From c6e8b600398de38b6684f5fa1eaaaade8562859b Mon Sep 17 00:00:00 2001 From: wangxinhui <wangxinhui@hnkhzn.com> Date: 星期六, 20 九月 2025 15:16:56 +0800 Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/ZhiHuiQiCe/LongDeLiLiKu --- 项目代码/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Reloaction.cs | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 112 insertions(+), 3 deletions(-) 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 cbdf94b..ac1e206 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" @@ -1,15 +1,19 @@ -锘縰sing System; +锘縰sing OfficeOpenXml.FormulaParsing.Excel.Functions.Math; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using WIDESEA_Common.CommonEnum; using WIDESEA_Common.LocationEnum; +using WIDESEA_Common.MaterielEnum; using WIDESEA_Common.OtherEnum; using WIDESEA_Common.StockEnum; using WIDESEA_Common.TaskEnum; +using WIDESEA_Common.WareHouseEnum; using WIDESEA_Core; using WIDESEA_Core.Helper; +using WIDESEA_DTO.Basic; using WIDESEA_DTO.Task; using WIDESEA_Model.Models; @@ -41,7 +45,7 @@ List<Dt_LocationInfo> littleDepthLocations = _basicService.LocationInfoService.GetGroupLocations(locationInfo); - Dt_LocationInfo? needRelocationItem = littleDepthLocations.Where(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && x.LocationStatus != LocationStatusEnum.PalletLock.ObjToInt() && x.LocationStatus != LocationStatusEnum.FreeLock.ObjToInt() && x.Depth < locationInfo.Depth).OrderBy(x => x.Depth).FirstOrDefault(); + Dt_LocationInfo? needRelocationItem = littleDepthLocations.Where(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && x.LocationStatus != LocationStatusEnum.FreeLock.ObjToInt() && x.Depth < locationInfo.Depth).OrderBy(x => x.Depth).FirstOrDefault(); if (needRelocationItem == null) { @@ -126,7 +130,6 @@ return WebResponseContent.Instance.Error(ex.Message); } } - public WebResponseContent RelocationTaskCompleted(Dt_Task task) { try @@ -166,5 +169,111 @@ return WebResponseContent.Instance.Error(ex.Message); } } + public WebResponseContent IsRelocation(string startAddress,string endAddress,string roadWay) + { + WebResponseContent content = new WebResponseContent(); + try + { + //鑾峰彇璐т綅 + 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 && 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() + { + Roadway = roadWay, + WarehouseId = stockInfo.WarehouseId, + CurrentAddress = startLocationInfo.LocationCode, + Grade = 99, + NextAddress = endLocationInfo.LocationCode, + OrderNo = "", + PalletCode = stockInfo.PalletCode, + PalletType = stockInfo.PalletType, + SourceAddress = startLocationInfo.LocationCode, + TargetAddress = endLocationInfo.LocationCode, + TaskNum = Repository.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), + TaskStatus = TaskStatusEnum.SC_Execute.ObjToInt(), + TaskType = TaskTypeEnum.Relocation.ObjToInt() + }; + stockInfo.StockStatus = StockStatusEmun.绉诲簱閿佸畾.ObjToInt(); + _unitOfWorkManage.BeginTran(); + Repository.AddData(newTask); + _basicService.LocationInfoService.UpdateLocationStatus(startLocationInfo, stockInfo.PalletType, LocationStatusEnum.Lock, stockInfo.WarehouseId); + _basicService.LocationInfoService.UpdateLocationStatus(endLocationInfo, stockInfo.PalletType, LocationStatusEnum.Lock, stockInfo.WarehouseId); + _stockService.StockInfoService.Repository.UpdateData(stockInfo); + _unitOfWorkManage.CommitTran(); + PushTasksToWCS(new List<Dt_Task> { newTask }); + content.OK("鎴愬姛"); + } + else + { + content.Error("搴撳瓨璐т綅淇℃伅涓虹┖"); + } + } + catch (Exception ex) + { + _unitOfWorkManage.RollbackTran(); + content.Error(ex.Message); + } + return content; + } + /// <summary> + /// 鍘熸枡宸烽亾闂寸Щ搴撲换鍔� todo:涓存椂 + /// </summary> + public WebResponseContent RelocationRoadWay(string roadWay, int Count) + { + WebResponseContent content = new WebResponseContent(); + try + { + //鑾峰彇瀵瑰簲搴撳瓨 + List<Dt_StockInfo> stockInfos = _stockRepository.StockInfoRepository.QueryData(x => x.MaterielWide <2200 && x.StockStatus == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt()).OrderBy(x => x.CreateDate).Take(Count).ToList(); + + //鑾峰彇璐т綅 + List<Dt_LocationInfo> locationInfos = _basicRepository.LocationInfoRepository.QueryData(x => stockInfos.Select(x => x.LocationCode).Contains(x.LocationCode)); + foreach (var item in stockInfos) + { + Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.LocationCode == item.LocationCode); + if (locationInfo != null && (locationInfo.EnableStatus == EnableStatusEnum.OnlyOut.ObjToInt() || locationInfo.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && locationInfo.LocationStatus == LocationStatusEnum.InStock.ObjToInt()) + { + item.StockStatus = StockStatusEmun.鍑哄簱閿佸畾.ObjToInt(); + } + else + { + return content.Error($"璐т綅鐘舵�佷笉姝g‘"); + } + } + + List<Dt_Task> tasks = GetTasks(stockInfos, TaskTypeEnum.OutPick); + if (tasks == null || tasks.Count <= 0) + { + return content.Error($"鐢熸垚浠诲姟澶辫触"); + } + tasks.ForEach(x => + { + x.TargetAddress = roadWay; + }); + //鍒ゆ柇鏄惁鏈夊嚭搴撳崟淇℃伅 + _unitOfWorkManage.BeginTran(); + //鏇存柊搴撳瓨鐘舵�� + _stockRepository.StockInfoRepository.UpdateData(stockInfos); + //鏇存柊璐т綅鐘舵�� + _basicRepository.LocationInfoRepository.UpdateLocationStatus(locationInfos, LocationStatusEnum.Lock); + //鍔犲叆璐т綅鍙樺姩璁板綍 + _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfos, LocationStatusEnum.Lock, LocationChangeType.OutboundAssignLocation, taskNums: tasks.Select(x => x.TaskNum).ToList()); + //鏂板缓浠诲姟 + BaseDal.AddData(tasks); + _unitOfWorkManage.CommitTran(); + PushTasksToWCS(tasks); + content.OK(); + } + catch (Exception ex) + { + content.Error(ex.Message); + } + return content; + } } } -- Gitblit v1.9.3