Browse Source

修改工单进度查询

章政 8 years ago
parent
commit
10e30121e6

+ 59 - 59
UAS-MES/FunctionCode/Query/Query_ExeProgress.Designer.cs

@@ -31,6 +31,13 @@
             this.sn_code_label = new System.Windows.Forms.Label();
             this.SerialPanel = new System.Windows.Forms.Panel();
             this.CraftInfDgv = new UAS_MES.CustomControl.DataGrid_View.DataGridViewWithSerialNum();
+            this.mp_sncode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.mp_makecode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.ma_prodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.mp_sourcecode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.mp_indate = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.ma_craftcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.ma_linecode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.groupBoxWithBorder1 = new UAS_MES.CustomControl.GroupBoxWithBorder.GroupBoxWithBorder();
             this.pictureBox2 = new System.Windows.Forms.PictureBox();
             this.label4 = new System.Windows.Forms.Label();
@@ -39,13 +46,6 @@
             this.label2 = new System.Windows.Forms.Label();
             this.label3 = new System.Windows.Forms.Label();
             this.sn_code = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
-            this.mp_sncode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.mp_makecode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.ma_prodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.mp_sourcecode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.mp_indate = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.ma_craftcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.ma_linecode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             ((System.ComponentModel.ISupportInitialize)(this.CraftInfDgv)).BeginInit();
             this.groupBoxWithBorder1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
@@ -96,6 +96,55 @@
             this.CraftInfDgv.Size = new System.Drawing.Size(1300, 238);
             this.CraftInfDgv.TabIndex = 193;
             // 
+            // mp_sncode
+            // 
+            this.mp_sncode.DataPropertyName = "mp_sncode";
+            this.mp_sncode.HeaderText = "序列号";
+            this.mp_sncode.Name = "mp_sncode";
+            this.mp_sncode.Width = 120;
+            // 
+            // mp_makecode
+            // 
+            this.mp_makecode.DataPropertyName = "mp_makecode";
+            this.mp_makecode.HeaderText = "工单代码";
+            this.mp_makecode.Name = "mp_makecode";
+            this.mp_makecode.Width = 120;
+            // 
+            // ma_prodcode
+            // 
+            this.ma_prodcode.DataPropertyName = "ma_prodcode";
+            this.ma_prodcode.HeaderText = "产品代码";
+            this.ma_prodcode.Name = "ma_prodcode";
+            this.ma_prodcode.Width = 120;
+            // 
+            // mp_sourcecode
+            // 
+            this.mp_sourcecode.DataPropertyName = "mp_sourcecode";
+            this.mp_sourcecode.HeaderText = "资源编号";
+            this.mp_sourcecode.Name = "mp_sourcecode";
+            this.mp_sourcecode.Width = 120;
+            // 
+            // mp_indate
+            // 
+            this.mp_indate.DataPropertyName = "mp_indate";
+            this.mp_indate.HeaderText = "过站时间";
+            this.mp_indate.Name = "mp_indate";
+            this.mp_indate.Width = 120;
+            // 
+            // ma_craftcode
+            // 
+            this.ma_craftcode.DataPropertyName = "ma_craftcode";
+            this.ma_craftcode.HeaderText = "途程代码";
+            this.ma_craftcode.Name = "ma_craftcode";
+            this.ma_craftcode.Width = 120;
+            // 
+            // ma_linecode
+            // 
+            this.ma_linecode.DataPropertyName = "ma_linecode";
+            this.ma_linecode.HeaderText = "产线";
+            this.ma_linecode.Name = "ma_linecode";
+            this.ma_linecode.Width = 120;
+            // 
             // groupBoxWithBorder1
             // 
             this.groupBoxWithBorder1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
@@ -132,7 +181,7 @@
             // 
             this.label4.AutoSize = true;
             this.label4.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label4.Location = new System.Drawing.Point(864, 12);
+            this.label4.Location = new System.Drawing.Point(867, 15);
             this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label4.Name = "label4";
             this.label4.Size = new System.Drawing.Size(92, 27);
