From 0bfe24ddf438636aeef8c1e6989d5c8c28b0bb1a Mon Sep 17 00:00:00 2001
From: Huangxiaoqiang-03 <1247017146@qq.com>
Date: 星期四, 31 十月 2024 16:56:13 +0800
Subject: [PATCH] 1

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs |  106 ++++++++++++++++++++++++++++------------------------
 1 files changed, 57 insertions(+), 49 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs"
index e57b084..2022f55 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs"
@@ -204,73 +204,81 @@
             try
             {
                 _unitOfWorkManage.BeginTran();
-                for (int i = 0; i < task.Count; i++)
+                if (task.Count > 0)
                 {
-                    Dt_LocationInfo location = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task[i].SourceAddress && x.RoadwayNo == task[i].Roadway);
-                    if (location != null)
+
+                    for (int i = 0; i < task.Count; i++)
                     {
-                        //(Dt_LocationInfo?, int?) result = _basicService.LocationInfoService.isDepth(location);
-                        (Dt_LocationInfo?, int?) result = isDepth(location);
-                        if (result.Item1 != null &&result.Item2 != LocationStatusEnum.Lock.ObjToInt() && result.Item2 != LocationStatusEnum.PalletLock.ObjToInt() && result.Item2 != LocationStatusEnum.Free.ObjToInt())
+                        Dt_LocationInfo location = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task[i].SourceAddress && x.RoadwayNo == task[i].Roadway);
+                        if (location != null)
                         {
-                            int sum = 0;
-                            for (int j = 0; j < task.Count; j++)
+                            //(Dt_LocationInfo?, int?) result = _basicService.LocationInfoService.isDepth(location);
+                            (Dt_LocationInfo?, int?) result = isDepth(location);
+                            if (result.Item1 != null && result.Item2 != LocationStatusEnum.Lock.ObjToInt() && result.Item2 != LocationStatusEnum.PalletLock.ObjToInt() && result.Item2 != LocationStatusEnum.Free.ObjToInt())
                             {
-                                if (result.Item1.LocationCode == task[j].SourceAddress)
+                                int sum = 0;
+                                for (int j = 0; j < task.Count; j++)
                                 {
-                                    sum++;
+                                    if (result.Item1.LocationCode == task[j].SourceAddress)
+                                    {
+                                        sum++;
+                                    }
+                                }
+                                if (sum == 0)
+                                {
+                                    return content = RelocationTask(task[i]);
+                                }
+                                else
+                                {
+                                    BaseDal.AddData(task[i]);
+                                    _basicService.LocationInfoService.UpdateLocationLock(location, task[i].TaskNum, StockChangeType.Outbound.ObjToInt(), true);
                                 }
                             }
-                            if (sum == 0)
-                            {
-                                return content = RelocationTask(task[i]);
-                            }
-                            else
-                            {
-                                BaseDal.AddData(task[i]);
-                                _basicService.LocationInfoService.UpdateLocationLock(location, task[i].TaskNum, StockChangeType.Outbound.ObjToInt(), true);
-                            }
-                        }
-                        else if (result.Item1 == null && result.Item2 == LocationStatusEnum.Free.ObjToInt())
-                        {
-                            BaseDal.AddData(task[i]);
-                            location.LocationStatus = LocationStatusEnum.Lock.ObjToInt();
-                            _basicService.LocationInfoService.UpdateData(location);
-                            content = WebResponseContent.Instance.OK();
-                        }
-                        else if (result.Item1 != null && result.Item2 == LocationStatusEnum.Free.ObjToInt())
-                        {
-                            BaseDal.AddData(task[i]);
-                            location.LocationStatus = LocationStatusEnum.Lock.ObjToInt();
-                            _basicService.LocationInfoService.UpdateData(location);
-                            _basicService.LocationInfoService.UpdateLocationLock(location, task[i].TaskNum, StockChangeType.Outbound.ObjToInt(), false);
-                            content = WebResponseContent.Instance.OK();
-                        }
-                        else if (result.Item1 != null && (result.Item2 == LocationStatusEnum.Lock.ObjToInt() || result.Item2 == LocationStatusEnum.PalletLock.ObjToInt()))
-                        {
-                            Dt_Task TaskInfo = BaseDal.QueryFirst(x => x.SourceAddress == result.Item1.LocationCode);
-                            if (TaskInfo == null)
-                            {
-                                return content = WebResponseContent.Instance.Error("璐т綅琚攣瀹氫笉鍙嚭搴�");
-                            }
-                            else
+                            else if (result.Item1 == null && result.Item2 == LocationStatusEnum.Free.ObjToInt())
                             {
                                 BaseDal.AddData(task[i]);
                                 location.LocationStatus = LocationStatusEnum.Lock.ObjToInt();
                                 _basicService.LocationInfoService.UpdateData(location);
                                 content = WebResponseContent.Instance.OK();
                             }
+                            else if (result.Item1 != null && result.Item2 == LocationStatusEnum.Free.ObjToInt())
+                            {
+                                BaseDal.AddData(task[i]);
+                                location.LocationStatus = LocationStatusEnum.Lock.ObjToInt();
+                                _basicService.LocationInfoService.UpdateData(location);
+                                _basicService.LocationInfoService.UpdateLocationLock(location, task[i].TaskNum, StockChangeType.Outbound.ObjToInt(), false);
+                                content = WebResponseContent.Instance.OK();
+                            }
+                            else if (result.Item1 != null && (result.Item2 == LocationStatusEnum.Lock.ObjToInt() || result.Item2 == LocationStatusEnum.PalletLock.ObjToInt()))
+                            {
+                                Dt_Task TaskInfo = BaseDal.QueryFirst(x => x.SourceAddress == result.Item1.LocationCode);
+                                if (TaskInfo == null)
+                                {
+                                    return content = WebResponseContent.Instance.Error("璐т綅琚攣瀹氫笉鍙嚭搴�");
+                                }
+                                else
+                                {
+                                    BaseDal.AddData(task[i]);
+                                    location.LocationStatus = LocationStatusEnum.Lock.ObjToInt();
+                                    _basicService.LocationInfoService.UpdateData(location);
+                                    content = WebResponseContent.Instance.OK();
+                                }
+                            }
+                        }
+                        else
+                        {
+                            return content = WebResponseContent.Instance.Error("浠诲姟寮傚父");
                         }
                     }
-                    else
-                    {
-                        return content = WebResponseContent.Instance.OK("浠诲姟寮傚父");
-                    }
+                }
+                else
+                {
+                    return content = WebResponseContent.Instance.Error("娌℃湁搴撳瓨鐢熸垚浠诲姟");
                 }
                 _unitOfWorkManage.CommitTran();
                 return content;
             }
-            catch(Exception ex) 
+            catch (Exception ex)
             {
                 _unitOfWorkManage.RollbackTran();
                 return content = WebResponseContent.Instance.Error(ex.Message);
@@ -326,7 +334,7 @@
                             if (result.Item1 != null && result.Item2 != null)
                             {
                                 _basicService.LocationInfoService.RelocationLock(Result.Item1, result.Item2, result.Item1.TaskNum);
-                                locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt();
+                                locationInfo.LocationStatus = LocationStatusEnum.PalletLock.ObjToInt();
                                 _basicService.LocationInfoService.UpdateData(locationInfo);
                                 _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Relocation.ObjToInt(), "", task.TaskNum);
                                 return content = WebResponseContent.Instance.OK();

--
Gitblit v1.9.3