From 0329286b3ba1ddbdcad4769b9ccd4d5b3f5d1e64 Mon Sep 17 00:00:00 2001 From: pang.jiabao <pang_jiabao@163.com> Date: 星期二, 24 九月 2024 09:20:49 +0800 Subject: [PATCH] 备货定时任务 --- src/main/java/com/zy/asrs/task/GhjtScheduler.java | 53 +++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 41 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/zy/asrs/task/GhjtScheduler.java b/src/main/java/com/zy/asrs/task/GhjtScheduler.java index 15b27c5..f3366d6 100644 --- a/src/main/java/com/zy/asrs/task/GhjtScheduler.java +++ b/src/main/java/com/zy/asrs/task/GhjtScheduler.java @@ -1,11 +1,12 @@ package com.zy.asrs.task; import com.baomidou.mybatisplus.mapper.EntityWrapper; -import com.zy.asrs.entity.Order; import com.zy.asrs.entity.WrkMast; import com.zy.asrs.mapper.OrderMapper; import com.zy.asrs.mapper.WrkMastMapper; import com.zy.asrs.task.handler.GhjtHandler; +import com.zy.system.entity.Config; +import com.zy.system.mapper.ConfigMapper; import lombok.extern.slf4j.Slf4j; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @@ -31,6 +32,29 @@ @Resource private OrderMapper orderMapper; + @Resource + private ConfigMapper configMapper; + + // 鑷姩澶囪揣(鏍规嵁鍑哄簱鍗曪紝鎶婅鍑虹殑璐ф彁鍓嶆斁鍒伴潬杩戝嚭搴撳彛浣嶇疆) + // 瀹氭椂浠诲姟鑾峰彇寰呭璐ц鍗曟槑缁�->鑾峰彇鍫嗗灈鏈哄搴旂殑婧愬簱浣嶏紝鑾峰彇澶囪揣鍖哄簱浣�->鐢熸垚绉诲簱浠诲姟11-> + // 鎵ц绉诲簱浠诲姟12->鍏ュ簱瀹屾垚4->鏇存柊宸ヤ綔妗e畾鏃朵换鍔′腑鏇存柊璁㈠崟澶囪揣鐘舵�佸拰璁㈠崟鏄庣粏澶囪揣鐘舵��5->杞偍鍘嗗彶 + @Scheduled(cron = "0/10 * * * * ?") + public synchronized void autoStockUp() { + // 鏌ヨ鑷姩澶囪揣閰嶇疆 + Config config = configMapper.selectConfigByCode("auto_stock_up"); + if (config == null || config.getStatus() == 0) { + return; + } + // 鏌ヨ鍑哄簱鐢宠鍗曚腑娌℃湁澶囪揣鐨勮鍗曟槑缁嗙殑鍖呰缁勫彿 + List<String> list = orderMapper.selectStockUpOrderDetl(); + if (list.isEmpty()) { + return; + } + + ghjtHandler.autoStockUpHandler(list, Integer.parseInt(config.getValue())); + + } + // 涓嬪彂鍑哄簱浠诲姟缁橤WCS(浠庡嚭搴撶爜澶村埌鍑哄簱鍙�) @Scheduled(cron = "0/2 * * * * ? ") public void ckrwPushGwcs() { @@ -45,17 +69,22 @@ } } - // 鍑哄簱璁㈠崟瀹屾垚鍒欎笂鎶ES -// @Scheduled(cron = "0/4 * * * * ? ") - public void OutBoundCompleteReport() { - // 鏌ヨ鍑哄簱璁㈠崟鐘舵�佷负4.宸插畬鎴� - List<Order> orders = orderMapper.selectComplete(); - for (Order order : orders) { - try { - ghjtHandler.OutBoundCompleteReport(order); - } catch (Exception e) { - log.error("鍑哄簱璁㈠崟瀹屾垚鍒欎笂鎶ES澶辫触锛屽紓甯镐俊鎭細" + e); - } + // 绌洪棽鐞嗚揣 + @Scheduled(cron = "0/5 * * * * ? ") + public void autoTallyGoods() { + // 绯荤粺閰嶇疆鐣岄潰鍚敤 + Config config = configMapper.selectConfigByCode("auto_tally_goods"); + if (config == null || config.getStatus() == 0) { + return; } + // 鍥涗釜鎹㈢洏鐐癸紝涓や釜缁勭洏鐐� + // 鍏堟煡浠诲姟鐩爣绔欎负 3045/3044鍜�3041/3040鐨勬崲鐩樼粍 濡傛灉鏈変负绌虹殑缁勫垯鍙互鍑猴紝鏈変竴涓垨涓や釜閮戒笉鑳藉嚭 + // todo 闇�鏂板涓や釜鍏ュ簱璺緞 3046/3042 + // 瀵绘壘涓や釜鑳界粍鐩樼殑搴撲綅锛屽簱浣嶇姸鎬佷负F锛屾弧瓒崇粍鐩樻潯浠� + // 鍑哄簱鎬庝箞鍑猴紝鎵嶈兘鎶婄粍濂界殑鐩樹竴娆″嚭鍑哄幓 + // gwcs鎬庝箞淇濊瘉涓や釜閮芥媶瀹屼簡鎵嶈姹傜粍鐩樺畬鎴� + + } + } -- Gitblit v1.9.1