|
|
|
@ -86,18 +86,18 @@ public class MesAssemblyScanStepService extends BaseStepService {
|
|
|
|
|
Integer busiType = getBusiType(productionPsInContextListNoFinishCode, prodRuleContextList);
|
|
|
|
|
|
|
|
|
|
//验证场景1 当前是否需要扫描装配件条码: 是否存在装配件清单 【当前验证只能对内部触发生效】
|
|
|
|
|
if (busiType == 1 && !CollectionUtils.isEmpty(prodRuleContextList) && !checkIsNeedScanAssembly(prodRuleContextList))
|
|
|
|
|
if (busiType == BUSI_TYPE.ONE.value && !CollectionUtils.isEmpty(prodRuleContextList) && !checkIsNeedScanAssembly(prodRuleContextList))
|
|
|
|
|
return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, "当前加工规则未配置装配件扫描项,当前无需扫描装配件条码!");
|
|
|
|
|
|
|
|
|
|
//场景1 处理装配件的装配爆炸图和音频文件
|
|
|
|
|
if (busiType == 1) doHandleAssemblyFile(reqBean, productionProcessContext.getWorkCenter(), prodRuleContextList);
|
|
|
|
|
if (busiType == BUSI_TYPE.ONE.value) doHandleAssemblyFile(reqBean, productionProcessContext.getWorkCenter(), prodRuleContextList);
|
|
|
|
|
|
|
|
|
|
//验证场景1 当前是否需要扫描装配件条码: 验证是否存在待绑定数据 【当前验证只能对内部触发生效】
|
|
|
|
|
if (busiType == 1 && !CollectionUtils.isEmpty(prodRuleContextList) && !hasUnBindAssembly(prodRuleContextList))
|
|
|
|
|
if (busiType == BUSI_TYPE.ONE.value && !CollectionUtils.isEmpty(prodRuleContextList) && !hasUnBindAssembly(prodRuleContextList))
|
|
|
|
|
return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, "当前加工规则对应的装配件清单已扫描完毕,当前无需扫描装配件条码!");
|
|
|
|
|
|
|
|
|
|
//验证场景3的当前未匹配的主条码是否是空腔码
|
|
|
|
|
if (busiType == 3 && CollectionUtils.isEmpty(curProductionPsInContextList))
|
|
|
|
|
if (busiType == BUSI_TYPE.THREE.value && CollectionUtils.isEmpty(curProductionPsInContextList))
|
|
|
|
|
return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, "当前主条码对应的装配件清单已扫描完毕,当前无需扫描装配件条码!");
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(scanInfo)) stepSendGuideAndThrowEx(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), "请扫描装配件条码!");
|
|
|
|
@ -115,7 +115,7 @@ public class MesAssemblyScanStepService extends BaseStepService {
|
|
|
|
|
Integer needQty = getNeedQty(busiType, cellEquipContext, curProductionPsInContextList);
|
|
|
|
|
|
|
|
|
|
//非场景1的情况下代表需要反向匹配出加工规则, 需要根据设备腔数直接批量扫描 生成零件号
|
|
|
|
|
if (busiType != 1) {
|
|
|
|
|
if (busiType != BUSI_TYPE.ONE.value) {
|
|
|
|
|
|
|
|
|
|
//根据设备代码获取可复用条码的个数
|
|
|
|
|
Integer repeatAssemblySnCount = productionCustomContextStepService.getRepeatAssemblySnCount(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), cellEquipContext.getEquipmentCode());
|
|
|
|
@ -145,7 +145,7 @@ public class MesAssemblyScanStepService extends BaseStepService {
|
|
|
|
|
productionDispatchContextStepService.dispatchScanAssemblySnContext(reqBean, equipVariableCollectContextList);
|
|
|
|
|
|
|
|
|
|
//唯一加工规则场景 默认扫描一次 匹配一次 循环处理直到当前的加工规则全部匹配完毕
|
|
|
|
|
if (busiType == 1) return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.SCAN.getValue()).scanInfo(scanInfo), stepResult, String.format("当前扫描信息装配件条码[%s]!", scanInfo));
|
|
|
|
|
if (busiType == BUSI_TYPE.ONE.value) return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.SCAN.getValue()).scanInfo(scanInfo), stepResult, String.format("当前扫描信息装配件条码[%s]!", scanInfo));
|
|
|
|
|
|
|
|
|
|
if (equipVariableCollectContextList.size() == needQty) return stepSuccessCompleteAndSendMsgReturn(
|
|
|
|
|
reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.SCAN.getValue()).scanInfo(scanInfo), stepResult, String.format("当前扫描信息装配件条码[%s],已扫描个数[%s]!", scanInfo, equipVariableCollectContextList.size() + "/" + needQty));
|
|
|
|
@ -157,15 +157,15 @@ public class MesAssemblyScanStepService extends BaseStepService {
|
|
|
|
|
|
|
|
|
|
//判断业务场景: 1=唯一加工规则场景; 2=无进无出扫装配件生成零件号场景; 3=有进未匹配加工规则扫装配件生成零件号场景
|
|
|
|
|
private Integer getBusiType(List<MesProductionPsInContext> productionPsInContextListNoFinishCode, List<MesProdRuleContext> prodRuleContextList) {
|
|
|
|
|
if (CollectionUtils.isEmpty(productionPsInContextListNoFinishCode) && CollectionUtils.isEmpty(prodRuleContextList)) return 2;
|
|
|
|
|
if (!CollectionUtils.isEmpty(productionPsInContextListNoFinishCode) && (CollectionUtils.isEmpty(prodRuleContextList) || productionPsInContextListNoFinishCode.size() != prodRuleContextList.size())) return 3;
|
|
|
|
|
return 1;
|
|
|
|
|
if (CollectionUtils.isEmpty(productionPsInContextListNoFinishCode) && CollectionUtils.isEmpty(prodRuleContextList)) return BUSI_TYPE.TWO.value;
|
|
|
|
|
if (!CollectionUtils.isEmpty(productionPsInContextListNoFinishCode) && (CollectionUtils.isEmpty(prodRuleContextList) || productionPsInContextListNoFinishCode.size() != prodRuleContextList.size())) return BUSI_TYPE.THREE.value;
|
|
|
|
|
return BUSI_TYPE.ONE.value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//需要扫描的绑定数量
|
|
|
|
|
private Integer getNeedQty(Integer busiType, MesCellEquipContext cellEquipContext, List<MesProductionPsInContext> curProductionPsInContextList) {
|
|
|
|
|
if (busiType == 1) return 1;
|
|
|
|
|
if (busiType == 2) return cellEquipContext.getCavity() * cellEquipContext.getBindQty();
|
|
|
|
|
if (busiType == BUSI_TYPE.ONE.value) return 1;
|
|
|
|
|
if (busiType == BUSI_TYPE.TWO.value) return cellEquipContext.getCavity() * cellEquipContext.getBindQty();
|
|
|
|
|
return curProductionPsInContextList.size() * cellEquipContext.getBindQty();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -264,4 +264,35 @@ public class MesAssemblyScanStepService extends BaseStepService {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//装配件扫描的业务场景
|
|
|
|
|
enum BUSI_TYPE {
|
|
|
|
|
|
|
|
|
|
ONE(1, "唯一加工规则场景"),//通过 产出零件 + 进料条码零件 + 设备 找到唯一的非排序产品加工规则, 产出零件与进料条码零件至少存在1个
|
|
|
|
|
|
|
|
|
|
TWO(2, "无进无出扫装配件生成零件号场景"),//产出零件与进料条码零件均不扫描, 直接扫描装配件, 通过生成零件号工步反向匹配非排序产品加工规则
|
|
|
|
|
|
|
|
|
|
THREE(3, "有进未匹配加工规则扫装配件生成零件号场景");//产出零件不扫描, 扫描进料条码零件 + 设备 会对应多个非排序产品加工规则, 通过扫描装配件, 生成零件号工步反向匹配非排序产品加工规则, 将匹配的规则再匹配进料条码零件
|
|
|
|
|
|
|
|
|
|
private Integer value;
|
|
|
|
|
|
|
|
|
|
private String description;
|
|
|
|
|
|
|
|
|
|
BUSI_TYPE(Integer value, String description) {
|
|
|
|
|
|
|
|
|
|
this.value = value;
|
|
|
|
|
|
|
|
|
|
this.description = description;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Integer getValue() {
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getDescription() {
|
|
|
|
|
return description;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|