| | |
| | | using System; |
| | | 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_Core.Helper; |
| | | using WIDESEA_IBasicRepository; |
| | | using WIDESEA_IBasicService; |
| | | using WIDESEA_Model.Models; |
| | |
| | | public PalletTypeInfoService(IPalletTypeInfoRepository BaseDal) : base(BaseDal) |
| | | { |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 打印托盘码 |
| | | /// </summary> |
| | | /// <param name="num"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent PrintPalletCode(int num, string palletCodeType) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | List<string> PalletCodes = new List<string>(); |
| | | for (int i = 0; i < num; i++) |
| | | { |
| | | PalletCodes.Add(GetOrderPintCode($"{palletCodeType}PalletCodes",palletCodeType)); |
| | | } |
| | | content= PrintPallet(PalletCodes); |
| | | return content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content.Error("未知错误,请联系管理员"); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取订单编号 |
| | | /// </summary> |
| | | /// <param name="printCode"></param> |
| | | /// <returns></returns> |
| | | public string GetOrderPintCode(string printCode,string palletCodeType) |
| | | { |
| | | string PrintCode = ""; |
| | | var PrintSetting = Db.Queryable<Dt_PrintSetting>().Where(x => x.PrintCode == printCode).ToList().FirstOrDefault(); |
| | | |
| | | 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; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 调用打印托盘码接口 |
| | | /// </summary> |
| | | /// <param name="palletCodes"></param> |
| | | /// <returns></returns> |
| | | /// <exception cref="InvalidOperationException"></exception> |
| | | public WebResponseContent PrintPallet(List<string> palletCodes) |
| | | { |
| | | string url = "http://127.0.0.1:8098/Print/PrintPalletCode"; |
| | | HttpHelper.Post(url, palletCodes.Serialize()); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | } |
| | | } |