Merge remote-tracking branch 'origin/dev' into dev

tags/yfai-pcn-ext-v1.0
jun 12 months ago
commit a4324b8f3a

@ -28,4 +28,7 @@ public interface IMesEquipmentLogExtService {
@ApiOperation(value = "验证设备通信质量") @ApiOperation(value = "验证设备通信质量")
Boolean checkEquipQuality(Integer quality); Boolean checkEquipQuality(Integer quality);
@ApiOperation(value = "根据设备ID 查询设备ID分表所有采集数据")
MesEquipmentLog queryMesEquipmentLog( Integer equipId, Long equipVariableId);
} }

@ -19,15 +19,15 @@ public interface IMesInputDefectRecordService {
@ApiOperation(value = "查询页面信息") @ApiOperation(value = "查询页面信息")
public MesPartInspectionViewModel queryPartInspection(MesPartInspectionInputModel model, String org); MesPartInspectionViewModel queryPartInspection(MesPartInspectionInputModel model, String org);
@ApiOperation(value = "零件类型缺陷类型对应关系信息") @ApiOperation(value = "零件类型缺陷类型对应关系信息")
public List<MesPartTypeDefect> queryPartTypeDefect(String serialNumber, String defectLocation, boolean flg, Integer frontBack, String org); List<MesPartTypeDefect> queryPartTypeDefect(String serialNumber, String defectLocation, boolean flg, Integer frontBack, String org);
@ApiOperation(value = "完成质检") @ApiOperation(value = "完成质检")
public void savePartInspection(MesPartInspectionInputModel model, String org); void savePartInspection(MesPartInspectionInputModel model, String org);
@ApiOperation(value = "可疑品录入") @ApiOperation(value = "可疑品录入")
public void saveSusPartInspection(MesPartInspectionInputModel model, String org); void saveSusPartInspection(MesPartInspectionInputModel model, String org);
} }

@ -20,4 +20,7 @@ public interface IMesWorkOrderExtService {
MesWorkOrder insert(MesWorkOrder item); MesWorkOrder insert(MesWorkOrder item);
void update(MesWorkOrder item); void update(MesWorkOrder item);
@ApiOperation(value = "根据生产工单ID查询生产工单信息")
List<MesWorkOrder> getWorkOrderListByShiftCode(String organizeCode, String workCenterCode, String shiftCode);
} }

