From 29cd467ba62b2bdf49c6546e78ae3ec809c4a723 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期四, 19 六月 2025 17:50:28 +0800
Subject: [PATCH] 1
---
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Service/InboundOrderService.cs | 75 +++++++++++++++++++++++++++++++++++++
1 files changed, 75 insertions(+), 0 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Service/InboundOrderService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Service/InboundOrderService.cs"
index 5bca9a1..d6d8d99 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Service/InboundOrderService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Service/InboundOrderService.cs"
@@ -36,6 +36,81 @@
return BaseDal.Db.Queryable<Dt_InboundOrder>().Includes(x => x.Details).First(x => x.OrderNo == inboundOrderNo); ;
}
+ public WebResponseContent MaterielGroup(SaveModel saveModel)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ var palletCode = saveModel.MainData["palletCode"].ToString();
+ if (string.IsNullOrEmpty(palletCode)) throw new Exception("鎵樼洏鍙蜂笉鍙负绌�");
+ var orderNo = saveModel.MainData["orderNo"].ToString();
+ if (string.IsNullOrEmpty(orderNo)) throw new Exception("鍗曞彿涓嶅彲涓虹┖");
+ var batchNo = saveModel.MainData["batchNo"].ToString();
+ if (string.IsNullOrEmpty(batchNo)) throw new Exception("鎵瑰彿涓嶅彲涓虹┖");
+ //var StationCode = saveModel.MainData["address"].ToString();
+ //if (string.IsNullOrEmpty(StationCode)) throw new Exception("鍦板潃涓嶅彲涓虹┖");
+
+ //Dt_RoadwayInfo roadwayInfo = _basicService.RoadwayInfoService.Repository.QueryFirst(x => x.InStationCode == StationCode) ?? throw new Exception("鏈壘鍒拌鍏ュ簱绔欏彴锛岃妫�鏌ュ熀纭�閰嶇疆淇℃伅!");
+ Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(palletCode);
+ if (stockInfo != null) throw new Exception($"鎵樼洏銆恵palletCode}銆戝凡瀛樺湪搴撳瓨淇℃伅");
+ stockInfo = new Dt_StockInfo();
+ stockInfo.Details = new List<Dt_StockInfoDetail>();
+ Dt_InboundOrder? inboundOrder = GetInboundOrder(orderNo);
+ if (inboundOrder == null) throw new Exception($"鏈壘鍒板崟鍙蜂负銆恵orderNo}銆戠殑鍏ュ簱鍗�");
+ Dt_InboundOrderDetail? inboundOrderDetail = inboundOrder.Details.Where(x => x.BatchNo == batchNo).FirstOrDefault();
+ if (inboundOrderDetail == null) throw new Exception($"鍗曞彿銆恵orderNo}銆戠殑鍏ュ簱鍗曟湭鎵惧埌鎵瑰彿銆恵batchNo}銆�");
+ if (inboundOrderDetail.OrderQuantity - inboundOrderDetail.ReceiptQuantity < 1) throw new Exception($"鍗曞彿銆恵orderNo}銆戠殑鎵瑰彿銆恵batchNo}銆戝彲缁勭洏鏁伴噺涓嶈冻");
+
+ #region 澶勭悊鍏ュ簱鍗�
+ inboundOrder.OrderStatus = InboundStatusEnum.鍏ュ簱涓�.ObjToInt();
+ inboundOrderDetail.ReceiptQuantity++;
+ inboundOrderDetail.OrderDetailStatus = inboundOrderDetail.OverInQuantity == inboundOrderDetail.OrderQuantity ? OrderDetailStatusEnum.Over.ObjToInt() : OrderDetailStatusEnum.GroupAndInbound.ObjToInt();
+ #endregion
+
+ #region 娣诲姞搴撳瓨
+ if (stockInfo.Id == 0)
+ {
+ stockInfo.PalletCode = palletCode;
+ stockInfo.StockStatus = StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt();
+ stockInfo.Creater = "System";
+ stockInfo.Remark = "浜哄伐缁勭洏鍏ュ簱";
+ }
+ Dt_StockInfoDetail stockInfoDetail = new Dt_StockInfoDetail()
+ {
+ Status = StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt(),
+ OrderNo = inboundOrder.OrderNo,
+ StockId = stockInfo.Id != 0 ? stockInfo.Id : 0,
+ MaterielName = inboundOrderDetail.MaterielName,
+ MaterielCode = inboundOrderDetail.MaterielCode,
+ BatchNo = inboundOrderDetail.BatchNo,
+ StockQuantity = 1,
+ SerialNumber = "",
+ Creater = "System"
+ };
+ stockInfo.Details.Add(stockInfoDetail);
+ #endregion
+ Db.Ado.BeginTran();
+ BaseDal.UpdateData(inboundOrder);
+ _inboundOrderDetailService.UpdateData(inboundOrderDetail);
+ _stockService.StockInfoService.AddMaterielGroup(stockInfo);
+ Db.Ado.CommitTran();
+ content.OK();
+ }
+ catch (Exception ex)
+ {
+ Db.Ado.RollbackTran();
+ content.Error(ex.Message);
+ }
+ return content;
+ }
+ public WebResponseContent QueryOrderDetailInfo(int pageNo, string orderNo)
+ {
+ WebResponseContent content = new WebResponseContent();
+ Dt_InboundOrder inboundOrder = GetInboundOrder(orderNo);
+ List<Dt_InboundOrderDetail> inboundOrderDetails = inboundOrder.Details;
+ content.OK(data: inboundOrderDetails);
+ return content;
+ }
/// <summary>
/// 缁勭洏
/// </summary>
--
Gitblit v1.9.3