From 4a1765ea61fb8706bddbf90b91b310e2ce0e9f7d Mon Sep 17 00:00:00 2001
From: yangpeixing <yangpeixing@hnkhzn.com>
Date: 星期一, 02 三月 2026 14:59:48 +0800
Subject: [PATCH] 1
---
WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Base/PalletTypeInfoService.cs | 136 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 135 insertions(+), 1 deletions(-)
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Base/PalletTypeInfoService.cs b/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Base/PalletTypeInfoService.cs
index 0a5bb15..9fceff8 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Base/PalletTypeInfoService.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Base/PalletTypeInfoService.cs
@@ -1,9 +1,14 @@
-锘縰sing System;
+锘縰sing 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;
@@ -15,5 +20,134 @@
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($"PalletCodes",palletCodeType));
+ }
+ content= PrintPallet(PalletCodes);
+ foreach (var PalletCode in PalletCodes)
+ {
+ Console.WriteLine(PalletCode);
+ }
+ 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.Spare1 + PrintSetting.PrintNo.ToString().PadLeft(PrintSetting.Spare2, '0');
+ PrintSetting.PrintNo = PrintSetting.PrintNo + 1;
+ }
+ else
+ {
+ PrintSetting.Spare1 = DateTime.Now.ToString("yyyyMMdd");
+ PrintSetting.PrintNo = 2;
+ PrintCode = palletCodeType+PrintSetting.Spare1 + 1.ToString().PadLeft(PrintSetting.Spare2, '0');
+ }
+ 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();
+ }
+
+ /// <summary>
+ /// 鑾峰彇鎵樼洏鏍囪瘑
+ /// </summary>
+ /// <returns></returns>
+ /// <exception cref="NotImplementedException"></exception>
+ public WebResponseContent GetPalletTypeInfos(int WarehouseId)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ List<Dt_PalletTypeInfo> dt_PalletTypeInfos = BaseDal.QueryData(x => x.WarehouseId == WarehouseId);
+ return content.OK(data: dt_PalletTypeInfos);
+ }
+ catch(Exception ex)
+ {
+ return content.Error();
+ }
+ }
+
+ public WebResponseContent GetWarehouses()
+ {
+ WebResponseContent content = new WebResponseContent();
+
+ try
+ {
+ List<Dt_PalletTypeInfo> dt_PalletTypeInfos = BaseDal.QueryData(x => x);
+ List<Dt_Warehouse> dt_Warehouses = new List<Dt_Warehouse>();
+ foreach (var item in dt_PalletTypeInfos)
+ {
+ Dt_Warehouse dt_Warehouse = Db.Queryable<Dt_Warehouse>().First(x => x.WarehouseId == item.WarehouseId);
+ dt_Warehouses.Add(dt_Warehouse);
+ }
+ List<Dt_Warehouse> NewDt_Warehouses = new List<Dt_Warehouse>();
+ NewDt_Warehouses.AddRange(dt_Warehouses.DistinctBy(x => x.WarehouseId));
+ return content.OK(data: NewDt_Warehouses);
+ }
+ catch(Exception ex)
+ {
+ return content.Error();
+ }
+
+ }
+
+ public override WebResponseContent UpdateData(SaveModel saveModel)
+ {
+ var id = saveModel.MainData["id"].ObjToInt();
+ var palletType = saveModel.MainData["palletType"].ObjToInt();
+ var typeName = saveModel.MainData["typeName"].ToString();
+ var length = saveModel.MainData["length"].ObjToInt();
+ var width = saveModel.MainData["width"].ObjToInt();
+ var height = saveModel.MainData["height"].ObjToInt();
+ var locationCount = saveModel.MainData["locaitonCount"].ObjToInt();
+ Dt_PalletTypeInfo palletTypeInfo = BaseDal.QueryFirst(x => x.Id == id);
+ palletTypeInfo.PalletType = palletType;
+ palletTypeInfo.TypeName = typeName;
+ palletTypeInfo.Length = length;
+ palletTypeInfo.Width = width;
+ palletTypeInfo.Height = height;
+ palletTypeInfo.LocaitonCount = locationCount;
+
+ return base.UpdateData(palletTypeInfo);
+ }
}
}
--
Gitblit v1.9.3