出库申请代码逻辑调整
This commit is contained in:
@@ -23,5 +23,6 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Outputs
|
||||
/// </summary>
|
||||
public object data { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,8 +31,8 @@ namespace Tnb.WarehouseMgr
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[NonUnify]
|
||||
[HttpPost,NonUnify]
|
||||
|
||||
public async Task<dynamic> MESCarryQuery(MESCarryQueryInput input)
|
||||
{
|
||||
if (input.IsNull()) throw new ArgumentNullException("input");
|
||||
|
||||
@@ -96,9 +96,19 @@ namespace Tnb.WarehouseMgr
|
||||
List<WmsCarryCode> carryCodes = new();
|
||||
foreach (var os in outStockDList)
|
||||
{
|
||||
var whereExpr = Expressionable.Create<WmsCarryH, WmsCarryCode, BasLocation>()
|
||||
.And((a, b, c) => b.material_id == os.material_id)
|
||||
.And((a, b, c) => a.is_lock == 0)
|
||||
.And((a, b, c) => !string.IsNullOrEmpty(a.location_id))
|
||||
.And((a, b, c) => a.status == (int)EnumCarryStatus.占用)
|
||||
.And((a, b, c) => c.is_type == ((int)EnumLocationType.存储库位).ToString())
|
||||
.And((a, b, c) => a.out_status=="0")
|
||||
.And((a, b, c) => c.wh_id == input.data[nameof(WmsOutstockH.warehouse_id)].ToString())
|
||||
.AndIF(!string.IsNullOrEmpty(os.code_batch), (a, b, c) => b.code_batch == os.code_batch)
|
||||
.ToExpression();
|
||||
|
||||
var carryCodesPart = await _db.Queryable<WmsCarryH>().InnerJoin<WmsCarryCode>((a, b) => a.id == b.carry_id).InnerJoin<BasLocation>((a, b, c) => a.location_id == c.id)
|
||||
.Where((a, b, c) => b.material_id == os.material_id && a.is_lock == 0 && !string.IsNullOrEmpty(a.location_id) && a.status == (int)EnumCarryStatus.占用 && c.is_type == ((int)EnumLocationType.存储库位).ToString())
|
||||
.WhereIF(!string.IsNullOrEmpty(os.code_batch), (a, b) => b.code_batch == os.code_batch)
|
||||
.Where(whereExpr)
|
||||
.Select<WmsCarryCode>()
|
||||
.ToListAsync();
|
||||
if (carryCodesPart?.Count > 0)
|
||||
@@ -215,11 +225,11 @@ namespace Tnb.WarehouseMgr
|
||||
carry_code = carry.carry_code,
|
||||
area_id = sPoint?.area_id!,
|
||||
area_code = it.Key,
|
||||
require_id = input.data["ReturnIdentity"].ToString()
|
||||
require_id = input.data["ReturnIdentity"].ToString(),
|
||||
require_code = input.data[nameof(preTask.bill_code)]?.ToString()!,
|
||||
create_id = _userManager.UserId,
|
||||
create_time = DateTime.Now
|
||||
};
|
||||
preTask.require_code = input.data[nameof(preTask.bill_code)]?.ToString()!;
|
||||
preTask.create_id = _userManager.UserId;
|
||||
preTask.create_time = DateTime.Now;
|
||||
return preTask;
|
||||
}).ToList();
|
||||
if (loc.is_sign == 0)
|
||||
@@ -245,6 +255,7 @@ namespace Tnb.WarehouseMgr
|
||||
pretaskCodes.AddRange(curPreTaskCodes);
|
||||
}
|
||||
var isOk = await _wareHouseService.GenPreTask(preTasks, pretaskCodes);
|
||||
|
||||
GenPreTaskUpInput genPreTaskAfterUpInput = new();
|
||||
genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList();
|
||||
genPreTaskAfterUpInput.LocationIds = new HashSet<string>(locIds).ToList();
|
||||
|
||||
@@ -14,6 +14,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using NPOI.SS.Formula;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.Common.Utils;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Attributes;
|
||||
using Tnb.WarehouseMgr.Entities.Consts;
|
||||
@@ -93,15 +94,16 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
else if (os.pr_qty <= carryCodesPart[i].codeqty)
|
||||
{
|
||||
carryCodesPart[i].codeqty = os.pr_qty;
|
||||
curCarryCodes.Add(carryCodesPart[i]);
|
||||
WmsCarryCode curCarryCode = DeepCopyHelper<WmsCarryCode>.DeepCopy(carryCodesPart[i]);
|
||||
curCarryCode.codeqty = os.pr_qty;
|
||||
curCarryCodes.Add(curCarryCode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
var partCarryMats = curCarryCodes.Adapt<List<WmsCarryMat>>();
|
||||
for (int i = 0; i < partCarryMats.Count; i++)
|
||||
{
|
||||
partCarryMats[i].need_qty = carryCodesPart[i].codeqty;
|
||||
partCarryMats[i].need_qty = curCarryCodes[i].codeqty;
|
||||
}
|
||||
|
||||
carryMats.AddRange(partCarryMats);
|
||||
|
||||
59
common/Tnb.Common/Utils/ParameterCheckHelper.cs
Normal file
59
common/Tnb.Common/Utils/ParameterCheckHelper.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.Common.Utils
|
||||
{
|
||||
public class PropertyNotNullChecker<T>
|
||||
{
|
||||
private static readonly Dictionary<Type, Func<T, bool>> Cache = new Dictionary<Type, Func<T, bool>>();
|
||||
|
||||
public static bool CheckAllPropertiesNotNull(T obj)
|
||||
{
|
||||
//Type type = typeof(T);
|
||||
|
||||
//// 检查缓存中是否存在类型的检查方法
|
||||
//if (Cache.TryGetValue(type, out var checkFunc))
|
||||
//{
|
||||
// return checkFunc(obj);
|
||||
//}
|
||||
|
||||
//var properties = type.GetProperties();
|
||||
|
||||
//// 创建表达式树的参数
|
||||
//var objParam = Expression.Parameter(type, "obj");
|
||||
|
||||
//var propertyNotNullExpressions = new List<Expression>();
|
||||
|
||||
//foreach (var property in properties)
|
||||
//{
|
||||
// // 创建访问属性的表达式
|
||||
// var propertyAccess = Expression.Property(objParam, property);
|
||||
|
||||
// // 创建检查属性非空的表达式
|
||||
// var notNullExpression = Expression.NotEqual(propertyAccess, Expression.Constant(null));
|
||||
|
||||
// propertyNotNullExpressions.Add(notNullExpression);
|
||||
//}
|
||||
|
||||
//// 创建所有属性非空的表达式
|
||||
//var allPropertiesNotNullExpression = Expression.AndAlso(propertyNotNullExpressions);
|
||||
|
||||
//// 创建Lambda表达式
|
||||
//var lambda = Expression.Lambda<Func<T, bool>>(allPropertiesNotNullExpression, objParam);
|
||||
|
||||
//// 编译表达式并执行
|
||||
//var func = lambda.Compile();
|
||||
|
||||
//// 将类型和检查方法添加到缓存中
|
||||
//Cache[type] = func;
|
||||
|
||||
//return func(obj);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user