From 5621e29bd415c85fd719e0e6366eae813b970ea2 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期四, 30 十月 2025 20:16:11 +0800
Subject: [PATCH] 1

---
 新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs |   67 +++++++++++++++------------------
 1 files changed, 31 insertions(+), 36 deletions(-)

diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs"
index e91b4f9..a341ca7 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs"
@@ -35,19 +35,19 @@
     public partial class DeliveryOrderServices : ServiceBase<Dt_DeliveryOrder, IRepository<Dt_DeliveryOrder>>, IDeliveryOrderServices
     {
         private readonly ICabinOrderServices _cabinOrderServices;
-        private readonly IBasicService _basicService;
         private readonly IUnitOfWorkManage _unitOfWorkManage;
         private readonly IInventory_BatchServices _inventory_BatchServices;
+        private readonly ILocationInfoService _locationInfoService;
         private readonly IInventoryInfoService _inventoryInfoService;
         private readonly IDeliveryOrderDetailServices _deliveryOrderDetailServices;
         private readonly ISupplyTaskService _supplyTaskService;
         private readonly ISupplyTaskHtyService _supplyTaskHtyService;
         private readonly ITacticsService _tacticsService;
+        private readonly IMaterielInfoService _materielInfoService;
         private readonly IMessageInfoService _messageInfoService;
         public IRepository<Dt_DeliveryOrder> Repository => BaseDal;
-        public DeliveryOrderServices(IRepository<Dt_DeliveryOrder> BaseDal, IBasicService basicService, IUnitOfWorkManage unitOfWorkManage, IInventory_BatchServices inventory_BatchServices, IInventoryInfoService inventoryInfoService, IDeliveryOrderDetailServices deliveryOrderDetailServices, ISupplyTaskService supplyTaskService, ICabinOrderServices cabinOrderServices, ITacticsService tacticsService, ISupplyTaskHtyService supplyTaskHtyService, IMessageInfoService messageInfoService) : base(BaseDal)
+        public DeliveryOrderServices(IRepository<Dt_DeliveryOrder> BaseDal, IUnitOfWorkManage unitOfWorkManage, IInventory_BatchServices inventory_BatchServices, IInventoryInfoService inventoryInfoService, IDeliveryOrderDetailServices deliveryOrderDetailServices, ISupplyTaskService supplyTaskService, ICabinOrderServices cabinOrderServices, ITacticsService tacticsService, ISupplyTaskHtyService supplyTaskHtyService, IMessageInfoService messageInfoService, IMaterielInfoService materielInfoService, ILocationInfoService locationInfoService) : base(BaseDal)
         {
-            _basicService = basicService;
             _unitOfWorkManage = unitOfWorkManage;
             _deliveryOrderDetailServices = deliveryOrderDetailServices;
             _supplyTaskService = supplyTaskService;
@@ -57,6 +57,8 @@
             _tacticsService = tacticsService;
             _supplyTaskHtyService = supplyTaskHtyService;
             _messageInfoService = messageInfoService;
+            _materielInfoService = materielInfoService;
+            _locationInfoService = locationInfoService;
         }
         #region 鍒涘缓鍑哄簱鍗�
         /// <summary>
@@ -223,7 +225,7 @@
                         #endregion
                         var Order_qty = Math.Abs(detail.order_qty);//鍑哄簱鍗曟暟閲�
                         #region 鏍规嵁鐗╂枡缂栫爜鏌ヨ鐗╂枡淇℃伅
-                        Dt_MaterielInfo materielInfo = _basicService.MaterielInfoService.Repository.QueryFirst(x => x.MaterielCode == detail.goods_no);
+                        Dt_MaterielInfo materielInfo = _materielInfoService.Repository.QueryFirst(x => x.MaterielCode == detail.goods_no);
                         if (materielInfo == null) throw new Exception($"鏈壘鍒拌嵂鍝佺紪鐮併�恵detail.goods_no}銆戠殑淇℃伅");
                         if (!Enum.IsDefined(typeof(MaterielSourceTypeEnum), materielInfo.MaterielSourceType))
                             throw new Exception($"璇疯缃嵂鍝佺紪鍙枫�恵detail.goods_no}銆戠殑灞炴�у垎绫�");
@@ -889,7 +891,7 @@
 
                 Dt_DeliveryOrderDetail? cabinOrderDetail = cabinOrder.Details.Where(x => x.Batch_num == supplyTask.BatchNo && x.Reservoirarea == supplyTask.WarehouseCode && x.Goods_no == supplyTask.MaterielCode).FirstOrDefault();
                 if (cabinOrderDetail == null) return WebResponseContent.Instance.Error($"鍑哄簱鍗曟槑缁嗗凡瀹屾垚");
-                Dt_MaterielInfo materielInfo = _basicService.MaterielInfoService.Repository.QueryFirst(x => x.MaterielCode == cabinOrderDetail.Goods_no);
+                Dt_MaterielInfo materielInfo = _materielInfoService.Repository.QueryFirst(x => x.MaterielCode == cabinOrderDetail.Goods_no);
                 if (materielInfo == null) return WebResponseContent.Instance.Error($"璇风淮鎶ょ墿鏂欑紪鍙枫�恵cabinOrderDetail.Goods_no}銆戠殑鐗╂枡淇℃伅");
                 cabinOrderDetail.Order_Outqty += supplyTask.StockQuantity;
                 if (cabinOrderDetail.Order_Outqty > cabinOrderDetail.Order_qty)
@@ -928,7 +930,7 @@
                 #region 璐т綅
                 if (supplyTask.WarehouseCode != WarehouseEnum.绔嬪簱.ObjToInt().ToString("000"))
                 {
-                    var location = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == supplyTask.LocationCode);
+                    var location = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == supplyTask.LocationCode);
                     if (location == null)
                         return WebResponseContent.Instance.Error($"璇风淮鎶よ揣浣嶇紪鍙枫�恵supplyTask.LocationCode}銆戠殑璐т綅淇℃伅");
                     //if (location.EnableStatus == EnableStatusEnum.Disable.ObjToInt())
