Browse Source

add: 同步货架数据到mes,同步压机检测数据到mes

master
李永德 1 year ago
parent
commit
9f0c7c6e43
  1. 5
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/brick/service/impl/MdBaseBrickInfoServiceImpl.java
  2. 10
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java
  3. 59
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/autotask/AutoSaveShelfInformation.java
  4. 25
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/WmsToMesService.java
  5. 6
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dao/mapper/MesRequestMapper.java
  6. 52
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dao/mapper/MesRequestMapper.xml
  7. 53
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dto/MesQSPressMonitorData.java
  8. 77
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dto/MesShelfInfo.java
  9. 79
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/impl/WmsToMesServiceImpl.java
  10. 29
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/util/Tes.java

5
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/brick/service/impl/MdBaseBrickInfoServiceImpl.java

@ -13,6 +13,7 @@ import org.nl.wms.database.brick.service.IMdBaseBrickInfoService;
import org.nl.wms.database.brick.service.dao.MdBaseBrickInfo; import org.nl.wms.database.brick.service.dao.MdBaseBrickInfo;
import org.nl.wms.database.brick.service.dao.mapper.MdBaseBrickInfoMapper; import org.nl.wms.database.brick.service.dao.mapper.MdBaseBrickInfoMapper;
import org.nl.wms.ext.acs.service.dto.BrickInfoDto; import org.nl.wms.ext.acs.service.dto.BrickInfoDto;
import org.nl.wms.ext.mes.service.WmsToMesService;
import org.nl.wms.pdm.workorder.service.IPdmBdWorkorderService; import org.nl.wms.pdm.workorder.service.IPdmBdWorkorderService;
import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder; import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -34,6 +35,8 @@ public class MdBaseBrickInfoServiceImpl extends ServiceImpl<MdBaseBrickInfoMappe
private MdBaseBrickInfoMapper mdBaseBrickInfoMapper; private MdBaseBrickInfoMapper mdBaseBrickInfoMapper;
@Autowired @Autowired
private IPdmBdWorkorderService workorderService; private IPdmBdWorkorderService workorderService;
@Autowired
private WmsToMesService wmsToMesService;
@Override @Override
public IPage<MdBaseBrickInfo> queryAll(Map whereJson, PageQuery page) { public IPage<MdBaseBrickInfo> queryAll(Map whereJson, PageQuery page) {
@ -66,6 +69,8 @@ public class MdBaseBrickInfoServiceImpl extends ServiceImpl<MdBaseBrickInfoMappe
public void addBrickInfo(BrickInfoDto dto) { public void addBrickInfo(BrickInfoDto dto) {
MdBaseBrickInfo brickInfo = toBrickInfoMapper(dto); MdBaseBrickInfo brickInfo = toBrickInfoMapper(dto);
mdBaseBrickInfoMapper.insert(brickInfo); mdBaseBrickInfoMapper.insert(brickInfo);
// todo:上传mes
wmsToMesService.reportBrickInfo(brickInfo);
} }
@Override @Override

10
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java

@ -62,6 +62,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -438,10 +439,15 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
GroupBindMaterialStatusEnum.UNBOUND.getValue()); GroupBindMaterialStatusEnum.UNBOUND.getValue());
String materialId = groupInfo.getMaterial_id(); String materialId = groupInfo.getMaterial_id();
MdBaseMaterial baseMaterial = materialService.getById(materialId); MdBaseMaterial baseMaterial = materialService.getById(materialId);
BigDecimal materialWeight = ObjectUtil.isNotEmpty(groupInfo.getMaterial_weight())
? groupInfo.getMaterial_weight() : BigDecimal.valueOf(0);
String singleWeightStr = baseMaterial.getSingle_weight();
BigDecimal singleWeight = BigDecimal.valueOf(Double.parseDouble(singleWeightStr));
BigDecimal multiply = materialWeight.multiply(singleWeight);
// 组合 // 组合
sb.append(baseRequest.getVehicle_code()).append("##") sb.append(baseRequest.getVehicle_code()).append("##")
.append(baseMaterial.getMaterial_code()).append("##") .append(baseMaterial.getMaterial_code()).append("##")
.append("吨量").append("##") .append(multiply).append("##")
.append(DateUtil.format(DateUtil.parse(DateUtil.today()), "yyyyMMdd")); .append(DateUtil.format(DateUtil.parse(DateUtil.today()), "yyyyMMdd"));
return ApplyTaskResponse.responseOk(requestNo, sb.toString()); return ApplyTaskResponse.responseOk(requestNo, sb.toString());
} }
@ -664,7 +670,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
processTracking.setProcess_location(baseRequest.getDevice_code()); processTracking.setProcess_location(baseRequest.getDevice_code());
processTracking.setRecord_time(DateUtil.now()); processTracking.setRecord_time(DateUtil.now());
processTrackingService.create(processTracking); processTrackingService.create(processTracking);
return ApplyTaskResponse.responseOk(baseRequest.getRequestNo()); return ApplyTaskResponse.responseOk(baseRequest.getRequestNo(), "扫码成功申请");
} }
/** /**

59
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/autotask/AutoSaveShelfInformation.java

@ -0,0 +1,59 @@
package org.nl.wms.ext.mes.autotask;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.nl.system.service.notice.ISysNoticeService;
import org.nl.wms.ext.mes.service.WmsToMesService;
import org.nl.wms.ext.mes.service.dto.MesShelfInfo;
import org.nl.wms.sch.task_manage.GeneralDefinition;
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
/**
* @Author: lyd
* @Description: 实时同步货架数据
* @Date: 2023/10/11
*/
@Slf4j
@Component
@Order(value = 1)
public class AutoSaveShelfInformation {
@Autowired
private WmsToMesService wmsToMesService;
@Autowired
private ISysNoticeService noticeService;
@SneakyThrows
public void run() {
// 获取所有货架上的信息
List<MesShelfInfo> mesShelfInfos = wmsToMesService.getAllShelfInfos();
AtomicInteger successNum = new AtomicInteger();
long startTime = System.currentTimeMillis();
String now = DateUtil.now();
mesShelfInfos.forEach(shelfInfo -> {
shelfInfo.setMSGID(IdUtil.getSnowflake(1,1).nextIdStr());
shelfInfo.setCREATE_TM(now);
shelfInfo.setSEND_TM(now);
shelfInfo.setOP_FLAG(GeneralDefinition.NO);
// 插入数据
try {
wmsToMesService.saveShelfInfoBatchToMes(shelfInfo);
successNum.getAndIncrement();
} catch (Exception e) {
log.error("插入货架数据失败的数据: {}", shelfInfo);
log.error("插入货架数据失败的信息:{}", e.getMessage());
// notice通知
noticeService.createNotice(e.getMessage(), "货架数据同步失败" + shelfInfo.getGROUP_ID(),
NoticeTypeEnum.NOTIFICATION.getCode());
}
});
long endTime = System.currentTimeMillis();
log.info("滚筒线数据有" + mesShelfInfos.size() + "条,成功" + successNum.get() + "条, 消耗时长:" + (endTime - startTime) + "ms");
}
}

