From a8756c3526832332db4ef5685348d9b188c2bf2b Mon Sep 17 00:00:00 2001 From: wangxinhui <wangxinhui@hnkhzn.com> Date: 星期六, 13 九月 2025 08:36:44 +0800 Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/MeiRuiAn/HuaiAn --- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 72 ++++++++++++++++++++++++----------- 1 files changed, 49 insertions(+), 23 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" index f671669..8b82537 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" @@ -139,29 +139,6 @@ return WebResponseContent.Instance.Error(ex.Message); } } - /// <summary> - /// 鏀捐揣瀹屾垚 - /// </summary> - /// <param name="code"></param> - /// <returns></returns> - public WebResponseContent PutFinish(string code, string barCode = "", string taskNum = "") - { - try - { - string url = AppSettings.Get("WCS"); - if (string.IsNullOrEmpty(url)) - { - return WebResponseContent.Instance.Error($"鏈壘鍒癢CSAApi鍦板潃,璇锋鏌ラ厤缃枃浠�"); - } - string response = HttpHelper.Post($"{url}/api/CTU_AGV/PutFinish?code={code}&barCode={barCode}&taskNum={taskNum}" ); - - return JsonConvert.DeserializeObject<WebResponseContent>(response) ?? WebResponseContent.Instance.Error("杩斿洖閿欒"); - } - catch (Exception ex) - { - return WebResponseContent.Instance.Error(ex.Message); - } - } public WebResponseContent AGVTasks(SaveModel saveModel) { @@ -213,6 +190,7 @@ PalletType = stockInfo.PalletType, MaterielCode = stockInfo.Details.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.MaterielCode, Quantity = (float)stockInfo.Details.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.StockQuantity, + BatchNo = stockInfo.Details.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.BatchNo }; _unitOfWorkManage.BeginTran(); BaseDal.AddData(newTask); @@ -1177,5 +1155,53 @@ } return content; } + + public WebResponseContent InboundTaskHandCancel(int taskNum, int warehouseId) + { + try + { + Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum); + if (task == null) + { + return WebResponseContent.Instance.Error($"鏈壘鍒拌浠诲姟淇℃伅"); + } + Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == task.PalletCode && x.WarehouseId == task.WarehouseId).Includes(x => x.Details).First(); + if (stockInfo == null) + { + return WebResponseContent.Instance.Error($"鏈壘鍒版墭鐩樺搴旂殑缁勭洏淇℃伅"); + } + if (stockInfo.Details.Count == 0 && stockInfo.PalletType != PalletTypeEnum.Empty.ObjToInt()) + { + return WebResponseContent.Instance.Error($"鏈壘鍒拌鎵樼洏搴撳瓨鏄庣粏淇℃伅"); + } + if (task.TaskType == TaskTypeEnum.MesPalletLargeReturn.ObjToInt() || task.TaskType == TaskTypeEnum.MesPalletSmallReturn.ObjToInt()) + { + task.TaskStatus = TaskStatusEnum.Cancel.ObjToInt(); + _unitOfWorkManage.BeginTran(); + BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId > 0 ? OperateTypeEnum.浜哄伐鍒犻櫎 : OperateTypeEnum.鑷姩鍒犻櫎); + _stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(stockInfo, App.User.UserId == 0 ? OperateTypeEnum.鑷姩鍒犻櫎 : OperateTypeEnum.浜哄伐鍒犻櫎); + _stockService.StockInfoDetailService.Repository.DeleteAndMoveIntoHty(stockInfo.Details, App.User.UserId == 0 ? OperateTypeEnum.鑷姩鍒犻櫎 : OperateTypeEnum.浜哄伐鍒犻櫎); + _unitOfWorkManage.CommitTran(); + return WebResponseContent.Instance.OK(); + } + Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress); + if (locationInfo != null) + { + if (locationInfo.LocationStatus == LocationStatusEnum.InStock.ObjToInt()) + { + return WebResponseContent.Instance.Error($"璐т綅鐘舵�佷笉姝g‘"); + } + + LocationStatusEnum lastStatus = (LocationStatusEnum)locationInfo.LocationStatus; + locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt(); + } + return WebResponseContent.Instance.OK(); + + } + catch(Exception ex) + { + return WebResponseContent.Instance.Error(ex.Message); + } + } } } -- Gitblit v1.9.3