diff --git a/lms/nladmin-system/logPath_IS_UNDEFINED/XgAgvDeviceDriver/DEVICECODE_IS_UNDEFINED/2023-09-13.0.log b/lms/nladmin-system/logPath_IS_UNDEFINED/XgAgvDeviceDriver/DEVICECODE_IS_UNDEFINED/2023-09-13.0.log new file mode 100644 index 0000000..e69de29 diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/common/exception/BadRequestException.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/common/exception/BadRequestException.java index ce1a3f3..627bdef 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/common/exception/BadRequestException.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/common/exception/BadRequestException.java @@ -16,6 +16,8 @@ package org.nl.common.exception; import lombok.Getter; +import lombok.extern.slf4j.Slf4j; +import org.nl.common.logging.annotation.Log; import org.springframework.http.HttpStatus; import static org.springframework.http.HttpStatus.BAD_REQUEST; @@ -25,6 +27,7 @@ import static org.springframework.http.HttpStatus.BAD_REQUEST; * @date 2018-11-23 * 统一异常处理 */ +@Slf4j @Getter public class BadRequestException extends RuntimeException{ @@ -32,6 +35,7 @@ public class BadRequestException extends RuntimeException{ public BadRequestException(String msg){ super(msg); + log.error("异常信息:{}", msg); } public BadRequestException(HttpStatus status,String msg){ diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/LogMessageConstant.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/LogMessageConstant.java index e407f84..1b80bef 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/LogMessageConstant.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/LogMessageConstant.java @@ -42,5 +42,5 @@ public class LogMessageConstant { public final static String BACKGROUND_YELLOW = "\u001B[43m"; /** 索引路径 */ - public final static String INDEX_DIR = "D:\\lucene\\index"; + public final static String INDEX_DIR = "E:\\lucene\\index"; } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/WmsToMesService.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/WmsToMesService.java index 0dda596..9b8d43b 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/WmsToMesService.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/WmsToMesService.java @@ -27,4 +27,27 @@ public interface WmsToMesService { * @param groupId */ void reportProductData(String groupId); + + /** + * wms入滚筒线上报半成品入库信息 + */ + void reportSemiProductionInfoIn(String groupId); + + /** + * wms出滚筒线上报半成品出库信息 + * @param groupId + */ + void reportSemiProductionInfoOut(String groupId); + + /** + * wms上报入窑记录信息 + * @param groupId + */ + void reportGdyMaterialInfoIn(String groupId); + + /** + * wms上报出窑数据 + * @param groupId + */ + void reportGdyMaterialInfoOut(String groupId); } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dao/mapper/MesRequestMapper.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dao/mapper/MesRequestMapper.java index 72f01d5..1c2c49b 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dao/mapper/MesRequestMapper.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dao/mapper/MesRequestMapper.java @@ -4,9 +4,7 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.dynamic.datasource.annotation.DS; import org.apache.ibatis.annotations.Param; import org.nl.wms.database.material.service.dao.MdBaseMaterial; -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 java.util.List; @@ -30,4 +28,12 @@ public interface MesRequestMapper { void insertMudConsumptionInfo(MesMudConsumptionDto mudObject); @DS("oracle") void insertProductData(MesProductDataDto mesProductDataDto); + @DS("oracle") + void insertSemiProductInfo(MesSemiProductionInfoInDto semiProductionInfoInDto); + @DS("oracle") + void insertSemiProductOutInfo(MesSemiProductionInfoOutDto semiProductionInfoOutDto); + @DS("oracle") + void insertGdyMaterialIn(MesGdyMaterialInDto gdyMaterialInDto); + @DS("oracle") + void insertGdyMaterialOut(MesGdyMaterialOutDto gdyMaterialOutDto); } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dao/mapper/MesRequestMapper.xml b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dao/mapper/MesRequestMapper.xml index 3e46019..104af63 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dao/mapper/MesRequestMapper.xml +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dao/mapper/MesRequestMapper.xml @@ -13,6 +13,34 @@ , #{FPRODUCT_MATERIAL_ID}, #{FPRODUCT_MATERIAL_NAME}, #{FMATSPEC}, #{FMATMODEL}, #{BATCHNO}, #{PRESSUNIT} , #{FTEAM}, #{TRAY_NO}, #{PRO_SUBNUM}, #{PRO_SUBUNIT}, #{CHECKERIN_TIM}, #{PRODATE}, #{CREATE_TM}, #{OP_FLAG}) + + INSERT INTO "LMSTELCOM"."RECEIVE_CS_SEMIPROINFO_IN"(MSGID, FORDER_NO, PRESSUNIT, FSCHEDULE_ID, FPRODUCT_MATERIAL_ID + , FPRODUCT_MATERIAL_NAME, FMATSPEC, FMATMODEL, BATCHNO, PRESSUNIT, FTEAM, TRAY_NO, PRO_SUBNUM, PRO_SUBUNIT + , CHECKERIN_TIM, PRODATE, CREATE_TM, OP_FLAG) VALUES (#{MSGID}, #{FORDER_NO}, #{PRESSUNIT}, #{FSCHEDULE_ID}, #{FPRODUCT_MATERIAL_ID} + , #{FPRODUCT_MATERIAL_NAME}, #{FMATSPEC}, #{FMATMODEL}, #{BATCHNO}, #{PRESSUNIT}, #{FTEAM}, #{TRAY_NO}, #{PRO_SUBNUM} + , #{PRO_SUBUNIT}, #{CHECKERIN_TIM}, #{PRODATE}, #{CREATE_TM}, #{OP_FLAG}) + + + INSERT INTO "LMSTELCOM"."RECEIVE_CS_SEMIPROINFO_OUT"(MSGID, SEMIPRODUCT_BATCHNO, PRODUCT_BATCHNO, FPRODUCT_MATERIAL_ID + , FPRODUCT_MATERIAL_NAME, FMATSPEC, FMATMODEL, PRO_SUBNUM, PRO_SUBUNIT, STOCK, STOCK_NAME, CHECKEROUT_TIM, OUTTYPE + , CREATE_TM, OP_FLAG) VALUES (#{MSGID}, #{SEMIPRODUCT_BATCHNO}, #{PRODUCT_BATCHNO}, #{FPRODUCT_MATERIAL_ID} + , #{FPRODUCT_MATERIAL_NAME}, #{FMATSPEC}, #{FMATMODEL}, #{PRO_SUBNUM}, #{PRO_SUBUNIT}, #{STOCK}, #{STOCK_NAME} + , #{CHECKEROUT_TIM}, #{OUTTYPE}, #{CREATE_TM}, #{OP_FLAG}) + + + INSERT INTO "LMSTELCOM"."RECEIVE_GDY_MATIN"(MSGID, TRAY_NO, FPRODUCT_MATERIAL_ID, FPRODUCT_MATERIAL_NAME + , FMATSPEC, FMATMODE, BATCHNO, PRESSUNIT, PRO_SUBNUM, PRO_SUBUNIT, FCONVERTRATE, STOCK, DEVICE, IN_DATE + , CREATE_TM, OP_FLAG) VALUES (#{MSGID}, #{TRAY_NO}, #{FPRODUCT_MATERIAL_ID}, #{FPRODUCT_MATERIAL_NAME} + , #{FMATSPEC}, #{FMATMODE}, #{BATCHNO}, #{PRESSUNIT}, #{PRO_SUBNUM}, #{PRO_SUBUNIT}, #{FCONVERTRATE} + , #{STOCK}, #{DEVICE}, #{IN_DATE}, #{CREATE_TM}, #{OP_FLAG}) + + + INSERT INTO "LMSTELCOM"."RECEIVE_GDY_MATOUT"(MSGID, TRAY_NO, FPRODUCT_MATERIAL_ID, FPRODUCT_MATERIAL_NAME + , FMATSPEC, FMATMODE, BATCHNO, PRESSUNIT, PRO_SUBNUM, PRO_SUBUNIT, FCONVERTRATE, STOCK, DEVICE, OUT_DATE + , CREATE_TM, OP_FLAG) VALUES (#{MSGID}, #{TRAY_NO}, #{FPRODUCT_MATERIAL_ID}, #{FPRODUCT_MATERIAL_NAME} + , #{FMATSPEC}, #{FMATMODE}, #{BATCHNO}, #{PRESSUNIT}, #{PRO_SUBNUM}, #{PRO_SUBUNIT}, #{FCONVERTRATE} + , #{STOCK}, #{DEVICE}, #{OUT_DATE}, #{CREATE_TM}, #{OP_FLAG}) + UPDATE "LMSTELCOM"."SEND_POP_SCHEDULE_PRESS" SET OP_FLAG = '1' diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dto/MesGdyMaterialInDto.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dto/MesGdyMaterialInDto.java new file mode 100644 index 0000000..ca7e27e --- /dev/null +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dto/MesGdyMaterialInDto.java @@ -0,0 +1,33 @@ +package org.nl.wms.ext.mes.service.dto; + +import lombok.Data; + +/** + * @Author: lyd + * @Description: 入窑记录数据 + * @Date: 2023/9/14 + */ +@Data +public class MesGdyMaterialInDto { + private String MSGID; + private String TRAY_NO; + private String FPRODUCT_MATERIAL_ID; + private String FPRODUCT_MATERIAL_NAME; + private String FMATSPEC; + private String FMATMODE; + private String BATCHNO; + private String PRESSUNIT; + private String PRO_NUM; + private String PRO_UNIT; + private String PRO_SUBNUM; + private String PRO_SUBUNIT; + private String FCONVERTRATE; + private String STOCK; + private String DEVICE; + private String DEVICEUNITPOST; + private String IN_DATE; + private String CREATE_TM; + private String OP_FLAG; + private String OP_TM; + +} diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dto/MesGdyMaterialOutDto.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dto/MesGdyMaterialOutDto.java new file mode 100644 index 0000000..c4db25c --- /dev/null +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dto/MesGdyMaterialOutDto.java @@ -0,0 +1,33 @@ +package org.nl.wms.ext.mes.service.dto; + +import lombok.Data; + +/** + * @Author: lyd + * @Description: 出窑记录 + * @Date: 2023/9/14 + */ +@Data +public class MesGdyMaterialOutDto { + private String MSGID; + private String TRAY_NO; + private String FPRODUCT_MATERIAL_ID; + private String FPRODUCT_MATERIAL_NAME; + private String FMATSPEC; + private String FMATMODEL; + private String BATCHNO; + private String PRESSUNIT; + private String PRO_NUM; + private String PRO_UNIT; + private String PRO_SUBNUM; + private String PRO_SUBUNIT; + private String FCONVERTRATE; + private String STOCK; + private String DEVICE; + private String DEVICEUNITPOST; + private String OUT_DATE; + private String CREATE_TM; + private String OP_FLAG; + private String OP_TM; + +} diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dto/MesSemiProductionInfoInDto.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dto/MesSemiProductionInfoInDto.java new file mode 100644 index 0000000..033370c --- /dev/null +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dto/MesSemiProductionInfoInDto.java @@ -0,0 +1,37 @@ +package org.nl.wms.ext.mes.service.dto; + +import lombok.Data; + +/** + * @Author: lyd + * @Description: PMS接收半成品入库信息 + * @Date: 2023/9/13 + */ +@Data +public class MesSemiProductionInfoInDto { + private String MSGID; + private String FORDER_NO; + private String PWORKSCHE_ID; + private String FSCHEDULE_ID; + private String FPRODUCT_MATERIAL_ID; + private String FPRODUCT_MATERIAL_NAME; + private String FMATSPEC; + private String FMATMODEL; + private String BATCHNO; + private String PRESSUNIT; + private String FTEAM; + private String TRAY_NO; + private String PRO_NUM; + private String PRO_UNIT; + private String PRO_SUBNUM; + private String PRO_SUBUNIT; + private String STOCK; + private String STOCK_NAME; + private String CHECKERIN; + private String CHECKERIN_TIM; + private String PRODATE; + private String CREATE_TM; + private String OP_FLAG; + private String OP_TM; + +} diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dto/MesSemiProductionInfoOutDto.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dto/MesSemiProductionInfoOutDto.java new file mode 100644 index 0000000..5818560 --- /dev/null +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dto/MesSemiProductionInfoOutDto.java @@ -0,0 +1,32 @@ +package org.nl.wms.ext.mes.service.dto; + +import lombok.Data; + +/** + * @Author: lyd + * @Description: PMS接收半成品出库信息 + * @Date: 2023/9/13 + */ +@Data +public class MesSemiProductionInfoOutDto { + private String MSGID; + private String SEMIPRODUCT_BATCHNO; + private String PRODUCT_BATCHNO; + private String FPRODUCT_MATERIAL_ID; + private String FPRODUCT_MATERIAL_NAME; + private String FMATSPEC; + private String FMATMODEL; + private String PRO_NUM; + private String PRO_UNIT; + private String PRO_SUBNUM; + private String PRO_SUBUNIT; + private String STOCK; + private String STOCK_NAME; + private String CHECKEROUT; + private String CHECKEROUT_TIM; + private String OUTTYPE; + private String CREATE_TM; + private String OP_FLAG; + private String OP_TM; + +} diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/impl/WmsToMesServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/impl/WmsToMesServiceImpl.java index c5a8ffa..c72ffd8 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/impl/WmsToMesServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/impl/WmsToMesServiceImpl.java @@ -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()); } } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AutoCreateTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AutoCreateTask.java index ee9df30..d030645 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AutoCreateTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AutoCreateTask.java @@ -10,6 +10,8 @@ import org.springframework.stereotype.Component; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.Map; import java.util.Set; @@ -18,6 +20,7 @@ import java.util.Set; @Order(value = 1) public class AutoCreateTask { private static Set> subTypes = null; + private Map, Method> methodCache = new HashMap<>(); // 类加载时候执行扫描 static { Reflections reflections = new Reflections("org.nl.wms.sch.task_manage.task.tasks"); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/hn/HNMLTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/hn/HNMLTask.java index 0dd42b7..6fdede0 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/hn/HNMLTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/hn/HNMLTask.java @@ -274,8 +274,9 @@ public class HNMLTask extends AbstractTask { String vehicleCode = TaskUtils.defaultVehicleCode(param.getString("vehicle_code")); String vehicleType = param.getString("vehicle_type"); // 泥料物料对应不出物料标识 - String packNo = param.getString("material_code"); // 泥料编码: 吨袋号,泥料前 - String materialCode = packNo.substring(0, 12); + // todo: 暂未处理 + String materialCode = param.getString("material_code"); // 泥料编码: 吨袋号,泥料前 +// String materialCode = packNo.substring(0, 12); // String mixTimes = param.getString("mix_number"); // 碾次 // 载具类型默认料盅 if (vehicleType == null || vehicleType.equals(GeneralDefinition.NO)) { @@ -320,7 +321,7 @@ public class HNMLTask extends AbstractTask { groupEntity.setGroup_bind_material_status(GroupBindMaterialStatusEnum.BOUND.getValue()); // 待绑定 groupEntity.setGroup_status(GroupStatusEnum.IN_STORAGE.getType()); // 暂时不维护。 groupEntity.setIs_delete(false); - groupEntity.setExt_data(packNo);// todo: 对于混碾的组盘 暂时存吨袋号 +// groupEntity.setExt_data(packNo);// todo: 对于混碾的组盘 暂时存吨袋号 vehiclematerialgroupService.saveOrUpdate(groupEntity); return groupEntity.getGroup_id(); } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/yao/CYZCTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/yao/CYZCTask.java index 47b17a9..4261d56 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/yao/CYZCTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/yao/CYZCTask.java @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import lombok.extern.slf4j.Slf4j; import org.nl.common.exception.BadRequestException; import org.nl.system.service.notice.ISysNoticeService; +import org.nl.wms.ext.mes.service.WmsToMesService; import org.nl.wms.pdm.track.service.IPdmBdProductionProcessTrackingService; import org.nl.wms.pdm.track.service.dao.PdmBdProductionProcessTracking; import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService; @@ -58,6 +59,8 @@ public class CYZCTask extends AbstractTask { private ISchBaseVehiclematerialgroupService vehiclematerialgroupService; @Autowired private IPdmBdProductionProcessTrackingService processTrackingService; + @Autowired + private WmsToMesService wmsToMesService; @Override @Transactional(rollbackFor = Exception.class) @@ -153,6 +156,8 @@ public class CYZCTask extends AbstractTask { } if (status.equals(TaskStatus.FINISHED)) { // 完成 this.finishTask(taskObj, TaskFinishedTypeEnum.AUTO_ACS); + // todo 出窑上报出窑记录 + wmsToMesService.reportGdyMaterialInfoOut(taskObj.getGroup_id()); } if (status.equals(TaskStatus.CANCELED)) { // 取消 this.cancelTask(taskObj, TaskFinishedTypeEnum.AUTO_ACS); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/yao/GZYQLTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/yao/GZYQLTask.java index 34e2016..5c3c8f0 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/yao/GZYQLTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/yao/GZYQLTask.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import lombok.extern.slf4j.Slf4j; import org.nl.common.exception.BadRequestException; import org.nl.system.service.notice.ISysNoticeService; +import org.nl.wms.ext.mes.service.WmsToMesService; import org.nl.wms.sch.point.service.ISchBasePointService; import org.nl.wms.sch.point.service.dao.SchBasePoint; import org.nl.wms.sch.task.service.ISchBaseTaskService; @@ -45,7 +46,8 @@ public class GZYQLTask extends AbstractTask { private ISchBaseTaskService taskService; @Autowired private ISchBaseTaskconfigService taskConfigService; - + @Autowired + private WmsToMesService wmsToMesService; @Autowired private ISysNoticeService noticeService; @Autowired @@ -118,7 +120,7 @@ public class GZYQLTask extends AbstractTask { @Override protected void updateStatus(String task_code, TaskStatus status) { -// 校验任务 + // 校验任务 SchBaseTask taskObj = taskService.getByCode(task_code); if (taskObj.getTask_status().equals(TaskStatus.FINISHED.getCode())) { throw new BadRequestException("该任务已完成!"); @@ -136,6 +138,10 @@ public class GZYQLTask extends AbstractTask { } if (status.equals(TaskStatus.FINISHED)) { // 完成 this.finishTask(taskObj, TaskFinishedTypeEnum.AUTO_ACS); + // todo 上传mes出滚筒线 + wmsToMesService.reportSemiProductionInfoOut(taskObj.getGroup_id()); + // todo 记录入窑数据 + wmsToMesService.reportGdyMaterialInfoIn(taskObj.getGroup_id()); } if (status.equals(TaskStatus.CANCELED)) { // 取消 this.cancelTask(taskObj, TaskFinishedTypeEnum.AUTO_ACS); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/yz/YZSLTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/yz/YZSLTask.java index f41d908..c0ca11e 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/yz/YZSLTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/yz/YZSLTask.java @@ -119,7 +119,7 @@ public class YZSLTask extends AbstractTask { TaskUtils.setUpdateByAcs(task); taskService.updateById(task); -// point.setIng_task_code(task.getTask_code()); + point.setIng_task_code(task.getTask_code()); PointUtils.setUpdateByAcs(point); pointService.updateById(point); @@ -185,7 +185,6 @@ public class YZSLTask extends AbstractTask { } @Override - @Transactional(rollbackFor = Exception.class) protected void updateStatus(String task_code, TaskStatus status) { // 校验任务 SchBaseTask taskObj = taskService.getByCode(task_code); @@ -206,6 +205,8 @@ public class YZSLTask extends AbstractTask { } if (status.equals(TaskStatus.FINISHED)) { // 完成 this.finishTask(taskObj, TaskFinishedTypeEnum.AUTO_ACS); + // todo: 完成后上报给MES + wmsToMesService.reportSemiProductionInfoIn(taskObj.getGroup_id()); } if (status.equals(TaskStatus.CANCELED)) { // 取消 this.cancelTask(taskObj, TaskFinishedTypeEnum.AUTO_ACS); diff --git a/lms/nladmin-system/nlsso-server/src/main/resources/config/application-prod.yml b/lms/nladmin-system/nlsso-server/src/main/resources/config/application-prod.yml index 169e49c..fdfd1b8 100644 --- a/lms/nladmin-system/nlsso-server/src/main/resources/config/application-prod.yml +++ b/lms/nladmin-system/nlsso-server/src/main/resources/config/application-prod.yml @@ -10,12 +10,12 @@ spring: datasource: mysql: driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy -# url: jdbc:log4jdbc:mysql://${DB_HOST:10.93.41.198}:${DB_PORT:3306}/${DB_NAME:rl_mg_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true -# username: ${DB_USER:root} -# password: ${DB_PWD:123456} - url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:rtmg_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true + url: jdbc:log4jdbc:mysql://${DB_HOST:10.93.41.198}:${DB_PORT:3306}/${DB_NAME:rl_mg_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true username: ${DB_USER:root} - password: ${DB_PWD:12356} + password: ${DB_PWD:123456} +# url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:rtmg_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true +# username: ${DB_USER:root} +# password: ${DB_PWD:12356} type: com.alibaba.druid.pool.DruidDataSource oracle: driver-class-name: oracle.jdbc.OracleDriver diff --git a/lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml b/lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml index 7e2aa7b..a37104c 100644 --- a/lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml +++ b/lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml @@ -42,7 +42,7 @@ spring: freemarker: check-template-location: false profiles: - active: dev + active: prod jackson: time-zone: GMT+8 data: diff --git a/lms/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml b/lms/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml index b31797c..9c01099 100644 --- a/lms/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml +++ b/lms/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml @@ -107,7 +107,7 @@ https://juejin.cn/post/6844903775631572999 - + diff --git a/lms/nladmin-system/nlsso-server/src/test/java/org/nl/ext/TestDemo.java b/lms/nladmin-system/nlsso-server/src/test/java/org/nl/ext/TestDemo.java index 047d3e3..a09d282 100644 --- a/lms/nladmin-system/nlsso-server/src/test/java/org/nl/ext/TestDemo.java +++ b/lms/nladmin-system/nlsso-server/src/test/java/org/nl/ext/TestDemo.java @@ -3,7 +3,6 @@ package org.nl.ext; import org.junit.jupiter.api.Test; 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.MesMudConsumptionDto; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -56,4 +55,5 @@ public class TestDemo { System.out.println("上面第" + up + "次"); } } + }