From 1d8897348d578648421b024d0dc5ff3d626e05f9 Mon Sep 17 00:00:00 2001
From: huanghongfeng <huanghongfeng@hnkhzn.com>
Date: 星期四, 19 六月 2025 16:48:07 +0800
Subject: [PATCH] 最新

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs |  258 ++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 240 insertions(+), 18 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 02e4916..4ab615a 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"
@@ -404,7 +404,7 @@
                     }
                     targetCodes[4] = "01";
                     string LocationCode = string.Join("-", targetCodes); //缁勮娴呭簱浣嶅湴鍧�
-                    Dt_LocationInfo locationInfos = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == LocationCode);
+                    Dt_LocationInfo locationInfos = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == LocationCode && (x.LocationStatus == (int)LocationStatusEnum.Free || x.LocationStatus == (int)LocationStatusEnum.InStock));
                     if (locationInfos == null)
                     {
                         return content = WebResponseContent.Instance.Error($"鏈壘鍒拌璐т綅淇℃伅,璐т綅缂栧彿:{locationInfos}");
@@ -417,7 +417,7 @@
                         }
                         else
                         {
-                            Dt_StockInfo dt_StockInfo = _stockService.StockInfoService.Repository.QueryFirst(x => x.LocationCode == LocationCode);
+                            Dt_StockInfo dt_StockInfo = _stockService.StockInfoService.Repository.QueryFirst(x => x.LocationCode == LocationCode && x.StockStatus== (int)StockStatusEmun.宸插叆搴�);
                             if (dt_StockInfo == null)
                             {
                                 return content = WebResponseContent.Instance.Error($"鏈壘鍒拌璐т綅鐨勫簱瀛樹俊鎭�,璐т綅缂栧彿:{LocationCode}");
@@ -435,7 +435,38 @@
                                 {
                                     Locationtype = 10;
                                 }
-                                newLocation = _basicService.LocationInfoService.GetLocation(locationInfos.RoadwayNo,Locationtype); //鎷垮埌浜嗙Щ搴撳悗鐨勮揣浣�
+                                //newLocation = _basicService.LocationInfoService.GetLocation(locationInfos.RoadwayNo,Locationtype); //鎷垮埌浜嗙Щ搴撳悗鐨勮揣浣�
+                                if (dt_StockInfo.MaterialType == (int)InventoryMaterialType.鎴愬搧)
+                                {
+                                    string[] targetCodesst = dt_StockInfo.PalletCode.Split("*");
+                                    Dt_InboundOrder dt_Inbound = _inboundService.InbounOrderService.Repository.QueryFirst(x => x.OrderName == targetCodesst[0]);
+                                    if (dt_Inbound.Startingcolumn != 0 || dt_Inbound.Terminationcolumn != 0)
+                                    {
+                                        newLocation = _basicService.LocationInfoService.GetLocation2(locationInfos.RoadwayNo, Locationtype, dt_Inbound.Startingcolumn, dt_Inbound.Terminationcolumn);
+                                    }
+                                    else
+                                    {
+                                        newLocation = _basicService.LocationInfoService.GetLocation(locationInfos.RoadwayNo, Locationtype);
+                                    }
+
+                                }
+                                else
+                                {
+                                    newLocation = _basicService.LocationInfoService.GetLocation(locationInfos.RoadwayNo, Locationtype);
+                                }
+
+
+                                //鐩爣璐т綅鏌ユ壘搴撲綅鏄惁鏈夎揣
+                                Dt_StockInfo dt_StockCurren = _stockService.StockInfoService.Repository.QueryFirst(x => x.LocationCode == newLocation.LocationCode);
+                                if (dt_StockCurren != null) return content = WebResponseContent.Instance.Error($"鍏ュ簱澶辫触锛屾墭鐩樻潯鐮侊細{dt_StockInfo.PalletCode}锛屾煡鎵惧嚭鐨勮揣浣嶄俊鎭搴斿凡鏈夊簱瀛�");
+
+                                Dt_Task taskcurren = BaseDal.QueryFirst(x => x.TargetAddress == newLocation.LocationCode);
+                                if (taskcurren != null) return content = WebResponseContent.Instance.Error($"鍏ュ簱澶辫触锛屾墭鐩樻潯鐮侊細{dt_StockInfo.PalletCode}锛屾煡鎵惧嚭鐨勮揣浣嶄俊鎭凡鏈夊叆搴撲换鍔�");
+
+                                bool crutaskthy = _taskHtyService.CrueeTaskHty(newLocation.LocationCode);
+                                if (crutaskthy) return content = WebResponseContent.Instance.Error($"鍏ュ簱澶辫触锛屾墭鐩樻潯鐮侊細{dt_StockInfo.PalletCode}锛屾煡鎵惧嚭鐨勮揣浣嶅湪浠诲姟鍘嗗彶淇℃伅涓紝鏈夊叆搴撴垨绉诲簱淇℃伅");
+
+
                                 if (newLocation != null)
                                 {
                                     Dt_Task dt_Task = new()
@@ -452,6 +483,7 @@
                                         Creater = "WMS",
                                         CreateDate = DateTime.Now,
                                         TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
+                                        MaterialType = dt_StockInfo.MaterialType
                                     };
                                     _unitOfWorkManage.BeginTran();
                                     if (locationInfos.LocationStatus == LocationStatusEnum.InStock.ObjToInt())
@@ -468,6 +500,7 @@
                                     loca.Add(newLocation);
                                     loca.Add(locationInfos);
                                     _basicService.LocationInfoService.UpdateData(loca);
+                                    BaseDal.AddData(dt_Task);
                                     _unitOfWorkManage.CommitTran();
                                     return content = WebResponseContent.Instance.OK(data: dt_Task);
                                 }
@@ -510,7 +543,12 @@
                     {
                         RoadwayNo = "2";
                     }
-                    Dt_LocationInfo locationInfos = _basicService.LocationInfoService.Repository.QueryFirst(x => x.RoadwayNo == RoadwayNo && x.LocationStatus == LocationStatusEnum.Pallet.ObjToInt());
+                    Dt_LocationInfo locationInfos = _basicService.LocationInfoService.Repository.QueryFirst(x => x.RoadwayNo == RoadwayNo && x.EnableStatus != (int)EnableStatusEnum.Disable && x.Depth==1 && x.LocationStatus == LocationStatusEnum.Pallet.ObjToInt());
+                    if(locationInfos == null)
+                    {
+                        locationInfos = _basicService.LocationInfoService.Repository.QueryFirst(x => x.RoadwayNo == RoadwayNo && x.Depth == 2 && x.EnableStatus != (int)EnableStatusEnum.Disable && x.LocationStatus == LocationStatusEnum.Pallet.ObjToInt());
+                    }
+
                     if (locationInfos != null)
                     {
                         Dt_StockInfo dt_StockInfo = _stockService.StockInfoService.Repository.QueryFirst(x => x.LocationCode == locationInfos.LocationCode);
@@ -538,6 +576,7 @@
                                     Depth = locationInfos.Depth,
                                     CreateDate = DateTime.Now,
                                     PalletCodequantity = (int)dt_StockInfo.Materialweight,
+                                    MaterialType = dt_StockInfo.MaterialType
                                 };
 
                                 _unitOfWorkManage.BeginTran();
@@ -618,6 +657,7 @@
                             CreateDate = DateTime.Now,
                             PalletCodequantity = (int)dt_StockInfo[i].Materialweight,
                             PLCTo = generate.TargetAddress == "R01-002-041-011-01" ? 1 : 2,
+                            MaterialType = dt_StockInfo[i].MaterialType
                         };
 
                         _unitOfWorkManage.BeginTran();
