Merge branch 'test-temp-wj-250117-pack' into dev

dev-temp-nht-202502180000-customprint
王杰 4 months ago
commit 3b060d3496

@ -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;
}

@ -133,7 +133,7 @@ public class MesAssemblyScanStepService extends BaseStepService {
if (!CollectionUtils.isEmpty(cachedEquipVariableCollectContextList)) productionDispatchContextStepService.removeScanAssemblySnContext(reqBean);
//当前已扫描的装配件条码数量 + 可复用数量 * 当前未匹配的主条码数量
repeatAssemblySnAmount = repeatAssemblySnCount * (!CollectionUtils.isEmpty(curProductionPsInContextList) ? curProductionPsInContextList.size() : 1);
repeatAssemblySnAmount = repeatAssemblySnCount * (!CollectionUtils.isEmpty(curProductionPsInContextList) ? curProductionPsInContextList.size() : cellEquipContext.getCavity());
Integer scanedQty = (!CollectionUtils.isEmpty(cachedEquipVariableCollectContextList) ? cachedEquipVariableCollectContextList.size() : MesPcnExtConstWords.ZERO) + repeatAssemblySnAmount;
//判断当前已存在数量是否超过需要数量

@ -15,6 +15,7 @@ import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
import cn.estsh.i3plus.mes.pcn.actor.shipping.dispatch.IFsmRouteDataService;
import cn.estsh.i3plus.mes.pcn.api.iservice.busi.ISyncFuncService;
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService;
import cn.estsh.i3plus.mes.pcn.util.StringUtil;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.platform.common.tool.MathOperation;
import cn.estsh.i3plus.platform.common.tool.TimeTool;
@ -186,6 +187,12 @@ public class MesPackageNoGenerateStepService extends BaseStepService implements
doPrintPackageNo(reqBean, resultBean, stepResult, packageRuleContext, labelTemplate, strategyService, (List<MesPackage>) stepResult.getDataCollection(), false);
}
log.info("工厂{}生产线{}工位{}:FSM STATE DISPATCHER --- DO STEP --- {} EXEC --- PART:{} --- CACHED:{} --- PACKAGE:{}",
reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(),
StringUtil.toLowerCaseFirst(this.getClass().getSimpleName()), entry.getKey(),
CollectionUtils.isEmpty(packageDataContextList) ? MesPcnExtConstWords.SQUARE_BRACKETS : JSONObject.toJSONString(packageDataContextList),
CollectionUtils.isEmpty(stepResult.getDataCollection()) ? MesPcnExtConstWords.SQUARE_BRACKETS : JSONObject.toJSONString(stepResult.getDataCollection()));
}
//保存包装规则信息

Loading…
Cancel
Save