|
|
|
@ -97,13 +97,13 @@ public class MesAssemblyMatchSortStepService extends BaseStepService {
|
|
|
|
|
//验证当前是否属于装配件跳过码
|
|
|
|
|
Boolean isSkip = checkIsSkip(productionProcessContext, equipVariableCollectContextList);
|
|
|
|
|
//验证当前是否属于装配件整腔跳过码
|
|
|
|
|
Boolean isCavitySkip = checkIsCavitySkip(productionProcessContext, equipVariableCollectContextList, prodRuleContextList, stepResult);
|
|
|
|
|
Boolean isCavitySkip = checkIsCavitySkip(productionProcessContext, equipVariableCollectContextList);
|
|
|
|
|
|
|
|
|
|
//处理待验证的装配件条码 [扫描模式匹配成功返回true, 否则返回flase, 非扫描模式需要验证是否全部匹配完成]
|
|
|
|
|
Boolean result = isCavitySkip ? true : doHandleMatchAssembly(reqBean, stepResult, prodRuleContextList, equipVariableCollectContextList, isSkip);
|
|
|
|
|
Boolean result = doHandleMatchAssembly(reqBean, stepResult, prodRuleContextList, equipVariableCollectContextList, isSkip, isCavitySkip);
|
|
|
|
|
|
|
|
|
|
//验证是否存在待绑定数据
|
|
|
|
|
hasUnBindAssembly = isCavitySkip ? true : hasUnBindAssembly(prodRuleContextList);
|
|
|
|
|
hasUnBindAssembly = hasUnBindAssembly(prodRuleContextList);
|
|
|
|
|
|
|
|
|
|
//搜集装配件条码
|
|
|
|
|
String suffix = MesPcnExtConstWords.EMPTY;
|
|
|
|
@ -172,12 +172,10 @@ public class MesAssemblyMatchSortStepService extends BaseStepService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//验证当前是否属于装配件整腔跳过码
|
|
|
|
|
private Boolean checkIsCavitySkip(MesProductionProcessContext productionProcessContext, List<MesEquipVariableCollectContext> equipVariableCollectContextList, List<MesProdRuleContext> prodRuleContextList, StepResult stepResult) {
|
|
|
|
|
private Boolean checkIsCavitySkip(MesProductionProcessContext productionProcessContext, List<MesEquipVariableCollectContext> equipVariableCollectContextList) {
|
|
|
|
|
if (equipVariableCollectContextList.size() > 1) return false;
|
|
|
|
|
if (equipVariableCollectContextList.get(0).getMessageSource().compareTo(MesExtEnumUtil.CELL_MESSAGE_SOURCE.SCAN.getValue()) != 0) return false;
|
|
|
|
|
if (!equipVariableCollectContextList.get(0).getEquipVariableValue().equals(productionProcessContext.getAssemblyCavitySkipCode())) return false;
|
|
|
|
|
|
|
|
|
|
//TODO
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -206,7 +204,7 @@ public class MesAssemblyMatchSortStepService extends BaseStepService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//处理待验证的装配件条码 [扫描模式匹配成功返回true, 否则返回flase, 非扫描模式需要验证是否全部匹配完成]
|
|
|
|
|
private Boolean doHandleMatchAssembly(StationRequestBean reqBean, StepResult stepResult, List<MesProdRuleContext> prodRuleContextList, List<MesEquipVariableCollectContext> equipVariableCollectContextList, Boolean isSkip) {
|
|
|
|
|
private Boolean doHandleMatchAssembly(StationRequestBean reqBean, StepResult stepResult, List<MesProdRuleContext> prodRuleContextList, List<MesEquipVariableCollectContext> equipVariableCollectContextList, Boolean isSkip, Boolean isCavitySkip) {
|
|
|
|
|
|
|
|
|
|
//遍历产品加工规则
|
|
|
|
|
for (MesProdRuleContext prodRuleContext : prodRuleContextList) {
|
|
|
|
@ -215,16 +213,16 @@ public class MesAssemblyMatchSortStepService extends BaseStepService {
|
|
|
|
|
if (null == prodRuleContext || StringUtils.isEmpty(prodRuleContext.getAssemblyDataJson())) continue;
|
|
|
|
|
|
|
|
|
|
//获取非排序装配件清单
|
|
|
|
|
List<MesProductionAssemblyNosortContext> productionAssemblyNosortContextList = prodRuleContext.getNosortAssemblyDataContext();
|
|
|
|
|
List<MesProductionAssemblySortContext> productionAssemblySortContextList = prodRuleContext.getSortAssemblyDataContext();
|
|
|
|
|
|
|
|
|
|
Boolean flag = false;
|
|
|
|
|
|
|
|
|
|
//遍历装配件清单
|
|
|
|
|
LOOP:
|
|
|
|
|
for (MesProductionAssemblyNosortContext productionAssemblyNosortContext : productionAssemblyNosortContextList) {
|
|
|
|
|
for (MesProductionAssemblySortContext productionAssemblySortContext : productionAssemblySortContextList) {
|
|
|
|
|
|
|
|
|
|
//已装配
|
|
|
|
|
if (null == productionAssemblyNosortContext || productionAssemblyNosortContext.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) != 0) continue;
|
|
|
|
|
if (null == productionAssemblySortContext || productionAssemblySortContext.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) != 0) continue;
|
|
|
|
|
|
|
|
|
|
//遍历装配件条码
|
|
|
|
|
for (MesEquipVariableCollectContext equipVariableCollectContext : equipVariableCollectContextList) {
|
|
|
|
@ -235,22 +233,43 @@ public class MesAssemblyMatchSortStepService extends BaseStepService {
|
|
|
|
|
//装配件跳过, 必须顺序扫描才生效
|
|
|
|
|
if (isSkip && !StringUtils.isEmpty(prodRuleContext.getIsCheckBindSeq()) && prodRuleContext.getIsCheckBindSeq().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) == 0) {
|
|
|
|
|
|
|
|
|
|
//装配件清单该数据标记跳过
|
|
|
|
|
productionAssemblySortContext.assemblySkip();
|
|
|
|
|
|
|
|
|
|
//匹配成功
|
|
|
|
|
equipVariableCollectContext.isConsume();
|
|
|
|
|
stepResult.msg(String.format("装配件跳过码验证成功,已跳过当前装配项!"));
|
|
|
|
|
|
|
|
|
|
flag = true;
|
|
|
|
|
|
|
|
|
|
break LOOP;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//装配件整腔跳过
|
|
|
|
|
if (isCavitySkip) {
|
|
|
|
|
|
|
|
|
|
//装配件清单该数据标记跳过
|
|
|
|
|
productionAssemblyNosortContext.assemblySkip();
|
|
|
|
|
productionAssemblySortContext.assemblySkip();
|
|
|
|
|
|
|
|
|
|
stepResult.msg(String.format("装配件跳过码验证成功,已跳过当前装配项!"));
|
|
|
|
|
//判断当腔是否还存在待装配的数据
|
|
|
|
|
Optional<MesProductionAssemblySortContext> optional = productionAssemblySortContextList.stream().filter(o -> (null != o && o.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) == 0)).findFirst();
|
|
|
|
|
if (null == optional || !optional.isPresent()) {
|
|
|
|
|
|
|
|
|
|
//匹配成功 [整腔全部跳过后标记]
|
|
|
|
|
equipVariableCollectContext.isConsume();
|
|
|
|
|
stepResult.msg(String.format("装配件整腔跳过码验证成功,已跳过当腔装配项!"));
|
|
|
|
|
|
|
|
|
|
flag = true;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break LOOP;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//匹配规则
|
|
|
|
|
Map<String, Object> result = numberRuleMatchDispatchService.matchNumberRule(reqBean.getOrganizeCode(), equipVariableCollectContext.getEquipVariableValue(), productionAssemblyNosortContext);
|
|
|
|
|
Map<String, Object> result = numberRuleMatchDispatchService.matchNumberRule(reqBean.getOrganizeCode(), equipVariableCollectContext.getEquipVariableValue(), productionAssemblySortContext);
|
|
|
|
|
|
|
|
|
|
//匹配失败
|
|
|
|
|
if (!(Boolean) result.get(MesPcnExtConstWords.RESULT)) {
|
|
|
|
@ -262,17 +281,17 @@ public class MesAssemblyMatchSortStepService extends BaseStepService {
|
|
|
|
|
MesProductionAssemblyNosortContext filter = (MesProductionAssemblyNosortContext) result.get(MesPcnExtConstWords.DATA);
|
|
|
|
|
|
|
|
|
|
//前道防错
|
|
|
|
|
if (!StringUtils.isEmpty(filter.getProductSnId()) && !StringUtils.isEmpty(productionAssemblyNosortContext.getPreCraftCode())) {
|
|
|
|
|
if (CollectionUtils.isEmpty(productionRecordService.findProductionRecordList(reqBean.getOrganizeCode(), equipVariableCollectContext.getEquipVariableValue(), productionAssemblyNosortContext.getPartNo(), productionAssemblyNosortContext.getPreCraftCode()))) {
|
|
|
|
|
if (!StringUtils.isEmpty(filter.getProductSnId()) && !StringUtils.isEmpty(productionAssemblySortContext.getPreCraftCode())) {
|
|
|
|
|
if (CollectionUtils.isEmpty(productionRecordService.findProductionRecordList(reqBean.getOrganizeCode(), equipVariableCollectContext.getEquipVariableValue(), productionAssemblySortContext.getPartNo(), productionAssemblySortContext.getPreCraftCode()))) {
|
|
|
|
|
stepResult.msg(String.format("%s%s", StringUtils.isEmpty(stepResult.getMsg()) ? MesPcnExtConstWords.EMPTY : stepResult.getMsg(),
|
|
|
|
|
String.format("零件条码[%s]前道防错零件号[%s]工艺[%s]验证失败,未查询到加工记录信息!", equipVariableCollectContext.getEquipVariableValue(), productionAssemblyNosortContext.getPartNo(), productionAssemblyNosortContext.getPreCraftCode())));
|
|
|
|
|
String.format("零件条码[%s]前道防错零件号[%s]工艺[%s]验证失败,未查询到加工记录信息!", equipVariableCollectContext.getEquipVariableValue(), productionAssemblySortContext.getPartNo(), productionAssemblySortContext.getPreCraftCode())));
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//时效性验证
|
|
|
|
|
if (!StringUtils.isEmpty(filter.getProductSnId())) {
|
|
|
|
|
result = timeEfficientCfgMatchService.checkSnTimeliness(reqBean.getOrganizeCode(), equipVariableCollectContext.getEquipVariableValue(), filter.getSourceId(), MesExtEnumUtil.TIME_DATA_SOURCE.DATA_SOURCE30.getValue());
|
|
|
|
|
result = timeEfficientCfgMatchService.checkSnTimeliness(reqBean.getOrganizeCode(), equipVariableCollectContext.getEquipVariableValue(), filter.getSourceId(), MesExtEnumUtil.TIME_DATA_SOURCE.DATA_SOURCE10.getValue());
|
|
|
|
|
|
|
|
|
|
if (!(Boolean)result.get(MesPcnExtConstWords.RESULT)) {
|
|
|
|
|
stepResult.msg(String.format("%s%s", StringUtils.isEmpty(stepResult.getMsg()) ? MesPcnExtConstWords.EMPTY : stepResult.getMsg(), result.get(MesPcnExtConstWords.MESSAGE)));
|
|
|
|
@ -286,21 +305,20 @@ public class MesAssemblyMatchSortStepService extends BaseStepService {
|
|
|
|
|
flag = true;
|
|
|
|
|
|
|
|
|
|
//装配件清单该数据标记已装配 (如果是自制件赋值productSnId)
|
|
|
|
|
productionAssemblyNosortContext.assemblyStatus(equipVariableCollectContext.getEquipVariableValue()).productSnId(filter.getProductSnId());
|
|
|
|
|
productionAssemblySortContext.assemblyStatus(equipVariableCollectContext.getEquipVariableValue()).productSnId(filter.getProductSnId());
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//是否验证顺序装配
|
|
|
|
|
if (!StringUtils.isEmpty(prodRuleContext.getIsCheckBindSeq()) &&
|
|
|
|
|
prodRuleContext.getIsCheckBindSeq().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) == 0 && equipVariableCollectContextList.get(0).getMessageSource().compareTo(MesExtEnumUtil.CELL_MESSAGE_SOURCE.READ.getValue()) != 0 &&
|
|
|
|
|
productionAssemblyNosortContext.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) == 0) break;
|
|
|
|
|
if (equipVariableCollectContextList.get(0).getMessageSource().compareTo(MesExtEnumUtil.CELL_MESSAGE_SOURCE.READ.getValue()) != 0 &&
|
|
|
|
|
isCheckBindSeq(prodRuleContext, productionAssemblySortContext) && productionAssemblySortContext.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) == 0) break;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//存在匹配成功的数据
|
|
|
|
|
if (flag) prodRuleContext.assemblyDataJson(productionAssemblyNosortContextList);
|
|
|
|
|
if (flag) prodRuleContext.assemblyDataJson(productionAssemblySortContextList);
|
|
|
|
|
if (flag && equipVariableCollectContextList.get(0).getMessageSource().compareTo(MesExtEnumUtil.CELL_MESSAGE_SOURCE.READ.getValue()) != 0 && equipVariableCollectContextList.size() == 1) return true;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -309,4 +327,10 @@ public class MesAssemblyMatchSortStepService extends BaseStepService {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Boolean isCheckBindSeq(MesProdRuleContext prodRuleContext, MesProductionAssemblySortContext productionAssemblySortContext) {
|
|
|
|
|
if (!StringUtils.isEmpty(prodRuleContext.getIsCheckBindSeq()) && prodRuleContext.getIsCheckBindSeq().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) == 0) return true;
|
|
|
|
|
if (!StringUtils.isEmpty(productionAssemblySortContext.getIsSeqScan()) && productionAssemblySortContext.getIsSeqScan().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) == 0) return true;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|