| | |
| | | using Masuit.Tools; |
| | | using SqlSugar; |
| | | using WIDESEA_Common.CustomModels; |
| | | |
| | | //using WIDESEA_Common.CustomModels; |
| | |
| | | ConsoleHelper.WriteColorLine(station.Roadway, ConsoleColor.Magenta); |
| | | var stackers = station.Roadway.Split(',').ToList(); |
| | | |
| | | var devices = SqlSugarHelper.DbWCS.Queryable<Dt_DeviceInfo>() |
| | | var deviceCode = SqlSugarHelper.DbWCS.Queryable<Dt_DeviceInfo>() |
| | | .Where(x => x.DeviceStatus == "1") |
| | | .Where(x => stackers.Contains(x.DeviceCode)) |
| | | .ToList(); |
| | | .ToList().Select(x => x.DeviceCode).ToList(); |
| | | |
| | | var deviceCode = devices.Select(x => x.DeviceCode).ToList(); |
| | | // 从缓存中获取库存信息 |
| | | IDictionary<string, DtStockInfo>? stockInfos = _simpleCacheService.HashGetAll<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo); |
| | | List<DtStockInfo> stockInfoList = stockInfos.Values.ToList(); |
| | | |
| | | var result = await _stockInfoRepository.Db.Queryable<DtStockInfo>() |
| | | .Includes(x => x.LocationInfo) // 预加载LocationInfo |
| | | .Includes(x => x.StockInfoDetails) // 预加载StockInfoDetails |
| | | .Where(x => x.ProductionLine == productLine) |
| | | var result = stockInfoList.Where(x => x.ProductionLine == productLine) |
| | | .Where(x => x.AreaCode == areaCode && x.IsFull == false) |
| | | .Where(x => x.StockInfoDetails.Any(y => y.MaterielCode == "空托盘")) |
| | | .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID && x.LocationInfo.EnalbeStatus == (int)EnableEnum.Enable) // 过滤条件 |
| | | .WhereIF(!deviceCode.IsNullOrEmpty(), x => deviceCode.Contains(x.LocationInfo.RoadwayNo)) |
| | | .OrderBy(x => x.CreateDate) // 排序 |
| | | .FirstAsync(); // 转换为列表 |
| | | .FirstOrDefault(); // 转换为列表 |
| | | |
| | | //var firstOrDefault = result[0]; // 查找第一个匹配的元素 |
| | | //return firstOrDefault; |
| | | if (result != null) |
| | | { |
| | | stockInfoList = stockInfoList.Where(x => x != result).ToList(); |
| | | _simpleCacheService.HashDel<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, new string[] { result.PalletCode }); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | |
| | | Dt_StationManager station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == json.Position && x.stationType == 12 && x.stationArea == "Call"); |
| | | if (station == null) { throw new Exception($"未找到包装站台信息,请检查传入参数{json.Position}"); } |
| | | |
| | | var devices = SqlSugarHelper.DbWCS.Queryable<Dt_DeviceInfo>() |
| | | var deviceCode = SqlSugarHelper.DbWCS.Queryable<Dt_DeviceInfo>() |
| | | .Where(x => x.DeviceStatus == "1") |
| | | .Where(x => x.DeviceCode.Contains("CWSC")) // 过滤条件 |
| | | .ToList(); |
| | | var deviceCode = devices.Select(x => x.DeviceCode).ToList(); |
| | | .ToList().Select(x => x.DeviceCode).ToList(); |
| | | |
| | | //LogFactory.GetLog("常温3出库至包装").Info(true, $"常温3出库至包装传入参数:" + JsonConvert.SerializeObject(json, Formatting.Indented)); |
| | | var stockInfo = _stockInfoRepository.Db.Queryable<DtStockInfo>() |
| | | .Where(x => x.ProductionLine == station.productLine) |
| | | .Includes(x => x.LocationInfo) // 预加载LocationInfo |
| | | |
| | | // 从缓存中获取库存信息 |
| | | IDictionary<string, DtStockInfo>? stockInfos = _simpleCacheService.HashGetAll<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo); |
| | | List<DtStockInfo> stockInfoList = stockInfos.Values.ToList(); |
| | | |
| | | |
| | | |
| | | var stockInfo = stockInfoList.Where(x => x.ProductionLine == station.productLine) |
| | | .Where(x => x.AreaCode == "CWSC3" && x.IsFull == true) // 过滤条件 |
| | | .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock) // 过滤条件 |
| | | .WhereIF(!deviceCode.IsNullOrEmpty(), x => deviceCode.Contains(x.LocationInfo.RoadwayNo)) |
| | | .OrderBy(x => x.OutboundTime) // 排序 |
| | | .First(); // 获取第一个元素 |
| | | .FirstOrDefault(); // 获取第一个元素 |
| | | |
| | | //DtStockInfo stockInfo = _stockInfoRepository.QueryFirst(X => X.IsFull && X.AreaCode == "CWSC3" && X.ProductionLine == station.productLine); |
| | | if (stockInfo != null) |
| | | { |
| | | stockInfoList = stockInfoList.Where(x => x != stockInfo).ToList(); |
| | | _simpleCacheService.HashDel<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, new string[] { stockInfo.PalletCode }); |
| | | } |
| | | |
| | | |
| | | if (stockInfo == null) throw new Exception($"库内{station.productLine}无满足条件的库存可出库"); |
| | | |
| | | DtLocationInfo locationInfo = _locationRepository.QueryFirst(x => x.AreaId == 5 && x.LocationCode == stockInfo.LocationCode); |