From b204caf20259f308a043fc15d4a94c38193dcf82 Mon Sep 17 00:00:00 2001 From: lilili Date: Tue, 11 Jul 2023 16:22:08 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=9D=A1=E7=A0=81=E7=94=9F?= =?UTF-8?q?=E6=88=90=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WMS-BS/NFine.Application/WMS/DeciliterApp.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/WMS-BS/NFine.Application/WMS/DeciliterApp.cs b/WMS-BS/NFine.Application/WMS/DeciliterApp.cs index 8762e77..d9a2162 100644 --- a/WMS-BS/NFine.Application/WMS/DeciliterApp.cs +++ b/WMS-BS/NFine.Application/WMS/DeciliterApp.cs @@ -31,8 +31,10 @@ namespace NFine.Application.WMS DataTable dt = new DataTable(); List parameter = new List(); - string sql = @"select max(LotNo) as NewLotNo from ICSInventoryLot where EATTRIBUTE1='{0}' "; - sql = string.Format(sql, LotNO); + //string sql = @"select max(LotNo) as NewLotNo from ICSInventoryLot where EATTRIBUTE1='{0}' "; + string sql = $@"SELECT TOP 1 + LotNO as NewLotNo FROM ICSInventoryLot WHERE EATTRIBUTE1='{LotNO}' + ORDER BY CAST(SUBSTRING(LotNO, (LEN(LotNO)-CHARINDEX('-',REVERSE(LotNO))+1)+1,CHARINDEX('-',REVERSE(LotNO))-1) AS INT) DESC"; dt= Repository().FindTableBySql(sql.ToString()); if (dt==null||dt.Rows.Count==0|| dt.Rows[0]["NewLotNo"].ToString()=="") {