From b55d324f4b7465f9a7dc50e999346697f5cc35a2 Mon Sep 17 00:00:00 2001
From: wankeda <Administrator@DESKTOP-HAU3ST3>
Date: 星期五, 07 三月 2025 15:17:19 +0800
Subject: [PATCH] 1

---
 WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs |  113 ++++++++------------------------------------------------
 1 files changed, 17 insertions(+), 96 deletions(-)

diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs b/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs
index 3c97516..7d59493 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs
@@ -20,56 +20,10 @@
 {
     public partial class TaskService
     {
-        /// <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>
-        /// 鐗╂枡鍏ュ簱
+        /// 绔嬪簱鍏ュ簱鎸囦护涓婁紶
         /// </summary>
         /// <param name="stationCode">璧峰鍦板潃</param>
         /// <param name="palletCode">鎵樼洏缂栧彿</param>
@@ -77,29 +31,26 @@
         public WebResponseContent InboundRequest(SaveModel saveModel)
         {
             string palletCode = saveModel.palletCode;
+            if (saveModel.palletCode == null) return WebResponseContent.Instance.Error($"璇疯緭鍏ユ纭墭鐩樺彿");
             WebResponseContent content = new WebResponseContent();
             try
             {
                 Dt_InboundOrderDetail inboundOrderDet = BaseDal.Db.Queryable<Dt_InboundOrderDetail>().Where(x => x.LPNNo == palletCode).First();
                 Dt_InboundOrder inboundOrder = BaseDal.Db.Queryable<Dt_InboundOrder>().Where(x => x.Id == inboundOrderDet.OrderId).Includes(x => x.Details).First();
-                Dt_RoadwayInfo roadwayInfo = _basicService.RoadwayInfoService.Repository.QueryFirst(x => x.RoadwayNo == inboundOrder.OutWareHouse);
                 if (inboundOrder == null)
                 {
                     return WebResponseContent.Instance.Error($"鏈壘鍒板叆搴撳崟淇℃伅");
                 }
+                Dt_Warehouse warehouse = _basicService.WarehouseService.Repository.QueryFirst(x => x.WarehouseId == inboundOrder.WarehouseId);
+                Dt_RoadwayInfo roadwayInfo = _basicService.RoadwayInfoService.Repository.QueryFirst(x => x.RoadwayNo == warehouse.WarehouseCode);
+                if (roadwayInfo != null) { }
+
                 if (inboundOrder.Details == null || inboundOrder.Details.Count <= 0)
                 {
                     return WebResponseContent.Instance.Error($"鏈壘鍒板叆搴撳崟鏄庣粏淇℃伅");
                 }
                 Dt_StockInfo stockInfo1 = BaseDal.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == palletCode).Includes(x => x.Details).First();
-                if (stockInfo1 != null)
-                {
-                    return WebResponseContent.Instance.Error($"宸插瓨鍦ㄦ鎵樼洏搴撳瓨淇℃伅");
-                }
-
-                //Dt_InboundOrder dt_Int = _inboundService.InbounOrderService.Repository.QueryFirst(x => x.UpperOrderNo == palletCode);
-                //Dt_InboundOrderDetail dt_InboundOrderDetail = _inboundService.InboundOrderDetailService.Repository.QueryFirst(x => x.OrderId == dt_Int.Id);
-                if (inboundOrder != null)
+                if (stockInfo1 == null)
                 {
                     Dt_StockInfo dt_Stock = new()
                     {
@@ -115,10 +66,8 @@
                         Mgeneratetime = DateTime.Now,
                     };
                     _stockService.StockInfoService.Repository.AddData(dt_Stock);
-                }
-                Dt_StockInfo dt_StockInfo = _stockService.StockInfoService.Repository.GetStockInfo(palletCode);
-                if (inboundOrderDet != null)
-                {
+
+                    Dt_StockInfo dt_StockInfo = _stockService.StockInfoService.Repository.GetStockInfo(palletCode);
                     Dt_StockInfoDetail dt_StockInfoDetail = new()
                     {
                         StockId = dt_StockInfo.Id,
@@ -129,7 +78,7 @@
                         LinId = inboundOrderDet.LinId,                    //SerialNumber = targetCodes[2].ToString(),    //鍖呭彿
                                                                           //BatchNoName = dt_Int.OrderNo,
                         StockQuantity = inboundOrderDet.OrderQuantity,    //閲嶉噺
-                        //OutboundQuantity = 1,    //搴忓垪鍙�
+                                                                          //OutboundQuantity = 1,    //搴忓垪鍙�
                         Status = (int)StockStatusEmun.缁勭洏鏆傚瓨,
                         Creater = "WMS",
                         CreateDate = DateTime.Now,
@@ -150,7 +99,7 @@
         }
         public string ReceiveWMSInventoryIn = WIDESEA_Core.Helper.AppSettings.Configuration["ReceiveWMSInventoryIn"];
         /// <summary>
-        /// 鐩樼偣鍏ュ簱
+        /// 鐩樼偣宸紓鏁伴噺鍥炰紶
         /// </summary>
         /// <returns></returns>
         public WebResponseContent InventoryIn(string name, int qty)
@@ -160,7 +109,6 @@
             {
                 Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.QueryFirst(x => x.PalletCode == name);
                 Dt_StockInfoDetail stockInfoDetail = _stockService.StockInfoDetailService.Repository.QueryFirst(x => x.StockId == stockInfo.Id);
-                //Dt_OutboundOrder outboundOrder = _outboundService.OutboundOrderService.Repository.QueryFirst(x => x.OrderNo == stockInfoDetail.OrderNo);
                 Dt_OutboundOrderDetail outboundOrderDetail = _outboundService.OutboundOrderDetailService.Repository.QueryFirst(x => x.LPNNo == stockInfo.PalletCode);
                 Dt_OutboundOrder outboundOrder = _outboundService.OutboundOrderService.Repository.QueryFirst(x => x.Id == outboundOrderDetail.OrderId);
                 HouseInventoryIn houseInboundPassBack = new HouseInventoryIn();
@@ -203,18 +151,6 @@
                     houseInboundPassBack.Context.Add("InvOrgId", InvOrgId);
                     var responses = HttpHelper.Post<WebResponseContent>(ReceiveWMSInventoryIn, houseInboundPassBack, "绔嬪簱鍏ュ簱鏁伴噺鍥炰紶WMS");
                 }
-
-                //          #region 楠岃瘉鏁版嵁
-                //(bool, string, object ?) result = CheckInboundOrderAddData(orderAddDTO1);
-                //          if (!result.Item1) return content = WebResponseContent.Instance.Error(result.Item2);
-                //          #endregion
-
-                //          Dt_OutboundOrder inboundOrder = _mapper.Map<Dt_OutboundOrder>(orderAddDTO1);
-                //          inboundOrder.OrderStatus = InboundStatusEnum.鏈紑濮�.ObjToInt();
-                //          inboundOrder.OrderType = OutOrderTypeEnum.OutInventory.ObjToInt();
-                //          inboundOrder.Creater = "WMS";
-                //          inboundOrder.CreateDate = DateTime.Now;
-                //          bool a = BaseDal.Db.InsertNav(inboundOrder).Include(x => x.Details).ExecuteCommand();
                 content = WebResponseContent.Instance.OK();
             }
             catch (Exception ex)
@@ -290,7 +226,7 @@
                         _basicService.LocationInfoService.UpdateLocationLock(locationInfo, task.TaskNum, StockChangeType.Inbound.ObjToInt(), false);
                     }
                     //涓嬪彂鍏ュ簱浠诲姟鑷砏CS
-                    var responses = HttpHelper.Post<WebResponseContent>(ReceiveWMSTask, task, "涓嬪彂浠诲姟鍏ュ簱");
+                    //var responses = HttpHelper.Post<WebResponseContent>(ReceiveWMSTask, task, "涓嬪彂浠诲姟鍏ュ簱");
                     dt_Int.OrderStatus = InboundStatusEnum.鍏ュ簱涓�.ObjToInt();
                     _inboundService.InbounOrderService.Repository.UpdateData(dt_Int);
                     _basicService.LocationInfoService.Repository.UpdateData(locationInfo);
@@ -320,10 +256,10 @@
             {
                 return (false, "璇ユ墭鐩樺彿宸叉湁浠诲姟");
             }
-            //if (BaseDal.QueryFirst(x => (x.SourceAddress == stationCode || x.CurrentAddress == stationCode) && x.TaskStatus == InTaskStatusEnum.InNew.ObjToInt()) != null)
-            //{
-            //    return (false, "褰撳墠鍏ュ簱绔欏彴宸叉湁涓�鏉℃柊寤轰换鍔�");
-            //}
+            if (BaseDal.QueryFirst(x => (x.SourceAddress == stationCode || x.CurrentAddress == stationCode) && x.TaskStatus == InTaskStatusEnum.InNew.ObjToInt()) != null)
+            {
+                return (false, "褰撳墠鍏ュ簱绔欏彴宸叉湁涓�鏉℃柊寤轰换鍔�");
+            }
             if (isCheckStock)
             {
                 if (stockInfo == null)
@@ -866,20 +802,5 @@
         //        throw;
         //    }
         //}
-
-        public WebResponseContent PalletQueryinventory()
-        {
-            WebResponseContent content = new WebResponseContent();
-            List<Dt_LocationInfo> locationinfoData = _basicService.LocationInfoService.Repository.QueryData(x => x.RoadwayNo == "2" && x.LocationStatus == LocationStatusEnum.Free.ObjToInt()
-            && x.LocationType == (int)LocationTypeEnum.EmptyCube && x.EnableStatus == (int)EnableStatusEnum.Normal);
-            if (locationinfoData.Count < 20)
-            {
-                return content = WebResponseContent.Instance.OK(data: 1);
-            }
-            else
-            {
-                return content = WebResponseContent.Instance.OK(data: 3);
-            }
-        }
     }
 }

--
Gitblit v1.9.3