Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
2024-05-28 14:02:53 +08:00
12 changed files with 549 additions and 76 deletions

View File

@@ -11,6 +11,7 @@ using JNPF.Common.Cache;
using JNPF.Common.Core.Manager;
using JNPF.Common.Dtos.VisualDev;
using JNPF.Common.Extension;
using JNPF.Common.Security;
using JNPF.FriendlyException;
using JNPF.Systems.Interfaces.System;
using Microsoft.AspNetCore.Identity;
@@ -61,7 +62,10 @@ namespace Tnb.ProductionMgr
// 二楼上升降机
private Timer? Floor2UpMachinecodetimer;
// 二楼料架配送
private Timer? Floor2RackDeliverytimer;
private Timer? Floor2timer送空托到上升降区;
private Timer? Floor2timer送满托到下升降区;
private Timer? Floor2timer移走上升降区未生成预任务且满托的料架;
private Timer? Floor2timer移走下升降区未生成预任务且空托的料架;
public static SemaphoreSlim s_taskExecuteFloor2UpMachinecodetimer = new(1);
public static SemaphoreSlim s_task送空托到上升降区 = new(1);
@@ -93,7 +97,7 @@ namespace Tnb.ProductionMgr
_wmsCarryBindService = wmsCarryBindService;
}
//获取redis数据
private void GetRedisData(object state)
private void GetRedisData(object? state)
{
var _redisReadConfigs = _repository.AsQueryable().Where(p => p.enabled == 1).ToList();
foreach (var config in _redisReadConfigs)
@@ -173,7 +177,7 @@ namespace Tnb.ProductionMgr
}
}
//ctu取货
private void CheckGet(object state)
private void CheckGet(object? state)
{
Dictionary<string, string[]> getdic = new Dictionary<string, string[]>();
getdic.Add("SSX-021-005", new string[] { "YTCS", "AllowFullOut_CS05", "LiftCode" });
@@ -424,7 +428,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
#region
//扫码入库
private void ScanInStock(object state)
private void ScanInStock(object? state)
{
Dictionary<string, string[]> getdic = new Dictionary<string, string[]>();
getdic.Add("BGWRKYCL02", new string[] { "CP8", "AllowGetFullBox1", "code1", "PutDoneEmptyBox", "false" });
@@ -506,7 +510,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
/// <summary>
/// 八工位空托盘补充
/// </summary>
private async void BGWCarrySupplement(object state)
private async void BGWCarrySupplement(object? state)
{
Dictionary<string, string[]> getdic = new Dictionary<string, string[]>();
getdic.Add("YCLCKBGW", new string[] { "CP8", "AllowPutEmptyBox1" });
@@ -597,7 +601,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
/// <summary>
/// 供料叠盘机空托盘自动入库
/// </summary>
private async void YCLGLDPJInstock(object state)
private async void YCLGLDPJInstock(object? state)
{
Dictionary<string, string[]> getdic = new Dictionary<string, string[]>();
getdic.Add("SGW-YCL", new string[] { "CP3-3", "AllowGetFullBox" });
@@ -682,7 +686,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
/// <summary>
/// 外协叠盘机空托盘自动入库
/// </summary>
private async void YCLWXDPJInstock(object state)
private async void YCLWXDPJInstock(object? state)
{
Dictionary<string, string[]> getdic = new Dictionary<string, string[]>();
getdic.Add("未定", new string[] { "CP3-3", "AllowGetFullBox" });
@@ -769,7 +773,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
#region
private void SSXcode(object state)
private void SSXcode(object? state)
{
Dictionary<string, string[]> dic = new Dictionary<string, string[]>();
dic.Add("东面提升机输送线", new string[] { "下升降机判断请求", "下升降机判断条码", "下升降机判断完毕", "下升降机判断结果" });
@@ -868,7 +872,11 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
Scantimer?.Dispose();
SSXcodetimer?.Dispose();
Floor2UpMachinecodetimer?.Dispose();
Floor2RackDeliverytimer?.Dispose();
Floor2timer送空托到上升降区?.Dispose();
Floor2timer送满托到下升降区?.Dispose();
Floor2timer移走上升降区未生成预任务且满托的料架?.Dispose();
Floor2timer移走下升降区未生成预任务且空托的料架?.Dispose();
BGWCarrySupplementtimer?.Dispose();
YCLGLDPJInstocktimer?.Dispose();
YCLWXDPJInstocktimer?.Dispose();
@@ -876,7 +884,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
#region
// 上升降机
private async void Floor2UpMachinecode(object args)
private async void Floor2UpMachinecode(object? args)
{
string barcode = await Floor2UpDownMachinecode_GetTag<string>(MechanicalArmConsts.);
if (string.IsNullOrEmpty(barcode))
@@ -968,7 +976,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
}
// 尝试写入空托送到信号
bool result上升降机空托送到 = await Floor2UpDownMachinecode_SetTag($"上升降机空托{target.stackingposition}送到", "true");
LoggerFloor2UpDownMachine.LogInformation($@"【送空托到上升降】回写 上升降机空托{target.stackingposition}送到 结果为{result上升降机空托送到}");
LoggerFloor2UpDownMachine.LogInformation($@"【上升降】回写 上升降机空托{target.stackingposition}送到 结果为{result上升降机空托送到}");
if (!result上升降机空托送到)
{
return;
@@ -1056,7 +1064,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
/// 送空托到上升降区
/// </summary>
/// <returns></returns>
public async Task<bool> ()
public async void (object? args)
{
#region
List<string> configs_upMachine = new List<string>();
@@ -1073,7 +1081,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
// 没有有效信号
if (configs_upMachine.Count == 0)
return false;
return;
#endregion
using (var db = _repository.AsSugarClient().CopyNew())
@@ -1086,13 +1094,13 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
InnerJoin<WmsPointH>((a, b) => a.point_id == b.id)
.InnerJoin<BasLocation>((a, b, c) => b.location_id == c.id)
.Where((a, b, c) => string.IsNullOrEmpty(a.rackcode) && c.is_lock == 0 && configs_upMachine.Contains(a.name));
List<WmsMechanicalArmH> WmsMechanicalArmHs = WmsMechanicalArmHsuagar.ToList();
if (WmsMechanicalArmHs.Count() == 0)
{
LoggerFloor2RackDelivery.LogWarning($"【送空托到上升降区】 无需补充料架区 {WmsMechanicalArmHsuagar.ToSqlString()}");
return false;
return;
}
// 料架区
@@ -1171,15 +1179,16 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
continue;
}
}
return true;
}
catch (Exception ex)
{
return false;
}
finally
{
s_task送空托到上升降区.Release();
_wareHouseService.GenTaskExecute();
}
}
}
@@ -1188,7 +1197,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
/// 送满托到下升降区
/// </summary>
/// <returns></returns>
public async Task<bool> ()
public async void (object? args)
{
#region
List<string> configs_upMachine = new List<string>();
@@ -1205,7 +1214,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
// 没有有效信号
if (configs_upMachine.Count == 0)
return false;
return;
#endregion
using (var db = _repository.AsSugarClient().CopyNew())
@@ -1224,7 +1233,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
if (WmsMechanicalArmHs.Count() == 0)
{
LoggerFloor2RackDelivery.LogWarning($"【送满托到下升降区】 无需补充料架区 {WmsMechanicalArmHsuagar.ToSqlString()}");
return false;
return;
}
// 料架区
@@ -1326,15 +1335,14 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
continue;
}
}
return true;
}
catch (Exception ex)
{
return false;
}
finally
{
s_task送满托到下升降区.Release();
_wareHouseService.GenTaskExecute();
}
}
}
@@ -1344,7 +1352,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
/// 移走上升降区未生成预任务且满托的料架
/// </summary>
/// <returns></returns>
public async Task<bool> ()
public async void (object? args)
{
#region
List<string> configs_upMachine = new List<string>();
@@ -1361,7 +1369,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
// 没有有效信号
if (configs_upMachine.Count == 0)
return false;
return;
#endregion
using (var db = _repository.AsSugarClient().CopyNew())
@@ -1435,15 +1443,14 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
}
LoggerFloor2RackDelivery.LogInformation($"【移走上升降区满托的料架】 成功生成预任务 {result.Item2}");
}
return true;
}
catch (Exception ex)
{
return false;
}
finally
{
s_task移走上升降区未生成预任务且满托的料架.Release();
_wareHouseService.GenTaskExecute();
}
}
}
@@ -1453,7 +1460,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
/// 移走下升降区未生成预任务且空托的料架
/// </summary>
/// <returns></returns>
public async Task<bool> ()
public async void (object? args)
{
#region
List<string> configs_upMachine = new List<string>();
@@ -1471,7 +1478,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
// 没有有效信号
if (configs_upMachine.Count == 0)
return false;
return;
#endregion
using (var db = _repository.AsSugarClient().CopyNew())
{
@@ -1551,47 +1558,20 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
continue;
}
}
return true;
}
catch (Exception ex)
{
LoggerFloor2RackDelivery.LogError(ex.ToString());
LoggerFloor2RackDelivery.LogError(ex.StackTrace);
return false;
}
finally
{
s_task移走下升降区未生成预任务且空托的料架.Release();
_wareHouseService.GenTaskExecute();
}
}
}
// 料架配送
private async void Floor2RackDelivery(object args)
{
try
{
// 送空托到上升降区
await ();
// 送满托到下升降区
await ();
// 移走上升降区未生成预任务且满托的料架
await ();
// 移走下升降区未生成预任务且空托的料架
await ();
_ = _wareHouseService.GenTaskExecute();
}
catch (Exception ex)
{
LoggerFloor2RackDelivery.LogError(ex.ToString());
LoggerFloor2RackDelivery.LogError(ex.StackTrace);
}
}
// 上下升降机生成预任务(补充料架、上升降机取货到料架、上升降机满托运走,下升降机拿货到输送线、下升降机空托运走)
private async Task<Tuple<bool, WmsPretaskH>> createPretask(List<WmsPointH> points, string carry_id, string carry_code, ILogger logger)
{
@@ -1695,8 +1675,12 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
// 二楼上升降机
Floor2UpMachinecodetimer = new Timer(Floor2UpMachinecode, null, TimeSpan.Zero, TimeSpan.FromSeconds(10));
// 二楼料架配送
Floor2RackDeliverytimer = new Timer(Floor2RackDelivery, null, TimeSpan.Zero, TimeSpan.FromSeconds(30));
Floor2timer送空托到上升降区 = new Timer(, null, TimeSpan.Zero, TimeSpan.FromSeconds(60));
Floor2timer送满托到下升降区 = new Timer(, null, TimeSpan.Zero, TimeSpan.FromSeconds(60));
Floor2timer移走上升降区未生成预任务且满托的料架 = new Timer(, null, TimeSpan.Zero, TimeSpan.FromSeconds(60));
Floor2timer移走下升降区未生成预任务且空托的料架 = new Timer(, null, TimeSpan.Zero, TimeSpan.FromSeconds(60));
return Task.CompletedTask;
}