李永德
1 year ago
10 changed files with 354 additions and 41 deletions
@ -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"); |
|||
} |
|||
} |
@ -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; |
|||
|
|||
} |
@ -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; |
|||
|
|||
} |
@ -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…
Reference in new issue