25
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/WmsToMesService.java

@ -1,10 +1,9 @@
package org.nl.wms.ext.mes.service; package org.nl.wms.ext.mes.service;
import org.nl.wms.database.brick.service.dao.MdBaseBrickInfo;
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.dto.MesGdyInfoDto; import org.nl.wms.ext.mes.service.dto.*;
import org.nl.wms.ext.mes.service.dto.MesGdyInfoWaitDto;
import org.nl.wms.ext.mes.service.dto.MesMudConsumptionDto;
import org.nl.wms.ext.mes.service.dto.MesSemiProductionInfo;
import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder; import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder;
import java.util.List; import java.util.List;
@ -75,4 +74,22 @@ public interface WmsToMesService {
* @return * @return
*/ */
List<MesGdyInfoWaitDto> getAllWaitIntoGdyInfos(); List<MesGdyInfoWaitDto> getAllWaitIntoGdyInfos();
/**
* 上报mes砖块检测信息
* @param brickInfo
*/
void reportBrickInfo(MdBaseBrickInfo brickInfo);
/**
* 获取货架所有数据
* @return
*/
List<MesShelfInfo> getAllShelfInfos();
/**
* 插入货架信息
* @param shelfInfo
*/
void saveShelfInfoBatchToMes(MesShelfInfo shelfInfo);
} }

