浏览代码

修改SQL

章政 8 年之前
父节点
当前提交
edd5643334

+ 11 - 34
UAS-MES/FunctionCode/Query/Query_OnlineTraceBack.Designer.cs

@@ -34,12 +34,10 @@
             this.SnInf = new UAS_MES.CustomControl.DataGrid_View.DataGridViewWithSerialNum();
             this.SnInf = new UAS_MES.CustomControl.DataGrid_View.DataGridViewWithSerialNum();
             this.ms_sncode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.ms_sncode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.status = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.status = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.ms_linecode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.ms_stepcode1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.ms_stepcode1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.ms_nextstepcode1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.ms_nextstepcode1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.mp_inman = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.ms_makecode = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.ms_makecode = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.ms_status = new UAS_MES.CustomControl.ComBoxWithFocus.ComBoxWithFocus();
             this.ms_status = new UAS_MES.CustomControl.ComBoxWithFocus.ComBoxWithFocus();
             this.Query = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.Query = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
@@ -81,12 +79,10 @@
             this.SnInf.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
             this.SnInf.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
             this.ms_sncode,
             this.ms_sncode,
             this.status,
             this.status,
+            this.ms_linecode,
             this.ms_stepcode1,
             this.ms_stepcode1,
             this.ms_nextstepcode1,
             this.ms_nextstepcode1,
-            this.Column5,
-            this.Column6,
-            this.Column7,
-            this.mp_inman});
+            this.Column5});
             this.SnInf.EnableContentClick = true;
             this.SnInf.EnableContentClick = true;
             this.SnInf.Location = new System.Drawing.Point(0, 70);
             this.SnInf.Location = new System.Drawing.Point(0, 70);
             this.SnInf.Margin = new System.Windows.Forms.Padding(4);
             this.SnInf.Margin = new System.Windows.Forms.Padding(4);
@@ -108,6 +104,12 @@
             this.status.Name = "status";
             this.status.Name = "status";
             this.status.ReadOnly = true;
             this.status.ReadOnly = true;
             // 
             // 
+            // ms_linecode
+            // 
+            this.ms_linecode.DataPropertyName = "ms_linecode";
+            this.ms_linecode.HeaderText = "线别";
+            this.ms_linecode.Name = "ms_linecode";
+            // 
             // ms_stepcode1
             // ms_stepcode1
             // 
             // 
             this.ms_stepcode1.DataPropertyName = "ms_stepcode";
             this.ms_stepcode1.DataPropertyName = "ms_stepcode";
@@ -129,29 +131,6 @@
             this.Column5.Name = "Column5";
             this.Column5.Name = "Column5";
             this.Column5.ReadOnly = true;
             this.Column5.ReadOnly = true;
             // 
             // 
-            // Column6
-            // 
-            this.Column6.DataPropertyName = "mp_indate";
-            this.Column6.HeaderText = "最近采集时间";
-            this.Column6.Name = "Column6";
-            this.Column6.ReadOnly = true;
-            this.Column6.Width = 150;
-            // 
-            // Column7
-            // 
-            this.Column7.DataPropertyName = "mp_sourcecode";
-            this.Column7.HeaderText = "最近采集资源";
-            this.Column7.Name = "Column7";
-            this.Column7.ReadOnly = true;
-            this.Column7.Width = 150;
-            // 
-            // mp_inman
-            // 
-            this.mp_inman.DataPropertyName = "mp_inman";
-            this.mp_inman.HeaderText = "最近采集人员";
-            this.mp_inman.Name = "mp_inman";
-            this.mp_inman.Width = 150;
-            // 
             // ms_makecode
             // ms_makecode
             // 
             // 
             this.ms_makecode.AllPower = null;
             this.ms_makecode.AllPower = null;
@@ -165,7 +144,7 @@
             this.ms_makecode.Str1 = null;
             this.ms_makecode.Str1 = null;
             this.ms_makecode.Str2 = null;
             this.ms_makecode.Str2 = null;
             this.ms_makecode.TabIndex = 204;
             this.ms_makecode.TabIndex = 204;
-            this.ms_makecode.Tag = "ms_makecode";
+            this.ms_makecode.Tag = "makecode";
             this.ms_makecode.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ma_code_KeyDown);
             this.ms_makecode.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ma_code_KeyDown);
             // 
             // 
             // ms_status
             // ms_status
@@ -289,11 +268,9 @@
         private System.Windows.Forms.Label ms_nextstepcode_label;
         private System.Windows.Forms.Label ms_nextstepcode_label;
         private System.Windows.Forms.DataGridViewTextBoxColumn ms_sncode;
         private System.Windows.Forms.DataGridViewTextBoxColumn ms_sncode;
         private System.Windows.Forms.DataGridViewTextBoxColumn status;
         private System.Windows.Forms.DataGridViewTextBoxColumn status;
