|
|
|
@ -1,8 +1,10 @@
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesEquipment
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesProductionRecord
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.dbinterface.MesInterfaceDataMapper
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesEquipmentRepository
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesProductionRecordRepository
|
|
|
|
|
import org.slf4j.Logger
|
|
|
|
|
import org.slf4j.LoggerFactory
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired
|
|
|
|
@ -22,11 +24,15 @@ class PiscesToMesProductionAssembly {
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesEquipmentRepository mesEquipmentRepository;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesProductionRecordRepository mesProductionRecordRepository;
|
|
|
|
|
|
|
|
|
|
def filterData(MesInterfaceDataMapper mapper, List<Map<String, Object>> srcData) throws Exception {
|
|
|
|
|
if (srcData == null || srcData.size() == 0) {
|
|
|
|
|
return srcData
|
|
|
|
|
}
|
|
|
|
|
Map<String, MesEquipment> mesEquipmentMap = new HashMap<>();
|
|
|
|
|
Map<String, MesProductionRecord> mesProductionRecordMap = new HashMap<>();
|
|
|
|
|
String organizeCode = mapper.getOrganizeCode();
|
|
|
|
|
for (Map<String, Object> rowMap : srcData) {
|
|
|
|
|
//获取设备名称&设备代码
|
|
|
|
@ -39,6 +45,18 @@ class PiscesToMesProductionAssembly {
|
|
|
|
|
LOGGER.info("EQUIPMENT_FID:{}信息不存在", String.valueOf(rowMap.get("EQUIPMENT_FID")))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(rowMap.get("PRODUCTION_LOG_FID"))) {
|
|
|
|
|
MesProductionRecord record = getMesProductionRecord(organizeCode, String.valueOf(rowMap.get("PRODUCTION_LOG_FID")), mesProductionRecordMap)
|
|
|
|
|
if (!Objects.isNull(record)) {
|
|
|
|
|
rowMap.put("PRODUCTION_RECORD_ID", record.getId())
|
|
|
|
|
} else {
|
|
|
|
|
LOGGER.info("加工记录FID:{}信息不存在", String.valueOf(rowMap.get("PRODUCTION_LOG_FID")))
|
|
|
|
|
rowMap.put("PRODUCTION_RECORD_ID", 0)
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
rowMap.put("PRODUCTION_RECORD_ID", 0)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return srcData;
|
|
|
|
|
}
|
|
|
|
@ -51,4 +69,13 @@ class PiscesToMesProductionAssembly {
|
|
|
|
|
}
|
|
|
|
|
return mesEquipmentMap.get(equipmentFid);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private MesProductionRecord getMesProductionRecord(String organizeCode, String fid, Map<String, MesProductionRecord> mesProductionRecordMap) {
|
|
|
|
|
if (Objects.isNull(mesProductionRecordMap) || !mesProductionRecordMap.containsKey(fid)) {
|
|
|
|
|
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(fid, "fid", ddlPackBean);
|
|
|
|
|
mesProductionRecordMap.put(fid, mesProductionRecordRepository.getByProperty(ddlPackBean))
|
|
|
|
|
}
|
|
|
|
|
return mesProductionRecordMap.get(fid);
|
|
|
|
|
}
|
|
|
|
|
}
|