yangpeixing
18 小时以前 027b75833ae1bc3bd1bb597b18c65c9177fa62d4
ÏîÄ¿´úÂë/WMS/WIDESEA_WMSServer/WIDESEA_OrderServices/Dt_InboundOrderService.cs
@@ -1,4 +1,5 @@
using MailKit.Search;
using AngleSharp.Dom;
using MailKit.Search;
using Masuit.Tools;
using Newtonsoft.Json;
using WIDESEA_Common;
@@ -16,6 +17,7 @@
using WIDESEA_Model.Models;
using WIDESEA_Model.Models.Order;
using WIDESEA_OrderRepository;
using WIDESEA_StorageTaskServices;
namespace WIDESEA_OrderServices
{
@@ -24,15 +26,18 @@
        private readonly IUnitOfWorkManage _unitOfWorkManage;
        private readonly ISys_ConfigService _configService;
        private readonly IDt_WareAreaInfoRepository _wareAreaInfoRepository;
        private readonly PrintStatusContainer _printStatusContainer;
        public Dt_InboundOrderService(IDt_InboundOrderRepository BaseDal,
                                        IUnitOfWorkManage unitOfWorkManage,
                                        ISys_ConfigService configService,
                                        IDt_WareAreaInfoRepository wareAreaInfoRepository) : base(BaseDal)
                                        IDt_WareAreaInfoRepository wareAreaInfoRepository,
                                        PrintStatusContainer printStatusContainer) : base(BaseDal)
        {
            _unitOfWorkManage = unitOfWorkManage;
            _configService = configService;
            _wareAreaInfoRepository = wareAreaInfoRepository;
            _printStatusContainer = printStatusContainer;
        }
        public override WebResponseContent UpdateData(SaveModel saveModel)
@@ -50,6 +55,11 @@
            return base.UpdateData(saveModel);
        }
        /// <summary>
        /// æŸ¥è¯¢å…¥åº“单据信息
        /// </summary>
        /// <param name="OrderNo"></param>
        /// <returns></returns>
        public WebResponseContent GetInboundOrderInfo(string OrderNo)
        {
            WebResponseContent content=new WebResponseContent();
@@ -67,6 +77,12 @@
                return content.Error(ex.Message);
            }
        }
        /// <summary>
        /// æ‰“印
        /// </summary>
        /// <param name="keys"></param>
        /// <returns></returns>
        public WebResponseContent PrintOrder(int[] keys)
        {
            WebResponseContent content = new WebResponseContent();
@@ -81,7 +97,7 @@
                        inboundOrders.Add(InboundOrder);
                    }
                }
                content=PrintInbound(inboundOrders);
                content = PrintInbound(inboundOrders);
                return content;
            }
            catch (Exception ex)
@@ -90,6 +106,42 @@
            }
        }
        /// <summary>
        /// å¤šæ¬¡æ‰“印
        /// </summary>
        /// <param name="keys"></param>
        /// <param name="num"></param>
        /// <returns></returns>
        public WebResponseContent MultiplePrintOrder(int keys,int num)
        {
            WebResponseContent content = new WebResponseContent();
            try
            {
                List<Dt_InboundOrder> inboundOrders = new List<Dt_InboundOrder>();
                var InboundOrder = BaseDal.QueryFirst(x => x.Id == keys);
                for (int i = 0; i < num; i++)
                {
                    if (InboundOrder != null)
                    {
                        inboundOrders.Add(InboundOrder);
                    }
                }
                content = PrintInbound(inboundOrders);
                return content;
            }
            catch (Exception ex)
            {
                return content.Error("未知错误,请联系管理员");
            }
        }
        /// <summary>
        /// æ‹†åˆ†
        /// </summary>
        /// <param name="id"></param>
        /// <param name="num"></param>
        /// <returns></returns>
        public WebResponseContent SplitOrder(int id,int num)
        {
            WebResponseContent content = new WebResponseContent();
@@ -100,7 +152,7 @@
                {
                    return content.Error("未找到该入库单信息");
                }
                if(originalOrder.Quantity < num || num <= 0)
                if(originalOrder.Quantity < num || num <= 0 || originalOrder.Quantity - num == 0)
                {
                    return content.Error("拆分数量不合法");
                }
@@ -123,7 +175,6 @@
                    Texture = originalOrder.Texture,
                    Quantity = num,
                    OrderStatus = originalOrder.OrderStatus,
                };
                originalOrder.Quantity = originalOrder.Quantity - num;
@@ -137,6 +188,12 @@
            }
        }
        /// <summary>
        /// æ‰“印托盘码
        /// </summary>
        /// <param name="num"></param>
        /// <returns></returns>
        public WebResponseContent PrintPalletCode(int num)
        {
            WebResponseContent content = new WebResponseContent();
@@ -155,6 +212,12 @@
                return content.Error("未知错误,请联系管理员");
            }
        }
        /// <summary>
        /// èŽ·å–è®¢å•ç¼–å·
        /// </summary>
        /// <param name="printCode"></param>
        /// <returns></returns>
        public string GetOrderPintCode(string printCode)
        {
            string PrintCode = "";
@@ -174,6 +237,13 @@
            SqlSugarHelper.DbWMS.Updateable(PrintSetting).ExecuteCommand();
            return PrintCode;
        }
        /// <summary>
        /// è°ƒç”¨æ‰“印托盘码接口
        /// </summary>
        /// <param name="palletCodes"></param>
        /// <returns></returns>
        /// <exception cref="InvalidOperationException"></exception>
        public WebResponseContent PrintPallet(List<string> palletCodes)
        {
            var configs = _configService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
@@ -188,6 +258,12 @@
            return JsonConvert.DeserializeObject<WebResponseContent>(result);
        }
        /// <summary>
        /// è°ƒç”¨æ‰“印单据接口
        /// </summary>
        /// <param name="orders"></param>
        /// <returns></returns>
        /// <exception cref="InvalidOperationException"></exception>
        public WebResponseContent PrintInbound(List<Dt_InboundOrder> orders)
        {
            var configs = _configService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
@@ -201,5 +277,22 @@
            var result = HttpsClient.PostAsync(IpAddress, orders.ToJsonString()).Result;
            return JsonConvert.DeserializeObject<WebResponseContent>(result);
        }
        /// <summary>
        /// å¼€å¯è‡ªåŠ¨æ‰“å°
        /// </summary>
        /// <param name="AutomaticPrintStatus"></param>
        /// <exception cref="NotImplementedException"></exception>
        public void AutomaticPrint(string AutomaticPrintStatus)
        {
            if (AutomaticPrintStatus.Equals("false"))
            {
                _printStatusContainer.AutomaticPrint = false;
            }
            else
            {
                _printStatusContainer.AutomaticPrint = true;
            }
        }
    }
}