任务完成时电梯任务数量减少,预任务生成时电梯任务数量增加
This commit is contained in:
@@ -28,6 +28,7 @@ using Microsoft.CodeAnalysis;
|
||||
using NPOI.HPSF;
|
||||
using NPOI.OpenXmlFormats.Wordprocessing;
|
||||
using Polly.Timeout;
|
||||
using Senparc.NeuChar.Helpers;
|
||||
using Senparc.Weixin.Work.AdvancedAPIs.OaDataOpen;
|
||||
using Spire.Pdf.Widget;
|
||||
using SqlSugar;
|
||||
@@ -243,7 +244,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
}
|
||||
foreach (var (i, v) in dic)
|
||||
{
|
||||
{
|
||||
foreach (var it in v)
|
||||
{
|
||||
it.groups = groupCode;
|
||||
@@ -382,16 +383,19 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
//更新任务执行表,单据状态为 完成
|
||||
await _db.Updateable<WmsDistaskH>().SetColumns(it => new WmsDistaskH { status = WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID }).Where(it => input.disTaskIds.Contains(it.id)).ExecuteCommandAsync();
|
||||
//更新预任务申请表,单据状态为 已完成
|
||||
var disTasks = await _db.Queryable<WmsDistaskH>().InnerJoin<WmsCarryH>((a, b) => a.carry_id == b.id).Where(a => input.disTaskIds.Contains(a.id)).Select((a, b) => new WmsDistaskH { carry_status = b.carry_status }, true).ToListAsync();
|
||||
if (disTasks?.Count > 0)
|
||||
{
|
||||
// 更新预任务申请表,单据状态为 已完成
|
||||
var preTaskIds = disTasks.Select(x => x.pretask_id).ToList();
|
||||
await _db.Updateable<WmsPretaskH>().SetColumns(it => new WmsPretaskH { status = WmsWareHouseConst.PRETASK_BILL_STATUS_COMPLE_ID }).Where(it => preTaskIds.Contains(it.id)).ExecuteCommandAsync();
|
||||
}
|
||||
//更新载具,锁定状态为未锁定,更新载具的库位当前任务的目标库位
|
||||
if (disTasks?.Count > 0)
|
||||
{
|
||||
|
||||
//更新电梯任务数量
|
||||
var eles = await _db.Queryable<WmsElevatorH>().Where(it => disTasks.Select(x => x.area_code).Contains(it.area_code)).ToListAsync();
|
||||
if (eles?.Count > 0)
|
||||
await _db.Updateable(eles).ReSetValue(it => it.task_nums--).ExecuteCommandAsync();
|
||||
|
||||
//更新载具,锁定状态为未锁定,更新载具的库位当前任务的目标库位
|
||||
var multiList = disTasks.Select(it => (it.carry_id, it.endlocation_id, it.endlocation_code)).ToList();
|
||||
for (int i = 0; i < multiList.Count; i++)
|
||||
{
|
||||
@@ -404,10 +408,8 @@ namespace Tnb.WarehouseMgr
|
||||
await _db.Updateable<WmsCarryCode>().SetColumns(it => new WmsCarryCode { warehouse_id = loc.wh_id, location_id = multiList[i].endlocation_id, location_code = multiList[i].endlocation_code }).Where(it => it.id == multiList[i].carry_id).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
//更新库位信息,使用状态为 使用,锁定状态为未锁定
|
||||
if (disTasks?.Count > 0)
|
||||
{
|
||||
|
||||
//更新库位信息,使用状态为 使用,锁定状态为未锁定
|
||||
var multis = disTasks.Select(it => (it.endlocation_id, it.carry_status)).ToList();
|
||||
for (int i = 0; i < multis.Count; i++)
|
||||
{
|
||||
@@ -419,27 +421,25 @@ namespace Tnb.WarehouseMgr
|
||||
var cStatus = carryStatus.ParseToInt();
|
||||
await _db.Updateable<BasLocation>().SetColumns(it => new BasLocation { is_use = cStatus.ToString(), is_lock = 0 }).Where(it => it.id == multis[i].endlocation_id).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
//更新业务主表的单据状态
|
||||
if (disTasks?.Count > 0)
|
||||
foreach (var dt in disTasks)
|
||||
{
|
||||
foreach (var dt in disTasks)
|
||||
var disTaskCodes = await _db.Queryable<WmsDistaskCode>().Where(it => it.bill_id == dt.id).ToListAsync();
|
||||
var upInput = new WareHouseUpInput { bizTypeId = dt.biz_type, requireId = dt.require_id!, distaskCodes = disTaskCodes, carryIds = disTasks.Select(x => x.carry_id).ToList() };
|
||||
upInput.loginType = !_userManager.LoginType.IsNullOrEmpty() ? "app" : "web";
|
||||
if (dt.is_sign == 1 && dt.chain_type == "3")
|
||||
{
|
||||
var disTaskCodes = await _db.Queryable<WmsDistaskCode>().Where(it => it.bill_id == dt.id).ToListAsync();
|
||||
var upInput = new WareHouseUpInput { bizTypeId = dt.biz_type, requireId = dt.require_id!, distaskCodes = disTaskCodes, carryIds = disTasks.Select(x => x.carry_id).ToList() };
|
||||
upInput.loginType = !_userManager.LoginType.IsNullOrEmpty() ? "app" : "web";
|
||||
if (dt.is_sign == 1 && dt.chain_type == "3")
|
||||
{
|
||||
await DoUpdate(upInput);
|
||||
}
|
||||
await DoUpdate(upInput);
|
||||
}
|
||||
}
|
||||
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
@@ -496,6 +496,11 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
row = await _db.Insertable(preTaskCodes).ExecuteCommandAsync();
|
||||
}
|
||||
var eleP = preTasks.Find(x => x.area_code.Contains("ELE"));
|
||||
if (eleP != null)
|
||||
{
|
||||
row = await _db.Updateable<WmsElevatorH>().SetColumns(it => it.task_nums == it.task_nums + 1).Where(it => it.area_code == eleP.area_code).ExecuteCommandAsync();
|
||||
}
|
||||
return row > 0;
|
||||
}
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user