|
|
|
@ -18,6 +18,7 @@ import cn.estsh.i3plus.pojo.mes.model.StationRequestBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.model.StationResultBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.model.StepResult;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.SpringContextsUtil;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
@ -29,6 +30,7 @@ import java.util.*;
|
|
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
import java.util.concurrent.locks.ReentrantLock;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Description : 站点扣减装配件工步
|
|
|
|
@ -114,12 +116,18 @@ public class MesStationDeductionAssemblyStepService extends BaseStepService {
|
|
|
|
|
Map<String, MesContainerPackageDetailContext> remainQtyMap2Cache = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
//执行容器装配件的缓存扣减
|
|
|
|
|
dispatchStationDeductionAssembly(reqBean, resultBean, stepResult, workCenter, prodRuleContextList, remainQtyMap2Cache);
|
|
|
|
|
|
|
|
|
|
if (!stepResult.isCompleted()) return stepNonCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult.nextTriggerEvent(MesPcnExtConstWords.NEXT_TRIGGER_EVENT_FEEDING), stepResult.getMsg());
|
|
|
|
|
Boolean isNeedSavePrc = dispatchStationDeductionAssembly(reqBean, resultBean, stepResult, workCenter, prodRuleContextList, remainQtyMap2Cache);
|
|
|
|
|
|
|
|
|
|
//保存上下文产品加工规则信息集合
|
|
|
|
|
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());
|
|
|
|
|
|
|
|
|
|
//重置原料条码的缓存库存
|
|
|
|
|
productionCustomContextStepService.dispatchContainerPackageDetailContext(reqBean.getOrganizeCode(), remainQtyMap2Cache);
|
|
|
|
@ -138,21 +146,27 @@ public class MesStationDeductionAssemblyStepService extends BaseStepService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//执行容器装配件的缓存扣减
|
|
|
|
|
private void dispatchStationDeductionAssembly(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, MesWorkCenter workCenter,
|
|
|
|
|
private Boolean dispatchStationDeductionAssembly(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, MesWorkCenter workCenter,
|
|
|
|
|
List<MesProdRuleContext> prodRuleContextList, Map<String, MesContainerPackageDetailContext> remainQtyMap2Cache) {
|
|
|
|
|
|
|
|
|
|
Boolean isNeedSavePrc = false;
|
|
|
|
|
List<String> needFeedPartNoList = new ArrayList<>();
|
|
|
|
|
for (MesProdRuleContext prodRuleContext : prodRuleContextList) {
|
|
|
|
|
if (null == prodRuleContext || StringUtils.isEmpty(prodRuleContext.getIsMatchContainer())) continue;
|
|
|
|
|
List<MesProductionAssemblyContext> productionAssemblyContextList = dispatchStationDeductionAssembly(reqBean, resultBean, stepResult, workCenter, prodRuleContext, remainQtyMap2Cache);
|
|
|
|
|
if (!stepResult.isCompleted()) break;
|
|
|
|
|
prodRuleContext.assemblyDataJson(productionAssemblyContextList);
|
|
|
|
|
if (dispatchStationDeductionAssembly(reqBean, resultBean, workCenter, prodRuleContext, remainQtyMap2Cache, 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> dispatchStationDeductionAssembly(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, MesWorkCenter workCenter,
|
|
|
|
|
MesProdRuleContext prodRuleContext, Map<String, MesContainerPackageDetailContext> remainQtyMap2Cache) {
|
|
|
|
|
private Boolean dispatchStationDeductionAssembly(StationRequestBean reqBean, StationResultBean resultBean, MesWorkCenter workCenter,
|
|
|
|
|
MesProdRuleContext prodRuleContext, Map<String, MesContainerPackageDetailContext> remainQtyMap2Cache, List<String> needFeedPartNoList) {
|
|
|
|
|
|
|
|
|
|
Boolean isNeedSavePrc = false;
|
|
|
|
|
|
|
|
|
|
List<MesProductionAssemblyContext> productionAssemblyContextList = prodRuleContext.getAssemblyDataContext(workCenter);
|
|
|
|
|
for (MesProductionAssemblyContext productionAssemblyContext : productionAssemblyContextList) {
|
|
|
|
@ -214,17 +228,20 @@ public class MesStationDeductionAssemblyStepService extends BaseStepService {
|
|
|
|
|
productionAssemblyContext.setAssemblyStatus(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue());
|
|
|
|
|
productionAssemblyContext.setAssemblySn(null);
|
|
|
|
|
productionAssemblyContext.setMatchDatetime(null);
|
|
|
|
|
isNeedSavePrc = true;
|
|
|
|
|
}
|
|
|
|
|
stepResult.isCompleted(false).msg(String.format("站点扣减装配件时验证零件号[%s]当前缺料,请扫描上料条码!", productionAssemblyContext.getAssemblyPartNo()));
|
|
|
|
|
break;
|
|
|
|
|
needFeedPartNoList.add(productionAssemblyContext.getPartNo());
|
|
|
|
|
} else {
|
|
|
|
|
productionAssemblyContext.setAssemblySn(barCodeList.get(0));
|
|
|
|
|
productionAssemblyContext.setContainerSnData(JSONObject.toJSONString(deductionContextList));
|
|
|
|
|
isNeedSavePrc = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return productionAssemblyContextList;
|
|
|
|
|
if (isNeedSavePrc) prodRuleContext.assemblyDataJson(productionAssemblyContextList);
|
|
|
|
|
|
|
|
|
|
return isNeedSavePrc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|