From e2bb2738c6ddb1d013837924dc639b0f6f63662b Mon Sep 17 00:00:00 2001 From: 刘磊 <1161824510@qq.com> Date: 星期二, 24 十二月 2024 10:07:55 +0800 Subject: [PATCH] 同步 --- Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs | 94 ++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 88 insertions(+), 6 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..c940d53 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,9 +428,10 @@ if (boxing.ProcessCode == "OCV1") area = _areaInfoRepository.QueryFirst(x => x.AreaID == 6); - else if (boxing.ProcessCode == "OCVB") area = _areaInfoRepository.QueryFirst(x => x.AreaID == 7); + else + area = _areaInfoRepository.QueryFirst(x => x.AreaID == loation.AreaId); if (area == null) throw new Exception("鏈壘鍒板搴斿尯鍩熶俊鎭�"); @@ -454,7 +454,7 @@ Remark = boxing.BoxingInfoDetails.Count().ToString(), }; - if (boxing.ProcessCode != "OCVB") + if (boxing.ProcessCode != "OCVB" && !task.Roadway.Contains("FR")) { // 澶勭悊璇锋眰鍙傛暟 AgingInputDto agingInputDto = new AgingInputDto() @@ -1323,9 +1323,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