增加空货架、非空货架 状态更新 并且呼叫空货架接口增加空货架限制
This commit is contained in:
@ -17,31 +17,35 @@ namespace WCS.BLL.Manager
|
|||||||
public static object flag = new object();
|
public static object flag = new object();
|
||||||
public static void UpdateShelfStatus()
|
public static void UpdateShelfStatus()
|
||||||
{
|
{
|
||||||
lock (flag)
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
var shelfIds = DbHelp.db.Queryable<MatDetailCurrentInfo>()
|
lock (flag)
|
||||||
.Select(t => t.ShelfId)
|
{
|
||||||
.Distinct()
|
var shelfIds = DbHelp.db.Queryable<MatDetailCurrentInfo>()
|
||||||
.ToList();
|
.Select(t => t.ShelfId)
|
||||||
var shelfInfos = DbHelp.db.Queryable<ShelfInfo>().ToList();
|
.Distinct()
|
||||||
|
.ToList();
|
||||||
|
var shelfInfos = DbHelp.db.Queryable<ShelfInfo>().ToList();
|
||||||
|
|
||||||
var notEmptyToEmpty = shelfInfos.Where(t => t.ShelfStatus == ShelfStatusEnum.非空货架)
|
var notEmptyToEmpty = shelfInfos.Where(t => t.ShelfStatus == ShelfStatusEnum.非空货架)
|
||||||
.Where(t => !shelfIds.Contains(t.Id))
|
.Where(t => !shelfIds.Contains(t.Id))
|
||||||
.ToList();
|
.ToList();
|
||||||
notEmptyToEmpty.ForEach(t => t.ShelfStatus = ShelfStatusEnum.空货架);
|
notEmptyToEmpty.ForEach(t => t.ShelfStatus = ShelfStatusEnum.空货架);
|
||||||
|
|
||||||
var emptyToNotEmpty = shelfInfos.Where(t => t.ShelfStatus == ShelfStatusEnum.空货架)
|
var emptyToNotEmpty = shelfInfos.Where(t => t.ShelfStatus == ShelfStatusEnum.空货架)
|
||||||
.Where(t => shelfIds.Contains(t.Id))
|
.Where(t => shelfIds.Contains(t.Id))
|
||||||
.ToList();
|
.ToList();
|
||||||
emptyToNotEmpty.ForEach(t => t.ShelfStatus = ShelfStatusEnum.非空货架);
|
emptyToNotEmpty.ForEach(t => t.ShelfStatus = ShelfStatusEnum.非空货架);
|
||||||
|
|
||||||
|
DbHelp.db.Updateable(notEmptyToEmpty)
|
||||||
|
.UpdateColumns(t => new { t.ShelfStatus })
|
||||||
|
.ExecuteCommand();
|
||||||
|
DbHelp.db.Updateable(emptyToNotEmpty)
|
||||||
|
.UpdateColumns(t => new { t.ShelfStatus })
|
||||||
|
.ExecuteCommand();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
DbHelp.db.Updateable(notEmptyToEmpty)
|
|
||||||
.UpdateColumns(t => new { t.ShelfStatus })
|
|
||||||
.ExecuteCommand();
|
|
||||||
DbHelp.db.Updateable(emptyToNotEmpty)
|
|
||||||
.UpdateColumns(t => new { t.ShelfStatus })
|
|
||||||
.ExecuteCommand();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -166,6 +166,7 @@ namespace WCS.BLL.Services.Service
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
DbHelp.db.CommitTran();
|
DbHelp.db.CommitTran();
|
||||||
|
DataProcessManager.UpdateShelfStatus();
|
||||||
return new ResponseCommon<Object>
|
return new ResponseCommon<Object>
|
||||||
{
|
{
|
||||||
Code = 200,
|
Code = 200,
|
||||||
@ -226,6 +227,7 @@ namespace WCS.BLL.Services.Service
|
|||||||
var deleteRows = await DbHelp.db.Deleteable(matDetailCurrentInfos).ExecuteCommandAsync();
|
var deleteRows = await DbHelp.db.Deleteable(matDetailCurrentInfos).ExecuteCommandAsync();
|
||||||
|
|
||||||
DbHelp.db.CommitTran();
|
DbHelp.db.CommitTran();
|
||||||
|
DataProcessManager.UpdateShelfStatus();
|
||||||
return new ResponseCommon<Object>
|
return new ResponseCommon<Object>
|
||||||
{
|
{
|
||||||
Code = 200,
|
Code = 200,
|
||||||
@ -467,6 +469,7 @@ namespace WCS.BLL.Services.Service
|
|||||||
|
|
||||||
}
|
}
|
||||||
await DbHelp.db.CommitTranAsync();
|
await DbHelp.db.CommitTranAsync();
|
||||||
|
DataProcessManager.UpdateShelfStatus();
|
||||||
return new ResponseCommon<List<string>>()
|
return new ResponseCommon<List<string>>()
|
||||||
{
|
{
|
||||||
Code = 200,
|
Code = 200,
|
||||||
|
@ -232,6 +232,7 @@ namespace WCS.BLL.Services.Service
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
DbHelp.db.CommitTran();
|
DbHelp.db.CommitTran();
|
||||||
|
DataProcessManager.UpdateShelfStatus();
|
||||||
return new ResponseCommon<Object>
|
return new ResponseCommon<Object>
|
||||||
{
|
{
|
||||||
Code = 200,
|
Code = 200,
|
||||||
@ -294,6 +295,7 @@ namespace WCS.BLL.Services.Service
|
|||||||
var deleteRows = await DbHelp.db.Deleteable(matDetailCurrentInfos).ExecuteCommandAsync();
|
var deleteRows = await DbHelp.db.Deleteable(matDetailCurrentInfos).ExecuteCommandAsync();
|
||||||
|
|
||||||
DbHelp.db.CommitTran();
|
DbHelp.db.CommitTran();
|
||||||
|
DataProcessManager.UpdateShelfStatus();
|
||||||
return new ResponseCommon<Object>
|
return new ResponseCommon<Object>
|
||||||
{
|
{
|
||||||
Code = 200,
|
Code = 200,
|
||||||
|
@ -82,6 +82,7 @@ namespace WCS.BLL.Services.Service
|
|||||||
//获取空货架进行呼叫
|
//获取空货架进行呼叫
|
||||||
shelf = await DbHelp.db.Queryable<ShelfInfo>()
|
shelf = await DbHelp.db.Queryable<ShelfInfo>()
|
||||||
.Where(t => t.TransStatus == TransStatusEnum.静止 && t.CurrentLocationId != 0)
|
.Where(t => t.TransStatus == TransStatusEnum.静止 && t.CurrentLocationId != 0)
|
||||||
|
.Where(t => t.ShelfStatus == ShelfStatusEnum.空货架)
|
||||||
.Where(t => t.ShelfTypeId == request.NeedShelfTypeId)
|
.Where(t => t.ShelfTypeId == request.NeedShelfTypeId)
|
||||||
.Where(t => t.IsEnable == true)
|
.Where(t => t.IsEnable == true)
|
||||||
.FirstAsync();
|
.FirstAsync();
|
||||||
|
@ -1541,6 +1541,7 @@ namespace WCS.BLL.Services.Service
|
|||||||
DbHelp.db.Updateable(stocktakingInfo).ExecuteCommand();
|
DbHelp.db.Updateable(stocktakingInfo).ExecuteCommand();
|
||||||
}
|
}
|
||||||
DbHelp.db.CommitTran();
|
DbHelp.db.CommitTran();
|
||||||
|
DataProcessManager.UpdateShelfStatus();
|
||||||
return new ResponseCommon<object>()
|
return new ResponseCommon<object>()
|
||||||
{
|
{
|
||||||
Code = 200,
|
Code = 200,
|
||||||
|
@ -405,6 +405,7 @@ namespace WCS.WebApi.Controllers
|
|||||||
DbHelp.db.Insertable(historyInfo).ExecuteCommand();
|
DbHelp.db.Insertable(historyInfo).ExecuteCommand();
|
||||||
|
|
||||||
DbHelp.db.CommitTran();
|
DbHelp.db.CommitTran();
|
||||||
|
DataProcessManager.UpdateShelfStatus();
|
||||||
return new ResponseCommon()
|
return new ResponseCommon()
|
||||||
{
|
{
|
||||||
Code = 200,
|
Code = 200,
|
||||||
|
@ -203,6 +203,7 @@ namespace WCS.WebApi.Controllers
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
DbHelp.db.CommitTran();
|
DbHelp.db.CommitTran();
|
||||||
|
DataProcessManager.UpdateShelfStatus();
|
||||||
return new ResponseCommon<Object>
|
return new ResponseCommon<Object>
|
||||||
{
|
{
|
||||||
Code = 200,
|
Code = 200,
|
||||||
@ -347,6 +348,7 @@ namespace WCS.WebApi.Controllers
|
|||||||
}
|
}
|
||||||
DbHelp.db.Deleteable(matCurrentInfos).ExecuteCommand();
|
DbHelp.db.Deleteable(matCurrentInfos).ExecuteCommand();
|
||||||
DbHelp.db.CommitTran();
|
DbHelp.db.CommitTran();
|
||||||
|
DataProcessManager.UpdateShelfStatus();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -369,6 +371,7 @@ namespace WCS.WebApi.Controllers
|
|||||||
//库存更新记录
|
//库存更新记录
|
||||||
//全部删除 删除数量为0的
|
//全部删除 删除数量为0的
|
||||||
DbHelp.db.Deleteable(matCurrentInfos).ExecuteCommand();
|
DbHelp.db.Deleteable(matCurrentInfos).ExecuteCommand();
|
||||||
|
DataProcessManager.UpdateShelfStatus();
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user