From 9adacbe74273a2c57c9d9d480d9b22cb53098a96 Mon Sep 17 00:00:00 2001
From: pan <antony1029@163.com>
Date: 星期二, 25 十一月 2025 13:24:41 +0800
Subject: [PATCH] 提交

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_AllocateService/AllocateService.cs |   43 ++++++++++++++++++++++++++++---------------
 1 files changed, 28 insertions(+), 15 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_AllocateService/AllocateService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_AllocateService/AllocateService.cs"
index 0314eb8..b720756 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_AllocateService/AllocateService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_AllocateService/AllocateService.cs"
@@ -1,11 +1,14 @@
-锘縰sing Microsoft.Extensions.Logging;
+锘縰sing MailKit.Search;
+using Microsoft.Extensions.Logging;
 using SqlSugar;
+using SqlSugar.Extensions;
 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using WIDESEA_Common.AllocateEnum;
+using WIDESEA_Common.OrderEnum;
 using WIDESEA_Core;
 using WIDESEA_Core.BaseRepository;
 using WIDESEA_Core.BaseServices;
@@ -50,14 +53,14 @@
         public IRepository<Dt_AllocateOrder> Repository => BaseDal;
 
 
-        public WebResponseContent ReceiveAllocateOrder(Dt_AllocateOrder allocateOrder, int operateType)
+        public async Task<WebResponseContent> ReceiveAllocateOrder(Dt_AllocateOrder allocateOrder, int operateType)
         {
             try
             {
                 return operateType switch
                 {
-                    1 => AddAllocateOrder(allocateOrder),
-                    2 => UpdateAllocateOrder(allocateOrder),
+                    1 => await AddAllocateOrder(allocateOrder),
+                    2 => await UpdateAllocateOrder(allocateOrder),
                     3 => DeleteAllocateOrder(allocateOrder),
 
                     _ => WebResponseContent.Instance.OK(),
@@ -69,7 +72,7 @@
             }
         }
 
-        public WebResponseContent AddAllocateOrder(Dt_AllocateOrder allocateOrder)
+        public async Task<WebResponseContent> AddAllocateOrder(Dt_AllocateOrder allocateOrder)
         {
             try
             {
@@ -81,15 +84,24 @@
                 Db.InsertNav(allocateOrder).Include(x => x.Details).ExecuteCommand();
                 if (Enum.TryParse<BusinessTypeEnum>(allocateOrder.BusinessType, out var businessType))
                 {
-                    if (businessType == BusinessTypeEnum.澶栭儴浠撳簱璋冩櫤浠�)
+                    if (businessType == BusinessTypeEnum.鏅轰粨璋冨閮ㄤ粨搴�)
                     {
                         var inboundOrders = ConvertToInboundOrders(allocateOrder);
-                        _inboundService.InbounOrderService.ReceiveInboundOrder(inboundOrders, 1);
+                        await _inboundService.InbounOrderService.ReceiveInboundOrder(inboundOrders, 1);
                     }
-                    else if (businessType == BusinessTypeEnum.鏅轰粨璋冨閮ㄤ粨搴�)
+                    else if (businessType == BusinessTypeEnum.澶栭儴浠撳簱璋冩櫤浠� || businessType == BusinessTypeEnum.鏅轰粨璋冩櫤浠�)
                     {
+                        if (businessType == BusinessTypeEnum.澶栭儴浠撳簱璋冩櫤浠�)
+                        {
+                            allocateOrder.OrderType = InOrderTypeEnum.Allocat.ObjToInt();
+                        }
+                        else if (businessType == BusinessTypeEnum.鏅轰粨璋冩櫤浠�)
+                        {
+                            allocateOrder.OrderType = InOrderTypeEnum.InternalAllocat.ObjToInt();
+                        }
+
                         var outboundOrders = ConvertToOutboundOrders(allocateOrder);
-                        _outboundService.OutboundOrderService.ReceiveOutboundOrder(outboundOrders, 1);
+                        await _outboundService.OutboundOrderService.ReceiveOutboundOrder(outboundOrders, 1);
                     }
                     else
                     {
@@ -105,7 +117,7 @@
                 return WebResponseContent.Instance.Error(ex.Message);
             }
         }
-        public WebResponseContent UpdateAllocateOrder(Dt_AllocateOrder model)
+        public async Task<WebResponseContent> UpdateAllocateOrder(Dt_AllocateOrder model)
         {
             try
             {
@@ -176,7 +188,8 @@
                 _unitOfWorkManage.BeginTran();
                 foreach (var item in deletePurchaseOrderDetails)
                 {
-                    _allocateOrderDetailRepository.DeleteAndMoveIntoHty(item, OperateTypeEnum.鑷姩鍒犻櫎);
+                    // _allocateOrderDetailRepository.DeleteAndMoveIntoHty(item, OperateTypeEnum.鑷姩鍒犻櫎);
+                    _allocateOrderDetailRepository.DeleteData(item);
                 }
 
                 _allocateOrderDetailRepository.UpdateData(updateAllocateOrderDetails);
@@ -238,7 +251,7 @@
                    InboundOrderNo=allocateOrder.OrderNo,
                    UpperOrderNo=allocateOrder.UpperOrderNo,
                    SupplierId=allocateOrder.SupplierId,
-                   OrderType=allocateOrder.OrderType,
+                   OrderType= allocateOrder.OrderType ,
                    OrderStatus=allocateOrder.OrderStatus,
                    CreateType=allocateOrder.CreateType,
                    BusinessType=allocateOrder.BusinessType,
@@ -257,7 +270,7 @@
                        OrderDetailStatus=detail.OrderDetailStatus,
                        Unit=detail.Unit,
                        RowNo=0,
-                       SupplyCode="",
+                       SupplyCode=detail.SupplyCode,
                        WarehouseCode=detail.WarehouseCode,
                        Barcode=detail.Barcode,
                        OutBoxbarcodes="",
@@ -275,7 +288,7 @@
                 WarehouseId = allocateOrder.WarehouseId,
                 OrderNo = allocateOrder.OrderNo,
                 UpperOrderNo = allocateOrder.UpperOrderNo,
-                OrderType = allocateOrder.OrderType,
+                OrderType = OutOrderTypeEnum.Allocate.ObjToInt(),
                 OrderStatus = allocateOrder.OrderStatus,
                 CreateType = allocateOrder.CreateType,
                 BusinessType = allocateOrder.BusinessType,
@@ -296,7 +309,7 @@
                     OrderDetailStatus = detail.OrderDetailStatus,
                     Unit = detail.Unit,
                     RowNo = 0,
-                    SupplyCode = "",
+                    SupplyCode = detail.SupplyCode,
                     WarehouseCode = detail.WarehouseCode,
 
                 }).ToList()

--
Gitblit v1.9.3