新增物料签收记录、调拨出库、电梯优化等

This commit is contained in:
2024-08-16 14:30:28 +08:00
parent bc7bb2cec6
commit ebddefa01b
17 changed files with 1141 additions and 55 deletions

View File

@@ -93,7 +93,11 @@ namespace Tnb.WarehouseMgr
public Func<string, int, Task> AddUnExecuteTask { get; set; }
public SemaphoreSlim _s_GenTaskExecute
{
get { return s_GenTaskExecute; }
}
public SemaphoreSlim s_taskExecuteSemaphore_YCLInstock
{
get { return _s_taskExecuteSemaphore_YCLInstock; }
@@ -1615,49 +1619,55 @@ namespace Tnb.WarehouseMgr
var e = await FindElevatorFromPars(q);
Logger.Information($"【GenTaskExecute】执行电梯任务时 根据任务单号获取电梯结果 {JsonConvert.SerializeObject(e)}");
// 三、四号梯发货带两托货
// 三、四号梯发货带两托货进定时任务
string[] doubleCarryRunElevators = new string[2]
{
"Elevator3","Elevator4"
};
if (doubleCarryRunElevators.Contains(e.elevator_code) && wmsDistaskHs[0].end_floor == 1)
{
// 电梯内放置两托货呼叫电梯下
if (group.Count() == 2)
{
if (e != null)
{
wmsDistaskHs[0].device_id = e.device_id;
wmsDistaskHs[1].device_id = e.device_id;
}
_ = ExecuteTargetFloorTask(wmsDistaskHs);
}
// 一托货
else if (group.Count() == 1)
{
// 如果当前电梯没有执行中的任务 则呼叫电梯下
//Logger.Information($"【GenTaskExecute】判断为三四号梯任务");
//Logger.Information($"【GenTaskExecute】现在有{group.Count()}托货");
//// 电梯内放置两托货呼叫电梯下
//if (group.Count() == 2)
//{
// if (e != null)
// {
// wmsDistaskHs[0].device_id = e.device_id;
// wmsDistaskHs[1].device_id = e.device_id;
// }
// Logger.Information($"【GenTaskExecute】呼叫电梯");
// _ = ExecuteTargetFloorTask(wmsDistaskHs);
//}
//// 一托货
//else if (group.Count() == 1)
//{
// // 如果当前电梯没有执行中的任务 则呼叫电梯下
if (_db.Queryable<WmsDistaskH>().Where(r => r.status != WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID
&& r.status != WmsWareHouseConst.TASK_BILL_STATUS_CANCEL_ID && r.endlocation_id == wmsDistaskHs[0].startlocation_id).Count() == 0)
{
if (e != null)
{
wmsDistaskHs[0].device_id = e.device_id;
}
_ = ExecuteTargetFloorTask(wmsDistaskHs);
}
}
else
{
Logger.LogError($"电梯 {e.elevator_code} 待执行的电梯任务数异常 目前是{group.Count()} 超过了两托");
}
// if (_db.Queryable<WmsDistaskH>().Where(r => r.status != WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID
// && r.status != WmsWareHouseConst.TASK_BILL_STATUS_CANCEL_ID && r.endlocation_id == wmsDistaskHs[0].startlocation_id).Count() == 0)
// {
// Logger.Information($"【GenTaskExecute】判断为三四号梯任务 没有执行中的任务 呼叫电梯");
// if (e != null)
// {
// wmsDistaskHs[0].device_id = e.device_id;
// }
// _ = ExecuteTargetFloorTask(wmsDistaskHs);
// }
//}
//else
//{
// Logger.LogError($"电梯 {e.elevator_code} 待执行的电梯任务数异常 目前是{group.Count()} 超过了两托");
//}
}
else
{
Logger.Information($"【GenTaskExecute】判断为非三四号梯任务");
if (e != null)
{
wmsDistaskHs[0].device_id = e.device_id;
}
Logger.Information($"【GenTaskExecute】呼叫电梯");
_ = ExecuteTargetFloorTask(wmsDistaskHs);
}
}
@@ -2511,14 +2521,16 @@ namespace Tnb.WarehouseMgr
});
}
WmsCarryCode carryCode = new()
List<WmsCarryCode> carrycodes = _db.Queryable<WmsCarryCode>().Where(r => r.carry_id == carry.id).ToList();
carrycodes.ForEach(r =>
{
warehouse_id = locWhIdMap.ContainsKey(endLocId) ? locWhIdMap[endLocId].ToString() : "",
location_id = multiList[i].endlocation_id,
location_code = multiList[i].endlocation_code
};
r.warehouse_id = locWhIdMap.ContainsKey(endLocId) ? locWhIdMap[endLocId].ToString() : "";
r.location_id = multiList[i].endlocation_id;
r.location_code = multiList[i].endlocation_code;
carryCodeIts.Add(r);
});
carryIts.Add(carry);
carryCodeIts.Add(carryCode);
BasLocation loc = new()
{
@@ -2544,7 +2556,7 @@ namespace Tnb.WarehouseMgr
_ = await _db.Updateable(carryIts).UpdateColumns(it => new { it.is_lock, it.location_id, it.location_code, it.instock_time }).ExecuteCommandAsync();
Logger.Information($"【TaskComplate】 更新载具 {JsonConvert.SerializeObject(carryIts)}");
//更新条码的库位和仓库信息
_ = await _db.Updateable(carryCodeIts).UpdateColumns(it => new { it.warehouse_id, it.location_id, it.location_code }).Where(it => multiList.Select(x => x.carry_id).Contains(it.carry_id)).ExecuteCommandAsync();
_ = await _db.Updateable(carryCodeIts).UpdateColumns(it => new { it.warehouse_id, it.location_id, it.location_code }).ExecuteCommandAsync();
//更新库位信息,使用状态为 使用,锁定状态为未锁定
_ = await _db.Updateable(locIts).UpdateColumns(it => new { it.is_use, it.is_lock }).ExecuteCommandAsync();
Logger.Information($"【TaskComplate】 更新库位 {JsonConvert.SerializeObject(locIts)}");