From 733e63cb362f17aea4a1020654fa348a0d0c1f06 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期一, 24 二月 2025 00:08:59 +0800
Subject: [PATCH] 优化入库逻辑,优化直接出库逻辑,优化移库任务逻辑

---
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs |   46 +++++++++++++---------------------------------
 1 files changed, 13 insertions(+), 33 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs"
index e60d181..bc40862 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs"
@@ -214,40 +214,15 @@
                         if (instockInfoDetail != null) instockInfo = _stockService.StockInfoService.Repository.GetStockInfo(instockInfoDetail.StockId);
                         if (instockInfo != null)
                         {
-                            locationInfo = _basicService.LocationInfoService.GetLocation(instockInfo.LocationCode);//鏌ヨ宸插瓨鍦ㄥ簱瀛樿揣浣嶇姸鎬�
-                            #region MyRegion
-                            //if (locationInfo.MaxQty == 12)
-                            //{
-                            //    locationInfo.EnableStatus = EnableStatusEnum.OnlyOut.ObjToInt();
-                            //    _basicService.LocationInfoService.Repository.UpdateData(locationInfo);
-                            //    locationInfo = null;
-                            //}
-                            //if (locationInfo.EnableStatus == EnableStatusEnum.OnlyOut.ObjToInt()) locationInfo = null; 
-                            #endregion
-                            if (locationInfo.LocationStatus > LocationStatusEnum.Inbounding.ObjToInt()) locationInfo = null;
-
-                            else
+                            Dt_LocationInfo? location = _basicService.LocationInfoService.GetLocation(instockInfo.LocationCode);//鏌ヨ宸插瓨鍦ㄥ簱瀛樿揣浣嶇姸鎬�
+                            if (location?.Row == 1)
                             {
-                                #region 鍒ゆ柇璐т綅
-                                if (locationInfo.Row == 1)//澶栦晶璐т綅锛屽垽鏂唴渚ц揣浣�
+                                var newLocation = Db.Queryable<Dt_LocationInfo>().Where(x => x.Row == 2 && x.Layer == location.Layer && x.Column == location.Column).First();
+                                if (newLocation != null && newLocation.LocationStatus == LocationStatusEnum.Free.ObjToInt() && newLocation.CurrentQty == 0 && (newLocation.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || newLocation.EnableStatus == EnableStatusEnum.Normal.ObjToInt()))
                                 {
-                                    var newLocation = Db.Queryable<Dt_LocationInfo>().Where(x => x.LocationCode != locationInfo.LocationCode && x.Remark == locationInfo.Remark).First();
-                                    if (newLocation != null)
-                                    {
-                                        if (newLocation.LocationStatus == LocationStatusEnum.Free.ObjToInt() &&
-                                            (newLocation.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() ||
-                                            newLocation.EnableStatus == EnableStatusEnum.Normal.ObjToInt()))
-                                        {
-                                            locationInfo = newLocation;
-                                        }
-                                    }
+                                    locationInfo = newLocation;
                                 }
-                                #endregion
-                                //List<Dt_StockInfoDetail> stockInfoDetails = _stockService.StockInfoDetailService.Get_StockInfoDetails(stockInfoDetail.OrderNo);//鑾峰彇宸ュ崟鎵�鏈夊凡鍏ュ簱鎴栧叆搴撲腑搴撳瓨
-                                //if (stockInfoDetails.GroupBy(x => x.BatchNo).Count() < 2) locationInfo.EnableStatus = EnableStatusEnum.OnlyOut.ObjToInt();
-                                //else locationInfo = null;
                             }
-                            //if (locationInfo?.MaxQty <= locationInfo?.CurrentQty) locationInfo = null;
                         }
                     }
 
@@ -268,13 +243,17 @@
                 task.CurrentAddress = task.NextAddress;
                 task.NextAddress = locationInfo.LocationCode;//浣跨敤璐т綅澶囨敞瀛楁锛屽搴斿爢鍨涙満鎺掑垪灞�
                 task.TargetAddress = task.NextAddress;
-                task.IsPickPlace = locationInfo.MaxQty - locationInfo.CurrentQty == 1;
+                string[] targetCodes = task.NextAddress.Split("-");
+                var Row = Convert.ToInt16(targetCodes[0]);
+                task.TargetIsPickPlace = Row > 1 ? locationInfo.MaxQty - locationInfo.CurrentQty == 1 : false;
+                task.SourceIsPickPlace = false;
                 stockInfo.LocationCode = locationInfo.LocationCode;
                 stockInfo.StockStatus = StockStatusEmun.鍏ュ簱涓�.ObjToInt();
                 stockInfoDetail.Status = StockStatusEmun.鍏ュ簱涓�.ObjToInt();
                 locationInfo.CurrentQty++;
                 if (locationInfo.MaxQty < locationInfo.CurrentQty) throw new Exception();
-                if (locationInfo.MaxQty == 12) locationInfo.EnableStatus = EnableStatusEnum.OnlyOut.ObjToInt();
+                /*if (locationInfo.MaxQty == 12)*/
+                locationInfo.EnableStatus = EnableStatusEnum.OnlyOut.ObjToInt();
                 locationInfo.LocationStatus = LocationStatusEnum.Inbounding.ObjToInt();
 
                 Db.Ado.BeginTran();
@@ -287,7 +266,8 @@
                 content.OK(data: new ReceiveWMSInfo()
                 {
                     TargetAddress = task.TargetAddress,
-                    IsPickPlace = task.IsPickPlace,
+                    SourceIsPickPlace = task.SourceIsPickPlace,
+                    TargetIsPickPlace = task.TargetIsPickPlace,
                 });
             }
             catch (Exception ex)

--
Gitblit v1.9.3