diff --git a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs
index 27d4a87a..b15d8719 100644
--- a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs
@@ -1605,7 +1605,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
return result.Contains("Ok");
- // 测试
+ //测试
//string DevName = "东面提升机输送线";
//JObject valueJson = new JObject();
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MaterialTransferCallRackToProductionLineInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MaterialTransferCallRackToProductionLineInput.cs
index c291316b..ad81aa62 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MaterialTransferCallRackToProductionLineInput.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MaterialTransferCallRackToProductionLineInput.cs
@@ -15,9 +15,9 @@
public string create_id { get; set; }
///
- /// 料架号
+ /// 工位
///
- public string? carry_code { get; set; }
+ public string? workstation_id { get; set; }
///
/// 终点库位
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/DeviceProviderService.cs b/WarehouseMgr/Tnb.WarehouseMgr/DeviceProviderService.cs
index cbd575b1..a9b783af 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/DeviceProviderService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/DeviceProviderService.cs
@@ -451,7 +451,7 @@ namespace Tnb.WarehouseMgr
await _db.Updateable().SetColumns(r => new WmsPretaskH
{
note = "WCS上传失败(FAILURE)信号 取消时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
- status = WmsWareHouseConst.TASK_BILL_STATUS_CANCEL_ID
+ status = WmsWareHouseConst.PRETASK_BILL_STATUS_CANCEL_ID
}).Where(P => wmsDistaskHCodes.Contains(P.bill_code)).ExecuteCommandAsync();
Logger.Information("成功处理WCS上传的失败任务");
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs
index 044c8992..84b18fff 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs
@@ -78,7 +78,8 @@ namespace Tnb.WarehouseMgr
public static SemaphoreSlim s_floor2CreatePretask = new(1);
public SemaphoreSlim s_taskCommonCreatePretask = new(1);
public SemaphoreSlim s_taskGenPreTask = new(1);
-
+ public SemaphoreSlim s_GenTaskExecute = new(1);
+
public Func AddUnExecuteTask { get; set; }
@@ -773,9 +774,11 @@ namespace Tnb.WarehouseMgr
rackAreaPointsDown.Add("AX02");
try {
+ List basLocations = _db.Queryable().Where(r => (r.location_code == disTask.endlocation_code || r.location_code == disTask.startlocation_code)
+ && r.wh_id != "33780009364245").ToList();
-
- if (disTask.area_code == "E")
+ // 暂存仓内任务
+ if (disTask.area_code == "E" && basLocations.Count() == 0)
{
await _db.Ado.BeginTranAsync();
Logger.Information($"【二楼机械臂Floor2MechanicalComplete】收到到货完成信号 传入参数: {disTask.bill_code} {action}");
@@ -870,8 +873,8 @@ namespace Tnb.WarehouseMgr
ISugarQueryable WmsMechanicalArmHs = _db.Queryable().Where(r => r.location_code == disTask.startlocation_code);
if (WmsMechanicalArmHs.Count() == 0)
{
- Logger.Information($"【二楼机械臂Floor2MechanicalComplete】 任务执行起点{disTask.endpoint_code} 与料架区的点位不匹配");
- throw new Exception($"【二楼机械臂Floor2MechanicalComplete】 任务执行起点{disTask.endpoint_code} 与料架区的点位不匹配");
+ Logger.Information($"【二楼机械臂Floor2MechanicalComplete】 任务执行终点{disTask.endpoint_code} 与料架区的点位不匹配");
+ throw new Exception($"【二楼机械臂Floor2MechanicalComplete】 任务执行终点{disTask.endpoint_code} 与料架区的点位不匹配");
}
WmsMechanicalArmH target = WmsMechanicalArmHs.First();
@@ -886,7 +889,20 @@ namespace Tnb.WarehouseMgr
// 更新料架在二楼配送的目标工位
// todo erp工位字段取数位置未确定
- string targetWorkstation = "003-01-01-01";
+ WmsMaterialTransferD wmsMaterialTransferD = await _db.Queryable()
+ .LeftJoin((a, b) => a.id == b.bill_id).Where((a, b) => a.bill_code == target.outbill)
+ .Select((a, b) => b).FirstAsync();
+ if (wmsMaterialTransferD == null)
+ {
+ throw new Exception($@"【上升降机】 发生异常!,转库单{target.outbill}没有载具明细");
+ }
+
+ string targetWorkstation = wmsMaterialTransferD.station_code;
+ if (string.IsNullOrEmpty(wmsMaterialTransferD.station_code))
+ {
+ throw new Exception($@"【上升降机】 发生异常!,转库单{target.outbill}的工位为空");
+ }
+
Logger.LogInformation($@"【上升降机】更新料架 {target.rackcode} 在二楼配送的目标工位 {targetWorkstation}");
await _db.Updateable().SetColumns(r => new WmsCarryH
{
@@ -954,6 +970,7 @@ namespace Tnb.WarehouseMgr
//return true;
}
+
///
/// 生成任务执行
///
@@ -961,20 +978,19 @@ namespace Tnb.WarehouseMgr
[HttpPost]
public async Task GenTaskExecute()
{
- if (s_taskExecuteSemaphore.CurrentCount == 0)
+ if (s_GenTaskExecute.CurrentCount == 0)
{
Logger.Information("【GenTaskExecute】 【测试】 丢弃此执行");
return;
}
- await s_taskExecuteSemaphore.WaitAsync();
- await CTUTaskExecute();
-
+ await s_GenTaskExecute.WaitAsync();
Stopwatch sw = Stopwatch.StartNew();
CancellationTokenSource agvCts = new();
-
SqlSugarClient db = _db.CopyNew();
try
{
+ await CTUTaskExecute();
+
//获取所有未下发的预任务申请
Logger.Information("【GenTaskExecute】 开始获取未下发的预任务...");
@@ -1101,6 +1117,7 @@ namespace Tnb.WarehouseMgr
}
}
}
+ Logger.Information($"已生成任务执行编码");
}
}
@@ -1237,7 +1254,7 @@ namespace Tnb.WarehouseMgr
}
finally
{
- _ = s_taskExecuteSemaphore.Release();
+ _ = s_GenTaskExecute.Release();
agvCts.Dispose();
sw.Stop();
Logger.Information($"【GenTaskExecute】 任务执行耗时{sw.ElapsedMilliseconds}毫秒");
@@ -1503,6 +1520,7 @@ namespace Tnb.WarehouseMgr
}
catch (Exception ex)
{
+ throw;
}
}
//判断生成bill_code
@@ -1819,10 +1837,10 @@ namespace Tnb.WarehouseMgr
kiva.Add("ZSSSXCTU01");
List floor2 = new List();
// 二楼暂存仓
- floor2.Add("AS01");
- floor2.Add("AS02");
- floor2.Add("AX01");
- floor2.Add("AX02");
+ //floor2.Add("AS01");
+ //floor2.Add("AS02");
+ //floor2.Add("AX01");
+ //floor2.Add("AX02");
//调用AGV创建任务链接口
try
{
@@ -1838,7 +1856,7 @@ namespace Tnb.WarehouseMgr
sourceName = it.startpoint_code,
targetName = it.endpoint_code,
containerCode = it.carry_code,
- shelfNumber = floor2.Contains(it.startlocation_code) || floor2.Contains(it.endlocation_code) ? it.carry_code : "" // 二楼暂存仓传料架
+ shelfNumber = it.area_code == "E" ? it.carry_code : "" // 二楼暂存仓传料架
}));
Logger.Information($"【AgvDispatch】 Agv任务执行的taskChainCodeDic:{JsonConvert.SerializeObject(taskChainCodeDic)}");
@@ -1848,7 +1866,8 @@ namespace Tnb.WarehouseMgr
var typeflag = false;
var dis = disTasks.Where(p => p.groups == k).First();
if (kiva.Contains(dis.startlocation_code) || kiva.Contains(dis.endlocation_code)
- || floor2.Contains(dis.startlocation_code) || floor2.Contains(dis.endlocation_code))
+ //|| floor2.Contains(dis.startlocation_code) || floor2.Contains(dis.endlocation_code)
+ )
{
typeflag = true;
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs
index 1ca08ccc..3c87615f 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs
@@ -301,7 +301,10 @@ namespace Tnb.WarehouseMgr
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;
+ if (!string.IsNullOrEmpty(input.create_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_WMSCARRYUNBIND_ID, true);
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialTransferService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialTransferService.cs
index 58bd71b5..57f66fb1 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialTransferService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialTransferService.cs
@@ -542,17 +542,23 @@ namespace Tnb.WarehouseMgr
{
try
{
- WmsCarryH wmsCarryH = _db.Queryable().Where(r => r.carry_code == input.carry_code).First();
+ OrganizeEntity organizeEntity = _db.Queryable().Where(r => r.Id == input.workstation_id).First();
+ if (organizeEntity == null)
+ {
+ Logger.LogWarning($"【CallRackToProductionLine】不存在工位id为{input.workstation_id}的工位!");
+ throw new AppFriendlyException($"不存在工位id为{input.workstation_id}的工位!", 500);
+ }
+ WmsCarryH wmsCarryH = _db.Queryable().Where(r => r.work_station == organizeEntity.EnCode).First();
if (wmsCarryH == null)
{
- Logger.LogWarning($"【CallRackToProductionLine】不存在编码为{input.carry_code}的料架号!");
- throw new AppFriendlyException($"不存在编码为{input.carry_code}的料架号!", 500);
- }
- if (string.IsNullOrEmpty(wmsCarryH.work_station))
- {
- Logger.LogWarning($"【CallRackToProductionLine】此料架目标工位为空!{input.carry_code}");
- throw new AppFriendlyException($"此料架目标工位为空!{input.carry_code}!", 500);
+ Logger.LogWarning($"【CallRackToProductionLine】不存在工位为{organizeEntity.EnCode}的料架号!");
+ throw new AppFriendlyException($"不存在编码为{organizeEntity.EnCode}的料架号!", 500);
}
+ //if (string.IsNullOrEmpty(wmsCarryH.work_station))
+ //{
+ // Logger.LogWarning($"【CallRackToProductionLine】此料架目标工位为空!{input.carry_code}");
+ // throw new AppFriendlyException($"此料架目标工位为空!{input.carry_code}!", 500);
+ //}
//if (string.IsNullOrEmpty(wmsCarryH.location_id))
//{
@@ -562,8 +568,8 @@ namespace Tnb.WarehouseMgr
if (string.IsNullOrEmpty(input.endlocation_id))
{
- Logger.LogWarning($"【CallRackToProductionLine】终点库位不能为空!{input.carry_code}");
- throw new AppFriendlyException($"终点库位不能为空!{input.carry_code}", 500);
+ Logger.LogWarning($"【CallRackToProductionLine】终点库位不能为空!{input.endlocation_id}");
+ throw new AppFriendlyException($"终点库位不能为空!{input.endlocation_id}", 500);
}
//BasLocation endlocation = _db.Queryable().Where(r => r.location_code == wmsCarryH.work_station).First();
@@ -571,8 +577,8 @@ namespace Tnb.WarehouseMgr
WmsPretaskH wmsPretaskH = _db.Queryable().Where(r => r.carry_code == wmsCarryH.carry_code && r.status != WmsWareHouseConst.PRETASK_BILL_STATUS_COMPLE_ID).First();
if (wmsPretaskH != null)
{
- Logger.LogWarning($"【CallRackToProductionLine】此料架{input.carry_code}存在未完成的预任务{wmsPretaskH.bill_code}!");
- throw new AppFriendlyException($"此料架{input.carry_code}存在未完成的预任务{wmsPretaskH.bill_code}!", 500);
+ Logger.LogWarning($"【CallRackToProductionLine】此料架{wmsCarryH.carry_code}存在未完成的预任务{wmsPretaskH.bill_code}!");
+ throw new AppFriendlyException($"此料架{wmsCarryH.carry_code}存在未完成的预任务{wmsPretaskH.bill_code}!", 500);
}
CommonCreatePretaskInput commonCreatePretaskInput = new CommonCreatePretaskInput();
diff --git a/apihost/Tnb.API.Entry/Startup.cs b/apihost/Tnb.API.Entry/Startup.cs
index ee57504c..692e0d5a 100644
--- a/apihost/Tnb.API.Entry/Startup.cs
+++ b/apihost/Tnb.API.Entry/Startup.cs
@@ -64,7 +64,7 @@ public class Startup : AppStartup
services.AddSingleton(sp => new TimedTaskBackgroundService());
//var bgSvc = App.GetRequiredService();
//bgSvc.StartAsync(CancellationToken.None);
- // services.AddHostedService();
+ services.AddHostedService();
}