Commit cf5b21b5 by wuwenlong

生产入款更新生产任务、生产计划完工数量及日期

parent 87ad59d9
...@@ -132,6 +132,34 @@ public class HGSCTools { ...@@ -132,6 +132,34 @@ public class HGSCTools {
} }
public static void complete(Long checkId, Integer completeNum){
HGZL002 hgzl002 = HGZLTools.THGZL002.get(checkId);
HGSC008 hgsc008 = THGSC008.getById(hgzl002.getWorkId());
HGSC007 hgsc007 = THGSC007.getById(hgsc008.getTaskId());
//更新生产任务完工数量
Integer finishQuatity = hgsc007.getFinishQuantity()+completeNum;
AssertUtils.isTrue(hgsc007.getQuantity().compareTo(finishQuatity)<0,"完工数量加已完工数量不能大于任务数量!");
AssertUtils.isTrue(finishQuatity<0,"扣除完工数量不能大于已完工数量!");
hgsc007.setFinishQuantity(finishQuatity);
hgsc007.setUnfinishQuantity(hgsc007.getQuantity() - finishQuatity);
hgsc007.setFinishWeight(hgsc007.getSingleWeight().multiply(new BigDecimal(finishQuatity)));
hgsc007.setUnfinishWeight(hgsc007.getSingleWeight().multiply(new BigDecimal(hgsc007.getUnfinishQuantity())));
if(hgsc007.getUnfinishQuantity()==0){
hgsc007.setCompleteDate(DateUtil.toDateStr(new Date(),DateUtil.DATE10_PATTERN));
}
DaoUtils.update(HGSC007.UPDATE,hgsc007);
HGSC006A hgsc006A = THGSC006A.getById(hgsc007.getOrderDetailId());
HGSC005A hgsc005A = THGSC005A.getById(hgsc006A.getPlanDetailId());
finishQuatity = hgsc005A.getFinishQuantity()+completeNum;
AssertUtils.isTrue(hgsc005A.getQuantity().compareTo(finishQuatity)<0,"完工数量加已完工数量不能大于任务数量!");
AssertUtils.isTrue(finishQuatity<0,"扣除完工数量不能大于已完工数量!");
hgsc005A.setFinishQuantity(finishQuatity);
hgsc005A.setUnfinishQuantity(hgsc005A.getQuantity() - finishQuatity);
hgsc005A.setFinishWeight(hgsc005A.getSingleWeight().multiply(new BigDecimal(finishQuatity)));
hgsc005A.setUnfinishWeight(hgsc005A.getSingleWeight().multiply(new BigDecimal(hgsc007.getUnfinishQuantity())));
DaoUtils.update(HGSC005A.UPDATE,hgsc005A);
}
public static class Hgsc001 { public static class Hgsc001 {
public static HGSC001 queryByCode(String code) { public static HGSC001 queryByCode(String code) {
AssertUtils.isNull(code, "项目Code不能为空!"); AssertUtils.isNull(code, "项目Code不能为空!");
...@@ -324,6 +352,12 @@ public class HGSCTools { ...@@ -324,6 +352,12 @@ public class HGSCTools {
public static class THGSC005A{ public static class THGSC005A{
public static HGSC005A getById(Long id){
AssertUtils.isTrue(Objects.isNull(id)||id<=0, "计划明细ID不能为空!");
HGSC005A results = (HGSC005A)DaoBase.getInstance().get(HGSC005A.QUERY, HGSC005A.FIELD_id, id);
return results;
}
public static List<HGSC005A> queryByPlanCodes(List<String> planCodes){ public static List<HGSC005A> queryByPlanCodes(List<String> planCodes){
AssertUtils.isEmpty(planCodes, "计划编码不能为空!"); AssertUtils.isEmpty(planCodes, "计划编码不能为空!");
Map paramMap = new HashMap(); Map paramMap = new HashMap();
...@@ -762,6 +796,12 @@ public class HGSCTools { ...@@ -762,6 +796,12 @@ public class HGSCTools {
} }
public static class THGSC008{ public static class THGSC008{
public static HGSC008 getById(Long taskId){
AssertUtils.isTrue(Objects.isNull(taskId)||taskId<=0, "报工单ID不能为空!");
HGSC008 results = (HGSC008)DaoBase.getInstance().get(HGSC008.QUERY, HGSC008.FIELD_id, taskId);
return results;
}
public static List<HGSC008> getByTaskId(Long taskId){ public static List<HGSC008> getByTaskId(Long taskId){
AssertUtils.isTrue(Objects.isNull(taskId)||taskId<=0, "生产任务ID不能为空!"); AssertUtils.isTrue(Objects.isNull(taskId)||taskId<=0, "生产任务ID不能为空!");
List<HGSC008> results = DaoBase.getInstance().query(HGSC008.QUERY, new HashMap<String,Object>(){{put(HGSC008.FIELD_task_id, taskId);}}); List<HGSC008> results = DaoBase.getInstance().query(HGSC008.QUERY, new HashMap<String,Object>(){{put(HGSC008.FIELD_task_id, taskId);}});
......
...@@ -87,6 +87,18 @@ public class HGZLTools { ...@@ -87,6 +87,18 @@ public class HGZLTools {
public static class THGZL002 { public static class THGZL002 {
/**
* @param id
*/
public static HGZL002 get(Long id) {
AssertUtils.isNull(id, "ID不能为空");
Map paramMap = new HashMap();
paramMap.put(HGZL002.FIELD_id, id);
List<HGZL002> results = DaoBase.getInstance().query(HGZL002.QUERY, paramMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
public static HGZL002 add(HGSC008 hgsc008) { public static HGZL002 add(HGSC008 hgsc008) {
HGZL002 hgzl002 = new HGZL002(); HGZL002 hgzl002 = new HGZL002();
BeanUtils.copyProperties(hgsc008, hgzl002); BeanUtils.copyProperties(hgsc008, hgzl002);
......
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