From 1caea0fdc7ed1788d854a2aba8853984b4494e01 Mon Sep 17 00:00:00 2001
From: wankeda <Administrator@DESKTOP-HAU3ST3>
Date: 星期二, 24 六月 2025 09:56:28 +0800
Subject: [PATCH] 代码提交

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs |  121 +++++++++++++++++++++++----------------
 1 files changed, 71 insertions(+), 50 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs"
index dfb74fb..22ab05c 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs"
@@ -18,53 +18,7 @@
     public partial class TaskService
     {
         public string url = AppSettings.Configuration["WCS"];
-        /// <summary>
-        /// PDA鐢宠鍏ュ簱--鍫嗗灈鏈虹珛搴撳叆搴�
-        /// </summary>
-        /// <param name="stationCode">璧峰鍦板潃</param>
-        /// <param name="taskType">浠诲姟绫诲瀷--鍏ョ┖锛屽叆鏂�</param>
-        /// <param name="palletCode">鎵樼洏缂栧彿</param>
-        /// <returns>杩斿洖澶勭悊缁撴灉</returns>
-        public WebResponseContent GenerateInboundTask(string stationCode, int taskType, string palletCode)
-        {
-            string? name = Enum.GetName(typeof(TaskTypeEnum), taskType);
-            MethodInfo? methodInfo = GetType().GetMethod(name + "Request");
-            if (methodInfo != null)
-            {
-                WebResponseContent? responseContent = (WebResponseContent?)methodInfo.Invoke(this, new object[] { stationCode, palletCode });
-                if (responseContent != null)
-                {
-                    return responseContent;
-                }
-            }
-            else
-            {
-                return WebResponseContent.Instance.Error("鏈壘鍒拌浠诲姟绫诲瀷涓氬姟");
-            }
-            return WebResponseContent.Instance.Error($"閿欒");
-        }
 
-        /// <summary>
-        /// 绌烘墭鐩樺叆搴�
-        /// </summary>
-        /// <param name="stationCode">璧峰鍦板潃</param>
-        /// <param name="palletCode">鎵樼洏缂栧彿</param>
-        /// <returns>杩斿洖澶勭悊缁撴灉</returns>
-        public WebResponseContent PalletInboundRequest(string stationCode, string palletCode)
-        {
-            WebResponseContent content = new WebResponseContent();
-            try
-            {
-                (bool, string) result = CheckRequestInbound(stationCode, palletCode, false);
-                if (!result.Item1) return content = WebResponseContent.Instance.Error(result.Item2);
-                content = AssignLocUpdateData(stationCode, TaskTypeEnum.PalletInbound.ObjToInt(), palletCode, false);
-            }
-            catch (Exception ex)
-            {
-                content = WebResponseContent.Instance.Error($"{ex.Message}");
-            }
-            return content;
-        }
 
         /// <summary>
         /// 鐗╂枡鍏ュ簱
@@ -120,7 +74,7 @@
                         TargetAddress = locationInfo.LocationCode,
                         TaskStatus = InTaskStatusEnum.InNew.ObjToInt(),
                         TaskType = taskType,
-                        Depth= locationInfo.Depth,
+                        Depth = locationInfo.Depth,
                     };
                     BaseDal.AddData(task);
                     int beforeStatus = locationInfo.LocationStatus;
@@ -147,7 +101,7 @@
                     }
                     else
                     {
-                        locationInfo.LocationStatus = LocationStatusEnum.PalletLock.ObjToInt();
+                        locationInfo.LocationStatus = StatusEnum.PalletLock.ObjToInt();
                         if (locationInfo.Depth == 2)
                         {
                             _basicService.LocationInfoService.UpdateLocationLock(locationInfo, task.TaskNum, StockChangeType.Inbound.ObjToInt(), false);
@@ -155,7 +109,7 @@
                         task.Grade = 1;
                     }
                     _basicService.LocationInfoService.Repository.UpdateData(locationInfo);
-                     
+
                     tasks.Add(task);
                     _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Inbound.ObjToInt(), orderNo, task.TaskNum);
 
@@ -225,7 +179,74 @@
 
             return (true, "鎴愬姛!");
         }
+        //private static readonly object text = new object();
 
