1
yangpeixing
2026-01-22 16de8df813307d46a35f4816e5810350d26dd676
WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Base/PalletTypeInfoService.cs
@@ -8,6 +8,7 @@
using WIDESEA_Core;
using WIDESEA_Core.BaseServices;
using WIDESEA_Core.Const;
using WIDESEA_Core.Helper;
using WIDESEA_IBasicRepository;
using WIDESEA_IBasicService;
using WIDESEA_Model.Models;
@@ -33,7 +34,7 @@
                List<string> PalletCodes = new List<string>();
                for (int i = 0; i < num; i++)
                {
                    //PalletCodes.Add(GetOrderPintCode("PalletCodes"),palletCodeType);
                    PalletCodes.Add(GetOrderPintCode($"{palletCodeType}PalletCodes",palletCodeType));
                }
                content= PrintPallet(PalletCodes);
                return content.OK();
@@ -52,20 +53,20 @@
        public string GetOrderPintCode(string printCode,string palletCodeType)
        {
            string PrintCode = "";
            //var PrintSetting = SqlSugarHelper.DbWMS.Queryable<Dt_PrintSetting>().Where(x => x.PrintCode == printCode).ToList().FirstOrDefault();
            var PrintSetting = Db.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();
            if (PrintSetting.Spare1 == DateTime.Now.ToString("yyyyMMdd"))
            {
                PrintCode = palletCodeType+PrintSetting.PrintNo.ToString().PadLeft(PrintSetting.Spare2, '0')+PrintSetting.Spare1;
                PrintSetting.PrintNo = PrintSetting.PrintNo + 1;
            }
            else
            {
                PrintSetting.Spare1 = DateTime.Now.ToString("yyyyMMdd");
                PrintSetting.PrintNo = 2;
                PrintCode = palletCodeType+1.ToString().PadLeft(PrintSetting.Spare2, '0')+PrintSetting.Spare1;
            }
           Db.Updateable(PrintSetting).ExecuteCommand();
            return PrintCode;
        }
@@ -77,15 +78,8 @@
        /// <exception cref="InvalidOperationException"></exception>
        public WebResponseContent PrintPallet(List<string> palletCodes)
        {
            var Base = "";
            var ipAddress = "";
            if (Base == null || ipAddress == null)
            {
                throw new InvalidOperationException("WMS IP 未配置");
            }
            var IpAddress = Base + ipAddress;
            //var result = HttpsClient.PostAsync(palletCodes.ToJsonString()).Result;
            //return JsonConvert.DeserializeObject<WebResponseContent>();
            string url = "http://127.0.0.1:8098/Print/PrintPalletCode";
            HttpHelper.Post(url, palletCodes.Serialize());
            return WebResponseContent.Instance.OK();
        }
    }