From 557058f03533e730f5379e311f492f471244969a Mon Sep 17 00:00:00 2001 From: 肖洋 <cathay_xy@163.com> Date: 星期六, 21 十二月 2024 11:00:03 +0800 Subject: [PATCH] 更新.gitignore以排除SemanticSymbols.db文件,新增MemoryLockManager类以管理任务锁,优化Dt_TaskService中的入库任务创建逻辑 --- Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs | 90 ++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 85 insertions(+), 5 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 bf8748c..000de4c 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 @@ -1,5 +1,4 @@ -锘縰sing AngleSharp.Io; -using Mapster; +锘縰sing Mapster; using Masuit.Tools; using System.Text.RegularExpressions; using WIDESEA_Core.Const; @@ -429,7 +428,6 @@ if (boxing.ProcessCode == "OCV1") area = _areaInfoRepository.QueryFirst(x => x.AreaID == 6); - else if (boxing.ProcessCode == "OCVB") area = _areaInfoRepository.QueryFirst(x => x.AreaID == 7); @@ -1323,9 +1321,91 @@ #endregion 鎸囧畾浠诲姟鍑哄簱 - #region 闈欑疆寮傚父鍙e叆搴� + #region 闈欑疆寮傚父鍙e叆搴� - #endregion + public async Task<WebResponseContent> CreateAndSendInboundTask(string locationCode, string palletCode, string position) + { + WebResponseContent content = new WebResponseContent(); + try + { + // 鏌ヨ搴撳瓨淇℃伅 + var stockInfo = await _stockInfoRepository.QueryFirstNavAsync(x => x.PalletCode == palletCode); + if (stockInfo == null) + { + var area = _areaInfoRepository.QueryFirst(x => x.AreaID == 2); + var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == position); + TrayCellsStatusDto trayCells = CreateTrayCellsStatusDto(area, palletCode); + content = await GetTrayCellStatusAsync(trayCells); + if (!content.Status) return content; + + var result = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(content.Data.ToString()); + if (!result.Success) + { + if (result.SerialNos.Count <= 0) + { + var location = await GetLocationDistributeAsync(station.Roadway); + // 鍒涘缓鏂颁换鍔″疄渚� + var task = new Dt_Task + { + CurrentAddress = locationCode, + Grade = 1, + Roadway = station.Roadway, + TargetAddress = location.LocationCode, + Dispatchertime = DateTime.Now, + MaterialNo = "", + NextAddress = location.LocationCode, + OrderNo = null, + PalletCode = palletCode, + SourceAddress = locationCode, + TaskState = (int)TaskInStatusEnum.Line_InFinish, + TaskType = (int)TaskInboundTypeEnum.Inbound, + TaskNum = await BaseDal.GetTaskNo(), + Creater = "Systeam" + }; + + // 鍒涘缓WMS浠诲姟 + WMSTaskDTO taskDTO = new WMSTaskDTO() + { + TaskNum = task.TaskNum.Value, + Grade = 1, + PalletCode = task.PalletCode, + RoadWay = task.Roadway, + SourceAddress = task.SourceAddress, + TargetAddress = task.Roadway, + TaskState = task.TaskState.Value, + Id = 0, + TaskType = task.TaskType, + }; + + await _unitOfWorkManage.UseTranAsync(async () => + { + // 娣诲姞浠诲姟鍒版暟鎹簱 + await BaseDal.AddDataAsync(task); + // 鏇存柊搴撳瓨浣嶇疆鐘舵�佷负涓嶅彲鐢� + location.LocationStatus = (int)LocationEnum.InStockDisable; + await _locationRepository.UpdateDataAsync(location); + }); + + content.OK(data: taskDTO); + } + else + content.Error(result.MOMMessage); + } + } + else + { + // TODO璐ㄦ鍥炲簱 + var area = _areaInfoRepository.QueryFirst(x => x.AreaID == 2); + } + } + catch (Exception ex) + { + content.Error(ex.Message); + } + return content; + } + + #endregion 闈欑疆寮傚父鍙e叆搴� #endregion 澶栭儴鎺ュ彛鏂规硶 -- Gitblit v1.9.3