| | |
| | | using System; |
| | | using 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; |
| | | |
| | |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | | } |