章政 8 lat temu
rodzic
commit
0092ba437e
1 zmienionych plików z 4 dodań i 4 usunięć
  1. 4 4
      UAS-MES/FunctionCode/Make/Make_Repair.cs

+ 4 - 4
UAS-MES/FunctionCode/Make/Make_Repair.cs

@@ -385,8 +385,8 @@ namespace UAS_MES.Make
             }
             //查询拆解的物料
             sql.Clear();
-            sql.Append("select cm_soncode from craftmaterial where (cm_sncode='" + firstsn + "' or cm_sncode ");
-            sql.Append("in (select sn from makesnrelation where firstsn='" + firstsn + "')) and cm_status=-1");
+            sql.Append("select distinct cm_soncode from craftmaterial where (cm_sncode='" + firstsn + "' or cm_sncode ");
+            sql.Append("in (select sn from makesnrelation where firstsn='" + firstsn + "')) and cm_status=-1 and cm_makecode='"+ms_makecode.Text+"'");
             dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
             //如果含有序列号物料有被拆解过
             if (dt.Rows.Count > 0)
@@ -398,8 +398,8 @@ namespace UAS_MES.Make
                 }
                 //查询对应的上料记录
                 sql.Clear();
-                sql.Append("select cm_soncode from craftmaterial where (cm_sncode='" + firstsn + "' or cm_sncode ");
-                sql.Append("in (select sn from makesnrelation where firstsn='" + firstsn + "')) and cm_status=0 and cm_soncode in (" + soncode.Substring(0, soncode.Length - 1) + ")");
+                sql.Append("select cm_soncode from craftmaterial where (cm_sncode='" + firstsn + "' or cm_sncode in (select sn from ");
+                sql.Append(" makesnrelation where firstsn='" + firstsn + "')) and cm_status=0 and cm_soncode in (" + soncode.Substring(0, soncode.Length - 1) + ") and cm_makecode='"+ms_makecode.Text+"'");
                 DataTable LoadSoncode = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                 //查询的结果不相等表示未完成上料
                 if (dt.Rows.Count != LoadSoncode.Rows.Count)