Browse Source

修复SQL Max(ReDo)时,由于ReDo字段非整型导致max所得值有误的Bug,导致程序崩溃。

sat23 3 years ago
parent
commit
0eb58f3afc
1 changed files with 2 additions and 2 deletions
  1. 2 2
      BLL/NTFBLL.cs

+ 2 - 2
BLL/NTFBLL.cs

@@ -174,7 +174,7 @@ namespace MOKA_Factory_Tools.BLL
             }
             else
             {// 将原ReDo="0"更新为ReDo=Max(ReDo)+1,并新增ReDo="0"的记录;
-                int maxReDo = dalAMResult.GetMaxID("ReDo", string.Format("Station='{0}' and SN='{1}'", model.Station, model.SN));
+                int maxReDo = dalAMResult.GetMaxID("convert(int,ReDo)", string.Format("Station='{0}' and SN='{1}'", model.Station, model.SN));
                 redo0Model.ReDo = maxReDo.ToString();
                 if (!dalAMResult.Update(redo0Model, string.Format("Station='{0}' and SN='{1}' and ReDo='{2}'", redo0Model.Station, redo0Model.SN, "0")))
                 {
@@ -409,7 +409,7 @@ namespace MOKA_Factory_Tools.BLL
             }
             else
             {// 将原ReDo="0"更新为ReDo=Max(ReDo)+1,并新增ReDo="0"的记录;
-                int maxReDo = dalAMResultTR.GetMaxID("ReDo", string.Format("Station='{0}' and SN='{1}'", model.Station, model.SN));
+                int maxReDo = dalAMResultTR.GetMaxID("convert(int,ReDo)", string.Format("Station='{0}' and SN='{1}'", model.Station, model.SN));
                 redo0Model.ReDo = maxReDo.ToString();
                 if (!dalAMResultTR.Update(redo0Model, string.Format("Station='{0}' and SN='{1}' and ReDo='{2}'", redo0Model.Station, redo0Model.SN, "0")))
                 {