This commit is contained in:
FanLian
2023-08-02 10:45:51 +08:00
4 changed files with 45 additions and 2 deletions

View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
{
/// <summary>
/// 创建任务链输入参数
/// </summary>
public class ChainStatusReportingUpInput
{
/// <summary>
/// 任务链编号
/// </summary>
public string taskChainCode { get; set; }
/// <summary>
/// 任务链任务状态
/// </summary>
public string status { get; set; }
}
}

View File

@@ -17,6 +17,10 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Outputs
/// 响应信息
/// </summary>
public string msg { get; set; }
/// <summary>
/// 错误提示消息
/// </summary>
public string error { get; set; }
public DateTime? timestamp { get; set; }
/// <summary>
/// 响应数据

View File

@@ -95,7 +95,6 @@ namespace Tnb.WarehouseMgr
/// <summary>
/// 任务链状态上报
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost, NonUnify]
public async Task<Result> TaskChainCallBack(TaskChainCallBackInput input)
@@ -184,7 +183,7 @@ namespace Tnb.WarehouseMgr
return await ToApiResult(HttpStatusCode.InternalServerError, "请重试!");
throw;
}
return await ToApiResult(HttpStatusCode.OK, "未启用");
return await ToApiResult(HttpStatusCode.InternalServerError, "未启用");
}

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Dynamic;
using System.Linq;
using System.Linq.Expressions;
@@ -19,6 +20,7 @@ using JNPF.DependencyInjection;
using JNPF.DynamicApiController;
using JNPF.Extras.CollectiveOAuth.Config;
using JNPF.FriendlyException;
using JNPF.Logging;
using JNPF.Systems.Entitys.Dto.Module;
using JNPF.Systems.Interfaces.System;
using Mapster;
@@ -214,6 +216,7 @@ namespace Tnb.WarehouseMgr
[HttpPost]
public async Task GenTaskExecute()
{
Stopwatch sw = Stopwatch.StartNew();
//获取所有未下发的预任务申请
var preTasks = await _db.Queryable<WmsPretaskH>().InnerJoin<WmsCarryH>((a, b) => a.startlocation_id == b.location_id && a.carry_id == b.id)
.InnerJoin<WmsAreaH>((a, b, c) => a.area_id == c.id)
@@ -317,6 +320,19 @@ namespace Tnb.WarehouseMgr
row = await _db.Updateable<WmsPretaskH>().SetColumns(it => new WmsPretaskH { status = WmsWareHouseConst.PRETASK_BILL_STATUS_YXF_ID }).Where(it => preTaskIds.Contains(it.id)).ExecuteCommandAsync();
}
//调用AGV创建任务链接口
var taskChainCodeDic = disTasks.Where(t => !t.groups.IsNullOrWhiteSpace()).GroupBy(g => g.groups!)
.ToDictionary(x => x.Key, x => x.Select(it => new
{
taskCode = it.bill_code,
sourceName = it.startlocation_code,
targetName = it.endlocation_code
}));
dynamic reqBody = new ExpandoObject();
sw.Stop();
Log.Information($"程序运行耗时{sw.ElapsedMilliseconds}ms");
await _db.Ado.CommitTranAsync();
}
catch (Exception)