|
|
|
@ -1,9 +1,6 @@
|
|
|
|
|
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.base;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesPartService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesProdOrgExtService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesReworkTaskService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesTemplateService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.base.*;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.busi.*;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.print.IPrintTemplateStrategyService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.apiservice.util.MesPcnException;
|
|
|
|
@ -38,6 +35,7 @@ import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.SpringContextsUtil;
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
@ -67,9 +65,9 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService {
|
|
|
|
|
|
|
|
|
|
private static final Logger LOGGER = LoggerFactory.getLogger(MesReworkTaskServiceImpl.class);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesReworkTaskRepository mesReworkTaskRepository;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesPartTypePictureRepository mesPartTypePictureRepository;
|
|
|
|
|
|
|
|
|
@ -138,8 +136,10 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IMesWorkOrderExtService workOrderExtService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesWorkOrderRepository workOrderRepository;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesProductVersionRepository productVersionRepository;
|
|
|
|
|
|
|
|
|
@ -155,6 +155,9 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService {
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesPartProdGroupRepository mesPartProdGroupRao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IMesEquipmentExtService equipmentExtService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ListPager<MesReworkTask> queryReworkTask(MesReworkTask mesReworkTask, Pager pager) {
|
|
|
|
|
String organizeCode = !StringUtils.isEmpty(mesReworkTask.getOrganizeCode())?mesReworkTask.getOrganizeCode():AuthUtil.getOrganizeCode();
|
|
|
|
@ -558,7 +561,7 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService {
|
|
|
|
|
Map<String,MesWorkCenter> mesWorkCenterMap = new HashMap<>();
|
|
|
|
|
//匹配装配件
|
|
|
|
|
for (MesProductionAssembly assembly : productionAssemblies) {
|
|
|
|
|
Object context = getContext(requestModel, assembly,mesWorkCenterMap);
|
|
|
|
|
Object context = getContext(requestModel, assembly, mesWorkCenterMap);
|
|
|
|
|
//匹配规则
|
|
|
|
|
Map<String, Object> result = numberRuleMatchDispatchService.matchNumberRule(requestModel.getOrganizeCode(), requestModel.getSn(), context);
|
|
|
|
|
//匹配成功
|
|
|
|
@ -928,20 +931,38 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService {
|
|
|
|
|
mesProductionAssemblyUniqueRepository.insert(productionAssemblyUnique);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Object getContext(MesReworkTaskRequestModel requestModel, MesProductionAssembly mesProductionAssembly,Map<String,MesWorkCenter> mesWorkCenterMap) {
|
|
|
|
|
private Object getContext(MesReworkTaskRequestModel requestModel, MesProductionAssembly mesProductionAssembly, Map<String,MesWorkCenter> mesWorkCenterMap) {
|
|
|
|
|
if(StringUtils.isEmpty(mesProductionAssembly.getWorkCenterCode())) MesPcnException.throwFlowException("产线代码不存在");
|
|
|
|
|
Object context = null;
|
|
|
|
|
MesWorkCenter workCenterDb = null;
|
|
|
|
|
MesWorkCenter workCenterDb;
|
|
|
|
|
//产线类型
|
|
|
|
|
if(!mesWorkCenterMap.containsKey(mesProductionAssembly.getWorkCenterCode())){
|
|
|
|
|
workCenterDb = getMesWorkCenter(requestModel.getOrganizeCode(), mesProductionAssembly.getWorkCenterCode());
|
|
|
|
|
mesWorkCenterMap.put(mesProductionAssembly.getWorkCenterCode(),workCenterDb);
|
|
|
|
|
}else{
|
|
|
|
|
} else{
|
|
|
|
|
workCenterDb = mesWorkCenterMap.get(mesProductionAssembly.getWorkCenterCode());
|
|
|
|
|
}
|
|
|
|
|
if (MesExtEnumUtil.WORK_CENTER_TYPE.SORT.getValue() == workCenterDb.getCenterType()) context = new MesProductionAssemblySortContext().copy(mesProductionAssembly);
|
|
|
|
|
else context = new MesProductionAssemblyNosortContext().copy(mesProductionAssembly);
|
|
|
|
|
return context;
|
|
|
|
|
|
|
|
|
|
//获取不可用规则
|
|
|
|
|
String prodRuleIgnoreCfg = getProdRuleIgnoreCfg(requestModel.getOrganizeCode(), workCenterDb.getCenterType(), mesProductionAssembly.getSourceId(), mesProductionAssembly.getEquipmentCode());
|
|
|
|
|
|
|
|
|
|
return MesExtEnumUtil.WORK_CENTER_TYPE.SORT.getValue() == workCenterDb.getCenterType()
|
|
|
|
|
? new MesProductionAssemblySortContext().copy(mesProductionAssembly).prodRuleIgnoreCfg(prodRuleIgnoreCfg)
|
|
|
|
|
: new MesProductionAssemblyNosortContext().copy(mesProductionAssembly).prodRuleIgnoreCfg(prodRuleIgnoreCfg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取不可用规则
|
|
|
|
|
private String getProdRuleIgnoreCfg(String organizeCode, Integer centerType, Long sourceId, String equipmentCode) {
|
|
|
|
|
if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(centerType) || StringUtils.isEmpty(sourceId) || StringUtils.isEmpty(equipmentCode)) return null;
|
|
|
|
|
Long sourceId2IgnoreCfg = null;
|
|
|
|
|
if (MesExtEnumUtil.WORK_CENTER_TYPE.SORT.getValue() == centerType) {
|
|
|
|
|
MesWorkOrderAssembly workOrderAssembly = mesAssemblyExtService.getWorkOrderAssembly(organizeCode, sourceId);
|
|
|
|
|
if (null != workOrderAssembly && !StringUtils.isEmpty(workOrderAssembly.getPid())) sourceId2IgnoreCfg = workOrderAssembly.getPid();
|
|
|
|
|
} else sourceId2IgnoreCfg = sourceId;
|
|
|
|
|
Integer dataSource = MesExtEnumUtil.WORK_CENTER_TYPE.SORT.getValue() == centerType ? MesExtEnumUtil.PROD_RULE_IGNORE_DATA_SOURCE.DATA_SOURCE10.getValue() : MesExtEnumUtil.PROD_RULE_IGNORE_DATA_SOURCE.DATA_SOURCE30.getValue();
|
|
|
|
|
if (StringUtils.isEmpty(sourceId2IgnoreCfg)) return null;
|
|
|
|
|
List<MesProdRuleIgnoreCfg> prodRuleIgnoreCfgList = equipmentExtService.getProdRuleIgnoreCfgList(organizeCode, equipmentCode, dataSource, sourceId2IgnoreCfg);
|
|
|
|
|
if (CollectionUtils.isEmpty(prodRuleIgnoreCfgList)) return null;
|
|
|
|
|
return JSONObject.toJSONString(prodRuleIgnoreCfgList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private MesProduceSn getMesProduceSn(String organizeCode, String productSn) {
|
|
|
|
|