using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Text; using System.Threading.Tasks; using WIDESEA_Core; using WIDESEA_Core.BaseServices; using WIDESEA_Core.Const; using WIDESEA_IBasicRepository; using WIDESEA_IBasicService; using WIDESEA_Model.Models; namespace WIDESEA_BasicService.Base { public partial class PalletTypeInfoService : ServiceBase, IPalletTypeInfoService { public PalletTypeInfoService(IPalletTypeInfoRepository BaseDal) : base(BaseDal) { } /// /// 打印托盘码 /// /// /// public WebResponseContent PrintPalletCode(int num, string palletCodeType) { WebResponseContent content = new WebResponseContent(); try { List PalletCodes = new List(); for (int i = 0; i < num; i++) { //PalletCodes.Add(GetOrderPintCode("PalletCodes"),palletCodeType); } content= PrintPallet(PalletCodes); return content.OK(); } catch (Exception ex) { return content.Error("未知错误,请联系管理员"); } } /// /// 获取订单编号 /// /// /// public string GetOrderPintCode(string printCode,string palletCodeType) { string PrintCode = ""; //var PrintSetting = SqlSugarHelper.DbWMS.Queryable().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 WebResponseContent PrintPallet(List 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(); return WebResponseContent.Instance.OK(); } } }