@@ -664,7 +704,7 @@
                 for (int i = 0; i < saveModel.DelKeys.Count; i++)
                 {
                     Dt_StockInfo stockt = _stockService.StockInfoService.Repository.QueryFirst(x => x.PalletCode == saveModel.DelKeys[i].ToString());
-                    if (stockt.StockStatus == (int)StockStatusEmun.宸插叆搴�)
+                    if (stockt.StockStatus == (int)StockStatusEmun.宸插叆搴� && (stockt.Wlstatus == (int)InventoryMaterialStatus.鍚堟牸 || stockt.Wlstatus == (int)InventoryMaterialStatus.杩斿伐 || stockt.Wlstatus == (int)InventoryMaterialStatus.鐗归噰) )
                     {
                         if(stockt.MaterialType != (int)InventoryMaterialType.鍘熸潗鏂�)
                         {
@@ -707,6 +747,7 @@
                                     Creater = "WMS",
                                     Depth = locationinfo.Depth,
                                     CreateDate = DateTime.Now,
+                                    MaterialType= stockt.MaterialType
                                 };
                                 dtstockt.Add(stockt);
                                 locations.Add(locationinfo);
@@ -718,17 +759,17 @@
                             }
                             else
                             {
-                                return content = WebResponseContent.Instance.Error($"鍑哄簱澶辫触锛屽彧鍙嚭搴�1宸烽亾鐨勬墭鐩樺拰鎴愬搧");
+                                return content = WebResponseContent.Instance.Error($"鍑哄簱澶辫触锛屽彧鍙嚭搴�1宸烽亾鐨勬墭鐩樺拰鎴愬搧锛屽嚭搴撴潯鐮侊細{saveModel.DelKeys[i].ToString()}");
                             }
                         }
                         else
                         {
-                            return content = WebResponseContent.Instance.Error($"鍑哄簱澶辫触锛岃涓嶈閫夋嫨鍘熸潗鏂欏嚭搴�");
+                            return content = WebResponseContent.Instance.Error($"鍑哄簱澶辫触锛岃涓嶈閫夋嫨鍘熸潗鏂欏嚭搴擄紝鍑哄簱鏉$爜锛歿saveModel.DelKeys[i].ToString()}");
                         }
                     }
                     else
                     {
-                        return content = WebResponseContent.Instance.Error($"鍑哄簱澶辫触锛岃閫夋嫨宸插叆搴撶殑搴撳瓨淇℃伅杩涜鍑哄簱");
+                        return content = WebResponseContent.Instance.Error($"鍑哄簱澶辫触锛岃閫夋嫨宸插叆搴撲笖锛堝悎鏍硷紝杩斿伐锛岀壒閲囷級鐨勭墿鏂欏嚭搴擄紒锛侊紒锛屽嚭搴撴潯鐮侊細{saveModel.DelKeys[i].ToString()}");
                     }
 
                 }
