| | |
| | | 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 |
| | | { |
| | |
| | | } |
| | | 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; } |