From fdf7bb595ee00e5fef7b4e110fbe32f637c069f6 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期一, 18 八月 2025 08:38:46 +0800
Subject: [PATCH] 1

---
 项目代码/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs           |  212 +++++++++++++++++++++---------------------
 项目代码/WMS/WMSServices/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs |   12 --
 项目代码/WMS/WMSServices/WIDESEA_ITaskInfoService/ITaskService.cs                 |    8 -
 项目代码/WMS/WMSServices/WIDESEA_Common/StockEnum/StockStatusEmun.cs              |   12 +-
 项目代码/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Reloaction.cs        |    2 
 5 files changed, 115 insertions(+), 131 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_Common/StockEnum/StockStatusEmun.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_Common/StockEnum/StockStatusEmun.cs"
index f2e8480..a155339 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_Common/StockEnum/StockStatusEmun.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_Common/StockEnum/StockStatusEmun.cs"
@@ -84,12 +84,12 @@
     {
         [Description("鎴愬搧")]
         鎴愬搧 =1,
-        [Description("灏炬暟")]
-        灏炬暟 =2,
-        [Description("鐮斿彂")]
-        鐮斿彂 =3,
-        [Description("鐮斿彂")]
-        杈呮枡 = 4,
+        [Description("鍗婃垚鍝�")]
+        鍗婃垚鍝� = 2,
+        [Description("鍘熸潗鏂�")]
+        鍘熸潗鏂� = 3,
+        [Description("杈呮枡澶囦欢")]
+        杈呮枡澶囦欢 = 4,
         [Description("绌烘墭")]
         绌烘墭 = 5,
     }
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_ITaskInfoService/ITaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_ITaskInfoService/ITaskService.cs"
index 2043f3f..238ea19 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_ITaskInfoService/ITaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_ITaskInfoService/ITaskService.cs"
@@ -152,13 +152,7 @@
         /// </summary>
         /// <returns></returns>
         WebResponseContent ShipmentOrderSync(MesShipmentOrderSync model);
-        /// <summary>
-        /// 鎴愬搧浣欐枡閫�搴撳叆浠�
-        /// </summary>
-        /// <param name="barCode"></param>
-        /// <param name="startPoint"></param>
-        /// <returns></returns>
-        WebResponseContent BackProductTask(string barCode, string startPoint);
+       
         /// <summary>
         /// 鎴愬搧绌烘鍥炲簱
         /// </summary>
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs"
index bb167ed..16142da 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs"
@@ -425,112 +425,112 @@
         /// <param name="barCode"></param>
         /// <param name="startPoint"></param>
         /// <returns></returns>
