|
|
|
@ -99,40 +99,49 @@ public class MesStationMatchAssemblyStepService extends BaseStepService {
|
|
|
|
|
Map<String, MesStation> stationMap2Lock = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
//匹配装配件的工序用量
|
|
|
|
|
dispatchStationMatchAssembly(reqBean, resultBean, stepResult, workCenter, prodRuleContextList, containerPackageDetailContextList, stationMap2Lock);
|
|
|
|
|
Boolean isNeedSavePrc = dispatchStationMatchAssembly(reqBean, resultBean, stepResult, workCenter, prodRuleContextList, containerPackageDetailContextList, stationMap2Lock);
|
|
|
|
|
|
|
|
|
|
//保存上下文产品加工规则信息集合
|
|
|
|
|
if (isNeedSavePrc) {
|
|
|
|
|
productionDispatchContextStepService.dispatchProdRuleDataContext(reqBean, prodRuleContextList);
|
|
|
|
|
if (workCenter.getCenterType().compareTo(MesExtEnumUtil.WORK_CENTER_TYPE.NOSORT.getValue()) == 0)
|
|
|
|
|
((MesAssemblyShowNosortStepService) SpringContextsUtil.getBean("mesAssemblyShowNosortStepService")).showProductionAssembly(reqBean, resultBean, workCenter, prodRuleContextList);
|
|
|
|
|
else
|
|
|
|
|
((MesAssemblyShowSortStepService) SpringContextsUtil.getBean("mesAssemblyShowSortStepService")).showProductionAssembly(reqBean, resultBean, workCenter, prodRuleContextList, true, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!stepResult.isCompleted()) return stepNonCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult.nextTriggerEvent(MesPcnExtConstWords.NEXT_TRIGGER_EVENT_FEEDING), stepResult.getMsg());
|
|
|
|
|
|
|
|
|
|
//保存上下文产品加工规则信息集合
|
|
|
|
|
productionDispatchContextStepService.dispatchProdRuleDataContext(reqBean, prodRuleContextList);
|
|
|
|
|
//保存站点用于后面扣料业务中进行LOCK
|
|
|
|
|
productionDispatchContextStepService.dispatchLockStationContext(reqBean, stationMap2Lock);
|
|
|
|
|
|
|
|
|
|
if (workCenter.getCenterType().compareTo(MesExtEnumUtil.WORK_CENTER_TYPE.NOSORT.getValue()) == 0)
|
|
|
|
|
((MesAssemblyShowNosortStepService) SpringContextsUtil.getBean("mesAssemblyShowNosortStepService")).showProductionAssembly(reqBean, resultBean, workCenter, prodRuleContextList);
|
|
|
|
|
else
|
|
|
|
|
((MesAssemblyShowSortStepService) SpringContextsUtil.getBean("mesAssemblyShowSortStepService")).showProductionAssembly(reqBean, resultBean, workCenter, prodRuleContextList, true, true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, "站点匹配装配件验证成功!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//匹配装配件的工序用量【遍历加工规则】
|
|
|
|
|
private void dispatchStationMatchAssembly(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, MesWorkCenter workCenter,
|
|
|
|
|
private Boolean dispatchStationMatchAssembly(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, MesWorkCenter workCenter,
|
|
|
|
|
List<MesProdRuleContext> prodRuleContextList, List<MesContainerPackageDetailContext> containerPackageDetailContextList,
|
|
|
|
|
Map<String, MesStation> stationMap2Lock) {
|
|
|
|
|
Boolean isNeedSavePrc = false;
|
|
|
|
|
List<String> needFeedPartNoList = new ArrayList<>();
|
|
|
|
|
for (MesProdRuleContext prodRuleContext : prodRuleContextList) {
|
|
|
|
|
if (null == prodRuleContext || StringUtils.isEmpty(prodRuleContext.getIsMatchContainer())) continue;
|
|
|
|
|
List<MesProductionAssemblyContext> productionAssemblyContextList = dispatchStationMatchAssembly(reqBean, resultBean, stepResult, workCenter, prodRuleContext, containerPackageDetailContextList, stationMap2Lock);
|
|
|
|
|
if (!stepResult.isCompleted()) break;
|
|
|
|
|
prodRuleContext.assemblyDataJson(productionAssemblyContextList);
|
|
|
|
|
if (dispatchStationMatchAssembly(reqBean, resultBean, workCenter, prodRuleContext, containerPackageDetailContextList, stationMap2Lock, needFeedPartNoList)) isNeedSavePrc = true;
|
|
|
|
|
}
|
|
|
|
|
if (!CollectionUtils.isEmpty(needFeedPartNoList)) {
|
|
|
|
|
stepResult.isCompleted(false)
|
|
|
|
|
.msg(String.format("站点匹配装配件时验证零件号%s当前缺料,请扫描上料条码!",
|
|
|
|
|
(needFeedPartNoList.stream().filter(o -> !StringUtils.isEmpty(o)).distinct().collect(Collectors.toList())).toString()));
|
|
|
|
|
}
|
|
|
|
|
return isNeedSavePrc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//匹配装配件的工序用量【遍历装配件】
|
|
|
|
|
private List<MesProductionAssemblyContext> dispatchStationMatchAssembly(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, MesWorkCenter workCenter,
|
|
|
|
|
MesProdRuleContext prodRuleContext, List<MesContainerPackageDetailContext> containerPackageDetailContextList,
|
|
|
|
|
Map<String, MesStation> stationMap2Lock) {
|
|
|
|
|
private Boolean dispatchStationMatchAssembly(StationRequestBean reqBean, StationResultBean resultBean, MesWorkCenter workCenter,
|
|
|
|
|
MesProdRuleContext prodRuleContext, List<MesContainerPackageDetailContext> containerPackageDetailContextList,
|
|
|
|
|
Map<String, MesStation> stationMap2Lock, List<String> needFeedPartNoList) {
|
|
|
|
|
Boolean isNeedSavePrc = false;
|
|
|
|
|
|
|
|
|
|
List<MesProductionAssemblyContext> productionAssemblyContextList = prodRuleContext.getAssemblyDataContext(workCenter);
|
|
|
|
|
for (MesProductionAssemblyContext productionAssemblyContext : productionAssemblyContextList) {
|
|
|
|
|
if (null == productionAssemblyContext || productionAssemblyContext.getMatchType().compareTo(MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.MATCH_TYPE_80.getValue()) != 0) continue;
|
|
|
|
@ -180,21 +189,26 @@ public class MesStationMatchAssemblyStepService extends BaseStepService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (MathOperation.compareTo(unMatchQty, new Double(0)) > 0) {
|
|
|
|
|
productionAssemblyContext.setAssemblyStatus(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue());
|
|
|
|
|
productionAssemblyContext.setAssemblySn(null);
|
|
|
|
|
productionAssemblyContext.setMatchDatetime(null);
|
|
|
|
|
stepResult.isCompleted(false).msg(String.format("站点匹配装配件时验证零件号[%s]当前缺料,请扫描上料条码!", productionAssemblyContext.getAssemblyPartNo()));
|
|
|
|
|
break;
|
|
|
|
|
if (!StringUtils.isEmpty(productionAssemblyContext.getAssemblySn())) {
|
|
|
|
|
productionAssemblyContext.setAssemblyStatus(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue());
|
|
|
|
|
productionAssemblyContext.setAssemblySn(null);
|
|
|
|
|
productionAssemblyContext.setMatchDatetime(null);
|
|
|
|
|
isNeedSavePrc = true;
|
|
|
|
|
}
|
|
|
|
|
needFeedPartNoList.add(productionAssemblyContext.getPartNo());
|
|
|
|
|
} else {
|
|
|
|
|
productionAssemblyContext.setAssemblyStatus(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_10.getValue());
|
|
|
|
|
productionAssemblyContext.setAssemblySn(barCodeList.get(0));
|
|
|
|
|
productionAssemblyContext.setMatchDatetime((new SimpleDateFormat(MesPcnExtConstWords.DATE_FORMAT_SSS)).format(new Date()));
|
|
|
|
|
productionAssemblyContext.setContainerSnData(JSONObject.toJSONString(containerSnDataList));
|
|
|
|
|
isNeedSavePrc = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return productionAssemblyContextList;
|
|
|
|
|
if (isNeedSavePrc) prodRuleContext.assemblyDataJson(productionAssemblyContextList);
|
|
|
|
|
|
|
|
|
|
return isNeedSavePrc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|