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

@@ -6,7 +6,6 @@
<Nullable>enable</Nullable>
<GenerateDocumentationFile>False</GenerateDocumentationFile>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -6,7 +6,6 @@
<Nullable>enable</Nullable>
<GenerateDocumentationFile>False</GenerateDocumentationFile>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -6,7 +6,6 @@
<Nullable>enable</Nullable>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -5,7 +5,6 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -5,7 +5,6 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -6,7 +6,6 @@
<Nullable>enable</Nullable>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -5,7 +5,6 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -5,7 +5,6 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -5,7 +5,6 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -6,7 +6,6 @@
<Nullable>enable</Nullable>
<GenerateDocumentationFile>False</GenerateDocumentationFile>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -6,7 +6,6 @@
<Nullable>enable</Nullable>
<GenerateDocumentationFile>False</GenerateDocumentationFile>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

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));

View File

@@ -5,7 +5,6 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -5,7 +5,6 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -5,7 +5,6 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -6,8 +6,14 @@ using System.Threading.Tasks;
namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
{
public class CarryBindFloor2UpDownMachineInput
public class CarryBatchBindInput
{
public List<CarryBindInput> carryBindInputs { get; set; }
}
public class CarryBindInput
{
public string? org { get; set; }
public string? create_id { get; set; }
public string? carry_id { get; set; }
public string? carry_code { get; set; }
public string? carrystd_id { get; set; }

View File

@@ -92,5 +92,9 @@ public partial class WmsElevatorH : BaseEntity<string>
/// 当前电梯所在楼层
/// </summary>
public int current_floor { get; set; }
/// <summary>
/// 电梯占用状态
/// </summary>
public int is_use { get; set; }
}

View File

@@ -5,7 +5,6 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -1,5 +1,6 @@
using JNPF.Common.Dtos.VisualDev;
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
using Tnb.WarehouseMgr.Entities.Dto.Outputs;
namespace Tnb.WarehouseMgr.Interfaces
{
@@ -10,8 +11,8 @@ namespace Tnb.WarehouseMgr.Interfaces
{
Task<dynamic> CarryBind(VisualDevModelDataCrInput input);
Task<dynamic> CarryBindFloor2UpDownMachine(CarryBindFloor2UpDownMachineInput input);
Task<dynamic> CarryUnbindFloor2UpDownMachine(CarryBindFloor2UpDownMachineInput input);
Task<Result> CarryBind(CarryBindInput input);
Task<Result> CarryUnbind(CarryBindInput input);
Task<dynamic> CarryCodeUnbind(CarryCodeUnbindInput input);
}
}

View File

@@ -5,7 +5,6 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -47,13 +47,12 @@ namespace Tnb.WarehouseMgr
context = new(cfg);
s_elevatorMap = await context.Queryable<WmsElevatorH>().ToDictionaryAsync(x => x.elevator_id, x => x.elevator_code);
s_loadedStatusDic = context.Queryable<WmsElevatorH>().ToList().ToDictionary(x => x.elevator_id, x => x.is_use);
if (s_eleUseStatusDic.Count < 1)
{
foreach (var (k, _) in s_elevatorMap)
{
s_eleUseStatusDic[k] = 0;
s_loadedStatusDic[k] = 0;
}
}

View File

@@ -83,8 +83,7 @@ namespace Tnb.WarehouseMgr
[HttpPost, NonUnify, AllowAnonymous]
public async Task<Tnb.WarehouseMgr.Entities.Dto.Outputs.Result> LoadConfirm(ConfirmInput input)
{
Logger.Information("【LoadConfirm】接收到WCS取货确认信号.................. ");
Logger.Information($"【LoadConfirm】接收到WCS取货确认信号.................. {JsonConvert.SerializeObject(input)}");
var dis = _db.Queryable<WmsDistaskH>().Where(P => P.bill_code == input.taskCode).First();
if (dis.area_code == "ZSCJ001")
@@ -324,7 +323,8 @@ namespace Tnb.WarehouseMgr
if (sysStatus == (int)EnumSysStatus. && runStatus == (int)EnumRunStatus.
&& doorStatus == (int)EnumDoorStatus. && s_eleUseStatusDic[elevator.device_id] == (int)EnumElevatorUseStatus.)
{
Logger.Information($"【UnloadConfirm】 成功");
Logger.Information($"【UnloadConfirm】 成功 {devName} 变更为占用");
await _db.Updateable<WmsElevatorH>().SetColumns(r => r.is_use == (int)EnumElevatorUseStatus.).Where(r => r.elevator_id == elevator.device_id).ExecuteCommandAsync();
s_eleUseStatusDic[elevator.device_id] = (int)EnumElevatorUseStatus.;
return await ToApiResult(HttpStatusCode.OK, "成功");
}
@@ -458,10 +458,11 @@ namespace Tnb.WarehouseMgr
Logger.Information($"【TaskCallback】 根据任务单查找电梯结果 {JsonConvert.SerializeObject(elevator)}");
if (!elevator?.device_id.IsNullOrEmpty() ?? false)
{
await _db.Updateable<WmsElevatorH>().SetColumns(r => r.is_use == (int)EnumElevatorUseStatus.).Where(r => r.elevator_id == elevator.device_id).ExecuteCommandAsync();
s_eleUseStatusDic[elevator.device_id] = (int)EnumElevatorUseStatus.;
// 根据disTask StartLocationId 起始库位关联电梯获取设备ID location_code.Continas("")
// 根据disTask StartLocationId 起始库位关联电梯获取设备ID location_code.Continas("")
var devName = s_elevatorMap[elevator.device_id]?.ToString();
Logger.Information($"【TaskCallback】 {devName.Match(@"\d+")}#梯,设备名称:{devName},开始进入关门流程");
Logger.Information($"【TaskCallback】 {devName.Match(@"\d+")}#梯,设备名称:{devName},开始进入关门流程 {devName} 变更为空闲");
int doorStatus = await _elevatorControlService.GetTagAsync(devName, ElevatorConsts.DoorStatus);
Logger.Information($"【TaskCallback】 设备:{devName},门状态:{doorStatus.ToEnum<EnumDoorStatus>().ToString()}");
if (doorStatus.ToEnum<EnumDoorStatus>() != EnumDoorStatus.

View File

@@ -7,7 +7,6 @@
<Nullable>enable</Nullable>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<Configurations>Debug;Release</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -71,7 +71,7 @@ namespace Tnb.WarehouseMgr
private readonly ElevatorControlConfiguration _eleCtlCfg = App.Configuration.Build<ElevatorControlConfiguration>();
private static Dictionary<string, object> locMap = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);
private readonly IConfiguration _configuration;
private readonly RedisData _redisData;
private readonly StackExRedisHelper _redisData;
private readonly IVisualDevService _visualDevService;
private readonly IRunService _runService;
@@ -80,7 +80,7 @@ namespace Tnb.WarehouseMgr
public Func<string, int, Task> AddUnExecuteTask { get; set; }
public WareHouseService(ISqlSugarRepository<WmsInstockH> repository, IDictionaryDataService dictionaryDataService, RedisData redisData,
public WareHouseService(ISqlSugarRepository<WmsInstockH> repository, IDictionaryDataService dictionaryDataService, StackExRedisHelper redisData,
IBillRullService billRullService, IUserManager userManager, ICacheManager cacheManager, IElevatorControlService elevatorControlService,
IWmsCarryBindService wmsCarryBindService,
IRunService runService,
@@ -389,7 +389,7 @@ namespace Tnb.WarehouseMgr
throw new AppFriendlyException("点位" + input.targetName + "不存在", 500);
strs = putdic.Where(p => p.Key == input.targetName).First().Value;
bool flag = await _redisData.HashExist(strs[0], strs[1]);
bool flag = await _redisData.HashExists(strs[0], strs[1]);
if (!flag)
{
throw new AppFriendlyException("点位" + input.targetName + "不存在", 500);
@@ -423,7 +423,7 @@ namespace Tnb.WarehouseMgr
putdic.Add("ZS-C02-1", new string[] { "hxjC", "A3允许入空箱", });
getdic.Add("ZS-C02-2", new string[] { "hxjC", "A3允许取满箱" });
putdic.Add("ZS-C03-1", new string[] { "hxjC", "A4允许入空箱", });
getdic.Add("ZS-C03-2", new string[] { "hxjC", "A4允许取满箱" });
@@ -436,6 +436,7 @@ namespace Tnb.WarehouseMgr
putdic.Add("ZS-C06-1", new string[] { "hxjC", "A7允许入空箱", });
getdic.Add("ZS-C06-2", new string[] { "hxjC", "A7允许取满箱" });
var strs = new string[] { };
if (action == "LOAD")//取货
{
if (!getdic.ContainsKey(code))
@@ -444,15 +445,16 @@ namespace Tnb.WarehouseMgr
}
strs = getdic.Where(p => p.Key == code).First().Value;
bool flag = _redisData.HashExist(strs[0], strs[1]).Result;
bool flag = await _redisData.HashExists(strs[0], strs[1]);
Logger.Information($"【Check】 判断CTU是否可以取货1 {code} {action} flag:{flag} ");
if (!flag)
{
Logger.Information($"【Check】 判断CTU是否可以取货 {code} {action} flag:{flag} ");
return false;
}
string data = _redisData.GetHash(strs[0], strs[1]).Result;
JObject? res = JsonConvert.DeserializeObject<JObject>(data);
bool result = res != null && res["Value"] != null ? res.Value<bool>("Value") : false;
Logger.Information($"【Check】 判断CTU是否可以取货2 {code} {action} result:{result} ");
if (!result)
return false;
return true;
@@ -463,15 +465,16 @@ namespace Tnb.WarehouseMgr
return false;
strs = putdic.Where(p => p.Key == code).First().Value;
bool flag = _redisData.HashExist(strs[0], strs[1]).Result;
bool flag = await _redisData.HashExists(strs[0], strs[1]);
Logger.Information($"【Check】 判断CTU是否可以取货1 {code} {action} flag:{flag} ");
if (!flag)
{
Logger.Information($"【Check】 判断CTU是否可以取货 {code} {action} flag:{flag} ");
return false;
}
string data = _redisData.GetHash(strs[0], strs[1]).Result;
JObject? res = JsonConvert.DeserializeObject<JObject>(data);
bool result = res != null && res["Value"] != null ? res.Value<bool>("Value") : false;
Logger.Information($"【Check】 判断CTU是否可以取货2 {code} {action} result:{result} ");
if (!result)
return false;
return true;
@@ -749,7 +752,7 @@ namespace Tnb.WarehouseMgr
//JObject valueJson = new JObject();
//valueJson["Value"] = value;
//bool res = await _redisData.HSet(DevName, tag, valueJson.ToString());
//_redisData.SetHash(DevName, tag, valueJson.ToString());
//return true;
}

View File

@@ -18,6 +18,7 @@ using SqlSugar;
using Tnb.WarehouseMgr.Entities;
using Tnb.WarehouseMgr.Entities.Dto;
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
using Tnb.WarehouseMgr.Entities.Dto.Outputs;
using Tnb.WarehouseMgr.Entities.Enums;
using Tnb.WarehouseMgr.Interfaces;
@@ -177,14 +178,14 @@ namespace Tnb.WarehouseMgr
/// <summary>
/// 二楼机械手
/// 绑定料箱到料架
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="AppFriendlyException"></exception>
[NonAction]
public async Task<dynamic> CarryBindFloor2UpDownMachine(CarryBindFloor2UpDownMachineInput input)
public async Task<Result> CarryBind(CarryBindInput input)
{
bool isOk = false;
@@ -197,6 +198,7 @@ namespace Tnb.WarehouseMgr
throw new ArgumentNullException(nameof(input));
}
await db.Ado.BeginTranAsync();
WmsCarryH? carry = await db.Queryable<WmsCarryH>().SingleAsync(it => it.id == input.carry_id);
WmsCarryH? subCarry = await db.Queryable<WmsCarryH>().SingleAsync(it => it.id == input.membercarry_id);
if (carry != null && subCarry != null)
@@ -215,6 +217,22 @@ namespace Tnb.WarehouseMgr
{
throw Oops.Oh(ErrorCode.COM1001);
}
// 插入子载具绑定记录
VisualDevModelDataCrInput visualDevModelCrInput = new() { data = new Dictionary<string, object>() };
visualDevModelCrInput.data[nameof(WmsCarrybindH.carry_id)] = input.carry_id;
visualDevModelCrInput.data[nameof(WmsCarrybindH.carry_code)] = input.carry_code;
visualDevModelCrInput.data[nameof(WmsCarrybindH.membercarry_id)] = input.membercarry_id;
visualDevModelCrInput.data[nameof(WmsCarrybindH.membercarry_code)] = input.membercarry_code;
visualDevModelCrInput.data[nameof(WmsCarrybindH.type)] = 0;
visualDevModelCrInput.data[nameof(WmsCarrybindH.carrystd_id)] = carry.carrystd_id;
visualDevModelCrInput.data[nameof(WmsCarrybindH.create_id)] = input.create_id;
visualDevModelCrInput.data[nameof(WmsCarrybindH.create_time)] = DateTime.Now;
visualDevModelCrInput.data[nameof(WmsCarrybindH.loc)] = 1;
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSCARRYBIND_ID, true);
await _runService.Create(templateEntity, visualDevModelCrInput);
await db.Ado.CommitTranAsync();
}
else
{
@@ -226,54 +244,78 @@ namespace Tnb.WarehouseMgr
}
catch (Exception ex)
{
await db.Ado.RollbackTranAsync();
return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.InternalServerError, ex.Message);
}
}
return Task.FromResult(true);
return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.OK, "成功");
}
/// <summary>
/// 二楼机械手解绑定
/// 解绑定料箱到料架
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="AppFriendlyException"></exception>
[NonAction]
public async Task<dynamic> CarryUnbindFloor2UpDownMachine(CarryBindFloor2UpDownMachineInput input)
public async Task<Result> CarryUnbind(CarryBindInput input)
{
bool isOk = false;
try
using (var db = _db.CopyNew())
{
if (input == null)
try
{
throw new ArgumentNullException(nameof(input));
}
if (input == null)
{
throw new ArgumentNullException(nameof(input));
}
WmsCarryH? carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == input.carry_id);
if (carry != null)
{
int row = await _db.Deleteable<WmsCarryD>().Where(r => r.carry_id == input.carry_id).ExecuteCommandAsync();
isOk = row > 0;
if (!isOk)
WmsCarryH? carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == input.carry_id);
if (carry != null)
{
throw Oops.Oh(ErrorCode.COM1001);
int row = await _db.Deleteable<WmsCarryD>().Where(r => r.carry_id == input.carry_id).ExecuteCommandAsync();
isOk = row > 0;
if (!isOk)
{
throw Oops.Oh(ErrorCode.COM1001);
}
// 插入子载具绑定记录
VisualDevModelDataCrInput visualDevModelCrInput = new() { data = new Dictionary<string, object>() };
visualDevModelCrInput.data[nameof(WmsCarrybindH.carry_id)] = input.carry_id;
visualDevModelCrInput.data[nameof(WmsCarrybindH.carry_code)] = input.carry_code;
visualDevModelCrInput.data[nameof(WmsCarrybindH.membercarry_id)] = input.membercarry_id;
visualDevModelCrInput.data[nameof(WmsCarrybindH.membercarry_code)] = input.membercarry_code;
visualDevModelCrInput.data[nameof(WmsCarrybindH.type)] = 0;
visualDevModelCrInput.data[nameof(WmsCarrybindH.carrystd_id)] = carry.carrystd_id;
visualDevModelCrInput.data[nameof(WmsCarrybindH.create_id)] = input.create_id;
visualDevModelCrInput.data[nameof(WmsCarrybindH.create_time)] = DateTime.Now;
visualDevModelCrInput.data[nameof(WmsCarrybindH.loc)] = 1;
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSCARRYBIND_ID, true);
await _runService.Create(templateEntity, visualDevModelCrInput);
await db.Ado.CommitTranAsync();
}
else
{
if (carry == null)
{
throw new AppFriendlyException("没有可用的主载具", 500);
}
}
}
else
catch (Exception ex)
{
if (carry == null)
{
throw new AppFriendlyException("没有可用的主载具", 500);
}
await db.Ado.RollbackTranAsync();
return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.InternalServerError, ex.Message);
}
}
catch (Exception ex)
{
}
return Task.FromResult(true);
return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.OK, "成功");
}
/// <summary>
@@ -315,6 +357,7 @@ namespace Tnb.WarehouseMgr
}
catch (Exception ex)
{
return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.InternalServerError, ex.Message);
}
return Task.FromResult(true);
}

