1
wankeda
2026-03-02 ea4adbde9c64181369161e851925e06d52260eba
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,10 +34,10 @@
                List<string> PalletCodes = new List<string>();
                for (int i = 0; i < num; i++)
                {
                    PalletCodes.Add(GetOrderPintCode($"{palletCodeType}PalletCodes",palletCodeType));
                    PalletCodes.Add(GetOrderPintCode($"PalletCodes",palletCodeType));
                }
                //content= PrintPallet(PalletCodes);
                foreach(var PalletCode in PalletCodes)
                content= PrintPallet(PalletCodes);
                foreach (var PalletCode in PalletCodes)
                {
                    Console.WriteLine(PalletCode);
                }
@@ -81,16 +82,72 @@
        /// <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();
        }
        /// <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);
        }
    }
}