|
|
|
|
@ -2045,6 +2045,94 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void qualified(WorkPlan wp, WorkOrder wo) { |
|
|
|
|
// 检验完成修改车间订单状态(注意如果wp中状态是已完成,则不更改订单状态和工序状态,只对后续工序的接收数和完工数进行更改)
|
|
|
|
|
WorkPlan nextWorkPlan = workPlanService.getById(wp.getNextWpId()); |
|
|
|
|
if (wp.getStatus() < WorkPlan.STATUS_COMPLETE) { |
|
|
|
|
wp.setStatus(WorkPlan.STATUS_WORK_OK); |
|
|
|
|
if (wo.getMakeQty() != null && wo.getMakeQty() == 0) { |
|
|
|
|
wo.setRunStatus(WorkOrder.RUN_STATUS_SCRAP); |
|
|
|
|
} else { |
|
|
|
|
wo.setRunStatus(WorkOrder.RUN_STATUS_RECEIVE); |
|
|
|
|
} |
|
|
|
|
WorkOrderRun wor = workOrderRunService.getById(wo.getWorId()); |
|
|
|
|
WorkPlan frontWorkPlan = workPlanService.getById(wp.getFrontWpId()); |
|
|
|
|
// if (wor != null && StringUtils.isNotBlank(wor.getDeliverKey())) {
|
|
|
|
|
// 判断下序没有外协商单位,或者上序的外协商和下序的外协商不一致,调用接口关闭外协信息
|
|
|
|
|
// if ((nextWorkPlan == null || nextWorkPlan.getOcId() == null || (frontWorkPlan.getOcId() != null && !frontWorkPlan.getOcId().equals(nextWorkPlan.getOcId())))) {
|
|
|
|
|
//调用erp检验接口
|
|
|
|
|
// prWorkCheckService.checkCompleteErpBackFill(wor.getWoCode(), wor.getDeliverKey(), wp.getWorkQty(), 0, wc.getCheckMan());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//检查下序与上序工序外协单位是否一样,如果一样直接接收报工
|
|
|
|
|
this.collaborative(wp, frontWorkPlan, nextWorkPlan, true, wo); |
|
|
|
|
} else { |
|
|
|
|
//开始更改后续工序的数量
|
|
|
|
|
this.getNextWorkPlan(wp, nextWorkPlan); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void getNextWorkPlan(WorkPlan currWp, WorkPlan nextWorkPlan) { |
|
|
|
|
// 如果下序的状态大于未开始则处理,否则停止(不分派工序(检验和镀后入库)直接跳过)
|
|
|
|
|
if (nextWorkPlan != null && nextWorkPlan.getStatus() > WorkPlan.STATUS_NO_START) { |
|
|
|
|
BsProcessSetEntity processSet = bsProcessSetService.getById(nextWorkPlan.getPpsId()); |
|
|
|
|
if ("1".equals(processSet.getIsDispatch())) { |
|
|
|
|
if (nextWorkPlan.getQualifiedQty() > 0) { |
|
|
|
|
nextWorkPlan.setQualifiedQty(currWp.getQualifiedQty()); |
|
|
|
|
} |
|
|
|
|
if (nextWorkPlan.getWorkQty() > 0) { |
|
|
|
|
nextWorkPlan.setWorkQty(currWp.getWorkQty()); |
|
|
|
|
} |
|
|
|
|
//开始处理报工信息(只处理报工记录是一条的情况,多条情况不处理)
|
|
|
|
|
List<MakeRec> macList = makeRecService.list(Wrappers.lambdaQuery(MakeRec.class).eq(MakeRec::getWpId, nextWorkPlan.getId())); |
|
|
|
|
if (macList != null && macList.size() == 1) { |
|
|
|
|
for (MakeRec mac : macList) { |
|
|
|
|
mac.setWorkQty(currWp.getWorkQty()); |
|
|
|
|
makeRecService.updateById(mac); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
WorkPlan nextWorkPlan2 = workPlanService.getById(nextWorkPlan.getNextWpId()); |
|
|
|
|
this.getNextWorkPlan(nextWorkPlan, nextWorkPlan2); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void collaborative(WorkPlan wp, WorkPlan frontWorkPlan, WorkPlan nextWorkPlan, boolean isFirst, WorkOrder wo) { |
|
|
|
|
if (nextWorkPlan == null || nextWorkPlan.getOcId() == null) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
Long currentOcId; |
|
|
|
|
Date factEndTime; |
|
|
|
|
if (isFirst) { |
|
|
|
|
if (frontWorkPlan == null || frontWorkPlan.getOcId() == null) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
factEndTime = frontWorkPlan.getFactEndTime(); |
|
|
|
|
currentOcId = frontWorkPlan.getOcId(); |
|
|
|
|
} else { |
|
|
|
|
if (wp == null || wp.getOcId() == null) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
currentOcId = wp.getOcId(); |
|
|
|
|
factEndTime = wp.getFactStartTime(); |
|
|
|
|
} |
|
|
|
|
Long nextOcId = nextWorkPlan.getOcId(); |
|
|
|
|
if (!currentOcId.equals(nextOcId)) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.workPlanEnd(wp, new Date(), wo.getMakeQty()); |
|
|
|
|
|
|
|
|
|
//开始下序
|
|
|
|
|
this.workPlanStart(nextWorkPlan, factEndTime, null, wo); |
|
|
|
|
|
|
|
|
|
WorkPlan frontWorkPlan2 = workPlanService.getById(nextWorkPlan.getFrontWpId()); |
|
|
|
|
WorkPlan nextWorkPlan2 = workPlanService.getById(nextWorkPlan.getNextWpId()); |
|
|
|
|
this.collaborative(nextWorkPlan, frontWorkPlan2, nextWorkPlan2, false, wo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void workPlanEnd(WorkPlan workPlan, Date newDate, Double makeQty) { |
|
|
|
|
if (workPlan == null) { |
|
|
|
|
return; |
|
|
|
|
|