View File

@@ -35,6 +35,8 @@ using JNPF.Systems.Entitys.System;
using JNPF.Systems.Entitys.Permission;
using Aop.Api.Domain;
using Senparc.Weixin.Work.AdvancedAPIs.OaDataOpen;
using NPOI.SS.Formula.Functions;
using Org.BouncyCastle.Asn1.X509;
namespace Tnb.WarehouseMgr
{
@@ -52,6 +54,7 @@ namespace Tnb.WarehouseMgr
private readonly IWareHouseService _wareHouseService;
private readonly IBillRullService _billRullService;
private readonly IUserManager _userManager;
private readonly IWmsCarryBindService _wmsCarryBindService;
public static SemaphoreSlim s_taskDistributeToZCC = new(1);
@@ -62,7 +65,8 @@ namespace Tnb.WarehouseMgr
IWareHouseService wareHouseService,
IUserManager userManager,
IBillRullService billRullService,
IEventPublisher eventPublisher)
IEventPublisher eventPublisher,
IWmsCarryBindService wmsCarryBindService)
{
_db = repository.AsSugarClient();
_runService = runService;
@@ -70,6 +74,7 @@ namespace Tnb.WarehouseMgr
_wareHouseService = wareHouseService;
_userManager = userManager;
_billRullService = billRullService;
_wmsCarryBindService = wmsCarryBindService;
OverideFuncs.GetListAsync = GetList;
}
@@ -650,8 +655,8 @@ namespace Tnb.WarehouseMgr
.Where((a, b) => input.details.Select(r => r.carry_code).Contains(a.carry_code)).Select((a, b) => b).ToList();
if (wmsCarryCodes.Count > 0)
{
Logger.LogWarning($"【RackEmptyInstock】存在非空料箱{string.Join(',', wmsCarryCodes.Select(r => r.carry_code).Distinct())},不能入库!{input.carry_code}");
throw new AppFriendlyException($"【RackEmptyInstock】存在非空料箱{string.Join(',', wmsCarryCodes.Select(r => r.carry_code).Distinct())},不能入库!{input.carry_code}", 500);
Logger.LogWarning($"【RackEmptyInstock】存在非空料箱不能入库{input.carry_code}");
throw new AppFriendlyException($"【RackEmptyInstock】存在非空料箱不能入库{input.carry_code}", 500);
}
}
@@ -668,10 +673,45 @@ namespace Tnb.WarehouseMgr
BasLocation endlocation = rackEndLocations.First();
WmsCarryH wmsCarryH = await _db.Queryable<WmsCarryH>().Where(r => r.carry_code == input.carry_code).FirstAsync();
// 重新绑定料箱到料架
// 清空料架
Logger.LogWarning($"【RackEmptyInstock】清空料架");
CommonCreatePretaskInput commonCreatePretaskInput = new CommonCreatePretaskInput();
List<WmsCarryH> membercarrys = _db.Queryable<WmsCarryH>().Where(r => input.details.Select(r => r.carry_code).Contains(r.carry_code)).ToList();
await _db.Ado.BeginTranAsync();
// 解除绑定料箱到料架
CarryBindInput carryBindInput = new();
carryBindInput.carry_id = wmsCarryH.id;
carryBindInput.carry_code = wmsCarryH.carry_code;
var resCarryUnbind = await _wmsCarryBindService.CarryUnbind(carryBindInput);
if (resCarryUnbind.code != JNPF.Common.Enums.HttpStatusCode.OK)
{
throw new AppFriendlyException($"解除绑定料箱到料架失败 载具 {input.carry_code}", 500);
}
Logger.LogWarning($"【RackEmptyInstock】绑定料箱到料架");
foreach (WmsCarryH membercarry in membercarrys)
{
// 绑定料箱到料架
CarryBindInput _carryBindInput = new();
_carryBindInput.carry_id = wmsCarryH.id;
_carryBindInput.carry_code = wmsCarryH.carry_code;
_carryBindInput.membercarry_id = membercarry.id;
_carryBindInput.membercarry_code = membercarry.carry_code;
_carryBindInput.carrystd_id = wmsCarryH.carrystd_id;
var resCarrybind = await _wmsCarryBindService.CarryBind(_carryBindInput);
if (resCarrybind.code != JNPF.Common.Enums.HttpStatusCode.OK)
{
throw new AppFriendlyException($"绑定料箱到料架失败 载具 {input.carry_code}", 500);
}
}
Logger.LogWarning($"【RackEmptyInstock】开始生成预任务");
CommonCreatePretaskInput commonCreatePretaskInput = new ();
commonCreatePretaskInput.startlocation_id = startlocation.id;
commonCreatePretaskInput.endlocation_id = endlocation.id;
commonCreatePretaskInput.carry_id = wmsCarryH.id;
commonCreatePretaskInput.carry_code = input.carry_code;
commonCreatePretaskInput.task_type = "";
commonCreatePretaskInput.biz_type = "FloorCallMaterial";
@@ -682,11 +722,14 @@ namespace Tnb.WarehouseMgr
Logger.LogInformation($"【RackEmptyInstock】生成预任务失败 载具 {input.carry_code}");
throw new AppFriendlyException($"生成预任务失败 载具 {input.carry_code}", 500);
}
Logger.LogWarning($"【RackEmptyInstock】生成预任务成功");
await _db.Ado.CommitTranAsync();
}
catch (Exception ex)
{
Logger.LogError("【RackEmptyInstock】" + ex.Message);
Logger.LogError("【RackEmptyInstock】" + ex.StackTrace);
await _db.Ado.RollbackTranAsync();
return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message);
}

