From 7990946c72ea48638718cf638c1fb743b239f93e Mon Sep 17 00:00:00 2001 From: zhangc <zc@123> Date: 星期六, 19 四月 2025 20:00:55 +0800 Subject: [PATCH] 999 --- src/main/java/com/zy/asrs/task/WrkMastScheduler.java | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 111 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/zy/asrs/task/WrkMastScheduler.java b/src/main/java/com/zy/asrs/task/WrkMastScheduler.java index 4f1b40b..bf8ee09 100644 --- a/src/main/java/com/zy/asrs/task/WrkMastScheduler.java +++ b/src/main/java/com/zy/asrs/task/WrkMastScheduler.java @@ -1,11 +1,17 @@ package com.zy.asrs.task; +import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.core.common.Cools; +import com.zy.asrs.domain.enums.NotifyMsgType; import com.zy.asrs.entity.LocMast; import com.zy.asrs.entity.WrkMast; import com.zy.asrs.service.LocMastService; import com.zy.asrs.service.WrkMastLogService; import com.zy.asrs.service.WrkMastService; +import com.zy.asrs.utils.NotifyUtils; +import com.zy.core.enums.LocStsType; +import com.zy.core.enums.WrkIoType; import com.zy.core.enums.WrkStsType; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -27,10 +33,12 @@ private WrkMastLogService wrkMastLogService; @Autowired private LocMastService locMastService; + @Autowired + private NotifyUtils notifyUtils; @Scheduled(cron = "0/1 * * * * ? ") @Transactional - public void executeIn(){ + public void executeIn() { List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("wrk_sts", WrkStsType.COMPLETE_INBOUND.sts)); if (wrkMasts.isEmpty()) { return; @@ -65,12 +73,18 @@ if (!wrkMastService.deleteById(wrkMast)) { log.info("鍒犻櫎宸ヤ綔涓绘。[workNo={}]澶辫触", wrkMast.getWrkNo()); } + + //涓婃姤 + if (!Cools.isEmpty(wrkMast.getWmsWrkNo())) { + notifyUtils.notify("task", 1, String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.TASK_COMPLETE, JSON.toJSONString(wrkMast)); + + } } } @Scheduled(cron = "0/1 * * * * ? ") @Transactional - public void executeOut(){ + public void executeOut() { List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("wrk_sts", WrkStsType.COMPLETE_OUTBOUND.sts)); if (wrkMasts.isEmpty()) { return; @@ -105,12 +119,17 @@ if (!wrkMastService.deleteById(wrkMast)) { log.info("鍒犻櫎宸ヤ綔涓绘。[workNo={}]澶辫触", wrkMast.getWrkNo()); } + + //涓婃姤 + if (!Cools.isEmpty(wrkMast.getWmsWrkNo())) { + notifyUtils.notify("task", 1, String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.TASK_COMPLETE, JSON.toJSONString(wrkMast)); + } } } @Scheduled(cron = "0/1 * * * * ? ") @Transactional - public void executeLocMove(){ + public void executeLocMove() { List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("wrk_sts", WrkStsType.COMPLETE_LOC_MOVE.sts)); if (wrkMasts.isEmpty()) { return; @@ -130,7 +149,7 @@ continue; } - LocMast sourceLocMast= locMastService.queryByLoc(sourceLocNo); + LocMast sourceLocMast = locMastService.queryByLoc(sourceLocNo); if (sourceLocMast == null) { log.info("[workNo={}]搴撲綅涓嶅瓨鍦�", wrkMast.getWrkNo()); continue; @@ -165,18 +184,47 @@ if (!wrkMastService.deleteById(wrkMast)) { log.info("鍒犻櫎宸ヤ綔涓绘。[workNo={}]澶辫触", wrkMast.getWrkNo()); } + + //涓婃姤 + if (!Cools.isEmpty(wrkMast.getWmsWrkNo())) { + notifyUtils.notify("task", 1, String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.TASK_COMPLETE, JSON.toJSONString(wrkMast)); + } } } @Scheduled(cron = "0/1 * * * * ? ") @Transactional - public void executeMove(){ - List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("wrk_sts", WrkStsType.COMPLETE_MOVE.sts)); + public void executeMove() { + List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>() + .in("wrk_sts" + , WrkStsType.COMPLETE_MOVE.sts + , WrkStsType.COMPLETE_MOVE_TRANSPORT_LIFT.sts + , WrkStsType.COMPLETE_MOVE_TRANSPORT_LIFT_OUT.sts + , WrkStsType.MOVE_IN_NO_LIFT_14.sts + , WrkStsType.MOVE_OUT_NO_LIFT_13.sts + )); if (wrkMasts.isEmpty()) { return; } for (WrkMast wrkMast : wrkMasts) { + WrkMast main = wrkMastService.selectByWorkNo(wrkMast.getMainWrkNo()); + if (main != null) { + if (main.getIoType() == WrkIoType.IN.id) { + main.setWrkSts(WrkStsType.COMPLETE_INBOUND.sts); + } else if (main.getIoType() == WrkIoType.OUT.id) { + main.setShuttleNo(wrkMast.getShuttleNo()); + main.setWrkSts(WrkStsType.OUTBOUND_SHUTTLE_RUN_COMPLETE.sts); + //閭f椂鍊欐墭鐩樺湪鎻愬崌鏈洪噷锛屽垯闇�瑕侀攣浣� + if (!(main.getStaNo() != 1013 && main.getStaNo() != 1024)) { + main.setLiftNo(1); + } + } + main.setModiTime(new Date()); + if (!wrkMastService.updateById(main)) { + log.info("鏇存柊涓诲伐浣滄。[workNo={}]澶辫触", wrkMast.getWrkNo()); + } + } // 淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗� if (!wrkMastLogService.save(wrkMast.getWrkNo())) { log.info("淇濆瓨宸ヤ綔鍘嗗彶妗workNo={}]澶辫触", wrkMast.getWrkNo()); @@ -190,7 +238,7 @@ @Scheduled(cron = "0/1 * * * * ? ") @Transactional - public void executeCharge(){ + public void executeCharge() { List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("wrk_sts", WrkStsType.COMPLETE_CHARGE.sts)); if (wrkMasts.isEmpty()) { return; @@ -205,6 +253,62 @@ if (!wrkMastService.deleteById(wrkMast)) { log.info("鍒犻櫎宸ヤ綔涓绘。[workNo={}]澶辫触", wrkMast.getWrkNo()); } + + //涓婃姤 + if (!Cools.isEmpty(wrkMast.getWmsWrkNo())) { + notifyUtils.notify("task", 1, String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.TASK_CHARGE_COMPLETE, JSON.toJSONString(wrkMast)); + } + } + } + + @Scheduled(cron = "0/1 * * * * ? ") + @Transactional + public void executeCancelTask() { + List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("mk", "taskCancel")); + if (wrkMasts.isEmpty()) { + return; + } + + for (WrkMast wrkMast : wrkMasts) { + // 淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗� + if (!wrkMastLogService.save(wrkMast.getWrkNo())) { + log.info("淇濆瓨宸ヤ綔鍘嗗彶妗workNo={}]澶辫触", wrkMast.getWrkNo()); + } + // 鍒犻櫎宸ヤ綔涓绘。 + if (!wrkMastService.deleteById(wrkMast)) { + log.info("鍒犻櫎宸ヤ綔涓绘。[workNo={}]澶辫触", wrkMast.getWrkNo()); + } + + if (wrkMast.getIoType() == WrkIoType.IN.id) { + LocMast locMast = locMastService.queryByLoc(wrkMast.getLocNo()); + locMast.setLocSts(String.valueOf(LocStsType.O)); + locMast.setModiTime(new Date()); + locMastService.updateById(locMast); + } else if (wrkMast.getIoType() == WrkIoType.OUT.id) { + LocMast locMast = locMastService.queryByLoc(wrkMast.getSourceLocNo()); + locMast.setLocSts(String.valueOf(LocStsType.O)); + locMast.setModiTime(new Date()); + locMastService.updateById(locMast); + } else if (wrkMast.getIoType() == WrkIoType.LOC_MOVE.id) { + LocMast sourceLocMast = locMastService.queryByLoc(wrkMast.getSourceLocNo()); + LocMast locMast = locMastService.queryByLoc(wrkMast.getLocNo()); + if (sourceLocMast.getLocSts().equals(String.valueOf(LocStsType.R))) { + sourceLocMast.setLocSts(String.valueOf(LocStsType.F)); + sourceLocMast.setModiTime(new Date()); + locMastService.updateById(sourceLocMast); + } + + if (locMast.getLocSts().equals(String.valueOf(LocStsType.S))) { + locMast.setLocSts(String.valueOf(LocStsType.O)); + locMast.setModiTime(new Date()); + locMastService.updateById(locMast); + } + } + + //涓婃姤 + if (!Cools.isEmpty(wrkMast.getWmsWrkNo())) { + notifyUtils.notify("task", 1, String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.TASK_CANCEL, JSON.toJSONString(wrkMast)); + } } } -- Gitblit v1.9.1