电梯优化

This commit is contained in:
2024-08-22 14:53:21 +08:00
parent 4ce0a58715
commit 20043b879d
10 changed files with 264 additions and 130 deletions

View File

@@ -40,12 +40,14 @@ namespace Tnb.WarehouseMgr
var code_batch = "";
var material_specification = "";
var container_no = "";
var material_code = "";
if (!input.queryJson.IsNullOrWhiteSpace())
{
supplier_code = JObject.Parse(input.queryJson).Value<string>("supplier_code");
code_batch = JObject.Parse(input.queryJson).Value<string>(nameof(WmsCarryCode.code_batch));
material_specification = JObject.Parse(input.queryJson).Value<string>(nameof(WmsCarryCode.material_specification));
container_no = JObject.Parse(input.queryJson).Value<string>(nameof(WmsCarryCode.container_no));
material_code = JObject.Parse(input.queryJson).Value<string>(nameof(WmsCarryCode.material_code));
}
List<WmsStockReportH?> result = new List<WmsStockReportH?>();
@@ -53,13 +55,14 @@ namespace Tnb.WarehouseMgr
{
List<WmsStockReportH> items = await _db.Queryable<WmsCarryCode>().InnerJoin<WmsCarryH>((a, b) => a.carry_id == b.id)
.InnerJoin<BasLocation>((a, b, c) => b.location_id == c.id).InnerJoin<BasWarehouse>((a, b, c, d) => c.wh_id == d.id)
.InnerJoin<WmsTempCode>((a, b, c, d, e) => e.barcode == a.barcode)
.InnerJoin<BasMaterial>((a, b, c, d, e, f) => f.id == e.material_id)
.LeftJoin<WmsTempCode>((a, b, c, d, e) => e.barcode == a.barcode)
.InnerJoin<BasMaterial>((a, b, c, d, e, f) => f.id == a.material_id)
.LeftJoin<WmsPurchaseD>((a, b, c, d, e, f, g) => e.require_id == g.id)
.LeftJoin<WmsPurchaseH>((a, b, c, d, e, f, g, h) => h.id == g.bill_id)
.WhereIF(!string.IsNullOrEmpty(material_specification), (a, b, c, d, e, f) => f.material_specification.Contains(material_specification))
.WhereIF(!string.IsNullOrEmpty(code_batch), (a, b, c, d, e, f) => a.code_batch.Contains(code_batch))
.WhereIF(!string.IsNullOrEmpty(container_no), (a, b, c, d, e, f) => f.container_no.Contains(container_no))
.WhereIF(!string.IsNullOrEmpty(material_code), (a, b, c, d, e, f) => f.code.Contains(material_code))
.Select((a, b, c, d, e, f, g, h) => new WmsStockReportH
{
org_id = e.org_id,
@@ -76,6 +79,18 @@ namespace Tnb.WarehouseMgr
supplier_name = "",
}, true).ToListAsync();
string ssssss = _db.Queryable<WmsCarryCode>().InnerJoin<WmsCarryH>((a, b) => a.carry_id == b.id)
.InnerJoin<BasLocation>((a, b, c) => b.location_id == c.id).InnerJoin<BasWarehouse>((a, b, c, d) => c.wh_id == d.id)
.LeftJoin<WmsTempCode>((a, b, c, d, e) => e.barcode == a.barcode)
.InnerJoin<BasMaterial>((a, b, c, d, e, f) => f.id == a.material_id)
.LeftJoin<WmsPurchaseD>((a, b, c, d, e, f, g) => e.require_id == g.id)
.LeftJoin<WmsPurchaseH>((a, b, c, d, e, f, g, h) => h.id == g.bill_id)
.WhereIF(!string.IsNullOrEmpty(material_specification), (a, b, c, d, e, f) => f.material_specification.Contains(material_specification))
.WhereIF(!string.IsNullOrEmpty(code_batch), (a, b, c, d, e, f) => a.code_batch.Contains(code_batch))
.WhereIF(!string.IsNullOrEmpty(container_no), (a, b, c, d, e, f) => f.container_no.Contains(container_no))
.WhereIF(!string.IsNullOrEmpty(material_code), (a, b, c, d, e, f) => f.code.Contains(material_code)).ToSqlString();
List<WmsCarryCode> carryCodes = await _db.Queryable<WmsCarryCode>().ToListAsync();
var storeMap = items.DistinctBy(x => new { x.warehouse_id, x.material_id, x.code_batch }).ToDictionary(x => new { x.warehouse_id, x.material_id, x.code_batch }, x => x);
@@ -115,14 +130,15 @@ namespace Tnb.WarehouseMgr
{
List<WmsStockReportH> items = await _db.Queryable<WmsCarryCode>().InnerJoin<WmsCarryH>((a, b) => a.carry_id == b.id)
.InnerJoin<BasLocation>((a, b, c) => b.location_id == c.id).InnerJoin<BasWarehouse>((a, b, c, d) => c.wh_id == d.id)
.InnerJoin<WmsTempCode>((a, b, c, d, e) => e.barcode == a.barcode)
.InnerJoin<BasMaterial>((a, b, c, d, e, f) => f.id == e.material_id)
.LeftJoin<WmsTempCode>((a, b, c, d, e) => e.barcode == a.barcode)
.InnerJoin<BasMaterial>((a, b, c, d, e, f) => f.id == a.material_id)
.LeftJoin<WmsPurchaseD>((a, b, c, d, e, f, g) => e.require_id == g.id)
.LeftJoin<WmsPurchaseH>((a, b, c, d, e, f, g, h) => h.id == g.bill_id)
.WhereIF(!string.IsNullOrEmpty(material_specification), (a, b, c, d, e, f) => f.material_specification.Contains(material_specification))
.WhereIF(!string.IsNullOrEmpty(code_batch), (a, b, c, d, e, f) => a.code_batch.Contains(code_batch))
.WhereIF(!string.IsNullOrEmpty(supplier_code), (a, b, c, d, e, f, g, h) => h.supplier_code.Contains(supplier_code))
.WhereIF(!string.IsNullOrEmpty(container_no), (a, b, c, d, e, f, g, h) => f.container_no.Contains(container_no))
.WhereIF(!string.IsNullOrEmpty(material_code), (a, b, c, d, e, f) => f.code.Contains(material_code))
.Select((a, b, c, d, e, f, g, h) => new WmsStockReportH
{
org_id = e.org_id,