diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/DataResult.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/DataResult.cs
index 1eb0521e..8b4643ba 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/DataResult.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/DataResult.cs
@@ -23,5 +23,6 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Outputs
///
public object data { get; set; }
+
}
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryQueryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryQueryService.cs
index 123e9d39..b04c4568 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryQueryService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryQueryService.cs
@@ -31,8 +31,8 @@ namespace Tnb.WarehouseMgr
///
///
///
- [HttpPost]
- [NonUnify]
+ [HttpPost,NonUnify]
+
public async Task MESCarryQuery(MESCarryQueryInput input)
{
if (input.IsNull()) throw new ArgumentNullException("input");
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs
index c02d3280..c1da4ced 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs
@@ -96,9 +96,19 @@ namespace Tnb.WarehouseMgr
List carryCodes = new();
foreach (var os in outStockDList)
{
+ var whereExpr = Expressionable.Create()
+ .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().InnerJoin((a, b) => a.id == b.carry_id).InnerJoin((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()
.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(locIds).ToList();
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs
index e739e14f..cfc398cd 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs
@@ -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.DeepCopy(carryCodesPart[i]);
+ curCarryCode.codeqty = os.pr_qty;
+ curCarryCodes.Add(curCarryCode);
break;
}
}
var partCarryMats = curCarryCodes.Adapt>();
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);
diff --git a/common/Tnb.Common/Utils/ParameterCheckHelper.cs b/common/Tnb.Common/Utils/ParameterCheckHelper.cs
new file mode 100644
index 00000000..2553d6d0
--- /dev/null
+++ b/common/Tnb.Common/Utils/ParameterCheckHelper.cs
@@ -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
+ {
+ private static readonly Dictionary> Cache = new Dictionary>();
+
+ 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();
+
+ //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>(allPropertiesNotNullExpression, objParam);
+
+ //// 编译表达式并执行
+ //var func = lambda.Compile();
+
+ //// 将类型和检查方法添加到缓存中
+ //Cache[type] = func;
+
+ //return func(obj);
+ return false;
+ }
+ }
+
+}