@@ -163,7 +212,7 @@
             // 
             this.label2.AutoSize = true;
             this.label2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label2.Location = new System.Drawing.Point(221, 12);
+            this.label2.Location = new System.Drawing.Point(224, 15);
             this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label2.Name = "label2";
             this.label2.Size = new System.Drawing.Size(152, 27);
@@ -174,7 +223,7 @@
             // 
             this.label3.AutoSize = true;
             this.label3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label3.Location = new System.Drawing.Point(540, 12);
+            this.label3.Location = new System.Drawing.Point(543, 15);
             this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label3.Name = "label3";
             this.label3.Size = new System.Drawing.Size(172, 27);
@@ -198,55 +247,6 @@
             this.sn_code.Tag = "NoAuto";
             this.sn_code.KeyDown += new System.Windows.Forms.KeyEventHandler(this.sn_code_KeyDown);
             // 
-            // mp_sncode
-            // 
-            this.mp_sncode.DataPropertyName = "mp_sncode";
-            this.mp_sncode.HeaderText = "序列号";
-            this.mp_sncode.Name = "mp_sncode";
-            this.mp_sncode.Width = 120;
-            // 
-            // mp_makecode
-            // 
-            this.mp_makecode.DataPropertyName = "mp_makecode";
-            this.mp_makecode.HeaderText = "工单代码";
-            this.mp_makecode.Name = "mp_makecode";
-            this.mp_makecode.Width = 120;
-            // 
-            // ma_prodcode
-            // 
-            this.ma_prodcode.DataPropertyName = "ma_prodcode";
-            this.ma_prodcode.HeaderText = "产品代码";
-            this.ma_prodcode.Name = "ma_prodcode";
-            this.ma_prodcode.Width = 120;
-            // 
-            // mp_sourcecode
-            // 
-            this.mp_sourcecode.DataPropertyName = "mp_sourcecode";
-            this.mp_sourcecode.HeaderText = "资源编号";
-            this.mp_sourcecode.Name = "mp_sourcecode";
-            this.mp_sourcecode.Width = 120;
-            // 
-            // mp_indate
-            // 
-            this.mp_indate.DataPropertyName = "mp_indate";
-            this.mp_indate.HeaderText = "过站时间";
-            this.mp_indate.Name = "mp_indate";
-            this.mp_indate.Width = 120;
-            // 
-            // ma_craftcode
-            // 
-            this.ma_craftcode.DataPropertyName = "ma_craftcode";
-            this.ma_craftcode.HeaderText = "途程代码";
-            this.ma_craftcode.Name = "ma_craftcode";
-            this.ma_craftcode.Width = 120;
-            // 
-            // ma_linecode
-            // 
-            this.ma_linecode.DataPropertyName = "ma_linecode";
-            this.ma_linecode.HeaderText = "产线";
-            this.ma_linecode.Name = "ma_linecode";
-            this.ma_linecode.Width = 120;
-            // 
             // Query_ExeProgress
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);

+ 28 - 36
UAS-MES/FunctionCode/Query/Query_ExeProgress.cs

@@ -21,6 +21,7 @@ namespace UAS_MES.Query
         string PastStep = "";
         //拆分后的经过的步骤
         Dictionary<int, string> Step;
+        List<Brush> PaintColor = new List<Brush>();
         //屏幕高度
         int ScreenWidth;
         //屏幕宽度
@@ -54,15 +55,13 @@ namespace UAS_MES.Query
             {
                 if (Step != null && Step.Count > 0)
                 {
-                    for (int i = 0; i < Step.Count; i++)
-                    {
-                        Controls.Remove(Controls[i + Step[i] + "_label"]);
-                    }
+                    Step.Clear();
+                    SerialPanel.Controls.Clear();
                 }
                 //查询执行过的步骤
                 sql.Clear();
                 sql.Append("select CD_DETNO,CD_STEPCODE from craft left join craftdetail on cd_crid = cr_id  left join makeserial ");
-                sql.Append("on ms_craftcode=cr_code and ms_prodcode=cr_prodcode where ms_sncode='"+sn_code.Text+"' order by cd_detno");
+                sql.Append("on ms_craftcode=cr_code and ms_prodcode=cr_prodcode where ms_sncode='" + sn_code.Text + "' order by cd_detno");
                 dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                 Step = new Dictionary<int, string>();
                 PastStep = dh.getFieldDataByCondition("makeserial", "ms_paststep", "ms_sncode='" + sn_code.Text + "'").ToString();
@@ -75,11 +74,27 @@ namespace UAS_MES.Query
                     else
                         Step.Add(i, dt.Rows[i - 1]["CD_STEPCODE"].ToString());
                 }