@@ -778,7 +819,7 @@
                     Dt_StockInfo stockt = stocktData.FirstOrDefault(x => x.PalletCode == palletCode);
                     if (stockt !=null)
                     {
-                        if (stockt.StockStatus == (int)StockStatusEmun.宸插叆搴�)
+                        if (stockt.StockStatus == (int)StockStatusEmun.宸插叆搴� && (stockt.Wlstatus == (int)InventoryMaterialStatus.鍚堟牸 || stockt.Wlstatus == (int)InventoryMaterialStatus.閫�璐� || stockt.Wlstatus == (int)InventoryMaterialStatus.鐗归噰))
                         {
                             Dt_StockInfoDetail stocktdetail = StockInfoDetailData.FirstOrDefault(x => x.StockId == stockt.Id);
                             if(stocktdetail != null)
@@ -791,6 +832,25 @@
                                     {
                                         locationinfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt();
                                     }
+
+                                    string TargetAdd = "";
+                                    if (saveModel.DelKeys[1].ToString()=="20")
+                                    {
+                                        TargetAdd = "R02-001-021-001-02";
+                                    }else if(saveModel.DelKeys[1].ToString() == "30")
+                                    {
+                                        TargetAdd = "R02-001-022-001-02";
+                                    }
+                                    else if (saveModel.DelKeys[1].ToString() == "40")
+                                    {
+                                        TargetAdd = "R01-002-044-001-01";
+                                    }
+                                    else
+                                    {
+                                        TargetAdd = locationinfo.RoadwayNo == "2" ? "R02-002-027-011-01" : "R01-002-041-011-01";
+                                    }
+
+
                                     Dt_Task dt_Task = new()
                                     {
                                         PalletCode = stockt.PalletCode,
@@ -799,23 +859,40 @@
                                         TaskType = TaskTypeEnum.Outbound.ObjToInt(),
                                         TaskStatus = InTaskStatusEnum.InNew.ObjToInt(),
                                         SourceAddress = locationinfo.LocationCode,
-                                        TargetAddress = locationinfo.RoadwayNo == "2" ? "R02-002-027-011-01" : "R01-002-041-011-01",
+                                        TargetAddress = TargetAdd,
                                         CurrentAddress = locationinfo.LocationCode,
-                                        NextAddress = locationinfo.RoadwayNo == "2" ? "R02-002-027-011-01" : "R01-002-041-011-01",
+                                        NextAddress = TargetAdd,
                                         Grade = 1,
                                         Creater = "WMS",
                                         Depth = locationinfo.Depth,
                                         CreateDate = DateTime.Now,
                                         PLCTo = int.Parse(saveModel.DelKeys[1].ToString()),
-
+                                        MaterialType=stockt.MaterialType
                                     };
                                     dtstockt.Add(stockt);
                                     locations.Add(locationinfo);
                                     taskdt.Add(dt_Task);
                                     dtstocktdetail.Add(stocktdetail);
                                 }
+                                else
+                                {
+                                    return content = WebResponseContent.Instance.Error($"鍑哄簱澶辫触锛屾湭鎵惧埌瀵瑰簲鐨勫簱浣嶄俊鎭紝璇锋牳瀵癸紒锛侊紒锛屽嚭搴撴潯鐮侊細{palletCode}");
+                                }
+                            }
+                            else
+                            {
+                                return content = WebResponseContent.Instance.Error($"鍑哄簱澶辫触锛屾湭鎵惧埌瀵瑰簲鐨勫簱瀛樿鎯呬俊鎭紝璇锋牳瀵癸紒锛侊紒锛屽嚭搴撴潯鐮侊細{palletCode}");
                             }
                         }
