fix:永丰售后修复BUG,
1,物料库存获取不到ERP:重新调整触发查询逻辑 2,工序变更导致物料无法出库:配置旧工序 3,测试出库订单ERP推送,任务下发
This commit is contained in:
1 parent
b2a9a38f38
commit
c76e7bb681
69 files changed
+5510
-157
No files matched your search
@@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using HHWMS.Web.Models.Agv;
|
||||
using HHWMS.Web.Services.Agv;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
using WalkingTec.Mvvm.Core;
|
||||
|
||||
namespace HHWMS.Web.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// AGV 平库任务对外接口(方案 4.2)
|
||||
/// 调用方向:AGV 调度系统 / 上游系统 → WMS
|
||||
/// 接口:Receive(接单)、Callback(状态回调)
|
||||
/// 鉴权:本期暂不实施,保持 Public 公开访问(AppKey/AppSecret 预留待后续启用)
|
||||
/// </summary>
|
||||
[Public]
|
||||
[ActionDescription("AGV接口")]
|
||||
[ApiController]
|
||||
[Route("api/[controller]/[action]"), ApiExplorerSettings(GroupName = "User")]
|
||||
public class AgvController : ApiController
|
||||
{
|
||||
private readonly AgvTaskService _taskService;
|
||||
private readonly AgvOption _option;
|
||||
|
||||
public AgvController(AgvTaskService taskService, IOptions<AgvOption> option)
|
||||
{
|
||||
_taskService = taskService;
|
||||
_option = option.Value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 接单:创建 AGV 任务(幂等 + 8 项校验 + LS 临时容器 + SKU 可选补建 + 接单落库即锁)
|
||||
/// 参数与手动下任务页面保持一致
|
||||
/// </summary>
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> Receive(AgvReceiveRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!_option.Enabled)
|
||||
{
|
||||
return ApiResultError("AGV 模块已停用");
|
||||
}
|
||||
// API 入口:来源系统未传则默认 THIRD_PARTY(页面手动下发走 Service 默认 WMS)
|
||||
if (string.IsNullOrWhiteSpace(request.SourceSystem))
|
||||
{
|
||||
request.SourceSystem = "THIRD_PARTY";
|
||||
}
|
||||
var task = await _taskService.CreateTaskAsync(request);
|
||||
return ApiResult(new
|
||||
{
|
||||
TaskNo = task.TaskNo,
|
||||
ContainerCode = task.ContainerCode,
|
||||
AgvStatus = task.AgvStatus?.ToString()
|
||||
});
|
||||
}
|
||||
catch (AgvBizException ex)
|
||||
{
|
||||
return ApiResultError($"接单失败: {ex.Message}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ApiResultError($"接单异常: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 状态回调:AGV 事件 → 状态机单调推进(Accepted/ArrivedLoad/Loaded/ArrivedUnload/Unloaded/Error/Cancel)
|
||||
/// </summary>
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> Callback(AgvCallbackRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!_option.Enabled)
|
||||
{
|
||||
return ApiResultError("AGV 模块已停用");
|
||||
}
|
||||
await _taskService.HandleCallbackAsync(request);
|
||||
return ApiResult(null);
|
||||
}
|
||||
catch (AgvBizException ex)
|
||||
{
|
||||
return ApiResultError($"回调处理失败: {ex.Message}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ApiResultError($"回调处理异常: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -172,10 +172,10 @@ namespace HHWMS.Web
|
||||
var data = new List<ChartData>();
|
||||
var locations = Wtm.DC.Set<Location>()
|
||||
.AsEnumerable()
|
||||
.GroupBy(x => x.ContainerStatus).ToList()
|
||||
.GroupBy(x => x.ContainerStatus ?? LocationStatus.空仓位).ToList()
|
||||
.Select(x => new { status = statusMap.TryGetValue(x.Key, out var chineseName)
|
||||
? chineseName
|
||||
: x.Key.ToString(), count = x.Count() });
|
||||
: x.Key, count = x.Count() });
|
||||
foreach (var item in locations)
|
||||
{
|
||||
data.Add(new ChartData
|
||||
@@ -227,12 +227,13 @@ namespace HHWMS.Web
|
||||
|
||||
foreach (var loc in group)
|
||||
{
|
||||
statusMap.TryGetValue(loc.ContainerStatus, out var statusInfo);
|
||||
var statusKey = loc.ContainerStatus ?? LocationStatus.空仓位;
|
||||
statusMap.TryGetValue(statusKey, out var statusInfo);
|
||||
heatmap.Points.Add(new HeatmapPointDto
|
||||
{
|
||||
Line = loc.Line,
|
||||
Layer = loc.Layer,
|
||||
Status = statusInfo.name ?? loc.ContainerStatus ?? "未知",
|
||||
Status = statusInfo.name ?? statusKey,
|
||||
Color = statusInfo.color ?? "#909399",
|
||||
ContainerCode = loc.ContainerCode,
|
||||
LocationCode = loc.Code
|
||||
|
||||
Reference in new issue
Block a user