电梯代码调整

This commit is contained in:
yang.lee
2023-12-15 09:50:54 +08:00
parent c23134729e
commit 838ad24660
5 changed files with 111 additions and 54 deletions

View File

@@ -1,5 +1,8 @@
using System.Text;
using JNPF;
using JNPF.Common.Extension;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using SqlSugar;
using Tnb.WarehouseMgr.Entities;
@@ -16,6 +19,7 @@ namespace Tnb.WarehouseMgr
private static SqlSugarScope context;
private readonly ISqlSugarClient _db;
public static Dictionary<string, int> s_eleUseStatusDic = new();
public static Dictionary<string, int> s_loadedStatusDic = new();
static DevServBase()
{
@@ -55,16 +59,28 @@ namespace Tnb.WarehouseMgr
/// 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.startpoint_code)
.Where((a, b, c) => a.enabled == 1)
.WhereIF(!SqlFunc.IsNullOrEmpty(input.taskCode), (a, b, c) => c.bill_code == input.taskCode)
.WhereIF(!SqlFunc.IsNullOrEmpty(input.endlocation_id), (a, b, c) => b.location_id == input.endlocation_id)
.WhereIF(!SqlFunc.IsNullOrEmpty(input.startlocation_id), (a, b, c) => b.location_id == input.startlocation_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)
//.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,