三楼人工库逻辑等
This commit is contained in:
@@ -265,7 +265,7 @@ public partial class BasMaterial : BaseEntity<string>
|
|||||||
public int? deleted { get; set; }
|
public int? deleted { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 箱号
|
/// 箱号(弃用)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string container_no { get; set; }
|
public string container_no { get; set; }
|
||||||
|
|
||||||
@@ -275,7 +275,7 @@ public partial class BasMaterial : BaseEntity<string>
|
|||||||
public string? material_specification { get; set; }
|
public string? material_specification { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 物料型号
|
/// 物料型号(箱号)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? material_standard { get; set; }
|
public string? material_standard { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -663,7 +663,6 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
|||||||
if (_wareHouseService.s_taskExecuteSemaphore_YCLOutstock.CurrentCount == 0)
|
if (_wareHouseService.s_taskExecuteSemaphore_YCLOutstock.CurrentCount == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
var YCLInnerTransfer = await db_YCLInternalTransfer.Queryable<BasFactoryConfig>().Where(p => p.key == "YCLInnerTransfer").FirstAsync();
|
var YCLInnerTransfer = await db_YCLInternalTransfer.Queryable<BasFactoryConfig>().Where(p => p.key == "YCLInnerTransfer").FirstAsync();
|
||||||
// 0则不进行移转
|
// 0则不进行移转
|
||||||
if (YCLInnerTransfer != null && YCLInnerTransfer.value == "0")
|
if (YCLInnerTransfer != null && YCLInnerTransfer.value == "0")
|
||||||
|
|||||||
@@ -91,7 +91,7 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 成品库人工出库区
|
/// 成品库人工出库区
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string REGION_CPManualOutstock_ID = "36539312699413";
|
public const string REGION_CPManualOutstock_ID = "36543552166677";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 长管出库
|
/// 长管出库
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
namespace Tnb.WarehouseMgr.Entities.Dto
|
using SqlSugar;
|
||||||
|
|
||||||
|
namespace Tnb.WarehouseMgr.Entities.Dto
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 库房业务更新输入参数
|
/// 库房业务更新输入参数
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 终点库位
|
/// 终点库位
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? endlocation_id { get; set; }
|
public string? endlocation_code { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 载具
|
/// 载具
|
||||||
|
|||||||
@@ -134,4 +134,8 @@ public partial class WmsRawmatTransferoutstockH : BaseEntity<string>
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string? instockorg_code { get; set; }
|
public string? instockorg_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// erp_bill_code
|
||||||
|
/// </summary>
|
||||||
|
public string? erp_bill_code { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ public partial class WmsTransferOrderD : BaseEntity<string>
|
|||||||
public string erp_wh_type { get; set; }
|
public string erp_wh_type { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// erp入库仓库编码
|
/// erp入库仓库id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? warehouse_instock_code { get; set; }
|
public string? warehouse_instock_code { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,4 +118,10 @@ public partial class WmsTransferOutstockH : BaseEntity<string>
|
|||||||
/// bip入库组织id
|
/// bip入库组织id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? instockorg_code { get; set; }
|
public string? instockorg_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// erp_bill_code
|
||||||
|
/// </summary>
|
||||||
|
public string? erp_bill_code { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,6 +51,15 @@ namespace Tnb.WarehouseMgr.Interfaces
|
|||||||
get;
|
get;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取锁
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <param name="warehouse_id"></param>
|
||||||
|
/// <param name="region_id"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
SemaphoreSlim GetSemaphore(string type, string warehouse_id, string region_id = "");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 入库策略
|
/// 入库策略
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -44,25 +44,55 @@ namespace Tnb.WarehouseMgr
|
|||||||
[LogLevel.Error] = "ERR",
|
[LogLevel.Error] = "ERR",
|
||||||
};
|
};
|
||||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||||
public static SemaphoreSlim s_taskExecuteSemaphore = new(1);
|
|
||||||
public static SemaphoreSlim s_elevatorStatusSemaphore = new(1);
|
public static SemaphoreSlim s_elevatorStatusSemaphore = new(1);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 原材料
|
||||||
|
/// </summary>
|
||||||
public static SemaphoreSlim _s_taskExecuteSemaphore_YCLInstock = new(1);
|
public static SemaphoreSlim _s_taskExecuteSemaphore_YCLInstock = new(1);
|
||||||
public static SemaphoreSlim _s_taskExecuteSemaphore_YCLOutstock = new(1);
|
public static SemaphoreSlim _s_taskExecuteSemaphore_YCLOutstock = new(1);
|
||||||
|
/// <summary>
|
||||||
|
/// 中储仓
|
||||||
|
/// </summary>
|
||||||
public static SemaphoreSlim _s_taskExecuteSemaphore_F1ZCCInstock = new(1);
|
public static SemaphoreSlim _s_taskExecuteSemaphore_F1ZCCInstock = new(1);
|
||||||
public static SemaphoreSlim _s_taskExecuteSemaphore_F1ZCCOutstock = new(1);
|
public static SemaphoreSlim _s_taskExecuteSemaphore_F1ZCCOutstock = new(1);
|
||||||
|
/// <summary>
|
||||||
|
/// 暂存仓
|
||||||
|
/// </summary>
|
||||||
public static SemaphoreSlim _s_taskExecuteSemaphore_F2ZCCInstock = new(1);
|
public static SemaphoreSlim _s_taskExecuteSemaphore_F2ZCCInstock = new(1);
|
||||||
public static SemaphoreSlim _s_taskExecuteSemaphore_F2ZCCOutstock = new(1);
|
public static SemaphoreSlim _s_taskExecuteSemaphore_F2ZCCOutstock = new(1);
|
||||||
|
/// <summary>
|
||||||
|
/// 缓存仓
|
||||||
|
/// </summary>
|
||||||
public static SemaphoreSlim _s_taskExecuteSemaphore_F2HCCInstock = new(1);
|
public static SemaphoreSlim _s_taskExecuteSemaphore_F2HCCInstock = new(1);
|
||||||
public static SemaphoreSlim _s_taskExecuteSemaphore_F2HCCOutstock = new(1);
|
public static SemaphoreSlim _s_taskExecuteSemaphore_F2HCCOutstock = new(1);
|
||||||
|
/// <summary>
|
||||||
|
/// 待灭菌仓
|
||||||
|
/// </summary>
|
||||||
public static SemaphoreSlim _s_taskExecuteSemaphore_F4DMJCInstock = new(1);
|
public static SemaphoreSlim _s_taskExecuteSemaphore_F4DMJCInstock = new(1);
|
||||||
public static SemaphoreSlim _s_taskExecuteSemaphore_F4DMJCOutstock = new(1);
|
public static SemaphoreSlim _s_taskExecuteSemaphore_F4DMJCOutstock = new(1);
|
||||||
|
/// <summary>
|
||||||
|
/// 成品仓
|
||||||
|
/// </summary>
|
||||||
|
public static SemaphoreSlim _s_taskExecuteSemaphore_F3CPInstock = new(1);
|
||||||
|
public static SemaphoreSlim _s_taskExecuteSemaphore_F3CPOutstock = new(1);
|
||||||
|
/// <summary>
|
||||||
|
/// 四楼包材库
|
||||||
|
/// </summary>
|
||||||
|
public static SemaphoreSlim _s_taskExecuteSemaphore_F4BCKInstock = new(1);
|
||||||
|
public static SemaphoreSlim _s_taskExecuteSemaphore_F4BCKOutstock = new(1);
|
||||||
|
/// <summary>
|
||||||
|
/// 二楼包材库
|
||||||
|
/// </summary>
|
||||||
|
public static SemaphoreSlim _s_taskExecuteSemaphore_F2BCQInstock = new(1);
|
||||||
|
public static SemaphoreSlim _s_taskExecuteSemaphore_F2BCQOutstock = new(1);
|
||||||
|
/// <summary>
|
||||||
|
/// 出入库明细
|
||||||
|
/// </summary>
|
||||||
public static SemaphoreSlim _s_taskExecuteSemaphore_AddOutinStockDetail = new(1);
|
public static SemaphoreSlim _s_taskExecuteSemaphore_AddOutinStockDetail = new(1);
|
||||||
|
/// <summary>
|
||||||
|
/// 编码规则
|
||||||
|
/// </summary>
|
||||||
public static SemaphoreSlim _s_taskExecuteSemaphore_codeRules = new(1);
|
public static SemaphoreSlim _s_taskExecuteSemaphore_codeRules = new(1);
|
||||||
|
|
||||||
protected static Dictionary<string, int> _s_eleUseStatusDic;
|
protected static Dictionary<string, int> _s_eleUseStatusDic;
|
||||||
|
|||||||
@@ -521,50 +521,58 @@ namespace Tnb.WarehouseMgr
|
|||||||
Logger.Information($"【TaskChainCallBack】{wmsDistaskH.bill_code} 执行取消电梯任务时 任务数变更{eleRow}");
|
Logger.Information($"【TaskChainCallBack】{wmsDistaskH.bill_code} 执行取消电梯任务时 任务数变更{eleRow}");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
Logger.Information($"【TaskChainCallBack】{wmsDistaskH.bill_code} 执行取消电梯任务时 电梯id{e.device_id}找不到对应电梯资料");
|
Logger.Information($"【TaskChainCallBack】{wmsDistaskH.bill_code} 执行取消电梯任务时 电梯id{e.device_id}找不到对应电梯资料");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
Logger.Information($"【TaskChainCallBack】{wmsDistaskH.bill_code} 判断不是在执行取消电梯任务");
|
Logger.Information($"【TaskChainCallBack】{wmsDistaskH.bill_code} 判断不是在执行取消电梯任务");
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (wmsDistaskH.startlocation_code.Contains("DT") || wmsDistaskH.endlocation_code.Contains("DT"))
|
|
||||||
{
|
|
||||||
//WmsElevatorUnlockInput wmsElevatorUnlockInput = new ();
|
|
||||||
//wmsElevatorUnlockInput.elevator_id = wmsDistaskH.device_id;
|
|
||||||
//await WmsElevatorUnlock(wmsElevatorUnlockInput);
|
|
||||||
//Logger.Information($"WCS取消任务{wmsDistaskH.bill_code},自动解占用电梯{wmsDistaskH.device_id}");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// 排除电梯任务 其他任务取消时自动解锁起点和终点库位
|
|
||||||
|
|
||||||
if (wmsDistaskH.act_start_date == null)
|
if (wmsDistaskH.act_start_date == null)
|
||||||
{
|
{
|
||||||
int unlockStartRow = await _db.Updateable<BasLocation>().SetColumns(r => r.is_lock == 0).Where(r => r.location_code == wmsDistaskH.startlocation_code).ExecuteCommandAsync();
|
int unlockStartRow = await _db.Updateable<BasLocation>().SetColumns(r => r.is_lock == 0).Where(r => r.location_code == wmsDistaskH.startlocation_code).ExecuteCommandAsync();
|
||||||
if (unlockStartRow > 0)
|
if (unlockStartRow > 0)
|
||||||
{
|
|
||||||
Logger.Information($"成功解锁起点库位{wmsDistaskH.startlocation_code}");
|
Logger.Information($"成功解锁起点库位{wmsDistaskH.startlocation_code}");
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
Logger.Information($"未成功解锁起点库位{wmsDistaskH.startlocation_code}");
|
Logger.Information($"未成功解锁起点库位{wmsDistaskH.startlocation_code}");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
int unlockEndRow = await _db.Updateable<BasLocation>().SetColumns(r => r.is_lock == 0).Where(r => r.location_code == wmsDistaskH.endlocation_code).ExecuteCommandAsync();
|
int unlockEndRow = await _db.Updateable<BasLocation>().SetColumns(r => r.is_lock == 0).Where(r => r.location_code == wmsDistaskH.endlocation_code).ExecuteCommandAsync();
|
||||||
if (unlockEndRow > 0)
|
if (unlockEndRow > 0)
|
||||||
{
|
|
||||||
Logger.Information($"成功解锁终点库位{wmsDistaskH.endlocation_code}");
|
Logger.Information($"成功解锁终点库位{wmsDistaskH.endlocation_code}");
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
Logger.Information($"未成功解锁终点库位{wmsDistaskH.endlocation_code}");
|
Logger.Information($"未成功解锁终点库位{wmsDistaskH.endlocation_code}");
|
||||||
|
|
||||||
|
#region 当前任务后续未开始的任务全取消,并解锁库位
|
||||||
|
WmsPretaskH curWmsPretaskH = await _db.Queryable<WmsPretaskH>().Where(r => r.bill_code == wmsDistaskH.pretask_code).FirstAsync();
|
||||||
|
List<WmsPretaskH> nextWmsPretaskHs = _db.Queryable<WmsPretaskH>().Where(r => r.status != WmsWareHouseConst.PRETASK_BILL_STATUS_COMPLE_ID
|
||||||
|
&& r.status != WmsWareHouseConst.PRETASK_BILL_STATUS_CANCEL_ID && r.carry_code == wmsDistaskH.carry_code && long.Parse(r.id) > long.Parse(curWmsPretaskH.id)).ToList();
|
||||||
|
Logger.Information($"即将取消{wmsDistaskH.bill_code}的后续预任务{nextWmsPretaskHs.Count}条");
|
||||||
|
foreach (WmsPretaskH wmsPretaskH in nextWmsPretaskHs)
|
||||||
|
{
|
||||||
|
int _row = await _db.Updateable<WmsPretaskH>().SetColumns(r => new WmsPretaskH
|
||||||
|
{
|
||||||
|
note = "WCS上传失败(CANCELLED)信号",
|
||||||
|
status = WmsWareHouseConst.PRETASK_BILL_STATUS_CANCEL_ID
|
||||||
|
}).Where(P => P.bill_code == wmsPretaskH.bill_code).ExecuteCommandAsync();
|
||||||
|
if (_row > 0)
|
||||||
|
Logger.Information($"成功取消后续预任务{wmsPretaskH.bill_code}");
|
||||||
|
else
|
||||||
|
Logger.Information($"未成功取消后续预任务{wmsPretaskH.bill_code}");
|
||||||
|
int _unlockStartRow = await _db.Updateable<BasLocation>().SetColumns(r => r.is_lock == 0).Where(r => r.location_code == wmsPretaskH.startlocation_code).ExecuteCommandAsync();
|
||||||
|
if (_unlockStartRow > 0)
|
||||||
|
Logger.Information($"成功解锁起点库位{wmsPretaskH.startlocation_code}");
|
||||||
|
else
|
||||||
|
Logger.Information($"未成功解锁起点库位{wmsPretaskH.startlocation_code}");
|
||||||
|
int _unlockEndRow = await _db.Updateable<BasLocation>().SetColumns(r => r.is_lock == 0).Where(r => r.location_code == wmsPretaskH.endlocation_code).ExecuteCommandAsync();
|
||||||
|
if (_unlockEndRow > 0)
|
||||||
|
Logger.Information($"成功解锁终点库位{wmsPretaskH.endlocation_code}");
|
||||||
|
else
|
||||||
|
Logger.Information($"未成功解锁终点库位{wmsPretaskH.endlocation_code}");
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
WmsCarryH wmsCarryH = await _db.Queryable<WmsCarryH>().Where(r => r.carry_code == wmsDistaskH.carry_code).FirstAsync();
|
WmsCarryH wmsCarryH = await _db.Queryable<WmsCarryH>().Where(r => r.carry_code == wmsDistaskH.carry_code).FirstAsync();
|
||||||
wmsCarryH.is_lock = 0;
|
wmsCarryH.is_lock = 0;
|
||||||
@@ -576,17 +584,13 @@ namespace Tnb.WarehouseMgr
|
|||||||
|
|
||||||
int unlockCarryRow = await _db.Updateable(wmsCarryH).ExecuteCommandAsync();
|
int unlockCarryRow = await _db.Updateable(wmsCarryH).ExecuteCommandAsync();
|
||||||
if (unlockCarryRow > 0)
|
if (unlockCarryRow > 0)
|
||||||
{
|
|
||||||
Logger.Information($"成功解锁载具{wmsDistaskH.carry_code}");
|
Logger.Information($"成功解锁载具{wmsDistaskH.carry_code}");
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
Logger.Information($"未成功解锁载具{wmsDistaskH.carry_code}");
|
Logger.Information($"未成功解锁载具{wmsDistaskH.carry_code}");
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
// 任务链取消
|
||||||
await _db.Updateable<WmsPretaskH>().SetColumns(r => new WmsPretaskH
|
await _db.Updateable<WmsPretaskH>().SetColumns(r => new WmsPretaskH
|
||||||
{
|
{
|
||||||
note = "WCS上传取消(CANCELLED)信号",
|
note = "WCS上传取消(CANCELLED)信号",
|
||||||
@@ -645,48 +649,57 @@ namespace Tnb.WarehouseMgr
|
|||||||
Logger.Information($"【TaskChainCallBack】{wmsDistaskH.bill_code} 执行取消电梯任务时 任务数变更{eleRow}");
|
Logger.Information($"【TaskChainCallBack】{wmsDistaskH.bill_code} 执行取消电梯任务时 任务数变更{eleRow}");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
Logger.Information($"【TaskChainCallBack】{wmsDistaskH.bill_code} 执行取消电梯任务时 电梯id{e.device_id}找不到对应电梯资料");
|
||||||
Logger.Information($"【TaskChainCallBack】{wmsDistaskH.bill_code} 执行电梯任务时 电梯id{e.device_id}找不到对应电梯资料");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Logger.Information($"【TaskChainCallBack】{wmsDistaskH.bill_code} 判断不是在执行电梯任务");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wmsDistaskH.startlocation_code.Contains("DT") || wmsDistaskH.endlocation_code.Contains("DT"))
|
|
||||||
{
|
|
||||||
//WmsElevatorUnlockInput wmsElevatorUnlockInput = new ();
|
|
||||||
//wmsElevatorUnlockInput.elevator_id = wmsDistaskH.device_id;
|
|
||||||
//await WmsElevatorUnlock(wmsElevatorUnlockInput);
|
|
||||||
//Logger.Information($"WCS取消任务{wmsDistaskH.bill_code},自动解占用电梯{wmsDistaskH.device_id}");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
Logger.Information($"【TaskChainCallBack】{wmsDistaskH.bill_code} 判断不是在执行电梯任务");
|
||||||
// 排除电梯任务 其他任务取消时自动解锁起点和终点库位
|
|
||||||
|
|
||||||
|
|
||||||
if (wmsDistaskH.act_start_date == null)
|
if (wmsDistaskH.act_start_date == null)
|
||||||
{
|
{
|
||||||
int unlockStartRow = await _db.Updateable<BasLocation>().SetColumns(r => r.is_lock == 0).Where(r => r.location_code == wmsDistaskH.startlocation_code).ExecuteCommandAsync();
|
int unlockStartRow = await _db.Updateable<BasLocation>().SetColumns(r => r.is_lock == 0).Where(r => r.location_code == wmsDistaskH.startlocation_code).ExecuteCommandAsync();
|
||||||
if (unlockStartRow > 0)
|
if (unlockStartRow > 0)
|
||||||
{
|
|
||||||
Logger.Information($"成功解锁起点库位{wmsDistaskH.startlocation_code}");
|
Logger.Information($"成功解锁起点库位{wmsDistaskH.startlocation_code}");
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
Logger.Information($"未成功解锁起点库位{wmsDistaskH.startlocation_code}");
|
Logger.Information($"未成功解锁起点库位{wmsDistaskH.startlocation_code}");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
int unlockEndRow = await _db.Updateable<BasLocation>().SetColumns(r => r.is_lock == 0).Where(r => r.location_code == wmsDistaskH.endlocation_code).ExecuteCommandAsync();
|
int unlockEndRow = await _db.Updateable<BasLocation>().SetColumns(r => r.is_lock == 0).Where(r => r.location_code == wmsDistaskH.endlocation_code).ExecuteCommandAsync();
|
||||||
if (unlockEndRow > 0)
|
if (unlockEndRow > 0)
|
||||||
{
|
|
||||||
Logger.Information($"成功解锁终点库位{wmsDistaskH.endlocation_code}");
|
Logger.Information($"成功解锁终点库位{wmsDistaskH.endlocation_code}");
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
Logger.Information($"未成功解锁终点库位{wmsDistaskH.endlocation_code}");
|
Logger.Information($"未成功解锁终点库位{wmsDistaskH.endlocation_code}");
|
||||||
|
|
||||||
|
#region 当前任务后续未开始的任务全取消,并解锁库位
|
||||||
|
WmsPretaskH curWmsPretaskH = await _db.Queryable<WmsPretaskH>().Where(r => r.bill_code == wmsDistaskH.pretask_code).FirstAsync();
|
||||||
|
List<WmsPretaskH> nextWmsPretaskHs = _db.Queryable<WmsPretaskH>().Where(r => r.status != WmsWareHouseConst.PRETASK_BILL_STATUS_COMPLE_ID
|
||||||
|
&& r.status != WmsWareHouseConst.PRETASK_BILL_STATUS_CANCEL_ID && r.carry_code == wmsDistaskH.carry_code && long.Parse(r.id) > long.Parse(curWmsPretaskH.id)).ToList();
|
||||||
|
Logger.Information($"即将取消{wmsDistaskH.bill_code}的后续预任务{nextWmsPretaskHs.Count}条");
|
||||||
|
foreach (WmsPretaskH wmsPretaskH in nextWmsPretaskHs)
|
||||||
|
{
|
||||||
|
int _row = await _db.Updateable<WmsPretaskH>().SetColumns(r => new WmsPretaskH
|
||||||
|
{
|
||||||
|
note = "WCS上传失败(FAILURE)信号",
|
||||||
|
status = WmsWareHouseConst.PRETASK_BILL_STATUS_CANCEL_ID
|
||||||
|
}).Where(P => P.bill_code == wmsPretaskH.bill_code).ExecuteCommandAsync();
|
||||||
|
if (_row > 0)
|
||||||
|
Logger.Information($"成功取消后续预任务{wmsPretaskH.bill_code}");
|
||||||
|
else
|
||||||
|
Logger.Information($"未成功取消后续预任务{wmsPretaskH.bill_code}");
|
||||||
|
int _unlockStartRow = await _db.Updateable<BasLocation>().SetColumns(r => r.is_lock == 0).Where(r => r.location_code == wmsPretaskH.startlocation_code).ExecuteCommandAsync();
|
||||||
|
if (_unlockStartRow > 0)
|
||||||
|
Logger.Information($"成功解锁起点库位{wmsPretaskH.startlocation_code}");
|
||||||
|
else
|
||||||
|
Logger.Information($"未成功解锁起点库位{wmsPretaskH.startlocation_code}");
|
||||||
|
int _unlockEndRow = await _db.Updateable<BasLocation>().SetColumns(r => r.is_lock == 0).Where(r => r.location_code == wmsPretaskH.endlocation_code).ExecuteCommandAsync();
|
||||||
|
if (_unlockEndRow > 0)
|
||||||
|
Logger.Information($"成功解锁终点库位{wmsPretaskH.endlocation_code}");
|
||||||
|
else
|
||||||
|
Logger.Information($"未成功解锁终点库位{wmsPretaskH.endlocation_code}");
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
WmsCarryH wmsCarryH = await _db.Queryable<WmsCarryH>().Where(r => r.carry_code == wmsDistaskH.carry_code).FirstAsync();
|
WmsCarryH wmsCarryH = await _db.Queryable<WmsCarryH>().Where(r => r.carry_code == wmsDistaskH.carry_code).FirstAsync();
|
||||||
wmsCarryH.is_lock = 0;
|
wmsCarryH.is_lock = 0;
|
||||||
@@ -698,17 +711,12 @@ namespace Tnb.WarehouseMgr
|
|||||||
|
|
||||||
int unlockCarryRow = await _db.Updateable(wmsCarryH).ExecuteCommandAsync();
|
int unlockCarryRow = await _db.Updateable(wmsCarryH).ExecuteCommandAsync();
|
||||||
if (unlockCarryRow > 0)
|
if (unlockCarryRow > 0)
|
||||||
{
|
|
||||||
Logger.Information($"成功解锁载具{wmsDistaskH.carry_code}");
|
Logger.Information($"成功解锁载具{wmsDistaskH.carry_code}");
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
Logger.Information($"未成功解锁载具{wmsDistaskH.carry_code}");
|
Logger.Information($"未成功解锁载具{wmsDistaskH.carry_code}");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
// 任务链取消
|
||||||
await _db.Updateable<WmsPretaskH>().SetColumns(r => new WmsPretaskH
|
await _db.Updateable<WmsPretaskH>().SetColumns(r => new WmsPretaskH
|
||||||
{
|
{
|
||||||
note = "WCS上传失败(FAILURE)信号",
|
note = "WCS上传失败(FAILURE)信号",
|
||||||
@@ -771,6 +779,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 任务状态上报
|
/// 任务状态上报
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -688,8 +688,8 @@ namespace Tnb.WarehouseMgr
|
|||||||
WmsErpWarehouserelaH wmsErpWarehouserelaHin = await db.Queryable<WmsErpWarehouserelaH>().Where(r => r.erp_warehousecode == input.warehouse_instock).FirstAsync();
|
WmsErpWarehouserelaH wmsErpWarehouserelaHin = await db.Queryable<WmsErpWarehouserelaH>().Where(r => r.erp_warehousecode == input.warehouse_instock).FirstAsync();
|
||||||
if (wmsErpWarehouserelaHin == null)
|
if (wmsErpWarehouserelaHin == null)
|
||||||
{
|
{
|
||||||
_LoggerErp2Mes.LogWarning($@"【TransferOrder】不存在erp仓库类型{input.warehouse_outstock}对应wms系统的映射关系!");
|
_LoggerErp2Mes.LogWarning($@"【TransferOrder】不存在erp仓库类型{input.warehouse_instock}对应wms系统的映射关系!");
|
||||||
throw new AppFriendlyException($@"不存在erp仓库类型{input.warehouse_outstock}对应wms系统的映射关系!", 500);
|
throw new AppFriendlyException($@"不存在erp仓库类型{input.warehouse_instock}对应wms系统的映射关系!", 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
string warehouse_outstock_code = wmsErpWarehouserelaHout.wms_warehousecode;
|
string warehouse_outstock_code = wmsErpWarehouserelaHout.wms_warehousecode;
|
||||||
@@ -840,7 +840,8 @@ namespace Tnb.WarehouseMgr
|
|||||||
wmsMaterialTransferD.material_specification = material.material_specification;
|
wmsMaterialTransferD.material_specification = material.material_specification;
|
||||||
}
|
}
|
||||||
|
|
||||||
var erpExtendField = await db.Queryable<ErpExtendField>().InnerJoin<DictionaryDataEntity>((a, b) => a.table_id == b.Id).Where((a, b) => b.EnCode == detail.unit_code).Select((a, b) => b).FirstAsync();
|
|
||||||
|
var erpExtendField = await db.Queryable<ErpExtendField>().InnerJoin<DictionaryDataEntity>((a, b) => a.table_id == b.Id).Where((a, b) => a.cunitid == detail.unit_code).Select((a, b) => b).FirstAsync();
|
||||||
if (erpExtendField != null)
|
if (erpExtendField != null)
|
||||||
{
|
{
|
||||||
wmsMaterialTransferD.unit_id = erpExtendField.Id;
|
wmsMaterialTransferD.unit_id = erpExtendField.Id;
|
||||||
@@ -895,7 +896,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
wmsPrdReturnD.material_name = material.name;
|
wmsPrdReturnD.material_name = material.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
var erpExtendField = await db.Queryable<ErpExtendField>().InnerJoin<DictionaryDataEntity>((a, b) => a.table_id == b.Id).Where((a, b) => b.EnCode == detail.unit_code).Select((a, b) => b).FirstAsync();
|
var erpExtendField = await db.Queryable<ErpExtendField>().InnerJoin<DictionaryDataEntity>((a, b) => a.table_id == b.Id).Where((a, b) => a.cunitid == detail.unit_code).Select((a, b) => b).FirstAsync();
|
||||||
if (erpExtendField != null)
|
if (erpExtendField != null)
|
||||||
{
|
{
|
||||||
wmsPrdReturnD.unit_id = erpExtendField.Id;
|
wmsPrdReturnD.unit_id = erpExtendField.Id;
|
||||||
@@ -1511,12 +1512,12 @@ namespace Tnb.WarehouseMgr
|
|||||||
b.whcode
|
b.whcode
|
||||||
})
|
})
|
||||||
.ToDictionaryAsync(k => k.erp_warehousecode, v => v.id);
|
.ToDictionaryAsync(k => k.erp_warehousecode, v => v.id);
|
||||||
foreach (var key in dic_WmsErpWarehouseidrelaH.Keys)
|
foreach (var detail in input.details)
|
||||||
{
|
{
|
||||||
if (dic_WmsErpWarehouseidrelaH[key] == null)
|
if (!dic_WmsErpWarehouseidrelaH.ContainsKey(detail.warehouse_outstock))
|
||||||
{
|
{
|
||||||
_LoggerErp2Mes.LogWarning($"【TransferOrder】无法查询到出库仓库{key}的档案记录!");
|
_LoggerErp2Mes.LogWarning($"【TransferOrder】无法查询到出库仓库{detail.warehouse_outstock}的档案记录!");
|
||||||
return await ToApiResult(HttpStatusCode.InternalServerError, $"无法查询到出库仓库{key}的档案记录!");
|
throw new AppFriendlyException($"无法查询到出库仓库{detail.warehouse_outstock}的档案记录!", 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Dictionary<string, object> dic_WmsErpWarehousecoderelaH = await db.Queryable<WmsErpWarehouserelaH>()
|
Dictionary<string, object> dic_WmsErpWarehousecoderelaH = await db.Queryable<WmsErpWarehouserelaH>()
|
||||||
@@ -1599,6 +1600,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
|
|
||||||
WmsRawmatTransferoutstockH wmsRawmatTransferoutstockH = new WmsRawmatTransferoutstockH();
|
WmsRawmatTransferoutstockH wmsRawmatTransferoutstockH = new WmsRawmatTransferoutstockH();
|
||||||
string code = await _billRuleService.GetBillNumber("RawmatTransferoutstock");
|
string code = await _billRuleService.GetBillNumber("RawmatTransferoutstock");
|
||||||
|
wmsRawmatTransferoutstockH.erp_bill_code = input.transfer_order;
|
||||||
wmsRawmatTransferoutstockH.bill_code = code;
|
wmsRawmatTransferoutstockH.bill_code = code;
|
||||||
wmsRawmatTransferoutstockH.create_id = WmsWareHouseConst.ErpUserId;
|
wmsRawmatTransferoutstockH.create_id = WmsWareHouseConst.ErpUserId;
|
||||||
wmsRawmatTransferoutstockH.create_time = DateTime.Now;
|
wmsRawmatTransferoutstockH.create_time = DateTime.Now;
|
||||||
@@ -1677,6 +1679,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
|
|
||||||
WmsTransferOutstockH wmsTransferOutstockH = new WmsTransferOutstockH();
|
WmsTransferOutstockH wmsTransferOutstockH = new WmsTransferOutstockH();
|
||||||
string code = await _billRuleService.GetBillNumber("WmsTransferOutstock");
|
string code = await _billRuleService.GetBillNumber("WmsTransferOutstock");
|
||||||
|
wmsTransferOutstockH.erp_bill_code = input.transfer_order;
|
||||||
wmsTransferOutstockH.bill_code = code;
|
wmsTransferOutstockH.bill_code = code;
|
||||||
wmsTransferOutstockH.create_id = WmsWareHouseConst.ErpUserId;
|
wmsTransferOutstockH.create_id = WmsWareHouseConst.ErpUserId;
|
||||||
wmsTransferOutstockH.create_time = DateTime.Now;
|
wmsTransferOutstockH.create_time = DateTime.Now;
|
||||||
|
|||||||
@@ -2337,7 +2337,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new Exception($"通知WCS电梯{devName}下行接口调用成功");
|
Logger.Information($"通知WCS电梯{devName}下行接口调用成功");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3100,21 +3100,42 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
WmsElevatorH wmsElevatorH = await _db.Queryable<WmsElevatorH>().Where(it => it.elevator_group == "2" && it.enabled == 1).OrderBy(r => r.task_nums).FirstAsync();
|
WmsElevatorH wmsElevatorH = await _db.Queryable<WmsElevatorH>().Where(it => it.elevator_group == "2" && it.enabled == 1).OrderBy(r => r.task_nums).FirstAsync();
|
||||||
string elevatorSno = wmsElevatorH.elevator_code.Replace("Elevator", "");
|
string elevatorSno = wmsElevatorH.elevator_code.Replace("Elevator", "");
|
||||||
|
|
||||||
List<BasLocation> locations = await _db.Queryable<BasLocation>()
|
List<BasLocation> locations = await _db.Queryable<BasLocation>()
|
||||||
.InnerJoin<WmsPointH>((a, b) => a.id == b.location_id)
|
.InnerJoin<WmsPointH>((a, b) => a.id == b.location_id)
|
||||||
.InnerJoin<WmsPointD>((a, b, c) => b.id == c.point_id)
|
.InnerJoin<WmsPointD>((a, b, c) => b.id == c.point_id)
|
||||||
.InnerJoin<WmsPointH>((a, b, c, d) => d.id == c.endpoint_id)
|
.InnerJoin<WmsPointH>((a, b, c, d) => d.id == c.endpoint_id)
|
||||||
.Where((a, b, c, d) => a.wh_id == WmsWareHouseConst.WAREHOUSE_CP_ID && a.region_id == WmsWareHouseConst.REGION_CPOutstockCache_ID && d.point_code == $"DT-3-{elevatorSno}")
|
.Where((a, b, c, d) => a.wh_id == WmsWareHouseConst.WAREHOUSE_CP_ID
|
||||||
|
&& a.is_lock == 0 && a.is_use == "0"
|
||||||
|
&& a.region_id == WmsWareHouseConst.REGION_CPOutstockCache_ID && d.point_code == $"DT-3-{elevatorSno}")
|
||||||
.Select((a, b, c, d) => new BasLocation
|
.Select((a, b, c, d) => new BasLocation
|
||||||
{
|
{
|
||||||
location_code = a.location_code,
|
location_code = a.location_code,
|
||||||
extras = d.point_code
|
extras = d.point_code
|
||||||
}).OrderBy("a.is_lock, a.is_use, a.location_code, d.point_code").ToListAsync();
|
}).OrderBy("a.location_code, d.point_code").ToListAsync();
|
||||||
|
// 如果没有空闲库位 再找一下另一个电梯的缓存区有没有空闲库位
|
||||||
|
if (locations.Count == 0)
|
||||||
|
{
|
||||||
|
elevatorSno = elevatorSno == "3" ? "4" : "3";
|
||||||
|
locations = await _db.Queryable<BasLocation>()
|
||||||
|
.InnerJoin<WmsPointH>((a, b) => a.id == b.location_id)
|
||||||
|
.InnerJoin<WmsPointD>((a, b, c) => b.id == c.point_id)
|
||||||
|
.InnerJoin<WmsPointH>((a, b, c, d) => d.id == c.endpoint_id)
|
||||||
|
.Where((a, b, c, d) => a.wh_id == WmsWareHouseConst.WAREHOUSE_CP_ID
|
||||||
|
&& a.is_lock == 0 && a.is_use == "0"
|
||||||
|
&& a.region_id == WmsWareHouseConst.REGION_CPOutstockCache_ID && d.point_code == $"DT-3-{elevatorSno}")
|
||||||
|
.Select((a, b, c, d) => new BasLocation
|
||||||
|
{
|
||||||
|
location_code = a.location_code,
|
||||||
|
extras = d.point_code
|
||||||
|
}).OrderBy("a.location_code, d.point_code").ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
if (locations.Count == 0)
|
if (locations.Count == 0)
|
||||||
{
|
{
|
||||||
throw new AppFriendlyException($"三楼发货时,没有可用的暂存库位可以使用", 500);
|
throw new AppFriendlyException($"三楼发货时,没有可用的暂存库位可以使用", 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
BasLocation cache_location = locations.First();
|
BasLocation cache_location = locations.First();
|
||||||
// 到暂存区
|
// 到暂存区
|
||||||
points.Add(wmsPointHs.Where(r => r.id == pStartId).First());
|
points.Add(wmsPointHs.Where(r => r.id == pStartId).First());
|
||||||
@@ -4055,6 +4076,79 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SemaphoreSlim GetSemaphore(string type, string warehouse_id, string region_id = "")
|
||||||
|
{
|
||||||
|
SemaphoreSlim result = null;
|
||||||
|
switch (warehouse_id)
|
||||||
|
{
|
||||||
|
case WmsWareHouseConst.WAREHOUSE_ZC_ID:
|
||||||
|
{
|
||||||
|
if (type == "outstock")
|
||||||
|
result = _s_taskExecuteSemaphore_F1ZCCOutstock;
|
||||||
|
else if (type == "instock")
|
||||||
|
result = _s_taskExecuteSemaphore_F1ZCCInstock;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case WmsWareHouseConst.WAREHOUSE_HCC_ID:
|
||||||
|
{
|
||||||
|
if (type == "outstock")
|
||||||
|
result = _s_taskExecuteSemaphore_F2HCCOutstock;
|
||||||
|
else if (type == "instock")
|
||||||
|
result = _s_taskExecuteSemaphore_F2HCCInstock;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case WmsWareHouseConst.WAREHOUSE_YCL_ID:
|
||||||
|
{
|
||||||
|
if (type == "outstock")
|
||||||
|
result = _s_taskExecuteSemaphore_YCLOutstock;
|
||||||
|
else if (type == "instock")
|
||||||
|
result = _s_taskExecuteSemaphore_YCLInstock;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case WmsWareHouseConst.WAREHOUSE_CP_ID:
|
||||||
|
{
|
||||||
|
if (type == "outstock")
|
||||||
|
result = _s_taskExecuteSemaphore_F3CPOutstock;
|
||||||
|
else if (type == "instock")
|
||||||
|
result = _s_taskExecuteSemaphore_F3CPInstock;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case WmsWareHouseConst.WAREHOUSE_ZCC_ID:
|
||||||
|
{
|
||||||
|
if (type == "outstock")
|
||||||
|
result = _s_taskExecuteSemaphore_F2ZCCOutstock;
|
||||||
|
else if (type == "instock")
|
||||||
|
result = _s_taskExecuteSemaphore_F2ZCCInstock;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case WmsWareHouseConst.WAREHOUSE_DMJC_ID:
|
||||||
|
{
|
||||||
|
if (type == "outstock")
|
||||||
|
result = _s_taskExecuteSemaphore_F4DMJCOutstock;
|
||||||
|
else if (type == "instock")
|
||||||
|
result = _s_taskExecuteSemaphore_F4DMJCInstock;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case WmsWareHouseConst.WAREHOUSE_BCK_ID:
|
||||||
|
{
|
||||||
|
if (type == "outstock")
|
||||||
|
result = _s_taskExecuteSemaphore_F4BCKOutstock;
|
||||||
|
else if (type == "instock")
|
||||||
|
result = _s_taskExecuteSemaphore_F4BCKInstock;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case WmsWareHouseConst.WAREHOUSE_F2BCQ_ID:
|
||||||
|
{
|
||||||
|
if (type == "outstock")
|
||||||
|
result = _s_taskExecuteSemaphore_F2BCQOutstock;
|
||||||
|
else if (type == "instock")
|
||||||
|
result = _s_taskExecuteSemaphore_F2BCQInstock;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _s_taskExecuteSemaphore_F1ZCCOutstock;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -65,12 +65,11 @@ namespace Tnb.WarehouseMgr
|
|||||||
|
|
||||||
public async Task<dynamic> WmsEmptyOut(VisualDevModelDataCrInput input)
|
public async Task<dynamic> WmsEmptyOut(VisualDevModelDataCrInput input)
|
||||||
{
|
{
|
||||||
if (input.data[nameof(OutStockStrategyQuery.warehouse_id)].ToString() == WmsWareHouseConst.WAREHOUSE_ZC_ID)
|
SemaphoreSlim semaphoreSlim = null;
|
||||||
{
|
|
||||||
await _s_taskExecuteSemaphore_F1ZCCOutstock.WaitAsync();
|
|
||||||
}
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
semaphoreSlim = _wareHouseService.GetSemaphore("outstock", input.data[nameof(OutStockStrategyQuery.warehouse_id)].ToString());
|
||||||
|
await semaphoreSlim.WaitAsync();
|
||||||
await _db.Ado.BeginTranAsync();
|
await _db.Ado.BeginTranAsync();
|
||||||
|
|
||||||
/*//入库取终点
|
/*//入库取终点
|
||||||
@@ -260,10 +259,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if (input.data[nameof(OutStockStrategyQuery.warehouse_id)].ToString() == WmsWareHouseConst.WAREHOUSE_ZC_ID)
|
semaphoreSlim.Release();
|
||||||
{
|
|
||||||
_s_taskExecuteSemaphore_F1ZCCOutstock.Release();
|
|
||||||
}
|
|
||||||
await InvokeGenPretaskExcute();
|
await InvokeGenPretaskExcute();
|
||||||
}
|
}
|
||||||
return Task.FromResult(true);
|
return Task.FromResult(true);
|
||||||
|
|||||||
@@ -272,7 +272,6 @@ namespace Tnb.WarehouseMgr
|
|||||||
erpRequestData.Add("cdptvid","0001A11000000007GGO8");//部门先写死
|
erpRequestData.Add("cdptvid","0001A11000000007GGO8");//部门先写死
|
||||||
erpRequestData.Add("corpoid", erpOrg.corpoid);
|
erpRequestData.Add("corpoid", erpOrg.corpoid);
|
||||||
erpRequestData.Add("corpvid", erpOrg.corpvid);
|
erpRequestData.Add("corpvid", erpOrg.corpvid);
|
||||||
erpRequestData.Add("corpvid", erpOrg.corpvid);
|
|
||||||
erpRequestData.Add("cotherwhid", wmsErpWarehouserelaHs.Find(x=>x.wms_warehousecode==wmsRawmatTransferoutstockD.warehouse_instock_code)?.erp_warehouseid ?? "");
|
erpRequestData.Add("cotherwhid", wmsErpWarehouserelaHs.Find(x=>x.wms_warehousecode==wmsRawmatTransferoutstockD.warehouse_instock_code)?.erp_warehouseid ?? "");
|
||||||
erpRequestData.Add("cwarehouseid", wmsErpWarehouserelaHs.Find(x=>x.erp_warehousecode==wmsRawmatTransferoutstockD.erp_wh_type)?.erp_warehouseid ?? "");
|
erpRequestData.Add("cwarehouseid", wmsErpWarehouserelaHs.Find(x=>x.erp_warehousecode==wmsRawmatTransferoutstockD.erp_wh_type)?.erp_warehouseid ?? "");
|
||||||
erpRequestData.Add("creationtime", nowStr);
|
erpRequestData.Add("creationtime", nowStr);
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ using Tnb.ProductionMgr.Entities;
|
|||||||
using Tnb.BasicData;
|
using Tnb.BasicData;
|
||||||
using Tnb.ProductionMgr.Entities.Entity;
|
using Tnb.ProductionMgr.Entities.Entity;
|
||||||
using Tnb.WarehouseMgr.Entities.Dto.Outputs;
|
using Tnb.WarehouseMgr.Entities.Dto.Outputs;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
namespace Tnb.WarehouseMgr
|
namespace Tnb.WarehouseMgr
|
||||||
{
|
{
|
||||||
@@ -782,8 +783,14 @@ namespace Tnb.WarehouseMgr
|
|||||||
[HttpPost, NonUnify, AllowAnonymous]
|
[HttpPost, NonUnify, AllowAnonymous]
|
||||||
public async Task<Entities.Dto.Outputs.Result> DistributeBCK(MaterialTransferDistributeInput input)
|
public async Task<Entities.Dto.Outputs.Result> DistributeBCK(MaterialTransferDistributeInput input)
|
||||||
{
|
{
|
||||||
|
SemaphoreSlim semaphoreSlimOutStock = null;
|
||||||
|
SemaphoreSlim semaphoreSlimInStock = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
semaphoreSlimOutStock = _wareHouseService.GetSemaphore("outstock", WmsWareHouseConst.WAREHOUSE_BCK_ID);
|
||||||
|
await semaphoreSlimOutStock.WaitAsync();
|
||||||
|
semaphoreSlimInStock = _wareHouseService.GetSemaphore("instock", WmsWareHouseConst.WAREHOUSE_F2BCQ_ID);
|
||||||
|
await semaphoreSlimInStock.WaitAsync();
|
||||||
if (string.IsNullOrEmpty(input.source_id))
|
if (string.IsNullOrEmpty(input.source_id))
|
||||||
{
|
{
|
||||||
throw new AppFriendlyException("来源单据id不可为空", 500);
|
throw new AppFriendlyException("来源单据id不可为空", 500);
|
||||||
@@ -813,14 +820,13 @@ namespace Tnb.WarehouseMgr
|
|||||||
|
|
||||||
if (wmsMaterialTransfer.warehouse_outstock != WmsWareHouseConst.WAREHOUSE_BCK_ID)
|
if (wmsMaterialTransfer.warehouse_outstock != WmsWareHouseConst.WAREHOUSE_BCK_ID)
|
||||||
{
|
{
|
||||||
throw new AppFriendlyException($@"转库单{wmsMaterialTransfer.bill_code}入库仓库不是四楼包材库,请检查!", HttpStatusCode.InternalServerError);
|
throw new AppFriendlyException($@"转库单{wmsMaterialTransfer.bill_code}出库仓库不是四楼包材库,请检查!", HttpStatusCode.InternalServerError);
|
||||||
}
|
}
|
||||||
if (wmsMaterialTransfer.warehouse_instock != WmsWareHouseConst.WAREHOUSE_F2BCQ_ID)
|
if (wmsMaterialTransfer.warehouse_instock != WmsWareHouseConst.WAREHOUSE_F2BCQ_ID)
|
||||||
{
|
{
|
||||||
throw new AppFriendlyException($@"转库单{wmsMaterialTransfer.bill_code}入库仓库不是二楼包材库,请检查!", HttpStatusCode.InternalServerError);
|
throw new AppFriendlyException($@"转库单{wmsMaterialTransfer.bill_code}入库仓库不是二楼包材库,请检查!", HttpStatusCode.InternalServerError);
|
||||||
}
|
}
|
||||||
|
|
||||||
await s_taskExecuteSemaphore.WaitAsync();
|
|
||||||
await _db.Ado.BeginTranAsync();
|
await _db.Ado.BeginTranAsync();
|
||||||
|
|
||||||
//入库取终点 //出库起点
|
//入库取终点 //出库起点
|
||||||
@@ -897,7 +903,8 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
_ = s_taskExecuteSemaphore.Release();
|
semaphoreSlimOutStock.Release();
|
||||||
|
semaphoreSlimInStock.Release();
|
||||||
InvokeGenPretaskExcute();
|
InvokeGenPretaskExcute();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1605,13 +1612,18 @@ namespace Tnb.WarehouseMgr
|
|||||||
// throw new AppFriendlyException($"此料架的库位为空!{input.carry_code}", 500);
|
// throw new AppFriendlyException($"此料架的库位为空!{input.carry_code}", 500);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(input.endlocation_id))
|
if (string.IsNullOrEmpty(input.endlocation_code))
|
||||||
{
|
{
|
||||||
Logger.LogWarning($"【CallRackToProductionLine】终点库位不能为空!{input.endlocation_id}");
|
Logger.LogWarning($"【CallRackToProductionLine】终点库位不能为空!{input.endlocation_code}");
|
||||||
throw new AppFriendlyException($"终点库位不能为空!{input.endlocation_id}", 500);
|
throw new AppFriendlyException($"终点库位不能为空!{input.endlocation_code}", 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
//BasLocation endlocation = _db.Queryable<BasLocation>().Where(r => r.location_code == wmsCarryH.work_station).First();
|
//BasLocation endlocation = _db.Queryable<BasLocation>().Where(r => r.location_code == wmsCarryH.work_station).First();
|
||||||
|
BasLocation endlocation = await _db.Queryable<BasLocation>().Where(r => r.location_code == input.endlocation_code).FirstAsync();
|
||||||
|
if (endlocation == null)
|
||||||
|
{
|
||||||
|
throw new AppFriendlyException($"终点库位{input.endlocation_code}在系统中不存在!", 500);
|
||||||
|
}
|
||||||
|
|
||||||
WmsPretaskH wmsPretaskH = _db.Queryable<WmsPretaskH>().Where(r => r.carry_code == wmsCarryH.carry_code && r.status != WmsWareHouseConst.PRETASK_BILL_STATUS_COMPLE_ID && r.status != WmsWareHouseConst.PRETASK_BILL_STATUS_CANCEL_ID).First();
|
WmsPretaskH wmsPretaskH = _db.Queryable<WmsPretaskH>().Where(r => r.carry_code == wmsCarryH.carry_code && r.status != WmsWareHouseConst.PRETASK_BILL_STATUS_COMPLE_ID && r.status != WmsWareHouseConst.PRETASK_BILL_STATUS_CANCEL_ID).First();
|
||||||
if (wmsPretaskH != null)
|
if (wmsPretaskH != null)
|
||||||
@@ -1622,7 +1634,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
|
|
||||||
CommonCreatePretaskInput commonCreatePretaskInput = new CommonCreatePretaskInput();
|
CommonCreatePretaskInput commonCreatePretaskInput = new CommonCreatePretaskInput();
|
||||||
commonCreatePretaskInput.startlocation_id = wmsCarryH.location_id;
|
commonCreatePretaskInput.startlocation_id = wmsCarryH.location_id;
|
||||||
commonCreatePretaskInput.endlocation_id = input.endlocation_id;
|
commonCreatePretaskInput.endlocation_id = endlocation.id;
|
||||||
commonCreatePretaskInput.carry_id = wmsCarryH.id;
|
commonCreatePretaskInput.carry_id = wmsCarryH.id;
|
||||||
commonCreatePretaskInput.carry_code = wmsCarryH.carry_code;
|
commonCreatePretaskInput.carry_code = wmsCarryH.carry_code;
|
||||||
commonCreatePretaskInput.task_type = "";
|
commonCreatePretaskInput.task_type = "";
|
||||||
@@ -1681,11 +1693,11 @@ namespace Tnb.WarehouseMgr
|
|||||||
JArray jArray = new JArray();
|
JArray jArray = new JArray();
|
||||||
foreach (WmsCarryH wmsCarryH in wmsCarryHs)
|
foreach (WmsCarryH wmsCarryH in wmsCarryHs)
|
||||||
{
|
{
|
||||||
if (wmsCarryH.carrystd_id != "26037267399717")
|
//if (wmsCarryH.carrystd_id != "26037267399717")
|
||||||
{
|
//{
|
||||||
Logger.LogWarning($"【RackAndMatByWorkstation】工位{input.work_station}绑定的{wmsCarryH.carry_code}载具不是料架类型!请检查");
|
// Logger.LogWarning($"【RackAndMatByWorkstation】工位{input.work_station}绑定的{wmsCarryH.carry_code}载具不是料架类型!请检查");
|
||||||
continue;
|
// continue;
|
||||||
}
|
//}
|
||||||
|
|
||||||
var matCodes = _db.Queryable<WmsCarryD>()
|
var matCodes = _db.Queryable<WmsCarryD>()
|
||||||
.InnerJoin<WmsCarryCode>((a, b) => a.membercarry_id == b.carry_id)
|
.InnerJoin<WmsCarryCode>((a, b) => a.membercarry_id == b.carry_id)
|
||||||
|
|||||||
@@ -165,8 +165,11 @@ namespace Tnb.WarehouseMgr
|
|||||||
[HttpPost, NonUnify, AllowAnonymous]
|
[HttpPost, NonUnify, AllowAnonymous]
|
||||||
public async Task<Tnb.WarehouseMgr.Entities.Dto.Outputs.Result> OutsourcedPartsInstock(OutsourcedPartsInstockInput input)
|
public async Task<Tnb.WarehouseMgr.Entities.Dto.Outputs.Result> OutsourcedPartsInstock(OutsourcedPartsInstockInput input)
|
||||||
{
|
{
|
||||||
|
SemaphoreSlim semaphoreSlim = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
semaphoreSlim = _wareHouseService.GetSemaphore("instock", WmsWareHouseConst.WAREHOUSE_CP_ID);
|
||||||
|
await semaphoreSlim.WaitAsync();
|
||||||
if (string.IsNullOrEmpty(input.carry_code))
|
if (string.IsNullOrEmpty(input.carry_code))
|
||||||
{
|
{
|
||||||
throw new AppFriendlyException("载具编号不可为空", 500);
|
throw new AppFriendlyException("载具编号不可为空", 500);
|
||||||
@@ -193,10 +196,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
throw new AppFriendlyException("此成品调拨任务已完成,不允许重复提交", 500);
|
throw new AppFriendlyException("此成品调拨任务已完成,不允许重复提交", 500);
|
||||||
}
|
}
|
||||||
await s_taskExecuteSemaphore.WaitAsync();
|
|
||||||
await _db.Ado.BeginTranAsync();
|
await _db.Ado.BeginTranAsync();
|
||||||
//入库取终点 //出库起点
|
//入库取终点 //出库起点
|
||||||
InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_CP_ID, Size = 1 };
|
InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_CP_ID,Region_id = WmsWareHouseConst.REGION_CPOutstock_ID, Size = 1 };
|
||||||
List<BasLocation> endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
|
List<BasLocation> endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
|
||||||
if (endLocations.Count == 0)
|
if (endLocations.Count == 0)
|
||||||
{
|
{
|
||||||
@@ -364,7 +366,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
_ = s_taskExecuteSemaphore.Release();
|
semaphoreSlim.Release();
|
||||||
await InvokeGenPretaskExcute();
|
await InvokeGenPretaskExcute();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -379,6 +381,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
[HttpPost, NonUnify, AllowAnonymous]
|
[HttpPost, NonUnify, AllowAnonymous]
|
||||||
public async Task<Tnb.WarehouseMgr.Entities.Dto.Outputs.Result> FinishproductOutstockSign(FinishproductOutstockSignInput input)
|
public async Task<Tnb.WarehouseMgr.Entities.Dto.Outputs.Result> FinishproductOutstockSign(FinishproductOutstockSignInput input)
|
||||||
{
|
{
|
||||||
|
|
||||||
Logger.LogInformation($"【FinishproductOutstockSign】载具签收 {input.carry_code}");
|
Logger.LogInformation($"【FinishproductOutstockSign】载具签收 {input.carry_code}");
|
||||||
if (string.IsNullOrEmpty(input.carry_code))
|
if (string.IsNullOrEmpty(input.carry_code))
|
||||||
{
|
{
|
||||||
@@ -455,8 +458,8 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.Error($"【FinishproductOutstockSign】 {ex.Message}");
|
Logger.LogWarning($"【FinishproductOutstockSign】 {ex.Message}");
|
||||||
Logger.Error($"【FinishproductOutstockSign】 {ex.StackTrace}");
|
Logger.LogWarning($"【FinishproductOutstockSign】 {ex.StackTrace}");
|
||||||
await _db.Ado.RollbackTranAsync();
|
await _db.Ado.RollbackTranAsync();
|
||||||
return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message);
|
return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message);
|
||||||
}
|
}
|
||||||
@@ -478,6 +481,27 @@ namespace Tnb.WarehouseMgr
|
|||||||
throw new AppFriendlyException("请选择区域", 500);
|
throw new AppFriendlyException("请选择区域", 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
OutStockStrategyQuery outStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_CP_ID, qty = 200, Region_id = WmsWareHouseConst.REGION_CPManualOutstock_ID, filter_carry_status = false };
|
||||||
|
List<WmsCarryH> items = await _wareHouseService.OutStockStrategy(outStockStrategyInput);
|
||||||
|
foreach (WmsCarryH wmsCarryH in items)
|
||||||
|
{
|
||||||
|
FinishproductOutstockSignInput signInput = new FinishproductOutstockSignInput();
|
||||||
|
signInput.carry_code = wmsCarryH.carry_code;
|
||||||
|
Entities.Dto.Outputs.Result result = await FinishproductOutstockSign(signInput);
|
||||||
|
if (result.code != HttpStatusCode.OK)
|
||||||
|
{
|
||||||
|
throw new Exception($@"库位{wmsCarryH.location_code}中的载具{wmsCarryH.carry_code}签收失败! 错误信息:{result.msg}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.LogWarning($"【FinishproductOutstockSignAll】 {ex.Message}");
|
||||||
|
Logger.LogWarning($"【FinishproductOutstockSignAll】 {ex.StackTrace}");
|
||||||
|
return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
return await ToApiResult(HttpStatusCode.OK, "成功");
|
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,13 +58,11 @@ namespace Tnb.WarehouseMgr
|
|||||||
|
|
||||||
private async Task<dynamic> PDAWmsEmptyOut(VisualDevModelDataCrInput input)
|
private async Task<dynamic> PDAWmsEmptyOut(VisualDevModelDataCrInput input)
|
||||||
{
|
{
|
||||||
|
SemaphoreSlim semaphoreSlim = null;
|
||||||
if (input.data[nameof(OutStockStrategyQuery.warehouse_id)].ToString() == WmsWareHouseConst.WAREHOUSE_ZC_ID)
|
|
||||||
await _s_taskExecuteSemaphore_F1ZCCOutstock.WaitAsync();
|
|
||||||
else if (input.data[nameof(OutStockStrategyQuery.warehouse_id)].ToString() == WmsWareHouseConst.WAREHOUSE_HCC_ID)
|
|
||||||
await _s_taskExecuteSemaphore_F2HCCOutstock.WaitAsync();
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
semaphoreSlim = _wareHouseService.GetSemaphore("outstock", input.data[nameof(OutStockStrategyQuery.warehouse_id)].ToString());
|
||||||
|
await semaphoreSlim.WaitAsync();
|
||||||
Logger.Information("开始PDA空载具出库");
|
Logger.Information("开始PDA空载具出库");
|
||||||
await _db.Ado.BeginTranAsync();
|
await _db.Ado.BeginTranAsync();
|
||||||
|
|
||||||
@@ -74,10 +72,15 @@ namespace Tnb.WarehouseMgr
|
|||||||
|
|
||||||
//出库取起点,获取所有符合输入的载具规格的载具
|
//出库取起点,获取所有符合输入的载具规格的载具
|
||||||
WmsEmptyOutstockH setQty = await _db.Queryable<WmsEmptyOutstockH>().FirstAsync(it => it.bill_code == input.data[nameof(WmsEmptyOutstockH.bill_code)].ToString());
|
WmsEmptyOutstockH setQty = await _db.Queryable<WmsEmptyOutstockH>().FirstAsync(it => it.bill_code == input.data[nameof(WmsEmptyOutstockH.bill_code)].ToString());
|
||||||
List<WmsCarryH>? carrys = await _db.Queryable<WmsCarryH>().LeftJoin<BasLocation>((a, b) => a.location_id == b.id)
|
//出库取起点,获取所有符合输入的载具规格的载具
|
||||||
.Where((a, b) => a.carrystd_id == input.data[nameof(WmsEmptyOutstockH.carrystd_id)].ToString()
|
OutStockStrategyQuery OutStockStrategyInput = new()
|
||||||
&& a.carry_status == ((int)EnumCarryStatus.空闲).ToString() && a.is_lock == 0 && b.is_lock == 0 && b.is_type == ((int)EnumLocationType.存储库位).ToString())
|
{
|
||||||
.ToListAsync();
|
carrystd_id = input.data[nameof(OutStockStrategyQuery.carrystd_id)].ToString(),
|
||||||
|
warehouse_id = input.data[nameof(OutStockStrategyQuery.warehouse_id)].ToString(),
|
||||||
|
Size = 1
|
||||||
|
};
|
||||||
|
List<WmsCarryH>? carrys = await _wareHouseService.OutStockStrategy(OutStockStrategyInput);
|
||||||
|
Logger.Information($"根据出库策略获取的载具数量:{carrys?.Count}");
|
||||||
|
|
||||||
WmsPointH sPoint = null!;
|
WmsPointH sPoint = null!;
|
||||||
WmsPointH ePoint = null!;
|
WmsPointH ePoint = null!;
|
||||||
@@ -90,14 +93,12 @@ namespace Tnb.WarehouseMgr
|
|||||||
|
|
||||||
Logger.Information($"PDA空载具出库实际可出载具数量:{carrys.Count}");
|
Logger.Information($"PDA空载具出库实际可出载具数量:{carrys.Count}");
|
||||||
|
|
||||||
if (int.Parse(input.data["qty"].ToString())> carrys.Count)
|
if (carrys.Count < 1)
|
||||||
{
|
{
|
||||||
throw new AppFriendlyException($"实际可出空载具数量只有 {carrys.Count}", 500);
|
throw new AppFriendlyException($"没有可以出库的空载具", 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
//根据每个载具的起始库位做路径运算
|
//根据每个载具的起始库位做路径运算
|
||||||
for (i = 0; i < int.Parse(input.data["qty"].ToString()); i++)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (carrys?.Count > 0)
|
if (carrys?.Count > 0)
|
||||||
{
|
{
|
||||||
@@ -221,9 +222,6 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
await _db.Ado.CommitTranAsync();
|
await _db.Ado.CommitTranAsync();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -235,11 +233,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if (input.data[nameof(OutStockStrategyQuery.warehouse_id)].ToString() == WmsWareHouseConst.WAREHOUSE_ZC_ID)
|
semaphoreSlim.Release();
|
||||||
_s_taskExecuteSemaphore_F1ZCCOutstock.Release();
|
|
||||||
else if (input.data[nameof(OutStockStrategyQuery.warehouse_id)].ToString() == WmsWareHouseConst.WAREHOUSE_HCC_ID)
|
|
||||||
_s_taskExecuteSemaphore_F2HCCOutstock.Release();
|
|
||||||
|
|
||||||
await InvokeGenPretaskExcute();
|
await InvokeGenPretaskExcute();
|
||||||
}
|
}
|
||||||
return Task.FromResult(true);
|
return Task.FromResult(true);
|
||||||
|
|||||||
@@ -148,8 +148,11 @@ namespace Tnb.WarehouseMgr
|
|||||||
public async Task<Tnb.WarehouseMgr.Entities.Dto.Outputs.Result> Distribute(SaleReleaseDistributeInput input)
|
public async Task<Tnb.WarehouseMgr.Entities.Dto.Outputs.Result> Distribute(SaleReleaseDistributeInput input)
|
||||||
{
|
{
|
||||||
Logger.LogInformation($"【Distribute】 销售出库下发");
|
Logger.LogInformation($"【Distribute】 销售出库下发");
|
||||||
|
SemaphoreSlim semaphoreSlim = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
semaphoreSlim = _wareHouseService.GetSemaphore("outstock", WmsWareHouseConst.WAREHOUSE_CP_ID);
|
||||||
|
await semaphoreSlim.WaitAsync();
|
||||||
if (input.qty <= 0)
|
if (input.qty <= 0)
|
||||||
{
|
{
|
||||||
throw new AppFriendlyException("数量必须大于0", 500);
|
throw new AppFriendlyException("数量必须大于0", 500);
|
||||||
@@ -160,7 +163,6 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
|
|
||||||
WmsSaleD wmsOutstockD = await _db.Queryable<WmsSaleD>().FirstAsync(it => it.id == input.source_id);
|
WmsSaleD wmsOutstockD = await _db.Queryable<WmsSaleD>().FirstAsync(it => it.id == input.source_id);
|
||||||
await s_taskExecuteSemaphore.WaitAsync();
|
|
||||||
await _db.Ado.BeginTranAsync();
|
await _db.Ado.BeginTranAsync();
|
||||||
//入库取终点 //出库起点
|
//入库取终点 //出库起点
|
||||||
OutStockStrategyQuery outStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_CP_ID, material_id = wmsOutstockD.material_id, qty = input.qty, code_batch = wmsOutstockD.code_batch, Region_id = WmsWareHouseConst.REGION_CPOutstock_ID };
|
OutStockStrategyQuery outStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_CP_ID, material_id = wmsOutstockD.material_id, qty = input.qty, code_batch = wmsOutstockD.code_batch, Region_id = WmsWareHouseConst.REGION_CPOutstock_ID };
|
||||||
@@ -188,6 +190,13 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
throw new AppFriendlyException("一楼没有足够的未锁定且空闲的出库工位", 500);
|
throw new AppFriendlyException("一楼没有足够的未锁定且空闲的出库工位", 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<BasLocation> endLocations_temp = await _db.Queryable<BasLocation>().Where(r => r.region_id == WmsWareHouseConst.REGION_CPOutstockCache_ID && r.is_lock == 0 && r.is_use == "0").ToListAsync();
|
||||||
|
|
||||||
|
if (endLocations_temp.Count < items_pretask.Count)
|
||||||
|
{
|
||||||
|
throw new AppFriendlyException($"三楼发货时,没有可用的暂存库位可以使用,需要下发任务{items_pretask.Count}条,可用的暂存库位只有{endLocations_temp.Count}条", 500);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//人工发货
|
//人工发货
|
||||||
else
|
else
|
||||||
@@ -400,7 +409,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
_ = s_taskExecuteSemaphore.Release();
|
semaphoreSlim.Release();
|
||||||
await InvokeGenPretaskExcute();
|
await InvokeGenPretaskExcute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
warehouse_name = d.whname,
|
warehouse_name = d.whname,
|
||||||
material_name = f.name,
|
material_name = f.name,
|
||||||
material_specification = f.material_specification,
|
material_specification = f.material_specification,
|
||||||
container_no = f.container_no,
|
container_no = f.material_standard,
|
||||||
create_time = a.create_time,
|
create_time = a.create_time,
|
||||||
create_id = a.create_id,
|
create_id = a.create_id,
|
||||||
code_batch = a.code_batch,
|
code_batch = a.code_batch,
|
||||||
@@ -79,18 +79,6 @@ namespace Tnb.WarehouseMgr
|
|||||||
supplier_name = "",
|
supplier_name = "",
|
||||||
}, true).ToListAsync();
|
}, true).ToListAsync();
|
||||||
|
|
||||||
|
|
||||||
string ssssss = _db.Queryable<WmsCarryCode>().InnerJoin<WmsCarryH>((a, b) => a.carry_id == b.id)
|
|
||||||
.InnerJoin<BasLocation>((a, b, c) => b.location_id == c.id).InnerJoin<BasWarehouse>((a, b, c, d) => c.wh_id == d.id)
|
|
||||||
.LeftJoin<WmsTempCode>((a, b, c, d, e) => e.barcode == a.barcode)
|
|
||||||
.InnerJoin<BasMaterial>((a, b, c, d, e, f) => f.id == a.material_id)
|
|
||||||
.LeftJoin<WmsPurchaseD>((a, b, c, d, e, f, g) => e.require_id == g.id)
|
|
||||||
.LeftJoin<WmsPurchaseH>((a, b, c, d, e, f, g, h) => h.id == g.bill_id)
|
|
||||||
.WhereIF(!string.IsNullOrEmpty(material_specification), (a, b, c, d, e, f) => f.material_specification.Contains(material_specification))
|
|
||||||
.WhereIF(!string.IsNullOrEmpty(code_batch), (a, b, c, d, e, f) => a.code_batch.Contains(code_batch))
|
|
||||||
.WhereIF(!string.IsNullOrEmpty(container_no), (a, b, c, d, e, f) => f.container_no.Contains(container_no))
|
|
||||||
.WhereIF(!string.IsNullOrEmpty(material_code), (a, b, c, d, e, f) => f.code.Contains(material_code)).ToSqlString();
|
|
||||||
|
|
||||||
List<WmsCarryCode> carryCodes = await _db.Queryable<WmsCarryCode>().ToListAsync();
|
List<WmsCarryCode> carryCodes = await _db.Queryable<WmsCarryCode>().ToListAsync();
|
||||||
var storeMap = items.DistinctBy(x => new { x.warehouse_id, x.material_id, x.code_batch }).ToDictionary(x => new { x.warehouse_id, x.material_id, x.code_batch }, x => x);
|
var storeMap = items.DistinctBy(x => new { x.warehouse_id, x.material_id, x.code_batch }).ToDictionary(x => new { x.warehouse_id, x.material_id, x.code_batch }, x => x);
|
||||||
|
|
||||||
@@ -147,7 +135,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
warehouse_name = d.whname,
|
warehouse_name = d.whname,
|
||||||
material_name = f.name,
|
material_name = f.name,
|
||||||
material_specification = f.material_specification,
|
material_specification = f.material_specification,
|
||||||
container_no = f.container_no,
|
container_no = f.material_standard,
|
||||||
create_time = a.create_time,
|
create_time = a.create_time,
|
||||||
create_id = a.create_id,
|
create_id = a.create_id,
|
||||||
code_batch = a.code_batch,
|
code_batch = a.code_batch,
|
||||||
|
|||||||
@@ -79,8 +79,11 @@ namespace Tnb.WarehouseMgr
|
|||||||
public async Task<Tnb.WarehouseMgr.Entities.Dto.Outputs.Result> Distribute(WmsTransferOutstockInput input)
|
public async Task<Tnb.WarehouseMgr.Entities.Dto.Outputs.Result> Distribute(WmsTransferOutstockInput input)
|
||||||
{
|
{
|
||||||
Logger.LogInformation($"【Distribute】 成品调拨出库下发");
|
Logger.LogInformation($"【Distribute】 成品调拨出库下发");
|
||||||
|
SemaphoreSlim semaphoreSlim = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
semaphoreSlim = _wareHouseService.GetSemaphore("outstock", WmsWareHouseConst.WAREHOUSE_CP_ID);
|
||||||
|
await semaphoreSlim.WaitAsync();
|
||||||
if (input.qty <= 0)
|
if (input.qty <= 0)
|
||||||
{
|
{
|
||||||
throw new AppFriendlyException("数量必须大于0", 500);
|
throw new AppFriendlyException("数量必须大于0", 500);
|
||||||
@@ -91,7 +94,6 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
|
|
||||||
WmsTransferOutstockD wmsOutstockD = await _db.Queryable<WmsTransferOutstockD>().FirstAsync(it => it.id == input.source_id);
|
WmsTransferOutstockD wmsOutstockD = await _db.Queryable<WmsTransferOutstockD>().FirstAsync(it => it.id == input.source_id);
|
||||||
await s_taskExecuteSemaphore.WaitAsync();
|
|
||||||
await _db.Ado.BeginTranAsync();
|
await _db.Ado.BeginTranAsync();
|
||||||
//入库取终点 //出库起点
|
//入库取终点 //出库起点
|
||||||
OutStockStrategyQuery outStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_CP_ID, material_id = wmsOutstockD.material_id, qty = input.qty, code_batch = wmsOutstockD.pi_code, Region_id = WmsWareHouseConst.REGION_CPOutstock_ID };
|
OutStockStrategyQuery outStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_CP_ID, material_id = wmsOutstockD.material_id, qty = input.qty, code_batch = wmsOutstockD.pi_code, Region_id = WmsWareHouseConst.REGION_CPOutstock_ID };
|
||||||
@@ -149,6 +151,12 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
throw new AppFriendlyException("一楼没有足够的未锁定且空闲的出库工位", 500);
|
throw new AppFriendlyException("一楼没有足够的未锁定且空闲的出库工位", 500);
|
||||||
}
|
}
|
||||||
|
List<BasLocation> endLocations_temp = await _db.Queryable<BasLocation>().Where(r => r.region_id == WmsWareHouseConst.REGION_CPOutstockCache_ID && r.is_lock == 0 && r.is_use == "0").ToListAsync();
|
||||||
|
|
||||||
|
if (endLocations_temp.Count < items_pretask.Count)
|
||||||
|
{
|
||||||
|
throw new AppFriendlyException($"三楼发货时,没有可用的暂存库位可以使用,需要下发任务{items_pretask.Count}条,可用的暂存库位只有{endLocations_temp.Count}条", 500);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//人工发货
|
//人工发货
|
||||||
else
|
else
|
||||||
@@ -327,7 +335,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
_ = s_taskExecuteSemaphore.Release();
|
semaphoreSlim.Release();
|
||||||
await InvokeGenPretaskExcute();
|
await InvokeGenPretaskExcute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user