@@ -937,7 +939,7 @@
                     if (inventoryInfo1 == null)
                     {
                         location.LocationStatus = LocationStatusEnum.Free.ObjToInt();
-                        _basicService.LocationInfoService.UpdateData(location);
+                        _locationInfoService.UpdateData(location);
                     }
                 }
                 #endregion
@@ -965,7 +967,7 @@
                 if (supplyTask.WarehouseCode == WarehouseEnum.绔嬪簱.ObjToInt().ToString("000"))
                 {
                     materielInfo.Business_qty -= supplyTask.StockQuantity;
-                    _basicService.MaterielInfoService.Repository.UpdateData(materielInfo);
+                    _materielInfoService.UpdateData(materielInfo);
                     if (materielInfo.Business_qty < materielInfo.MinQty)
                         CreateAllocatInOut(materielInfo);//鍒涘缓璋冩嫧浠诲姟
                 }
@@ -996,36 +998,29 @@
 
                 foreach (var item in deliveryOrders)
                 {
-                    if (item.Out_type==OutOrderTypeEnum.Allocate.ObjToInt().ToString())
-                    {
-                        if (item.Details!=null)
-                        {
-                            _deliveryOrderDetailServices.Repository.DeleteAndMoveIntoHty(item.Details, OperateTypeEnum.浜哄伐瀹屾垚);
-                            item.Details =null;
-                        }
-                    }
-                    else
-                    {
-                        if (item.Details != null)
-                            _deliveryOrderDetailServices.Repository.DeleteAndMoveIntoHty(item.Details, OperateTypeEnum.浜哄伐瀹屾垚);
-                        item.Modifier = App.User.UserName;
-                        item.ModifyDate = DateTime.Now;
-                        item.Details = null;
-                      
-                    }
-                    BaseDal.DeleteAndMoveIntoHty(deliveryOrders, OperateTypeEnum.浜哄伐瀹屾垚);
+                    if (item.Details != null)
+                        _deliveryOrderDetailServices.Repository.DeleteAndMoveIntoHty(item.Details, OperateTypeEnum.浜哄伐瀹屾垚);
+                    item.Modifier = App.User.UserName;
+                    item.ModifyDate = DateTime.Now;
+                    item.Details = null;
                 }
-                var url = "http://121.37.118.63:80/GYZ2/95fck/outOrderOk";
-
-                var requestDate = new
+                BaseDal.DeleteAndMoveIntoHty(deliveryOrders, OperateTypeEnum.浜哄伐瀹屾垚);
+                if (deliveryOrder.Out_type == OutOrderTypeEnum.Allocate.ObjToInt().ToString())
+                    _unitOfWorkManage.CommitTran();
+                else
                 {
-                    order_no = deliveryOrder.Out_no
-                };
-                var result = HttpHelper.Post(url, requestDate.ToJsonString());
-                var response = JsonConvert.DeserializeObject<UpstreamOrderResponse>(result);
-                if (response == null) throw new Exception("涓婃姤ERP鍑哄簱鍗曞畬鎴愬け璐ワ紒");
-                if (response.resultCode != "0") throw new Exception(response.resultMsg);
-                _unitOfWorkManage.CommitTran();
+                    var url = "http://121.37.118.63:80/GYZ2/95fck/outOrderOk";
+
+                    var requestDate = new
+                    {
+                        order_no = deliveryOrder.Out_no
+                    };
+                    var result = HttpHelper.Post(url, requestDate.ToJsonString());
+                    var response = JsonConvert.DeserializeObject<UpstreamOrderResponse>(result);
+                    if (response == null) throw new Exception("涓婃姤ERP鍑哄簱鍗曞畬鎴愬け璐ワ紒");
+                    if (response.resultCode != "0") throw new Exception(response.resultMsg);
+                    _unitOfWorkManage.CommitTran();
+                }
                 content.OK();
             }
             catch (Exception ex)

--
Gitblit v1.9.3