+                        else
+                        {
+                            return content = WebResponseContent.Instance.Error($"鍑哄簱澶辫触锛岃閫夋嫨宸插叆搴撲笖锛堝悎鏍硷紝鐗归噰锛岄��璐э級鐨勭墿鏂欏嚭搴擄紒锛侊紒锛屽嚭搴撴潯鐮侊細{palletCode}");
+                        }
+                    }
+                    else
+                    {
+                        return content = WebResponseContent.Instance.Error($"鍑哄簱澶辫触锛屾湭鎵惧埌瀵瑰簲鏉$爜鐨勫簱瀛樹俊鎭紝鍑哄簱鏉$爜锛歿palletCode}");
+
                     }
                 }
                 var responses = HttpHelper.Post<WebResponseContent>(ReceiveWMSTask, taskdt, "涓嬪彂浠诲姟鍏ュ簱");
@@ -835,6 +912,94 @@
             {
                 _unitOfWorkManage.RollbackTran();
                 return content = WebResponseContent.Instance.Error($"鍑哄簱澶辫触锛屾姤閿欎俊鎭細{ex.Message}");
+                throw;
+            }
+        }
+
+        public WebResponseContent ManualOutbound3(SaveModel saveModel)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                List<Dt_StockInfo> dtstockt = new List<Dt_StockInfo>();
+
+
+                List<Dt_StockInfo> stocktData = _stockService.StockInfoService.Repository.QueryData(x => x.StockStatus == (int)StockStatusEmun.宸插叆搴�);
+                string json = saveModel.DelKeys[0].ToString();
+                List<int> palletCodes = JsonConvert.DeserializeObject<List<int>>(json);
+
+                foreach (int pallid in palletCodes)
+                {
+                    Dt_StockInfo stockt = stocktData.FirstOrDefault(x => x.Id == pallid);
+                    if (stockt != null)
+                    {
+
+                        stockt.Wlstatus = int.Parse(saveModel.DelKeys[1].ToString());
+                        dtstockt.Add(stockt);
+                    }
+                    else
+                    {
+                        return content = WebResponseContent.Instance.Error($"淇敼澶辫触锛屾湭鎵惧埌瀵瑰簲鐨勫簱瀛樹俊鎭紝搴撳瓨缂栧彿锛歿pallid}");
+
+                    }
+                }
+                _unitOfWorkManage.BeginTran();
+                if (dtstockt.Count > 0)
+                {
+                    _stockService.StockInfoService.Repository.UpdateData(dtstockt);
+                }
+                _unitOfWorkManage.CommitTran();
+                content = WebResponseContent.Instance.OK($"淇敼鎴愬姛");
+                return content;
+            }
+            catch (Exception ex)
+            {
+                _unitOfWorkManage.RollbackTran();
+                return content = WebResponseContent.Instance.Error($"淇敼澶辫触锛屾姤閿欎俊鎭細{ex.Message}");
+                throw;
+            }
+        }
+
+        public WebResponseContent ManualOutbound4(SaveModel saveModel)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                List<Dt_StockInfo> dtstockt = new List<Dt_StockInfo>();
+
+
+                List<Dt_StockInfo> stocktData = _stockService.StockInfoService.Repository.QueryData(x => x.StockStatus == (int)StockStatusEmun.宸插叆搴�);
+                string json = saveModel.DelKeys[0].ToString();
+                List<int> palletCodes = JsonConvert.DeserializeObject<List<int>>(json);
+
+                foreach (int pallid in palletCodes)
+                {
+                    Dt_StockInfo stockt = stocktData.FirstOrDefault(x => x.Id == pallid);
+                    if (stockt != null)
+                    {
+
+                        stockt.Mgeneratetime = DateTime.Parse(saveModel.DelKeys[1].ToString());
+                        dtstockt.Add(stockt);
+                    }
+                    else
+                    {
+                        return content = WebResponseContent.Instance.Error($"淇敼澶辫触锛屾湭鎵惧埌瀵瑰簲鐨勫簱瀛樹俊鎭紝搴撳瓨缂栧彿锛歿pallid}");
+
+                    }
+                }
+                _unitOfWorkManage.BeginTran();
+                if (dtstockt.Count > 0)
+                {
+                    _stockService.StockInfoService.Repository.UpdateData(dtstockt);
+                }
+                _unitOfWorkManage.CommitTran();
+                content = WebResponseContent.Instance.OK($"淇敼鎴愬姛");
+                return content;
+            }
+            catch (Exception ex)
+            {
+                _unitOfWorkManage.RollbackTran();
+                return content = WebResponseContent.Instance.Error($"淇敼澶辫触锛屾姤閿欎俊鎭細{ex.Message}");
                 throw;
             }
         }
