|
|
|
@ -91,7 +91,8 @@ public class MesAssemblyShowNosortStepService extends BaseStepService {
|
|
|
|
|
doHandleProdRuleData(reqBean, resultBean, stepResult, workCenter, productionProcessContext, cellEquipContext, prodRuleContextList, productionPartContextList, productionPsInContextList);
|
|
|
|
|
|
|
|
|
|
//匹配失败需要清除本次扫描/读取信息
|
|
|
|
|
if (!stepResult.isCompleted() && doBusiCheckToDelete(reqBean, productionPartContextList, productionPsInContextList)) return stepResult;
|
|
|
|
|
if (!stepResult.isCompleted() && doBusiCheckToDelete(reqBean, stepResult, productionPartContextList, productionPsInContextList))
|
|
|
|
|
return stepResult.nextTriggerEvent(CollectionUtils.isEmpty(productionPsInContextList) ? MesPcnExtConstWords.NEXT_TRIGGER_EVENT_ORDER : (!StringUtils.isEmpty(stepResult.getObj()) ? MesPcnExtConstWords.NEXT_TRIGGER_EVENT_ORDER : MesPcnExtConstWords.NEXT_TRIGGER_EVENT_PRODUCT_SN));
|
|
|
|
|
|
|
|
|
|
if (prodRuleContextList.size() != initSize) {
|
|
|
|
|
//保存上下文产品加工规则信息集合
|
|
|
|
@ -206,31 +207,21 @@ public class MesAssemblyShowNosortStepService extends BaseStepService {
|
|
|
|
|
double complateQty = mesWorkOrder.getCompleteQty() + productionPartContexts.size();
|
|
|
|
|
double qty = mesWorkOrder.getQty();
|
|
|
|
|
// 如果预完成数量 小于等于工单数量,则直接过
|
|
|
|
|
if (complateQty <= qty) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (complateQty <= qty) continue;
|
|
|
|
|
|
|
|
|
|
// 以下则是超工单逻辑
|
|
|
|
|
// 如果产线中没有配置超工单,则直接阻断
|
|
|
|
|
if (!Objects.equals(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(), workCenter.getIsCheckOrderQty())) {
|
|
|
|
|
productionPartContextList.forEach(o -> o.busiCheckToDelete());
|
|
|
|
|
if (!CollectionUtils.isEmpty(productionPsInContextList)) {
|
|
|
|
|
productionPsInContextList.forEach(o -> o.busiCheckToDelete());
|
|
|
|
|
}
|
|
|
|
|
return execNonCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, String.format(
|
|
|
|
|
"请检查工单数量,工单号[%s],工单数量[%s]预完成数量[%s],且未配置超工单",
|
|
|
|
|
workOrder, mesWorkOrder.getQty(), complateQty));
|
|
|
|
|
if (!CollectionUtils.isEmpty(productionPsInContextList)) productionPsInContextList.forEach(o -> o.busiCheckToDelete());
|
|
|
|
|
return execNonCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult.obj(false), String.format("请检查工单数量,工单号[%s],工单数量[%s]预完成数量[%s],且未配置超工单!", workOrder, mesWorkOrder.getQty(), complateQty));
|
|
|
|
|
}
|
|
|
|
|
// 如果配置了超工单,且比例已经超过了配置的超工单比例,也需要阻断
|
|
|
|
|
double rate = (complateQty - qty)/qty;
|
|
|
|
|
if (rate > workCenter.getOrderRate()) {
|
|
|
|
|
if (CollectionUtils.isEmpty(productionPsInContextList)) {
|
|
|
|
|
productionPartContextList.forEach(o -> o.busiCheckToDelete());
|
|
|
|
|
} else {
|
|
|
|
|
productionPsInContextList.forEach(o -> o.busiCheckToDelete());
|
|
|
|
|
}
|
|
|
|
|
return execNonCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, String.format(
|
|
|
|
|
"请检查工单数量,工单号[%s],工单数量[%s]预完成数量[%s],配置了超工单,但超过了比例[%s]",
|
|
|
|
|
workOrder, mesWorkOrder.getQty(), complateQty, workCenter.getOrderRate()));
|
|
|
|
|
if (!CollectionUtils.isEmpty(productionPsInContextList)) productionPsInContextList.forEach(o -> o.busiCheckToDelete());
|
|
|
|
|
return execNonCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult.obj(false), String.format("请检查工单数量,工单号[%s],工单数量[%s]预完成数量[%s],配置了超工单,但超过了比例[%s]!", workOrder, mesWorkOrder.getQty(), complateQty, workCenter.getOrderRate()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return stepResult;
|
|
|
|
@ -484,12 +475,13 @@ public class MesAssemblyShowNosortStepService extends BaseStepService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//清除本次扫描/读取信息 有进料【只】需要清除进料,否则存在产出零件需要清除产出零件 【只需要清除被标记的数据】
|
|
|
|
|
private Boolean doBusiCheckToDelete(StationRequestBean reqBean, List<MesProductionPartContext> productionPartContextList, List<MesProductionPsInContext> productionPsInContextList) {
|
|
|
|
|
if (!CollectionUtils.isEmpty(productionPsInContextList)) productionDispatchContextStepService.saveProductionPsInContext(reqBean,
|
|
|
|
|
productionPsInContextList.stream().filter(o -> (null != o && o.getBusiCheckToDelete().compareTo(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()) == 0)).collect(Collectors.toList()));
|
|
|
|
|
else if (!CollectionUtils.isEmpty(productionPartContextList)) {
|
|
|
|
|
productionDispatchContextStepService.saveProductionPartContext(reqBean,
|
|
|
|
|
productionPartContextList.stream().filter(o -> (null != o && o.getBusiCheckToDelete().compareTo(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()) == 0)).collect(Collectors.toList()));
|
|
|
|
|
private Boolean doBusiCheckToDelete(StationRequestBean reqBean, StepResult stepResult, List<MesProductionPartContext> productionPartContextList, List<MesProductionPsInContext> productionPsInContextList) {
|
|
|
|
|
if (!CollectionUtils.isEmpty(productionPsInContextList) && StringUtils.isEmpty(stepResult.getObj())) {
|
|
|
|
|
productionDispatchContextStepService.saveProductionPsInContext(reqBean, productionPsInContextList.stream().filter(o -> (null != o && o.getBusiCheckToDelete().compareTo(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()) == 0)).collect(Collectors.toList()));
|
|
|
|
|
} else if (!CollectionUtils.isEmpty(productionPartContextList)) {
|
|
|
|
|
if (!StringUtils.isEmpty(stepResult.getObj())) productionDispatchContextStepService.deleteProductionPsInContext(reqBean);
|
|
|
|
|
productionDispatchContextStepService.deleteProductionPartContext(reqBean);
|
|
|
|
|
productionDispatchContextStepService.deleteProdRuleDataContext(reqBean);
|
|
|
|
|
productionProcessContextStepService.deleteFunctionChooseCavityOrderContext(reqBean);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|