时效性验证

tags/yfai-pcn-ext-v1.3 yfai-pcn-ext-v1.3
王杰 9 months ago
parent a1b4eaee52
commit 86f040de3a

@ -13,6 +13,9 @@ public interface IMesProduceSnExtService {
@ApiOperation(value = "根据零件条码查询零件条码信息")
List<MesProduceSn> getProduceSnList(String organizeCode, List<String> productSnList);
@ApiOperation(value = "根据零件条码查询零件条码信息")
List<MesProduceSn> getProduceSnList(String organizeCode, String productSn);
@ApiOperation(value = "根据零件条码ID查询零件条码信息")
MesProduceSn getProduceSn(String organizeCode, Long id);
@ -34,4 +37,7 @@ public interface IMesProduceSnExtService {
MesProduceSn insert(MesProduceSn item);
void update(MesProduceSn item);
void updateNoSync(MesProduceSn item);
}

@ -4,7 +4,6 @@ import cn.estsh.i3plus.pojo.mes.bean.MesProductionRecord;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import java.util.Map;
/**
* @Description :
@ -15,20 +14,6 @@ import java.util.Map;
**/
public interface IMesProductionRecordService {
/**
*
* @param productSn
* @param sourceId
* @param dataSource ,,
*
* MesExtEnumUtil.TIME_DATA_SOURCE
* DATA_SOURCE10(10, "排序加工规则"),
* DATA_SOURCE20(20, "非排序加工规则"),
* DATA_SOURCE30(30, "非排序装配件");
*
*/
Map<String, Object> checkSnTimeliness(String organizeCode, String productSn, Long sourceId, Integer dataSource);
@ApiOperation(value = "根据零件条码查询加工记录信息")
List<MesProductionRecord> findProductionRecordList(String organizeCode, String productSn);

@ -0,0 +1,24 @@
package cn.estsh.i3plus.ext.mes.pcn.api.busi;
import io.swagger.annotations.ApiOperation;
import java.util.Map;
public interface IMesTimeEfficientCfgMatchService {
/**
*
* @param productSn
* @param sourceId
* @param dataSource ,,
*
* MesExtEnumUtil.TIME_DATA_SOURCE
* DATA_SOURCE10(10, "排序加工规则"),
* DATA_SOURCE20(20, "非排序加工规则"),
* DATA_SOURCE30(30, "非排序装配件");
*
*/
@ApiOperation(value = "时效性匹配")
Map<String, Object> checkSnTimeliness(String organizeCode, String productSn, Long sourceId, Integer dataSource);
}

@ -0,0 +1,13 @@
package cn.estsh.i3plus.ext.mes.pcn.api.busi;
import cn.estsh.i3plus.pojo.mes.bean.MesTimeEfficientCfg;
import io.swagger.annotations.ApiOperation;
import java.util.List;
public interface IMesTimeEfficientCfgService {
@ApiOperation(value = "根据来源ID查询时效性配置信息")
List<MesTimeEfficientCfg> getTimeEfficientCfgList(String organizeCode, Long sourceId);
}

@ -49,14 +49,6 @@ public class PcnRepositoryAspect {
updateBeanSync((BaseBean)arg);
}
}
} else if (methodName.equals("insert")) {
Object[] args = joinPoint.getArgs();
if (args.length > 0) {
Object item = args[0];
if (BaseBean.class.isAssignableFrom(item.getClass())) {
updateBeanSync((BaseBean)item);
}
}
} else if (methodName.equals("saveAll")) {
Object[] args = joinPoint.getArgs();
if (args.length > 0) {

@ -46,6 +46,17 @@ public class MesProduceSnExtService implements IMesProduceSnExtService {
return produceSnRepository.findByHqlWhere(packBean);
}
@Override
public List<MesProduceSn> getProduceSnList(String organizeCode, String productSn) {
if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(productSn)) return null;
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getStringEqualPack(productSn, MesPcnExtConstWords.PRODUCT_SN, packBean);
return produceSnRepository.findByHqlWhere(packBean);
}
//根据零件条码ID查询零件条码信息
@Override
public MesProduceSn getProduceSn(String organizeCode, Long id) {
@ -130,4 +141,11 @@ public class MesProduceSnExtService implements IMesProduceSnExtService {
public void update(MesProduceSn item) {
produceSnRepository.update(item);
}
@Override
@MonitorLog
public void updateNoSync(MesProduceSn item) {
produceSnRepository.updateNoSync(item);
}
}

@ -6,22 +6,16 @@ import cn.estsh.i3plus.platform.common.tool.TimeTool;
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
import cn.estsh.i3plus.pojo.mes.bean.MesProductionAssembly;
import cn.estsh.i3plus.pojo.mes.bean.MesProductionRecord;
import cn.estsh.i3plus.pojo.mes.bean.MesTimeEfficientCfg;
import cn.estsh.i3plus.pojo.mes.repository.MesProductionAssemblyRepository;
import cn.estsh.i3plus.pojo.mes.repository.MesProductionRecordRepository;
import cn.estsh.i3plus.pojo.mes.repository.MesTimeEfficientCfgRepository;
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import java.util.List;
/**
* @Description :
@ -42,126 +36,6 @@ public class MesProductionRecordService implements IMesProductionRecordService {
@Autowired
private MesProductionAssemblyRepository productionAssemblyRepository;
/**
* :
* 0.
* 1.
* 1.1 ; true
* 1.2 ,
* 1.2.1
* 1.2.2
* 2.
* 2.1 --
* 2.2
* 2.3 ,
*
* timeDataSource + sourceId MES_TIME_EFFICIENT_CFG
* DATA_SOURCE10(10, "排序加工规则"),
* DATA_SOURCE20(20, "非排序加工规则"),
* DATA_SOURCE30(30, "非排序装配件");
*
* @param productSn
* @param sourceId
* @param organizeCode
* @return
*/
@Override
public Map<String, Object> checkSnTimeliness(String organizeCode, String productSn, Long sourceId, Integer dataSource) {
Map<String, Object> resultMap = new HashMap<>();
resultMap.put(MesPcnExtConstWords.RESULT, true);//校验成功
try {
//1.根据prodRuleNoSortId 获取 非排序加工规则的 时效性数据 --- 当前的条码需要完全匹配查询的规则
DdlPackBean timelinessPackBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getNumEqualPack(sourceId, MesPcnExtConstWords.SOURCE_ID, timelinessPackBean);
List<MesTimeEfficientCfg> timelinessList = timeEfficientCfgRepository.findByHqlWhere(timelinessPackBean);
//2.如果timelinessList为空 且 非装配件校验 直接返回true
if (CollectionUtils.isEmpty(timelinessList)) return resultMap;
//3.根据条码获取生产加工记录结果
List<MesProductionRecord> productionRecordList = findProductionRecordList(organizeCode, productSn);
if (CollectionUtils.isEmpty(productionRecordList)) return backResultMap(resultMap, String.format("零件条码[%s]时效性验证失败,未查询到加工记录信息!", productSn));
Date now = new Date();
SimpleDateFormat sdf = new SimpleDateFormat(MesPcnExtConstWords.DATE_FORMAT);
for (MesTimeEfficientCfg timeliness : timelinessList) {
if (null == timeliness || StringUtils.isEmpty(timeliness.getCraftCode())) continue;
List<MesProductionRecord> filterList;
//时效性规则 零件号不为空或者为空 过滤数据
if (!StringUtils.isEmpty(timeliness.getPartNo())) filterList = productionRecordList.stream().filter(o -> o.getPartNo().equals(timeliness.getPartNo()) && o.getCraftCode().equals(timeliness.getCraftCode())).sorted(Comparator.comparing(MesProductionRecord::getCreateDatetime).reversed()).collect(Collectors.toList());
else filterList = productionRecordList.stream().filter(item -> item.getCraftCode().equals(timeliness.getCraftCode())).sorted(Comparator.comparing(MesProductionRecord::getCreateDatetime).reversed()).collect(Collectors.toList());
if (CollectionUtils.isEmpty(filterList)) return backResultMap(resultMap, String.format("零件条码[%s]时效性零件号[%s]工艺[%s]验证失败,未查询到加工记录信息!", productSn, timeliness.getPartNo(), timeliness.getCraftCode()));
//不为空 则 需要校验时效性
String completeDateTime = filterList.get(0).getCompleteDateTime();
Date productDateTime = sdf.parse(completeDateTime);
//时差
int minDiff = (int) ((now.getTime() - productDateTime.getTime())/(60 * 1000));
if (!checkTimeliness(timeliness, minDiff)) return backResultMap(resultMap, String.format("零件条码[%s]时效性零件号[%s]工艺[%s]验证失败!", productSn, timeliness.getPartNo(), timeliness.getCraftCode()));
}
return resultMap;
} catch (Exception e) {
return backResultMap(resultMap, String.format("零件条码[%s]时效性零件号[%s]工艺[%s]验证异常:%s!", productSn, e.toString()));
}
}
private Map<String, Object> backResultMap(Map<String, Object> resultMap, String message) {
resultMap.put(MesPcnExtConstWords.RESULT, false);
resultMap.put(MesPcnExtConstWords.MESSAGE, message);
return resultMap;
}
/**
* MATCH_RULE_10("10", "生产时间小于装配件有效期"),
* MATCH_RULE_20("20", "小于最小时差有效"),
* MATCH_RULE_30("30", "大于最大时差有效"),
* MATCH_RULE_40("40", "最大最小时差有效"),
* MATCH_RULE_50("50", "最大外或最小内有效");
*
*
*
*
* @param
* @return
*/
private boolean checkTimeliness(MesTimeEfficientCfg timeliness, int minDiff) {
String matchRule = timeliness.getMatchRule();
Double minValue = timeliness.getMinValue();
Double maxValue = timeliness.getMaxValue();
if (MesExtEnumUtil.MATCH_RULE.MATCH_RULE_20.getValue().equals(matchRule)) {
//差值 小于最小时差有效
if (minDiff >= minValue){
return false;
}
} else if (MesExtEnumUtil.MATCH_RULE.MATCH_RULE_30.getValue().equals(matchRule)) {
// 差值 大于最大时差有效
if (minDiff <= maxValue){
return false;
}
} else if (MesExtEnumUtil.MATCH_RULE.MATCH_RULE_40.getValue().equals(matchRule)) {
// 差值 最大最小时差有效 在 最大值 最小值之间
if (minDiff <= minValue || minDiff >= maxValue){
return false;
}
} else if (MesExtEnumUtil.MATCH_RULE.MATCH_RULE_50.getValue().equals(matchRule)) {
// 差值 最大外或最小内有效
if (minDiff >= minValue && minDiff <= maxValue){
return false;
}
}
return true;
}
@Override
public List<MesProductionRecord> findProductionRecordList(String organizeCode, String productSn) {
if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(productSn)) return null;

@ -0,0 +1,28 @@
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesTimeEfficientCfgService;
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.mes.bean.MesTimeEfficientCfg;
import cn.estsh.i3plus.pojo.mes.repository.MesTimeEfficientCfgRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.List;
@Service
public class MesTimeEfficientCfgService implements IMesTimeEfficientCfgService {
@Autowired
private MesTimeEfficientCfgRepository timeEfficientCfgRepository;
@Override
public List<MesTimeEfficientCfg> getTimeEfficientCfgList(String organizeCode, Long sourceId) {
if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(sourceId)) return null;
return timeEfficientCfgRepository.findByProperty(
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, MesPcnExtConstWords.SOURCE_ID},
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), sourceId});
}
}

