|
@@ -753,15 +753,16 @@ namespace wms.service.Service
|
|
|
{
|
|
|
foreach (var item in reqDto.listinfo)
|
|
|
{
|
|
|
- var boxrule = _boxrulerepository.AsQueryable().Where(x => x.DocsNo.Contains(item) && x.ZXStateCode == 0).ToList();
|
|
|
- if (boxrule.Any())
|
|
|
+ var boxrule = _boxrulerepository.AsQueryable().Where(x => x.DocsNo.Contains(item)).ToList();
|
|
|
+ var boxruleId= boxrule.Where(x => x.ZXStateCode == 0).Select(x=>x.Id).ToList();
|
|
|
+ if (boxruleId.Any())
|
|
|
{
|
|
|
_db.BeginTran();
|
|
|
_boxrulerepository.UpdateSetColumnsTrue(p => new BillPboxrule()
|
|
|
{
|
|
|
ZXStateCode = 2,
|
|
|
Memo = "工单终止,自动停用"
|
|
|
- }, x => x.DocsNo.Contains(item));
|
|
|
+ }, x => boxruleId.Contains(x.Id));
|
|
|
_db.CommitTran();
|
|
|
}
|
|
|
}
|
|
@@ -1467,7 +1468,7 @@ namespace wms.service.Service
|
|
|
// 提前查询并返回符合条件的 cell 列表
|
|
|
var cellQuery = _basewarecellrepository.AsQueryable()
|
|
|
.With(SqlWith.NoLock)
|
|
|
- .Where(p => p.IsStop == LocationStop.LocationInvoke.GetHashCode() && p.StateNum == LocationState.LocationState_Empty);
|
|
|
+ .Where(p => p.IsStop == LocationStop.LocationInvoke.GetHashCode() && p.StateNum == LocationState.LocationState_Empty); ;
|
|
|
|
|
|
var cell = new List<BaseWarecell>();
|
|
|
|
|
@@ -1475,15 +1476,11 @@ namespace wms.service.Service
|
|
|
var disabletunnels = _sysconfigrepository.GetList(p => p.SType == "InStop" && !string.IsNullOrEmpty(p.SContent));
|
|
|
if (disabletunnels != null && disabletunnels.Any())
|
|
|
{
|
|
|
- // 先提取禁用的巷道数据到集合中,item1 为巷道,item2 为楼层
|
|
|
- var disableTunnels = new List<Tuple<int, int>>();
|
|
|
-
|
|
|
foreach (var item in disabletunnels)
|
|
|
{
|
|
|
var distun = int.Parse(item.Default1);
|
|
|
var disfloor = int.Parse(item.Default2);
|
|
|
- disableTunnels.Add(new Tuple<int, int>(distun, disfloor));
|
|
|
- cellQuery.Where(x => x.Tunnel != distun && x.Floor != disfloor);
|
|
|
+ cellQuery.Where(x => !(x.Tunnel == distun && x.Floor == disfloor));
|
|
|
}
|
|
|
// 执行查询,获取最终的 cell 列表
|
|
|
cell = cellQuery.Clone().ToList();
|
|
@@ -1497,6 +1494,50 @@ namespace wms.service.Service
|
|
|
{
|
|
|
isTobeTors = true;
|
|
|
}
|
|
|
+
|
|
|
+ #region 检测库存占比是否符合要求
|
|
|
+
|
|
|
+ if (isTobeTors)
|
|
|
+ {
|
|
|
+ //扭转检测库存最大比
|
|
|
+ var torsInventoryRate = _sysconfigrepository.GetFirst(p => p.Code == "TorsInventoryRate").SContent;
|
|
|
+ var torsInventoryRateValue = decimal.Parse(torsInventoryRate) / 100;
|
|
|
+ //计算已使用货位占比
|
|
|
+ decimal cellCount = _basewarecellrepository.AsQueryable().With(SqlWith.NoLock).Where(p => p.Tunnel <= 2 && p.IsStop == LocationStop.LocationInvoke.GetHashCode()).Count();
|
|
|
+ decimal fullCellCount = _basewarecellrepository.AsQueryable().With(SqlWith.NoLock)
|
|
|
+ .Where(p => p.Tunnel <= 2 && p.IsStop == LocationStop.LocationInvoke.GetHashCode()
|
|
|
+ && p.StateNum != LocationState.LocationState_Empty).Count(); //所有不是空的货位都算作满货位
|
|
|
+ var fullCellRate = fullCellCount / cellCount;
|
|
|
+
|
|
|
+ if (fullCellRate >= torsInventoryRateValue)
|
|
|
+ {
|
|
|
+ result.ResData.TaskNo = 0;
|
|
|
+ result.ResMsg = reqDto.Code + $"扭转库存占比已达{ToPercentage(fullCellRate)},根据系统配置开始禁止入库";
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //码垛库存最大比
|
|
|
+ var palletizingInventoryRate = _sysconfigrepository.GetFirst(p => p.Code == "PalletizingInventoryRate").SContent;
|
|
|
+ var palletizingInventoryRateValue = decimal.Parse(palletizingInventoryRate) / 100;
|
|
|
+ //计算已使用货位占比
|
|
|
+ decimal cellCount = _basewarecellrepository.AsQueryable().With(SqlWith.NoLock).Where(p => p.Tunnel > 2 && p.IsStop == LocationStop.LocationInvoke.GetHashCode()).Count();
|
|
|
+ decimal fullCellCount = _basewarecellrepository.AsQueryable().With(SqlWith.NoLock)
|
|
|
+ .Where(p => p.Tunnel > 2 && p.IsStop == LocationStop.LocationInvoke.GetHashCode()
|
|
|
+ && p.StateNum != LocationState.LocationState_Empty).Count(); //所有不是空的货位都算作满货位
|
|
|
+ var fullCellRate = fullCellCount / cellCount;
|
|
|
+
|
|
|
+ if (fullCellRate >= palletizingInventoryRateValue)
|
|
|
+ {
|
|
|
+ result.ResData.TaskNo = 0;
|
|
|
+ result.ResMsg = reqDto.Code + $"码垛库存占比已达{ToPercentage(fullCellRate)},根据系统配置开始禁止入库";
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion 检测库存占比是否符合要求
|
|
|
+
|
|
|
var cellfloor1count = isTobeTors == true ? cell.Where(p => p.Floor == 1 && p.Tunnel <= tun).Count() : cell.Where(p => p.Floor == 1 && p.Tunnel > tun).Count(); //1楼层可用的货位数
|
|
|
var cellfloor2count = isTobeTors == true ? cell.Where(p => p.Floor == 2 && p.Tunnel <= tun).Count() : cell.Where(p => p.Floor == 2 && p.Tunnel > tun).Count(); //2楼层可用的货位数
|
|
|
var cellfloor3count = isTobeTors == true ? cell.Where(p => p.Floor == 3 && p.Tunnel <= tun).Count() : cell.Where(p => p.Floor == 3 && p.Tunnel > tun).Count(); //3楼层可用的货位数
|
|
@@ -1534,8 +1575,11 @@ namespace wms.service.Service
|
|
|
{
|
|
|
if (taskcount.Where(p => p.Floor == tempcells[2].Item1).Count() > floorTaskCount || tempcells[2].Item2 == 0)
|
|
|
{
|
|
|
+ var it1 = taskcount.Where(p => p.Floor == tempcells[0].Item1).Count();
|
|
|
+ var it2 = taskcount.Where(p => p.Floor == tempcells[1].Item1).Count();
|
|
|
+ var it3 = taskcount.Where(p => p.Floor == tempcells[2].Item1).Count();
|
|
|
result.ResData.TaskNo = 0;
|
|
|
- result.ResMsg = reqDto.Code + "当前环线三个楼层执行中的任务数已满,不允许分配楼层";
|
|
|
+ result.ResMsg = reqDto.Code + $"当前环线三个楼层执行中的任务数已满,不允许分配楼层1-{tempcells[0].Item1}:{it1}:{tempcells[0].Item2}--{tempcells[1].Item1}:{it2}:{tempcells[1].Item2}--{tempcells[2].Item1}:{it3}:{tempcells[2].Item2}";
|
|
|
result.ResData.Floor = 0;
|
|
|
return result;
|
|
|
}
|
|
@@ -1563,7 +1607,7 @@ namespace wms.service.Service
|
|
|
if (taskcount.Where(p => p.Floor == tempcells[2].Item1).Count() > floorTaskCount || tempcells[2].Item2 == 0)
|
|
|
{
|
|
|
result.ResData.TaskNo = 0;
|
|
|
- result.ResMsg = reqDto.Code + "当前环线三个楼层执行中的任务数已满,不允许分配楼层";
|
|
|
+ result.ResMsg = reqDto.Code + "当前环线三个楼层执行中的任务数已满,不允许分配楼层2";
|
|
|
result.ResData.Floor = 0;
|
|
|
return result;
|
|
|
}
|
|
@@ -1586,7 +1630,7 @@ namespace wms.service.Service
|
|
|
else
|
|
|
{
|
|
|
result.ResData.TaskNo = 0;
|
|
|
- result.ResMsg = reqDto.Code + "当前环线三个楼层执行中的任务数已满,不允许分配楼层";
|
|
|
+ result.ResMsg = reqDto.Code + "当前环线三个楼层执行中的任务数已满,不允许分配楼层3";
|
|
|
result.ResData.Floor = 0;
|
|
|
return result;
|
|
|
}
|
|
@@ -16081,10 +16125,10 @@ namespace wms.service.Service
|
|
|
{
|
|
|
invlist = invlist.Where(p => p.Wind == request.Wind);
|
|
|
}
|
|
|
- if (!string.IsNullOrEmpty(request.WbGroupCode))
|
|
|
- {
|
|
|
- invlist = invlist.Where(p => p.WbGroupCode == request.WbGroupCode);
|
|
|
- }
|
|
|
+ //if (!string.IsNullOrEmpty(request.WbGroupCode))
|
|
|
+ //{
|
|
|
+ // invlist = invlist.Where(p => p.WbGroupCode == request.WbGroupCode);
|
|
|
+ //}
|
|
|
if (!string.IsNullOrEmpty(request.HwType))
|
|
|
{
|
|
|
invlist = invlist.Where(p => p.HWTypeCode.Contains(request.HwType));
|
|
@@ -17467,5 +17511,15 @@ namespace wms.service.Service
|
|
|
_ => string.Empty // 默认值或其他处理
|
|
|
};
|
|
|
}
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 转换为百分比
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="value"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ private static string ToPercentage(decimal value)
|
|
|
+ {
|
|
|
+ return (value * 100).ToString("F2") + "%";
|
|
|
+ }
|
|
|
}
|
|
|
}
|