From 87ce8f1a70dfbf819e6804a26ab8e845a134856c Mon Sep 17 00:00:00 2001 From: huangxiaoqiang <1247017146@qq.com> Date: 星期四, 05 六月 2025 10:16:58 +0800 Subject: [PATCH] 批量删除任务 --- Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs | 78 ++++++++++++++++++++++++++------------- 1 files changed, 52 insertions(+), 26 deletions(-) diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs index 857e86e..5f638a5 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs @@ -636,6 +636,7 @@ case (int)TaskOutboundTypeEnum.OutTray: case (int)TaskOutboundTypeEnum.Outbound: case (int)TaskOutboundTypeEnum.OutNG: + case (int)TaskOutboundTypeEnum.OutQuality: LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鍑哄簱浠诲姟", ""); return await CompleteStackTaskAsync(task, stock); @@ -905,21 +906,44 @@ // 鑾峰彇缁勭洏淇℃伅 private DtBoxingInfo CreateBoxingInfo(ResultTrayCellsStatus result, string palletCode) { - return new DtBoxingInfo + var boxing=_boxingInfoRepository.QueryFirst(x=>x.PalletCode== palletCode); + if (boxing == null) { - PalletCode = palletCode, - IsFull = true, - ProcessCode = result.ProcessCode, - ProductionLine = result.ProductionLine, - BoxingInfoDetails = result.SerialNos.Select(serialNoObj => new DtBoxingInfoDetail + return new DtBoxingInfo { - SerialNumber = serialNoObj.SerialNo, - OrderNo = serialNoObj.PositionNo.ToString(), - Status = serialNoObj.SerialNoStatus, - MaterielCode = result.BindCode, - Remark = result.TrayBarcodePropertys.ToJsonString(), - }).ToList() - }; + PalletCode = palletCode, + IsFull = true, + ProcessCode = result.ProcessCode, + ProductionLine = result.ProductionLine, + BoxingInfoDetails = result.SerialNos.Select(serialNoObj => new DtBoxingInfoDetail + { + SerialNumber = serialNoObj.SerialNo, + OrderNo = serialNoObj.PositionNo.ToString(), + Status = serialNoObj.SerialNoStatus, + MaterielCode = result.BindCode, + Remark = result.TrayBarcodePropertys.ToJsonString(), + }).ToList() + }; + } + else + { + _boxingInfoRepository.DeleteData(boxing); + return new DtBoxingInfo + { + PalletCode = palletCode, + IsFull = true, + ProcessCode = result.ProcessCode, + ProductionLine = result.ProductionLine, + BoxingInfoDetails = result.SerialNos.Select(serialNoObj => new DtBoxingInfoDetail + { + SerialNumber = serialNoObj.SerialNo, + OrderNo = serialNoObj.PositionNo.ToString(), + Status = serialNoObj.SerialNoStatus, + MaterielCode = result.BindCode, + Remark = result.TrayBarcodePropertys.ToJsonString(), + }).ToList() + }; + } } // 鑾峰彇宸ヨ壓鐢宠 @@ -1716,21 +1740,23 @@ // 鍒涘缓鍘嗗彶浠诲姟瀹炰緥妯″瀷 try { - Dt_Task task = BaseDal.QueryFirst(x => x.TaskId == Convert.ToInt32(key[0])); - if (task == null) + foreach (object item in key) { - return content.Error("鏈壘鍒颁换鍔′俊鎭�!"); + Dt_Task task = BaseDal.QueryFirst(x => x.TaskId == Convert.ToInt32(key)); + if (task == null) + { + return content.Error("鏈壘鍒颁换鍔′俊鎭�!"); + } + var taskHtyNG = CreateHistoricalTask(task, true); + + // 鎵ц鏁版嵁搴撲簨鍔� + + // 娣诲姞鍘嗗彶浠诲姟 + var isTaskHtyAdd = _task_HtyRepository.AddData(taskHtyNG) > 0; + + // 鍒犻櫎浠诲姟鏁版嵁 + var isTaskDelete = BaseDal.Delete(task.TaskId); } - var taskHtyNG = CreateHistoricalTask(task, true); - - // 鎵ц鏁版嵁搴撲簨鍔� - - // 娣诲姞鍘嗗彶浠诲姟 - var isTaskHtyAdd = _task_HtyRepository.AddData(taskHtyNG) > 0; - - // 鍒犻櫎浠诲姟鏁版嵁 - var isTaskDelete = BaseDal.Delete(task.TaskId); - return content.OK("鍒犻櫎鎴愬姛!"); } catch (Exception ex) -- Gitblit v1.9.3