-
+        /// <summary>
+        /// 鍏ュ簱浠诲姟
+        /// </summary>
+        /// <param name="saveModel"></param>
+        /// <returns></returns>
+        public WebResponseContent InboundTask(SaveModel saveModel)
+        {
+            lock (text)
+            {
+                WebResponseContent content = new WebResponseContent();
+                try
+                {
+                    string stationcode = saveModel.MainData["stationcode"].ToString();
+                    string PalletCode = saveModel.MainData["PalletCode"].ToString();//闇�鍖哄垎鍖哄煙锛侊紒锛侊紒锛侊紒锛侊紒锛�
+                    //string PointName = saveModel.MainData["PointName"].ToString();
+                    if (stationcode == "" || PalletCode == "")//寮傚父杩斿洖銆傘�傘�傘�傘�傘�倈| PointName == ""  && x.PointName.Contains(PointName)
+                    {
+                        return content = WebResponseContent.Instance.Error($"娣诲姞浠诲姟寮傚父,閿欒淇℃伅:{"鎵爜鏁版嵁涓嶈兘涓虹┖"}");
+                    }
+                    Dt_CachePoint endCachePoint = _basicService.CachePointService.Repository.QueryFirst(x => x.PointCode.Contains("鎴愬搧搴�") && x.PointStatus == LocationStatusEnum.Free.ObjToInt() && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt().ObjToInt());
+                    if (endCachePoint == null)
+                    {
+                        return content = WebResponseContent.Instance.Error($"娣诲姞浠诲姟寮傚父,閿欒淇℃伅:{"鏈壘鍒版垚鍝佸簱鍙敤瀛樻斁缂撳瓨鏋�"}");
+                    }
+                    Dt_CachePoint point = _basicService.CachePointService.Repository.QueryFirst(x => x.PointCode == stationcode && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt());//&& x.Materialtype == PalletCode
+                    if (point == null)
+                    {
+                        return content = WebResponseContent.Instance.Error($"娣诲姞浠诲姟寮傚父,閿欒淇℃伅:{"鎵爜鏁版嵁寮傚父锛屾湭鎵惧埌姝ょ紦瀛樻灦鎴栧凡绂佺敤"}");
+                    }
+                    Dt_CachePoint points = _basicService.CachePointService.Repository.QueryFirst(x => x.PointCode == stationcode && x.PointStatus == LocationStatusEnum.Free.ObjToInt());
+                    if (points == null)
+                    {
+                        return content = WebResponseContent.Instance.Error($"娣诲姞浠诲姟寮傚父,閿欒淇℃伅:{"鎵爜鏁版嵁寮傚父锛屾缂撳瓨鐐瑰凡琚攣瀹�"}");
+                    }
+                    Dt_Task taskcode = BaseDal.QueryFirst(x => x.SourceAddress == stationcode || x.TargetAddress == stationcode);
+                    if (taskcode != null)
+                    {
+                        return content = WebResponseContent.Instance.Error($"娣诲姞浠诲姟寮傚父,閿欒淇℃伅:璇ョ珯鐐瑰凡瀛樺湪浠诲姟");
+                    }
+                    List<Dt_Task> tasks = new List<Dt_Task>();
+                    Dt_Task task = new Dt_Task()
+                    {
+                        CurrentAddress = "",
+                        Grade = 1,
+                        NextAddress = "",
+                        PalletCode = "",
+                        Roadway = "",
+                        SourceAddress = stationcode,
+                        TargetAddress = endCachePoint.PointCode,
+                        TaskStatus = AGVTaskStatusEnum.AGV_Wait.ObjToInt(),
+                        TaskType = TaskTypeEnum.Inbound.ObjToInt(),
+                        Materialtype = PalletCode,
+                        Depth = 1,
+                        TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum))
+                    };
+                    tasks.Add(task);
+                    Repository.AddData(tasks);
+                    HCJLock(task);
+                    content = WebResponseContent.Instance.OK();
+                }
+                catch (Exception ex)
+                {
+                    content = WebResponseContent.Instance.Error($"娣诲姞浠诲姟寮傚父,閿欒淇℃伅:{ex.Message}");
+                }
+                return content;
+            }
+        }
     }
 }

--
Gitblit v1.9.3