fix:永丰售后修复BUG,

1,物料库存获取不到ERP:重新调整触发查询逻辑
2,工序变更导致物料无法出库:配置旧工序
3,测试出库订单ERP推送,任务下发
This commit is contained in:
sunwang committed 2026-10-29 13:12:11 +08:00
1 parent b2a9a38f38
commit c76e7bb681
69 files changed
+5510 -157

No files matched your search

+51
View File
@@ -0,0 +1,51 @@
using System;
namespace HHWMS.Web.Models.Agv
{
/// <summary>
/// AGV 平库任务配置项(对应 appsettings.json 顶层 AgvOption 节点)
/// 参考《平库AGV方案流程(AGV自调度版).md》10.5
/// </summary>
public class AgvOption
{
/// <summary>
/// 模块总开关:false 时接单/回调接口统一拒绝并提示(灰度/紧急停用,不影响立库)
/// </summary>
public bool Enabled { get; set; } = true;
/// <summary>
/// Mock 模式:不联网、直接返回约定成功报文,开发/联调用(无 AGV 可用)
/// </summary>
public bool MockEnabled { get; set; } = true;
/// <summary>
/// 对外调用超时(秒),默认 15s
/// </summary>
public int CallTimeoutSeconds { get; set; } = 15;
/// <summary>
/// 锁持有告警阈值(分钟):超时任务页面标红,由人工决定取消/继续等待
/// </summary>
public int LockTimeoutMinutes { get; set; } = 60;
/// <summary>
/// 超时监控阈值(分钟):超时监控 Job 周期扫描的判定线
/// </summary>
public int TimeoutMonitorMinutes { get; set; } = 30;
/// <summary>
/// 对账 Job 开关(默认关闭;开启后周期扫描已下发/执行中超时任务并查询 AGV 状态)
/// </summary>
public bool ReconcileEnabled { get; set; } = false;
/// <summary>
/// 对账周期(分钟)
/// </summary>
public int ReconcileMinutes { get; set; } = 10;
/// <summary>
/// AGV 联动写库存的系统账号(必须是真实存在的 FrameworkUser.ITCode,见方案 8.3)
/// </summary>
public string SysUser { get; set; } = "system";
}
}
+123
View File
@@ -0,0 +1,123 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using WalkingTec.Mvvm.Core;
namespace HHWMS.Web.Models.Agv
{
/// <summary>
/// AGV 平库任务(独立表,与立库 TaskHeader 完全隔离)
/// 对应《平库AGV方案流程(AGV自调度版).md》5.1 / 10.2 DDL
/// </summary>
[Index(nameof(TaskNo), IsUnique = true)]
[Index(nameof(AgvStatus))]
[Table("AgvTask")]
public class AgvTask : BasePoco
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public new int ID { get; set; }
/// <summary>
/// WMS 任务号(= 上游 sourceCode 或自生成 AGV+日期+序号),全局唯一
/// </summary>
[Display(Name = "AGV.TaskNo", Description = "WMS任务号")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
[Required(ErrorMessage = "Validate.{0}required")]
public string TaskNo { get; set; }
/// <summary>
/// 上游任务号(与 SourceSystem 组合做幂等去重)
/// </summary>
[Display(Name = "AGV.SourceCode", Description = "上游任务号")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string SourceCode { get; set; }
/// <summary>
/// 上游来源系统标识(如 MES、WMS_CP)
/// </summary>
[Display(Name = "AGV.SourceSystem", Description = "上游来源系统标识")]
[StringLength(20, ErrorMessage = "Validate.{0}stringmax{1}")]
public string SourceSystem { get; set; }
/// <summary>
/// AGV 业务类型(AgvTaskTypeEnum 1~6),由任务场景配置映射
/// </summary>
[Display(Name = "AGV.AgvTaskType", Description = "AGV业务类型")]
public AgvTaskTypeEnum? AgvTaskType { get; set; }
/// <summary>
/// 起点库位编码(AGV 点位,强制校验)
/// </summary>
[Display(Name = "AGV.FromLocation", Description = "起点库位编码")]
[StringLength(64, ErrorMessage = "Validate.{0}stringmax{1}")]
public string FromLocation { get; set; }
/// <summary>
/// 终点库位编码(AGV 点位,强制校验)
/// </summary>
[Display(Name = "AGV.ToLocation", Description = "终点库位编码")]
[StringLength(64, ErrorMessage = "Validate.{0}stringmax{1}")]
public string ToLocation { get; set; }
/// <summary>
/// 起点楼层(取自 LocationZone.Floor,可空;仅记录/展示,不做强校验)
/// </summary>
[Display(Name = "AGV.FromFloor", Description = "起点楼层")]
public int? FromFloor { get; set; }
/// <summary>
/// 终点楼层(同上)
/// </summary>
[Display(Name = "AGV.ToFloor", Description = "终点楼层")]
public int? ToFloor { get; set; }
/// <summary>
/// 容器号(接单/页面非强制,不给则自动生成 LS 临时容器)
/// </summary>
[Display(Name = "AGV.ContainerCode", Description = "容器号")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string ContainerCode { get; set; }
/// <summary>
/// 优先级(数值越大越优先,默认 0)
/// </summary>
[Display(Name = "AGV.Priority", Description = "优先级")]
public int? Priority { get; set; }
/// <summary>
/// AGV 任务状态(AgvTaskStatusEnum,状态机单调推进)
/// </summary>
[Display(Name = "AGV.AgvStatus", Description = "AGV任务状态")]
public AgvTaskStatusEnum? AgvStatus { get; set; }
/// <summary>
/// AGV 小车编号(回调回传,仅展示/排查用)
/// </summary>
[Display(Name = "AGV.AgvCarNo", Description = "AGV小车编号")]
[StringLength(20, ErrorMessage = "Validate.{0}stringmax{1}")]
public string AgvCarNo { get; set; }
/// <summary>
/// 失败/异常/取消原因与完成联动失败原因
/// </summary>
[Display(Name = "AGV.ErrorMsg", Description = "错误信息")]
[StringLength(255, ErrorMessage = "Validate.{0}stringmax{1}")]
public string ErrorMsg { get; set; }
/// <summary>
/// 流水类型(AgvBillTypeEnum:In_AGV/Out_AGV/Move_AGV)
/// </summary>
[Display(Name = "AGV.BillType", Description = "流水类型")]
[StringLength(20, ErrorMessage = "Validate.{0}stringmax{1}")]
public string BillType { get; set; }
/// <summary>
/// 物料明细(JSON,SKU,非强制;缺明细则按空容器业务处理)
/// </summary>
[Display(Name = "AGV.Details", Description = "物料明细(JSON)")]
public string Details { get; set; }
}
}
+82
View File
@@ -0,0 +1,82 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using WalkingTec.Mvvm.Core;
namespace HHWMS.Web.Models.Agv
{
/// <summary>
/// AGV 任务归档镜像(超 1 个月终态任务备份于此,再由 AgvTaskArchiveJob 清理主表)
/// 对应《平库AGV方案流程(AGV自调度版).md》10.2 DDL 第 5 段
/// </summary>
[Index(nameof(TaskNo))]
[Index(nameof(CreateTime))]
[Table("AgvTaskHistory")]
public class AgvTaskHistory : BasePoco
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public new int ID { get; set; }
[Display(Name = "AGV.TaskNo", Description = "WMS任务号")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string TaskNo { get; set; }
[Display(Name = "AGV.SourceCode", Description = "上游任务号")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string SourceCode { get; set; }
[Display(Name = "AGV.SourceSystem", Description = "上游来源系统标识")]
[StringLength(20, ErrorMessage = "Validate.{0}stringmax{1}")]
public string SourceSystem { get; set; }
[Display(Name = "AGV.AgvTaskType", Description = "AGV业务类型")]
public AgvTaskTypeEnum? AgvTaskType { get; set; }
[Display(Name = "AGV.FromLocation", Description = "起点库位编码")]
[StringLength(64, ErrorMessage = "Validate.{0}stringmax{1}")]
public string FromLocation { get; set; }
[Display(Name = "AGV.ToLocation", Description = "终点库位编码")]
[StringLength(64, ErrorMessage = "Validate.{0}stringmax{1}")]
public string ToLocation { get; set; }
[Display(Name = "AGV.FromFloor", Description = "起点楼层")]
public int? FromFloor { get; set; }
[Display(Name = "AGV.ToFloor", Description = "终点楼层")]
public int? ToFloor { get; set; }
[Display(Name = "AGV.ContainerCode", Description = "容器号")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string ContainerCode { get; set; }
[Display(Name = "AGV.Priority", Description = "优先级")]
public int? Priority { get; set; }
[Display(Name = "AGV.AgvStatus", Description = "归档前任务状态")]
public AgvTaskStatusEnum? AgvStatus { get; set; }
[Display(Name = "AGV.AgvCarNo", Description = "AGV小车编号")]
[StringLength(20, ErrorMessage = "Validate.{0}stringmax{1}")]
public string AgvCarNo { get; set; }
[Display(Name = "AGV.ErrorMsg", Description = "错误信息")]
[StringLength(255, ErrorMessage = "Validate.{0}stringmax{1}")]
public string ErrorMsg { get; set; }
[Display(Name = "AGV.BillType", Description = "流水类型")]
[StringLength(20, ErrorMessage = "Validate.{0}stringmax{1}")]
public string BillType { get; set; }
[Display(Name = "AGV.Details", Description = "物料明细(JSON)")]
public string Details { get; set; }
/// <summary>
/// 归档时间
/// </summary>
[Display(Name = "AGV.ArchivedAt", Description = "归档时间")]
public DateTime? ArchivedAt { get; set; }
}
}
+109
View File
@@ -0,0 +1,109 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using WalkingTec.Mvvm.Core;
namespace HHWMS.Web.Models.Agv
{
/// <summary>
/// AGV 任务状态与报文日志(每次状态变更/关键动作写一条)
/// 对应《平库AGV方案流程(AGV自调度版).md》9.6 / 10.2 DDL 第 4 段
/// </summary>
[Index(nameof(TaskNo), nameof(CreateTime))]
[Index(nameof(OrderId))]
[Table("AgvTaskLog")]
public class AgvTaskLog : BasePoco
{
// 必须声明 public new int ID,否则 EF 会用 BasePoco 的 Guid 主键
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public new int ID { get; set; }
/// <summary>
/// WMS 任务号
/// </summary>
[Display(Name = "AGV.TaskNo", Description = "WMS任务号")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
[Required(ErrorMessage = "Validate.{0}required")]
public string TaskNo { get; set; }
/// <summary>
/// AGV 返回运单号(与 TaskNo 一致,原值留痕)
/// </summary>
[Display(Name = "AGV.OrderId", Description = "AGV运单号")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string OrderId { get; set; }
/// <summary>
/// 变更前状态
/// </summary>
[Display(Name = "AGV.FromStatus", Description = "变更前状态")]
public AgvTaskStatusEnum? FromStatus { get; set; }
/// <summary>
/// 变更后状态
/// </summary>
[Display(Name = "AGV.ToStatus", Description = "变更后状态")]
public AgvTaskStatusEnum? ToStatus { get; set; }
/// <summary>
/// 回调事件(如 Loaded/Unloaded/Exception/Canceled)
/// </summary>
[Display(Name = "AGV.Event", Description = "回调事件")]
[StringLength(30, ErrorMessage = "Validate.{0}stringmax{1}")]
public string Event { get; set; }
/// <summary>
/// 方向:down=下发,up=回调
/// </summary>
[Display(Name = "AGV.Direction", Description = "方向(down/up)")]
[StringLength(10, ErrorMessage = "Validate.{0}stringmax{1}")]
public string Direction { get; set; }
/// <summary>
/// 事件发生时间
/// </summary>
[Display(Name = "AGV.EventTime", Description = "事件发生时间")]
public DateTime? EventTime { get; set; }
/// <summary>
/// 来源 IP
/// </summary>
[Display(Name = "AGV.SourceIp", Description = "来源IP")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string SourceIp { get; set; }
/// <summary>
/// 耗时(毫秒)
/// </summary>
[Display(Name = "AGV.DurationMs", Description = "耗时(毫秒)")]
public int? DurationMs { get; set; }
/// <summary>
/// 请求报文
/// </summary>
[Display(Name = "AGV.RequestJson", Description = "请求报文")]
public string RequestJson { get; set; }
/// <summary>
/// 响应报文
/// </summary>
[Display(Name = "AGV.ResponseJson", Description = "响应报文")]
public string ResponseJson { get; set; }
/// <summary>
/// 操作人(AGV 回调记 AGV)
/// </summary>
[Display(Name = "AGV.Operator", Description = "操作人")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string Operator { get; set; }
/// <summary>
/// 备注/异常信息
/// </summary>
[Display(Name = "AGV.Remark", Description = "备注")]
[StringLength(500, ErrorMessage = "Validate.{0}stringmax{1}")]
public string Remark { get; set; }
}
}
+73
View File
@@ -0,0 +1,73 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using WalkingTec.Mvvm.Core;
namespace HHWMS.Web.Models.Agv
{
/// <summary>
/// AGV 任务日志归档镜像(超 6 个月日志备份于此,再由 AgvTaskArchiveJob 清理主表)
/// 对应《平库AGV方案流程(AGV自调度版).md》10.2 DDL 第 6 段
/// </summary>
[Index(nameof(TaskNo), nameof(CreateTime))]
[Table("AgvTaskLogHistory")]
public class AgvTaskLogHistory : BasePoco
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public new int ID { get; set; }
[Display(Name = "AGV.TaskNo", Description = "WMS任务号")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string TaskNo { get; set; }
[Display(Name = "AGV.OrderId", Description = "AGV运单号")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string OrderId { get; set; }
[Display(Name = "AGV.FromStatus", Description = "变更前状态")]
public AgvTaskStatusEnum? FromStatus { get; set; }
[Display(Name = "AGV.ToStatus", Description = "变更后状态")]
public AgvTaskStatusEnum? ToStatus { get; set; }
[Display(Name = "AGV.Event", Description = "回调事件")]
[StringLength(30, ErrorMessage = "Validate.{0}stringmax{1}")]
public string Event { get; set; }
[Display(Name = "AGV.Direction", Description = "方向(down/up)")]
[StringLength(10, ErrorMessage = "Validate.{0}stringmax{1}")]
public string Direction { get; set; }
[Display(Name = "AGV.EventTime", Description = "事件发生时间")]
public DateTime? EventTime { get; set; }
[Display(Name = "AGV.SourceIp", Description = "来源IP")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string SourceIp { get; set; }
[Display(Name = "AGV.DurationMs", Description = "耗时(毫秒)")]
public int? DurationMs { get; set; }
[Display(Name = "AGV.RequestJson", Description = "请求报文")]
public string RequestJson { get; set; }
[Display(Name = "AGV.ResponseJson", Description = "响应报文")]
public string ResponseJson { get; set; }
[Display(Name = "AGV.Operator", Description = "操作人")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string Operator { get; set; }
[Display(Name = "AGV.Remark", Description = "备注")]
[StringLength(500, ErrorMessage = "Validate.{0}stringmax{1}")]
public string Remark { get; set; }
/// <summary>
/// 归档时间
/// </summary>
[Display(Name = "AGV.ArchivedAt", Description = "归档时间")]
public DateTime? ArchivedAt { get; set; }
}
}
@@ -0,0 +1,71 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using WalkingTec.Mvvm.Core;
namespace HHWMS.Web.Models.Agv
{
/// <summary>
/// AGV 任务场景配置:映射"客户(甲方/MES)字符串任务类型 -> AGV 场景"
/// 对应《平库AGV方案流程(AGV自调度版).md》5.6 / 10.2 DDL 第 3 段
/// </summary>
[Index(nameof(SourceTaskType), IsUnique = true)]
[Table("AgvTaskSceneConfig")]
public class AgvTaskSceneConfig : BasePoco
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public new int ID { get; set; }
/// <summary>
/// 上游字符串任务类型(映射主键,如 RAW_IN)
/// </summary>
[Display(Name = "AGV.SourceTaskType", Description = "上游任务类型(映射主键)")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
[Required(ErrorMessage = "Validate.{0}required")]
public string SourceTaskType { get; set; }
/// <summary>
/// 内部业务类型(AgvTaskTypeEnum 1~6,必填)
/// </summary>
[Display(Name = "AGV.AgvTaskType", Description = "内部业务类型")]
public AgvTaskTypeEnum AgvTaskType { get; set; }
/// <summary>
/// AGV 场景 ID(不写死,现场调整只改配置)
/// </summary>
[Display(Name = "AGV.SceneId", Description = "AGV场景ID")]
[StringLength(64, ErrorMessage = "Validate.{0}stringmax{1}")]
[Required(ErrorMessage = "Validate.{0}required")]
public string SceneId { get; set; }
/// <summary>
/// AGV 场景名称
/// </summary>
[Display(Name = "AGV.SceneName", Description = "AGV场景名称")]
[StringLength(64, ErrorMessage = "Validate.{0}stringmax{1}")]
public string SceneName { get; set; }
/// <summary>
/// 取货动作名(默认 Load)
/// </summary>
[Display(Name = "AGV.BinTaskLoad", Description = "取货动作名")]
[StringLength(32, ErrorMessage = "Validate.{0}stringmax{1}")]
public string BinTaskLoad { get; set; }
/// <summary>
/// 放货动作名(默认 Unload)
/// </summary>
[Display(Name = "AGV.BinTaskUnload", Description = "放货动作名")]
[StringLength(32, ErrorMessage = "Validate.{0}stringmax{1}")]
public string BinTaskUnload { get; set; }
/// <summary>
/// 备注
/// </summary>
[Display(Name = "AGV.Remark", Description = "备注")]
[StringLength(255, ErrorMessage = "Validate.{0}stringmax{1}")]
public string Remark { get; set; }
}
}