From a6a33f6916afbf1fc629baecb772939cda2ee981 Mon Sep 17 00:00:00 2001
From: wankeda <Administrator@DESKTOP-HAU3ST3>
Date: 星期四, 13 三月 2025 17:58:12 +0800
Subject: [PATCH] 代码提交

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs |   74 +++++++++++++++++++++++++++++++++++--
 1 files changed, 70 insertions(+), 4 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..1de5253 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"
@@ -120,7 +120,7 @@
                         TargetAddress = locationInfo.LocationCode,
                         TaskStatus = InTaskStatusEnum.InNew.ObjToInt(),
                         TaskType = taskType,
-                        Depth= locationInfo.Depth,
+                        Depth = locationInfo.Depth,
                     };
                     BaseDal.AddData(task);
                     int beforeStatus = locationInfo.LocationStatus;
@@ -155,7 +155,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 +225,73 @@
 
             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 == "")//寮傚父杩斿洖銆傘�傘�傘�傘�傘��
+                    {
+                        return content = WebResponseContent.Instance.Error($"娣诲姞浠诲姟寮傚父,閿欒淇℃伅:{"鎵爜鏁版嵁涓嶈兘涓虹┖"}");
+                    }
+                    Dt_CachePoint endCachePoint = _basicService.CachePointService.Repository.QueryFirst(x => x.PointCode.Contains("鎴愬搧搴�") && x.PointName.Contains(PointName) && x.PointStatus == LocationStatusEnum.Free.ObjToInt());
+                    if (endCachePoint == null)
+                    {
+                        return content = WebResponseContent.Instance.Error($"娣诲姞浠诲姟寮傚父,閿欒淇℃伅:{"鏈壘鍒版垚鍝佸簱鍙敤瀛樻斁缂撳瓨鏋�"}");
+                    }
+                    Dt_CachePoint point = _basicService.CachePointService.Repository.QueryFirst(x => x.PointCode == stationcode && 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_New.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