Эх сурвалжийг харах

未在线和在线区别查询

章政 8 жил өмнө
parent
commit
219e59a1a3

+ 5 - 3
UAS-MES/FunctionCode/Query/Query_OnlineTraceBack.cs

@@ -78,9 +78,11 @@ namespace UAS_MES.Query
                 else
                 {
                     sql.Clear();
-                    sql.Append("select DISTINCT msd_sncode ms_sncode ,msd_makecode ms_makecode,'未上线' ms_status from makesnruledetail ");
-                    sql.Append("left join makeserial on ms_makecode='" + ms_makecode.Text + "' and  msd_sncode not in (select ms_sncode from  ");
-                    sql.Append("makeserial where ms_makecode='" + ms_makecode.Text + "') where msd_type='before' and msd_makecode='" + ms_makecode.Text + "' and ms_sncode is not null");
+                    sql.Append("select DISTINCT nvl(msl_sncode,msd_sncode)ms_sncode,nvl(msl_makecode,msd_makecode) ms_makecode,'未上线' ms_status from ");
+                    sql.Append("makesnruledetail left join makesnlist on msl_makecode = msd_makecode and msl_sncode = msd_sncode left join makeserial on  ");
+                    sql.Append("(ms_makecode='" + ms_makecode.Text + "' or msd_makecode='" + ms_makecode.Text + "' or msl_makecode='" + ms_makecode.Text + "')");
+                    sql.Append("and  msd_sncode not in (select ms_sncode from makeserial where ms_makecode ='" + ms_makecode.Text + "')");
+                    sql.Append(" where msd_type='before' and msd_makecode='" + ms_makecode.Text + "' and ms_sncode is not null order by ms_sncode");
                     DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                     BaseUtil.FillDgvWithDataTable(SnInf, dt);
                 }