+                //添加开始节点绿色
+                PaintColor.Add(Brushes.Green);
+                //添加中间节点
+                for (int i = 0; i < dt.Rows.Count; i++)
+                {
+                    if (PastStep.Contains(dt.Rows[i]["CD_STEPCODE"].ToString()))
+                        PaintColor.Add(Brushes.Green);
+                    else
+                        PaintColor.Add(Brushes.White);
+                }
+                //完工添加绿色,未完工添加红色
+                if (dh.CheckExist("Makeserial", "ms_sncode='" + sn_code.Text + "' and ms_status=2"))
+                    PaintColor.Add(Brushes.Green);
+                else
+                    PaintColor.Add(Brushes.White);
                 Refresh();
+                SerialPanel.Refresh();
                 sql.Clear();
                 sql.Append("select mp_makecode,ma_prodcode,ma_linecode,ma_craftcode,mp_sourcecode,mp_sncode,mp_indate ");
-                sql.Append("from makeprocess left join make on mp_makecode=ma_code where mp_sncode='"+sn_code.Text+"'");
-                dt = (DataTable)dh.ExecuteSql(sql.GetString(),"select");
+                sql.Append("from makeprocess left join make on mp_makecode=ma_code where mp_sncode='" + sn_code.Text + "'");
+                dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                 BaseUtil.FillDgvWithDataTable(CraftInfDgv, dt);
             }
         }
@@ -105,7 +120,9 @@ namespace UAS_MES.Query
                         //途程节点的矩形 
                         Rectangle r;
                         if (Step[j].Contains("开始") || Step[j].Contains("结束"))
+                        {
                             r = new Rectangle(0, 0, 40, 40);
+                        }
                         else
                             r = new Rectangle();
                         r.Width = SerialPanel.Width / 10;
@@ -126,19 +143,9 @@ namespace UAS_MES.Query
                         if (i % 2 != 0)
                         {
                             r.Location = new Point(x, y);
-                            if (PastStep.Contains(Step[j]))
-                            {
-                                g.FillRectangle(Brushes.Green, r);
-                            }
-                            else
-                            {
-                                if (Step[j].Contains("开始"))
-                                    g.FillEllipse(Brushes.Green, r);
-                                else
-                                    g.FillRectangle(Brushes.White, r);
-                            }
+                            g.FillRectangle(PaintColor[j], r);
                             //填充方块内的信息
-                            if (Controls[Param.Name] == null)
+                            if (SerialPanel.Controls[Param.Name] == null)
                                 SerialPanel.Controls.Add(Param);
                             if (j + 1 == Step.Count)
                                 break;
@@ -160,26 +167,11 @@ namespace UAS_MES.Query
                         //如果在偶数行
                         else
                         {
-
                             r.Location = new Point(x, y);
-                            if (PastStep.Contains(Step[j]))
-                            {
-                                g.FillRectangle(Brushes.Green, r);
-                            }
-                            else
-                            {
-                                if (Step[j].Contains("开始"))
-                                {
-                                    g.FillEllipse(Brushes.Green, r);
-                                }
-                                else
-                                {
-                                    g.FillRectangle(Brushes.White, r);
-                                }
-                            }
+                            g.FillRectangle(PaintColor[j], r);
                             //填充文字信息
                             //存在这个名称的则不进行添加
-                            if (Controls[Param.Name] == null)
+                            if (SerialPanel.Controls[Param.Name] == null)
                             {
                                 SerialPanel.Controls.Add(Param);
                             }