6
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dao/mapper/MesRequestMapper.java

@ -53,4 +53,10 @@ public interface MesRequestMapper {
List<MesGdyInfoWaitDto> getAllWaitIntoGdyInfos(); List<MesGdyInfoWaitDto> getAllWaitIntoGdyInfos();
@DS("oracle") @DS("oracle")
void insertGdyMaterialWait(MesGdyInfoWaitDto mesGdyInfoWaitDto); void insertGdyMaterialWait(MesGdyInfoWaitDto mesGdyInfoWaitDto);
@DS("oracle")
void insertQSPressMonitorData(MesQSPressMonitorData mesQSPressMonitorData);
@DS("mysql")
List<MesShelfInfo> getAllShelfInfos();
@DS("oracle")
void saveShelfInfoBatchToMes(MesShelfInfo shelfInfo);
} }

52
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dao/mapper/MesRequestMapper.xml

@ -70,6 +70,24 @@
VALUES (#{MSGID}, #{SEND_TM}, #{TRAY_NO}, #{FPRODUCT_MATERIAL_ID}, #{FPRODUCT_MATERIAL_NAME}, #{FMATSPEC} VALUES (#{MSGID}, #{SEND_TM}, #{TRAY_NO}, #{FPRODUCT_MATERIAL_ID}, #{FPRODUCT_MATERIAL_NAME}, #{FMATSPEC}
, #{FMATMODEL}, #{BATCHNO}, #{PRESSUNIT}, #{PRO_SUBNUM}, #{PRO_SUBUNIT}, #{CREATE_TM}, #{OP_FLAG}) , #{FMATMODEL}, #{BATCHNO}, #{PRESSUNIT}, #{PRO_SUBNUM}, #{PRO_SUBUNIT}, #{CREATE_TM}, #{OP_FLAG})
</insert> </insert>
<insert id="insertQSPressMonitorData" parameterType="org.nl.wms.ext.mes.service.dto.MesQSPressMonitorData">
INSERT INTO "LMSTELCOM"."RECEIVE_QS_PRESS_MONITORDATA"(BRICK_ID, GET_STATION, PUT_STATION, IS_QUALIFIED, LASER_MARKING_CODE
, WEIGHT, HEIGHT1, HEIGHT2, HEIGHT3, HEIGHT4, WIDTH1, WIDTH2, LEN, VOLUME, FLATNESS, UNQUALIFIED_QTY, WORKORDER_CODE
, CREATE_TM, OP_FLAG) VALUES (#{BRICK_ID}, #{GET_STATION}, #{PUT_STATION}, #{IS_QUALIFIED}, #{LASER_MARKING_CODE}
, #{WEIGHT}, #{HEIGHT1}, #{HEIGHT2}, #{HEIGHT3}, #{HEIGHT4}, #{WIDTH1}, #{WIDTH2}, #{LEN}, #{VOLUME}, #{FLATNESS}
, #{UNQUALIFIED_QTY}, #{WORKORDER_CODE}, #{CREATE_TM}, #{OP_FLAG})
</insert>
<insert id="saveShelfInfoBatchToMes" parameterType="org.nl.wms.ext.mes.service.dto.MesShelfInfo">
INSERT INTO "LMSTELCOM"."RECEIVE_LMS_BINSTA"(MSGID, SEND_TM, GROUP_ID, VEHICLE_TYPE, VEHICLE_CODE, MATERIAL_ID
, MATERIAL_NAME, MATSPEC, MATMODEL, SOURCE_VEHICLE_CODE, POINT_CODE, POINT_NAME, IS_FIRING, IS_FULL, PCSN
, INSTORAGE_TIME, STANDING_TIME, MATERIAL_QTY, MATERIAL_WEIGHT, WORKORDER_CODE, GROUP_NUMBER
, GROUP_BIND_MATERIAL_STATUS, MOVE_WAY, REMARK, UPDATE_TIME, OUT_KILN_TIME, INTO_KILN_TIME, CREATE_TM, OP_FLAG)
VALUES (#{MSGID}, #{SEND_TM}, #{GROUP_ID}, #{VEHICLE_TYPE}, #{VEHICLE_CODE}, #{MATERIAL_ID}, #{MATERIAL_NAME}
, #{MATSPEC}, #{MATMODEL}, #{SOURCE_VEHICLE_CODE}, #{POINT_CODE}, #{POINT_NAME}, #{IS_FIRING}, #{IS_FULL}, #{PCSN}
, #{INSTORAGE_TIME}, #{STANDING_TIME}, #{MATERIAL_QTY}, #{MATERIAL_WEIGHT}, #{WORKORDER_CODE}, #{GROUP_NUMBER}
, #{GROUP_BIND_MATERIAL_STATUS}, #{MOVE_WAY}, #{REMARK}, #{UPDATE_TIME}, #{OUT_KILN_TIME}, #{INTO_KILN_TIME}
, #{CREATE_TM}, #{OP_FLAG})
</insert>
<update id="updateWorkOrderRead" parameterType="java.util.List"> <update id="updateWorkOrderRead" parameterType="java.util.List">
UPDATE "LMSTELCOM"."SEND_POP_SCHEDULE_PRESS" UPDATE "LMSTELCOM"."SEND_POP_SCHEDULE_PRESS"
SET OP_FLAG = '1' SET OP_FLAG = '1'
@ -227,4 +245,38 @@
vg.point_code IN ( 'HCSSX01', 'HCSSX63' ) vg.point_code IN ( 'HCSSX01', 'HCSSX63' )
AND pw.workorder_code IS NOT NULL AND pw.workorder_code IS NOT NULL
</select> </select>
<select id="getAllShelfInfos" resultType="org.nl.wms.ext.mes.service.dto.MesShelfInfo">
SELECT
vg.group_id AS GROUP_ID,
vg.vehicle_code AS VEHICLE_CODE,
vg.vehicle_type AS VEHICLE_TYPE,
IF(p1.point_status = '2','-',mm.material_code) AS MATERIAL_ID,
mm.material_name AS MATERIAL_NAME,
mm.material_spec AS MATSPEC,
mm.material_model AS MATMODEL,
p2.ext_point_code AS SOURCE_VEHICLE_CODE,
p1.point_code AS POINT_CODE,
p1.point_name AS POINT_NAME,
vg.is_firing AS IS_FIRING,
vg.is_full AS IS_FULL,
vg.pcsn AS PCSN,
vg.instorage_time AS INSTORAGE_TIME,
vg.standing_time AS STANDING_TIME,
vg.material_qty AS MATERIAL_QTY,
vg.material_weight AS MATERIAL_WEIGHT,
vg.workorder_code AS WORKORDER_CODE,
vg.group_number AS GROUP_NUMBER,
vg.group_bind_material_status AS GROUP_BIND_MATERIAL_STATUS,
vg.move_way AS MOVE_WAY,
vg.remark AS REMARK,
vg.update_time AS UPDATE_TIME,
vg.out_kiln_time AS OUT_KILN_TIME,
vg.into_kiln_time AS INTO_KILN_TIME
FROM
`sch_base_point` p1
LEFT JOIN sch_base_vehiclematerialgroup vg ON p1.vehicle_code = vg.vehicle_code AND p1.vehicle_type = vg.vehicle_type AND vg.group_bind_material_status = '2'
LEFT JOIN md_base_material mm ON mm.material_id = vg.material_id
LEFT JOIN sch_base_point p2 ON p2.point_code = vg.source_vehicle_code
WHERE p1.region_code = 'GTPHC'
</select>
</mapper> </mapper>

53
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dto/MesQSPressMonitorData.java

@ -0,0 +1,53 @@
package org.nl.wms.ext.mes.service.dto;
import lombok.Data;
/**
* @Author: lyd
* @Description: 压机检测数据
* @Date: 2023/10/11
* 唯一标识
* 当前抓取工位
* 当前放置工位
* 是否合格
* 激光标刻码
* 重量
* 高度1
* 高度2
* 高度3
* 高度4
* 宽度1
* 宽度2
* 长度
* 体积
* 平面度
* 缺陷个数
* 工单标识
* 写入时间
* 读取标志,0未读取1已读取
* 读取时间
*/
@Data
public class MesQSPressMonitorData {
private String BRICK_ID;
private String GET_STATION;
private String PUT_STATION;
private Boolean IS_QUALIFIED;
private String LASER_MARKING_CODE;
private String WEIGHT;
private String HEIGHT1;
private String HEIGHT2;
private String HEIGHT3;
private String HEIGHT4;
private String WIDTH1;
private String WIDTH2;
private String LEN;
private String VOLUME;
private String FLATNESS;
private String UNQUALIFIED_QTY;
private String WORKORDER_CODE;
private String CREATE_TM;
private String OP_FLAG;
private String OP_TM;
}

77
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dto/MesShelfInfo.java

@ -0,0 +1,77 @@
package org.nl.wms.ext.mes.service.dto;
import lombok.Data;
import java.math.BigDecimal;
/**
* @Author: lyd
* @Description: 三层货架信息
* @Date: 2023/10/11
* 唯一ID - 新生成
* 发送时间 - 新生成
* 仓库号 - 不录入
* 组盘标识
* 载具类型
* 载具编码
* 物料标识
* 物料名称
* 规格
* 型号
* 来源载具编码/载具的来源点位(压机)
* 货位号
* 点位名称
* 是否已烧制
* 是否满托
* 批次
* 入库时间
* 静置时间(分钟)
* 物料数量
* 物料重量
* 搬运工单编码
* 组盘次数
* 组盘绑定物料状态
* 位置跟踪
* 备注
* 修改时间
* 出窑时间
* 入窑时间
* 写入时间
* 读取标识
* 读取时间
*/
@Data
public class MesShelfInfo {
private String MSGID;
private String SEND_TM;
private String LOGT;
private String GROUP_ID;
private String VEHICLE_TYPE;
private String VEHICLE_CODE;
private String MATERIAL_ID;
private String MATERIAL_NAME;
private String MATSPEC;
private String MATMODEL;
private String SOURCE_VEHICLE_CODE;
private String POINT_CODE;
private String POINT_NAME;
private Boolean IS_FIRING;
private Boolean IS_FULL;
private String PCSN;
private String INSTORAGE_TIME;
private String STANDING_TIME;
private int MATERIAL_QTY;
private BigDecimal MATERIAL_WEIGHT;
private String WORKORDER_CODE;
private String GROUP_NUMBER;
private String GROUP_BIND_MATERIAL_STATUS;
private String MOVE_WAY;
private String REMARK;
private String UPDATE_TIME;
private String OUT_KILN_TIME;
private String INTO_KILN_TIME;
private String CREATE_TM;
private String OP_FLAG;
private String OP_TM;
}

79
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/impl/WmsToMesServiceImpl.java

@ -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 brickInfolms的砖块检测信息
* @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 -> {

29
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/util/Tes.java

@ -1,29 +0,0 @@
package org.nl.wms.util;
import java.io.IOException;
/**
* @Author: lyd
* @Description:
* @Date: 2023/10/8
*/
public class Tes {
public static void main(String[] args) {
String videoFilePath = "video.mp4";
String audioFilePath = "audio.wav";
String ffmpegCommand = "ffmpeg -i " + videoFilePath + " -vn -acodec pcm_s16le -ar 44100 -ac 2 " + audioFilePath;
try {
Process process = Runtime.getRuntime().exec(ffmpegCommand);
int exitCode = process.waitFor();
if (exitCode == 0) {
System.out.println("音频提取完成");
} else {
System.err.println("音频提取失败");
}
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
}
}
Loading…
Cancel
Save