From b2cc7bb7740e42e57cf50af02a8ca4b535cad484 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期三, 11 三月 2026 17:02:21 +0800
Subject: [PATCH] 优化WMS接口逻辑
---
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/KLSLocationInfoService.cs | 68 +++++++++++++++++++++++++++++++++-
1 files changed, 66 insertions(+), 2 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/KLSLocationInfoService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/KLSLocationInfoService.cs"
index ba9b8bd..124ba42 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/KLSLocationInfoService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/KLSLocationInfoService.cs"
@@ -1,10 +1,17 @@
-锘縰sing System;
+锘縰sing OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
+using SqlSugar;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using WIDESEA_DTO.Basic;
+using WIDESEAWCS_Common.LocationEnum;
+using WIDESEAWCS_Core;
using WIDESEAWCS_Core.BaseRepository;
using WIDESEAWCS_Core.BaseServices;
+using WIDESEAWCS_Core.Helper;
+using WIDESEAWCS_Core.Utilities;
using WIDESEAWCS_IBasicInfoService;
using WIDESEAWCS_Model.Models;
@@ -15,7 +22,64 @@
public KLSLocationInfoService(IRepository<Dt_KLSLocationInfo> BaseDal) : base(BaseDal)
{
}
-
+ private Dictionary<string, OrderByType> _emptyAssignOrderBy = new Dictionary<string, OrderByType>()
+ {
+ { nameof(Dt_KLSLocationInfo.Depth), OrderByType.Desc },
+ { nameof(Dt_KLSLocationInfo.Layer), OrderByType.Asc },
+ { nameof(Dt_KLSLocationInfo.Column), OrderByType.Asc },
+ { nameof(Dt_KLSLocationInfo.Row), OrderByType.Asc },
+ };
public IRepository<Dt_KLSLocationInfo> Repository => BaseDal;
+ /// <summary>
+ /// 鑾峰彇鍙敤绌鸿揣浣�
+ /// </summary>
+ /// <param name="AreaCode"></param>
+ /// <param name="containerType"></param>
+ /// <returns></returns>
+ public Dt_KLSLocationInfo GetFreeLocationInfo(string AreaCode, int containerType)
+ {
+ Dt_KLSLocationInfo? kLSLocationInfo = BaseDal.QueryFirst(x => x.WarehouseId.ToString() == AreaCode && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.LocationType == containerType,_emptyAssignOrderBy);
+ return kLSLocationInfo;
+ }
+
+ public WebResponseContent InitializationLocation(InitializationLocationDTO initializationLocationDTO)
+ {
+ try
+ {
+ (bool, string, object?) result = ModelValidate.ValidateModelData(initializationLocationDTO);
+ if (!result.Item1) return WebResponseContent.Instance.Error(result.Item2);
+
+ List<Dt_KLSLocationInfo> locationInfos = new List<Dt_KLSLocationInfo>();
+ for (int i = 9; i < initializationLocationDTO.MaxRow; i++)
+ {
+ for (int j = 0; j < initializationLocationDTO.MaxColumn; j++)
+ {
+ for (int k = 0; k < initializationLocationDTO.MaxLayer; k++)
+ {
+ Dt_KLSLocationInfo locationInfo = new Dt_KLSLocationInfo()
+ {
+ Column = j + 1,
+ EnableStatus = EnableStatusEnum.Normal.ObjToInt(),
+ Layer = k + 1,
+ LocationStatus = LocationStatusEnum.Free.ObjToInt(),
+ RoadwayNo = $"{initializationLocationDTO.Roadway}",
+ Row = i + 1,
+ LocationType = LocationTypeEnum.SmallPallet.ObjToInt(),
+ Depth = initializationLocationDTO.Depth,
+ };
+ locationInfo.LocationCode = $"{locationInfo.Row.ToString().PadLeft(3, '0')}-{locationInfo.Column.ToString().PadLeft(3, '0')}-{locationInfo.Layer.ToString().PadLeft(3, '0')}";
+ locationInfo.LocationName = $"{locationInfo.Row.ToString().PadLeft(3, '0')}琛寋locationInfo.Column.ToString().PadLeft(3, '0')}鍒梴locationInfo.Layer.ToString().PadLeft(3, '0')}灞�";
+ locationInfos.Add(locationInfo);
+ }
+ }
+ }
+ BaseDal.AddData(locationInfos);
+ return WebResponseContent.Instance.OK();
+ }
+ catch (Exception ex)
+ {
+ return WebResponseContent.Instance.Error(ex.Message);
+ }
+ }
}
}
--
Gitblit v1.9.3