@@ -1062,10 +1227,33 @@
                     {
                         Dt_StockInfoDetail stocktdetail = _stockService.StockInfoDetailService.Repository.QueryFirst(x => x.StockId == stockt.Id);
                         Dt_LocationInfo locationinfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == stockt.LocationCode);
+                        Dt_Task_Hty task_Hty = new Dt_Task_Hty()
+                        {
+                            TaskNum = 001,
+                            PalletCode = stockt.PalletCode,
+                            Roadway = locationinfo.RoadwayNo,
+                            TaskType = (int)TaskTypeEnum.Outbound,
+                            TaskStatus = (int)OutTaskStatusEnum.OutFinish,
+                            SourceAddress = locationinfo.LocationCode,
+                            TargetAddress = locationinfo.LocationCode,
+                            CurrentAddress = locationinfo.LocationCode,
+                            NextAddress = locationinfo.LocationCode,
+                            Grade = 1,
+                            Dispatchertime = DateTime.Now,
+                            Creater = App.User.UserName,
+                        CreateDate = DateTime.Now,
+                            ModifyDate = DateTime.Now,
+                            Modifier = App.User.UserName,
+                            Remark = "浜哄伐鍑哄簱",
+                            PLCTo = 1,
+                            PalletCodequantity = 1,
+                            MaterialType = 1
+                        };
+                        _taskHtyService.AddData(task_Hty);
                         locationinfo.LocationStatus = LocationStatusEnum.Free.ObjToInt();
                         dtstockt.Add(stockt);
                         locations.Add(locationinfo);
-                        if (stockt.MaterialType == (int)InventoryMaterialType.绌烘墭)
+                        if (stockt.MaterialType != (int)InventoryMaterialType.绌烘墭)
                         {
                             dtstocktdetail.Add(stocktdetail);
                         }
@@ -1079,10 +1267,7 @@
                 }
                 _unitOfWorkManage.BeginTran();
                 _stockService.StockInfoService.Repository.DeleteData(dtstockt);
-                if(dtstocktdetail.Count==0)
-                {
-                    _stockService.StockInfoDetailService.Repository.DeleteData(dtstocktdetail);
-                }
+                _stockService.StockInfoDetailService.Repository.DeleteData(dtstocktdetail);
                 _basicService.LocationInfoService.Repository.UpdateData(locations);
                 _unitOfWorkManage.CommitTran();
                 content = WebResponseContent.Instance.OK();
@@ -1132,13 +1317,14 @@
                     BaseDal.DeleteData(task);
                     BaseDal.DeleteAndMoveIntoHty(task, OperateType.浜哄伐鍒犻櫎);
                     WriteLog.GetLog("浠诲姟鏃ュ織").Write($"鍑哄簱浠诲姟鍙栨秷鎴愬姛锛屾墭鐩樻潯鐮侊細{task.PalletCode}", $"浠诲姟鍙栨秷");
