callm 4 дней назад
Родитель
Сommit
b4e44d63ed
1 измененных файлов с 5 добавлено и 5 удалено
  1. 5 5
      UAS_MES_YDCY/FunctionCode/Query/Query_SN.cs

+ 5 - 5
UAS_MES_YDCY/FunctionCode/Query/Query_SN.cs

@@ -208,7 +208,7 @@ namespace UAS_MES_NEW.Query
 
         private void SystemSetting_PrinterTest_Load(object sender, EventArgs e)
         {
-            engine.Start();
+            //engine.Start();
 
 
             ma_code.TableName = " make left join product on ma_prodcode=pr_code";
@@ -355,8 +355,8 @@ namespace UAS_MES_NEW.Query
                         custbarcode.Add(data);
                 }
                 string sql = "insert into makesnlist(MSL_ID, MSL_INDATE, MSL_MAKECODE, MSL_SNCODE, MSL_TYPE,msl_status)" +
-              "select makesnlist_seq.nextval,sysdate,'" + ma_code.Text + "',:custbarcode,'before',0 from dual where :custbarcode not in " +
-              "(select msl_sncode from makesnlist)";
+              "select makesnlist_seq.nextval,sysdate,'" + ma_code.Text + "',:custbarcode,'before',0 from dual where not EXISTS " +
+              "(select 1 from makesnlist where msl_sncode=:custbarcode)";
                 dh.BatchInsert(sql, new string[] { "custbarcode", "custbarcode" }, custbarcode.ToArray(), custbarcode.ToArray());
                 //更新最大流水号
                 dh.UpdateByCondition("RuleMaxNum", "rmn_maxnumber='" + custserialnum + "'", "rmn_nrcode='" + pr_exbarcode + "' and rmn_prefix='" + Prefix + "'");
@@ -440,8 +440,8 @@ namespace UAS_MES_NEW.Query
                         custbarcode.Add(data);
                 }
                 string sql = "insert into makesnlist(MSL_ID, MSL_INDATE, MSL_MAKECODE, MSL_SNCODE, MSL_TYPE,msl_status)" +
-              "select makesnlist_seq.nextval,sysdate,'" + ma_code.Text + "',:custbarcode,'before',0 from dual where :custbarcode not in " +
-              "(select msl_sncode from makesnlist)";
+              "select makesnlist_seq.nextval,sysdate,'" + ma_code.Text + "',:custbarcode,'before',0 from dual where not EXISTS " +
+              "(select 1 from makesnlist where msl_sncode=:custbarcode)";
                 dh.BatchInsert(sql, new string[] { "custbarcode", "custbarcode" }, custbarcode.ToArray(), custbarcode.ToArray());
                 //更新最大流水号
                 dh.UpdateByCondition("RuleMaxNum", "rmn_maxnumber='" + custserialnum + "'", "rmn_nrcode='" + pr_exbarcode + "'");