@ -0,0 +1,166 @@
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.rulematch;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProduceSnExtService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionRecordService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesTimeEfficientCfgMatchService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesTimeEfficientCfgService;
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
import cn.estsh.i3plus.pojo.mes.bean.MesProduceSn;
import cn.estsh.i3plus.pojo.mes.bean.MesProductionRecord;
import cn.estsh.i3plus.pojo.mes.bean.MesTimeEfficientCfg;
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class MesTimeEfficientCfgMatchService implements IMesTimeEfficientCfgMatchService {
@Autowired
private IMesTimeEfficientCfgService timeEfficientCfgService;
@Autowired
private IMesProductionRecordService productionRecordService;
@Autowired
private IMesProduceSnExtService produceSnExtService;
/**
* :
* 0.
* 1.
* 1.1 ; true
* 1.2 ,
* 1.2.1
* 1.2.2
* 2.
* 2.1 --
* 2.2
* 2.3 ,
*
* timeDataSource + sourceId MES_TIME_EFFICIENT_CFG
* DATA_SOURCE10(10, "排序加工规则"),
* DATA_SOURCE20(20, "非排序加工规则"),
* DATA_SOURCE30(30, "非排序装配件");
*
* @param productSn
* @param sourceId
* @param organizeCode
* @return
*/
@Override
public Map<String, Object> checkSnTimeliness(String organizeCode, String productSn, Long sourceId, Integer dataSource) {
Map<String, Object> resultMap = new HashMap<>();
resultMap.put(MesPcnExtConstWords.RESULT, true);//校验成功
try {
//1.根据prodRuleNoSortId 获取 非排序加工规则的 时效性数据 --- 当前的条码需要完全匹配查询的规则
List<MesTimeEfficientCfg> timelinessList = timeEfficientCfgService.getTimeEfficientCfgList(organizeCode, sourceId);
//2.如果timelinessList为空 且 非装配件校验 直接返回true
if (CollectionUtils.isEmpty(timelinessList)) return resultMap;
//3.根据条码获取生产加工记录结果
List<MesProductionRecord> productionRecordList = null;
Optional<MesTimeEfficientCfg> optional = timelinessList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getCraftCode()))).findFirst();
if (null != optional && optional.isPresent()) {
productionRecordList = productionRecordService.findProductionRecordList(organizeCode, productSn);
if (CollectionUtils.isEmpty(productionRecordList)) return backResultMap(resultMap, String.format("零件条码[%s]时效性验证失败,未查询到加工记录信息!", productSn));
}
List<MesProduceSn> produceSnList = null;
optional = timelinessList.stream().filter(o -> (null != o && StringUtils.isEmpty(o.getCraftCode()))).findFirst();
if (null != optional && optional.isPresent()) {
produceSnList = produceSnExtService.getProduceSnList(organizeCode, productSn);
if (CollectionUtils.isEmpty(produceSnList)) return backResultMap(resultMap, String.format("零件条码[%s]时效性验证失败,未查询到零件条码信息!", productSn));
}
Date now = new Date();
SimpleDateFormat sdf = new SimpleDateFormat(MesPcnExtConstWords.DATE_FORMAT);
for (MesTimeEfficientCfg timeliness : timelinessList) {
if (null == timeliness || (StringUtils.isEmpty(timeliness.getPartNo()) && StringUtils.isEmpty(timeliness.getCraftCode()))) continue;
List<Object> filterList;
//时效性规则 零件号不为空或者为空 过滤数据
if (!StringUtils.isEmpty(timeliness.getPartNo()) && !StringUtils.isEmpty(timeliness.getCraftCode()))
filterList = productionRecordList.stream().filter(o -> o.getPartNo().equals(timeliness.getPartNo()) && o.getCraftCode().equals(timeliness.getCraftCode())).sorted(Comparator.comparing(MesProductionRecord::getCreateDatetime).reversed()).collect(Collectors.toList());
else if (!StringUtils.isEmpty(timeliness.getCraftCode()))
filterList = productionRecordList.stream().filter(item -> item.getCraftCode().equals(timeliness.getCraftCode())).sorted(Comparator.comparing(MesProductionRecord::getCreateDatetime).reversed()).collect(Collectors.toList());
else
filterList = produceSnList.stream().filter(item -> item.getPartNo().equals(timeliness.getPartNo())).sorted(Comparator.comparing(MesProduceSn::getCreateDatetime).reversed()).collect(Collectors.toList());
if (CollectionUtils.isEmpty(filterList)) return backResultMap(resultMap, String.format("零件条码[%s]时效性零件号[%s]工艺[%s]验证失败,未查询到%s!", productSn, timeliness.getPartNo(), timeliness.getCraftCode(), !StringUtils.isEmpty(timeliness.getCraftCode()) ? "加工记录信息" : "零件条码信息"));
//不为空 则 需要校验时效性
String completeDateTime = !StringUtils.isEmpty(timeliness.getCraftCode()) ? ((MesProductionRecord) filterList.get(0)).getCompleteDateTime() : ((MesProduceSn) filterList.get(0)).getCreateDatetime();
Date productDateTime = sdf.parse(completeDateTime);
//时差
int minDiff = (int) ((now.getTime() - productDateTime.getTime())/(60 * 1000));
if (!checkTimeliness(timeliness, minDiff)) return backResultMap(resultMap, String.format("零件条码[%s]时效性零件号[%s]工艺[%s]验证失败!", productSn, timeliness.getPartNo(), timeliness.getCraftCode()));
}
return resultMap;
} catch (Exception e) {
return backResultMap(resultMap, String.format("零件条码[%s]时效性零件号[%s]工艺[%s]验证异常:%s!", productSn, e.toString()));
}
}
private Map<String, Object> backResultMap(Map<String, Object> resultMap, String message) {
resultMap.put(MesPcnExtConstWords.RESULT, false);
resultMap.put(MesPcnExtConstWords.MESSAGE, message);
return resultMap;
}
/**
* MATCH_RULE_10("10", "生产时间小于装配件有效期"),
* MATCH_RULE_20("20", "小于最小时差有效"),
* MATCH_RULE_30("30", "大于最大时差有效"),
* MATCH_RULE_40("40", "最大最小时差有效"),
* MATCH_RULE_50("50", "最大外或最小内有效");
*
*
*
*
* @param
* @return
*/
private boolean checkTimeliness(MesTimeEfficientCfg timeliness, int minDiff) {
String matchRule = timeliness.getMatchRule();
Double minValue = timeliness.getMinValue();
Double maxValue = timeliness.getMaxValue();
if (MesExtEnumUtil.MATCH_RULE.MATCH_RULE_20.getValue().equals(matchRule)) {
//差值 小于最小时差有效
if (minDiff >= minValue){
return false;
}
} else if (MesExtEnumUtil.MATCH_RULE.MATCH_RULE_30.getValue().equals(matchRule)) {
// 差值 大于最大时差有效
if (minDiff <= maxValue){
return false;
}
} else if (MesExtEnumUtil.MATCH_RULE.MATCH_RULE_40.getValue().equals(matchRule)) {
// 差值 最大最小时差有效 在 最大值 最小值之间
if (minDiff <= minValue || minDiff >= maxValue){
return false;
}
} else if (MesExtEnumUtil.MATCH_RULE.MATCH_RULE_50.getValue().equals(matchRule)) {
// 差值 最大外或最小内有效
if (minDiff >= minValue && minDiff <= maxValue){
return false;
}
}
return true;
}
}

