From 836a3231be910fd3e11258e18cf389594ac9b420 Mon Sep 17 00:00:00 2001
From: huanghongfeng <huanghongfeng@hnkhzn.com>
Date: 星期一, 08 七月 2024 12:51:18 +0800
Subject: [PATCH] 处理人工出库空托

---
 代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/SendFromaddress.cs              |    2 
 代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/QueueTask/OutboundTask.cs               |   51 +++++++++++++++++++++++++
 代码管理/大屏/src/views/centerRight3.vue                                             |    3 -
 代码管理/WMS/WMS_Server/WIDESEA_WebApi/Controllers/JobQueueTask.cs                 |    1 
 代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/AGVServer.cs                    |    7 ++-
 代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/UploadMesInfo/AGVAPIAddress.cs  |    7 ++-
 代码管理/WMS/WMS_Server/WIDESEA_WMS/Services/system/Partial/dt_inventoryService.cs |    7 +--
 代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/SendToaddress.cs                |    2 
 代码管理/WMS/WMS_Server/WIDESEA_WMS/ToMes/OutsourceInbound.cs                      |    7 +--
 9 files changed, 68 insertions(+), 19 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/AGVServer.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/AGVServer.cs"
index 4257532..8c00e29 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/AGVServer.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/AGVServer.cs"
@@ -6,6 +6,7 @@
 using System.Security.Policy;
 using System.Text;
 using System.Threading.Tasks;
+using WIDESEA_Comm;
 using WIDESEA_Comm.LogInfo;
 using WIDESEA_Common;
 using WIDESEA_Core.EFDbContext;