View File

@@ -1,3 +1,5 @@
using System.Text.RegularExpressions;
Serve.Run(RunOptions.Default
.AddWebComponent<WebComponent>().WithArgs(args));
@@ -7,7 +9,6 @@ public class WebComponent : IWebComponent
{
builder.Host.UseWindowsService();
builder.Configuration.AddJsonFile("Location.json", optional: true, reloadOnChange: true);
//// 日志过滤
//builder.Logging.AddFilter((provider, category, logLevel) =>
//{
@@ -24,4 +25,6 @@ public class WebComponent : IWebComponent
// options.DateFormat = "yyyy-MM-dd HH:mm:ss(zzz) dddd";
//});
}
}

View File

@@ -5,8 +5,8 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<SatelliteResourceLanguages>none</SatelliteResourceLanguages>
<ServerGarbageCollection>false</ServerGarbageCollection>
<ConcurrentGarbageCollection>true</ConcurrentGarbageCollection>
<!--<ServerGarbageCollection>true</ServerGarbageCollection>
<ConcurrentGarbageCollection>false</ConcurrentGarbageCollection>-->
</PropertyGroup>
<ItemGroup>

View File

@@ -7,7 +7,6 @@
<GenerateDocumentationFile>False</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS8618;</NoWarn>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -6,7 +6,6 @@
<Nullable>enable</Nullable>
<GenerateDocumentationFile>False</GenerateDocumentationFile>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -7,7 +7,6 @@
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8625;CS1572;CS1573;</NoWarn>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -6,7 +6,6 @@
<GenerateDocumentationFile>False</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8618;CS8625;CS1572;CS1573;CS0168;</NoWarn>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -7,7 +7,6 @@
<GenerateDocumentationFile>False</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8618;CS8625;CS1572;CS1573;CS0168;CS1998;</NoWarn>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -41,9 +41,13 @@ namespace Tnb.Common.Redis
}
// 获取哈希值
public string GetHash(string key, string field)
public async Task<string> GetHash(string key, string field)
{
return _db.HashGet(key, field);
return await _db.HashGetAsync(key, field);
}
public async Task<bool> HashExists(string key, string field)
{
return await _db.HashExistsAsync(key, field);
}
// 存储列表值
@@ -65,7 +69,7 @@ namespace Tnb.Common.Redis
{
if (_db.HashExists(key, field))
{
string data = GetHash(key, field);
string data = await GetHash(key, field);
Dictionary<String, String> json = JsonConvert.DeserializeObject<Dictionary<String, String>>(data);
Type type = typeof(T);
if ((!type.IsValueType && type.GetGenericArguments().Length > 0) || (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>)))

View File

@@ -9,7 +9,6 @@
<GenerateDocumentationFile>False</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8605;CS8618;CS8619;CS8625;CS1572;CS1573;</NoWarn>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -11,7 +11,6 @@
<NoWarn>$(NoWarn);CS1591;</NoWarn>
<GenerateDocumentationFile>False</GenerateDocumentationFile>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -8,7 +8,6 @@
<GenerateDocumentationFile>False</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8618;CS8625;CS1572;CS1573;CS0168;CS0618;</NoWarn>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -8,7 +8,6 @@
<GenerateDocumentationFile>False</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8618;CS1572;CS1573;CS1998;</NoWarn>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -7,7 +7,6 @@
<GenerateDocumentationFile>False</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS8618;</NoWarn>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -7,7 +7,6 @@
<GenerateDocumentationFile>False</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS8625;</NoWarn>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -7,7 +7,6 @@
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8625;CS1572;CS1573;CS0168;</NoWarn>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -7,7 +7,6 @@
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8618;CS8625;CS1572;CS1573;</NoWarn>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -7,7 +7,6 @@
<GenerateDocumentationFile>False</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS8603;CS8618;</NoWarn>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -7,7 +7,6 @@
<GenerateDocumentationFile>False</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS8625;</NoWarn>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -7,7 +7,6 @@
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8619;CS8625;CS8629;CS1572;CS1573;CS0168;CS4014;CS1998;</NoWarn>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -7,7 +7,6 @@
<GenerateDocumentationFile>False</GenerateDocumentationFile>
<NoWarn>$(NoWarn)CS8604;CS8618;</NoWarn>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -6,7 +6,6 @@
<Nullable>enable</Nullable>
<GenerateDocumentationFile>False</GenerateDocumentationFile>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -7,7 +7,6 @@
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8625;CS1572;CS1573;</NoWarn>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -5,7 +5,6 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -7,7 +7,6 @@
<GenerateDocumentationFile>False</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8618;CS8625;CS8629;CS1572;CS1573;CS0168;</NoWarn>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -7,7 +7,6 @@
<GenerateDocumentationFile>False</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS8618;</NoWarn>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -6,7 +6,6 @@
<Nullable>enable</Nullable>
<GenerateDocumentationFile>False</GenerateDocumentationFile>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -7,7 +7,6 @@
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8625;CS8629;CS1572;CS1573;CS0168;</NoWarn>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -7,7 +7,6 @@
<GenerateDocumentationFile>False</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS8618;</NoWarn>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -7,7 +7,6 @@
<GenerateDocumentationFile>False</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS8625;</NoWarn>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View File

@@ -7,7 +7,6 @@
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8619;CS8620;CS8625;CS8629;CS1572;CS1573;CS0168;CS4014;CS1998;</NoWarn>
<Configurations>Debug;Release;tianyi</Configurations>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>