Browse Source

add: mes对接出入窑数据

master
李永德 1 year ago
parent
commit
774b2d446f
  1. 0
      lms/nladmin-system/logPath_IS_UNDEFINED/XgAgvDeviceDriver/DEVICECODE_IS_UNDEFINED/2023-09-13.0.log
  2. 4
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/common/exception/BadRequestException.java
  3. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/LogMessageConstant.java
  4. 23
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/WmsToMesService.java
  5. 12
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dao/mapper/MesRequestMapper.java
  6. 28
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dao/mapper/MesRequestMapper.xml
  7. 33
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dto/MesGdyMaterialInDto.java
  8. 33
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dto/MesGdyMaterialOutDto.java
  9. 37
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dto/MesSemiProductionInfoInDto.java
  10. 32
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dto/MesSemiProductionInfoOutDto.java
  11. 180
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/impl/WmsToMesServiceImpl.java
  12. 3
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AutoCreateTask.java
  13. 7
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/hn/HNMLTask.java
  14. 5
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/yao/CYZCTask.java
  15. 10
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/yao/GZYQLTask.java
  16. 5
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/yz/YZSLTask.java
  17. 10
      lms/nladmin-system/nlsso-server/src/main/resources/config/application-prod.yml
  18. 2
      lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml
  19. 2
      lms/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml
  20. 2
      lms/nladmin-system/nlsso-server/src/test/java/org/nl/ext/TestDemo.java

0
lms/nladmin-system/logPath_IS_UNDEFINED/XgAgvDeviceDriver/DEVICECODE_IS_UNDEFINED/2023-09-13.0.log

4
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){

2
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";
}

23
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);
}

12
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);
}

28
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>
<insert id="insertSemiProductInfo" parameterType="org.nl.wms.ext.mes.service.dto.MesSemiProductionInfoInDto">
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>
<insert id="insertSemiProductOutInfo" parameterType="org.nl.wms.ext.mes.service.dto.MesSemiProductionInfoOutDto">
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>
<insert id="insertGdyMaterialIn" parameterType="org.nl.wms.ext.mes.service.dto.MesGdyMaterialInDto">
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>
<insert id="insertGdyMaterialOut" parameterType="org.nl.wms.ext.mes.service.dto.MesGdyMaterialOutDto">
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})
</insert>
<update id="updateWorkOrderRead" parameterType="java.util.List">
UPDATE "LMSTELCOM"."SEND_POP_SCHEDULE_PRESS"
SET OP_FLAG = '1'

33
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;
}

33
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;
}

37
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;
}

32
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;
}

180
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());
}
}

3
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<Class<? extends AbstractTask>> subTypes = null;
private Map<Class<?>, Method> methodCache = new HashMap<>();
// 类加载时候执行扫描
static {
Reflections reflections = new Reflections("org.nl.wms.sch.task_manage.task.tasks");

7
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();
}

5
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);

10
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);

5
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);

10
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

2
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:

2
lms/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml

@ -107,7 +107,7 @@ https://juejin.cn/post/6844903775631572999
<!--生产环境:打印控制台和输出到文件-->
<springProfile name="prod">
<root level="INFO">
<root level="ERROR">
<appender-ref ref="asyncFileAppender"/>
<appender-ref ref="asyncLuceneAppender"/>
</root>

2
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 + "次");
}
}
}

Loading…
Cancel
Save