@ -58,6 +58,9 @@ public class MesAssemblyGeneratePartNoStepService extends BaseStepService {
@Autowired
private IMesProductionRecordService productionRecordService;
@Autowired
private IMesTimeEfficientCfgMatchService timeEfficientCfgMatchService;
@Override
public StepResult execute(StationRequestBean reqBean) {
@ -210,7 +213,7 @@ public class MesAssemblyGeneratePartNoStepService extends BaseStepService {
//时效性验证
if (!StringUtils.isEmpty(filterList.get(0).getProductSnId())) {
Map<String, Object> result = productionRecordService.checkSnTimeliness(reqBean.getOrganizeCode(), equipVariableCollectContext.getEquipVariableValue(), filterList.get(0).getSourceId(), MesExtEnumUtil.TIME_DATA_SOURCE.DATA_SOURCE30.getValue());
Map<String, Object> result = timeEfficientCfgMatchService.checkSnTimeliness(reqBean.getOrganizeCode(), equipVariableCollectContext.getEquipVariableValue(), filterList.get(0).getSourceId(), MesExtEnumUtil.TIME_DATA_SOURCE.DATA_SOURCE30.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)));
continue;

@ -1,9 +1,6 @@
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesNumberRuleMatchDispatchService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionDispatchContextStepService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionProcessContextStepService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionRecordService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.*;
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.*;
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
import cn.estsh.i3plus.mes.pcn.actor.shipping.dispatch.IFsmCommonService;
@ -53,6 +50,9 @@ public class MesAssemblyMatchNosortStepService extends BaseStepService {
private IMesProductionRecordService productionRecordService;
@Autowired
private IMesTimeEfficientCfgMatchService timeEfficientCfgMatchService;
@Autowired
private IFsmCommonService fsmCommonService;
@Override
@ -267,7 +267,6 @@ public class MesAssemblyMatchNosortStepService extends BaseStepService {
//前道防错
if (!StringUtils.isEmpty(filterList.get(0).getProductSnId()) && !StringUtils.isEmpty(productionAssemblyNosortContext.getPreCraftCode())) {
log.info("工厂{}生产线{}工位{} MesAssemblyMatchNosortStepService ---- 5 ----", reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode());
if (CollectionUtils.isEmpty(productionRecordService.findProductionRecordList(reqBean.getOrganizeCode(), equipVariableCollectContext.getEquipVariableValue(), productionAssemblyNosortContext.getPartNo(), productionAssemblyNosortContext.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())));
@ -277,7 +276,7 @@ public class MesAssemblyMatchNosortStepService extends BaseStepService {
//时效性验证
if (!StringUtils.isEmpty(filterList.get(0).getProductSnId())) {
Map<String, Object> result = productionRecordService.checkSnTimeliness(reqBean.getOrganizeCode(), equipVariableCollectContext.getEquipVariableValue(), filterList.get(0).getSourceId(), MesExtEnumUtil.TIME_DATA_SOURCE.DATA_SOURCE30.getValue());
Map<String, Object> result = timeEfficientCfgMatchService.checkSnTimeliness(reqBean.getOrganizeCode(), equipVariableCollectContext.getEquipVariableValue(), filterList.get(0).getSourceId(), MesExtEnumUtil.TIME_DATA_SOURCE.DATA_SOURCE30.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)));

@ -49,7 +49,7 @@ public class MesAssemblyShowNosortStepService extends BaseStepService {
private IMesNumberRuleMatchDispatchService numberRuleMatchDispatchService;
@Autowired
private IMesProductionRecordService productionRecordService;
private IMesTimeEfficientCfgMatchService timeEfficientCfgMatchService;
@Autowired
private IMesWorkOrderExtService workOrderExtService;
@ -273,7 +273,7 @@ public class MesAssemblyShowNosortStepService extends BaseStepService {
//时效性验证
if (!StringUtils.isEmpty(productionPsInContext.getPartNo())) {
Map<String, Object> result = productionRecordService.checkSnTimeliness(reqBean.getOrganizeCode(), productionPsInContext.getProductSn(), filterList.get(0).getId(), MesExtEnumUtil.TIME_DATA_SOURCE.DATA_SOURCE20.getValue());
Map<String, Object> result = timeEfficientCfgMatchService.checkSnTimeliness(reqBean.getOrganizeCode(), productionPsInContext.getProductSn(), filterList.get(0).getId(), MesExtEnumUtil.TIME_DATA_SOURCE.DATA_SOURCE20.getValue());
if (!(Boolean)result.get(MesPcnExtConstWords.RESULT)) {
if (productionPsInContext.getMessageSource().compareTo(MesExtEnumUtil.CELL_MESSAGE_SOURCE.SCAN.getValue()) == 0) productionPsInContext.busiCheckToDelete();
@ -367,7 +367,7 @@ public class MesAssemblyShowNosortStepService extends BaseStepService {
//时效性验证
if (!StringUtils.isEmpty(productionPsInContext.getPartNo())) {
Map<String, Object> result = productionRecordService.checkSnTimeliness(reqBean.getOrganizeCode(), productionPsInContext.getProductSn(), innerfilterList.get(0).getId(), MesExtEnumUtil.TIME_DATA_SOURCE.DATA_SOURCE20.getValue());
Map<String, Object> result = timeEfficientCfgMatchService.checkSnTimeliness(reqBean.getOrganizeCode(), productionPsInContext.getProductSn(), innerfilterList.get(0).getId(), MesExtEnumUtil.TIME_DATA_SOURCE.DATA_SOURCE20.getValue());
if (!(Boolean)result.get(MesPcnExtConstWords.RESULT)) {
if (productionPsInContext.getMessageSource().compareTo(MesExtEnumUtil.CELL_MESSAGE_SOURCE.SCAN.getValue()) == 0) productionPsInContext.busiCheckToDelete();

@ -10,6 +10,7 @@ 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.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil;
import cn.estsh.i3plus.pojo.mes.bean.MesPart;
import cn.estsh.i3plus.pojo.mes.bean.MesProduceSn;
@ -198,10 +199,13 @@ public class MesProductSnGenerateStepService extends BaseStepService {
if (StringUtils.isEmpty(produceSn.getInWorkCenterTime())) produceSn.setInWorkCenterTime(produceSn.getModifyDatetime());
produceSn.setLotNo(produceSn.getModifyDatetime().substring(0, 10));
//未知不同步
produceSn.setSystemSyncStatus(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
if (StringUtils.isEmpty(produceSn.getId())) {
produceSn.setFid(UUID.randomUUID().toString());
produceSn = produceSnExtService.insert(produceSn);
} else produceSnExtService.update(produceSn);
} else produceSnExtService.updateNoSync(produceSn);
return new MesProductionPsOutContext().copy(produceSn, prodRuleContext.getForeignKey()).isCalcCompleteQty(!StringUtils.isEmpty(produceSn.getWorkOrderNo()) && !isSamePart);

Loading…
Cancel
Save