-        public WebResponseContent BackProductTask(string barCode, string startPoint)
-        {
-            WebResponseContent content = new WebResponseContent();
-            try
-            {
-                string palletCode = @"^C\d{5}$";  // 姝e垯琛ㄨ揪寮�
-                bool isValid = Regex.IsMatch(barCode, palletCode);
-                if (!isValid)
-                {
-                    return content.Error($"妗嗙爜鏍煎紡閿欒{barCode}");
-                }
-                if (!OutStartPonits.Contains(startPoint))
-                {
-                    return content.Error($"璧风偣閿欒{startPoint}");
-                }
-                //鍒ゆ柇褰撳墠鐐逛綅鏄惁閲嶅
-                Dt_Task taskOldPoint = BaseDal.QueryFirst(x=>x.SourceAddress==startPoint && (x.TaskStatus == TaskStatusEnum.New.ObjToInt()||x.TaskStatus==TaskStatusEnum.Line_Execute.ObjToInt()|| x.TaskStatus == TaskStatusEnum.Line_Executing.ObjToInt() || x.TaskStatus == TaskStatusEnum.AGV_Takeing.ObjToInt()));
-                if (taskOldPoint != null)
-                {
-                    return content.Error($"绔欑偣{startPoint}宸插瓨鍦ㄤ换鍔�");
-                }
-                Dt_Task taskOld = BaseDal.QueryFirst(x => x.PalletCode == barCode);
-                if (taskOld != null)
-                {
-                    return content.Error($"鑳舵{barCode}浠诲姟宸插瓨鍦�");
-                }
-                //鑾峰彇鑳舵浣欐枡
-                Dt_ProStockInfo proStockInfo = _stockRepository.ProStockInfoRepository.Db.Queryable<Dt_ProStockInfo>().Where(x=>x.PalletCode== barCode).Includes(x=>x.proStockInfoDetails).First();
-                if (proStockInfo==null)
-                {
-                    return content.Error($"鏈壘鍒皗barCode}鑳舵淇℃伅");
-                }
-                if (proStockInfo.proStockInfoDetails==null || proStockInfo.proStockInfoDetails.Count<=0)
-                {
-                    return content.Error($"{barCode}鑳舵淇℃伅涓虹┖");
-                }
-                if (proStockInfo.StockStatus!=StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt())
-                {
-                    return content.Error($"{barCode}鑳舵淇℃伅鐘舵�佸紓甯�");
-                }
-                //鑾峰彇鎴愬搧骞冲簱
-                Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA101.ToString());
-                if (proStockInfo.WarehouseId != warehouse.WarehouseId && proStockInfo.LocationCode!= "鎴愬搧鍖呰鎷h揣鍖�")
-                {
-                    return content.Error($"{barCode}鑳舵淇℃伅涓嶅湪鎷h揣鍖�");
-                }
-                //鑾峰彇褰撳墠鐨勫簱瀛樺睘鎬�
-                Dt_Warehouse? warePoint = null;
-                switch (proStockInfo.ProStockAttribute)
-                {
-                    case (int)ProStockAttributeEnum.鎴愬搧:
-                        warePoint = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA71.ToString());
-                        break;
-                    case (int)ProStockAttributeEnum.灏炬暟:
-                        warePoint = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA72.ToString());
-                        break;
-                    case (int)ProStockAttributeEnum.鐮斿彂:
-                        warePoint = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA73.ToString());
-                        break;
-                    default:
-                        throw new Exception($"鏈壘鍒皗barCode}鑳舵淇℃伅搴撳瓨灞炴��");
-                }
-                Dt_Warehouse warehouseLocation = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA71.ToString());
-                Dt_LocationInfo locationInfo = _basicRepository.LocationInfoRepository.QueryFirst(x => x.WarehouseId == warehouseLocation.WarehouseId);
-                if (locationInfo == null)
-                {
-                    return content.Error($"鏈壘鍒皗warehouse.WarehouseCode}璐т綅淇℃伅");
-                }
-                proStockInfo.StockStatus = StockStatusEmun.鎴愬搧浣欐枡鍥炲簱.ObjToInt();
-                proStockInfo.proStockInfoDetails.ForEach(x =>
-                {
-                    x.ProOutDetailStatus = StockStatusEmun.鎴愬搧浣欐枡鍥炲簱.ObjToInt();
-                });
-                Dt_Task newTask = new Dt_Task()
-                {
-                    CurrentAddress = startPoint,
-                    Grade = 0,
-                    NextAddress = "",
-                    PalletCode = proStockInfo.PalletCode,
-                    Roadway = locationInfo.RoadwayNo,
-                    SourceAddress = startPoint,
-                    TargetAddress = "",
-                    TaskType = TaskTypeEnum.InProductBack.ObjToInt(),
-                    TaskStatus = TaskStatusEnum.New.ObjToInt(),
-                    WarehouseId = warePoint.WarehouseId,
-                    PalletType = proStockInfo.PalletType,
-                    MaterielCode = proStockInfo.proStockInfoDetails.Where(x => x.ProStockId == proStockInfo.Id).FirstOrDefault()?.ProductCode,
-                    Quantity = (float)proStockInfo.proStockInfoDetails.Where(x => x.ProStockId == proStockInfo.Id).Sum(x => x.StockPcsQty)
-                };
-                _unitOfWorkManage.BeginTran();
-                int taskId = BaseDal.AddData(newTask);
-                newTask.TaskId = taskId;
-                _stockRepository.ProStockInfoRepository.UpdateData(proStockInfo);
-                _stockRepository.ProStockInfoDetailRepository.UpdateData(proStockInfo.proStockInfoDetails);
-                _unitOfWorkManage.CommitTran();
-                //鎺ㄩ�佷换鍔�
-                PushTasksToWCS(new List<Dt_Task> { newTask });
-                content.OK("鍙戦�佹垚鍔�");
-            }
-            catch (Exception ex)
-            {
-                _unitOfWorkManage.RollbackTran();
-                content.Error(ex.Message);
-            }
-            return content;
-        }
+        //public WebResponseContent BackProductTask(string barCode, string startPoint)
+        //{
+        //    WebResponseContent content = new WebResponseContent();
+        //    try
+        //    {
+        //        string palletCode = @"^C\d{5}$";  // 姝e垯琛ㄨ揪寮�
+        //        bool isValid = Regex.IsMatch(barCode, palletCode);
+        //        if (!isValid)
+        //        {
+        //            return content.Error($"妗嗙爜鏍煎紡閿欒{barCode}");
+        //        }
+        //        if (!OutStartPonits.Contains(startPoint))
+        //        {
+        //            return content.Error($"璧风偣閿欒{startPoint}");
+        //        }
+        //        //鍒ゆ柇褰撳墠鐐逛綅鏄惁閲嶅
+        //        Dt_Task taskOldPoint = BaseDal.QueryFirst(x=>x.SourceAddress==startPoint && (x.TaskStatus == TaskStatusEnum.New.ObjToInt()||x.TaskStatus==TaskStatusEnum.Line_Execute.ObjToInt()|| x.TaskStatus == TaskStatusEnum.Line_Executing.ObjToInt() || x.TaskStatus == TaskStatusEnum.AGV_Takeing.ObjToInt()));
+        //        if (taskOldPoint != null)
+        //        {
+        //            return content.Error($"绔欑偣{startPoint}宸插瓨鍦ㄤ换鍔�");
+        //        }
+        //        Dt_Task taskOld = BaseDal.QueryFirst(x => x.PalletCode == barCode);
+        //        if (taskOld != null)
+        //        {
+        //            return content.Error($"鑳舵{barCode}浠诲姟宸插瓨鍦�");
+        //        }
+        //        //鑾峰彇鑳舵浣欐枡
+        //        Dt_ProStockInfo proStockInfo = _stockRepository.ProStockInfoRepository.Db.Queryable<Dt_ProStockInfo>().Where(x=>x.PalletCode== barCode).Includes(x=>x.proStockInfoDetails).First();
+        //        if (proStockInfo==null)
+        //        {
+        //            return content.Error($"鏈壘鍒皗barCode}鑳舵淇℃伅");
+        //        }
+        //        if (proStockInfo.proStockInfoDetails==null || proStockInfo.proStockInfoDetails.Count<=0)
+        //        {
+        //            return content.Error($"{barCode}鑳舵淇℃伅涓虹┖");
+        //        }
+        //        if (proStockInfo.StockStatus!=StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt())
+        //        {
+        //            return content.Error($"{barCode}鑳舵淇℃伅鐘舵�佸紓甯�");
+        //        }
+        //        //鑾峰彇鎴愬搧骞冲簱
+        //        Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA101.ToString());
+        //        if (proStockInfo.WarehouseId != warehouse.WarehouseId && proStockInfo.LocationCode!= "鎴愬搧鍖呰鎷h揣鍖�")
+        //        {
+        //            return content.Error($"{barCode}鑳舵淇℃伅涓嶅湪鎷h揣鍖�");
+        //        }
+        //        //鑾峰彇褰撳墠鐨勫簱瀛樺睘鎬�
+        //        Dt_Warehouse? warePoint = null;
+        //        switch (proStockInfo.ProStockAttribute)
+        //        {
+        //            case (int)ProStockAttributeEnum.鎴愬搧:
+        //                warePoint = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA71.ToString());
+        //                break;
+        //            case (int)ProStockAttributeEnum.灏炬暟:
+        //                warePoint = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA72.ToString());
+        //                break;
+        //            case (int)ProStockAttributeEnum.鐮斿彂:
+        //                warePoint = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA73.ToString());
+        //                break;
+        //            default:
+        //                throw new Exception($"鏈壘鍒皗barCode}鑳舵淇℃伅搴撳瓨灞炴��");
+        //        }
+        //        Dt_Warehouse warehouseLocation = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA71.ToString());
+        //        Dt_LocationInfo locationInfo = _basicRepository.LocationInfoRepository.QueryFirst(x => x.WarehouseId == warehouseLocation.WarehouseId);
+        //        if (locationInfo == null)
+        //        {
+        //            return content.Error($"鏈壘鍒皗warehouse.WarehouseCode}璐т綅淇℃伅");
+        //        }
+        //        proStockInfo.StockStatus = StockStatusEmun.鎴愬搧浣欐枡鍥炲簱.ObjToInt();
+        //        proStockInfo.proStockInfoDetails.ForEach(x =>
+        //        {
+        //            x.ProOutDetailStatus = StockStatusEmun.鎴愬搧浣欐枡鍥炲簱.ObjToInt();
+        //        });
+        //        Dt_Task newTask = new Dt_Task()
+        //        {
+        //            CurrentAddress = startPoint,
+        //            Grade = 0,
+        //            NextAddress = "",
+        //            PalletCode = proStockInfo.PalletCode,
+        //            Roadway = locationInfo.RoadwayNo,
+        //            SourceAddress = startPoint,
+        //            TargetAddress = "",
+        //            TaskType = TaskTypeEnum.InProductBack.ObjToInt(),
+        //            TaskStatus = TaskStatusEnum.New.ObjToInt(),
+        //            WarehouseId = warePoint.WarehouseId,
+        //            PalletType = proStockInfo.PalletType,
+        //            MaterielCode = proStockInfo.proStockInfoDetails.Where(x => x.ProStockId == proStockInfo.Id).FirstOrDefault()?.ProductCode,
+        //            Quantity = (float)proStockInfo.proStockInfoDetails.Where(x => x.ProStockId == proStockInfo.Id).Sum(x => x.StockPcsQty)
+        //        };
+        //        _unitOfWorkManage.BeginTran();
+        //        int taskId = BaseDal.AddData(newTask);
+        //        newTask.TaskId = taskId;
+        //        _stockRepository.ProStockInfoRepository.UpdateData(proStockInfo);
+        //        _stockRepository.ProStockInfoDetailRepository.UpdateData(proStockInfo.proStockInfoDetails);
+        //        _unitOfWorkManage.CommitTran();
+        //        //鎺ㄩ�佷换鍔�
+        //        PushTasksToWCS(new List<Dt_Task> { newTask });
+        //        content.OK("鍙戦�佹垚鍔�");
+        //    }
+        //    catch (Exception ex)
+        //    {
+        //        _unitOfWorkManage.RollbackTran();
+        //        content.Error(ex.Message);
+        //    }
+        //    return content;
+        //}
         /// <summary>
         /// 绌烘鍥炲簱
         /// </summary>
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Reloaction.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Reloaction.cs"
index 7e3464f..10f4bb0 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Reloaction.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Reloaction.cs"
@@ -176,7 +176,7 @@
                 Dt_LocationInfo startLocationInfo = _basicRepository.LocationInfoRepository.QueryFirst(x => x.LocationCode == startAddress);
                 Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.QueryFirst(x => x.LocationCode == startAddress);
                 Dt_LocationInfo endLocationInfo = _basicRepository.LocationInfoRepository.QueryFirst(x => x.LocationCode == endAddress);