@ -34,8 +34,6 @@ public class MqttConfig {
@Value("${mqtt.clearSession}") @Value("${mqtt.clearSession}")
public boolean clearSession; public boolean clearSession;
@Value("${mqtt.topic}")
public String topic;
@Value("${mqtt.topic.list}") @Value("${mqtt.topic.list}")
private String topicList; private String topicList;

@ -37,7 +37,7 @@ public class MesNcProcessingController {
try { try {
partInspection.setOrganizeCode(AuthUtil.getOrganizeCode()); partInspection.setOrganizeCode(partInspection.getOrganizeCode());
ListPager<MesPartInspection> partInspectionListPager = ncProcessingService.queryPartInspectionByPager(partInspection, pager); ListPager<MesPartInspection> partInspectionListPager = ncProcessingService.queryPartInspectionByPager(partInspection, pager);
return ResultBean.success("查询成功").setListPager(partInspectionListPager); return ResultBean.success("查询成功").setListPager(partInspectionListPager);
} catch (ImppBusiException imppException) { } catch (ImppBusiException imppException) {
@ -88,6 +88,9 @@ public class MesNcProcessingController {
if (model.getType() == MesExtEnumUtil.NC_TYPE.REWORK.getValue() if (model.getType() == MesExtEnumUtil.NC_TYPE.REWORK.getValue()
|| model.getType() == MesExtEnumUtil.NC_TYPE.SCRAP.getValue()) { || model.getType() == MesExtEnumUtil.NC_TYPE.SCRAP.getValue()) {
ValidatorBean.checkNotNull(model.getPerson(), "责任人不能为空"); ValidatorBean.checkNotNull(model.getPerson(), "责任人不能为空");
if (model.getPerson().getId() == null) {
throw new ImppBusiException("责任人不能为空");
}
ValidatorBean.checkNotNull(model.getInventoryLocationCode(), "区域代码不能为空"); ValidatorBean.checkNotNull(model.getInventoryLocationCode(), "区域代码不能为空");
} }

@ -5,6 +5,7 @@ import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesEquipmentLogExtService;
import cn.estsh.i3plus.ext.mes.pcn.apiservice.schedulejob.MesReportNoSortJob; import cn.estsh.i3plus.ext.mes.pcn.apiservice.schedulejob.MesReportNoSortJob;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesWorkOrderService; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesWorkOrderService;
import cn.estsh.i3plus.ext.mes.pcn.apiservice.schedulejob.MesReportWorkByPreDayJob; import cn.estsh.i3plus.ext.mes.pcn.apiservice.schedulejob.MesReportWorkByPreDayJob;
import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.test.TestService;
import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant; import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant;
import cn.estsh.i3plus.platform.common.convert.ConvertBean; import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean; import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
@ -50,6 +51,9 @@ public class TestController {
@Autowired @Autowired
private IMesConfigService configService; private IMesConfigService configService;
@Autowired
private TestService testService;
@GetMapping("/equipment/log/query") @GetMapping("/equipment/log/query")
@ApiOperation(value = "查询设备交互") @ApiOperation(value = "查询设备交互")
public ResultBean queryReworkTaskByPager(String organizeCode, Integer equipId) { public ResultBean queryReworkTaskByPager(String organizeCode, Integer equipId) {
@ -123,4 +127,11 @@ public class TestController {
mesReportWorkByPreDayJob.executeMesJob(null, null); mesReportWorkByPreDayJob.executeMesJob(null, null);
} }
@GetMapping("/testInsert")
@ApiOperation(value = "批量")
public void testInsert() {
testService.insertList();
}
} }

@ -4,6 +4,7 @@ import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesEquipmentLogService;
import cn.estsh.i3plus.ext.mes.pcn.apiservice.config.MqttConfig; import cn.estsh.i3plus.ext.mes.pcn.apiservice.config.MqttConfig;
import cn.estsh.i3plus.ext.mes.pcn.apiservice.util.SpringUtils; import cn.estsh.i3plus.ext.mes.pcn.apiservice.util.SpringUtils;
import cn.estsh.i3plus.ext.mes.pcn.pojo.mqtt.EquipLogMqttMsg; import cn.estsh.i3plus.ext.mes.pcn.pojo.mqtt.EquipLogMqttMsg;
import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentVariable;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;

@ -15,7 +15,9 @@ import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentLogDetail;
import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentRecord; import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentRecord;
import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentVariable; import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentVariable;
import cn.estsh.i3plus.pojo.mes.repository.MesEquipmentLogDetailRepository; import cn.estsh.i3plus.pojo.mes.repository.MesEquipmentLogDetailRepository;
import cn.estsh.i3plus.pojo.mes.repository.MesEquipmentLogRepository;
import cn.estsh.i3plus.pojo.mes.repository.MesEquipmentRecordRepository; import cn.estsh.i3plus.pojo.mes.repository.MesEquipmentRecordRepository;
import cn.estsh.i3plus.pojo.mes.repository.MesEquipmentVariableRepository;
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
import cn.estsh.impp.framework.boot.util.ImppRedis; import cn.estsh.impp.framework.boot.util.ImppRedis;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -39,12 +41,17 @@ public class MesEquipmentLogService implements IMesEquipmentLogService {
public static final Logger LOGGER = LoggerFactory.getLogger(CommonConstWords.SYSTEM_LOG); public static final Logger LOGGER = LoggerFactory.getLogger(CommonConstWords.SYSTEM_LOG);
@Autowired @Autowired
private MesEquipmentVariableRepository equipmentVariableRepository;
@Autowired
private MesEquipmentLogExtService mesEquipmentLogExtService; private MesEquipmentLogExtService mesEquipmentLogExtService;
@Autowired @Autowired
private MesEquipmentExtService mesEquipmentExtService; private MesEquipmentExtService mesEquipmentExtService;
@Autowired @Autowired
private MesEquipmentLogDetailRepository mesEquipmentLogDetailRepository; private MesEquipmentLogDetailRepository mesEquipmentLogDetailRepository;
@Autowired @Autowired
private MesEquipmentLogRepository mesEquipmentLogRepository;
@Autowired
private MesEquipmentRecordRepository mesEquipmentRecordRepository; private MesEquipmentRecordRepository mesEquipmentRecordRepository;
@Autowired @Autowired
private SnowflakeIdMaker snowflakeIdMaker; private SnowflakeIdMaker snowflakeIdMaker;
@ -148,6 +155,20 @@ public class MesEquipmentLogService implements IMesEquipmentLogService {
@Override @Override
public void updateValue(EquipLogMqttMsg equipLogMqttMsg) { public void updateValue(EquipLogMqttMsg equipLogMqttMsg) {
mesEquipmentLogExtService.updateEquipmentLogValue("CK01", Integer.valueOf(equipLogMqttMsg.getPTCode()), Long.valueOf(equipLogMqttMsg.getTagAddress()), equipLogMqttMsg.getValue()); DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean();
DdlPreparedPack.getStringEqualPack(equipLogMqttMsg.getTagAddress(), "tagAddress", ddlPackBean);
MesEquipmentVariable mesEquipmentVariable = equipmentVariableRepository.getByProperty(ddlPackBean);
if (mesEquipmentVariable == null) {
LOGGER.info("tagAddress 不存在【{}】", equipLogMqttMsg.getTagAddress());
}
MesEquipmentLog equipmentLog = mesEquipmentLogExtService.queryMesEquipmentLog(Integer.valueOf(equipLogMqttMsg.getPTCode()), mesEquipmentVariable.getId());
ConvertBean.serviceModelUpdate(equipmentLog, "mqtt");
mesEquipmentLogRepository.update(equipmentLog);
MesEquipmentLogDetail mesEquipmentLogDetail = new MesEquipmentLogDetail();
BeanUtils.copyProperties(equipmentLog, mesEquipmentLogDetail);
mesEquipmentLogDetail.setId(null);
mesEquipmentLogDetailRepository.save(mesEquipmentLogDetail);
} }
} }

@ -301,6 +301,7 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService {
mesProductionRepeatAssembly.setAssemblyStatus(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_10.getValue()); mesProductionRepeatAssembly.setAssemblyStatus(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_10.getValue());
mesProductionRepeatAssembly.setId(null); mesProductionRepeatAssembly.setId(null);
mesProductionRepeatAssembly.setIsOrigSn(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()); mesProductionRepeatAssembly.setIsOrigSn(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue());
mesProductionRepeatAssembly.setFid(UUID.randomUUID().toString());
mesProductionAssembly.setRepeatAssemblySn(sn); mesProductionAssembly.setRepeatAssemblySn(sn);
mesProductionAssemblyRepository.update(mesProductionAssembly); mesProductionAssemblyRepository.update(mesProductionAssembly);

@ -89,6 +89,9 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
@Autowired @Autowired
private IMesProduceSnExtService produceSnExtService; private IMesProduceSnExtService produceSnExtService;
@Autowired
private MesProductVersionRepository productVersionRepository;
@Override @Override
public MesPartInspectionViewModel queryPartInspection(MesPartInspectionInputModel inputModel, String org) { public MesPartInspectionViewModel queryPartInspection(MesPartInspectionInputModel inputModel, String org) {
@ -821,8 +824,25 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
partInspectionRepository.save(partInspection); partInspectionRepository.save(partInspection);
// //
String source = configService.getCfgValue(org, "LGORT");
//移库 //移库
MesMove move = createMove(model, configService.getCfgValue(org, "LGORT"), configService.getCfgValue(org, "UMLGO"), org); String partNo = model.getPartNo();
// 查询生产版本
String workCenterCode = model.getWorkCenterCode();
String productVersion = model.getProductVersion();
if (!StringUtils.isEmpty(productVersion)) {
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean();
DdlPreparedPack.getStringEqualPack(partNo, "partNo", ddlPackBean);
DdlPreparedPack.getStringEqualPack(workCenterCode, "workCenterCode", ddlPackBean);
DdlPreparedPack.getStringEqualPack(productVersion, "productVersion", ddlPackBean);
MesProductVersion version = productVersionRepository.getByProperty(ddlPackBean);
if (version != null) {
source = version.getShipInventoryPoint();
}
}
MesMove move = createMove(model, source, configService.getCfgValue(org, "UMLGO"), org);
moveRepository.save(move); moveRepository.save(move);
} }
} }

@ -95,6 +95,9 @@ public class MesNcProcessingService implements IMesNcProcessingService {
private MesOrgRepository mesOrgRDao; private MesOrgRepository mesOrgRDao;
@Autowired @Autowired
private MesProductVersionRepository productVersionRepository;
@Autowired
private IMesProduceSnExtService produceSnExtService; private IMesProduceSnExtService produceSnExtService;
@Override @Override
public ListPager<MesPartInspection> queryPartInspectionByPager(MesPartInspection partInspection, Pager pager) { public ListPager<MesPartInspection> queryPartInspectionByPager(MesPartInspection partInspection, Pager pager) {
@ -106,6 +109,8 @@ public class MesNcProcessingService implements IMesNcProcessingService {
DdlPreparedPack.getStringEqualPack(partInspection.getLotNo(), "lotNo", packBean); DdlPreparedPack.getStringEqualPack(partInspection.getLotNo(), "lotNo", packBean);
DdlPreparedPack.getNumEqualPack(partInspection.getQty(), "qty", packBean); DdlPreparedPack.getNumEqualPack(partInspection.getQty(), "qty", packBean);
DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PART_INSPECTION_STATUS.FAIL.getValue(), "inspectionStatus", packBean); DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PART_INSPECTION_STATUS.FAIL.getValue(), "inspectionStatus", packBean);
DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.CREATE.getValue(), "ncStatus", packBean);
DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"createDatetime"}, packBean); DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"createDatetime"}, packBean);
pager = PagerHelper.getPager(pager, partInspectionRepository.findByHqlWhereCount(packBean)); pager = PagerHelper.getPager(pager, partInspectionRepository.findByHqlWhereCount(packBean));
@ -327,6 +332,19 @@ public class MesNcProcessingService implements IMesNcProcessingService {
private void saveDate(MesNcProcessingInputModel model, MesPartSap part, Integer type, MesDefectType person, String org,String areaCode, boolean private void saveDate(MesNcProcessingInputModel model, MesPartSap part, Integer type, MesDefectType person, String org,String areaCode, boolean
isOrder) { isOrder) {
String source = configService.getCfgValue(org, "LGORT");
if (!StringUtils.isEmpty(model.getProductVersion())) {
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean();
DdlPreparedPack.getStringEqualPack(model.getPart().getPartNo(), "partNo", ddlPackBean);
DdlPreparedPack.getStringEqualPack(model.getPartInspection().getWorkCenterCode(), "workCenterCode", ddlPackBean);
DdlPreparedPack.getStringEqualPack(model.getProductVersion(), "productVersion", ddlPackBean);
MesProductVersion version = productVersionRepository.getByProperty(ddlPackBean);
if (version != null) {
source = version.getShipInventoryPoint();
}
}
if (type == MesExtEnumUtil.NC_TYPE.NORMAL.getValue()) { if (type == MesExtEnumUtil.NC_TYPE.NORMAL.getValue()) {
//更新条码质量状态 //更新条码质量状态
@ -419,13 +437,14 @@ public class MesNcProcessingService implements IMesNcProcessingService {
ConvertBean.serviceModelUpdate(sn, model.getPartInspection().getModifyUser()); ConvertBean.serviceModelUpdate(sn, model.getPartInspection().getModifyUser());
partInspectionRepository.save(model.getPartInspection()); partInspectionRepository.save(model.getPartInspection());
if (isOrder) { if (isOrder) {
MesMove move = createMove(model, configService.getCfgValue(org, "UMLGO"), configService.getCfgValue(org, "SCRAP"), org,MesExtEnumUtil.MOVE_TYPE.SCRAP_MOVE); MesMove move = createMove(model, source, configService.getCfgValue(org, "SCRAP"), org,MesExtEnumUtil.MOVE_TYPE.SCRAP_MOVE);
moveRepository.save(move); moveRepository.save(move);
} } else {
//移库 转报废 根据责任方库区对应关系的主数据选择哪个责任方就移动到哪个库区8000移至8002/8003 //移库 转报废 根据责任方库区对应关系的主数据选择哪个责任方就移动到哪个库区8000移至8002/8003
MesMove move = createMove(model, configService.getCfgValue(org, "UMLGO"), areaCode, org, MesExtEnumUtil.MOVE_TYPE.SCRAP_MOVE); MesMove move = createMove(model, configService.getCfgValue(org, "UMLGO"), areaCode, org, MesExtEnumUtil.MOVE_TYPE.SCRAP_MOVE);
// MesMove move = createMove(model, configService.getCfgValue(org, "UMLGO"), configService.getCfgValue(org, "SCRAP"), org); // MesMove move = createMove(model, configService.getCfgValue(org, "UMLGO"), configService.getCfgValue(org, "SCRAP"), org);
moveRepository.save(move); moveRepository.save(move);
}
} else if (type == MesExtEnumUtil.NC_TYPE.RELEASE.getValue()) { } else if (type == MesExtEnumUtil.NC_TYPE.RELEASE.getValue()) {

@ -57,6 +57,7 @@ public class MesWorkCellScanMonitorLogServiceImpl implements IMesWorkCellScanMon
for (Long mouldRecordId : mouldRecordIdList) { for (Long mouldRecordId : mouldRecordIdList) {
DdlPackBean recordPackBean = DdlPackBean.getDdlPackBean(organizeCode); DdlPackBean recordPackBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getNumEqualPack(mouldRecordId, "mouldRecordId", recordPackBean); DdlPreparedPack.getNumEqualPack(mouldRecordId, "mouldRecordId", recordPackBean);
List<MesProductionRecord> recordList = productionRecordRao.findByHqlWhere(recordPackBean); List<MesProductionRecord> recordList = productionRecordRao.findByHqlWhere(recordPackBean);
//需要补录如下字段 //需要补录如下字段
DdlPackBean monitorLogPackBean = DdlPackBean.getDdlPackBean(organizeCode); DdlPackBean monitorLogPackBean = DdlPackBean.getDdlPackBean(organizeCode);
@ -73,7 +74,6 @@ public class MesWorkCellScanMonitorLogServiceImpl implements IMesWorkCellScanMon
new Object[]{workOrderNoStr, serialNoStr, productSnStr, custSnStr, partNoStr, partNameStr, TimeTool.getNowTime(true), "JOB", MesExtEnumUtil.MES_LOG_DEAL_STATUS.DEAL_SUCCESS.getValue(), newTimes}, monitorLogPackBean); new Object[]{workOrderNoStr, serialNoStr, productSnStr, custSnStr, partNoStr, partNameStr, TimeTool.getNowTime(true), "JOB", MesExtEnumUtil.MES_LOG_DEAL_STATUS.DEAL_SUCCESS.getValue(), newTimes}, monitorLogPackBean);
} else { } else {
if (newTimes > times) { if (newTimes > times) {
monitorLogRao.updateByProperties(new String[]{"modifyDatetime", "modifyUser", "times"}, new Object[]{TimeTool.getNowTime(true), "JOB", newTimes}, monitorLogPackBean); monitorLogRao.updateByProperties(new String[]{"modifyDatetime", "modifyUser", "times"}, new Object[]{TimeTool.getNowTime(true), "JOB", newTimes}, monitorLogPackBean);
} else { } else {
monitorLogRao.updateByProperties(new String[]{"modifyDatetime", "modifyUser", "times", "dealStatus"}, new Object[]{TimeTool.getNowTime(true), "JOB", newTimes, MesExtEnumUtil.MES_LOG_DEAL_STATUS.DEAL_FAILURE.getValue()}, monitorLogPackBean); monitorLogRao.updateByProperties(new String[]{"modifyDatetime", "modifyUser", "times", "dealStatus"}, new Object[]{TimeTool.getNowTime(true), "JOB", newTimes, MesExtEnumUtil.MES_LOG_DEAL_STATUS.DEAL_FAILURE.getValue()}, monitorLogPackBean);

@ -74,4 +74,12 @@ public class MesWorkOrderExtService implements IMesWorkOrderExtService {
public void update(MesWorkOrder item) { public void update(MesWorkOrder item) {
workOrderRepository.update(item); workOrderRepository.update(item);
} }
@Override
public List<MesWorkOrder> getWorkOrderListByShiftCode(String organizeCode, String workCenterCode, String shiftCode) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getStringEqualPack(workCenterCode, MesPcnExtConstWords.WORK_CENTER_CODE, packBean);
DdlPreparedPack.getStringEqualPack(shiftCode, MesPcnExtConstWords.SHIFT_CODE, packBean);
return workOrderRepository.findByHqlWhere(packBean);
}
} }

@ -554,8 +554,15 @@ public class MesWorkOrderService implements IMesWorkOrderService {
//保存数据 //保存数据
List<MesProductOffLine> mesProductOffLineList = new ArrayList<>(); List<MesProductOffLine> mesProductOffLineList = new ArrayList<>();
MesProductOffLine newMesProductOffLine; MesProductOffLine newMesProductOffLine;
// 排除重复的数据
for (MesBom mesBom : mesBoms) { Map<MesBom, List<MesBom>> map = mesBoms.stream().collect(Collectors.groupingBy(mesBom -> {
MesBom bom = new MesBom();
bom.setPartNo(mesBom.getPartNo());
bom.setItemPartNo(mesBom.getItemPartNo());
return bom;
}));
for (Map.Entry<MesBom, List<MesBom>> entry : map.entrySet()) {
MesBom mesBom = entry.getValue().get(0);
newMesProductOffLine = new MesProductOffLine(); newMesProductOffLine = new MesProductOffLine();
newMesProductOffLine.setReportPartNo(oldMesWorkOrder.getPartNo()); newMesProductOffLine.setReportPartNo(oldMesWorkOrder.getPartNo());
newMesProductOffLine.setReportPartNameRdd(oldMesWorkOrder.getPartName()); newMesProductOffLine.setReportPartNameRdd(oldMesWorkOrder.getPartName());
@ -580,7 +587,6 @@ public class MesWorkOrderService implements IMesWorkOrderService {
ConvertBean.serviceModelInitialize(newMesProductOffLine, userName); ConvertBean.serviceModelInitialize(newMesProductOffLine, userName);
mesProductOffLineList.add(newMesProductOffLine); mesProductOffLineList.add(newMesProductOffLine);
} }
mesProductOffLineRDao.saveAll(mesProductOffLineList); mesProductOffLineRDao.saveAll(mesProductOffLineList);
// 同步工单信息给加工记录、条码信息 // 同步工单信息给加工记录、条码信息
DdlPackBean snDdlPackBean = DdlPackBean.getDdlPackBean(); DdlPackBean snDdlPackBean = DdlPackBean.getDdlPackBean();
@ -678,6 +684,7 @@ public class MesWorkOrderService implements IMesWorkOrderService {
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(organizeCode); DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getStringEqualPack(productionRecord.getPartNo(), "partNo", ddlPackBean); DdlPreparedPack.getStringEqualPack(productionRecord.getPartNo(), "partNo", ddlPackBean);
DdlPreparedPack.getStringEqualPack(productionRecord.getWorkCenterCode(), "workCenterCode", ddlPackBean); DdlPreparedPack.getStringEqualPack(productionRecord.getWorkCenterCode(), "workCenterCode", ddlPackBean);
if (!StringUtils.isEmpty(productionRecord.getWorkOrderNo())) { if (!StringUtils.isEmpty(productionRecord.getWorkOrderNo())) {
DdlPreparedPack.getStringEqualPack(productionRecord.getWorkOrderNo(), "workOrderNo", ddlPackBean); DdlPreparedPack.getStringEqualPack(productionRecord.getWorkOrderNo(), "workOrderNo", ddlPackBean);
@ -687,7 +694,9 @@ public class MesWorkOrderService implements IMesWorkOrderService {
// 新增班次逻辑 // 新增班次逻辑
//DdlPreparedPack. //DdlPreparedPack.
List<MesWorkOrder> oldMesWorkOrders = workOrderRepository.findByHqlWhere(ddlPackBean); List<MesWorkOrder> oldMesWorkOrders = workOrderRepository.findByHqlWhere(ddlPackBean);
if (!CollectionUtils.isEmpty(oldMesWorkOrders)) {
oldMesWorkOrders = oldMesWorkOrders.stream().filter(mesWorkOrder -> !Objects.equals(MesExtEnumUtil.ORDER_TYPE_IDENTIFICATION.P.getValue(), mesWorkOrder.getOrderFlag())).collect(Collectors.toList());
}
return oldMesWorkOrders; return oldMesWorkOrders;
} }
@ -748,14 +757,7 @@ public class MesWorkOrderService implements IMesWorkOrderService {
if(!CollectionUtils.isEmpty(mesProductionRecordList)) { if(!CollectionUtils.isEmpty(mesProductionRecordList)) {
Map<String, List<MesProductionRecord>> map = mesProductionRecordList.stream().collect(Collectors.groupingBy(MesProductionRecord::getPartNo)); Map<String, List<MesProductionRecord>> map = mesProductionRecordList.stream().collect(Collectors.groupingBy(MesProductionRecord::getPartNo));
map.forEach((k, v) -> { map.forEach((k, v) -> {
DdlPackBean packBean = DdlPackBean.getDdlPackBean();
DdlPreparedPack.getStringEqualPack(k, "partNo", packBean);
// 排除掉试制造件
MesPartSap part = partSapRepository.getByProperty(packBean);
if (part != null && !Objects.equals(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(), part.getIsTestPiece())) {
recordList.add(v.get(0)); recordList.add(v.get(0));
}
LOGGER.info("sap物料中不存在该物料号【{}】, 或者是试制件,不进行报工");
}); });
} }
@ -791,7 +793,6 @@ public class MesWorkOrderService implements IMesWorkOrderService {
if (part != null && !Objects.equals(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(), part.getIsTestPiece())) { if (part != null && !Objects.equals(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(), part.getIsTestPiece())) {
recordList.add(v.get(0)); recordList.add(v.get(0));
} }
LOGGER.info("sap物料中不存在该物料号【{}】, 或者是试制件,不进行报工");
}); });
} }
return recordList; return recordList;

@ -67,7 +67,7 @@ public class MesEquipmentLogExtService implements IMesEquipmentLogExtService {
DdlPreparedPack.getNumEqualPack(equipId, MesPcnExtConstWords.EQUIP_ID, packBean); DdlPreparedPack.getNumEqualPack(equipId, MesPcnExtConstWords.EQUIP_ID, packBean);
DdlPreparedPack.getNumEqualPack(equipVariableId, MesPcnExtConstWords.EQUIP_VARIABLE_ID, packBean); DdlPreparedPack.getNumEqualPack(equipVariableId, MesPcnExtConstWords.EQUIP_VARIABLE_ID, packBean);
equipmentLogRepository.updateByProperties(new String[]{"equipVariableValue",MesPcnExtConstWords.EQUIP_VARIABLE_STATUS}, new Object[]{value, MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.TRUE.getValue()}, packBean); equipmentLogRepository.updateByProperties(new String[]{"equipVariableValue",MesPcnExtConstWords.EQUIP_VARIABLE_STATUS}, new Object[]{value, MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.TRUE.getEquipVariableStatus()}, packBean);
} }
@Override @Override
public Boolean checkEquipQuality(Integer quality) { public Boolean checkEquipQuality(Integer quality) {
@ -87,8 +87,8 @@ public class MesEquipmentLogExtService implements IMesEquipmentLogExtService {
//标记当前设备通信默认正常 //标记当前设备通信默认正常
cellEquipContext.setQuality(MesExtEnumUtil.EQUIP_LOG_QUALITY.defaultQuality()); cellEquipContext.setQuality(MesExtEnumUtil.EQUIP_LOG_QUALITY.defaultQuality());
//根据常变值分别获取设备ID分表的采集数据 //根据常变值分别获取设备ID分表的采集数据
Map<Long, MesEquipmentLog> needNewValue2Collect = getEquipmentLog(equipLogDispatchContext, cellEquipContext, collectContextList, MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.TRUE.getValue()); Map<Long, List<MesEquipmentLog>> needNewValue2Collect = getEquipmentLog(equipLogDispatchContext, cellEquipContext, collectContextList, MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.TRUE.getValue());
Map<Long, MesEquipmentLog> unNeedNewValue2Collect = getEquipmentLog(equipLogDispatchContext, cellEquipContext, collectContextList, MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.FALSE.getValue()); Map<Long, List<MesEquipmentLog>> unNeedNewValue2Collect = getEquipmentLog(equipLogDispatchContext, cellEquipContext, collectContextList, MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.FALSE.getValue());
//根据设备ID,设备数据变量ID集合 修改设备ID分表采集数据的状态 【修改常变值配置对应的设备ID分表的采集数据的状态为1】 【isResetEquipVariable = false 标记需要修改的设备数据变量ID, 后续匹配成功后再调用updateEquipmentLogList进行修改】 //根据设备ID,设备数据变量ID集合 修改设备ID分表采集数据的状态 【修改常变值配置对应的设备ID分表的采集数据的状态为1】 【isResetEquipVariable = false 标记需要修改的设备数据变量ID, 后续匹配成功后再调用updateEquipmentLogList进行修改】
if (!CollectionUtils.isEmpty(needNewValue2Collect) && checkEquipQuality(cellEquipContext.getQuality())) { if (!CollectionUtils.isEmpty(needNewValue2Collect) && checkEquipQuality(cellEquipContext.getQuality())) {
@ -133,16 +133,16 @@ public class MesEquipmentLogExtService implements IMesEquipmentLogExtService {
} }
private MesEquipmentLog filterEquipmentLog(Map<Long, MesEquipmentLog> needNewValue2Collect, Map<Long, MesEquipmentLog> unNeedNewValue2Collect, Long equipVariableId, Integer needNewValue) { private MesEquipmentLog filterEquipmentLog(Map<Long, List<MesEquipmentLog>> needNewValue2Collect, Map<Long, List<MesEquipmentLog>> unNeedNewValue2Collect, Long equipVariableId, Integer needNewValue) {
if (!StringUtils.isEmpty(needNewValue) && MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.TRUE.getValue() == needNewValue) return filterEquipmentLog(needNewValue2Collect, equipVariableId); if (!StringUtils.isEmpty(needNewValue) && MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.TRUE.getValue() == needNewValue) return filterEquipmentLog(needNewValue2Collect, equipVariableId);
else return filterEquipmentLog(unNeedNewValue2Collect, equipVariableId); else return filterEquipmentLog(unNeedNewValue2Collect, equipVariableId);
} }
private MesEquipmentLog filterEquipmentLog(Map<Long, MesEquipmentLog> collectMap, Long equipVariableId) { private MesEquipmentLog filterEquipmentLog(Map<Long, List<MesEquipmentLog>> collectMap, Long equipVariableId) {
return !CollectionUtils.isEmpty(collectMap) ? collectMap.get(equipVariableId) : null; return (!CollectionUtils.isEmpty(collectMap) && collectMap.containsKey(equipVariableId)) ? collectMap.get(equipVariableId).get(0) : null;
} }
private Map<Long, MesEquipmentLog> getEquipmentLog(MesEquipLogDispatchContext equipLogDispatchContext, MesCellEquipContext cellEquipContext, List<MesEquipVariableCfgCollectContext> equipVariableCollectContextList, Integer needNewValue) { private Map<Long, List<MesEquipmentLog>> getEquipmentLog(MesEquipLogDispatchContext equipLogDispatchContext, MesCellEquipContext cellEquipContext, List<MesEquipVariableCfgCollectContext> equipVariableCollectContextList, Integer needNewValue) {
List<MesEquipVariableCfgCollectContext> filterList = equipVariableCollectContextList.stream().filter(o -> (null != o && o.getNeedNewValue().compareTo(needNewValue) == 0)).collect(Collectors.toList()); List<MesEquipVariableCfgCollectContext> filterList = equipVariableCollectContextList.stream().filter(o -> (null != o && o.getNeedNewValue().compareTo(needNewValue) == 0)).collect(Collectors.toList());
if (CollectionUtils.isEmpty(filterList)) return null; if (CollectionUtils.isEmpty(filterList)) return null;
List<MesEquipmentLog> equipmentLogList = getEquipmentLogList(cellEquipContext.getOrganizeCode(), cellEquipContext.getEquipId(), needNewValue, collectEquipVariableIdList(filterList)); List<MesEquipmentLog> equipmentLogList = getEquipmentLogList(cellEquipContext.getOrganizeCode(), cellEquipContext.getEquipId(), needNewValue, collectEquipVariableIdList(filterList));
@ -152,7 +152,7 @@ public class MesEquipmentLogExtService implements IMesEquipmentLogExtService {
//【已经采集到任何数据 或者 (equipmentLogList有数据且是长变值方式获取的 或者 不是常变值方式获取的但必须有value) 】 情况下isCollectValue标记为true //【已经采集到任何数据 或者 (equipmentLogList有数据且是长变值方式获取的 或者 不是常变值方式获取的但必须有value) 】 情况下isCollectValue标记为true
if (equipLogDispatchContext.getIsCollectValue() || (!CollectionUtils.isEmpty(equipmentLogList) && (needNewValue == MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.TRUE.getValue() || checkEquipmentLogHasValue(equipmentLogList)))) equipLogDispatchContext.isCollectValue(); if (equipLogDispatchContext.getIsCollectValue() || (!CollectionUtils.isEmpty(equipmentLogList) && (needNewValue == MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.TRUE.getValue() || checkEquipmentLogHasValue(equipmentLogList)))) equipLogDispatchContext.isCollectValue();
return CollectionUtils.isEmpty(equipmentLogList) ? null : equipmentLogList.stream().filter(o -> null != o).collect(Collectors.toMap(MesEquipmentLog::getEquipVariableId, o -> o)); return CollectionUtils.isEmpty(equipmentLogList) ? null : equipmentLogList.stream().filter(o -> null != o).collect(Collectors.groupingBy(MesEquipmentLog::getEquipVariableId));
} }
private Boolean checkEquipmentLogHasValue(List<MesEquipmentLog> equipmentLogList) { private Boolean checkEquipmentLogHasValue(List<MesEquipmentLog> equipmentLogList) {
@ -170,4 +170,13 @@ public class MesEquipmentLogExtService implements IMesEquipmentLogExtService {
return CollectionUtils.isEmpty(equipVariableIdList) ? null : equipVariableIdList.stream().filter(o -> !StringUtils.isEmpty(o)).distinct().collect(Collectors.toList()); return CollectionUtils.isEmpty(equipVariableIdList) ? null : equipVariableIdList.stream().filter(o -> !StringUtils.isEmpty(o)).distinct().collect(Collectors.toList());
} }
@Override
public MesEquipmentLog queryMesEquipmentLog(Integer equipId, Long equipVariableId) {
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean();
DdlPreparedPack.getNumEqualPack(equipId, "equipId", ddlPackBean);
DdlPreparedPack.getNumEqualPack(equipVariableId, "equipVariableId", ddlPackBean);
return equipmentLogRepository.getByProperty(ddlPackBean);
}
} }

@ -4,6 +4,7 @@ import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesProdShiftRecordService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionCustomContextStepService; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionCustomContextStepService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionDispatchContextStepService; 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.IMesProductionProcessContextStepService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesWorkOrderExtService;
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProdShiftContext; import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProdShiftContext;
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPartContext; import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPartContext;
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext; import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext;
@ -15,10 +16,7 @@ import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil; import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack; import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
import cn.estsh.i3plus.pojo.mes.bean.MesFile; import cn.estsh.i3plus.pojo.mes.bean.*;
import cn.estsh.i3plus.pojo.mes.bean.MesProdShiftRecord;
import cn.estsh.i3plus.pojo.mes.bean.MesStateMachineStatus;
import cn.estsh.i3plus.pojo.mes.bean.MesWorkCell;
import cn.estsh.i3plus.pojo.mes.model.AttrBean; import cn.estsh.i3plus.pojo.mes.model.AttrBean;
import cn.estsh.i3plus.pojo.mes.model.StationKvBean; import cn.estsh.i3plus.pojo.mes.model.StationKvBean;
import cn.estsh.i3plus.pojo.mes.model.StationRequestBean; import cn.estsh.i3plus.pojo.mes.model.StationRequestBean;
@ -40,6 +38,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.StringJoiner; import java.util.StringJoiner;
import java.util.function.BinaryOperator;
/** /**
* @Description : * @Description :
@ -62,6 +61,9 @@ public class MesProductionNoSortModuleService extends BaseModuleService {
private IMesProdShiftRecordService mesProdShiftRecordService; private IMesProdShiftRecordService mesProdShiftRecordService;
@Autowired @Autowired
private IMesWorkOrderExtService workOrderExtService;
@Autowired
private MesFileRepository mesFileRepository; private MesFileRepository mesFileRepository;
@Override @Override
@ -93,7 +95,7 @@ public class MesProductionNoSortModuleService extends BaseModuleService {
productionStatisticsContext = StationKvBeanUtil.addStationKvBeanList(new ArrayList<>(), new StationKvBean(new StringJoiner(MesPcnExtConstWords.AND).add(mesProdShiftKvBean.getShiftGroup()).add(mesProdShiftKvBean.getShiftCode()).toString(), "加工数", "0"), productionStatisticsContext = StationKvBeanUtil.addStationKvBeanList(new ArrayList<>(), new StationKvBean(new StringJoiner(MesPcnExtConstWords.AND).add(mesProdShiftKvBean.getShiftGroup()).add(mesProdShiftKvBean.getShiftCode()).toString(), "加工数", "0"),
new StationKvBean("color", "颜色", MesExtEnumUtil.COLOR.BLACK.getValue())); new StationKvBean("color", "颜色", MesExtEnumUtil.COLOR.BLACK.getValue()));
} }
StationResultBean shiftCountBean = getStationResultBean(reqBean, productionStatisticsContext,mesWorkCell); StationResultBean shiftCountBean = getStationResultBean(reqBean, productionStatisticsContext,mesWorkCell, mesProdShiftKvBean);
this.sendMessage(reqBean, shiftCountBean); this.sendMessage(reqBean, shiftCountBean);
//验证工位是否锁定 //验证工位是否锁定
@ -143,7 +145,7 @@ public class MesProductionNoSortModuleService extends BaseModuleService {
return attrBeanList; return attrBeanList;
} }
private StationResultBean getStationResultBean(StationRequestBean reqBean, List<StationKvBean> productionStatisticsContext, MesWorkCell mesWorkCell) { private StationResultBean getStationResultBean(StationRequestBean reqBean, List<StationKvBean> productionStatisticsContext, MesWorkCell mesWorkCell, MesProdShiftContext mesProdShiftKvBean) {
StationResultBean resultBean = new StationResultBean(); StationResultBean resultBean = new StationResultBean();
resultBean.setBusiType(MesPcnEnumUtil.STATION_BUSI_TYPE.MODULE_CUSTOM_CONTENT.getValue()); resultBean.setBusiType(MesPcnEnumUtil.STATION_BUSI_TYPE.MODULE_CUSTOM_CONTENT.getValue());
String dataType = MesPcnEnumUtil.STATION_DATA_TYPE.ECHART.getValue(); String dataType = MesPcnEnumUtil.STATION_DATA_TYPE.ECHART.getValue();
@ -164,11 +166,21 @@ public class MesProductionNoSortModuleService extends BaseModuleService {
} }
if (Objects.equal(MesExtEnumUtil.WORK_FILE_TYPE.HISTOGRAM.getValue(), mesWorkCell.getIsShowMsg())) { if (Objects.equal(MesExtEnumUtil.WORK_FILE_TYPE.HISTOGRAM.getValue(), mesWorkCell.getIsShowMsg())) {
dataType = MesPcnEnumUtil.STATION_DATA_TYPE.ECHART.getValue(); dataType = MesPcnEnumUtil.STATION_DATA_TYPE.ECHART.getValue();
List<MesWorkOrder> workOrderList = workOrderExtService.getWorkOrderListByShiftCode(reqBean.getOrganizeCode(), mesWorkCell.getWorkCenterCode(), mesProdShiftKvBean.getShiftCode());
if (CollectionUtils.isEmpty(workOrderList)) {
StationKvBeanUtil.addStationKvBeanList(orderQtyKvBeans, new ArrayList<>(),
new StationKvBean(MesPcnExtConstWords.QTY, "工单计划数", 0 + ""),
new StationKvBean(MesPcnExtConstWords.COMPLATED_QTY, "工单完成数", 0 + ""));
} else {
double qty = workOrderList.stream().map(MesWorkOrder::getQty).reduce((a, b) -> a + b).get();
double complateQty = workOrderList.stream().map(MesWorkOrder::getCompleteQty).reduce((a, b) -> a + b).get();
StationKvBeanUtil.addStationKvBeanList(orderQtyKvBeans, new ArrayList<>(),
new StationKvBean(MesPcnExtConstWords.QTY, "工单计划数", qty + ""),
new StationKvBean(MesPcnExtConstWords.COMPLATED_QTY, "工单完成数", complateQty + ""));
}
if (!CollectionUtils.isEmpty(productionPartContextList)) { if (!CollectionUtils.isEmpty(productionPartContextList)) {
productionPartContextList.forEach(o -> StationKvBeanUtil.addStationKvBeanList(orderQtyKvBeans, new ArrayList<>(),
new StationKvBean(MesPcnExtConstWords.WORK_ORDER_NO, "工单号", o.getWorkOrderNo() + ""),
new StationKvBean(MesPcnExtConstWords.QTY, "工单计划数", o.getQty() + ""),
new StationKvBean(MesPcnExtConstWords.COMPLATED_QTY, "工单完成数", o.getCompleteQty() + "")));
} }
resultBean.setResultList(orderQtyKvBeans); resultBean.setResultList(orderQtyKvBeans);
@ -203,7 +215,7 @@ public class MesProductionNoSortModuleService extends BaseModuleService {
return StationKvBeanUtil.addStationKvBeanList(new ArrayList<>(), return StationKvBeanUtil.addStationKvBeanList(new ArrayList<>(),
new StationKvBean("shiftGroup", "班组", record.getShiftGroup()), new StationKvBean("shiftGroup", "班组", record.getShiftGroup()),
new StationKvBean("shiftGroupName", "班组名称", record.getShiftGroup()), new StationKvBean("shiftGroupName", "班组名称", record.getShiftGroupName()),
new StationKvBean("shiftCode", "班次", record.getShiftCode()), new StationKvBean("shiftCode", "班次", record.getShiftCode()),
new StationKvBean("shiftName", "班次名称", record.getShiftName())) new StationKvBean("shiftName", "班次名称", record.getShiftName()))
; ;

@ -25,6 +25,7 @@ import org.springframework.util.StringUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -139,6 +140,8 @@ public class MesAssemblySaveNosortStepService extends BaseStepService {
productionAssembly.setOrganizeCode(reqBean.getOrganizeCode()); productionAssembly.setOrganizeCode(reqBean.getOrganizeCode());
ConvertBean.serviceModelInitialize(productionAssembly, reqBean.getUserInfo()); ConvertBean.serviceModelInitialize(productionAssembly, reqBean.getUserInfo());
productionAssembly.setFid(UUID.randomUUID().toString());
productionAssemblyRepository.insert(productionAssembly); productionAssemblyRepository.insert(productionAssembly);
if (!StringUtils.isEmpty(productionAssemblyNosortContext.getProductSnId())) productSnId.add(productionAssemblyNosortContext.getProductSnId()); if (!StringUtils.isEmpty(productionAssemblyNosortContext.getProductSnId())) productSnId.add(productionAssemblyNosortContext.getProductSnId());

@ -484,7 +484,11 @@ public class MesAssemblyShowNosortStepService extends BaseStepService {
productionDispatchContextStepService.deleteProductionPartContext(reqBean); productionDispatchContextStepService.deleteProductionPartContext(reqBean);
productionDispatchContextStepService.deleteProdRuleDataContext(reqBean); productionDispatchContextStepService.deleteProdRuleDataContext(reqBean);
productionProcessContextStepService.deleteFunctionChooseCavityOrderContext(reqBean); productionProcessContextStepService.deleteFunctionChooseCavityOrderContext(reqBean);
if (productionDispatchContextStepService.checkFirstMouldNoIsExistContext(reqBean)) {
//存在头道模具号场景下 必须抛出异常 因为头道模具号的接口逻辑会配置非常变值,也就是每次返回回去都会拿到头道模具号 就会出现死循环线程
productionDispatchContextStepService.deleteFirstMouldNoContext(reqBean); productionDispatchContextStepService.deleteFirstMouldNoContext(reqBean);
foundExThrowNoShowMsg();
}
} }
return true; return true;
} }

@ -5,6 +5,7 @@ import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesInputDefectRecordService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesNcProcessingService; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesNcProcessingService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionDispatchContextStepService; 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.IMesProductionProcessContextStepService;
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPartContext;
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPsOutContext; import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPsOutContext;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesNcProcessingInputModel; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesNcProcessingInputModel;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesPartInspectionInputModel; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesPartInspectionInputModel;
@ -28,6 +29,7 @@ import com.google.common.base.Objects;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.util.Arrays; import java.util.Arrays;
@ -35,6 +37,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
/** /**
* @Description : * @Description :
@ -76,8 +79,11 @@ public class MesProductResultErrorHandleStepService extends BaseStepService {
} }
// 获取条码列表 // 获取条码列表
List<MesProductionPsOutContext> mesProduceSns = mesProductionDispatchContextStepService.getProductionPsOutContext(reqBean); List<MesProductionPsOutContext> mesProduceSns = mesProductionDispatchContextStepService.getProductionPsOutContext(reqBean);
List<MesProductionPartContext> productionPartContexts = mesProductionDispatchContextStepService.getProductionPartContext(reqBean);
// 保存加工异常记录(NC判断记录) // 保存加工异常记录(NC判断记录)
saveProductResultException(reqBean, mesProduceSns, result); saveProductResultException(reqBean, mesProduceSns,productionPartContexts, result);
return execSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), stepResult, "加工异常处理成功"); return execSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), stepResult, "加工异常处理成功");
@ -90,9 +96,14 @@ public class MesProductResultErrorHandleStepService extends BaseStepService {
* @param reqBean * @param reqBean
* @param mesProduceSns * @param mesProduceSns
*/ */
private void saveProductResultException(StationRequestBean reqBean, List<MesProductionPsOutContext> mesProduceSns, String result) { private void saveProductResultException(StationRequestBean reqBean, List<MesProductionPsOutContext> mesProduceSns, List<MesProductionPartContext> productionPartContexts, String result) {
String defectTypeCode = MesEnumUtil.DEFECT_TYPE_CODE.DETERMIND.getValue(); String defectTypeCode = MesEnumUtil.DEFECT_TYPE_CODE.DETERMIND.getValue();
mesProduceSns.forEach(mesProduceSn -> { mesProduceSns.forEach(mesProduceSn -> {
String productVersion = null;
List<MesProductionPartContext> mesProductionPartContextList = productionPartContexts.stream().filter(mesProductionPartContext -> Objects.equal(mesProduceSn.getForeignKey(),mesProductionPartContext.getForeignKey())).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(mesProductionPartContextList)) {
productVersion = mesProductionPartContextList.get(0).getProductVersion();
}
MesNcProcessingInputModel model = new MesNcProcessingInputModel(); MesNcProcessingInputModel model = new MesNcProcessingInputModel();
MesDefectType mesDefectType = new MesDefectType(); MesDefectType mesDefectType = new MesDefectType();
mesDefectType.setBackDefect(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); mesDefectType.setBackDefect(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
@ -135,6 +146,7 @@ public class MesProductResultErrorHandleStepService extends BaseStepService {
mesPartInspectionDetail.setDefectTypeName(mesDefectType.getDefectTypeName()); mesPartInspectionDetail.setDefectTypeName(mesDefectType.getDefectTypeName());
model.setPartInspection(partInspection); model.setPartInspection(partInspection);
model.setType(partInspection.getSourceType()); model.setType(partInspection.getSourceType());
model.setProductVersion(productVersion);
if (Objects.equal(MesExtEnumUtil.EQUIP_VARIABLE_CFG_CATEGORY.PRODUCT_SCRAP.getValue(), result)) { if (Objects.equal(MesExtEnumUtil.EQUIP_VARIABLE_CFG_CATEGORY.PRODUCT_SCRAP.getValue(), result)) {
model.setType(MesExtEnumUtil.NC_TYPE.SCRAP.getValue()); model.setType(MesExtEnumUtil.NC_TYPE.SCRAP.getValue());
@ -156,6 +168,8 @@ public class MesProductResultErrorHandleStepService extends BaseStepService {
inspectModel.setWorkCenterCode(mesProduceSn.getWorkCenterCode()); inspectModel.setWorkCenterCode(mesProduceSn.getWorkCenterCode());
inspectModel.setPartInspection(partInspection); inspectModel.setPartInspection(partInspection);
inspectModel.setShiftCode(mesProduceSn.getShiftCode()); inspectModel.setShiftCode(mesProduceSn.getShiftCode());
inspectModel.setProductVersion(productVersion);
inputDefectRecordService.saveSusPartInspection(inspectModel, reqBean.getOrganizeCode()); inputDefectRecordService.saveSusPartInspection(inspectModel, reqBean.getOrganizeCode());
} }
}); });

@ -31,6 +31,7 @@ import org.springframework.util.StringUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -197,8 +198,10 @@ public class MesProductSnGenerateStepService extends BaseStepService {
if (StringUtils.isEmpty(produceSn.getInWorkCenterTime())) produceSn.setInWorkCenterTime(produceSn.getModifyDatetime()); if (StringUtils.isEmpty(produceSn.getInWorkCenterTime())) produceSn.setInWorkCenterTime(produceSn.getModifyDatetime());
produceSn.setLotNo(produceSn.getModifyDatetime().substring(0, 10)); produceSn.setLotNo(produceSn.getModifyDatetime().substring(0, 10));
if (StringUtils.isEmpty(produceSn.getId())) produceSn = produceSnExtService.insert(produceSn); if (StringUtils.isEmpty(produceSn.getId())) {
else produceSnExtService.update(produceSn); produceSn.setFid(UUID.randomUUID().toString());
produceSn = produceSnExtService.insert(produceSn);
} else produceSnExtService.update(produceSn);
return new MesProductionPsOutContext().copy(produceSn, prodRuleContext.getForeignKey()).isCalcCompleteQty(!StringUtils.isEmpty(produceSn.getWorkOrderNo()) && !isSamePart); return new MesProductionPsOutContext().copy(produceSn, prodRuleContext.getForeignKey()).isCalcCompleteQty(!StringUtils.isEmpty(produceSn.getWorkOrderNo()) && !isSamePart);

@ -27,6 +27,7 @@ import org.springframework.util.StringUtils;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -144,6 +145,9 @@ public class MesProductionRecordGenerateStepService extends BaseStepService {
ConvertBean.serviceModelInitialize(productionRecord, reqBean.getUserInfo()); ConvertBean.serviceModelInitialize(productionRecord, reqBean.getUserInfo());
productionRecord.setCompleteDateTime(productionRecord.getModifyDatetime()); productionRecord.setCompleteDateTime(productionRecord.getModifyDatetime());
productionRecord.setFid(UUID.randomUUID().toString());
productionRecord.setOneMouldMoreId(UUID.randomUUID().toString());
productionRecord = productionRecordRepository.insert(productionRecord); productionRecord = productionRecordRepository.insert(productionRecord);
if (null != prodRuleContext) prodRuleContextList.stream().filter(o -> (null != o && if (null != prodRuleContext) prodRuleContextList.stream().filter(o -> (null != o &&

@ -0,0 +1,6 @@
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.test;
public interface TestService {
void insertList();
}

@ -0,0 +1,100 @@
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.test;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.pojo.base.codemaker.SnowflakeIdMaker;
import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentLogDetail;
import cn.estsh.i3plus.pojo.mes.repository.MesEquipmentLogDetailRepository;
import cn.estsh.i3plus.pojo.mes.repository.MesEquipmentLogRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.logging.Logger;
@Service
public class TestServiceImpl implements TestService{
@Autowired
private MesEquipmentLogRepository equipmentLogRepository;
@Autowired
private MesEquipmentLogDetailRepository equipmentLogDetailRepository;
@Autowired
private SnowflakeIdMaker snowflakeIdMaker;
private static ExecutorService executorService = new ThreadPoolExecutor(1, 10,
0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<>(200), r -> {
Thread thread = new Thread(r);
thread.setName("executorService--"+r.hashCode());
return thread;
},new ThreadPoolExecutor.DiscardPolicy());
private static ExecutorService executorService2 = new ThreadPoolExecutor(1, 10,
0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<>(200), r -> {
Thread thread = new Thread(r);
thread.setName("executorService--"+r.hashCode());
return thread;
},new ThreadPoolExecutor.DiscardPolicy());
public void insertList() {
executorService = new ThreadPoolExecutor(1, 10,
0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<>(200), r -> {
Thread thread = new Thread(r);
thread.setName("executorService--"+r.hashCode());
return thread;
},new ThreadPoolExecutor.DiscardPolicy());
executorService2 = new ThreadPoolExecutor(1, 10,
0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<>(200), r -> {
Thread thread = new Thread(r);
thread.setName("executorService--"+r.hashCode());
return thread;
},new ThreadPoolExecutor.DiscardPolicy());
List<MesEquipmentLogDetail> list = new ArrayList<>();
for (int i= 1; i< 10; i ++) {
executorService.execute(new Runnable() {
@Override
public void run() {
for (int j = 1; j < 500; j++) {
executorService2.execute(new Runnable() {
@Override
public void run() {
MesEquipmentLogDetail equipmentLogDetail = new MesEquipmentLogDetail();
ConvertBean.serviceModelInitialize(equipmentLogDetail, "test");
equipmentLogDetail.setId(snowflakeIdMaker.nextId());
equipmentLogDetail.setEquipVariableId(123123l);
equipmentLogDetail.setEquipVariableName("aaa");
equipmentLogDetail.setReadWriteFlag(1);
equipmentLogDetail.setDataType("40");
equipmentLogDetail.setEquipId(7);
equipmentLogDetail.setEquipmentCode("Foaming5#");
list.add(equipmentLogDetail);
/* try {
Thread.sleep(50);
} catch (InterruptedException e) {
e.printStackTrace();
}*/
}
});
}
}
});
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
equipmentLogDetailRepository.saveAll(list);
}
}
}

@ -45,6 +45,9 @@ public class MesProductionPartContext implements Serializable {
@ApiParam("完成数量【不能用于业务计算】") @ApiParam("完成数量【不能用于业务计算】")
private Double completeQty; private Double completeQty;
@ApiParam("生产版本")
private String productVersion;
@ApiParam("设备代码") @ApiParam("设备代码")
private String equipmentCode; private String equipmentCode;

@ -38,6 +38,9 @@ public class MesNcProcessingInputModel {
@ApiParam("物料") @ApiParam("物料")
private MesPartSap part; private MesPartSap part;
@ApiParam("版本号")
private String productVersion;
@ApiParam("NC-零件检测详情") @ApiParam("NC-零件检测详情")
private List<MesPartInspectionDetail> partInspectionDetailList; private List<MesPartInspectionDetail> partInspectionDetailList;

@ -49,6 +49,8 @@ public class MesPartInspectionInputModel {
@ApiParam("是否返工单完成单据") @ApiParam("是否返工单完成单据")
private boolean transferFlg = false; private boolean transferFlg = false;
@ApiParam("版本号")
private String productVersion;
@ApiParam("NC-零件检测-单据") @ApiParam("NC-零件检测-单据")
private MesPartInspection partInspection; private MesPartInspection partInspection;

Loading…
Cancel
Save