bug修复

This commit is contained in:
2024-06-07 17:30:47 +08:00
parent 3549274b72
commit 51bfc0d99c
56 changed files with 357 additions and 315 deletions

View File

@@ -2,6 +2,7 @@
using System.Data;
using System.DirectoryServices.ActiveDirectory;
using System.Dynamic;
using System.Security.Cryptography.X509Certificates;
using System.Security.Policy;
using System.Text;
using System.Text.RegularExpressions;
@@ -112,12 +113,13 @@ namespace Tnb.ProductionMgr
//ctu取货
private async void CheckGet(object? state)
{
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 执行CheckGet");
Dictionary<string, string[]> getdic = new Dictionary<string, string[]>();
getdic.Add("SSX-021-005", new string[] { "YTCS", "AllowFullOut_CS05", "LiftCode" });
getdic.Add("SSX-011-002", new string[] { "YTCS", "AllowAgvFullIn_CS02", "Code_CS02" });
getdic.Add("SSX-011-004", new string[] { "YTCS", "AllowCtuFullOut_CS04", "Code_CS04" });
getdic.Add("SSX-011-008", new string[] { "东面提升机输送线", "入库输送线8允许出箱", "入库输送线7条码" });
getdic.Add("SSX-011-008", new string[] { "东面提升机输送线", "入库输送线8允许出箱", "入库输送线8条码" });
getdic.Add("SSX-111-011", new string[] { "东面提升机输送线", "下升降机11允许出箱", "下升降机11条码" });
getdic.Add("SSX-111-012", new string[] { "东面提升机输送线", "下升降机12允许出箱", "下升降机12条码" });
@@ -137,7 +139,7 @@ namespace Tnb.ProductionMgr
if (!string.IsNullOrEmpty(strs[2]))
{
string coderesult = await GetStringTag(strs[0], strs[2]);
coderesult = coderesult.Replace("\r", "").Replace(" ", "");
coderesult = coderesult.Replace("\r", "").Replace("\\r", "").Replace(" ", "");
if (string.IsNullOrEmpty(coderesult))
{
@@ -374,6 +376,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
//扫码入库
private async void ScanInStock(object? state)
{
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 执行ScanInStock");
Dictionary<string, string[]> getdic = new Dictionary<string, string[]>();
getdic.Add("BGWRKYCL02", new string[] { "CP8", "AllowGetFullBox1", "code1", "PutDoneEmptyBox", "false" });
getdic.Add("BGWRKYCL01", new string[] { "CP8", "AllowGetFullBox2", "code2", "PutDoneEmptyBox", "false" });
@@ -405,37 +408,40 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
Logger.LogInformation($"【ScanInStock】 八工位 {key} 获取到扫码信息: {coderesult}");
WmsCarryH? carry = _repository.AsSugarClient().Queryable<WmsCarryH>().Single(it => it.carry_code == coderesult);
Logger.LogInformation($"【ScanInStock】 八工位 {key} 查找{coderesult}绑定的托盘: {JsonConvert.SerializeObject(carry)}");
if (carry != null)
using (var _db = _repository.AsSugarClient().CopyNew())
{
if (_repository.AsSugarClient().Queryable<WmsDistaskH>().Where(p => p.carry_id == carry.id && p.status != WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID).Any())
WmsCarryH? carry = _db.Queryable<WmsCarryH>().Single(it => it.carry_code == coderesult);
Logger.LogInformation($"【ScanInStock】 八工位 {key} 查找{coderesult}绑定的托盘: {JsonConvert.SerializeObject(carry)}");
if (carry != null)
{
Logger.LogInformation($"【ScanInStock】 八工位 {key} 托盘 {carry.id} 对应的执行任务状态(status)不是26126860808229(已完成),此时不能执行入库");
continue;
}
if (_db.Queryable<WmsDistaskH>().Where(p => p.carry_id == carry.id && p.status != WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID).Any())
{
Logger.LogInformation($"【ScanInStock】 八工位 {key} 托盘 {carry.id} 对应的执行任务状态(status)不是26126860808229(已完成),此时不能执行入库");
continue;
}
var WmsCarryCode = _repository.AsSugarClient().Queryable<WmsCarryCode>().Where(it => it.carry_id == carry.id).OrderByDescending(it => it.id).First();
// 用适当的字段替换 YourTimestampField
var WmsCarryCode = _db.Queryable<WmsCarryCode>().Where(it => it.carry_id == carry.id).OrderByDescending(it => it.id).First();
// 用适当的字段替换 YourTimestampField
if (WmsCarryCode != null)
{
Logger.LogInformation($"【ScanInStock】 八工位 {key} 查找到托盘{carry.carry_code}在WmsCarryCode中存在");
if (WmsCarryCode != null)
{
Logger.LogInformation($"【ScanInStock】 八工位 {key} 查找到托盘{carry.carry_code}在WmsCarryCode中存在");
VisualDevModelDataCrInput input = new VisualDevModelDataCrInput();
input.data = new Dictionary<string, object>();
input.data.Add("barcode", coderesult);
input.data.Add("codeqty", WmsCarryCode.codeqty);//条码数量
input.data.Add("material_code", WmsCarryCode.material_code);
input.data.Add("extras", key);//location_code
input.data.Add("warehouse_id", "1");//TEST
input.data.Add("bill_code", "");//采购收货单号
input.data.Add("code_batch", WmsCarryCode.code_batch!);//批次
input.data.Add("material_specification", WmsCarryCode.material_specification!);//规格型号
input.data.Add("container_no", WmsCarryCode.container_no!);//箱号
input.data.Add("material_id", WmsCarryCode.material_id);
input.data.Add("id", null);
_wmsPDAScanInStock.ScanInStockByRedis(input).Wait();
VisualDevModelDataCrInput input = new VisualDevModelDataCrInput();
input.data = new Dictionary<string, object>();
input.data.Add("barcode", coderesult);
input.data.Add("codeqty", WmsCarryCode.codeqty);//条码数量
input.data.Add("material_code", WmsCarryCode.material_code);
input.data.Add("extras", key);//location_code
input.data.Add("warehouse_id", "1");//TEST
input.data.Add("bill_code", "");//采购收货单号
input.data.Add("code_batch", WmsCarryCode.code_batch!);//批次
input.data.Add("material_specification", WmsCarryCode.material_specification!);//规格型号
input.data.Add("container_no", WmsCarryCode.container_no!);//箱号
input.data.Add("material_id", WmsCarryCode.material_id);
input.data.Add("id", null);
_wmsPDAScanInStock.ScanInStockByRedis(input).Wait();
}
}
}
}
@@ -453,6 +459,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
/// </summary>
private async void BGWCarrySupplement(object? state)
{
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 执行BGWCarrySupplement");
Dictionary<string, string[]> getdic = new Dictionary<string, string[]>();
getdic.Add("YCLCKBGW", new string[] { "CP8", "AllowPutEmptyBox1" });
@@ -464,44 +471,77 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
bool result = await GetBoolTag(strs[0], strs[1]);
if (result)
{
//LoggerBGWCarrySupplement.LogInformation($"【BGWCarrySupplementtimer】 八工位 {key} {strs[1]}采集到 {result}");
LoggerBGWCarrySupplement.LogInformation($"【BGWCarrySupplementtimer】读取到信号{strs[1]} 值为{result} ");
BasLocation endLocation = _repository.AsSugarClient().Queryable<BasLocation>().Where(r => r.location_code == key).First();
if (endLocation == null)
using (var _db = _repository.AsSugarClient().CopyNew())
{
//LoggerBGWCarrySupplement.LogWarning($"【BGWCarrySupplementtimer】 {key}未维护库位信息");
continue;
BasLocation endLocation = _db.Queryable<BasLocation>().Where(r => r.location_code == key).First();
if (endLocation == null)
{
LoggerBGWCarrySupplement.LogWarning($"【BGWCarrySupplementtimer】 {key}未维护库位信息");
continue;
}
if (endLocation.is_lock == 1)
{
LoggerBGWCarrySupplement.LogInformation($"【BGWCarrySupplementtimer】 八工位 {key} 已锁定");
continue;
}
// 未锁定且已占用且库位中没有记录托盘 此时认为是叠盘机送过来的
var wmsLoc = _db.Queryable<BasLocation>()
.LeftJoin<WmsCarryH>((a, b) => a.id == b.location_id)
.Where((a, b) => a.is_lock == 0 && a.is_use == "1"
&& a.wh_id == WmsWareHouseConst.WAREHOUSE_YCL_ID && a.location_code.Contains("YCL-")
&& a.is_type == "0")
.OrderBy((a, b) => a.location_code) // 当前是按库位排序出库
.Select((a, b) => new
{
BasLocation = a,
WmsCarryH = b
}).ToList().GroupBy(p => p.BasLocation)
.Where(group =>
{
// 是否存在托盘
bool isExistsCarry = false;
foreach (var item in group)
{
if (!string.IsNullOrEmpty(item.WmsCarryH.carry_code))
{
isExistsCarry = true;
break;
}
}
if (isExistsCarry)
return false;
else
return true;
}).Select(r => r.Key);
if (wmsLoc.Count() == 0)
{
LoggerBGWCarrySupplement.LogInformation($"【BGWCarrySupplementtimer】 没有未锁定且已占用且库位中没有记录托盘的数据");
continue;
}
BasLocation startLocation = wmsLoc.First();
//锁定起点库位
await _db.Updateable<BasLocation>().SetColumns(r => r.is_lock == 1).Where(r => r.id == startLocation.id).ExecuteCommandAsync();
////锁定终点库位 更新为空闲
//await _db.Updateable<BasLocation>().SetColumns(r => new BasLocation { is_lock = 1, is_use = "0" }).Where(r => r.id == endLocation.id).ExecuteCommandAsync();
LoggerBGWCarrySupplement.LogInformation($"【BGWCarrySupplementtimer】锁定起点库位 开始生成 {startLocation.location_code} 到 {endLocation.location_code} 预任务 ");
bool result_createPretask = await createPretask(startLocation.id, endLocation.id, "", "", LoggerBGWCarrySupplement);
if (!result_createPretask)
{
LoggerBGWCarrySupplement.LogWarning($"【BGWCarrySupplementtimer】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成失败 ");
continue;
}
LoggerBGWCarrySupplement.LogInformation($"【BGWCarrySupplementtimer】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成成功");
}
if (endLocation.is_lock == 1)
{
//LoggerBGWCarrySupplement.LogInformation($"【BGWCarrySupplementtimer】 八工位 {key} 已锁定");
continue;
}
// 找到库位未锁定的空托盘 todo 待修改为使用出库策略
var wmsLoc = _repository.AsSugarClient().Queryable<BasLocation>()
.LeftJoin<WmsCarryH>((a, b) => a.id == b.location_id)
.Where((a, b) => a.wh_id == WmsWareHouseConst.WAREHOUSE_YCL_ID
&& a.is_lock == 0 && a.location_code.Contains("YCL-") && a.is_use == "1")
.OrderBy((a, b) => a.location_code);
BasLocation startLocation = wmsLoc.First();
//锁定起点库位
await _repository.AsSugarClient().Updateable<BasLocation>().SetColumns(r => r.is_lock == 1).Where(r => r.id == startLocation.id).ExecuteCommandAsync();
//锁定终点库位 更新为空闲
await _repository.AsSugarClient().Updateable<BasLocation>().SetColumns(r => new BasLocation { is_lock = 1, is_use = "0" }).Where(r => r.id == endLocation.id).ExecuteCommandAsync();
bool result_createPretask = await createPretask(startLocation.id, endLocation.id, "", "", LoggerBGWCarrySupplement);
if (!result_createPretask)
{
LoggerBGWCarrySupplement.LogWarning($"【BGWCarrySupplementtimer】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成失败 ");
continue;
}
LoggerBGWCarrySupplement.LogWarning($"【BGWCarrySupplementtimer】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成成功");
_ = _wareHouseService.GenTaskExecute();
@@ -519,14 +559,14 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
//获取redis数据
private void GetRedisData(object? state)
private async void GetRedisData(object? state)
{
var _redisReadConfigs = _repository.AsQueryable().Where(p => p.enabled == 1).ToList();
foreach (var config in _redisReadConfigs)
{
try
{
var json = _redisData.GetHash(config.dev_name!, config.tag_name!);
var json = await _redisData.GetHash(config.dev_name!, config.tag_name!);
if (json == null)
{
continue;
@@ -599,86 +639,6 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
}
}
///// <summary>
///// 7号输送线空料箱补充 (弃用)
///// </summary>
//private async void SSX7Supplement(object? state)
//{
// Dictionary<string, string[]> getdic = new Dictionary<string, string[]>();
// getdic.Add("SSX-021-007", new string[] { "东面提升机输送线", "出库输送线7呼叫CTU" });
// foreach (var key in getdic.Keys)
// {
// try
// {
// var strs = getdic.Where(p => p.Key == key).First().Value;
// string data = await _redisData.GetHash(strs[0], strs[1]);
// if (data == null)
// {
// continue;
// }
// JObject? res = JsonConvert.DeserializeObject<JObject>(data);
// bool result = res != null && res["Value"] != null ? res.Value<bool>("Value") : false;
// if (result)
// {
// LoggerBGWCarrySupplement.LogInformation($"【SSX7Supplement】 7号输送线 {key} {strs[1]}采集到 {res["Value"]}");
// BasLocation endLocation = _repository.AsSugarClient().Queryable<BasLocation>().Where(r => r.location_code == key).First();
// if (endLocation == null)
// {
// LoggerBGWCarrySupplement.LogWarning($"【SSX7Supplement】 {key}未维护库位信息");
// continue;
// }
// if (endLocation.is_lock == 1)
// {
// LoggerBGWCarrySupplement.LogInformation($"【SSX7Supplement】 7号输送线 {key} 已锁定");
// continue;
// }
// BasLocation location = await _repository.AsSugarClient().Queryable<BasLocation>().SingleAsync(it => it.location_code == key && it.is_type != EnumLocationType.存储库位.ToString()) ?? throw new AppFriendlyException("无此库位或为存储库位", 500);
// //锁定起点库位
// await _repository.AsSugarClient().Updateable<BasLocation>().SetColumns(r => r.is_lock == 1).Where(r => r.id == location.id).ExecuteCommandAsync();
// Dictionary<string, object> dic = new()
// {
// [nameof(WmsEmptyOutstockH.id)] = SnowflakeIdHelper.NextId(),
// [nameof(WmsEmptyOutstockH.org_id)] = WmsWareHouseConst.AdministratorOrgId,
// [nameof(WmsEmptyOutstockH.location_id)] = location.id,
// [nameof(WmsEmptyOutstockH.carrystd_id)] = WmsWareHouseConst.LIAOXIANGID,
// [nameof(WmsEmptyOutstockH.bill_code)] = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_EMPTYOUTSTK_ENCODE).GetAwaiter().GetResult(),
// [nameof(WmsEmptyOutstockH.status)] = WmsWareHouseConst.BILLSTATUS_ADD_ID,
// [nameof(WmsEmptyOutstockH.qty)] = 1,
// [nameof(WmsEmptyOutstockH.biz_type)] = WmsWareHouseConst.BIZTYPE_WMSEPTYOUTSTK_ID,
// ["warehouse_id"] = WmsWareHouseConst.WAREHOUSE_ZC_ID,
// [nameof(WmsEmptyOutstockH.create_id)] = WmsWareHouseConst.AdministratorUserId,
// [nameof(WmsEmptyOutstockH.create_time)] = DateTime.Now
// };
// VisualDevModelDataCrInput visualDevModelDataCrInput = new()
// {
// data = dic,
// };
// var result_WmsEmptyOut = await _wmsEmptyOutstockService.WmsEmptyOut(visualDevModelDataCrInput);
// if (result_WmsEmptyOut.code2 != "200")
// {
// LoggerBGWCarrySupplement.LogWarning($"【SSX7Supplement】 预任务生成失败 {result_WmsEmptyOut.msg}");
// continue;
// }
// LoggerBGWCarrySupplement.LogWarning($"【SSX7Supplement】 预任务生成成功");
// _ = _wareHouseService.GenTaskExecute();
// }
// }
// catch (Exception ex)
// {
// LoggerBGWCarrySupplement.LogInformation($"【SSX7Supplement】 7号输送线空料箱补充发生异常:{ex}");
// }
// }
//}
#endregion
/// <summary>
@@ -686,6 +646,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
/// </summary>
private async void YCLGLDPJInstock(object? state)
{
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 执行YCLGLDPJInstock");
Dictionary<string, string[]> getdic = new Dictionary<string, string[]>();
getdic.Add("SGW-YCL", new string[] { "CP3-5", "AllowGetFullBox" });
@@ -828,6 +789,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
private async void SSXcode(object? state)
{
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 执行SSXcode");
Dictionary<string, string[]> dic = new Dictionary<string, string[]>();
dic.Add("东面提升机输送线", new string[] { "下升降机判断请求", "下升降机判断条码", "下升降机判断完毕", "下升降机判断结果" });
Dictionary<string, int> putdic = new Dictionary<string, int>();
@@ -928,6 +890,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
// 上升降机扫码 需要等待空料架区 此处需要轮询
private async void Floor2UpMachinecode(object? args)
{
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 执行Floor2UpMachinecode");
string barcode = await GetStringTag("东面提升机输送线", MechanicalArmConsts.);
if (string.IsNullOrEmpty(barcode))
{
@@ -1060,14 +1023,14 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
LoggerFloor2UpDownMachine.LogInformation($@"【上升降机】回写转库单的剩余可绑定料架数量");
// 绑定料箱到料架
CarryBindFloor2UpDownMachineInput carryBindFloor2UpDownMachineInput = new() { };
carryBindFloor2UpDownMachineInput.carry_id = target.rackid;
carryBindFloor2UpDownMachineInput.carry_code = target.rackcode;
carryBindFloor2UpDownMachineInput.membercarry_id = LX.id;
carryBindFloor2UpDownMachineInput.membercarry_code = LX.carry_code;
carryBindFloor2UpDownMachineInput.carrystd_id = rack.carrystd_id;
CarryBindInput carryBindInput = new();
carryBindInput.carry_id = target.rackid;
carryBindInput.carry_code = target.rackcode;
carryBindInput.membercarry_id = LX.id;
carryBindInput.membercarry_code = LX.carry_code;
carryBindInput.carrystd_id = rack.carrystd_id;
await _wmsCarryBindService.CarryBindFloor2UpDownMachine(carryBindFloor2UpDownMachineInput);
await _wmsCarryBindService.CarryBind(carryBindInput);
await db.Ado.CommitTranAsync();
}
@@ -1102,6 +1065,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
/// <returns></returns>
public async void (object? args)
{
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 执行送空托到上升降区");
#region
List<string> configs_upMachine = new List<string>();
if (await GetBoolTag("东面提升机输送线", $"上升降机请求送空托1"))
@@ -1215,6 +1179,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
/// <returns></returns>
public async void (object? args)
{
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 执行送满托到下升降区");
#region
List<string> configs_upMachine = new List<string>();
if (await GetBoolTag("东面提升机输送线", $"下升降机请求送满托1"))
@@ -1352,6 +1317,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
/// <returns></returns>
public async void (object? args)
{
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 执行移走上升降区未生成预任务且满托的料架");
#region
List<string> configs_upMachine = new List<string>();
if (await GetBoolTag("东面提升机输送线", $"上升降机请求取满托1"))
@@ -1445,6 +1411,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
/// <returns></returns>
public async void (object? args)
{
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 执行移走下升降区未生成预任务且空托的料架");
#region
List<string> configs_upMachine = new List<string>();
if (await GetBoolTag("东面提升机输送线", $"下升降机请求取空托1"))
@@ -1497,11 +1464,11 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
BasLocation endLocation = rackEndLocations.First();
// 解除绑定料箱到料架
CarryBindFloor2UpDownMachineInput carryBindFloor2UpDownMachineInput = new() { };
carryBindFloor2UpDownMachineInput.carry_id = wmsMechanicalArmH.rackid;
carryBindFloor2UpDownMachineInput.carry_code = wmsMechanicalArmH.rackcode;
CarryBindInput carryBindInput = new() { };
carryBindInput.carry_id = wmsMechanicalArmH.rackid;
carryBindInput.carry_code = wmsMechanicalArmH.rackcode;
await _wmsCarryBindService.CarryUnbindFloor2UpDownMachine(carryBindFloor2UpDownMachineInput);
await _wmsCarryBindService.CarryUnbind(carryBindInput);
// 锁住终点库位
await db.Updateable<BasLocation>(r => new BasLocation
@@ -1557,18 +1524,76 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
return false;
}
#region
public async Task<bool> GetBoolTag(string DevName, string field)
{
try
{
string jsonString = _redisData.GetHash(DevName, field);
string jsonString = await _redisData.GetHash(DevName, field);
string pattern = @"""Value"":\s*(true|false)";
JObject jsonObject = JObject.Parse(jsonString);
if (jsonObject.TryGetValue("Value", out JToken valueToken2))
{
return bool.Parse(valueToken2.ToString());
}
else
{
Console.WriteLine($"未找到匹配项 {DevName} {field}");
}
}
catch (Exception ex)
{
Console.WriteLine($"未找到匹配项{DevName} {field}");
}
return false;
}
public async Task<string> GetStringTag(string DevName, string field)
{
#region
//try
//{
// string jsonString = await _redisData.GetHash(DevName, field);
// JObject jsonObject = JObject.Parse(jsonString);
// if (jsonObject.TryGetValue("StatusCode", out JToken valueToken1))
// {
// if (valueToken1.ToString() == "-1")
// return "";
// }
// if (jsonObject.TryGetValue("Value", out JToken valueToken2))
// {
// return valueToken2.ToString();
// }
// else
// {
// Console.WriteLine($"未找到匹配项 {DevName} {field}");
// }
//}
//catch (Exception ex)
//{
// // 捕获并处理异常
// Console.WriteLine($"发生异常: {ex.Message}");
//}
//return $"未找到匹配项 {DevName} {field}";
#endregion
try
{
string jsonString = await _redisData.GetHash(DevName, field);
string pattern = "\"Value\":\"(.*?)\"";
System.Text.RegularExpressions.Match match = Regex.Match(jsonString, pattern);
if (match.Success)
{
return bool.Parse(match.Groups[1].Value);
return match.Groups[1].Value;
}
else
{
@@ -1580,56 +1605,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
Console.WriteLine($"未找到匹配项{DevName} {field}");
}
return false;
}
public async Task<string> GetStringTag(string DevName, string field)
{
try
{
string jsonString = _redisData.GetHash(DevName, field);
JObject jsonObject = JObject.Parse(jsonString);
if (jsonObject.TryGetValue("Value", out JToken valueToken))
{
return valueToken.ToString();
}
else
{
Console.WriteLine($"未找到匹配项 {DevName} {field}");
}
}
catch (Exception ex)
{
// 捕获并处理异常
Console.WriteLine($"发生异常: {ex.Message}");
}
return $"未找到匹配项 {DevName} {field}";
//try
//{
// string jsonString = _redisData.GetHash(DevName, field);
// string pattern = @"""Value"":\s*""([^""]+)""";
// System.Text.RegularExpressions.Match match = Regex.Match(jsonString, pattern);
// if (match.Success)
// {
// return match.Groups[1].Value;
// }
// else
// {
// Console.WriteLine($"未找到匹配项{DevName} {field}");
// }
//}
//catch (Exception ex)
//{
// Console.WriteLine($"未找到匹配项{DevName} {field}");
//}
//return $"未找到匹配项 {DevName} {field}";
}
private async Task<bool> Floor2UpDownMachinecode_SetTag(string tag, string value)
@@ -1652,10 +1628,13 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
//JObject valueJson = new JObject();
//valueJson["Value"] = value;
//bool res = await _redisData.HSet(DevName, tag, valueJson.ToString());
//return true;
//_redisData.SetHash(DevName, tag, valueJson.ToString());
return true;
}
#endregion
#endregion
public Task StartAsync(CancellationToken cancellationToken)
@@ -1674,13 +1653,13 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
//YCLWXDPJInstocktimer = new Timer(YCLWXDPJInstock, null, TimeSpan.Zero, TimeSpan.FromSeconds(100000));
// 二楼上升降机
Floor2UpMachinecodetimer = new Timer(Floor2UpMachinecode, null, TimeSpan.Zero, TimeSpan.FromSeconds(30));
Floor2UpMachinecodetimer = new Timer(Floor2UpMachinecode, null, TimeSpan.Zero, TimeSpan.FromSeconds(20));
// 二楼料架配送
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));
Floor2timer送空托到上升降区 = new Timer(, null, TimeSpan.Zero, TimeSpan.FromSeconds(30));
Floor2timer送满托到下升降区 = new Timer(, null, TimeSpan.Zero, TimeSpan.FromSeconds(30));
Floor2timer移走上升降区未生成预任务且满托的料架 = new Timer(, null, TimeSpan.Zero, TimeSpan.FromSeconds(30));
Floor2timer移走下升降区未生成预任务且空托的料架 = new Timer(, null, TimeSpan.Zero, TimeSpan.FromSeconds(30));
// 7号线补充空料箱 (弃用)
//SSX7Supplementtimer = new Timer(SSX7Supplement, null, TimeSpan.Zero, TimeSpan.FromSeconds(30));