|
|
|
@ -122,14 +122,11 @@ public class MesAssemblyMatchNosortRetrodictStepService extends BaseStepService
|
|
|
|
|
//搜集装配件条码
|
|
|
|
|
String assemblySn = equipVariableCollectContextList.stream().filter(o -> null != o).map(MesEquipVariableCollectContext::getEquipVariableValue).collect(Collectors.toList()).toString();
|
|
|
|
|
|
|
|
|
|
//未知腔数配置【工位参数】, 不验证装配件条码的个数
|
|
|
|
|
String cavityUnknownCfg = getCavityUnknownCfg(reqBean);
|
|
|
|
|
|
|
|
|
|
//根据设备代码获取可复用条码的个数
|
|
|
|
|
Integer repeatAssemblySnCount = productionCustomContextStepService.getRepeatAssemblySnCount(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), cellEquipContext.getEquipmentCode());
|
|
|
|
|
Integer repeatAssemblySnAmount = repeatAssemblySnCount * (!CollectionUtils.isEmpty(curProductionPsInContextList) ? curProductionPsInContextList.size() : 1);
|
|
|
|
|
//非未知腔数,验证装配件条码个数是否匹配 腔数或者未匹配的主条码个数*每腔个数
|
|
|
|
|
if (StringUtils.isEmpty(cavityUnknownCfg) && (equipVariableCollectContextList.size() + repeatAssemblySnAmount) != (!CollectionUtils.isEmpty(curProductionPsInContextList) ? curProductionPsInContextList.size() : cellEquipContext.getCavity()) * cellEquipContext.getBindQty()) {
|
|
|
|
|
Integer repeatAssemblySnAmount = repeatAssemblySnCount * (!CollectionUtils.isEmpty(curProductionPsInContextList) ? curProductionPsInContextList.size() : cellEquipContext.getCavity());
|
|
|
|
|
//验证装配件条码个数是否匹配 腔数或者未匹配的主条码个数*每腔个数
|
|
|
|
|
if ((equipVariableCollectContextList.size() + repeatAssemblySnAmount) != (!CollectionUtils.isEmpty(curProductionPsInContextList) ? curProductionPsInContextList.size() : cellEquipContext.getCavity()) * cellEquipContext.getBindQty()) {
|
|
|
|
|
String suffix = repeatAssemblySnAmount == 0 ? MesPcnExtConstWords.EMPTY : String.format(",可复用个数[%s]", repeatAssemblySnAmount);
|
|
|
|
|
if (!CollectionUtils.isEmpty(curProductionPsInContextList)) {
|
|
|
|
|
productionDispatchContextStepService.dispatchProductionPsInContext(reqBean, productionPsInContextList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getForeignKey()))).collect(Collectors.toList()));
|
|
|
|
@ -141,13 +138,16 @@ public class MesAssemblyMatchNosortRetrodictStepService extends BaseStepService
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//当前反向匹配最外层的遍历次数
|
|
|
|
|
Integer loopTimes = !CollectionUtils.isEmpty(productionPsInContextList) ? curProductionPsInContextList.size() : cellEquipContext.getCavity();
|
|
|
|
|
|
|
|
|
|
//获取设备下所有的装配件规则清单, 根据非排序加工规则ID分组
|
|
|
|
|
Map<Long, List<MesProductionAssemblyNosortContext>> assemblyNosortCfgMap = doHandleAssemblyNosortCfg(reqBean, resultBean, stepResult, cellEquipContext);
|
|
|
|
|
|
|
|
|
|
//无主条码则无加工规则, 有主条码可能无加工规则
|
|
|
|
|
prodRuleContextList = CollectionUtils.isEmpty(prodRuleContextList) ? new ArrayList<>() : prodRuleContextList;
|
|
|
|
|
//生成零件号业务处理
|
|
|
|
|
prodRuleContextList = doHandleAssemblyGeneratePartNo(reqBean, resultBean, stepResult, cellEquipContext, cavityUnknownCfg, productionProcessContext, productionPsInContextList, prodRuleContextList, assemblyNosortCfgMap, equipVariableCollectContextList);
|
|
|
|
|
prodRuleContextList = doHandleAssemblyGeneratePartNo(reqBean, resultBean, stepResult, cellEquipContext, loopTimes, productionProcessContext, productionPsInContextList, prodRuleContextList, assemblyNosortCfgMap, equipVariableCollectContextList);
|
|
|
|
|
|
|
|
|
|
String suffix = !CollectionUtils.isEmpty(curProductionPsInContextList) ? String.format("当前主条码%s", curProductionPsInContextList.stream().filter(o -> null != o).map(MesProductionPsInContext::getProductSn).collect(Collectors.toList()).toString()) : MesPcnExtConstWords.EMPTY;
|
|
|
|
|
|
|
|
|
@ -193,12 +193,6 @@ public class MesAssemblyMatchNosortRetrodictStepService extends BaseStepService
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//未知腔数配置【工位参数】
|
|
|
|
|
private String getCavityUnknownCfg(StationRequestBean reqBean) {
|
|
|
|
|
String cavityUnknownCfg = fsmCommonService.handleFsmWcpcMapDataForDoScan(reqBean).get(MesPcnExtConstWords.CAVITY_UNKNOWN_CFG);
|
|
|
|
|
return (!StringUtils.isEmpty(cavityUnknownCfg) && cavityUnknownCfg.equals(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr())) ? cavityUnknownCfg : null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取设备下所有的装配件规则清单, 根据非排序加工规则ID分组
|
|
|
|
|
private Map<Long, List<MesProductionAssemblyNosortContext>> doHandleAssemblyNosortCfg(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, MesCellEquipContext cellEquipContext) {
|
|
|
|
|
|
|
|
|
@ -224,7 +218,7 @@ public class MesAssemblyMatchNosortRetrodictStepService extends BaseStepService
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//生成零件号业务处理
|
|
|
|
|
private List<MesProdRuleContext> doHandleAssemblyGeneratePartNo(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, MesCellEquipContext cellEquipContext, String cavityUnknownCfg,
|
|
|
|
|
private List<MesProdRuleContext> doHandleAssemblyGeneratePartNo(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, MesCellEquipContext cellEquipContext, Integer loopTimes,
|
|
|
|
|
MesProductionProcessContext productionProcessContext, List<MesProductionPsInContext> productionPsInContextList, List<MesProdRuleContext> prodRuleContextList,
|
|
|
|
|
Map<Long, List<MesProductionAssemblyNosortContext>> assemblyNosortCfgMap, List<MesEquipVariableCollectContext> equipVariableCollectContextList) {
|
|
|
|
|
|
|
|
|
@ -235,6 +229,8 @@ public class MesAssemblyMatchNosortRetrodictStepService extends BaseStepService
|
|
|
|
|
Optional<MesProdRuleContext> maxForeignKeyOptional = CollectionUtils.isEmpty(prodRuleContextList) ? null : prodRuleContextList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getForeignKey()))).max(Comparator.comparing(MesProdRuleContext::getForeignKey));
|
|
|
|
|
Integer foreignKey = (null != maxForeignKeyOptional && maxForeignKeyOptional.isPresent()) ? maxForeignKeyOptional.get().getForeignKey() : MesPcnExtConstWords.ZERO;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < loopTimes; i ++) {
|
|
|
|
|
|
|
|
|
|
//遍历非排序加工规则ID
|
|
|
|
|
for (Map.Entry<Long, List<MesProductionAssemblyNosortContext>> entry : assemblyNosortCfgMap.entrySet()) {
|
|
|
|
|
|
|
|
|
@ -248,8 +244,8 @@ public class MesAssemblyMatchNosortRetrodictStepService extends BaseStepService
|
|
|
|
|
List<MesProductionAssemblyNosortContext> productionAssemblyNosortContextList = entry.getValue().stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getMatchType()) && MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.checkIsNeedScan(o.getMatchType()))).collect(Collectors.toList());
|
|
|
|
|
if (CollectionUtils.isEmpty(productionAssemblyNosortContextList)) continue;
|
|
|
|
|
|
|
|
|
|
//没有未知腔数配置, 剔除装配件规则个数不等于每腔个数的数据
|
|
|
|
|
if (StringUtils.isEmpty(cavityUnknownCfg) && cellEquipContext.getBindQty().compareTo(productionAssemblyNosortContextList.size()) != 0) continue;
|
|
|
|
|
//剔除装配件规则个数不等于每腔个数的数据
|
|
|
|
|
if (cellEquipContext.getBindQty().compareTo(productionAssemblyNosortContextList.size()) != 0) continue;
|
|
|
|
|
|
|
|
|
|
//收集未消费的临时数据
|
|
|
|
|
List<MesEquipVariableCollectContext> equipVariableCollectContextListTemp = DeepCloneUtil.deepCloneList(unConsumeList);
|
|
|
|
@ -386,6 +382,8 @@ public class MesAssemblyMatchNosortRetrodictStepService extends BaseStepService
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return prodRuleContextList;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|