1
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using Tnb.WarehouseMgr.Entities.Enums;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities.Dto
|
||||
{
|
||||
public class ConfirmInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 任务链编号
|
||||
/// </summary>
|
||||
public string taskChainCode { get; set; }
|
||||
/// <summary>
|
||||
/// 子任务编号
|
||||
/// </summary>
|
||||
public string taskCode { get; set; }
|
||||
/// <summary>
|
||||
/// 起点编号
|
||||
/// </summary>
|
||||
public string sourceName { get; set; }
|
||||
/// <summary>
|
||||
/// 终点编号
|
||||
/// </summary>
|
||||
public string targetName { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using Tnb.WarehouseMgr.Entities.Enums;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities.Dto
|
||||
{
|
||||
public class TaskCallBackInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 任务链编号
|
||||
/// </summary>
|
||||
public string taskChainCode { get; set; }
|
||||
/// <summary>
|
||||
/// 任务链编号
|
||||
/// </summary>
|
||||
public string taskCode { get; set; }
|
||||
/// <summary>
|
||||
/// 起点编号
|
||||
/// </summary>
|
||||
public string sourceName { get; set; }
|
||||
/// <summary>
|
||||
/// 终点编号
|
||||
/// </summary>
|
||||
public string targetName { get; set; }
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public string status { get; set; }
|
||||
/// <summary>
|
||||
/// 取货/放货
|
||||
/// </summary>
|
||||
public string action { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using Tnb.WarehouseMgr.Entities.Enums;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities.Dto
|
||||
{
|
||||
public class TaskChainCallBackInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 任务链编号
|
||||
/// </summary>
|
||||
public string taskChainCode { get; set; }
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public string status { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -54,5 +54,18 @@ namespace Tnb.WarehouseMgr.Interfaces
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
Task TaskComplate(TaskCompleUpInput input);
|
||||
/// <summary>
|
||||
/// 任务执行
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
Task TaskExecute(TaskExecuteUpInput input);
|
||||
/// <summary>
|
||||
/// 任务执行取操作返回(后续操作)
|
||||
/// </summary>
|
||||
/// /// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
Task TaskExecuteAfter(TaskExecuteAfterUpInput input);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,41 +3,190 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NPOI.OpenXmlFormats;
|
||||
using Senparc.NeuChar.ApiHandlers;
|
||||
using SqlSugar;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Dto;
|
||||
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||
using Tnb.WarehouseMgr.Entities.Dto.Outputs;
|
||||
using Tnb.WarehouseMgr.Entities.Entity;
|
||||
using Tnb.WarehouseMgr.Interfaces;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// Wms设备接口提供程序服务类
|
||||
/// </summary>
|
||||
|
||||
|
||||
public class DeviceProviderService : BaseWareHouseService
|
||||
{
|
||||
//[HttpPost,NonUnify]
|
||||
//public async Task<dynamic> pickupRequest(pickupRequest)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IWareHouseService _wareHouseService;
|
||||
|
||||
// }
|
||||
// catch (Exception)
|
||||
// {
|
||||
|
||||
// throw;
|
||||
// }
|
||||
// return ToApiResult();
|
||||
//}
|
||||
public DeviceProviderService(ISqlSugarRepository<WmsInstockH> repository, IWareHouseService wareHouseService)
|
||||
{
|
||||
_db = repository.AsSugarClient();
|
||||
_wareHouseService = wareHouseService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建任务链
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<Result> CreateTaskChain()
|
||||
[HttpPost, NonUnify]
|
||||
public async Task<Result> CreateTaskChain()
|
||||
{
|
||||
return await Task.FromResult<Result>(null);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取货确认/申请取货
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, NonUnify]
|
||||
public async Task<Result> LoadConfirm(ConfirmInput input)
|
||||
{
|
||||
try
|
||||
{
|
||||
var eles = await _db.Queryable<WmsElevatorH>().LeftJoin<WmsElevatorD>((a, b) => a.id == b.bill_id)
|
||||
.LeftJoin<WmsDistaskH>((a, b, c) => b.location_id == c.startlocation_id)
|
||||
.Where((a, b, c) => c.startlocation_code == input.sourceName && c.bill_code == $"{input.taskChainCode}-{input.taskCode}")
|
||||
.ToListAsync();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return await ToApiResult(HttpStatusCode.InternalServerError, "请重试!");
|
||||
throw;
|
||||
}
|
||||
return await ToApiResult(HttpStatusCode.InternalServerError, "未启用");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 放货确认/申请放货
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, NonUnify]
|
||||
public async Task<Result> UnloadConfirm(ConfirmInput input)
|
||||
{
|
||||
try
|
||||
{
|
||||
var eles = await _db.Queryable<WmsElevatorH>().LeftJoin<WmsElevatorD>((a, b) => a.id == b.bill_id)
|
||||
.LeftJoin<WmsDistaskH>((a, b, c) => b.location_id == c.endlocation_id)
|
||||
.Where((a, b, c) => c.endlocation_code == input.targetName && c.bill_code == $"{input.taskChainCode}-{input.taskCode}")
|
||||
.ToListAsync();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return await ToApiResult(HttpStatusCode.InternalServerError, "请重试!");
|
||||
throw;
|
||||
}
|
||||
return await ToApiResult(HttpStatusCode.InternalServerError, "未启用");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 任务链状态上报
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, NonUnify]
|
||||
public async Task<Result> TaskChainCallBack(TaskChainCallBackInput input)
|
||||
{
|
||||
try
|
||||
{
|
||||
switch (input.status)
|
||||
{
|
||||
case "CREATED": break;
|
||||
case "ALLOCATED":
|
||||
var disTasks = await _db.Queryable<WmsDistaskH>().Where(it => it.bill_code.Contains(input.taskChainCode)).ToListAsync();
|
||||
TaskExecuteUpInput taskExecuteUpInput = new()
|
||||
{
|
||||
disTaskIds = disTasks.Select(x => x.id).ToList(),
|
||||
};
|
||||
await _wareHouseService.TaskExecute(taskExecuteUpInput); break;
|
||||
case "PROGRESSING": break;
|
||||
case "CANCELLED": break;
|
||||
case "SUCCEED": break;
|
||||
case "FAILURE": break;
|
||||
case "FINISHED": break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return await ToApiResult(HttpStatusCode.InternalServerError, "请重试!");
|
||||
throw;
|
||||
}
|
||||
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 任务状态上报
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, NonUnify]
|
||||
public async Task<Result> TaskCallback(TaskCallBackInput input)
|
||||
{
|
||||
try
|
||||
{
|
||||
var disTasks = await _db.Queryable<WmsDistaskH>().Where(it => it.bill_code.Contains($"{input.taskChainCode}-{input.taskCode}")).ToListAsync();
|
||||
if (input.action == "取货")
|
||||
{
|
||||
TaskExecuteAfterUpInput taskExecuteAfterUpInput = new()
|
||||
{
|
||||
disTaskIds = disTasks.Select(x => x.id).ToList()
|
||||
};
|
||||
await _wareHouseService.TaskExecuteAfter(taskExecuteAfterUpInput);
|
||||
}
|
||||
else if (input.action == "放货")
|
||||
{
|
||||
TaskCompleUpInput taskCompleUpInput = new()
|
||||
{
|
||||
disTaskIds = disTasks.Select(x => x.id).ToList()
|
||||
};
|
||||
await _wareHouseService.TaskComplate(taskCompleUpInput);
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return await ToApiResult(HttpStatusCode.InternalServerError, "请重试!");
|
||||
throw;
|
||||
}
|
||||
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 申请进出电梯
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, NonUnify]
|
||||
public async Task<Result> ElevatorConfirm(ConfirmInput input)
|
||||
{
|
||||
try
|
||||
{
|
||||
var eles = await _db.Queryable<WmsElevatorH>().LeftJoin<WmsElevatorD>((a, b) => a.id == b.bill_id)
|
||||
.LeftJoin<WmsDistaskH>((a, b, c) => b.location_id == c.startlocation_id)
|
||||
.Where((a, b, c) => c.startlocation_code == input.sourceName && c.bill_code == $"{input.taskChainCode}-{input.taskCode}")
|
||||
.ToListAsync();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return await ToApiResult(HttpStatusCode.InternalServerError, "请重试!");
|
||||
throw;
|
||||
}
|
||||
return await ToApiResult(HttpStatusCode.InternalServerError, "未启用");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,6 +164,7 @@ namespace Tnb.WarehouseMgr
|
||||
var whereExp = Expressionable.Create<BasLocation>()
|
||||
.And(it => it.wh_id == input.warehouse_id)
|
||||
.And(it => it.is_lock == 0)
|
||||
.And(it => it.is_type == ((int)EnumLocationType.存储库位).ToString())
|
||||
.And(it => it.is_use == ((int)EnumCarryStatus.空闲).ToString())
|
||||
.ToExpression();
|
||||
items = await _db.Queryable<BasLocation>().Where(whereExp).OrderBy(policy.policy).ToListAsync();
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace Tnb.WarehouseMgr
|
||||
preTaskUpInput.CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!;
|
||||
preTaskUpInput.CarryStartLocationId = points.FirstOrDefault()!.location_id!;
|
||||
preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault()!.location_code!;
|
||||
preTaskUpInput.LocationIds = points.Select(x => x.id).ToList();
|
||||
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList()!;
|
||||
preTaskUpInput.PreTaskRecords = preTasks.Adapt<List<WmsHandleH>>();
|
||||
preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId());
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ namespace Tnb.WarehouseMgr
|
||||
preTaskUpInput.CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!;
|
||||
preTaskUpInput.CarryStartLocationId = points.FirstOrDefault()!.location_id!;
|
||||
preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault()!.location_code!;
|
||||
preTaskUpInput.LocationIds = points.Select(x => x.id).ToList();
|
||||
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList()!;
|
||||
preTaskUpInput.PreTaskRecords = preTasks.Adapt<List<WmsHandleH>>();
|
||||
preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId());
|
||||
WmsHandleH handleH = new();
|
||||
|
||||
Reference in New Issue
Block a user