From 644cbe3e4eba765affa25454d69fee6286bb6094 Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期四, 30 十月 2025 13:06:35 +0800
Subject: [PATCH] 1

---
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_OrderServices/Dt_InboundOrderService.cs |  118 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 116 insertions(+), 2 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_OrderServices/Dt_InboundOrderService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_OrderServices/Dt_InboundOrderService.cs"
index f2f9ff9..73a7a9b 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_OrderServices/Dt_InboundOrderService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_OrderServices/Dt_InboundOrderService.cs"
@@ -1,23 +1,137 @@
-锘縰sing WIDESEA_Core.BaseRepository;
+锘縰sing MailKit.Search;
+using Masuit.Tools;
+using WIDESEA_Common;
+using WIDESEA_Core;
+using WIDESEA_Core.BaseRepository;
 using WIDESEA_Core.BaseServices;
+using WIDESEA_Core.Const;
+using WIDESEA_Core.Helper;
 using WIDESEA_IOrderRepository;
 using WIDESEA_IOrderServices;
+using WIDESEA_IServices;
 using WIDESEA_IStorageTaskRepository;
 using WIDESEA_IStorageTaskServices;
 using WIDESEA_Model.Models;
 using WIDESEA_Model.Models.Order;
+using WIDESEA_OrderRepository;
 
 namespace WIDESEA_OrderServices
 {
     public class Dt_InboundOrderService : ServiceBase<Dt_InboundOrder, IDt_InboundOrderRepository>, IDt_InboundOrderService
     {
         private readonly IUnitOfWorkManage _unitOfWorkManage;
+        private readonly ISys_ConfigService _configService;
 
         public Dt_InboundOrderService(IDt_InboundOrderRepository BaseDal,
-                                        IUnitOfWorkManage unitOfWorkManage) : base(BaseDal)
+                                        IUnitOfWorkManage unitOfWorkManage,
+                                        ISys_ConfigService configService) : base(BaseDal)
         {
             _unitOfWorkManage = unitOfWorkManage;
+            _configService = configService;
 
         }
+
+        public WebResponseContent GetInboundOrderInfo(string OrderNo)
+        {
+            WebResponseContent content=new WebResponseContent();
+            try
+            {
+                var InboundOrder = BaseDal.QueryFirst(x => x.OrderNo == OrderNo);
+                if (InboundOrder == null)
+                {
+                    return content.Error($"鏈壘鍒拌鍗曞彿鏁版嵁璇蜂汉宸ョ‘璁�");
+                }
+                return content.OK(data: InboundOrder);
+            }
+            catch (Exception ex)
+            {
+                return content.Error(ex.Message);
+            }
+        }
+        public WebResponseContent PrintOrder(int[] keys)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                List<Dt_InboundOrder> inboundOrders = new List<Dt_InboundOrder>();
+                foreach (var item in keys)
+                {
+                    var InboundOrder = BaseDal.QueryFirst(x => x.Id == item);
+                    if(InboundOrder != null)
+                    {
+                        inboundOrders.Add(InboundOrder);
+                    }
+                }
+                PrintInbound(inboundOrders);
+                return content.OK("鎴愬姛");
+            }
+            catch (Exception ex)
+            {
+                return content.Error(ex.Message);
+            }
+        }
+
+        public WebResponseContent PrintPalletCode(int num)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                List<string> PalletCodes = new List<string>();
+                for (int i = 0; i < num; i++)
+                {
+                    PalletCodes.Add(GetOrderPintCode("PalletCodes"));
+                }
+                PrintPallet(PalletCodes);
+                return content.OK();
+            }
+            catch (Exception ex)
+            {
+                return content.Error(ex.Message);
+            }
+        }
+        public string GetOrderPintCode(string printCode)
+        {
+            string PrintCode = "";
+            var PrintSetting = SqlSugarHelper.DbWMS.Queryable<Dt_PrintSetting>().Where(x => x.PrintCode == printCode).ToList().FirstOrDefault();
+
+            if (PrintSetting.Spare1 == DateTime.Now.ToString("yyyyMMdd"))
+            {
+                PrintCode = PrintSetting.Spare1 + PrintSetting.PrintNo.ToString().PadLeft(PrintSetting.Spare2, '0');
+                PrintSetting.PrintNo = PrintSetting.PrintNo + 1;
+            }
+            else
+            {
+                PrintSetting.Spare1 = DateTime.Now.ToString("yyyyMMdd");
+                PrintSetting.PrintNo = 2;
+                PrintCode = PrintSetting.Spare1 + 1.ToString().PadLeft(PrintSetting.Spare2, '0');
+            }
+            SqlSugarHelper.DbWMS.Updateable(PrintSetting).ExecuteCommand();
+            return PrintCode;
+        }
+        public void PrintPallet(List<string> palletCodes)
+        {
+            var configs = _configService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
+            var Base = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.PrintIPAddress)?.ConfigValue;
+            var ipAddress = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.PrintPalletCodes)?.ConfigValue;
+            if (Base == null || ipAddress == null)
+            {
+                throw new InvalidOperationException("WMS IP 鏈厤缃�");
+            }
+            var IpAddress = Base + ipAddress;
+            var result = HttpsClient.PostAsync(IpAddress, palletCodes.ToJsonString()).Result;
+        }
+
+        public void PrintInbound(List<Dt_InboundOrder> orders)
+        {
+            var configs = _configService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
+            var Base = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.PrintIPAddress)?.ConfigValue;
+            var ipAddress = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.PrintInboundOrder)?.ConfigValue;
+            if (Base == null || ipAddress == null)
+            {
+                throw new InvalidOperationException("WMS IP 鏈厤缃�");
+            }
+            var IpAddress = Base + ipAddress;
+            var result = HttpsClient.PostAsync(IpAddress, orders.ToJsonString()).Result;
+        }
     }
 }

--
Gitblit v1.9.3