-                if (startLocationInfo != null && endLocationInfo != null && stockInfo!=null)
+                if (startLocationInfo != null && startLocationInfo.LocationStatus==LocationStatusEnum.InStock.ObjToInt() && endLocationInfo != null && endLocationInfo.LocationStatus==LocationStatusEnum.Free.ObjToInt() && endLocationInfo.EnableStatus==EnableStatusEnum.Normal.ObjToInt() && stockInfo!=null)
                 {
                     Dt_Task newTask = new Dt_Task()
                     {
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs"
index 24cc3df..1d03895 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs"
@@ -57,17 +57,7 @@
         {
             return Service.AssignInboundTaskLocationByHeight(taskNum, roadwayNo, heightType);
         }
-        /// <summary>
-        /// 鎴愬搧浣欐枡閫�搴撳叆浠�
-        /// </summary>
-        /// <param name="barCode"></param>
-        /// <param name="startPoint"></param>
-        /// <returns></returns>
-        [HttpPost, HttpGet, Route("BackProductTask"), AllowAnonymous]
-        public WebResponseContent BackProductTask(string barCode, string startPoint)
-        {
-            return Service.BackProductTask(barCode, startPoint);
-        }
+        
         /// <summary>
         /// 鎴愬搧绌烘鍥炲簱
         /// </summary>

--
Gitblit v1.9.3