|
@@ -4795,12 +4795,12 @@ namespace wms.service.Service
|
|
|
if (findBestStackingPosition!=req.EquCode)//当前码垛位不是最近码垛位置
|
|
|
{
|
|
|
//查看最近码垛位是否存在未结束的码垛任务
|
|
|
- var used = _taskrepository.AsQueryable().With(SqlWith.NoLock).Any(x => x.AddrTo==findBestStackingPosition&&x.BusType== FJTaskBusType.环形库出库码垛任务.GetDescription());
|
|
|
+ var used = _taskrepository.AsQueryable().With(SqlWith.NoLock).Any(x => x.AddrTo==findBestStackingPosition&&x.BusType== FJTaskBusType.环形库出库码垛任务.GetDescription()&&x.Status< TaskStatus.Finish);
|
|
|
//无正在执行的任务,报错返回
|
|
|
if (!used)
|
|
|
{
|
|
|
res.ResCode = ResponseStatusCodeEnum.Fail.GetHashCode();
|
|
|
- res.ResMsg = "优先最近码垛位执行";
|
|
|
+ res.ResMsg = $"优先最近码垛位执行-{findBestStackingPosition}";
|
|
|
return res;
|
|
|
}
|
|
|
}
|
|
@@ -7170,118 +7170,6 @@ namespace wms.service.Service
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 获取环形库第一深度为空,第二深度有货的货位信息
|
|
|
- /// </summary>
|
|
|
- /// <param name="wareHouseId">仓库信息主键</param>
|
|
|
- /// <param name="depth">第一深度</param>
|
|
|
- /// <param name="size"></param>
|
|
|
- /// <returns></returns>
|
|
|
- public ISugarQueryable<BaseWarecell, BaseWarecell, BillInvnow> RingGetEmptyCell(long wareHouseId, int depth, long size) => GetEmptyCell(wareHouseId, depth, FjLocationType.RingLibrary, size);
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 获取第一深度为空,第二深度有货的货位信息
|
|
|
- /// </summary>
|
|
|
- /// <param name="wareHouseId">仓库信息主键</param>
|
|
|
- /// <param name="depth">第一深度</param>
|
|
|
- /// <param name="type">仓库类型</param>
|
|
|
- /// <param name="size">大小货位</param>
|
|
|
- /// <returns></returns>
|
|
|
- public ISugarQueryable<BaseWarecell, BaseWarecell, BillInvnow> GetEmptyCell(long wareHouseId, int depth, FjLocationType type, long size)
|
|
|
- {
|
|
|
- var nextDepth = depth + 1;
|
|
|
- return _basewarecellrepository.Context.Queryable<BaseWarecell, BaseWarecell, BillInvnow>((loc1, loc2, inv)
|
|
|
- => new object[]
|
|
|
- {
|
|
|
- JoinType.Inner,loc1.Shelf == loc2.Shelf && loc1.Col == loc2.Col && loc1.Layer == loc2.Layer ,
|
|
|
- JoinType.Inner, loc2.ContGrpBarCode == inv.ContGrpBarCode||loc2.ContGrpBarCode == inv.HWBarCode,
|
|
|
- })
|
|
|
- .Where((loc1, loc2, inv) => loc1.WarehouseId == wareHouseId && loc1.TypeNum == type && loc1.Depth == depth && loc1.StateNum == FjLocationState.Empty && loc1.IsStop == 0 && loc1.Size == size)
|
|
|
- .Where((loc1, loc2, inv) => (loc2.StateNum == FjLocationState.Full || loc2.StateNum == FjLocationState.StockIn) && loc2.Depth == nextDepth && loc2.IsStop == 0 && loc2.Size == size)
|
|
|
- .Where((loc1, loc2, inv) => inv.InvStateCode == InvState.InvEcecState_In.ToString() || inv.InvStateCode == InvState.InvEcecState_BuildUp.ToString());
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 获取环形库第一深度为空,第二深度有货的货位信息
|
|
|
- /// </summary>
|
|
|
- /// <param name="wareHouseId">仓库信息主键</param>
|
|
|
- /// <param name="depth">第一深度</param>
|
|
|
- /// <param name="size"></param>
|
|
|
- /// <returns></returns>
|
|
|
- public ISugarQueryable<BaseWarecell, BaseWarecell, BillInvnow> RingGetFullCell(long wareHouseId, int depth, long size) => GetEmptyCell(wareHouseId, depth, FjLocationType.RingLibrary, size);
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 获取第一深度为空,第二深度有货的货位信息
|
|
|
- /// </summary>
|
|
|
- /// <param name="wareHouseId">仓库信息主键</param>
|
|
|
- /// <param name="depth">第一深度</param>
|
|
|
- /// <param name="type">仓库类型</param>
|
|
|
- /// <param name="size">大小货位</param>
|
|
|
- /// <returns></returns>
|
|
|
- public ISugarQueryable<BaseWarecell, BaseWarecell, BillInvnow> GetFullCell(long wareHouseId, int depth, FjLocationType type, long size)
|
|
|
- {
|
|
|
- var nextDepth = depth + 1;
|
|
|
- return _basewarecellrepository.Context.Queryable<BaseWarecell, BaseWarecell, BillInvnow>((loc1, loc2, inv)
|
|
|
- => new object[]
|
|
|
- {
|
|
|
- JoinType.Inner,loc1.Shelf == loc2.Shelf && loc1.Col == loc2.Col && loc1.Layer == loc2.Layer ,
|
|
|
- JoinType.Inner, loc2.ContGrpBarCode == inv.ContGrpBarCode||loc2.ContGrpBarCode == inv.HWBarCode,
|
|
|
- })
|
|
|
- .Where((loc1, loc2, inv) => loc1.WarehouseId == wareHouseId && loc1.TypeNum == type && loc1.Depth == depth && loc1.StateNum == FjLocationState.Empty && loc1.IsStop == 0 && loc1.Size == size)
|
|
|
- .Where((loc1, loc2, inv) => (loc2.StateNum == FjLocationState.Full || loc2.StateNum == FjLocationState.StockIn) && loc2.Depth == nextDepth && loc2.IsStop == 0 && loc2.Size == size)
|
|
|
- .Where((loc1, loc2, inv) => inv.InvStateCode == InvState.InvEcecState_In.ToString() || inv.InvStateCode == InvState.InvEcecState_BuildUp.ToString());
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 获取前置深位为空的货位信息
|
|
|
- /// </summary>
|
|
|
- /// <param name="emptyLoc">可用深位集合</param>
|
|
|
- /// <param name="depth">前置深位</param>
|
|
|
- /// <returns></returns>
|
|
|
- public IEnumerable<string> GetEmptyCell(List<BaseWarecell> emptyLoc, int depth)
|
|
|
- {
|
|
|
- var nextDepth = depth + 1;
|
|
|
- return _basewarecellrepository.GetList(p => p.TypeNum == FjLocationType.RingLibrary && p.Depth == depth)
|
|
|
- .Join(emptyLoc.Where(p => p.Depth == nextDepth), loc1 => new { loc1.Col, loc1.Layer, loc1.Shelf }, loc2 => new { loc2.Col, loc2.Layer, loc2.Shelf }, (loc1, loc2) => loc2)
|
|
|
- .ToList().Select(x => x.Code);
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 执行并发锁
|
|
|
- /// 指定redis
|
|
|
- /// </summary>
|
|
|
- /// <param name="lockKey">并发锁key</param>
|
|
|
- /// <exception cref="Exception"></exception>
|
|
|
- public static SRes RedisExists(string lockKey, Action act)
|
|
|
- {
|
|
|
- lock (lockInOrOut)
|
|
|
- {
|
|
|
- lockKey = "ConcurrentLock:" + lockKey;
|
|
|
- var res = new SRes()
|
|
|
- {
|
|
|
- ResCode = ResponseStatusCodeEnum.Sucess.GetHashCode(),
|
|
|
- ResMsg = ResponseStatusCodeEnum.Sucess.GetDescription(),
|
|
|
- };
|
|
|
- try
|
|
|
- {
|
|
|
- if (RedisHelper.Exists(lockKey)) throw new Exception($"调用冲突:{lockKey}");
|
|
|
- RedisHelper.Expire(lockKey, 60);
|
|
|
- act();
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- res.ResCode = ResponseStatusCodeEnum.Fail.GetHashCode();
|
|
|
- res.ResMsg = $"{ex.Message}";
|
|
|
- }
|
|
|
- finally
|
|
|
- {
|
|
|
- RedisHelper.Del(lockKey);
|
|
|
- }
|
|
|
-
|
|
|
- return res;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 计算最佳码垛位置
|
|
|
/// </summary>
|