+                    WebResponseContent webResponseContent = HttpHelper.Post<WebResponseContent>(ReceiveWCSTask, task.TaskNum, "浠诲姟鍒犻櫎");
                     return content = WebResponseContent.Instance.Error($"鍑哄簱浠诲姟鍙栨秷鎴愬姛");
 
                 }
                 else if(task.TaskType == (int)TaskTypeEnum.Inbound || task.TaskType == (int)TaskTypeEnum.PalletInbound)
                 {
                     //澶勭悊鍑哄簱鐨勯�昏緫
-                    Dt_LocationInfo locationinfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.SourceAddress);
+                    Dt_LocationInfo locationinfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress);
                     if (locationinfo.LocationStatus == LocationStatusEnum.Lock.ObjToInt() || locationinfo.LocationStatus == LocationStatusEnum.PalletLock.ObjToInt())
                     {
                         locationinfo.LocationStatus = LocationStatusEnum.Free.ObjToInt();
@@ -1154,6 +1340,42 @@
                     BaseDal.DeleteData(task);
                     BaseDal.DeleteAndMoveIntoHty(task, OperateType.浜哄伐鍒犻櫎);
                     WriteLog.GetLog("浠诲姟鏃ュ織").Write($"鍏ュ簱浠诲姟鍙栨秷鎴愬姛锛屾墭鐩樻潯鐮侊細{task.PalletCode}", $"浠诲姟鍙栨秷");
+                    WebResponseContent webResponseContent = HttpHelper.Post<WebResponseContent>(ReceiveWCSTask, task.TaskNum, "浠诲姟鍒犻櫎");
+                    return content = WebResponseContent.Instance.Error($"鍏ュ簱浠诲姟鍙栨秷鎴愬姛");
+                }
+                else if (task.TaskType == (int)TaskTypeEnum.RelocationIn)    //搴撳唴绉诲簱
+                {
+                    //澶勭悊鍑哄簱鐨勯�昏緫
+                    Dt_LocationInfo locationinfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress);
+                    if (locationinfo.LocationStatus == LocationStatusEnum.Lock.ObjToInt() || locationinfo.LocationStatus == LocationStatusEnum.PalletLock.ObjToInt())
+                    {
+                        locationinfo.LocationStatus = LocationStatusEnum.Free.ObjToInt();
+                    }
+                    _basicService.LocationInfoService.Repository.UpdateData(locationinfo);
+
+                    Dt_LocationInfo locationinfo2 = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.SourceAddress);
+                    if (locationinfo2.LocationStatus == LocationStatusEnum.Lock.ObjToInt())
+                    {
+                        locationinfo2.LocationStatus = LocationStatusEnum.InStock.ObjToInt();
+                    }
+                    if (locationinfo2.LocationStatus == LocationStatusEnum.PalletLock.ObjToInt())
+                    {
+                        locationinfo2.LocationStatus = LocationStatusEnum.Pallet.ObjToInt();
+                    }
+                    _basicService.LocationInfoService.Repository.UpdateData(locationinfo2);
+                    Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.QueryFirst(x => x.PalletCode == task.PalletCode);
+                    stockInfo.StockStatus = (int)StockStatusEmun.宸插叆搴�;
+                    _stockService.StockInfoService.Repository.UpdateData(stockInfo);
+                    Dt_StockInfoDetail stocktdetail = _stockService.StockInfoDetailService.Repository.QueryFirst(x => x.StockId == stockInfo.Id);
+                    if (stocktdetail != null)
+                    {
+                        stocktdetail.Status = (int)StockStatusEmun.宸插叆搴�;
+                        _stockService.StockInfoDetailService.Repository.UpdateData(stocktdetail);
+                    }
+                    BaseDal.DeleteData(task);
+                    BaseDal.DeleteAndMoveIntoHty(task, OperateType.浜哄伐鍒犻櫎);
+                    WriteLog.GetLog("浠诲姟鏃ュ織").Write($"鍏ュ簱浠诲姟鍙栨秷鎴愬姛锛屾墭鐩樻潯鐮侊細{task.PalletCode}", $"浠诲姟鍙栨秷");
+                    WebResponseContent webResponseContent = HttpHelper.Post<WebResponseContent>(ReceiveWCSTask, task.TaskNum, "浠诲姟鍒犻櫎");
                     return content = WebResponseContent.Instance.Error($"鍏ュ簱浠诲姟鍙栨秷鎴愬姛");
                 }
                 else

--
Gitblit v1.9.3