+        private System.Windows.Forms.DataGridViewTextBoxColumn ms_linecode;
         private System.Windows.Forms.DataGridViewTextBoxColumn ms_stepcode1;
         private System.Windows.Forms.DataGridViewTextBoxColumn ms_stepcode1;
         private System.Windows.Forms.DataGridViewTextBoxColumn ms_nextstepcode1;
         private System.Windows.Forms.DataGridViewTextBoxColumn ms_nextstepcode1;
         private System.Windows.Forms.DataGridViewTextBoxColumn Column5;
         private System.Windows.Forms.DataGridViewTextBoxColumn Column5;
-        private System.Windows.Forms.DataGridViewTextBoxColumn Column6;
-        private System.Windows.Forms.DataGridViewTextBoxColumn Column7;
-        private System.Windows.Forms.DataGridViewTextBoxColumn mp_inman;
     }
     }
 }
 }

+ 20 - 18
UAS-MES/FunctionCode/Query/Query_OnlineTraceBack.cs

@@ -35,7 +35,9 @@ namespace UAS_MES.Query
             ComBoxData.Columns.Add(status);
             ComBoxData.Columns.Add(status);
             ComBoxData.Columns.Add(statuscode);
             ComBoxData.Columns.Add(statuscode);
             DataRow dr = ComBoxData.NewRow();
             DataRow dr = ComBoxData.NewRow();
-            dr[0] = "未上线"; dr[1] = "0"; ComBoxData.Rows.Add(dr);
+            dr[0] = "全部"; dr[1] = "null"; ComBoxData.Rows.Add(dr);
+            dr = ComBoxData.NewRow();
+            dr[0] = "未生产"; dr[1] = "0"; ComBoxData.Rows.Add(dr);
             dr = ComBoxData.NewRow();
             dr = ComBoxData.NewRow();
             dr[0] = "在线"; dr[1] = "1"; ComBoxData.Rows.Add(dr);
             dr[0] = "在线"; dr[1] = "1"; ComBoxData.Rows.Add(dr);
             dr = ComBoxData.NewRow();
             dr = ComBoxData.NewRow();
@@ -63,29 +65,29 @@ namespace UAS_MES.Query
         {
         {
             if (dh.CheckExist("make", "ma_code='" + ms_makecode.Text + "'"))
             if (dh.CheckExist("make", "ma_code='" + ms_makecode.Text + "'"))
             {
             {
+                string condition = BaseUtil.GetScreenSqlCondition(ms_makecode, ms_stepcode, ms_nextstepcode);
                 string statuscode = ms_status.SelectedValue.ToString();
                 string statuscode = ms_status.SelectedValue.ToString();
-                if (statuscode == "1" || statuscode == "2" || statuscode == "3" || statuscode == "4")
+                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("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(condition);
+                if (statuscode == "0")
+                {
+                    sql.Append("and ms_status is null");
+                }
+                else if (statuscode == "null")
                 {
                 {
-                    string condition = BaseUtil.GetScreenSqlCondition(ms_makecode, ms_status, ms_stepcode, ms_nextstepcode);
-                    sql.Clear();
-                    sql.Append("select ms_sncode,ms_stepcode,ms_nextstepcode,case when ms_status=1 then '在线' when ms_status=2 then ");
-                    sql.Append("'已完工' when ms_status=3 then '不良待维修' when ms_status=4 then '已报废' end ms_status,ms_craftcode");
-                    sql.Append(",mp_indate,mp_inman,mp_sourcecode from makeserial left join makeprocess on mp_makecode=ms_makecode ");
-                    sql.Append("and mp_sncode=ms_sncode  and mp_stepcode=ms_stepcode " + condition + " order by ms_id ");
-                    DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-                    BaseUtil.FillDgvWithDataTable(SnInf, dt);
+
                 }
                 }
                 else
                 else
                 {
                 {
-                    sql.Clear();
-                    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);
+                    sql.Append("and ms_status ='" + statuscode + "'");
                 }
                 }
+                DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                BaseUtil.FillDgvWithDataTable(SnInf, dt);
             }
             }
             else
             else
             {
             {

+ 3 - 9
UAS-MES/FunctionCode/Query/Query_OnlineTraceBack.resx

@@ -123,6 +123,9 @@
   <metadata name="status.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   <metadata name="status.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
     <value>True</value>
   </metadata>
   </metadata>
+  <metadata name="ms_linecode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
   <metadata name="ms_stepcode1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   <metadata name="ms_stepcode1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
     <value>True</value>
   </metadata>
   </metadata>
@@ -132,15 +135,6 @@
   <metadata name="Column5.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   <metadata name="Column5.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
     <value>True</value>
   </metadata>
   </metadata>
-  <metadata name="Column6.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="Column7.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="mp_inman.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
   <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
   <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
   <data name="Query.DownImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
   <data name="Query.DownImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
     <value>