This commit is contained in:
2024-04-11 17:31:32 +08:00
parent f6eaa2f481
commit 4fbc6c0267
200 changed files with 1252 additions and 1860 deletions

View File

@@ -1,5 +1,4 @@
using Aop.Api.Domain;
using JNPF;
using JNPF;
using JNPF.Common.Core.Manager;
using JNPF.Common.Enums;
using JNPF.Common.Extension;
@@ -35,7 +34,7 @@ namespace Tnb.WarehouseMgr
/// Wms设备接口提供程序服务类
/// </summary>
public class DeviceProviderService : DevServBase<DeviceProviderService>
public class DeviceProviderService : ServiceLoggerBase<DeviceProviderService>
{
private readonly ISqlSugarClient _db;
private readonly IWareHouseService _wareHouseService;
@@ -46,6 +45,7 @@ namespace Tnb.WarehouseMgr
private readonly ElevatorControlConfiguration _eleCtlCfg = App.Configuration.Build<ElevatorControlConfiguration>();
private readonly ILoggerFactory _loggerFactory;
public static Dictionary<string, int> s_eleUseStatusDic = new();
public static Dictionary<string, int> s_loadedStatusDic = new();
@@ -54,7 +54,7 @@ namespace Tnb.WarehouseMgr
IEventPublisher eventPublisher,
IUserManager userManger,
IElevatorControlService elevatorControlService
) : base(repository.AsSugarClient())
) //: base(repository.AsSugarClient())
{
_db = repository.AsSugarClient();
_wareHouseService = wareHouseService;
@@ -187,6 +187,49 @@ namespace Tnb.WarehouseMgr
return await ToApiResult(HttpStatusCode.InternalServerError, "请重试!");
}
/// <summary>
/// 获取电梯根据任务单号
/// </summary>
/// <param name="input">
/// taskCode:子任务编号
/// endlocation_id:目标库位ID
/// </param>
/// <returns></returns>
protected async Task<WmsElevatorH> FindElevatorFromPars(ElevagorInfoQuery input)
{
var whereExpable = Expressionable.Create<WmsElevatorH, WmsElevatorD, WmsDistaskH>()
.And((a, b, c) => a.enabled == 1);
if (!input.taskCode.IsNullOrEmpty())
{
whereExpable.AndIF(!SqlFunc.IsNullOrEmpty(input.taskCode), (a, b, c) => c.bill_code == input.taskCode);
}
if (!input.endlocation_id.IsNullOrEmpty())
{
whereExpable.AndIF(!SqlFunc.IsNullOrEmpty(input.endlocation_id), (a, b, c) => b.location_id == input.endlocation_id);
}
if (!input.startlocation_id.IsNullOrEmpty())
{
whereExpable.AndIF(!SqlFunc.IsNullOrEmpty(input.startlocation_id), (a, b, c) => b.location_id == input.startlocation_id);
}
var ele = await _db.CopyNew().Queryable<WmsElevatorH>().InnerJoin<WmsElevatorD>((a, b) => a.id == b.bill_id)
.InnerJoin<WmsDistaskH>((a, b, c) => b.location_code == c.endlocation_code || b.location_code == c.startlocation_code)
.Where(whereExpable.ToExpression())
.WhereIF(!SqlFunc.IsNullOrEmpty(input.sourceName) && SqlFunc.StartsWith("DT-R", input.sourceName), (a, b, c) => c.startpoint_code == input.sourceName)
.WhereIF(!SqlFunc.IsNullOrEmpty(input.sourceName) && SqlFunc.StartsWith("DT-C", input.sourceName), (a, b, c) => c.endpoint_code == input.sourceName)
.Select((a, b, c) => new WmsElevatorH
{
bill_code = c.bill_code,
device_id = a.elevator_id,
end_floor = c.end_floor
}, true)
.FirstAsync();
return ele;
}
/// <summary>
/// 放货确认/申请放货
/// </summary>