[Bug #962] Refactor addNewLineAdvanceAssignment
FEA: ItEr73S04BugFixing
This commit is contained in:
parent
059974d8d5
commit
0efbdff9ba
3 changed files with 16 additions and 14 deletions
|
|
@ -50,7 +50,7 @@ public interface IManageOrderElementAdvancesModel {
|
|||
|
||||
public void initEdit(OrderElement orderElement);
|
||||
|
||||
public boolean addNewLineAdvaceAssignment();
|
||||
public boolean addNewLineAdvanceAssignment();
|
||||
|
||||
public AdvanceMeasurement addNewLineAdvaceMeasurement();
|
||||
|
||||
|
|
|
|||
|
|
@ -267,7 +267,7 @@ public class ManageOrderElementAdvancesController extends
|
|||
public void goToCreateLineAdvanceAssignment() {
|
||||
findErrorsInMeasurements();
|
||||
boolean fineResult = manageOrderElementAdvancesModel
|
||||
.addNewLineAdvaceAssignment();
|
||||
.addNewLineAdvanceAssignment();
|
||||
if (fineResult) {
|
||||
int position = getAdvanceAssignments().size() - 1;
|
||||
selectAdvanceLine(position);
|
||||
|
|
|
|||
|
|
@ -279,28 +279,30 @@ public class ManageOrderElementAdvancesModel implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean addNewLineAdvaceAssignment() {
|
||||
public boolean addNewLineAdvanceAssignment() {
|
||||
DirectAdvanceAssignment newAdvance = DirectAdvanceAssignment.create();
|
||||
newAdvance.setOrderElement(this.orderElement);
|
||||
newAdvance.setOrderElement(orderElement);
|
||||
|
||||
/*
|
||||
* set the first advance type of the list as the default
|
||||
*/
|
||||
// Set first advance type of the list as default
|
||||
List<AdvanceType> listAdvanceType = getPossibleAdvanceTypes(newAdvance);
|
||||
if (!listAdvanceType.isEmpty()) {
|
||||
newAdvance.setAdvanceType(listAdvanceType.get(0));
|
||||
newAdvance.setMaxValue(getMaxValue(listAdvanceType.get(0)));
|
||||
} else {
|
||||
if (listAdvanceType.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (listAdvanceAssignments.isEmpty()) {
|
||||
newAdvance.setReportGlobalAdvance(true);
|
||||
}
|
||||
// Create new progress type and add it to list
|
||||
final AdvanceType progressType = first(listAdvanceType);
|
||||
newAdvance.setAdvanceType(progressType);
|
||||
newAdvance.setMaxValue(getMaxValue(progressType));
|
||||
newAdvance.setReportGlobalAdvance(listAdvanceAssignments.isEmpty());
|
||||
listAdvanceAssignments.add(newAdvance);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private AdvanceType first(List<AdvanceType> listAdvanceType) {
|
||||
return listAdvanceType.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal getMaxValue(AdvanceType advanceType) {
|
||||
if (advanceType != null) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue