From 5e87fa97a49ffb83924a09cf1c7739ad5a6437df Mon Sep 17 00:00:00 2001
From: Administrator <Administrator@DESKTOP-JIE70N9>
Date: 星期四, 08 五月 2025 08:36:13 +0800
Subject: [PATCH] agv取货完成方法名称修改

---
 Admin.NET/WCS.Application/Util/AGVStorageUtil.cs |  352 +++++++++++++---------------------------------------------
 1 files changed, 81 insertions(+), 271 deletions(-)

diff --git a/Admin.NET/WCS.Application/Util/AGVStorageUtil.cs b/Admin.NET/WCS.Application/Util/AGVStorageUtil.cs
index b9569e0..b1746af 100644
--- a/Admin.NET/WCS.Application/Util/AGVStorageUtil.cs
+++ b/Admin.NET/WCS.Application/Util/AGVStorageUtil.cs
@@ -15,290 +15,100 @@
     private static readonly ISqlSugarClient _db = SqlSugarSetup.ITenant.GetConnectionScope(SqlSugarConst.MainConfigId);
     private static readonly SysCacheService sysCacheService = App.GetRequiredService<SysCacheService>();
     private static readonly SysConfigService _sysConfigService = App.GetRequiredService<SysConfigService>();
-    private static List<string[]> listStorage = new List<string[]>();
-    private static string[] listPallet = new[] { "cache_Z53", "cache_Z52", "cache_Z51" };
+    
     static AGVStorageUtil()
     {
-        listStorage.Add(new[] { "cache_Z11", "cache_Z12", "cache_Z13" });
-        listStorage.Add(new[] { "cache_Z21", "cache_Z22", "cache_Z23" });
-        listStorage.Add(new[] { "cache_Z31", "cache_Z32", "cache_Z33" });
-        listStorage.Add(new[] { "cache_Z41", "cache_Z42", "cache_Z43" });
     }
-    /// <summary>
-    /// 鑾峰彇鎴愬搧鏁伴噺
-    /// </summary>
-    /// <returns></returns>
-    public static int ProductCount()
+
+    public static string GetTaskModle(string straLocate,string endLocate,out string type1,out string type2,out string jiebo)
     {
-        int i = 0;
-        foreach (var item in listStorage)
+        type1 = "";
+        type2 = "";
+        jiebo = "";
+        var taskModle = "";//浠诲姟妯℃澘
+        var locate1 = _db.Queryable<WcsStorageLocat>().First(m => m.IsDelete == false && m.LocatNo == straLocate);      
+        var locate2 = _db.Queryable<WcsStorageLocat>().First(m => m.IsDelete == false && m.LocatNo == endLocate);
+        if (locate1 == null || locate2 == null)
         {
-            foreach (var mod in item.Reverse())
-            {
-                var value = _sysConfigService.GetConfigValue<bool>(mod).Result;
-                if (value)
-                    i++;
-            }
+            return taskModle;
         }
-        return i;
-    }
-    /// <summary>
-    /// 鑾峰彇鎴愬搧瑕佸叆鐨勫偍浣�
-    /// </summary>
-    /// <returns></returns>
-    public static string GetProductInStorage(string TaskNo = "")
-    {
-        List<string> listResult = new List<string>();
-        foreach (var item in listStorage)
+        switch (locate1.WareHouseNo)
         {
-            List<string> listItem = new List<string>();
-            foreach (var mod in item.Reverse())
-            {
-                var value = _sysConfigService.GetConfigValue<bool>(mod).Result;
-                if (!value)
-                    listItem.Add(mod.Split('_')[1]);
-                else
-                    break;
-            }
-            listResult.AddRange(listItem.AsEnumerable().Reverse());
-        }
-        //妫�鏌ユ槸鍚︽湁姝e湪鍏ョ殑浠诲姟
-        foreach (var result in listResult)
-        {
-            if (!_db.Queryable<WcsTask>().Where(s => s.Type == PLCTypeEnum.AGV && s.Status <= TaskStatusEnum.Doing && s.EndLocate == result && s.TaskNo != TaskNo).Any())
-                return result;
-        }
-        return "";
-        //Log.Error("鏃犲彲鍏ョ殑鍌ㄤ綅");
-        //throw Oops.Bah("鏃犲彲鍏ョ殑鍌ㄤ綅");
-    }
-    /// <summary>
-    /// 鑾峰彇鎴愬搧瑕佸嚭鐨勫偍浣�
-    /// </summary>
-    /// <returns></returns>
-    public static string GetProductOutStorage()
-    {
-        foreach (var item in listStorage.AsEnumerable().Reverse())
-        {
-            foreach (var mod in item.Reverse())
-            {
-                var value = _sysConfigService.GetConfigValue<bool>(mod).Result;
-                if (value)
-                    return mod.Split('_')[1];
-            }
-        }
-        return "";
-        //Log.Error("鏃犲彲鍑虹殑鍌ㄤ綅");
-        //throw Oops.Bah("鏃犲彲鍑虹殑鍌ㄤ綅");
-    }
-    /// <summary>
-    /// 鑾峰彇鎵樼洏瑕佸叆鐨勫偍浣�
-    /// </summary>
-    /// <returns></returns>
-    public static string GetPalletInStorage(string TaskNo = "")
-    {
-        List<string> listResult = new List<string>();
-        foreach (var item in listPallet)
-        {
-            var value = _sysConfigService.GetConfigValue<bool>(item).Result;
-            if (!value)
-                listResult.Add(item.Split('_')[1]);
-            else
+            case "W02":
+                type1 = "SITE";
+                break;
+            case "W04":
+                type1 = "STORAGE";
+                break;
+            default:
                 break;
         }
-        //妫�鏌ユ槸鍚︽湁姝e湪鍏ョ殑浠诲姟
-        foreach (var result in listResult.AsEnumerable().Reverse())
+
+        switch (locate2.WareHouseNo)
         {
-            if (!_db.Queryable<WcsTask>().Where(s => s.Type == PLCTypeEnum.AGV && s.Status <= TaskStatusEnum.Doing && s.EndLocate == result && s.TaskNo != TaskNo).Any())
-                return result;
+            case "W02":
+                type2 = "SITE";
+                break;
+            case "W04":
+                type2 = "STORAGE";
+                break;
+            default:
+                break;
         }
-        return "";
-        //Log.Error("鏃犲彲鍏ョ殑鍌ㄤ綅");
-        //throw Oops.Bah("鏃犲彲鍏ョ殑鍌ㄤ綅");
-    }
-    /// <summary>
-    /// 鑾峰彇鎵樼洏瑕佸嚭鐨勫偍浣�
-    /// </summary>
-    /// <returns></returns>
-    public static string GetPalletOutStorage()
-    {
-        foreach (var item in listPallet)
+        var  AreaAll = new List<string>() { "B06", "B07" };//1002銆�1003鍏ㄩ儴鍖哄煙
+        var Area1002 = new List<string>() { "B06",""};//1002杞﹂棿鍖哄煙
+        var Area10031 = new List<string>() { ""};//1003 1妤艰溅闂村尯鍩�
+        var Area10032 = new List<string>() { "B07"};//1003 2妤艰溅闂村尯鍩�
+        if (Area1002.Contains(locate2.AreaNo))
         {
-            var value = _sysConfigService.GetConfigValue<bool>(item).Result;
-            if (value)
-                return item.Split('_')[1];
+            jiebo = "1JB";//鎺ラ┏浣�
         }
-        return "";
-        //Log.Error("鏃犲彲鍑虹殑鍌ㄤ綅");
-        //throw Oops.Bah("鏃犲彲鍑虹殑鍌ㄤ綅");
+        if (Area10031.Contains(locate2.AreaNo) || Area10032.Contains(locate2.AreaNo))
+        {
+            jiebo = "2JB";
+        }
+        if (type1 == "" || type2 == "")
+        {
+            return taskModle;
+        }
+        //鍒ゆ柇鑾峰彇浠诲姟妯℃澘  STORAGE 璐ф灦浠撲綅  SITE 骞冲簱浠撲綅  ZONE 鍖哄煙
+        switch (type1)
+        {
+            case "STORAGE" when type2 == "SITE":
+                {
+                    taskModle = "FJ";
+                }
+                break;
+            case "SITE" when type2 == "STORAGE":
+                {
+                    taskModle = "YCRK"; 
+                }
+                break;
+            case "SITE" when type2 == "SITE":
+                {
+                    if (Area10032.Contains(locate1.AreaNo) && locate2.AreaNo == "B04")
+                    {
+                        taskModle = "CPRK";
+                    }
+                    else if(Area1002.Contains(locate1.AreaNo) && locate2.AreaNo == "B04")
+                    {
+                        taskModle = "CPRK2";
+                    }
+                    else if ((Area10032.Contains(locate2.AreaNo) || Area10032.Contains(locate2.AreaNo)) && !AreaAll.Contains(locate1.AreaNo))
+                    {
+                        taskModle = "YFLSX";
+                    }
+                    else if (Area1002.Contains(locate2.AreaNo) && !AreaAll.Contains(locate1.AreaNo))
+                    {
+                        taskModle = "YFLSX2";
+                    }
+
+                }
+                break;
+            default:
+                break;
+        }
+        return taskModle;
     }
 
-    #region 灞炴��
-
-    public static bool Z11
-    {
-        get
-        {
-            return _sysConfigService.GetConfigValue<bool>("cache_Z11").Result;
-        }
-        set
-        {
-            _sysConfigService.UpdateConfigValue("cache_Z11", value);
-        }
-    }
-    public static bool Z12
-    {
-        get
-        {
-            return _sysConfigService.GetConfigValue<bool>("cache_Z12").Result;
-        }
-        set
-        {
-            _sysConfigService.UpdateConfigValue("cache_Z12", value);
-        }
-    }
-    public static bool Z13
-    {
-        get
-        {
-            return _sysConfigService.GetConfigValue<bool>("cache_Z13").Result;
-        }
-        set
-        {
-            _sysConfigService.UpdateConfigValue("cache_Z13", value);
-        }
-    }
-    public static bool Z21
-    {
-        get
-        {
-            return _sysConfigService.GetConfigValue<bool>("cache_Z21").Result;
-        }
-        set
-        {
-            _sysConfigService.UpdateConfigValue("cache_Z21", value);
-        }
-    }
-    public static bool Z22
-    {
-        get
-        {
-            return _sysConfigService.GetConfigValue<bool>("cache_Z22").Result;
-        }
-        set
-        {
-            _sysConfigService.UpdateConfigValue("cache_Z22", value);
-        }
-    }
-    public static bool Z23
-    {
-        get
-        {
-            return _sysConfigService.GetConfigValue<bool>("cache_Z23").Result;
-        }
-        set
-        {
-            _sysConfigService.UpdateConfigValue("cache_Z23", value);
-        }
-    }
-    public static bool Z31
-    {
-        get
-        {
-            return _sysConfigService.GetConfigValue<bool>("cache_Z31").Result;
-        }
-        set
-        {
-            _sysConfigService.UpdateConfigValue("cache_Z31", value);
-        }
-    }
-    public static bool Z32
-    {
-        get
-        {
-            return _sysConfigService.GetConfigValue<bool>("cache_Z32").Result;
-        }
-        set
-        {
-            _sysConfigService.UpdateConfigValue("cache_Z32", value);
-        }
-    }
-    public static bool Z33
-    {
-        get
-        {
-            return _sysConfigService.GetConfigValue<bool>("cache_Z33").Result;
-        }
-        set
-        {
-            _sysConfigService.UpdateConfigValue("cache_Z33", value);
-        }
-    }
-    public static bool Z41
-    {
-        get
-        {
-            return _sysConfigService.GetConfigValue<bool>("cache_Z41").Result;
-        }
-        set
-        {
-            _sysConfigService.UpdateConfigValue("cache_Z41", value);
-        }
-    }
-    public static bool Z42
-    {
-        get
-        {
-            return _sysConfigService.GetConfigValue<bool>("cache_Z42").Result;
-        }
-        set
-        {
-            _sysConfigService.UpdateConfigValue("cache_Z42", value);
-        }
-    }
-    public static bool Z43
-    {
-        get
-        {
-            return _sysConfigService.GetConfigValue<bool>("cache_Z43").Result;
-        }
-        set
-        {
-            _sysConfigService.UpdateConfigValue("cache_Z43", value);
-        }
-    }
-    public static bool Z51
-    {
-        get
-        {
-            return _sysConfigService.GetConfigValue<bool>("cache_Z51").Result;
-        }
-        set
-        {
-            _sysConfigService.UpdateConfigValue("cache_Z51", value);
-        }
-    }
-    public static bool Z52
-    {
-        get
-        {
-            return _sysConfigService.GetConfigValue<bool>("cache_Z52").Result;
-        }
-        set
-        {
-            _sysConfigService.UpdateConfigValue("cache_Z52", value);
-        }
-    }
-    public static bool Z53
-    {
-        get
-        {
-            return _sysConfigService.GetConfigValue<bool>("cache_Z53").Result;
-        }
-        set
-        {
-            _sysConfigService.UpdateConfigValue("cache_Z53", value);
-        }
-    }
-    #endregion
 }

--
Gitblit v1.8.0