From 1ad40156ec25db1b9d90c3f94819434e20d52b00 Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周五, 16 5月 2025 13:12:45 +0800 Subject: [PATCH] 222 --- PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/SharedService.cs | 21 +++++++++++++++++---- 1 files changed, 17 insertions(+), 4 deletions(-) diff --git a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/SharedService.cs b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/SharedService.cs index 8183c36..3a1e6b2 100644 --- a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/SharedService.cs +++ b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/SharedService.cs @@ -437,9 +437,9 @@ /// <param name="_serviceProvider">鏈嶅姟鎻愪緵鑰�</param> /// <returns>鎿嶄綔缁撴灉</returns> /// <exception cref="UserFriendlyException">褰撴暟鎹笉瀛樺湪鎴栫姸鎬佷笉鍏佽鍙枡鏃舵姏鍑�</exception> - public async Task<MesOrderResponse> CallMaterialByDataIdentifier(Guid id, IServiceProvider _serviceProvider) + public async Task<MesOrderResponse> CallMaterial(CallMaterialByDataIdentifierInput input, IServiceProvider _serviceProvider, MyCurrentUser myCurrentUser) { - if (string.IsNullOrEmpty(id.ToString())) + if (string.IsNullOrEmpty(input.Id.ToString())) { throw new UserFriendlyException("鍘熸枡鏍囪瘑涓嶈兘涓虹┖"); } @@ -451,7 +451,7 @@ // 鏌ユ壘鏁版嵁 - var callMaterialOrder = await callMaterialOrderRepository.GetAsync(id); + var callMaterialOrder = await callMaterialOrderRepository.GetAsync(input.Id); if (callMaterialOrder == null) { throw new UserFriendlyException($"鎵句笉鍒板彨鏂欒褰�"); @@ -463,7 +463,10 @@ throw new UserFriendlyException($"鍘熸枡鏍囪瘑涓� '{callMaterialOrder.DataIdentifier}' 鐨勫彨鏂欒褰曠姸鎬佷负 '{callMaterialOrder.CallMaterialStatus}'锛屼笉鍏佽鍙枡"); } + //TODO:杩欓噷璋冪敤wms鐨勫彨鏂欐帴鍙� + // 鏇存柊鏁版嵁 + callMaterialOrder.MaterialBatch = GenerateRandomBatch();//wms杩斿洖鐨勫師鏂欐壒娆� callMaterialOrder.WmsRetResult = "鎴愬姛"; callMaterialOrder.WmsTaskNo = GenerateRandomTaskNo(); callMaterialOrder.CallMaterialStatus = Domain.Shared.Enums.CallMaterialStatusEnum.鍙枡瀹屾垚; @@ -472,7 +475,7 @@ await callMaterialOrderRepository.UpdateAsync(callMaterialOrder); //鏇存柊浣滀笟璁″垝琛� - var workPlanList = await workPlanRepository.FindByDataIdentifierAsync(callMaterialOrder.DataIdentifier); + var workPlanList = await workPlanRepository.GetListByFilterAsync(x => x.DataIdentifier == callMaterialOrder.DataIdentifier); foreach (var item in workPlanList) { item.CallMaterialStatus = Domain.Shared.Enums.CallMaterialStatusEnum.鍙枡瀹屾垚; @@ -484,6 +487,7 @@ var callMaterialOrderRecord = new CallMaterialOrderRecord() { CallMaterialStatus = Domain.Shared.Enums.CallMaterialStatusEnum.鍙枡瀹屾垚, + MaterialBatch = callMaterialOrder.MaterialBatch, MaterialMode = callMaterialOrder.MaterialMode, DataIdentifier = callMaterialOrder.DataIdentifier, Quantity = 1, @@ -529,4 +533,13 @@ // 鐢熸垚鍓嶇紑 return $"WMS{timestamp}"; } + + private string GenerateRandomBatch() + { + // 鑾峰彇褰撳墠鏃堕棿鎴筹紙浠�1970-01-01 00:00:00 UTC鍒扮幇鍦ㄧ殑绉掓暟锛� + long timestamp = new DateTimeOffset(DateTime.UtcNow).ToUnixTimeSeconds(); + + // 鐢熸垚鍓嶇紑 + return $"Batch{timestamp}"; + } } -- Gitblit v1.9.3