章政 8 anni fa
parent
commit
edb4496a53
1 ha cambiato i file con 7 aggiunte e 3 eliminazioni
  1. 7 3
      UAS-MES/FunctionCode/Query/Query_OnlineTraceBack.cs

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

@@ -68,11 +68,14 @@ namespace UAS_MES.Query
                 string condition = BaseUtil.GetScreenSqlCondition(ms_makecode, ms_stepcode, ms_nextstepcode);
                 string statuscode = ms_status.SelectedValue.ToString();
                 sql.Clear();
-                sql.Append("select sncode ms_sncode,ms_linecode,ms_stepcode,ms_nextstepcode,ms_craftcode,makecode ms_makecode,case when ms_status is null then '未生产'  when ms_status=1 then '在线' ");
-                sql.Append("when ms_status=2 then '已完工' when ms_status=3 then '不良待维修' when ms_status=4 then '已报废' ");
+                sql.Append("select sncode ms_sncode,ms_linecode,ms_stepcode,ms_nextstepcode,ms_craftcode,makecode ms_makecode, ");
+                sql.Append("case when ms_status is null then '未生产'  when ms_status=1 then '在线' when ms_status=2 ");
+                sql.Append(" then '已完工' when ms_status=3 then '不良待维修' when ms_status=4 then '已报废' ");
                 sql.Append("else 'null' end ms_status  from((select msd_sncode sncode,msd_makecode makecode,msd_type type ");
                 sql.Append("from makesnruledetail where msd_makecode='" + ms_makecode.Text + "') union (select msl_sncode sncode,msl_makecode ");
-                sql.Append("makecode,msl_type type from makesnlist where msl_makecode='" + ms_makecode.Text + "'))A left join makeserial on ms_code=sncode");
+                sql.Append("makecode,msl_type type from makesnlist where msl_makecode='" + ms_makecode.Text + "') union (");
+                sql.Append("select ms_sncode,ms_makecode,'' type from  makeserial where ms_makecode='" + ms_makecode.Text + "'))");
+                sql.Append("A left join makeserial on ms_code=sncode");
                 sql.Append(condition);
                 if (statuscode == "0")
                 {
@@ -86,6 +89,7 @@ namespace UAS_MES.Query
                 {
                     sql.Append("and ms_status ='" + statuscode + "'");
                 }
+                sql.Append(" order by ms_sncode ");
                 DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                 BaseUtil.FillDgvWithDataTable(SnInf, dt);
             }