| | |
| | | using SqlSugar; |
| | | 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_Common.LocationEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.Enums; |
| | |
| | | (bool, string, object?) result = ModelValidate.ValidateModelData(initializationLocationDTO); |
| | | if (!result.Item1) return WebResponseContent.Instance.Error(result.Item2); |
| | | |
| | | int side = 1; |
| | | int depth = initializationLocationDTO.Depth; |
| | | List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>(); |
| | | for (int i = 0; i < initializationLocationDTO.MaxRow; i++) |
| | | { |
| | | if((i + 1) % initializationLocationDTO.MaxRow == 1) |
| | | { |
| | | depth = initializationLocationDTO.Depth; |
| | | } |
| | | else if ((i + 1) % initializationLocationDTO.MaxRow == initializationLocationDTO.Depth + 1) |
| | | { |
| | | depth = 1; |
| | | } |
| | | else if ((i + 1) % initializationLocationDTO.MaxRow > 1 && (i + 1) % initializationLocationDTO.MaxRow <= initializationLocationDTO.Depth) |
| | | { |
| | | depth -= 1; |
| | | } |
| | | else |
| | | { |
| | | depth += 1; |
| | | } |
| | | for (int j = 0; j < initializationLocationDTO.MaxColumn; j++) |
| | | { |
| | | for (int k = 0; k < initializationLocationDTO.MaxLayer; k++) |
| | |
| | | EnableStatus = EnableStatusEnum.Normal.ObjToInt(), |
| | | Layer = k + 1, |
| | | LocationStatus = LocationStatusEnum.Free.ObjToInt(), |
| | | LocationType = LocationTypeEnum.Cube.ObjToInt(), |
| | | RoadwayNo = initializationLocationDTO.Roadway, |
| | | LocationType = LocationTypeEnum.Undefined.ObjToInt(), |
| | | RoadwayNo = $"R{initializationLocationDTO.Roadway.ToString()}", |
| | | Row = i + 1, |
| | | Depth = depth, |
| | | }; |
| | | |
| | | if (initializationLocationDTO.IsSingleDepth) |
| | | { |
| | | locationInfo.Depth = 1; |
| | | locationInfo.LocationCode = $"R{initializationLocationDTO.Roadway.ToString().PadLeft(2, '0')}-{locationInfo.Row.ToString().PadLeft(3, '0')}-{locationInfo.Column.ToString().PadLeft(3, '0')}-{locationInfo.Layer.ToString().PadLeft(3, '0')}-{locationInfo.Depth.ToString().PadLeft(2, '0')}"; |
| | | locationInfo.LocationName = $"R{initializationLocationDTO.Roadway.ToString().PadLeft(2, '0')}å··é{locationInfo.Row.ToString().PadLeft(3, '0')}è¡{locationInfo.Column.ToString().PadLeft(3, '0')}å{locationInfo.Layer.ToString().PadLeft(3, '0')}å±{locationInfo.Depth.ToString().PadLeft(2, '0')}æ·±"; |
| | | } |
| | | else |
| | | { |
| | | if (initializationLocationDTO.FirstDepthRows.Contains(i + 1)) |
| | | { |
| | | locationInfo.Depth = 1; |
| | | } |
| | | else |
| | | { |
| | | locationInfo.Depth = 2; |
| | | } |
| | | locationInfo.LocationCode = $"R{initializationLocationDTO.Roadway.ToString().PadLeft(2, '0')}-{locationInfo.Row.ToString().PadLeft(3, '0')}-{locationInfo.Column.ToString().PadLeft(3, '0')}-{locationInfo.Layer.ToString().PadLeft(3, '0')}-{locationInfo.Depth.ToString().PadLeft(2, '0')}"; |
| | | locationInfo.LocationName = $"R{initializationLocationDTO.Roadway.ToString().PadLeft(2, '0')}å··é{locationInfo.Row.ToString().PadLeft(3, '0')}è¡{locationInfo.Column.ToString().PadLeft(3, '0')}å{locationInfo.Layer.ToString().PadLeft(3, '0')}å±{locationInfo.Depth.ToString().PadLeft(2, '0')}æ·±"; |
| | | } |
| | | |
| | | locationInfo.LocationCode = $"{locationInfo.RoadwayNo}-{locationInfo.Row.ToString().PadLeft(3, '0')}-{locationInfo.Column.ToString().PadLeft(3, '0')}-{locationInfo.Layer.ToString().PadLeft(3, '0')}-{locationInfo.Depth.ToString().PadLeft(2, '0')}"; |
| | | locationInfo.LocationName = $"{locationInfo.RoadwayNo}å··é{locationInfo.Row.ToString().PadLeft(3, '0')}è¡{locationInfo.Column.ToString().PadLeft(3, '0')}å{locationInfo.Layer.ToString().PadLeft(3, '0')}å±{locationInfo.Depth.ToString().PadLeft(2, '0')}æ·±"; |
| | | locationInfos.Add(locationInfo); |
| | | } |
| | | } |
| | | } |
| | | |
| | | BaseDal.AddData(locationInfos); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |