@ -9,8 +9,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper ;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper ;
import lombok.extern.slf4j.Slf4j ;
import lombok.extern.slf4j.Slf4j ;
import org.nl.system.service.notice.ISysNoticeService ;
import org.nl.system.service.notice.ISysNoticeService ;
import org.nl.wms.database.brick.service.dao.MdBaseBrickInfo ;
import org.nl.wms.database.material.service.IMdBaseMaterialService ;
import org.nl.wms.database.material.service.IMdBaseMaterialService ;
import org.nl.wms.database.material.service.dao.MdBaseMaterial ;
import org.nl.wms.database.material.service.dao.MdBaseMaterial ;
import org.nl.wms.ext.acs.service.dto.BrickInfoDto ;
import org.nl.wms.ext.mes.autotask.AutoSaveWaitGdyInfo ;
import org.nl.wms.ext.mes.autotask.AutoSaveWaitGdyInfo ;
import org.nl.wms.ext.mes.service.WmsToMesService ;
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.dao.mapper.MesRequestMapper ;
@ -36,7 +38,7 @@ import java.util.stream.Collectors;
/ * *
/ * *
* @Author : lyd
* @Author : lyd
* @Description :
* @Description : wms请求mes的实现类
* @Date : 2023 / 8 / 3
* @Date : 2023 / 8 / 3
* /
* /
@Slf4j
@Slf4j
@ -140,7 +142,8 @@ public class WmsToMesServiceImpl implements WmsToMesService {
mesProductDataDto . setPRO_SUBNUM ( BigDecimal . valueOf ( vehiclematerialgroup . getMaterial_qty ( ) ) ) ; // 数量
mesProductDataDto . setPRO_SUBNUM ( BigDecimal . valueOf ( vehiclematerialgroup . getMaterial_qty ( ) ) ) ; // 数量
mesProductDataDto . setPRO_SUBUNIT ( "块" ) ;
mesProductDataDto . setPRO_SUBUNIT ( "块" ) ;
mesProductDataDto . setCHECKERIN_TIM ( DateUtil . now ( ) ) ;
mesProductDataDto . setCHECKERIN_TIM ( DateUtil . now ( ) ) ;
mesProductDataDto . setPRODATE ( ObjectUtil . isNotEmpty ( workorder . getProduce_date ( ) ) ? workorder . getProduce_date ( ) : DateUtil . now ( ) ) ;
mesProductDataDto . setPRODATE ( ObjectUtil . isNotEmpty ( workorder . getProduce_date ( ) )
? workorder . getProduce_date ( ) : DateUtil . now ( ) ) ;
mesProductDataDto . setCREATE_TM ( DateUtil . now ( ) ) ;
mesProductDataDto . setCREATE_TM ( DateUtil . now ( ) ) ;
mesProductDataDto . setOP_FLAG ( GeneralDefinition . NO ) ;
mesProductDataDto . setOP_FLAG ( GeneralDefinition . NO ) ;
log . info ( "压机产出返给MES的数据:{}" , mesProductDataDto ) ;
log . info ( "压机产出返给MES的数据:{}" , mesProductDataDto ) ;
@ -150,8 +153,8 @@ public class WmsToMesServiceImpl implements WmsToMesService {
} catch ( Exception e ) {
} catch ( Exception e ) {
log . error ( "反馈压机产出插入mes数据库失败:{}" , e . getMessage ( ) ) ;
log . error ( "反馈压机产出插入mes数据库失败:{}" , e . getMessage ( ) ) ;
// 发送通知
// 发送通知
noticeService . createNotice ( "反馈压机产出插入mes数据库失败" , "压机产出" + mesProductDataDto . getPRESSUNIT ( ) ,
noticeService . createNotice ( "反馈压机产出插入mes数据库失败" , "压机产出"
NoticeTypeEnum . EXCEPTION . getCode ( ) ) ;
+ mesProductDataDto . getPRESSUNIT ( ) , NoticeTypeEnum . EXCEPTION . getCode ( ) ) ;
}
}
}
}
@ -192,8 +195,8 @@ public class WmsToMesServiceImpl implements WmsToMesService {
} catch ( Exception e ) {
} catch ( Exception e ) {
log . error ( "半成品入库插入mes数据库失败:{}" , e . getMessage ( ) ) ;
log . error ( "半成品入库插入mes数据库失败:{}" , e . getMessage ( ) ) ;
// todo:发送通知
// todo:发送通知
noticeService . createNotice ( "半成品入库插入mes数据库失败" , "半成品入库" + semiProductionInfoInDto . getMSGID ( ) ,
noticeService . createNotice ( "半成品入库插入mes数据库失败" , "半成品入库"
NoticeTypeEnum . EXCEPTION . getCode ( ) ) ;
+ semiProductionInfoInDto . getMSGID ( ) , NoticeTypeEnum . EXCEPTION . getCode ( ) ) ;
}
}
}
}
@ -364,6 +367,9 @@ public class WmsToMesServiceImpl implements WmsToMesService {
mesRequestMapper . insertMesUnusedInfo ( mesUnusedDto ) ;
mesRequestMapper . insertMesUnusedInfo ( mesUnusedDto ) ;
} catch ( Exception e ) {
} catch ( Exception e ) {
log . error ( "插入机口判废失败:{}" , e . getMessage ( ) ) ;
log . error ( "插入机口判废失败:{}" , e . getMessage ( ) ) ;
// todo:发送通知
noticeService . createNotice ( "机口判废插入mes数据库失败" , "机口判废" + mesUnusedDto . getMSGID ( ) ,
NoticeTypeEnum . EXCEPTION . getCode ( ) ) ;
}
}
}
}
@ -372,6 +378,67 @@ public class WmsToMesServiceImpl implements WmsToMesService {
return mesRequestMapper . getAllWaitIntoGdyInfos ( ) ;
return mesRequestMapper . getAllWaitIntoGdyInfos ( ) ;
}
}
@Override
public void reportBrickInfo ( MdBaseBrickInfo brickInfo ) {
// 转换成mes字段
MesQSPressMonitorData mesQSPressMonitorData = toPressMonitorMapper ( brickInfo ) ;
// 插入mes数据库
try {
mesRequestMapper . insertQSPressMonitorData ( mesQSPressMonitorData ) ;
} catch ( Exception e ) {
log . error ( "插入压机检测失败:{}" , e . getMessage ( ) ) ;
// todo:发送通知
noticeService . createNotice ( "压机检测插入mes数据库失败" , "压机检测"
+ mesQSPressMonitorData . getBRICK_ID ( ) , NoticeTypeEnum . EXCEPTION . getCode ( ) ) ;
}
}
@Override
public List < MesShelfInfo > getAllShelfInfos ( ) {
return mesRequestMapper . getAllShelfInfos ( ) ;
}
@Override
public void saveShelfInfoBatchToMes ( MesShelfInfo shelfInfo ) {
mesRequestMapper . saveShelfInfoBatchToMes ( shelfInfo ) ;
}
/ * *
* 转换
* @param brickInfo : lms的砖块检测信息
* @return 上报mes的砖块检测信息
* /
private MesQSPressMonitorData toPressMonitorMapper ( MdBaseBrickInfo brickInfo ) {
// 获取mes的设备
SchBasePoint device = pointService . getById ( brickInfo . getGet_station ( ) ) ;
MesQSPressMonitorData monitorData = new MesQSPressMonitorData ( ) ;
monitorData . setBRICK_ID ( brickInfo . getBrick_id ( ) ) ;
monitorData . setGET_STATION ( device . getExt_point_code ( ) ) ;
monitorData . setPUT_STATION ( brickInfo . getPut_station ( ) ) ;
monitorData . setIS_QUALIFIED ( brickInfo . getIs_qualified ( ) ) ;
monitorData . setLASER_MARKING_CODE ( brickInfo . getLaser_marking_code ( ) ) ;
monitorData . setWEIGHT ( brickInfo . getWeight ( ) ) ;
monitorData . setHEIGHT1 ( brickInfo . getHeight1 ( ) ) ;
monitorData . setHEIGHT2 ( brickInfo . getHeight2 ( ) ) ;
monitorData . setHEIGHT3 ( brickInfo . getHeight3 ( ) ) ;
monitorData . setHEIGHT4 ( brickInfo . getHeight4 ( ) ) ;
monitorData . setWIDTH1 ( brickInfo . getWidth1 ( ) ) ;
monitorData . setWIDTH2 ( brickInfo . getWidth2 ( ) ) ;
monitorData . setLEN ( brickInfo . getLen ( ) ) ;
monitorData . setVOLUME ( brickInfo . getVolume ( ) ) ;
monitorData . setFLATNESS ( brickInfo . getFlatness ( ) ) ;
monitorData . setUNQUALIFIED_QTY ( brickInfo . getUnqualified_qty ( ) ) ;
monitorData . setWORKORDER_CODE ( brickInfo . getWorkorder_code ( ) ) ;
monitorData . setCREATE_TM ( DateUtil . now ( ) ) ;
monitorData . setOP_FLAG ( GeneralDefinition . NO ) ;
return monitorData ;
}
/ * *
* 转换
* @param mesWorkOrderInfos : mes的工单
* @return lms工单
* /
public List < PdmBdWorkorder > toWorkOrderList ( List < MesWorkOrderDto > mesWorkOrderInfos ) {
public List < PdmBdWorkorder > toWorkOrderList ( List < MesWorkOrderDto > mesWorkOrderInfos ) {
List < PdmBdWorkorder > list = new CopyOnWriteArrayList < > ( ) ;
List < PdmBdWorkorder > list = new CopyOnWriteArrayList < > ( ) ;
mesWorkOrderInfos . forEach ( mesWorkOrderDto - > {
mesWorkOrderInfos . forEach ( mesWorkOrderDto - > {