From fc9cba5f058089887aa7061d2e6b4006b9e04a9a Mon Sep 17 00:00:00 2001
From: 陈勇 <竞男@ASUNA>
Date: 星期二, 10 三月 2026 09:46:43 +0800
Subject: [PATCH] 同步

---
 项目代码/WMS/WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs |   78 ++++++++++++++++++++-------------------
 1 files changed, 40 insertions(+), 38 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs"
index 9cc2883..c1dc994 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs"
@@ -44,13 +44,14 @@
             }
 
             var carBody = _carBodyRepository.QueryFirst(x => x.PalletCode == input.PalletCode);
+            if (carBody == null) throw new Exception($"杞﹁韩{input.PalletCode}淇℃伅涓嶅瓨鍦�");
 
-            BDCManager bDCManager = new BDCManager(_bdcConfigurationService, _locationRepository, _roadWayInfoRepository);
+            //BDCManager bDCManager = new BDCManager(_bdcConfigurationService, _locationRepository, _roadWayInfoRepository);
 
-            await bDCManager.AddToBDC(carBody);
+            //await bDCManager.AddToBDC(carBody);
 
             // 鑾峰彇搴撲綅
-            var location = RequestLocation(stationInfo.Roadway);
+            var location = RequestLocation(stationInfo.RoadwayNo, carBody.CarType);
             if (location == null)
             {
                 return content.Error("鏃犳硶鑾峰彇璐т綅淇℃伅鎴栧簱浣嶅凡婊�");
@@ -62,8 +63,8 @@
                 Grade = 1,
                 Roadway = stationInfo.Roadway,
                 TargetAddress = location.LocationCode,
-                Dispatchertime = DateTime.Now,
-                NextAddress = stationInfo.Roadway,
+                //Dispatchertime = DateTime.Now,
+                NextAddress = input.Position,
                 OrderNo = null,
                 PalletCode = input.PalletCode,
                 SourceAddress = stationInfo.stationLocation,
@@ -71,8 +72,9 @@
                 TaskType = (int)TaskInboundTypeEnum.Inbound,
                 TaskNum = await BaseDal.GetTaskNo(),
                 Creater = "Systeam",
-            };
+                PVI = input.PVI,
 
+            };
 
             _unitOfWorkManage.BeginTran();
 
@@ -96,24 +98,36 @@
     #endregion 璇锋眰浠诲姟鍏ュ簱
 
     #region 搴撲綅鍒嗛厤
+
     #region 鑾峰彇璐т綅
     object objLOCK = new object();
     /// <summary>
-    /// 鍙屽崌搴撲綅鍒嗛厤
+    /// 搴撲綅鍒嗛厤
     /// </summary>
     /// <param name="requestTask"></param>
     /// <param name="locationInfos"></param>
     /// <returns></returns>
-    public DtLocationInfo RequestLocation(string roadwayNo)
+    public DtLocationInfo RequestLocation(string roadwayNo, int carType)
     {
         lock (objLOCK)
         {
             try
             {
                 List<DtLocationInfo> locations = new List<DtLocationInfo>();
-                locations = _locationRepository.QueryData(x => x.RoadwayNo == roadwayNo && x.LocationStatus == (int)LocationEnum.Free && x.EnalbeStatus == 1);   //&& x.LocationType == 1
+                if (carType == 1)
+                {
+                    locations = _locationRepository.QueryData(x => x.RoadwayNo == roadwayNo && x.LocationStatus == (int)LocationEnum.Free && x.EnalbeStatus == 1 && (x.LocationType == 1 || x.LocationType == 3));   //&& x.LocationType == 1
+                }
+                else if (carType == 2)
+                {
+                    locations = _locationRepository.QueryData(x => x.RoadwayNo == roadwayNo && x.LocationStatus == (int)LocationEnum.Free && x.EnalbeStatus == 1 && (x.LocationType == 2 || x.LocationType == 3));   //&& x.LocationType == 1
+                }
+                else if (carType == 3)
+                {
+                    locations = _locationRepository.QueryData(x => x.RoadwayNo == roadwayNo && x.LocationStatus == (int)LocationEnum.Free && x.EnalbeStatus == 1 && x.LocationType == 3);   //&& x.LocationType == 1
+                }
 
-                var location = GetEmptyLocation(locations);
+                var location = GetEmptyLocation(locations, carType);
                 if (location == null)
                 {
                     throw new Exception("搴撲綅宸叉弧");
@@ -129,9 +143,22 @@
     }
 
 
-    private DtLocationInfo GetEmptyLocation(List<DtLocationInfo> dtLocationInfos)
+    private DtLocationInfo GetEmptyLocation(List<DtLocationInfo> dtLocationInfos, int carType)
     {
-        var locationinfo = dtLocationInfos.Where(x => x.LocationStatus == (int)LocationEnum.Free && x.EnalbeStatus == 1).OrderBy(x => x.Column).ThenBy(x => x.Row).ThenBy(x => x.Layer).FirstOrDefault();   //.ThenByDescending(x => x.Depth)
+        DtLocationInfo locationinfo = new DtLocationInfo();
+        if (carType == 1 || carType == 3)
+        {
+            locationinfo = dtLocationInfos.Where(x => x.LocationStatus == (int)LocationEnum.Free && x.EnalbeStatus == 1).OrderBy(x => x.Layer).ThenBy(x => x.Column).ThenBy(x => x.Row).FirstOrDefault();
+        }
+        else if (carType == 2)
+        {
+            locationinfo = dtLocationInfos.Where(x => x.LocationStatus == (int)LocationEnum.Free && x.EnalbeStatus == 1).OrderBy(x => x.Layer).ThenByDescending(x => x.Column).ThenBy(x => x.Row).FirstOrDefault();
+        }
+        //else if (carType == 3)
+        //{
+        //    locationinfo = dtLocationInfos.Where(x => x.LocationStatus == (int)LocationEnum.Free && x.EnalbeStatus == 1).OrderBy(x => x.Column).ThenBy(x => x.Row).ThenBy(x => x.Layer).FirstOrDefault();
+        //}
+
         return locationinfo;
     }
 
@@ -139,31 +166,6 @@
     #endregion 鑾峰彇璐т綅
     #endregion 搴撲綅鍒嗛厤
 
-    public WebResponseContent confirmTask(int taskNum)
-    {
-        WebResponseContent content = new WebResponseContent();
-        try
-        {
-            var taskInfo = BaseDal.QueryFirst(x => x.TaskNum == taskNum);
-            if (taskInfo == null) throw new Exception("鏈煡浠诲姟");
-
-            if (taskInfo.TaskState != (int)TaskOutStatusEnum.OutFinish) throw new Exception("褰撳墠浠诲姟鏈畬鎴�,绂佹纭");
-
-            var taskHty = taskInfo.Adapt<Dt_Task_Hty>();
-            taskHty.FinishTime = DateTime.Now;
-            taskHty.OperateType = (int)OperateTypeEnum.浜哄伐纭;
-
-            BaseDal.DeleteData(taskInfo);
-            _task_HtyRepository.AddData(taskHty);
-
-            content.OK("纭瀹屾垚");
-        }
-        catch (Exception ex)
-        {
-            content.Error($"纭寮傚父:{ex.Message}");
-        }
-
-        return content;
-    }
+    //public WebResponseContent 
 
 }
\ No newline at end of file

--
Gitblit v1.9.3