| | |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.OrderEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.BaseServices; |
| | |
| | | using WIDESEA_IBasicRepository; |
| | | using WIDESEA_IBasicService; |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_Model.Models.Inbound; |
| | | |
| | | namespace WIDESEA_BasicService |
| | | { |
| | |
| | | //LocationType = LocationTypeEnum.Cube.ObjToInt(), |
| | | RoadwayNo = initializationLocationDTO.Roadway, |
| | | Row = i + 1, |
| | | Creater="WMS", |
| | | CreateDate = DateTime.Now, |
| | | }; |
| | | |
| | | 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')}深"; |
| | | locationInfo.LocationCode = $"{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 = $"{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 |
| | | { |
| | |
| | | { |
| | | 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 = $"{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 = $"{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')}深"; |
| | | } |
| | | |
| | | locationInfos.Add(locationInfo); |
| | |
| | | } |
| | | return groupLocations; |
| | | } |
| | | /// <summary> |
| | | /// 货位释放 |
| | | /// </summary> |
| | | /// <param name="locationCodes"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent LocationRelease(List<string> locationCodes) |
| | | { |
| | | try |
| | | { |
| | | if (locationCodes == null || locationCodes.Count == 0) |
| | | { |
| | | return WebResponseContent.Instance.Error("请提供货位编码"); |
| | | } |
| | | |
| | | List<Dt_LocationInfo> locationInfos = BaseDal.GetLocationInfos(locationCodes); |
| | | var matchedCodes = locationInfos.Select(x => x.LocationCode).ToList(); |
| | | var unmatchedCode = locationCodes.Except(matchedCodes).ToList(); |
| | | |
| | | if (unmatchedCode.Any()) |
| | | { |
| | | return WebResponseContent.Instance.Error($"以下货位编号{string.Join(",", unmatchedCode)}未找到货位信息"); |
| | | } |
| | | |
| | | foreach (var x in locationInfos) |
| | | { |
| | | if (x.EnableStatus == EnableStatusEnum.Disable.ObjToInt()|| x.EnableStatus == LocationStatusEnum.InStock.ObjToInt()) |
| | | { |
| | | return WebResponseContent.Instance.OK($"货位释放操作已终止,该货位{x.LocationCode}已禁用或处于有货状态"); |
| | | } |
| | | |
| | | if (x.LocationStatus == LocationStatusEnum.Lock.ObjToInt()) |
| | | { |
| | | Dt_ReturnOrder returnOrder = BaseDal.Db.Queryable<Dt_ReturnOrder>() |
| | | .Where(y => y.LocationCode == x.LocationCode && y.OrderStatus == InOrderStatusEnum.未开始.ObjToInt()) |
| | | .First(); |
| | | |
| | | if (returnOrder == null) |
| | | { |
| | | continue; |
| | | } |
| | | else |
| | | { |
| | | x.LocationStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | Repository.UpdateData(locationInfos); |
| | | return WebResponseContent.Instance.OK("货位释放成功"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | public class LocationCache |
| | | { |
| | | public string LocationCode { get; set; } |