From e7cf443b37f8f4d8a1bc4fe4cd6f058f39e5c7f5 Mon Sep 17 00:00:00 2001 From: hutongqing <hutongqing@hnkhzn.com> Date: 星期六, 14 十二月 2024 01:15:03 +0800 Subject: [PATCH] 更新 --- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockViewService.cs | 0 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/MaterielInfoController.cs | 23 ++ 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Outbound/Dt_OutboundLockInfo.cs | 12 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutStockLockInfoService.cs | 33 +++ 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoDetailService.cs | 6 代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/4cc8f357-fc0c-4940-a3b6-b8853a50c180.vsidx | 0 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs | 39 +++ 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfo_HtyService.cs | 0 代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/341739e1-48c0-452c-a5ea-3c213effa27e.vsidx | 0 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_RecordService/Service/LocationStatusChangeRecordService.cs | 2 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs | 20 + 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IBasicRepository/ILocationInfoRepository.cs | 2 /dev/null | 28 -- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundOrderDetailService.cs | 49 ++++ 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IRecordService/ILocationStatusChangeRecordService.cs | 2 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/CodeAnalysisHelper.cs | 2 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs | 343 ++++++++++++++++++++++++++++++++++ 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Common/StockEnum/StockChangeTypeEnum.cs | 6 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IStockInfoService.cs | 4 代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/ea02e79b-60fd-46cb-830c-ee3a3c992700.vsidx | 0 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicRepository/LocationInfoRepository.cs | 13 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoDetail_HtyService.cs | 0 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Stock/StockSelectViewDTO.cs | 8 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutStockLockInfoService.cs | 4 24 files changed, 546 insertions(+), 50 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/341739e1-48c0-452c-a5ea-3c213effa27e.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/341739e1-48c0-452c-a5ea-3c213effa27e.vsidx" new file mode 100644 index 0000000..b775839 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/341739e1-48c0-452c-a5ea-3c213effa27e.vsidx" Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/412af394-9dac-4306-95f6-39fd60896df6.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/412af394-9dac-4306-95f6-39fd60896df6.vsidx" deleted file mode 100644 index d93638a..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/412af394-9dac-4306-95f6-39fd60896df6.vsidx" +++ /dev/null Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/4cc8f357-fc0c-4940-a3b6-b8853a50c180.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/4cc8f357-fc0c-4940-a3b6-b8853a50c180.vsidx" new file mode 100644 index 0000000..22b1e74 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/4cc8f357-fc0c-4940-a3b6-b8853a50c180.vsidx" Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/ce72d7b5-21c0-485a-b3a5-52df88bd7a47.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/ce72d7b5-21c0-485a-b3a5-52df88bd7a47.vsidx" deleted file mode 100644 index ff19bd8..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/ce72d7b5-21c0-485a-b3a5-52df88bd7a47.vsidx" +++ /dev/null Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/ea02e79b-60fd-46cb-830c-ee3a3c992700.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/ea02e79b-60fd-46cb-830c-ee3a3c992700.vsidx" new file mode 100644 index 0000000..0698fa9 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/ea02e79b-60fd-46cb-830c-ee3a3c992700.vsidx" Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/edabd823-9c10-4009-8e95-cb1d3217eb83.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/edabd823-9c10-4009-8e95-cb1d3217eb83.vsidx" deleted file mode 100644 index 574d1c2..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/edabd823-9c10-4009-8e95-cb1d3217eb83.vsidx" +++ /dev/null Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicRepository/LocationInfoRepository.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicRepository/LocationInfoRepository.cs" index d7e8f20..28c4bb4 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicRepository/LocationInfoRepository.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicRepository/LocationInfoRepository.cs" @@ -29,10 +29,10 @@ public List<LocationGroupDTO> GetLocationGroups(string roadway, LocationStatusEnum locationAStatus, LocationStatusEnum locationBStatus) { return QueryTabs<Dt_LocationInfo, Dt_LocationInfo, LocationGroupDTO>( - (a, b) => a.Column == b.Column && a.Layer == b.Layer && a.Row != b.Row && SqlFunc.Abs(a.Row - b.Row) == 1, - (a, b) => new LocationGroupDTO { DepthA = a.Depth, DepthB = b.Depth, EnableStatusA = a.EnableStatus, EnableStatusB = b.EnableStatus, IdA = a.Id, IdB = b.Id, LocationCodeA = a.LocationCode, LocationCodeB = b.LocationCode, LocationStatusA = a.LocationStatus, LocationStatusB = b.LocationStatus, LocationTypeA = a.LocationType, LocationTypeB = b.LocationType }, - a => a.Depth == 1 && a.RoadwayNo == roadway && a.LocationStatus == locationAStatus.ObjToInt(), - b => b.Depth == 2 && b.RoadwayNo == roadway && b.LocationStatus == locationBStatus.ObjToInt(), + (a, b) => a.Column == b.Column && a.Layer == b.Layer && a.Row != b.Row && SqlFunc.Abs(a.Row - b.Row) == 1, + (a, b) => new LocationGroupDTO { DepthA = a.Depth, DepthB = b.Depth, EnableStatusA = a.EnableStatus, EnableStatusB = b.EnableStatus, IdA = a.Id, IdB = b.Id, LocationCodeA = a.LocationCode, LocationCodeB = b.LocationCode, LocationStatusA = a.LocationStatus, LocationStatusB = b.LocationStatus, LocationTypeA = a.LocationType, LocationTypeB = b.LocationType }, + a => a.Depth == 1 && a.RoadwayNo == roadway && a.LocationStatus == locationAStatus.ObjToInt(), + b => b.Depth == 2 && b.RoadwayNo == roadway && b.LocationStatus == locationBStatus.ObjToInt(), x => true); } @@ -54,5 +54,10 @@ }); UpdateData(locationInfos); } + + public List<string> GetCanOutLocationCodes(int warehouseId) + { + return QueryData(x => x.LocationCode, x => x.WarehouseId == warehouseId && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyOut.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt())).Distinct().ToList(); + } } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Common/StockEnum/StockChangeTypeEnum.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Common/StockEnum/StockChangeTypeEnum.cs" index 30fbfca..63631fe 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Common/StockEnum/StockChangeTypeEnum.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Common/StockEnum/StockChangeTypeEnum.cs" @@ -31,5 +31,11 @@ /// </summary> [Description("绉诲簱")] Relocation, + + /// <summary> + /// 鍑哄簱閿佸畾 + /// </summary> + [Description("鍑哄簱閿佸畾")] + StockLock } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/CodeAnalysisHelper.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/CodeAnalysisHelper.cs" index 3150e8c..dd90e9b 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/CodeAnalysisHelper.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/CodeAnalysisHelper.cs" @@ -99,7 +99,7 @@ } catch (Exception ex) { - + throw new Exception($"瑙f瀽閿欒,{ex.Message}"); } (bool, string, object?) validateResult = ModelValidate.ValidateModelData(result, type); diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Stock/StockSelectViewDTO.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Stock/StockSelectViewDTO.cs" index 0a6e5bc..d90115b 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Stock/StockSelectViewDTO.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Stock/StockSelectViewDTO.cs" @@ -9,14 +9,14 @@ public class StockSelectViewDTO { - public string MaterielCode { get; set; } + public string MaterielCode { get; set; } public string MaterielName { get; set; } - public decimal UseableQuantity { get; set; } + public float UseableQuantity { get; set; } - public string PalletCode { get; set; } + public string PalletCode { get; set; } - public string LocationCode { get; set; } + public string LocationCode { get; set; } } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IBasicRepository/ILocationInfoRepository.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IBasicRepository/ILocationInfoRepository.cs" index a5154b4..85c9a04 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IBasicRepository/ILocationInfoRepository.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IBasicRepository/ILocationInfoRepository.cs" @@ -42,5 +42,7 @@ /// <param name="locationInfos">璐т綅瀹炰綋闆嗗悎</param> /// <param name="locationStatus">璐т綅鐘舵��</param> void UpdateLocationStatus(List<Dt_LocationInfo> locationInfos, LocationStatusEnum locationStatus); + + List<string> GetCanOutLocationCodes(int warehouseId); } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutStockLockInfoService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutStockLockInfoService.cs" index 6bdb926..f8d11f6 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutStockLockInfoService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutStockLockInfoService.cs" @@ -14,5 +14,9 @@ public interface IOutStockLockInfoService : IService<Dt_OutStockLockInfo> { IOutStockLockInfoRepository Repository { get; } + + List<Dt_OutStockLockInfo> GetOutStockLockInfos(Dt_OutboundOrder outboundOrder, Dt_OutboundOrderDetail outboundOrderDetail, List<Dt_StockInfo> outStocks, int? taskNum = null); + + List<Dt_OutStockLockInfo> GetByOrderDetailId(int orderDetailId, OutLockStockStatusEnum outStockStatus); } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundOrderDetailService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundOrderDetailService.cs" index 83d6edd..5a8c324 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundOrderDetailService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundOrderDetailService.cs" @@ -4,6 +4,7 @@ using System.Reflection; using System.Text; using System.Threading.Tasks; +using WIDESEA_Common.LocationEnum; using WIDESEA_Core; using WIDESEA_Core.BaseServices; using WIDESEA_Core.Enums; @@ -17,5 +18,53 @@ { IOutboundOrderDetailRepository Repository { get; } + /// <summary> + /// 閿佸畾鍑哄簱搴撳瓨 + /// </summary> + /// <param name="orderDetailId">鍑哄簱鍗曟槑缁咺d</param> + /// <returns></returns> + WebResponseContent LockOutboundStock(int orderDetailId); + + /// <summary> + /// 鍒嗛厤搴撳瓨鍑哄簱閫昏緫 + /// </summary> + /// <param name="outboundOrderDetail">鍑哄簱鍗曟槑缁�</param> + /// <param name="stockSelectViews">浜哄伐閫夋嫨鐨勫簱瀛�</param> + /// <returns></returns> + (List<Dt_StockInfo>, Dt_OutboundOrderDetail, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) AssignStockOutbound(Dt_OutboundOrderDetail outboundOrderDetail, List<StockSelectViewDTO> stockSelectViews); + + /// <summary> + /// 閿佸畾鍑哄簱搴撳瓨 + /// </summary> + /// <param name="orderDetailId">鍑哄簱鍗曟槑缁咺d</param> + /// <param name="stockSelectViews">浜哄伐閫夋嫨鐨勫簱瀛�</param> + /// <returns></returns> + WebResponseContent LockOutboundStock(int orderDetailId, List<StockSelectViewDTO> stockSelectViews); + + /// <summary> + /// 閿佸畾鍑哄簱搴撳瓨(澶氭槑缁�) + /// </summary> + /// <param name="keys"></param> + /// <returns></returns> + WebResponseContent LockOutboundStock(int[] keys); + + /// <summary> + /// 閿佸畾鍑哄簱搴撳瓨(淇敼鏁版嵁) + /// </summary> + /// <param name="stockInfos">搴撳瓨鏄庣粏闆嗗悎</param> + /// <param name="outboundOrderDetails">鍑哄簱鍗曟槑缁嗛泦鍚�</param> + /// <param name="outStockLockInfos">鍑哄簱閿佸畾鏄庣粏闆嗗悎</param> + /// <param name="locationInfos">璐т綅缁撳悎</param> + /// <param name="locationStatus">璐т綅鐘舵�佷慨鏀圭殑鍊�</param> + /// <param name="tasks">浠诲姟淇℃伅</param> + /// <returns></returns> + WebResponseContent LockOutboundStockDataUpdate(List<Dt_StockInfo> stockInfos, List<Dt_OutboundOrderDetail> outboundOrderDetails, List<Dt_OutStockLockInfo> outStockLockInfos, List<Dt_LocationInfo> locationInfos, LocationStatusEnum locationStatus = LocationStatusEnum.Lock, List<Dt_Task>? tasks = null); + + /// <summary> + /// 鎾ら攢閿佸畾鍑哄簱搴撳瓨 + /// </summary> + /// <param name="orderDetailId">鍑哄簱鍗曟槑缁嗕富閿�</param> + /// <returns></returns> + WebResponseContent RevokeLockOutboundStock(int orderDetailId); } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IRecordService/ILocationStatusChangeRecordService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IRecordService/ILocationStatusChangeRecordService.cs" index 4499a31..651618f 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IRecordService/ILocationStatusChangeRecordService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IRecordService/ILocationStatusChangeRecordService.cs" @@ -17,7 +17,7 @@ void AddLocationStatusChangeRecord(Dt_LocationInfo locationInfo, LocationStatusEnum lastStatus, LocationChangeType changeType, string? orderNo = null, int? taskNum = null); - void AddLocationStatusChangeRecord(List<Dt_LocationInfo> locationInfos, LocationStatusEnum newStatus, LocationChangeType changeType, string? orderNo, List<int>? taskNums); + void AddLocationStatusChangeRecord(List<Dt_LocationInfo> locationInfos, LocationStatusEnum newStatus, LocationChangeType changeType, string? orderNo = null, List<int>? taskNums = null); WebResponseContent GetLocationState(int id); } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IStockInfoService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IStockInfoService.cs" index 378bea7..5ec7435 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IStockInfoService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IStockInfoService.cs" @@ -13,5 +13,9 @@ public interface IStockInfoService : IService<Dt_StockInfo> { IStockInfoRepository Repository { get; } + + List<Dt_StockInfo> GetOutboundStocks(List<Dt_StockInfo> stockInfos, string materielCode, float needQuantity, out float residueQuantity); + + List<Dt_StockInfo> GetUseableStocks(string materielCode, int warehoseId); } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Outbound/Dt_OutboundLockInfo.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Outbound/Dt_OutboundLockInfo.cs" index 388cb33..9009559 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Outbound/Dt_OutboundLockInfo.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Outbound/Dt_OutboundLockInfo.cs" @@ -36,14 +36,14 @@ [SugarColumn(IsNullable = false, ColumnDescription = "搴撳瓨涓婚敭")] public int StockId { get; set; } - [SugarColumn(IsNullable = false, DecimalDigits = 2, ColumnDescription = "鍗曟嵁鏁伴噺")] - public decimal OrderQuantity { get; set; } + [SugarColumn(IsNullable = false, ColumnDescription = "鍗曟嵁鏁伴噺")] + public float OrderQuantity { get; set; } - [SugarColumn(IsNullable = false, DecimalDigits = 2, ColumnDescription = "鍘熷搴撳瓨閲�")] - public decimal OriginalQuantity { get; set; } + [SugarColumn(IsNullable = false, ColumnDescription = "鍘熷搴撳瓨閲�")] + public float OriginalQuantity { get; set; } - [SugarColumn(IsNullable = false, DecimalDigits = 2, ColumnDescription = "鍒嗛厤鍑哄簱閲�")] - public decimal AssignQuantity { get; set; } + [SugarColumn(IsNullable = false, ColumnDescription = "鍒嗛厤鍑哄簱閲�")] + public float AssignQuantity { get; set; } [SugarColumn(IsNullable = true, Length = 20, ColumnDescription = "璐т綅缂栧彿")] public string LocationCode { get; set; } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutStockLockInfoService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutStockLockInfoService.cs" index 2c0c087..4c9edb1 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutStockLockInfoService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutStockLockInfoService.cs" @@ -19,5 +19,38 @@ public OutStockLockInfoService(IOutStockLockInfoRepository BaseDal) : base(BaseDal) { } + + public List<Dt_OutStockLockInfo> GetOutStockLockInfos(Dt_OutboundOrder outboundOrder, Dt_OutboundOrderDetail outboundOrderDetail, List<Dt_StockInfo> outStocks, int? taskNum = null) + { + List<Dt_OutStockLockInfo> outStockLockInfos = new List<Dt_OutStockLockInfo>(); + + foreach (var item in outStocks) + { + Dt_OutStockLockInfo outStockLockInfo = new Dt_OutStockLockInfo() + { + PalletCode = item.PalletCode, + AssignQuantity = item.Details.Where(x => x.MaterielCode == outboundOrderDetail.MaterielCode).Sum(x => x.OutboundQuantity), + MaterielCode = outboundOrderDetail.MaterielCode, + BatchNo = outboundOrderDetail.BatchNo, + LocationCode = item.LocationCode, + MaterielName = outboundOrderDetail.MaterielName, + OrderDetailId = outboundOrderDetail.Id, + OrderNo = outboundOrder.OrderNo, + OrderType = outboundOrder.OrderType, + OriginalQuantity = item.Details.Where(x => x.MaterielCode == outboundOrderDetail.MaterielCode).Sum(x => x.StockQuantity), + Status = taskNum == null ? OutLockStockStatusEnum.宸插垎閰�.ObjToInt() : OutLockStockStatusEnum.鍑哄簱涓�.ObjToInt(), + StockId = item.Id, + TaskNum = taskNum + }; + outStockLockInfos.Add(outStockLockInfo); + } + + return outStockLockInfos; + } + + public List<Dt_OutStockLockInfo> GetByOrderDetailId(int orderDetailId, OutLockStockStatusEnum outStockStatus) + { + return BaseDal.QueryData(x => x.OrderDetailId == orderDetailId && x.Status == outStockStatus.ObjToInt()); + } } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs" index e7babd1..60c1462 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs" @@ -5,6 +5,9 @@ using System.Reflection; using System.Text; using System.Threading.Tasks; +using WIDESEA_Common.LocationEnum; +using WIDESEA_Common.OrderEnum; +using WIDESEA_Common.StockEnum; using WIDESEA_Core; using WIDESEA_Core.BaseRepository; using WIDESEA_Core.BaseServices; @@ -19,6 +22,7 @@ using WIDESEA_IStockRepository; using WIDESEA_IStockService; using WIDESEA_Model.Models; +using WIDESEA_OutboundRepository; using WIDESEA_StockRepository; namespace WIDESEA_OutboundService @@ -26,12 +30,349 @@ public partial class OutboundOrderDetailService : ServiceBase<Dt_OutboundOrderDetail, IOutboundOrderDetailRepository>, IOutboundOrderDetailService { private readonly IUnitOfWorkManage _unitOfWorkManage; + private readonly IStockService _stockService; + private readonly IOutboundRepository _outboundRepository; + private readonly IOutStockLockInfoService _outStockLockInfoService; + private readonly IBasicService _basicService; + private readonly IRecordService _recordService; public IOutboundOrderDetailRepository Repository => BaseDal; - public OutboundOrderDetailService(IOutboundOrderDetailRepository BaseDal, IUnitOfWorkManage unitOfWorkManage) : base(BaseDal) + public OutboundOrderDetailService(IOutboundOrderDetailRepository BaseDal, IUnitOfWorkManage unitOfWorkManage, IStockService stockService, IOutboundRepository outboundRepository, IOutStockLockInfoService outStockLockInfoService, IBasicService basicService, IRecordService recordService) : base(BaseDal) { _unitOfWorkManage = unitOfWorkManage; + _stockService = stockService; + _outboundRepository = outboundRepository; + _outStockLockInfoService = outStockLockInfoService; + _basicService = basicService; + _recordService = recordService; + } + + public WebResponseContent LockOutboundStock(int orderDetailId) + { + Dt_OutboundOrderDetail outboundOrderDetail = BaseDal.QueryFirst(x => x.Id == orderDetailId); + (bool, string) result = CheckDeital(outboundOrderDetail); + if (!result.Item1) return WebResponseContent.Instance.Error(result.Item2); + Dt_OutboundOrder outboundOrder = _outboundRepository.OutboundOrderRepository.QueryFirst(x => x.Id == outboundOrderDetail.OrderId); + + float needQuantity = outboundOrderDetail.OrderQuantity - outboundOrderDetail.LockQuantity; + + List<Dt_StockInfo> outStock = new List<Dt_StockInfo>(); + + List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseableStocks(outboundOrderDetail.MaterielCode, outboundOrder.WarehouseId); + float stockTotalQuantity = stockInfos.Select(x => x.Details.Sum(v => v.StockQuantity - v.OutboundQuantity)).Sum(x => x); + if (stockTotalQuantity >= needQuantity)//搴撳瓨澶� + { + int index = 0; + while (needQuantity > 0) + { + Dt_StockInfo stockInfo = stockInfos[index]; + float useableStockQuantity = stockInfo.Details.Where(x => x.MaterielCode == outboundOrderDetail.MaterielCode).Sum(x => x.StockQuantity - x.OutboundQuantity); + if (useableStockQuantity < needQuantity) + { + outboundOrderDetail.LockQuantity += useableStockQuantity; + stockInfo.Details.ForEach(x => x.OutboundQuantity = x.StockQuantity); + needQuantity -= useableStockQuantity; + } + else + { + outboundOrderDetail.LockQuantity += needQuantity; + stockInfo.Details.ForEach(x => + { + if (x.StockQuantity > x.OutboundQuantity && x.MaterielCode == outboundOrderDetail.MaterielCode) + { + if (x.StockQuantity - x.OutboundQuantity >= needQuantity) + { + x.OutboundQuantity += needQuantity; + needQuantity = 0; + } + else + { + needQuantity -= (x.StockQuantity - x.OutboundQuantity); + x.OutboundQuantity = x.StockQuantity; + } + } + }); + } + outStock.Add(stockInfo); + index++; + } + return WebResponseContent.Instance.OK(data: new { stockInfos, outboundOrderDetail }); + } + else + { + for (int i = 0; i < stockInfos.Count; i++) + { + Dt_StockInfo stockInfo = stockInfos[i]; + float useableStockQuantity = stockInfo.Details.Where(x => x.MaterielCode == outboundOrderDetail.MaterielCode).Sum(x => x.StockQuantity - x.OutboundQuantity); + if (useableStockQuantity < needQuantity) + { + outboundOrderDetail.LockQuantity += useableStockQuantity; + stockInfo.Details.ForEach(x => x.OutboundQuantity = x.StockQuantity); + needQuantity -= useableStockQuantity; + } + else + { + outboundOrderDetail.LockQuantity += needQuantity; + stockInfo.Details.ForEach(x => + { + if (x.StockQuantity > x.OutboundQuantity && x.MaterielCode == outboundOrderDetail.MaterielCode) + { + if (x.StockQuantity - x.OutboundQuantity >= needQuantity) + { + x.OutboundQuantity += needQuantity; + needQuantity = 0; + } + else + { + needQuantity -= (x.StockQuantity - x.OutboundQuantity); + x.OutboundQuantity = x.StockQuantity; + } + } + }); + } + outStock.Add(stockInfo); + } + return WebResponseContent.Instance.OK(data: new { stockInfos, outboundOrderDetail }); + } + } + + private (bool, string) CheckDeital(Dt_OutboundOrderDetail outboundOrderDetail) + { + if (outboundOrderDetail == null) + { + return (false, "鏈壘鍒板嚭搴撳崟鏄庣粏淇℃伅"); + } + if (outboundOrderDetail.OrderDetailStatus != OrderDetailStatusEnum.New.ObjToInt()) + { + return (false, "璇ユ槑缁嗕笉鍙搷浣�"); + } + return (true, "鎴愬姛"); + } + + public (List<Dt_StockInfo>, Dt_OutboundOrderDetail, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) AssignStockOutbound(Dt_OutboundOrderDetail outboundOrderDetail, List<StockSelectViewDTO> stockSelectViews) + { + (bool, string) checkResult = CheckSelectStockDeital(outboundOrderDetail, stockSelectViews); + if (!checkResult.Item1) throw new Exception(checkResult.Item2); + + Dt_OutboundOrder outboundOrder = _outboundRepository.OutboundOrderRepository.QueryFirst(x => x.Id == outboundOrderDetail.OrderId); + float originalNeedQuantity = outboundOrderDetail.OrderQuantity - outboundOrderDetail.LockQuantity; + + float needQuantity = originalNeedQuantity; + + List<Dt_StockInfo> outStocks = _stockService.StockInfoService.Repository.GetStockInfosByPalletCodes(stockSelectViews.Select(x => x.PalletCode).ToList()); + float assignQuantity = 0; + outStocks.ForEach(x => + { + x.Details.ForEach(v => + { + assignQuantity += v.StockQuantity - v.OutboundQuantity; + }); + }); + + outboundOrderDetail.LockQuantity += assignQuantity; + outStocks.ForEach(x => + { + x.Details.ForEach(v => + { + v.OutboundQuantity = v.StockQuantity; + }); + }); + needQuantity -= assignQuantity; + if (outboundOrderDetail.OrderQuantity > outboundOrderDetail.LockQuantity) + { + List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseableStocks(outboundOrderDetail.MaterielCode, outboundOrder.WarehouseId); + stockInfos = stockInfos.Where(x => !stockSelectViews.Select(v => v.PalletCode).Contains(x.PalletCode)).ToList(); + List<Dt_StockInfo> autoAssignStocks = _stockService.StockInfoService.GetOutboundStocks(stockInfos, outboundOrderDetail.MaterielCode, needQuantity, out float residueQuantity); + outboundOrderDetail.LockQuantity += needQuantity - residueQuantity; + outStocks.AddRange(autoAssignStocks); + outboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.AssignOver.ObjToInt(); + if (residueQuantity > 0) + { + outboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.AssignOverPartial.ObjToInt(); + } + } + + List<Dt_OutStockLockInfo> outStockLockInfos = _outStockLockInfoService.GetOutStockLockInfos(outboundOrder, outboundOrderDetail, outStocks); + + List<Dt_LocationInfo> locationInfos = _basicService.LocationInfoService.Repository.GetLocationInfos(outStocks.Select(x => x.LocationCode).ToList()); + + return (outStocks, outboundOrderDetail, outStockLockInfos, locationInfos); + } + + public WebResponseContent LockOutboundStock(int orderDetailId, List<StockSelectViewDTO> stockSelectViews) + { + try + { + Dt_OutboundOrderDetail outboundOrderDetail = BaseDal.QueryFirst(x => x.Id == orderDetailId); + (bool, string) checkResult = CheckSelectStockDeital(outboundOrderDetail, stockSelectViews); + if (!checkResult.Item1) throw new Exception(checkResult.Item2); + + (List<Dt_StockInfo>, Dt_OutboundOrderDetail, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = AssignStockOutbound(outboundOrderDetail, stockSelectViews); + + _unitOfWorkManage.BeginTran(); + WebResponseContent content = LockOutboundStockDataUpdate(result.Item1, new List<Dt_OutboundOrderDetail> { result.Item2 }, result.Item3, result.Item4); + if (content.Status) + { + _unitOfWorkManage.CommitTran(); + } + else + { + _unitOfWorkManage.RollbackTran(); + } + return content; + } + catch (Exception ex) + { + _unitOfWorkManage.RollbackTran(); + return WebResponseContent.Instance.Error(ex.Message); + } + } + + public WebResponseContent LockOutboundStock(int[] keys) + { + try + { + List<StockSelectViewDTO> stockSelectViews = new List<StockSelectViewDTO>(); + List<Dt_StockInfo> stockInfos = new List<Dt_StockInfo>(); + List<Dt_OutboundOrderDetail> outboundOrderDetails = new List<Dt_OutboundOrderDetail>(); + List<Dt_OutStockLockInfo> outStockLockInfos = new List<Dt_OutStockLockInfo>(); + List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>(); + foreach (var item in keys) + { + Dt_OutboundOrderDetail outboundOrderDetail = BaseDal.QueryFirst(x => x.Id == item); + (bool, string) checkResult = CheckSelectStockDeital(outboundOrderDetail, stockSelectViews); + if (!checkResult.Item1) throw new Exception(checkResult.Item2); + + (List<Dt_StockInfo>, Dt_OutboundOrderDetail, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = AssignStockOutbound(outboundOrderDetail, stockSelectViews); + if (result.Item1.Count > 0) + { + stockInfos.AddRange(result.Item1); + outboundOrderDetails.Add(result.Item2); + outStockLockInfos.AddRange(result.Item3); + locationInfos.AddRange(result.Item4); + } + } + + _unitOfWorkManage.BeginTran(); + WebResponseContent content = LockOutboundStockDataUpdate(stockInfos, outboundOrderDetails, outStockLockInfos, locationInfos); + if (content.Status) + { + _unitOfWorkManage.CommitTran(); + } + else + { + _unitOfWorkManage.RollbackTran(); + } + return content; + } + catch (Exception ex) + { + _unitOfWorkManage.RollbackTran(); + return WebResponseContent.Instance.Error(ex.Message); + } + } + + public WebResponseContent LockOutboundStockDataUpdate(List<Dt_StockInfo> stockInfos, List<Dt_OutboundOrderDetail> outboundOrderDetails, List<Dt_OutStockLockInfo> outStockLockInfos, List<Dt_LocationInfo> locationInfos, LocationStatusEnum locationStatus = LocationStatusEnum.Lock, List<Dt_Task>? tasks = null) + { + try + { + _stockService.StockInfoService.Repository.UpdateData(stockInfos); + List<Dt_StockInfoDetail> stockInfoDetails = new List<Dt_StockInfoDetail>(); + foreach (var item in stockInfos) + { + stockInfoDetails.AddRange(item.Details); + } + _stockService.StockInfoDetailService.Repository.UpdateData(stockInfoDetails); + BaseDal.UpdateData(outboundOrderDetails); + + List<Dt_OutStockLockInfo> addOutStockLockInfos = outStockLockInfos.Where(x => x.Id == 0).ToList(); + if (addOutStockLockInfos != null && addOutStockLockInfos.Any()) + { + _outStockLockInfoService.Repository.AddData(addOutStockLockInfos); + } + List<Dt_OutStockLockInfo> updateOutStockLockInfos = outStockLockInfos.Where(x => x.Id > 0).ToList(); + if (updateOutStockLockInfos != null && updateOutStockLockInfos.Any()) + { + _outStockLockInfoService.Repository.UpdateData(updateOutStockLockInfos); + } + + _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfos, locationStatus, LocationChangeType.OutboundAssignLocation, "", tasks?.Select(x => x.TaskNum).ToList()); + _basicService.LocationInfoService.Repository.UpdateLocationStatus(locationInfos, locationStatus); + return WebResponseContent.Instance.OK(); + } + catch (Exception ex) + { + return WebResponseContent.Instance.Error(ex.Message); + } + } + + private (bool, string) CheckSelectStockDeital(Dt_OutboundOrderDetail outboundOrderDetail, List<StockSelectViewDTO> stockSelectViews) + { + if (outboundOrderDetail == null) + { + return (false, "鏈壘鍒板嚭搴撳崟鏄庣粏淇℃伅"); + } + if (outboundOrderDetail.OrderDetailStatus != OrderDetailStatusEnum.New.ObjToInt() && outboundOrderDetail.OrderDetailStatus != OrderDetailStatusEnum.AssignOverPartial.ObjToInt()) + { + return (false, "璇ユ槑缁嗕笉鍙搷浣�"); + } + if (stockSelectViews.Sum(x => x.UseableQuantity) > outboundOrderDetail.OrderQuantity - outboundOrderDetail.LockQuantity) + { + return (false, "閫夋嫨鏁伴噺瓒呭嚭鍗曟嵁鏁伴噺"); + } + return (true, "鎴愬姛"); + } + + public WebResponseContent RevokeLockOutboundStock(int orderDetailId) + { + Dt_OutboundOrderDetail outboundOrderDetail = BaseDal.QueryFirst(x => x.Id == orderDetailId); + (bool, string) result = CheckRevoke(outboundOrderDetail); + if (!result.Item1) return WebResponseContent.Instance.Error(result.Item2); + + List<Dt_OutStockLockInfo> outStockLockInfos = _outStockLockInfoService.GetByOrderDetailId(orderDetailId, OutLockStockStatusEnum.宸插垎閰�); + if (outStockLockInfos.Count > 0) + { + List<Dt_StockInfo> stocks = _stockService.StockInfoService.Repository.GetStockInfosByPalletCodes(outStockLockInfos.Select(x => x.PalletCode).ToList()); + if (stocks.Count > 0) + { + stocks.ForEach(x => + { + x.Details.ForEach(v => + { + v.OutboundQuantity = 0; + }); + }); + + outboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.New.ObjToInt(); + outboundOrderDetail.LockQuantity = outboundOrderDetail.OverOutQuantity; + + outStockLockInfos.ForEach(x => + { + x.Status = OutLockStockStatusEnum.鎾ら攢.ObjToInt(); + }); + + List<Dt_LocationInfo> locationInfos = _basicService.LocationInfoService.Repository.GetLocationInfos(stocks.Select(x => x.LocationCode).ToList()); + + return LockOutboundStockDataUpdate(stocks, new List<Dt_OutboundOrderDetail> { outboundOrderDetail }, outStockLockInfos, locationInfos, LocationStatusEnum.InStock); + } + return WebResponseContent.Instance.Error("鏈壘鍒板簱瀛樹俊鎭�"); + } + return WebResponseContent.Instance.Error("鏈壘鍒板凡鍒嗛厤鐨勫嚭搴撲俊鎭�"); + + } + + private (bool, string) CheckRevoke(Dt_OutboundOrderDetail outboundOrderDetail) + { + if (outboundOrderDetail == null) + { + return (false, "鏈壘鍒板嚭搴撳崟鏄庣粏淇℃伅"); + } + if (outboundOrderDetail.OrderDetailStatus != OrderDetailStatusEnum.New.ObjToInt() && outboundOrderDetail.OrderDetailStatus != OrderDetailStatusEnum.AssignOverPartial.ObjToInt() && outboundOrderDetail.OrderDetailStatus != OrderDetailStatusEnum.AssignOver.ObjToInt()) + { + return (false, "璇ユ槑缁嗕笉鍙搷浣�"); + } + return (true, "鎴愬姛"); } } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs" index fa29aa5..edff987 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs" @@ -29,14 +29,16 @@ private readonly IMapper _mapper; private readonly IBasicService _basicService; private readonly IOutboundOrderDetailRepository _outboundOrderDetailRepository; + private readonly IStockInfoService _stockInfoService; public IOutboundOrderRepository Repository => BaseDal; - public OutboundOrderService(IOutboundOrderRepository BaseDal, IMapper mapper, IBasicService basicService, IOutboundOrderDetailRepository outboundOrderDetailRepository) : base(BaseDal) + public OutboundOrderService(IOutboundOrderRepository BaseDal, IMapper mapper, IBasicService basicService, IOutboundOrderDetailRepository outboundOrderDetailRepository, IStockInfoService stockInfoService) : base(BaseDal) { _mapper = mapper; _basicService = basicService; _outboundOrderDetailRepository = outboundOrderDetailRepository; + _stockInfoService = stockInfoService; } public WebResponseContent ReceiveOutOrder(ErpOutOrderDTO model) @@ -121,7 +123,7 @@ { return WebResponseContent.Instance.Error($"鏈壘鍒拌鏄庣粏琛屽彿淇℃伅"); } - if(outboundOrderDetail.OrderDetailStatus != OrderDetailStatusEnum.New.ObjToInt()) + if (outboundOrderDetail.OrderDetailStatus != OrderDetailStatusEnum.New.ObjToInt()) { return WebResponseContent.Instance.Error($"璇ユ槑缁嗕笉鍙慨鏀�"); } @@ -137,6 +139,39 @@ _outboundOrderDetailRepository.UpdateData(outboundOrderDetail); } + else if (model.Way == 3) + { + if (oldOutboundOrder == null) + { + return WebResponseContent.Instance.Error($"鏈壘鍒拌鍑哄簱鍗�"); + } + } + + return WebResponseContent.Instance.OK(); + } + catch (Exception ex) + { + return WebResponseContent.Instance.Error(ex.Message); + } + } + + public WebResponseContent ReleaseOutOrder(int id) + { + try + { + Dt_OutboundOrder outboundOrder = Db.Queryable<Dt_OutboundOrder>().Where(x => x.Id == id).Includes(x => x.Details).First(); + if (outboundOrder == null) + { + return WebResponseContent.Instance.Error($"鏈壘鍒拌鍑哄簱鍗�"); + } + if(outboundOrder.Details == null || outboundOrder.Details.Count == 0) + { + return WebResponseContent.Instance.Error($"鏈壘鍒版槑缁嗕俊鎭�"); + } + + foreach (var item in outboundOrder.Details) + { + } return WebResponseContent.Instance.OK(); } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_RecordService/Service/LocationStatusChangeRecordService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_RecordService/Service/LocationStatusChangeRecordService.cs" index af43159..9660b90 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_RecordService/Service/LocationStatusChangeRecordService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_RecordService/Service/LocationStatusChangeRecordService.cs" @@ -44,7 +44,7 @@ } } - public void AddLocationStatusChangeRecord(List<Dt_LocationInfo> locationInfos, LocationStatusEnum newStatus, LocationChangeType changeType, string? orderNo, List<int>? taskNums) + public void AddLocationStatusChangeRecord(List<Dt_LocationInfo> locationInfos, LocationStatusEnum newStatus, LocationChangeType changeType, string? orderNo = null, List<int>? taskNums = null) { try { diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Base/StockInfoDetailService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Base/StockInfoDetailService.cs" deleted file mode 100644 index 555e3a5..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Base/StockInfoDetailService.cs" +++ /dev/null @@ -1,22 +0,0 @@ -锘縰sing System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using WIDESEA_Core.BaseServices; -using WIDESEA_IStockRepository; -using WIDESEA_IStockService; -using WIDESEA_Model.Models; - -namespace WIDESEA_StockService -{ - public partial class StockInfoDetailService : ServiceBase<Dt_StockInfoDetail, IStockInfoDetailRepository>, IStockInfoDetailService - { - public StockInfoDetailService(IStockInfoDetailRepository BaseDal) : base(BaseDal) - { - } - - public IStockInfoDetailRepository Repository => BaseDal; - - } -} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Base/StockInfoService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Base/StockInfoService.cs" deleted file mode 100644 index bc4e2d7..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Base/StockInfoService.cs" +++ /dev/null @@ -1,34 +0,0 @@ -锘縰sing AutoMapper; -using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup; -using SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using WIDESEA_Core; -using WIDESEA_Core.BaseServices; -using WIDESEA_Core.Enums; -using WIDESEA_Core.Helper; -using WIDESEA_DTO.Stock; -using WIDESEA_IBasicRepository; -using WIDESEA_IRecordRepository; -using WIDESEA_IRecordService; -using WIDESEA_IStockRepository; -using WIDESEA_IStockService; -using WIDESEA_Model.Models; - -namespace WIDESEA_StockService -{ - public partial class StockInfoService : ServiceBase<Dt_StockInfo, IStockInfoRepository>, IStockInfoService - { - private readonly IMapper _mapper; - - public IStockInfoRepository Repository => BaseDal; - - public StockInfoService(IStockInfoRepository BaseDal, IMapper mapper) : base(BaseDal) - { - _mapper = mapper; - } - } -} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockViewService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockViewService.cs" deleted file mode 100644 index f2fb085..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockViewService.cs" +++ /dev/null @@ -1,28 +0,0 @@ -锘� -using Microsoft.AspNetCore.Http; -using SqlSugar; -using System; -using System.Collections.Generic; -using System.Drawing.Printing; -using System.Dynamic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; -using WIDESEA_Core; -using WIDESEA_Core.BaseRepository; -using WIDESEA_Core.BaseServices; -using WIDESEA_Core.Enums; -using WIDESEA_Core.Helper; -using WIDESEA_Core.Utilities; -using WIDESEA_DTO.Stock; -using WIDESEA_IStockRepository; -using WIDESEA_IStockService; -using WIDESEA_Model.Models; - -namespace WIDESEA_StockService -{ - public partial class StockViewService : IStockViewService - { - } -} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoDetailService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoDetailService.cs" similarity index 81% rename from "\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoDetailService.cs" rename to "\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoDetailService.cs" index 666b495..63d400e 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoDetailService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoDetailService.cs" @@ -12,6 +12,12 @@ { public partial class StockInfoDetailService : ServiceBase<Dt_StockInfoDetail, IStockInfoDetailRepository>, IStockInfoDetailService { + public StockInfoDetailService(IStockInfoDetailRepository BaseDal) : base(BaseDal) + { + } + + public IStockInfoDetailRepository Repository => BaseDal; + public bool ExistSerialNumber(string SerialNumber) { return BaseDal.QueryFirst(x => x.SerialNumber == SerialNumber) != null; diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Base/StockInfoDetail_HtyService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoDetail_HtyService.cs" similarity index 100% rename from "\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Base/StockInfoDetail_HtyService.cs" rename to "\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoDetail_HtyService.cs" diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs" similarity index 86% rename from "\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoService.cs" rename to "\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs" index 277cf6c..37f7521 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs" @@ -6,7 +6,6 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -using WIDESEA_Common.StockEnum; using WIDESEA_Core; using WIDESEA_Core.BaseServices; using WIDESEA_Core.Enums; @@ -23,7 +22,17 @@ { public partial class StockInfoService : ServiceBase<Dt_StockInfo, IStockInfoRepository>, IStockInfoService { - + private readonly IMapper _mapper; + private readonly IBasicRepository _basicRepository; + + public IStockInfoRepository Repository => BaseDal; + + public StockInfoService(IStockInfoRepository BaseDal, IMapper mapper, IBasicRepository basicRepository) : base(BaseDal) + { + _mapper = mapper; + _basicRepository = basicRepository; + } + public List<Dt_StockInfo> GetOutboundStocks(List<Dt_StockInfo> stockInfos, string materielCode, float needQuantity, out float residueQuantity) { List<Dt_StockInfo> outStocks = new List<Dt_StockInfo>(); @@ -100,5 +109,12 @@ residueQuantity = needQuantity; return outStocks; } + + public List<Dt_StockInfo> GetUseableStocks(string materielCode, int warehoseId) + { + List<string> locationCodes = _basicRepository.LocationInfoRepository.GetCanOutLocationCodes(warehoseId); + + return BaseDal.GetStockInfos(materielCode, locationCodes); + } } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Base/StockInfo_HtyService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfo_HtyService.cs" similarity index 100% rename from "\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Base/StockInfo_HtyService.cs" rename to "\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfo_HtyService.cs" diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Base/StockViewService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockViewService.cs" similarity index 100% rename from "\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Base/StockViewService.cs" rename to "\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockViewService.cs" diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/MaterielInfoController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/MaterielInfoController.cs" index 18baec8..6478e00 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/MaterielInfoController.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/MaterielInfoController.cs" @@ -1,6 +1,10 @@ 锘縰sing Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; +using WIDESEA_Core; using WIDESEA_Core.BaseController; +using WIDESEA_Core.CodeConfigEnum; +using WIDESEA_Core.Helper; +using WIDESEA_DTO.Basic; using WIDESEA_IBasicService; using WIDESEA_Model.Models; @@ -13,5 +17,24 @@ public MaterielInfoController(IMaterielInfoService service) : base(service) { } + + /// <summary> + /// 鐗╂枡鐮佽В鏋� + /// </summary> + /// <param name="serNum"></param> + /// <returns></returns> + [HttpPost, HttpGet, Route("CodeAnalysis")] + public WebResponseContent CodeAnalysis(string serNum) + { + try + { + MatSerNumAnalysisModel model = CodeAnalysisHelper.CodeAnalysis<MatSerNumAnalysisModel>(AnalysisCodeEnum.MatSerNumAnalysis, serNum); + return WebResponseContent.Instance.OK(data: model); + } + catch (Exception ex) + { + return WebResponseContent.Instance.Error(ex.Message); + } + } } } -- Gitblit v1.9.3