From 9ccc6f16980e55dc0b1a1af740e1e1bcb8fc97b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8C=83?= <15095123350@163.com> Date: Tue, 15 Oct 2024 10:04:57 +0800 Subject: [PATCH] =?UTF-8?q?CTU=E5=87=BA=E5=BA=93=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Khd.Core.Wcs/Wcs/CreateTaskByRecord.cs | 49 ++++++++++++++++++++-- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/src/Khd.Core.Wcs/Wcs/CreateTaskByRecord.cs b/src/Khd.Core.Wcs/Wcs/CreateTaskByRecord.cs index ca798e3..0ff3491 100644 --- a/src/Khd.Core.Wcs/Wcs/CreateTaskByRecord.cs +++ b/src/Khd.Core.Wcs/Wcs/CreateTaskByRecord.cs @@ -2186,12 +2186,32 @@ namespace Khd.Core.Wcs.Wcs { if (index == 1) { - bill = bill.OrderBy(t => t.a.locRow).ThenBy(t => t.a.locColumn).ToList(); + if (bill.Where(t => t.b.totalAmount - t.b.frozenAmount > needNumber).Any()) + { + bill = bill.OrderBy(t => t.a.locRow).ThenBy(t => t.a.locColumn) + .OrderBy(t => t.b.totalAmount - t.b.frozenAmount) + .ToList(); + } + else + { + bill = bill.OrderBy(t => t.a.locRow).ThenBy(t => t.a.locColumn) + .OrderByDescending(t => t.b.totalAmount - t.b.frozenAmount); + } index = 2; } else { - bill = bill.OrderByDescending(t => t.a.locRow).ThenBy(t => t.a.locColumn).ToList(); + if (bill.Where(t => t.b.totalAmount - t.b.frozenAmount > needNumber).Any()) + { + bill = bill.OrderByDescending(t => t.a.locRow).ThenBy(t => t.a.locColumn) + .OrderBy(t => t.b.totalAmount - t.b.frozenAmount) + .ToList(); + } + else + { + bill = bill.OrderByDescending(t => t.a.locRow).ThenBy(t => t.a.locColumn) + .OrderByDescending(t => t.b.totalAmount - t.b.frozenAmount); + } index = 1; } } @@ -2200,15 +2220,36 @@ namespace Khd.Core.Wcs.Wcs bill = bill.OrderByDescending(t => t.a.locRow).ThenBy(t => t.a.locColumn).ToList(); if (index == 1) { - bill = bill.OrderByDescending(t => t.a.locRow).ThenBy(t => t.a.locColumn).ToList(); + if (bill.Where(t => t.b.totalAmount - t.b.frozenAmount > needNumber).Any()) + { + bill = bill.OrderByDescending(t => t.a.locRow).ThenBy(t => t.a.locColumn) + .OrderBy(t => t.b.totalAmount - t.b.frozenAmount) + .ToList(); + } + else + { + bill = bill.OrderByDescending(t => t.a.locRow).ThenBy(t => t.a.locColumn) + .OrderByDescending(t => t.b.totalAmount - t.b.frozenAmount); + } index = 2; } else { - bill = bill.OrderBy(t => t.a.locRow).ThenBy(t => t.a.locColumn).ToList(); + if (bill.Where(t => t.b.totalAmount - t.b.frozenAmount > needNumber).Any()) + { + bill = bill.OrderBy(t => t.a.locRow).ThenBy(t => t.a.locColumn) + .OrderBy(t => t.b.totalAmount - t.b.frozenAmount) + .ToList(); + } + else + { + bill = bill.OrderBy(t => t.a.locRow).ThenBy(t => t.a.locColumn) + .OrderByDescending(t => t.b.totalAmount - t.b.frozenAmount); + } index = 1; } } + BaseEquip ctuEquip = StaticData.BaseEquip.First(t => t.objid == 11); BaseEquip lineEquip = StaticData.BaseEquip.First(t => t.objid == 20); foreach (var b in bill)