@@ -45,7 +46,7 @@
                     {
                         var Materiel = QueryData.QueryMateriel(agv_task.agv_materielid);//鏌ユ壘杞﹁疆鏁版嵁
                         var Materiel1 = QueryData.QueryMateriel1(agv_task.agv_materielid);//鏌ユ壘杞﹁疆鏁版嵁
-                        if (Materiel == null && Materiel1 == null && !agv_task.agv_tasktype.Contains("TaskType_EmptyPallet"))
+                        if (Materiel == null && Materiel1 == null && !agv_task.agv_tasktype.Contains(AGVTaskTypeEnum.TaskType_EmptyPallet.ToString()))
                         {
                             agv_task.agv_remark = "鏈幏鍙栧埌褰撳墠浠诲姟鐨勮溅杞暟鎹�";
                             agvtaskRepository.Update(agv_task, true);
@@ -57,8 +58,8 @@
                         requestTask.Material = agv_task.agv_materielid;
                         requestTask.Grade = agv_task.agv_grade;
                         requestTask.Quantity = agv_task.agv_qty;
-                        requestTask.TrayType = agv_task.agv_Traytype.Contains("Small") ? 1 : 2;//
-                        requestTask.TaskType = agv_task.agv_tasktype.Contains("TaskType_EmptyPallet") ? 2 : 1;//
+                        requestTask.TrayType = agv_task.agv_Traytype.Contains(TrayTypeEnum.SmallTray.ToString()) ? 1 : 2;//
+                        requestTask.TaskType = agv_task.agv_tasktype.Contains(AGVTaskTypeEnum.TaskType_EmptyPallet.ToString()) ? 2 : 1;//
                         #region 缁�/鎷嗙┖鐩樹换鍔¢渶澶勭悊
                         requestTask.StarQuantity = agv_task.StarQuantity;
                         requestTask.EndQuantity = agv_task.EndQuantity;
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/SendFromaddress.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/SendFromaddress.cs"
index 3dde5ce..59d5885 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/SendFromaddress.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/SendFromaddress.cs"
@@ -57,7 +57,7 @@
                         #endregion
 
                         #region AGV涓婃湁涓や釜绌烘墭锛屼笉涓嬪彂澶栧崗鍙栫┖鎵樹换鍔�
-                        if (agv_task.agv_fromaddress.Contains("W"))
+                         if (agv_task.agv_fromaddress.Contains("W"))
                         {
                             var count = agvtaskRepository.Find(x => x.agv_taskstate != AGVTaskStateEnum.Queue.ToString() && x.agv_tasktype == AGVTaskTypeEnum.TaskType_EmptyPallet.ToString() && string.IsNullOrEmpty(x.agv_toaddress)).Count();
                             if (count >= 2) continue;
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/SendToaddress.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/SendToaddress.cs"
index 27ada93..978512b 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/SendToaddress.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/SendToaddress.cs"
@@ -81,7 +81,7 @@
                             requestFromTask.EndQuantity = EmptyStation.quantity;
                             #endregion
                             var postJson = JsonConvert.SerializeObject(requestFromTask);
-                            var respone = RequestAGV(agvtaskRepository, agv_task, postJson, AGVAPIAddress.IPAddress_AGVToaddTask);
+                             var respone = RequestAGV(agvtaskRepository, agv_task, postJson, AGVAPIAddress.IPAddress_AGVToaddTask);
                             if (respone.Success)
                             {
                                 agv_task.EndQuantity = EmptyStation.quantity;
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/UploadMesInfo/AGVAPIAddress.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/UploadMesInfo/AGVAPIAddress.cs"
index 1a9b536..a14fa32 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/UploadMesInfo/AGVAPIAddress.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/UploadMesInfo/AGVAPIAddress.cs"
@@ -8,17 +8,18 @@
 {
     public class AGVAPIAddress
     {
+        public const string ip = "http://192.168.12.204:5000/";
         /// <summary>
         /// 瀹屾暣AGV浠诲姟涓嬪彂鍦板潃
         /// </summary>
-        public const string IPAddress_AGVTask = "http://192.168.12.204:5000/api/TaskCreat/CreatTask";
+        public const string IPAddress_AGVTask = ip + "api/TaskCreat/CreatTask";
         /// <summary>
         /// AGV璧风偣浠诲姟涓嬪彂鍦板潃
         /// </summary>
-        public const string IPAddress_AGVFromaddTask = "http://192.168.12.204:5000/api/TaskCreat/CreatGetPalletTask";
+        public const string IPAddress_AGVFromaddTask = ip + "api/TaskCreat/CreatGetPalletTask";
         /// <summary>
         /// AGV缁堢偣浠诲姟涓嬪彂鍦板潃
         /// </summary>
-        public const string IPAddress_AGVToaddTask = "http://192.168.12.204:5000/api/TaskCreat/CreatPutPalletTask";
+        public const string IPAddress_AGVToaddTask = ip + "api/TaskCreat/CreatPutPalletTask";
     }
 }
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/QueueTask/OutboundTask.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/QueueTask/OutboundTask.cs"
index 6edd1a4..5a545c3 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/QueueTask/OutboundTask.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/QueueTask/OutboundTask.cs"
@@ -7,6 +7,7 @@
 using WIDESEA_Comm;
 using WIDESEA_Comm.LogInfo;
 using WIDESEA_Comm.TaskNo;
+using WIDESEA_Common;
 using WIDESEA_Core.EFDbContext;
 using WIDESEA_Core.Extensions;
 using WIDESEA_Entity.DomainModels;
@@ -50,7 +51,7 @@
                             //鏌ユ壘褰撳墠璐т綅鍚岃鏄惁瀛樺湪鍏ュ簱浠诲姟
                             if (GetStation.InBusyStation(Station.stationCode)) continue;
 
-                            stationinfo = stationinfoRepository.Find(x => x.line == Station.line && x.area == Station.area && x.enable && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderByDescending(x => x.column).FirstOrDefault();
+                            stationinfo = stationinfoRepository.Find(x => x.line == Station.line && x.area == Station.area && x.enable && x.tray_status == "StrogeTray" && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderByDescending(x => x.column).FirstOrDefault();
                             if (stationinfo != null)
                             {
                                 if (agvtaskRepository.Find(x => x.agv_fromaddress == stationinfo.stationCode).Any()) continue;
@@ -122,5 +123,53 @@
                 WriteDBLog.Error("鍒涘缓鍑哄簱浠诲姟", $"閿欒淇℃伅锛歿ex.Message}", "PCS");
             }
         }
+        /// <summary>
+        /// 澶勭悊浜哄伐鍑哄簱绌烘墭
+        /// </summary>
+        public static void Outkongtuo()
+        {
+            try
+            {
+                VOLContext context = new VOLContext();
+                Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(context);
+                Idt_agvtaskRepository agvdb = new dt_agvtaskRepository(context);
+                var Station = stationinfoRepository.Find(x => x.tray_status == "EmptyTrayss" && x.enable && x.location_state== LocationStateEnum.Stroge.ToString() && x.quantity==1).ToList();
+                foreach (var station in Station)
+                {
+                    var EmptyStations = stationinfoRepository.Find(x => x.area == station.area && x.line == station.line && x.column > station.column && x.location_state != LocationStateEnum.Empty.ToString()).Any();
+                    if (!EmptyStations)
+                    {
+                        dt_agvtask agvtask = new dt_agvtask()
+                        {
+                            agv_fromaddress = station.stationCode,
+                            agv_id = Guid.NewGuid(),
+                            agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
+                            agv_grade = 3,
+                            agv_createtime = DateTime.Now,
+                            agv_taskstate = "Queue",
+                            agv_qty = station.quantity,
+                            agv_Traytype = station.tray_type,
+                            agv_tasktype = AGVTaskTypeEnum.TaskType_EmptyPallet.ToString(),
+                            //agv_toaddress = TargetLocation.stationCode,
+                            agv_toaddress = "",
+                            agv_userid = "绯荤粺",
+                            agv_TrayStatus = "EmptyTray",
+                        };
+
+                        agvdb.Add(agvtask, true);
+
+                        station.location_state = LocationStateEnum.OutBusy.ToString();
+                        stationinfoRepository.Update(station, x => new { x.location_state }, true);
+                    }
+
+                }
+
+            }
+            catch (Exception ex)
+            {
+
+                WriteDBLog.Error("鍒涘缓浜哄伐鍑哄簱鍚庣殑绌烘墭鍑哄簱", $"閿欒淇℃伅锛歿ex.Message}", "PCS");
+            }
+        }
     }
 }
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/system/Partial/dt_inventoryService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/system/Partial/dt_inventoryService.cs"
index 9ec980a..a1ca6f8 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/system/Partial/dt_inventoryService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/system/Partial/dt_inventoryService.cs"
@@ -272,15 +272,14 @@
                             station.quantity = station.quantity - 1;
                             if (station.quantity < 1)
                             {
-                                station.quantity = 0;
+                                station.quantity = 1;
                                 station.stationType = string.Empty;
                                 station.heatNumber = string.Empty;
                                 station.Number = string.Empty;
                                 station.billetID = string.Empty;
                                 station.bindSN = string.Empty;
-                                station.enable = false;
-                                station.tray_status = string.Empty;
-                                station.location_state = LocationStateEnum.Empty.ToString();
+                                station.tray_status = "EmptyTrayss";
+                                station.location_state = LocationStateEnum.Stroge.ToString();
                             }
                             else
                             {
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/ToMes/OutsourceInbound.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/ToMes/OutsourceInbound.cs"
index aa074ec..23b5100 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/ToMes/OutsourceInbound.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/ToMes/OutsourceInbound.cs"
@@ -89,15 +89,14 @@
                             station.quantity = station.quantity - 1;
                             if (station.quantity < 1)
                             {
-                                station.quantity = 0;
+                                station.quantity = 1;
                                 station.stationType = string.Empty;
                                 station.heatNumber = string.Empty;
                                 station.Number = string.Empty;
                                 station.billetID = string.Empty;
                                 station.bindSN = string.Empty;
-                                station.enable = false;
-                                station.tray_status = string.Empty;
-                                station.location_state = LocationStateEnum.Empty.ToString();
+                                station.tray_status = "EmptyTrayss";
+                                station.location_state = LocationStateEnum.Stroge.ToString();
                             }
                             else
                             {
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/Controllers/JobQueueTask.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/Controllers/JobQueueTask.cs"
index ac426e7..0a972a7 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/Controllers/JobQueueTask.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/Controllers/JobQueueTask.cs"
@@ -11,6 +11,7 @@
             QueueTask.ReplaceTrayTask();
             ToMes.InfoToMes();
             OutboundTask.CreateOutboundTask();
+            OutboundTask.Outkongtuo();
         }
     }
 }
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/\345\244\247\345\261\217/src/views/centerRight3.vue" "b/\344\273\243\347\240\201\347\256\241\347\220\206/\345\244\247\345\261\217/src/views/centerRight3.vue"
index 6bf8290..bcc5acc 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/\345\244\247\345\261\217/src/views/centerRight3.vue"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/\345\244\247\345\261\217/src/views/centerRight3.vue"
@@ -72,9 +72,8 @@
             oddRowBGC: '#0f1325', //濂囨暟琛�
             evenRowBGC: '#171c33', //鍋舵暟琛�
             index: true,
-            columnWidth: [50,100,100,100,100,100],
+            columnWidth: [50,102,100,100,100,100],
             align: ['center'],
-
           }
       })
       .catch(error => {

--
Gitblit v1.9.3