|
|
@ -2,20 +2,17 @@ package org.nl.wms.ext.mes.service.impl; |
|
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
import cn.hutool.core.util.IdUtil; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.nl.system.service.notice.ISysNoticeService; |
|
|
|
import org.nl.wms.database.material.service.IMdBaseMaterialService; |
|
|
|
import org.nl.wms.database.material.service.dao.MdBaseMaterial; |
|
|
|
import org.nl.wms.ext.mes.service.WmsToMesService; |
|
|
|
import org.nl.wms.ext.mes.service.dao.mapper.MesRequestMapper; |
|
|
|
import org.nl.wms.ext.mes.service.dto.MesProductDataDto; |
|
|
|
import org.nl.wms.ext.mes.service.dto.MesWorkOrderDto; |
|
|
|
import org.nl.wms.ext.mes.service.dto.MesMudConsumptionDto; |
|
|
|
import org.nl.wms.ext.mes.service.dto.*; |
|
|
|
import org.nl.wms.ext.record.service.ISysInteractRecordService; |
|
|
|
import org.nl.wms.pdm.consumption.service.dao.PdmBdMudConsumption; |
|
|
|
import org.nl.wms.pdm.consumption.service.dao.mapper.PdmBdMudConsumptionMapper; |
|
|
|
import org.nl.wms.pdm.workorder.service.IPdmBdWorkorderService; |
|
|
|
import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder; |
|
|
@ -24,6 +21,7 @@ import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup; |
|
|
|
import org.nl.wms.sch.point.service.ISchBasePointService; |
|
|
|
import org.nl.wms.sch.point.service.dao.SchBasePoint; |
|
|
|
import org.nl.wms.sch.task_manage.GeneralDefinition; |
|
|
|
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum; |
|
|
|
import org.nl.wms.sch.task_manage.enums.WorkOrderStatusEnum; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@ -43,10 +41,6 @@ public class WmsToMesServiceImpl implements WmsToMesService { |
|
|
|
@Autowired |
|
|
|
private MesRequestMapper mesRequestMapper; |
|
|
|
@Autowired |
|
|
|
private PdmBdMudConsumptionMapper mudConsumptionMapper; |
|
|
|
@Autowired |
|
|
|
private ISysInteractRecordService interactRecordService; |
|
|
|
@Autowired |
|
|
|
private IMdBaseMaterialService mdBaseMaterialService; |
|
|
|
@Autowired |
|
|
|
private ISchBasePointService pointService; |
|
|
@ -54,6 +48,8 @@ public class WmsToMesServiceImpl implements WmsToMesService { |
|
|
|
private IPdmBdWorkorderService pdmBdWorkorderService; |
|
|
|
@Autowired |
|
|
|
private ISchBaseVehiclematerialgroupService vehiclematerialgroupService; |
|
|
|
@Autowired |
|
|
|
private ISysNoticeService noticeService; |
|
|
|
@Override |
|
|
|
public void reportMudConsumption(MesMudConsumptionDto mudObject) { |
|
|
|
log.info("上报mes消耗泥料记录的信息: {}", mudObject); |
|
|
@ -140,7 +136,171 @@ public class WmsToMesServiceImpl implements WmsToMesService { |
|
|
|
try { |
|
|
|
mesRequestMapper.insertProductData(mesProductDataDto); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("反馈压机产出插入mes数据库失败: {}", e.getMessage()); |
|
|
|
log.error("反馈压机产出插入mes数据库失败:{}", workorder); |
|
|
|
// todo:发送通知
|
|
|
|
noticeService.createNotice("反馈压机产出插入mes数据库失败", "压机产出"+mesProductDataDto.getMSGID(), |
|
|
|
NoticeTypeEnum.EXCEPTION.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void reportSemiProductionInfoIn(String groupId) { |
|
|
|
log.info("物料入滚筒线"); |
|
|
|
// 获取组盘信息
|
|
|
|
SchBaseVehiclematerialgroup vehiclematerialgroup = vehiclematerialgroupService.getById(groupId); |
|
|
|
String workorderCode = vehiclematerialgroup.getWorkorder_code(); |
|
|
|
// 获取工单
|
|
|
|
PdmBdWorkorder workorder = pdmBdWorkorderService.getByCode(workorderCode); |
|
|
|
String extData = workorder.getExt_data(); |
|
|
|
MesWorkOrderDto mesWorkOrderDto = JSON.parseObject(extData, MesWorkOrderDto.class); |
|
|
|
log.info("获取mes给的工单数据:{}", mesWorkOrderDto); |
|
|
|
MesSemiProductionInfoInDto semiProductionInfoInDto = new MesSemiProductionInfoInDto(); |
|
|
|
semiProductionInfoInDto.setMSGID(IdUtil.simpleUUID()); |
|
|
|
semiProductionInfoInDto.setFORDER_NO(mesWorkOrderDto.getFORDER_NO()); |
|
|
|
semiProductionInfoInDto.setPRESSUNIT(mesWorkOrderDto.getPRESSUNIT()); |
|
|
|
semiProductionInfoInDto.setFSCHEDULE_ID(mesWorkOrderDto.getFSCHEDULE_ID()); |
|
|
|
semiProductionInfoInDto.setFPRODUCT_MATERIAL_ID(mesWorkOrderDto.getFPRODUCT_MATERIAL_ID()); |
|
|
|
semiProductionInfoInDto.setFPRODUCT_MATERIAL_NAME(mesWorkOrderDto.getFPRODUCT_MATERIAL_NAME()); |
|
|
|
semiProductionInfoInDto.setFMATSPEC(mesWorkOrderDto.getFMATSPEC()); |
|
|
|
semiProductionInfoInDto.setFMATMODEL(mesWorkOrderDto.getFMATMODEL()); |
|
|
|
semiProductionInfoInDto.setBATCHNO(mesWorkOrderDto.getBATCHNO()); |
|
|
|
semiProductionInfoInDto.setPRESSUNIT(mesWorkOrderDto.getPRESSUNIT()); |
|
|
|
semiProductionInfoInDto.setFTEAM(workorder.getTeam()); |
|
|
|
semiProductionInfoInDto.setTRAY_NO(vehiclematerialgroup.getVehicle_code()); |
|
|
|
semiProductionInfoInDto.setPRO_SUBNUM(String.valueOf(vehiclematerialgroup.getMaterial_qty()));// 数量
|
|
|
|
semiProductionInfoInDto.setPRO_SUBUNIT("块"); |
|
|
|
semiProductionInfoInDto.setCHECKERIN_TIM(DateUtil.now()); |
|
|
|
semiProductionInfoInDto.setPRODATE(workorder.getProduce_date()); |
|
|
|
semiProductionInfoInDto.setCREATE_TM(DateUtil.now()); |
|
|
|
semiProductionInfoInDto.setOP_FLAG(GeneralDefinition.NO); |
|
|
|
log.info("入滚筒线返给MES的数据:{}", semiProductionInfoInDto); |
|
|
|
// 插入mes数据库
|
|
|
|
try { |
|
|
|
mesRequestMapper.insertSemiProductInfo(semiProductionInfoInDto); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("入滚筒线插入mes数据库失败:{}", workorder); |
|
|
|
// todo:发送通知
|
|
|
|
noticeService.createNotice("入滚筒线插入mes数据库失败", "入滚筒线" + semiProductionInfoInDto.getMSGID(), |
|
|
|
NoticeTypeEnum.EXCEPTION.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void reportSemiProductionInfoOut(String groupId) { |
|
|
|
log.info("物料出滚筒线"); |
|
|
|
// 获取组盘信息
|
|
|
|
SchBaseVehiclematerialgroup vehiclematerialgroup = vehiclematerialgroupService.getById(groupId); |
|
|
|
String workorderCode = vehiclematerialgroup.getWorkorder_code(); |
|
|
|
// 获取工单
|
|
|
|
PdmBdWorkorder workorder = pdmBdWorkorderService.getByCode(workorderCode); |
|
|
|
String extData = workorder.getExt_data(); |
|
|
|
MesWorkOrderDto mesWorkOrderDto = JSON.parseObject(extData, MesWorkOrderDto.class); |
|
|
|
log.info("获取mes给的工单数据:{}", mesWorkOrderDto); |
|
|
|
MesSemiProductionInfoOutDto semiProductionInfoOutDto = new MesSemiProductionInfoOutDto(); |
|
|
|
semiProductionInfoOutDto.setMSGID(IdUtil.simpleUUID()); |
|
|
|
semiProductionInfoOutDto.setSEMIPRODUCT_BATCHNO(workorder.getBatch_no()); |
|
|
|
semiProductionInfoOutDto.setPRODUCT_BATCHNO(workorder.getBatch_no()); |
|
|
|
semiProductionInfoOutDto.setFPRODUCT_MATERIAL_ID(mesWorkOrderDto.getFPRODUCT_MATERIAL_ID()); |
|
|
|
semiProductionInfoOutDto.setFPRODUCT_MATERIAL_NAME(mesWorkOrderDto.getFPRODUCT_MATERIAL_NAME()); |
|
|
|
semiProductionInfoOutDto.setFMATSPEC(mesWorkOrderDto.getFMATSPEC()); |
|
|
|
semiProductionInfoOutDto.setFMATMODEL(mesWorkOrderDto.getFMATMODEL()); |
|
|
|
semiProductionInfoOutDto.setPRO_NUM(String.valueOf(vehiclematerialgroup.getMaterial_qty())); |
|
|
|
semiProductionInfoOutDto.setPRO_UNIT("块"); |
|
|
|
semiProductionInfoOutDto.setSTOCK("未知"); |
|
|
|
semiProductionInfoOutDto.setSTOCK_NAME("未知"); |
|
|
|
semiProductionInfoOutDto.setCHECKEROUT_TIM(vehiclematerialgroup.getUpdate_time()); |
|
|
|
semiProductionInfoOutDto.setOUTTYPE("成品出库"); |
|
|
|
semiProductionInfoOutDto.setCREATE_TM(DateUtil.now()); |
|
|
|
semiProductionInfoOutDto.setOP_FLAG(GeneralDefinition.NO); |
|
|
|
log.info("出滚筒线返给MES的数据:{}", semiProductionInfoOutDto); |
|
|
|
// 插入mes数据库
|
|
|
|
try { |
|
|
|
mesRequestMapper.insertSemiProductOutInfo(semiProductionInfoOutDto); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("出滚筒线插入mes数据库失败:{}", workorder); |
|
|
|
// todo:发送通知
|
|
|
|
noticeService.createNotice("入滚筒线插入mes数据库失败", "入滚筒线" + semiProductionInfoOutDto.getMSGID(), |
|
|
|
NoticeTypeEnum.EXCEPTION.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void reportGdyMaterialInfoIn(String groupId) { |
|
|
|
log.info("物料入窑"); |
|
|
|
// 获取组盘信息
|
|
|
|
SchBaseVehiclematerialgroup vehiclematerialgroup = vehiclematerialgroupService.getById(groupId); |
|
|
|
String workorderCode = vehiclematerialgroup.getWorkorder_code(); |
|
|
|
// 获取工单
|
|
|
|
PdmBdWorkorder workorder = pdmBdWorkorderService.getByCode(workorderCode); |
|
|
|
String extData = workorder.getExt_data(); |
|
|
|
MesWorkOrderDto mesWorkOrderDto = JSON.parseObject(extData, MesWorkOrderDto.class); |
|
|
|
log.info("获取mes给的工单数据:{}", mesWorkOrderDto); |
|
|
|
MesGdyMaterialInDto gdyMaterialInDto = new MesGdyMaterialInDto(); |
|
|
|
gdyMaterialInDto.setMSGID(IdUtil.simpleUUID()); |
|
|
|
gdyMaterialInDto.setTRAY_NO(vehiclematerialgroup.getVehicle_code()); |
|
|
|
gdyMaterialInDto.setFPRODUCT_MATERIAL_ID(mesWorkOrderDto.getFPRODUCT_MATERIAL_ID()); |
|
|
|
gdyMaterialInDto.setFPRODUCT_MATERIAL_NAME(mesWorkOrderDto.getFPRODUCT_MATERIAL_NAME()); |
|
|
|
gdyMaterialInDto.setFMATSPEC(mesWorkOrderDto.getFMATSPEC()); |
|
|
|
gdyMaterialInDto.setFMATMODE(mesWorkOrderDto.getFMATMODEL()); |
|
|
|
gdyMaterialInDto.setBATCHNO(mesWorkOrderDto.getBATCHNO()); |
|
|
|
gdyMaterialInDto.setPRESSUNIT(mesWorkOrderDto.getPRESSUNIT()); |
|
|
|
gdyMaterialInDto.setPRO_NUM(String.valueOf(vehiclematerialgroup.getMaterial_qty())); |
|
|
|
gdyMaterialInDto.setPRO_UNIT("块"); |
|
|
|
gdyMaterialInDto.setFCONVERTRATE(mesWorkOrderDto.getFCONVERTRATE()); |
|
|
|
gdyMaterialInDto.setSTOCK("未知"); |
|
|
|
gdyMaterialInDto.setDEVICE(GeneralDefinition.YES); |
|
|
|
gdyMaterialInDto.setIN_DATE(vehiclematerialgroup.getInto_kiln_time()); |
|
|
|
gdyMaterialInDto.setCREATE_TM(DateUtil.now()); |
|
|
|
gdyMaterialInDto.setOP_FLAG(GeneralDefinition.NO); |
|
|
|
log.info("入窑返给MES的数据:{}", gdyMaterialInDto); |
|
|
|
// 插入mes数据库
|
|
|
|
try { |
|
|
|
mesRequestMapper.insertGdyMaterialIn(gdyMaterialInDto); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("入窑插入mes数据库失败:{}", workorder); |
|
|
|
// todo:发送通知
|
|
|
|
noticeService.createNotice("入窑插入mes数据库失败", "入窑" + gdyMaterialInDto.getMSGID(), |
|
|
|
NoticeTypeEnum.EXCEPTION.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void reportGdyMaterialInfoOut(String groupId) { |
|
|
|
log.info("物料出窑"); |
|
|
|
// 获取组盘信息
|
|
|
|
SchBaseVehiclematerialgroup vehiclematerialgroup = vehiclematerialgroupService.getById(groupId); |
|
|
|
String workorderCode = vehiclematerialgroup.getWorkorder_code(); |
|
|
|
// 获取工单
|
|
|
|
PdmBdWorkorder workorder = pdmBdWorkorderService.getByCode(workorderCode); |
|
|
|
String extData = workorder.getExt_data(); |
|
|
|
MesWorkOrderDto mesWorkOrderDto = JSON.parseObject(extData, MesWorkOrderDto.class); |
|
|
|
log.info("获取mes给的工单数据:{}", mesWorkOrderDto); |
|
|
|
MesGdyMaterialOutDto gdyMaterialOutDto = new MesGdyMaterialOutDto(); |
|
|
|
gdyMaterialOutDto.setMSGID(IdUtil.simpleUUID()); |
|
|
|
gdyMaterialOutDto.setTRAY_NO(vehiclematerialgroup.getVehicle_code()); |
|
|
|
gdyMaterialOutDto.setFPRODUCT_MATERIAL_ID(mesWorkOrderDto.getFPRODUCT_MATERIAL_ID()); |
|
|
|
gdyMaterialOutDto.setFPRODUCT_MATERIAL_NAME(mesWorkOrderDto.getFPRODUCT_MATERIAL_NAME()); |
|
|
|
gdyMaterialOutDto.setFMATSPEC(mesWorkOrderDto.getFMATSPEC()); |
|
|
|
gdyMaterialOutDto.setFMATMODEL(mesWorkOrderDto.getFMATMODEL()); |
|
|
|
gdyMaterialOutDto.setBATCHNO(mesWorkOrderDto.getBATCHNO()); |
|
|
|
gdyMaterialOutDto.setPRESSUNIT(mesWorkOrderDto.getPRESSUNIT()); |
|
|
|
gdyMaterialOutDto.setPRO_SUBNUM(String.valueOf(vehiclematerialgroup.getMaterial_qty())); |
|
|
|
gdyMaterialOutDto.setPRO_SUBUNIT("块"); |
|
|
|
gdyMaterialOutDto.setFCONVERTRATE(mesWorkOrderDto.getFCONVERTRATE()); |
|
|
|
gdyMaterialOutDto.setSTOCK("未知"); |
|
|
|
gdyMaterialOutDto.setDEVICE("1"); |
|
|
|
gdyMaterialOutDto.setOUT_DATE(vehiclematerialgroup.getOut_kiln_time()); |
|
|
|
gdyMaterialOutDto.setCREATE_TM(DateUtil.now()); |
|
|
|
gdyMaterialOutDto.setOP_FLAG(GeneralDefinition.NO); |
|
|
|
log.info("出窑返给MES的数据:{}", gdyMaterialOutDto); |
|
|
|
// 插入mes数据库
|
|
|
|
try { |
|
|
|
mesRequestMapper.insertGdyMaterialOut(gdyMaterialOutDto); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("出窑插入mes数据库失败:{}", workorder); |
|
|
|
// todo:发送通知
|
|
|
|
noticeService.createNotice("出窑插入mes数据库失败", "出窑" + gdyMaterialOutDto.getMSGID(), |
|
|
|
NoticeTypeEnum.EXCEPTION.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|