任务完成时电梯任务数量减少,预任务生成时电梯任务数量增加
This commit is contained in:
@@ -11,5 +11,6 @@ namespace Tnb.WarehouseMgr.Entities.Entity
|
||||
string startlocation_id { get; set; }
|
||||
string endlocation_id { get; set; }
|
||||
string carry_id { get; set; }
|
||||
string area_code { get;set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
||||
using JNPF.Common.Contracts;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Entity;
|
||||
|
||||
@@ -43,6 +44,7 @@ namespace Tnb.WarehouseMgr
|
||||
await _db.Updateable(carry).UpdateColumns(it => it.is_lock).ExecuteCommandAsync();
|
||||
}
|
||||
await _db.Deleteable(preTask).ExecuteCommandAsync();
|
||||
await _db.Updateable<WmsElevatorH>().SetColumns(it => it.task_nums == it.task_nums - 1).Where(it => it.area_code == preTask.area_code).ExecuteCommandAsync();
|
||||
}
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -125,12 +125,6 @@ namespace Tnb.WarehouseMgr
|
||||
return preTask;
|
||||
}).ToList();
|
||||
var isOk = await _wareHouseService.GenPreTask(preTasks, null!);
|
||||
//更新电梯任务数量
|
||||
var eleP = points.Find(x => x.area_code.Contains("ELE"));
|
||||
if (eleP != null)
|
||||
{
|
||||
await _db.Updateable<WmsElevatorH>().SetColumns(it => it.task_nums == it.task_nums + 1).Where(it => it.area_code == eleP.area_code).ExecuteCommandAsync();
|
||||
}
|
||||
if (isOk)
|
||||
{
|
||||
var preTaskUpInput = new GenPreTaskUpInput();
|
||||
@@ -162,6 +156,10 @@ namespace Tnb.WarehouseMgr
|
||||
it => new WmsCarryH { is_lock = 1, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode },
|
||||
it => new BasLocation { is_lock = 1 });
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new AppFriendlyException("预任务生成失败,路径或者设备相关配置错误", 500);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -71,8 +71,6 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
|
||||
|
||||
|
||||
/*//入库取终点
|
||||
var inStockStrategyInput = new InStockStrategyQuery { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString(), Size = 1 };
|
||||
var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);*/
|
||||
@@ -156,12 +154,6 @@ namespace Tnb.WarehouseMgr
|
||||
preTasks[^1].is_sign = 0; // 修改最后一个元素的是否签收值
|
||||
}
|
||||
isOk = await _wareHouseService.GenPreTask(preTasks, null!);
|
||||
//更新电梯任务数量
|
||||
var eleP = points.Find(x => x.area_code.Contains("ELE"));
|
||||
if (eleP != null)
|
||||
{
|
||||
await _db.Updateable<WmsElevatorH>().SetColumns(it => it.task_nums == it.task_nums + 1).Where(it => it.area_code == eleP.area_code).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
if(isOk)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user