Commit 81b7829e by wuwenlong

生产计划重量计算

parent 80f8ef06
...@@ -372,8 +372,10 @@ public class HGSCTools { ...@@ -372,8 +372,10 @@ public class HGSCTools {
HGSC005A uo = op.get(); HGSC005A uo = op.get();
uo.setQuantity(uo.getQuantity()+o.getQuantity()); uo.setQuantity(uo.getQuantity()+o.getQuantity());
uo.setUnfinishQuantity(uo.getUnfinishQuantity()+o.getQuantity()); uo.setUnfinishQuantity(uo.getUnfinishQuantity()+o.getQuantity());
handleWeight(hgsc005a,uo);
updateList.add(uo); updateList.add(uo);
}else{ }else{
handleWeight(hgsc005a,o);
createList.add(o); createList.add(o);
} }
}); });
...@@ -403,8 +405,10 @@ public class HGSCTools { ...@@ -403,8 +405,10 @@ public class HGSCTools {
HGSC005A uo = op.get(); HGSC005A uo = op.get();
uo.setQuantity(o.getQuantity()); uo.setQuantity(o.getQuantity());
uo.setUnfinishQuantity(o.getQuantity()-uo.getFinishQuantity()); uo.setUnfinishQuantity(o.getQuantity()-uo.getFinishQuantity());
handleWeight(hgsc005a,uo);
updateList.add(uo); updateList.add(uo);
}else{ }else{
handleWeight(hgsc005a,o);
createList.add(o); createList.add(o);
} }
}); });
...@@ -429,10 +433,12 @@ public class HGSCTools { ...@@ -429,10 +433,12 @@ public class HGSCTools {
oldObjMap.forEach((k,v)->{ oldObjMap.forEach((k,v)->{
HGSC005A oldObj = v.get(); HGSC005A oldObj = v.get();
if(oldObj.getQuantity()-hgsc005a.getQuantity()<=0){ if(oldObj.getQuantity()-hgsc005a.getQuantity()<=0){
handleWeight(hgsc005a,oldObj);
deleteIds.add(oldObj.getId()); deleteIds.add(oldObj.getId());
}else{ }else{
oldObj.setQuantity(oldObj.getQuantity()-hgsc005a.getQuantity()); oldObj.setQuantity(oldObj.getQuantity()-hgsc005a.getQuantity());
oldObj.setUnfinishQuantity(oldObj.getQuantity()-oldObj.getFinishQuantity()); oldObj.setUnfinishQuantity(oldObj.getQuantity()-oldObj.getFinishQuantity());
handleWeight(hgsc005a,oldObj);
updateList.add(oldObj); updateList.add(oldObj);
} }
}); });
...@@ -449,6 +455,15 @@ public class HGSCTools { ...@@ -449,6 +455,15 @@ public class HGSCTools {
} }
} }
private static void handleWeight(HGSC005A hgsc005a, HGSC005A target){
if(Objects.nonNull(hgsc005a.getSingleWeight())) {
target.setSingleWeight(hgsc005a.getSingleWeight());
target.setTotalWeight(hgsc005a.getSingleWeight().multiply(new BigDecimal(target.getQuantity())));
target.setFinishWeight(hgsc005a.getSingleWeight().multiply(new BigDecimal(target.getFinishQuantity())));
target.setUnfinishWeight(hgsc005a.getSingleWeight().multiply(new BigDecimal(target.getUnfinishQuantity())));
}
}
/** /**
* 校验修改的数据 * 校验修改的数据
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment