Product_Wms/WcsMain/Business/Container/ContainerAction.cs

81 lines
2.6 KiB
C#
Raw Normal View History

using WcsMain.ApiClient.DataEntity.ContainerEntity;
using WcsMain.Common;
using WcsMain.DataBase.TableEntity;
using WcsMain.Plugins;
using WcsMain.ExtendMethod;
using WcsMain.WcsAttribute.AutoFacAttribute;
namespace WcsMain.Business.Container;
/// <summary>
/// 四向车库
/// </summary>
[Component]
public class ContainerAction(ContainerWebApiPost webApiPost)
{
/// <summary>
/// 四向车库执行移库任务
/// </summary>
/// <param name="wmsTask"></param>
/// <returns></returns>
public string ExecuteMoveTask(AppWmsTask wmsTask)
{
ContainerTaskResqust containerTaskResqust = new()
{
RequestId = Guid.NewGuid().ToString(),
Key = "",
WmsTaskId = wmsTask.TaskId,
FromCellNo = wmsTask.Origin,
TaskType = "3",
ToCell = wmsTask.Destination,
PalletNo = wmsTask.VehicleNo
};
var response = webApiPost.HttpPost<ContainerTaskResqust, ContainerTaskResponse>(containerTaskResqust, CommonData.AppApiBaseInfos.GetAddress("ContainerOutMoveApiAddress") ?? "");
var responseData = response.ResponseEntity;
if(!response.IsSend || responseData == null)
{
return "请求失败,网络故障";
}
if(responseData.Code == "200")
{
return string.Empty;
}
return responseData.Message ?? "请求失败,未知异常";
}
/// <summary>
/// 发送出库任务
/// </summary>
/// <param name="taskId"></param>
/// <param name="origin"></param>
/// <param name="destination"></param>
/// <param name="vehicleNo"></param>
/// <returns></returns>
public string ExecuteOutTask(string? taskId, string? origin, string? destination, string? vehicleNo)
{
ContainerTaskResqust containerTaskResqust = new()
{
RequestId = Guid.NewGuid().ToString(),
Key = "",
WmsTaskId = taskId,
FromCellNo = origin,
TaskType = "2",
ToCell = destination,
PalletNo = vehicleNo
};
var response = webApiPost.HttpPost<ContainerTaskResqust, ContainerTaskResponse>(containerTaskResqust, CommonData.AppApiBaseInfos.GetAddress("ContainerOutMoveApiAddress") ?? "");
var responseData = response.ResponseEntity;
if (!response.IsSend || responseData == null)
{
return "请求失败,网络故障";
}
if (responseData.Code == "200")
{
return string.Empty;
}
return responseData.Message ?? "请求失败,未知异常";
}
}