同步bip调整

This commit is contained in:
2024-07-11 14:42:10 +08:00
parent 614681284d
commit a75fc548cb

View File

@@ -27,6 +27,7 @@ using NetTaste;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Npgsql;
using NPOI.OpenXmlFormats;
using Org.BouncyCastle.Asn1.X509;
using Org.BouncyCastle.Asn1.X509.Qualified;
using Qiniu.Util;
@@ -57,6 +58,7 @@ namespace Tnb.ProductionMgr
public class RedisBackGround : IHostedService, IDisposable
{
#region
private static Timer? GenTaskExecutetimer;
private static Timer? Readtimer;
private static Timer? CheckGettimer;
private static Timer? Scantimer;
@@ -1445,7 +1447,8 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
LoggerFloor2RackDelivery.LogInformation($"【移走上升降区满托的料架】 开始执行预任务生成: 料架区为{wmsMechanicalArmH.name}{wmsMechanicalArmH.stackingposition} 料架为{wmsMechanicalArmH.rackcode}");
bool result = await createPretask(wmsMechanicalArmH.location_id, endLocation.id, wmsMechanicalArmH.rackid, wmsMechanicalArmH.rackcode, LoggerFloor2RackDelivery, db_Floor2timer移走上升降区未生成预任务且满托的料架);
WmsMaterialTransfer wmsMaterialTransfer = await db_Floor2timer移走上升降区未生成预任务且满托的料架.Queryable<WmsMaterialTransfer>().Where(r => r.bill_code == wmsMechanicalArmH.outbill).FirstAsync();
bool result = await createPretask(wmsMechanicalArmH.location_id, endLocation.id, wmsMechanicalArmH.rackid, wmsMechanicalArmH.rackcode, LoggerFloor2RackDelivery, db_Floor2timer移走上升降区未生成预任务且满托的料架, true, wmsMaterialTransfer.id);
if (!result)
{
LoggerFloor2RackDelivery.LogError($"【移走上升降区满托的料架】 未成功生成预任务 起点{wmsMechanicalArmH.location_code} 终点{endLocation.location_code} 料架 {wmsMechanicalArmH.rackcode}");
@@ -1577,7 +1580,8 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
LoggerFloor2RackDelivery.LogInformation($"【移走下升降区空托的料架】 开始执行预任务生成: 料架区为{wmsMechanicalArmH.name}{wmsMechanicalArmH.stackingposition} 料架为{wmsMechanicalArmH.rackcode}");
bool result = await createPretask(wmsMechanicalArmH.location_id, endLocation.id, wmsMechanicalArmH.rackid, wmsMechanicalArmH.rackcode, LoggerFloor2RackDelivery, db_Floor2timer移走下升降区未生成预任务且空托的料架);
WmsMaterialTransfer wmsMaterialTransfer = await db_Floor2timer移走下升降区未生成预任务且空托的料架.Queryable<WmsMaterialTransfer>().Where(r => r.bill_code == wmsMechanicalArmH.outbill).FirstAsync();
bool result = await createPretask(wmsMechanicalArmH.location_id, endLocation.id, wmsMechanicalArmH.rackid, wmsMechanicalArmH.rackcode, LoggerFloor2RackDelivery, db_Floor2timer移走下升降区未生成预任务且空托的料架, true, wmsMaterialTransfer.id);
if (!result)
{
LoggerFloor2RackDelivery.LogInformation($"【移走下升降区空托的料架】 未成功生成预任务 起点{wmsMechanicalArmH.location_code} 终点{endLocation.location_code} 料架 {wmsMechanicalArmH.rackcode}");
@@ -1613,8 +1617,19 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
}
}
/// <summary>
/// 定时触发一次任务执行生成
/// </summary>
/// <param name="args"></param>
public async void GenTaskExecute(object? args)
{
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 触发任务执行");
LoggerTimer.LogInformation($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 触发任务执行");
_wareHouseService.GenTaskExecute();
}
// 上下升降机生成预任务(补充料架、上升降机取货到料架、上升降机满托运走,下升降机拿货到输送线、下升降机空托运走)
private async Task<bool> createPretask(string startlocation_id, string endlocation_id, string carry_id, string carry_code, ILogger logger, ISqlSugarClient dbConn)
private async Task<bool> createPretask(string startlocation_id, string endlocation_id, string carry_id, string carry_code, ILogger logger, ISqlSugarClient dbConn, bool isSync2Erp = false, string source_id = "")
{
CommonCreatePretaskInput commonCreatePretaskInput = new CommonCreatePretaskInput();
commonCreatePretaskInput.startlocation_id = startlocation_id;
@@ -1622,8 +1637,9 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
commonCreatePretaskInput.carry_id = carry_id;
commonCreatePretaskInput.carry_code = carry_code;
commonCreatePretaskInput.task_type = WmsWareHouseConst.BIZTYPE_WMSTRANSFER_ID;
commonCreatePretaskInput.biz_type = "";
commonCreatePretaskInput.biz_type = isSync2Erp ? "erp_qtrk" : "";
commonCreatePretaskInput.require_id = "";
commonCreatePretaskInput.source_id = source_id;
commonCreatePretaskInput.isExcuteMission = false;
logger.LogInformation($"开始执行 GenPreTask {JsonConvert.SerializeObject(commonCreatePretaskInput)}");
@@ -1778,6 +1794,8 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
Floor2timer移走上升降区未生成预任务且满托的料架 = new Timer(, null, TimeSpan.Zero, TimeSpan.FromSeconds(30));
Floor2timer移走下升降区未生成预任务且空托的料架 = new Timer(, null, TimeSpan.Zero, TimeSpan.FromSeconds(30));
GenTaskExecutetimer = new Timer(GenTaskExecute, null, TimeSpan.Zero, TimeSpan.FromSeconds(30));
return Task.CompletedTask;
}