From c37ae85eab15d2c7566677bfb26920c31da879fe Mon Sep 17 00:00:00 2001
From: zyx <zyx123456>
Date: 星期五, 24 十一月 2023 12:07:51 +0800
Subject: [PATCH] agv拣货流程更改

---
 src/main/java/com/zy/asrs/task/AutoReplenishmentScheduler.java |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/src/main/java/com/zy/asrs/task/AutoReplenishmentScheduler.java b/src/main/java/com/zy/asrs/task/AutoReplenishmentScheduler.java
index d0ab451..3f08e02 100644
--- a/src/main/java/com/zy/asrs/task/AutoReplenishmentScheduler.java
+++ b/src/main/java/com/zy/asrs/task/AutoReplenishmentScheduler.java
@@ -3,12 +3,10 @@
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.core.common.Cools;
 import com.zy.asrs.entity.DocType;
+import com.zy.asrs.entity.LocDetl;
 import com.zy.asrs.entity.Mat;
 import com.zy.asrs.entity.Order;
-import com.zy.asrs.service.AgvLocDetlService;
-import com.zy.asrs.service.DocTypeService;
-import com.zy.asrs.service.MatService;
-import com.zy.asrs.service.OrderService;
+import com.zy.asrs.service.*;
 import com.zy.asrs.task.handler.AutoReplenishmentHandler;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -31,28 +29,38 @@
     private MatService matService;
     @Autowired
     private AgvLocDetlService agvLocDetlService;
+    @Autowired
+    private LocDetlService locDetlService;
 
     /*
     瀹氭椂渚垮埄搴撳瓨锛岀敓鎴愯嚜鍔ㄨˉ璐у崟鎹�
      */
-    //@Scheduled(cron = "0/5 * * * * ? ")
+    @Scheduled(cron = "0/5 * * * * ? ")
     public void createOrder(){
         //妫�娴嬫槸鍚︽湁鏈畬鎴愮殑琛ヨ揣鍗曟嵁
         DocType docType = docTypeService.selectOne(new EntityWrapper<DocType>().eq("doc_name", "鑷姩琛ヨ揣鍗�"));
         int count = orderService.selectCount(new EntityWrapper<Order>()
                 .eq("doc_type", docType.getDocId())
                 .andNew().eq("settle",2)
-                .or("settle",1));
+                .or().eq("settle",1));
         if(count > 0){
             return;
         }
 
         //鏌ヨ鎵�鏈夐渶瑕佽ˉ璐х殑鐗╂枡
-        List<Mat> matList = matService.selectList(new EntityWrapper<Mat>().eq(false, "store_min", 0));
+        List<Mat> matList = matService.selectList(new EntityWrapper<Mat>().gt( "store_min", 0));
         if(!Cools.isEmpty(matList)){
             for (Mat mat : matList){
                 //鏌ヨ褰撳墠鐗╂枡鏄惁鍦╝gv搴撳皬浜庡簱瀛樹笂闄�
                 Double anfmeSum = agvLocDetlService.selectSumAnfmeByMatnr(mat.getMatnr());
+                if(Cools.isEmpty(anfmeSum)){
+                    anfmeSum = 0.0;
+                }
+                //鏌ヨ褰撳墠鐗╂枡鍥涢」搴撴槸鍚﹀瓨鍦�
+                if(Cools.isEmpty(locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("matnr", mat.getMatnr())))){
+                    continue;
+                }
+
                 if(anfmeSum < mat.getStoreMin()){
                     autoReplenishmentHandler.create(mat,mat.getStoreMax() - anfmeSum);
                     break;

--
Gitblit v1.9.1