任务链下发、日志优化

This commit is contained in:
2024-07-24 12:46:04 +08:00
parent dd0ef3c8e2
commit 79a1828b21
5 changed files with 58 additions and 5 deletions

View File

@@ -130,4 +130,8 @@ public partial class BasLocation : BaseEntity<string>
/// 任务数
/// </summary>
public int task_nums { get; set; }
/// <summary>
/// 通道
/// </summary>
public string passage { get; set; }
}

View File

@@ -857,14 +857,15 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
var DistaskH = db_SSXcodetimer.Queryable<WmsDistaskH>().Where(p => p.carry_code == result && p.status != WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID).OrderByDescending(p => p.create_time).First();
if (DistaskH != null)
{
LoggerSSX.LogInformation($"【定时任务SSXcode】DistaskH != null putdic.Keys.Contains(DistaskH.startlocation_code):{putdic.Keys.Contains(DistaskH.startlocation_code)} {result}");
string target = putdic.Keys.Contains(DistaskH.startlocation_code) ? putdic.Where(p => p.Key == DistaskH.startlocation_code).First().Value.ToString() : "13";
LoggerSSX.LogInformation($"【定时任务SSXcode】下升降机入中储仓任务{DistaskH.bill_code} 判定料箱{result} 去{target}线");
Dictionary<string, string> dicCommand2 = new(StringComparer.OrdinalIgnoreCase)
{
["DevName"] = key,
["token"] = _eleCtlCfg.token,
["TagName"] = strs[3],
["Value"] = putdic.Keys.Contains(DistaskH.startlocation_code) ? putdic.Where(p => p.Key == DistaskH.startlocation_code).First().Value.ToString() : "13",
["Value"] = target,
};
HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand2).Wait();
Dictionary<string, string> dicCommand = new(StringComparer.OrdinalIgnoreCase)
@@ -878,7 +879,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
}
else
{
LoggerSSX.LogInformation($"【定时任务SSXcode】DistaskH == null ");
LoggerSSX.LogInformation($"【定时任务SSXcode】找不到料箱对应的下升降机入中储仓任务 判定料箱{result} 去13线 ");
Dictionary<string, string> dicCommand2 = new(StringComparer.OrdinalIgnoreCase)
{
["DevName"] = key,

View File

@@ -64,6 +64,14 @@
/// </summary>
public const string WAREHOUSE_F2KTQ_ID = "35434202453013";
/// <summary>
/// 原材料缓存区
/// </summary>
public const string REGION_YCLCache_ID = "35724362038549";
/// <summary>
/// 采购存储区
/// </summary>
public const string REGION_Purchase_ID = "26125793924133";
/// <summary>
/// 长管出库

View File

@@ -1895,7 +1895,7 @@ namespace Tnb.WarehouseMgr
else if (distaskH.task_type == WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID || distaskH.task_type == WmsWareHouseConst.BIZTYPE_WMSTRANSFER_ID)
{
var orgdistaskHs = OriginDistaskH.Where(p => p.status == WmsWareHouseConst.TASK_BILL_STATUS_DZX_ID && p.task_type == WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID && p.endpoint_id == distaskH.endpoint_id).ToList();
var newdistaskHs = NewdistaskHs = OriginDistaskH.Where(p => p.status == WmsWareHouseConst.TASK_BILL_STATUS_DZX_ID && p.task_type == WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID && p.endpoint_id == distaskH.endpoint_id).ToList();
var newdistaskHs = NewdistaskHs.Where(p => p.status == WmsWareHouseConst.TASK_BILL_STATUS_DZX_ID && p.task_type == WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID && p.endpoint_id == distaskH.endpoint_id).ToList();
if ((orgdistaskHs.Count + newdistaskHs.Count) == 0)
{
var groups = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_TASK_EXECUTE_ENCODE).Result;

View File

@@ -151,7 +151,47 @@ namespace Tnb.WarehouseMgr
var result = data.Adapt<CarryMaterialDetail>();
return result;
}
[HttpPost]
public async Task CarryMaterialBind(CarryMaterialBindInput input)
{
try
{
WmsCarryH? carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.carry_code == input.carrycode);
List<WmsCarryCode> WmsCarryCodes = new List<WmsCarryCode>();
foreach (var detail in input.details)
{
var WmsCarryCode = detail.Adapt<WmsCarryCode>();
WmsCarryCode.id = SnowflakeIdHelper.NextId();
WmsCarryCode.carry_id = carry.id;
WmsCarryCode.is_out = 0;
WmsCarryCode.create_id = input.create_id;
WmsCarryCode.create_time = DateTime.Now;
WmsCarryCodes.Add(WmsCarryCode);
}
int rows = 0;
if (WmsCarryCodes.Count > 0)
rows = await _db.Insertable(WmsCarryCodes).ExecuteCommandAsync();
if (rows == 0)
{
throw new Exception($"物料列表为空,不能提交绑定,可能的原因;1.需要检查扫码设置(新PDA) 2.未扫到有效的二维码 详细信息:接收到{input.details.Count}个条码 但是成功绑定的条码数量为0个");
}
}
catch (PostgresException ex)
{
Logger.LogError(ex.Message);
Logger.LogError(ex.StackTrace);
throw new AppFriendlyException($"绑定失败(1.可能是存在已被绑定的条码 2.存在其他与此载具编号相同的载具 3.存在字段传了空值) {ex.Message}", 500);
}
catch (Exception ex)
{
Logger.LogError(ex.Message);
Logger.LogError(ex.StackTrace);
throw new AppFriendlyException($"绑定失败 {ex.Message}", 500);
}
}
[NonAction]
public async Task CarryMaterialBind(CarryMaterialBindInput input, ISqlSugarClient dbConn = null)
{
var db = _db;