1、<add>[important]添加电子标签wmsapi接口
2、<add>[important]添加输送线WMS接口 3、<update>[normal]优化变更电子标签任务状态的显示
This commit is contained in:
parent
7ffb3e46be
commit
9637d9f0a3
|
|
@ -0,0 +1,37 @@
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Controllers.Dto.WMSEntity.Convey;
|
||||||
|
|
||||||
|
public class GetConveyTaskRequest
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 任务组
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("taskGroup")]
|
||||||
|
public string? TaskGroup { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 载具号
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("vehicleNo")]
|
||||||
|
public string? VehicleNo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务类型
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("taskType")]
|
||||||
|
public int? TaskType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 点位
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("location")]
|
||||||
|
public string[]? Locations { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 备注
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("remark")]
|
||||||
|
public string? Remark { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,76 @@
|
||||||
|
using DataCheck;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Controllers.Dto.WMSEntity.ElTag;
|
||||||
|
|
||||||
|
public class GetElTagTaskRequest
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 任务组
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("taskGroup")]
|
||||||
|
public string? TaskGroup { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务类型
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("taskType")]
|
||||||
|
[DataRules]
|
||||||
|
public int? TaskType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 载具号
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("vehicleNo")]
|
||||||
|
[DataRules]
|
||||||
|
public string? VehicleNo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 订单号
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("orderId")]
|
||||||
|
public string? OrderId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务信息
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("taskData")]
|
||||||
|
public ElTagTaskdata[]? TaskData { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ElTagTaskdata
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 任务号
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("taskId")]
|
||||||
|
public string? TaskId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 点位
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("location")]
|
||||||
|
[DataRules]
|
||||||
|
public string? Location { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物品编号
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("goodsId")]
|
||||||
|
public string? GoodsId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物品名称
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("goodsName")]
|
||||||
|
public string? GoodsName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 需求数量
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("needNum")]
|
||||||
|
[DataRules]
|
||||||
|
public int? NeedNum { get; set; }
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using WcsMain.ApiServe.ControllerFilter;
|
||||||
|
using WcsMain.ApiServe.Controllers.Dto.WMSEntity;
|
||||||
|
using WcsMain.ApiServe.Controllers.Dto.WMSEntity.Convey;
|
||||||
|
using WcsMain.ApiServe.Service.WmsService;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Controllers.WmsController;
|
||||||
|
|
||||||
|
[Route("api/wms/convey")]
|
||||||
|
[ApiController]
|
||||||
|
[ServiceFilter<ResponseFilterAttribute>]
|
||||||
|
[WmsApiExceptionFilter]
|
||||||
|
public class ConveyController(ConveyService conveyService) : ControllerBase
|
||||||
|
{
|
||||||
|
|
||||||
|
private readonly ConveyService _conveyService = conveyService;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 接受上位系统发送过来的输送任务
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("conveyTask")]
|
||||||
|
public WmsApiResponse GetConveyTask([FromBody] GetConveyTaskRequest request)
|
||||||
|
{
|
||||||
|
return _conveyService.GetConveyTask(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using WcsMain.ApiServe.ControllerFilter;
|
||||||
|
using WcsMain.ApiServe.Controllers.Dto.WMSEntity;
|
||||||
|
using WcsMain.ApiServe.Controllers.Dto.WMSEntity.ElTag;
|
||||||
|
using WcsMain.ApiServe.Service.WmsService;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Controllers.WmsController;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 电子标签 WMS 外部接口类
|
||||||
|
/// </summary>
|
||||||
|
[Route("api/wms/elTag")]
|
||||||
|
[ApiController]
|
||||||
|
[ServiceFilter<ResponseFilterAttribute>]
|
||||||
|
[WmsApiExceptionFilter]
|
||||||
|
public class ElTagController(ElTagService elTagService) : ControllerBase
|
||||||
|
{
|
||||||
|
|
||||||
|
private readonly ElTagService _elTagService = elTagService;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 接收 上位系统发来的 电子标签任务
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("elTagTask")]
|
||||||
|
public WmsApiResponse GetElTagTask([FromBody] GetElTagTaskRequest request)
|
||||||
|
{
|
||||||
|
return _elTagService.GetElTagTask(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -48,12 +48,28 @@ public class ElTagService(AppElTagTaskDao tagTaskDao, DataBaseData dataBaseData)
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public WcsApiResponse EditTaskInfo(EditTaskInfoRequest request)
|
public WcsApiResponse EditTaskInfo(EditTaskInfoRequest request)
|
||||||
{
|
{
|
||||||
var updateResult = _tagTaskDao.Update(new AppElTagTask
|
AppElTagTask elTagTask = new()
|
||||||
{
|
{
|
||||||
TaskId = request.TaskId,
|
TaskId = request.TaskId,
|
||||||
TaskStatus = request.TaskStatus,
|
TaskStatus = request.TaskStatus,
|
||||||
Remark = "WCS变更信息"
|
Remark = $"WCS变更信息 - {request.TaskStatus}"
|
||||||
});
|
};
|
||||||
|
switch(request.TaskStatus)
|
||||||
|
{
|
||||||
|
case (int)ElTagTaskStatusEnum.Lighting:
|
||||||
|
elTagTask.LightTime = DateTime.Now;
|
||||||
|
elTagTask.Remark = "WCS变更信息 - 点亮";
|
||||||
|
break;
|
||||||
|
case (int)ElTagTaskStatusEnum.Confirm:
|
||||||
|
elTagTask.ConfirmTime = DateTime.Now;
|
||||||
|
elTagTask.Remark = "WCS变更信息 - 确认";
|
||||||
|
break;
|
||||||
|
case (int)ElTagTaskStatusEnum.Off:
|
||||||
|
elTagTask.OffTime = DateTime.Now;
|
||||||
|
elTagTask.Remark = "WCS变更信息 - 熄灭";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
var updateResult = _tagTaskDao.Update(elTagTask);
|
||||||
return updateResult > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
return updateResult > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
52
WcsMain/ApiServe/Service/WmsService/ConveyService.cs
Normal file
52
WcsMain/ApiServe/Service/WmsService/ConveyService.cs
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
using WcsMain.ApiServe.Controllers.Dto.WMSEntity;
|
||||||
|
using WcsMain.ApiServe.Controllers.Dto.WMSEntity.Convey;
|
||||||
|
using WcsMain.ApiServe.Factory;
|
||||||
|
using WcsMain.DataBase.Dao;
|
||||||
|
using WcsMain.DataBase.TableEntity;
|
||||||
|
using WcsMain.DataService;
|
||||||
|
using WcsMain.Enum.TaskEnum;
|
||||||
|
using WcsMain.WcsAttribute.AutoFacAttribute;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Service.WmsService;
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
public class ConveyService(DataBaseData dataBaseData, AppConveyTaskDao conveyTaskDao)
|
||||||
|
{
|
||||||
|
private readonly DataBaseData _databseData = dataBaseData;
|
||||||
|
private readonly AppConveyTaskDao _conveyTaskDao = conveyTaskDao;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 接收WMS发送过来的输送线任务
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public WmsApiResponse GetConveyTask(GetConveyTaskRequest request)
|
||||||
|
{
|
||||||
|
if(string.IsNullOrEmpty(request.VehicleNo) || request.TaskType == default || request.Locations == default || request.Locations.Length < 1)
|
||||||
|
{
|
||||||
|
return WmsApiResponseFactory.RequestErr("存在必填项未填");
|
||||||
|
}
|
||||||
|
if (request.TaskGroup == default)
|
||||||
|
{
|
||||||
|
request.TaskGroup = _databseData.GetNewUUID2(); // 当任务组为空时生成一个新的
|
||||||
|
}
|
||||||
|
List<AppConveyTask> conveyTasks = [];
|
||||||
|
DateTime now = DateTime.Now;
|
||||||
|
foreach(var location in request.Locations)
|
||||||
|
{
|
||||||
|
conveyTasks.Add(new AppConveyTask
|
||||||
|
{
|
||||||
|
TaskId = _databseData.GetNewUUID(),
|
||||||
|
TaskGroup = request.TaskGroup,
|
||||||
|
VehicleNo = request.VehicleNo,
|
||||||
|
TaskType = request.TaskType,
|
||||||
|
TaskStatus = (int)ConveyTaskStatusEnum.create,
|
||||||
|
Location = location,
|
||||||
|
CreatePerson = StaticData.StaticString.WMS,
|
||||||
|
CreateTime = now,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
var insertResult = _conveyTaskDao.Insert(conveyTasks);
|
||||||
|
return insertResult > 0 ? WmsApiResponseFactory.Success() : WmsApiResponseFactory.DataBaseErr();
|
||||||
|
}
|
||||||
|
}
|
||||||
66
WcsMain/ApiServe/Service/WmsService/ElTagService.cs
Normal file
66
WcsMain/ApiServe/Service/WmsService/ElTagService.cs
Normal file
|
|
@ -0,0 +1,66 @@
|
||||||
|
using DataCheck;
|
||||||
|
using WcsMain.ApiServe.Controllers.Dto.WMSEntity;
|
||||||
|
using WcsMain.ApiServe.Controllers.Dto.WMSEntity.ElTag;
|
||||||
|
using WcsMain.ApiServe.Factory;
|
||||||
|
using WcsMain.Common;
|
||||||
|
using WcsMain.DataBase.Dao;
|
||||||
|
using WcsMain.DataBase.TableEntity;
|
||||||
|
using WcsMain.DataService;
|
||||||
|
using WcsMain.Enum.TaskEnum;
|
||||||
|
using WcsMain.WcsAttribute.AutoFacAttribute;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Service.WmsService;
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
public class ElTagService(DataBaseData dataBaseData, AppElTagTaskDao elTagTaskDao)
|
||||||
|
{
|
||||||
|
private readonly DataBaseData _dataBaseData = dataBaseData;
|
||||||
|
private readonly AppElTagTaskDao _elTagTaskDao = elTagTaskDao;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 接收电子标签任务
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public WmsApiResponse GetElTagTask(GetElTagTaskRequest request)
|
||||||
|
{
|
||||||
|
if (!CheckData.CheckDataRules(request) || request.TaskData == default || request.TaskData.Length < 1)
|
||||||
|
{
|
||||||
|
return WmsApiResponseFactory.RequestErr();
|
||||||
|
}
|
||||||
|
foreach (var elTagTask in request.TaskData)
|
||||||
|
{
|
||||||
|
if (!CheckData.CheckDataRules(elTagTask))
|
||||||
|
{
|
||||||
|
return WmsApiResponseFactory.RequestErr();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(request.TaskGroup == default)
|
||||||
|
{
|
||||||
|
request.TaskGroup = _dataBaseData.GetNewUUID2();
|
||||||
|
}
|
||||||
|
/* 插入任务 */
|
||||||
|
List<AppElTagTask> elTagTasks = [];
|
||||||
|
DateTime now = DateTime.Now;
|
||||||
|
foreach (var elTagTask in request.TaskData)
|
||||||
|
{
|
||||||
|
elTagTasks.Add(new AppElTagTask()
|
||||||
|
{
|
||||||
|
TaskId = string.IsNullOrEmpty(elTagTask.TaskId) ? _dataBaseData.GetNewUUID() : elTagTask.TaskId,
|
||||||
|
TaskGroup = request.TaskGroup,
|
||||||
|
TaskType = request.TaskType,
|
||||||
|
Location = elTagTask.Location,
|
||||||
|
OrderId = request.OrderId,
|
||||||
|
VehicleNo = request.VehicleNo,
|
||||||
|
GoodsId = elTagTask.GoodsId,
|
||||||
|
GoodsName = elTagTask.GoodsName,
|
||||||
|
TaskStatus = (int)ElTagTaskStatusEnum.NeedLight,
|
||||||
|
NeedNum = elTagTask.NeedNum ?? 0,
|
||||||
|
CreatePerson = StaticData.StaticString.WMS,
|
||||||
|
CreateTime = now
|
||||||
|
});
|
||||||
|
}
|
||||||
|
var insertResult = _elTagTaskDao.Insert(elTagTasks.ToArray());
|
||||||
|
return insertResult > 0 ? WmsApiResponseFactory.Success() : WmsApiResponseFactory.DataBaseErr();
|
||||||
|
}
|
||||||
|
}
|
||||||
37
WcsMain/DataBase/Dao/AppConveyTaskDao.cs
Normal file
37
WcsMain/DataBase/Dao/AppConveyTaskDao.cs
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
using WcsMain.Common;
|
||||||
|
using WcsMain.DataBase.TableEntity;
|
||||||
|
using WcsMain.WcsAttribute.AutoFacAttribute;
|
||||||
|
|
||||||
|
namespace WcsMain.DataBase.Dao;
|
||||||
|
|
||||||
|
[Component]
|
||||||
|
public class AppConveyTaskDao
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 插入数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="conveyTasks"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public int Insert(List<AppConveyTask> conveyTasks) => Insert(conveyTasks.ToArray());
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 插入数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="conveyTasks"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public int Insert(params AppConveyTask[] conveyTasks)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var sqlFuc = CommonTool.DbServe.Insertable(conveyTasks);
|
||||||
|
return sqlFuc.ExecuteCommand();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_ = ex;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
81
WcsMain/DataBase/TableEntity/AppConveyTask.cs
Normal file
81
WcsMain/DataBase/TableEntity/AppConveyTask.cs
Normal file
|
|
@ -0,0 +1,81 @@
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
namespace WcsMain.DataBase.TableEntity;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 输送线任务表
|
||||||
|
/// </summary>
|
||||||
|
[SugarTable("tbl_app_convey_task")]
|
||||||
|
public class AppConveyTask
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 任务号
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "task_id", IsPrimaryKey = true)]
|
||||||
|
public string? TaskId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务组
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "task_group")]
|
||||||
|
public string? TaskGroup { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 载具号
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "vehicle_no")]
|
||||||
|
public string? VehicleNo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务类型
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "task_type")]
|
||||||
|
public int? TaskType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务状态
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "task_status")]
|
||||||
|
public int? TaskStatus { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 点位
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "location")]
|
||||||
|
public string? Location { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 实际到达的点位
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "arrive_location")]
|
||||||
|
public string? ArriveLocation { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建人
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "create_person")]
|
||||||
|
public string? CreatePerson { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "create_time")]
|
||||||
|
public DateTime? CreateTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 移栽时间
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "move_time")]
|
||||||
|
public DateTime? MoveTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 完成时间
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "complete_time")]
|
||||||
|
public DateTime? CompleteTime { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
14
WcsMain/Enum/TaskEnum/ConveyTaskStatusEnum.cs
Normal file
14
WcsMain/Enum/TaskEnum/ConveyTaskStatusEnum.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
namespace WcsMain.Enum.TaskEnum;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 输送机任务状态枚举
|
||||||
|
/// </summary>
|
||||||
|
public enum ConveyTaskStatusEnum
|
||||||
|
{
|
||||||
|
create = 0, // 新创建
|
||||||
|
noved = 1, // 已经移栽
|
||||||
|
arrive = 2, // 到达
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user