浏览代码

Merge remote-tracking branch 'refs/remotes/origin/master'

shim 8 年之前
父节点
当前提交
99d352b17b

+ 10 - 1
UAS-MES/CustomControl/DataGrid_View/DataGridViewWithCheckBox.Designer.cs

@@ -28,7 +28,16 @@
         /// </summary>
         private void InitializeComponent()
         {
-            components = new System.ComponentModel.Container();
+            ((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
+            this.SuspendLayout();
+            // 
+            // DataGridViewWithCheckBox
+            // 
+            this.RowTemplate.Height = 27;
+            this.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.DataGridViewWithCheckBox_CellContentClick);
+            ((System.ComponentModel.ISupportInitialize)(this)).EndInit();
+            this.ResumeLayout(false);
+
         }
 
         #endregion

+ 8 - 0
UAS-MES/CustomControl/DataGrid_View/DataGridViewWithCheckBox.cs

@@ -15,6 +15,14 @@ namespace UAS_MES.CustomControl.DataGrid_View
         {
             InitializeComponent();
         }
+
+        private void DataGridViewWithCheckBox_CellContentClick(object sender, DataGridViewCellEventArgs e)
+        {
+            if (Columns[0] is DataGridViewCheckBoxColumn && e.ColumnIndex > 0)
+            {
+                Rows[e.RowIndex].Cells[0].Value = true;
+            }
+        }
     }
 
     public class DataGridViewCheckBoxHeaderCell : DataGridViewColumnHeaderCell

+ 10 - 2
UAS-MES/CustomControl/DataGrid_View/DataGridViewWithSerialNum.Designer.cs

@@ -32,8 +32,16 @@ namespace UAS_MES.CustomControl.DataGrid_View
         /// </summary>
         private void InitializeComponent()
         {
-            components = new System.ComponentModel.Container();
-           // this.AutoScaleMode = AutoScaleMode.Font;
+            ((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
+            this.SuspendLayout();
+            // 
+            // DataGridViewWithSerialNum
+            // 
+            this.RowTemplate.Height = 27;
+            this.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.DataGridViewWithSerialNum_CellContentClick);
+            ((System.ComponentModel.ISupportInitialize)(this)).EndInit();
+            this.ResumeLayout(false);
+
         }
 
         #endregion

+ 8 - 0
UAS-MES/CustomControl/DataGrid_View/DataGridViewWithSerialNum.cs

@@ -24,5 +24,13 @@ namespace UAS_MES.CustomControl.DataGrid_View
             e.Graphics.DrawString((e.RowIndex + 1).ToString(), e.InheritedRowStyle.Font, solidBrush, e.RowBounds.Location.X + 15, e.RowBounds.Location.Y + 5);
             base.OnRowPostPaint(e);
         }
+
+        private void DataGridViewWithSerialNum_CellContentClick(object sender, DataGridViewCellEventArgs e)
+        {
+            if (Columns[0] is DataGridViewCheckBoxColumn && e.ColumnIndex > 0)
+            {
+                Rows[e.RowIndex].Cells[0].Value = true;
+            }
+        }
     }
 }

+ 12 - 13
UAS-MES/DataOperate/DataHelper.cs

@@ -57,7 +57,7 @@ namespace UAS_MES.DataOperate
         {
             DataTable dt = new DataTable();
             string sql = "select " + Field + " from " + TableName + " where " + Condition;
-            Console.WriteLine(sql);
+            
             command = new OracleCommand(sql, connection);
             Reconnect(command);
             OracleDataAdapter ad = new OracleDataAdapter();
@@ -119,7 +119,7 @@ namespace UAS_MES.DataOperate
         {
             DataTable dt = new DataTable();
             string sql = "select count(1) from " + TableName + " where " + Condition;
-            Console.WriteLine(sql);
+            
             command = new OracleCommand(sql, connection);
             Reconnect(command);
             OracleDataAdapter ad = new OracleDataAdapter(command);
@@ -141,7 +141,7 @@ namespace UAS_MES.DataOperate
             command = new OracleCommand(sql, connection);
             Reconnect(command);
             OracleDataAdapter ad = new OracleDataAdapter(command);
-            Console.WriteLine(sql);
+            
             ad.Fill(dt);
             ad.Dispose();
             command.Dispose();
@@ -157,7 +157,7 @@ namespace UAS_MES.DataOperate
             string sql = "select ";
             sql += AddField(Fields);
             sql += " from " + TableName + " where " + Condition + " and rownum=1";
-            Console.WriteLine(sql);
+            
             command = new OracleCommand(sql, connection);
             Reconnect(command);
             OracleDataAdapter ad = new OracleDataAdapter(command);
@@ -211,7 +211,6 @@ namespace UAS_MES.DataOperate
                 else
                     sql.Append(" from " + TableName + ") A where ROWNUM <= " + CurrentPage * PageSize + ") where RN> " + (CurrentPage - 1) * PageSize);
             }
-            Console.WriteLine(sql.ToString());
             command = new OracleCommand(sql.ToString(), connection);
             Reconnect(command);
             OracleDataAdapter ad = new OracleDataAdapter(command);
@@ -236,7 +235,7 @@ namespace UAS_MES.DataOperate
             string sql = "select ";
             sql += AddField(Fields);
             sql += " from " + TableName + " where " + Condition;
-            Console.WriteLine(sql);
+            
             command = new OracleCommand(sql, connection);
             Reconnect(command);
             OracleDataAdapter ad = new OracleDataAdapter(command);
@@ -565,7 +564,7 @@ namespace UAS_MES.DataOperate
             Reconnect(command);
             OracleDataAdapter ad = new OracleDataAdapter(command);
             DataTable dt = new DataTable();
-            Console.WriteLine(sql);
+            
             ad.Fill(dt);
             ad.Dispose();
             command.Dispose();
@@ -609,7 +608,7 @@ namespace UAS_MES.DataOperate
                 for (int i = 0; i < addpar.Length; i++)
                     command.Parameters.Add(new OracleParameter(addpar[i].ToString(), OracleDbType.Varchar2, names[i], ParameterDirection.Input));
             }
-            Console.WriteLine(SQL);
+            
             switch (Type.ToUpper())
             {
                 case "SELECT":
@@ -663,7 +662,7 @@ namespace UAS_MES.DataOperate
         {
             DataTable dt = new DataTable();
             string sql = "select distinct count('" + Field + "') from " + TableName;
-            Console.WriteLine(sql);
+            
             command = new OracleCommand(sql, connection);
             Reconnect(command);
             OracleDataAdapter ad = new OracleDataAdapter(command);
@@ -694,7 +693,7 @@ namespace UAS_MES.DataOperate
         public void DeleteDataByID(string TableName, string ID, string[] DeleteID)
         {
             string sql = "delete from " + TableName + " where " + ID + " =:DeleteID";
-            Console.WriteLine(sql);
+            
             command = new OracleCommand(sql, connection);
             Reconnect(command);
             command.ArrayBindCount = DeleteID.Length;
@@ -841,7 +840,7 @@ namespace UAS_MES.DataOperate
             command = new OracleCommand(sql, connection);
             Reconnect(command);
             command.ArrayBindCount = names[1].Length;
-            Console.WriteLine(sql);
+            
             //因为第一个数组保存的是参数的名称,所以循环从1而不是0开始
             //将第一个数组的下标固定为0作为循环添加的参数的名称
             for (int i = 1; i <= names[0].Length; i++)
@@ -952,7 +951,7 @@ namespace UAS_MES.DataOperate
         public string UpdateByCondition(string TableName, string update, string condition)
         {
             string sql = "update " + TableName + " set " + update + " where " + condition;
-            Console.WriteLine(sql);
+            
             command = new OracleCommand(sql, connection);
             Reconnect(command);
             command.ExecuteNonQuery();
@@ -996,7 +995,7 @@ namespace UAS_MES.DataOperate
                 {
                     if (!String.IsNullOrEmpty(sql))
                     {
-                        Console.WriteLine(sql);
+                        
                         command.CommandText = sql;
                         command.ExecuteNonQuery();
                     }

+ 4 - 1
UAS-MES/DbFind.cs

@@ -94,7 +94,9 @@ namespace UAS_MES
                     IsAbleDbFind = true;
                 }
             }
-            catch (Exception) { IsAbleDbFind = false; }
+            catch (Exception) {
+
+                IsAbleDbFind = false; }
         }
 
         protected override void WndProc(ref Message m)
@@ -185,6 +187,7 @@ namespace UAS_MES
             }
             catch (Exception ea)
             {
+                LogManager.DoLog(ea.Message);
                 SuccessReturnData = false;
             }
             Dispose();

+ 5 - 8
UAS-MES/FunctionCode/Make/Make_NewMatainInf.cs

@@ -164,7 +164,6 @@ namespace UAS_MES.Make
             string[] nrg_name = new string[GetListViewCheckCount(nrg_name_lsv)];
             string[] nr_name = new string[GetListViewCheckCount(nr_name_lsv)];
             string[] mbr_dutycode = new string[GetListViewCheckCount(mbr_dutycode_lsv)];
-            string[] mbr_solutioncode = new string[GetListViewCheckCount(mbr_solutioncode_lsv)];
             string ErrorMessage = "";
             if (nrg_name.Length == 0)
                 ErrorMessage += " 不良原因组 ";
@@ -172,8 +171,6 @@ namespace UAS_MES.Make
                 ErrorMessage += " 不良原因 ";
             if (mbr_dutycode.Length == 0)
                 ErrorMessage += " 责任别 ";
-            if (mbr_solutioncode.Length == 0)
-                ErrorMessage += " 解决方案 ";
             if (ErrorMessage == "")
             {
                 for (int i = 0; i < mbc_component_lsv.Items.Count; i++)
@@ -182,7 +179,8 @@ namespace UAS_MES.Make
                     {
                         mbc_component_lsv.Items[i].Selected = true;
                     }
-                    else {
+                    else
+                    {
                         mbc_component_lsv.Items[i].Selected = false;
                     }
                 }
@@ -198,7 +196,7 @@ namespace UAS_MES.Make
                     string macode = dt.Rows[0]["ms_makecode"].ToString();
                     string mbr_id = dh.GetSEQ("makebadreason_seq");
                     //存在不良组件进行提示
-                    if (dh.CheckExist("makebadreason", "mbr_badcode='" + bccode + "' and mbr_sncode='" + sncode + "' and mbr_brcode='" + nrcode + "'"))
+                    if (dh.CheckExist("makebadreason left join makebad on mbr_mbid=mb_id and mbr_sncode=mb_sncode", "mbr_badcode='" + bccode + "' and mbr_sncode='" + sncode + "' and mbr_brcode='" + nrcode + "' and mb_status=0"))
                     {
                         ErrorMessage = "不良代码【" + bc_name.Text + "】已存在不良原因【" + nrname + "】\n";
                     }
@@ -209,7 +207,7 @@ namespace UAS_MES.Make
                     }
                     else
                     {
-                        //保存不良原因
+                        //保存不良组件
                         sql.Clear();
                         sql.Append("insert into makebadrscom (mbc_id,mbc_mbrid,mbc_component,mbc_badcode,");
                         sql.Append("mbc_brcode,mbc_sncode,mbc_makecode,mbc_indate,mbc_inman ) values ");
@@ -220,7 +218,7 @@ namespace UAS_MES.Make
                     }
                     if (mbccomponent != "" || mbccomponent != null)
                     {
-                        //保存不良组件
+                        //保存不良原因
                         sql.Clear();
                         sql.Append("insert into makebadreason (mbr_mbid,mbr_id,mbr_brcode,mbr_solutioncode,");
                         sql.Append("mbr_dutycode,mbr_brgcode,mbr_badcode,mbr_sncode,mbr_makecode,mbr_indate,");
@@ -229,7 +227,6 @@ namespace UAS_MES.Make
                         sql.Append("'" + sncode + "','" + macode + "',sysdate,'" + User.UserCode + "' from dual");
                         dh.ExecuteSql(sql.GetString(), "insert");
                     }
-
                 }
                 else MessageBox.Show("序列号错误,不存在或者不处于维修状态");
             }

+ 62 - 36
UAS-MES/FunctionCode/Make/Make_Repair.Designer.cs

@@ -62,11 +62,7 @@
             this.ms_sncode = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
             this.prodcode = new UAS_MES.CustomControl.TextBoxWithIcon.SearchTextBox();
             this.mbp_partdgv = new UAS_MES.CustomControl.DataGrid_View.DataGridViewWithCheckBox();
-            this.mbp_part1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.mbp_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.mbl_locdgv = new UAS_MES.CustomControl.DataGrid_View.DataGridViewWithCheckBox();
-            this.mbl_loc1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.mbl_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.RefreshTreeView = new UAS_MES.CustomControl.ClickPicBox.ClickPicBox();
             this.GetSNCode = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.NewRepairInf = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
@@ -91,6 +87,12 @@
             this.SaveBadLocation = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.Scrap = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.RepairComplete = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
+            this.mbl_loc1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.DeletePos = new System.Windows.Forms.DataGridViewImageColumn();
+            this.mbl_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.mbp_part1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.DeleteCom = new System.Windows.Forms.DataGridViewImageColumn();
+            this.mbp_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.panel2.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.LocationSource)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.ComponentSource)).BeginInit();
@@ -454,6 +456,7 @@
             this.mbp_partdgv.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
             this.mbp_partdgv.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
             this.mbp_part1,
+            this.DeleteCom,
             this.mbp_id});
             this.mbp_partdgv.Location = new System.Drawing.Point(611, 418);
             this.mbp_partdgv.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
@@ -461,21 +464,7 @@
             this.mbp_partdgv.RowTemplate.Height = 27;
             this.mbp_partdgv.Size = new System.Drawing.Size(349, 190);
             this.mbp_partdgv.TabIndex = 121;
-            // 
-            // mbp_part1
-            // 
-            this.mbp_part1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
-            this.mbp_part1.DataPropertyName = "mbp_part";
-            this.mbp_part1.HeaderText = "已选择不良零件";
-            this.mbp_part1.Name = "mbp_part1";
-            this.mbp_part1.ReadOnly = true;
-            // 
-            // mbp_id
-            // 
-            this.mbp_id.DataPropertyName = "mbp_id";
-            this.mbp_id.HeaderText = "mbp_id";
-            this.mbp_id.Name = "mbp_id";
-            this.mbp_id.Visible = false;
+            this.mbp_partdgv.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.mbp_partdgv_CellContentClick);
             // 
             // mbl_locdgv
             // 
@@ -483,6 +472,7 @@
             this.mbl_locdgv.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
             this.mbl_locdgv.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
             this.mbl_loc1,
+            this.DeletePos,
             this.mbl_id});
             this.mbl_locdgv.Location = new System.Drawing.Point(222, 418);
             this.mbl_locdgv.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
@@ -490,21 +480,7 @@
             this.mbl_locdgv.RowTemplate.Height = 27;
             this.mbl_locdgv.Size = new System.Drawing.Size(349, 190);
             this.mbl_locdgv.TabIndex = 120;
-            // 
-            // mbl_loc1
-            // 
-            this.mbl_loc1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
-            this.mbl_loc1.DataPropertyName = "mbl_loc";
-            this.mbl_loc1.HeaderText = "已选择不良位置";
-            this.mbl_loc1.Name = "mbl_loc1";
-            this.mbl_loc1.ReadOnly = true;
-            // 
-            // mbl_id
-            // 
-            this.mbl_id.DataPropertyName = "mbl_id";
-            this.mbl_id.HeaderText = "mbl_id";
-            this.mbl_id.Name = "mbl_id";
-            this.mbl_id.Visible = false;
+            this.mbl_locdgv.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.mbl_locdgv_CellContentClick);
             // 
             // RefreshTreeView
             // 
@@ -951,6 +927,54 @@
             this.RepairComplete.UseVisualStyleBackColor = true;
             this.RepairComplete.Click += new System.EventHandler(this.RepairComplete_Click);
             // 
+            // mbl_loc1
+            // 
+            this.mbl_loc1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+            this.mbl_loc1.DataPropertyName = "mbl_loc";
+            this.mbl_loc1.HeaderText = "已选择不良位置";
+            this.mbl_loc1.Name = "mbl_loc1";
+            this.mbl_loc1.ReadOnly = true;
+            // 
+            // DeletePos
+            // 
+            this.DeletePos.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+            this.DeletePos.HeaderText = "删除";
+            this.DeletePos.Image = global::UAS_MES.Properties.Resources.bindingNavigatorDeleteItem_Image;
+            this.DeletePos.Name = "DeletePos";
+            this.DeletePos.Width = 80;
+            // 
+            // mbl_id
+            // 
+            this.mbl_id.DataPropertyName = "mbl_id";
+            this.mbl_id.HeaderText = "mbl_id";
+            this.mbl_id.Name = "mbl_id";
+            this.mbl_id.Visible = false;
+            // 
+            // mbp_part1
+            // 
+            this.mbp_part1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+            this.mbp_part1.DataPropertyName = "mbp_part";
+            this.mbp_part1.HeaderText = "已选择不良零件";
+            this.mbp_part1.Name = "mbp_part1";
+            this.mbp_part1.ReadOnly = true;
+            // 
+            // DeleteCom
+            // 
+            this.DeleteCom.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+            this.DeleteCom.HeaderText = "删除";
+            this.DeleteCom.Image = global::UAS_MES.Properties.Resources.bindingNavigatorDeleteItem_Image;
+            this.DeleteCom.Name = "DeleteCom";
+            this.DeleteCom.Resizable = System.Windows.Forms.DataGridViewTriState.True;
+            this.DeleteCom.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
+            this.DeleteCom.Width = 80;
+            // 
+            // mbp_id
+            // 
+            this.mbp_id.DataPropertyName = "mbp_id";
+            this.mbp_id.HeaderText = "mbp_id";
+            this.mbp_id.Name = "mbp_id";
+            this.mbp_id.Visible = false;
+            // 
             // Make_Repair
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
@@ -1017,14 +1041,14 @@
             this.Text = "维修作业";
             this.Load += new System.EventHandler(this.维修作业_Load);
             this.SizeChanged += new System.EventHandler(this.Make_Repair_SizeChanged);
-            this.panel2.ResumeLayout(true);
+            this.panel2.ResumeLayout(false);
             this.panel2.PerformLayout();
             ((System.ComponentModel.ISupportInitialize)(this.LocationSource)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.ComponentSource)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.mbp_partdgv)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.mbl_locdgv)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.RefreshTreeView)).EndInit();
-            this.ResumeLayout(true);
+            this.ResumeLayout(false);
             this.PerformLayout();
 
         }
@@ -1088,8 +1112,10 @@
         private CustomControl.ValueLabel.ValueLabel ms_sncode;
         private CustomControl.TextBoxWithIcon.TextBoxWithTextArea mb_badremark;
         private System.Windows.Forms.DataGridViewTextBoxColumn mbp_part1;
+        private System.Windows.Forms.DataGridViewImageColumn DeleteCom;
         private System.Windows.Forms.DataGridViewTextBoxColumn mbp_id;
         private System.Windows.Forms.DataGridViewTextBoxColumn mbl_loc1;
+        private System.Windows.Forms.DataGridViewImageColumn DeletePos;
         private System.Windows.Forms.DataGridViewTextBoxColumn mbl_id;
     }
 }

+ 21 - 5
UAS-MES/FunctionCode/Make/Make_Repair.cs

@@ -302,7 +302,7 @@ namespace UAS_MES.Make
                     {
                         dh.UpdateByCondition("makeserial", "ms_status=4,ms_nextstepcode='',ms_stepcode='" + User.CurrentStepCode + "'", "ms_sncode='" + ms_sncode.Text + "' and ms_makecode='" + macode + "'");
                         dh.UpdateByCondition("make", "MA_NGMADEQTY=nvl(MA_NGMADEQTY,0)+1", "ma_code='" + macode + "'");
-                        LogicHandler.InsertMakeProcess(ms_sncode.Text,ms_makecode.Text,User.UserSourceCode,"报废","序列号报废",User.UserCode);
+                        LogicHandler.InsertMakeProcess(ms_sncode.Text, ms_makecode.Text, User.UserSourceCode, "报废", "序列号报废", User.UserCode);
                         OperatResult.AppendText(">>报废成功\n", Color.Green);
                         GetSNCode.Clear();
                         BaseUtil.CleanForm(this);
@@ -399,10 +399,10 @@ namespace UAS_MES.Make
             {
                 if (mbr_id != "")
                 {
-                    string delete1 = "delete from makebadrsloc where mbl_mbrid='" + mbr_id+"'";
-                    string delete2 = "delete from makebadrspart where mbp_mbrid='" + mbr_id+"'";
-                    string delete3 = "delete from makebadrscom where mbc_mbrid='" + mbr_id+"'";
-                    string delete4 = "delete from makebadreason where mbr_id='" + mbr_id+"'";
+                    string delete1 = "delete from makebadrsloc where mbl_mbrid='" + mbr_id + "'";
+                    string delete2 = "delete from makebadrspart where mbp_mbrid='" + mbr_id + "'";
+                    string delete3 = "delete from makebadrscom where mbc_mbrid='" + mbr_id + "'";
+                    string delete4 = "delete from makebadreason where mbr_id='" + mbr_id + "'";
                     dh.ExecuteSQLTran(delete1, delete2, delete3, delete4);
                     OperatResult.AppendText(">>删除成功\n", Color.Green);
                     BaseUtil.CleanControlsText(bc_name, bc_code, bg_name, bg_code, mb_badremark, nrg_name, nr_name, nr_code, mbr_solutioncode, mbr_dutycode, mbc_component);
@@ -491,5 +491,21 @@ namespace UAS_MES.Make
         {
             OperatResult.Clear();
         }
+
+        private void mbl_locdgv_CellContentClick(object sender, DataGridViewCellEventArgs e)
+        {
+            if (mbl_locdgv.Columns[e.ColumnIndex].Name == "DeletePos")
+            {
+                mbl_locdgv.Rows.RemoveAt(e.RowIndex);
+            }
+        }
+
+        private void mbp_partdgv_CellContentClick(object sender, DataGridViewCellEventArgs e)
+        {
+            if (mbp_partdgv.Columns[e.ColumnIndex].Name == "DeleteCom")
+            {
+                mbp_partdgv.Rows.RemoveAt(e.RowIndex);
+            }
+        }
     }
 }

+ 6 - 0
UAS-MES/FunctionCode/Make/Make_Repair.resx

@@ -126,9 +126,15 @@
   <metadata name="mbp_part1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <metadata name="DeleteCom.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
   <metadata name="mbl_loc1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <metadata name="DeletePos.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" />
   <data name="NewRepairInf.DownImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>

+ 9 - 4
UAS-MES/FunctionCode/Make/Make_TestCollection.cs

@@ -98,6 +98,11 @@ namespace UAS_MES.Make
         /// <param name="e"></param>
         private void ChooseedReject_Click(object sender, EventArgs e)
         {
+            if (ms_sncode.Text == "")
+            {
+                OperateResult.AppendText(">>序列号不能为空\n", Color.Red);
+                ms_sncode.Focus();
+            }
             int CheckedNum = 0;
             //是否已经添加到不良
             bool AddToReject = false;
@@ -534,6 +539,10 @@ namespace UAS_MES.Make
                 ChooseedReject.Enabled = true;
                 Save.Visible = true;
             }
+            if (ms_sncode.Text == "")
+            {
+                ms_sncode.Focus();
+            }
         }
 
         private void SendCheck_Click(object sender, EventArgs e)
@@ -556,13 +565,9 @@ namespace UAS_MES.Make
             {
                 string Cut = dh.getFieldDataByCondition("product left join oqcbatch on ob_prodcode=pr_code", "pr_ifautocutcheckno", "ob_checkno='" + ob_checkno.Text + "'").ToString();
                 if (Cut == "" || Cut == "0")
-                {
                     AutoCut = false;
-                }
                 else
-                {
                     AutoCut = true;
-                }
                 SendCheck.Enabled = true;
             }
         }

+ 6 - 10
UAS-MES/FunctionCode/OQC/OQC_BatchResultJudge.cs

@@ -130,11 +130,7 @@ namespace UAS_MES.OQC
         {
             if (CheckBefore() && PassCheckStep)
             {
-                sql.Clear();
-                sql.Append("select max(nvl(ad_maxngacceptqty,0)) maxngacceptqty from QUA_Aql,QUA_AqlDetail where al_id=ad_alid ");
-                sql.Append("and al_statuscode='AUDITED'  and al_code ='" + ob_aqlcode.Text + "' and " + (ob_nowcheckqty.Text != "" ? ob_nowcheckqty.Text : "0") + " >= ad_minqty ");
-                sql.Append("and " + (ob_nowcheckqty.Text != "" ? ob_nowcheckqty.Text : "0") + "<=ad_maxqty ");
-                dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                dh.ExecuteSql("update makeserial set ms_status=3 where ms_checkno='" + ob_checkno.Text + "'", "update");
                 dh.ExecuteSql("update OQCBatch set ob_status='NG',ob_result='NG' where ob_checkno='" + ob_checkno.Text + "'", "select");
                 //如果勾选了发起反攻需求则新增记录
                 if (ReworkRequire.Checked)
@@ -153,7 +149,7 @@ namespace UAS_MES.OQC
                     sql.Append("from OQCBatch  left join OQCBatchDetail on obd_obid=ob_id where ob_checkno='" + ob_checkno.Text + "'");
                     dh.ExecuteSql(sql.GetString(), "insert");
                     //将工单信息写回到OQC主表
-                    dh.ExecuteSql("update oqcbatch set ob_rmcode='"+re_code+"' where ob_checkno='"+ob_checkno.Text+"'", "update");
+                    dh.ExecuteSql("update oqcbatch set ob_rmcode='" + re_code + "' where ob_checkno='" + ob_checkno.Text + "'", "update");
                 }
                 DoLog("判退通过", "批次判退成功", "通过");
                 OperateResult.AppendText(">>判退批成功\n", Color.Green);
@@ -176,6 +172,7 @@ namespace UAS_MES.OQC
         {
             if (PassCheckStep)
             {
+                dh.ExecuteSql("update makeserial set ms_status=3 where ms_checkno='" + ob_checkno.Text + "'", "update");
                 dh.ExecuteSql("update OQCBatch set ob_status='NG' ,ob_result='FNG' where ob_checkno='" + ob_checkno.Text + "'", "select");
                 DoLog("强制判退通过", "强制判退通过成功", "判退");
                 GetBatch.PerformClick();
@@ -320,16 +317,16 @@ namespace UAS_MES.OQC
                 {
                     List<string> sql = new List<string>();
                     //该序列号的批次数量
-                    int batchqty = dh.getRowCount("makeserial", "ms_checkno='" + ob_checkno.Text + "'");
+                    string batchqty = dh.getFieldDataByCondition("oqcbatch", "ob_nowcheckqty", "ob_checkno='" + ob_checkno.Text + "'").ToString();
                     //撤销时如果没有下一工序表示工单已经完工了,此时撤销需要将完工数减掉一个批次
                     if (dh.getFieldDataByCondition("makeserial", "ms_nextstepcode", "ms_sncode='" + ms_sncode.Text + "'").ToString() == "")
                     {
                         sql.Add("update make set ma_madeqty=ma_madeqty-" + batchqty + " where ma_code='" + ob_makecode.Text + "'");
                     }
                     //获取上一步执行的工序
-                    string PastCode = dh.getFieldDataByCondition("makeserial", "SUBSTR(ms_paststep,0,INSTR(ms_paststep,',', -1, 1)-1) ms_paststep", "ms_checkno='" + ob_checkno.Text + "'").ToString();
+                    string PastCode = dh.getFieldDataByCondition("makeserial", "SUBSTR(ms_paststep,0,INSTR(ms_paststep,',', -1, 1)-1) ms_paststep", "ms_checkno='" + ob_checkno.Text + "' and ms_status<>3").ToString();
                     string[] LastStepCode = PastCode.Split(',');
-                    sql.Add("update makeserial set ms_paststep=(select distinct SUBSTR(ms_paststep,0,INSTR(ms_paststep,',', -1, 1)-1)  from makeserial where ms_checkno='" + ob_checkno.Text + "') where ms_checkno='" + ob_checkno.Text + "'");
+                    sql.Add("update makeserial set ms_paststep=(select distinct SUBSTR(ms_paststep,0,INSTR(ms_paststep,',', -1, 1)-1)  from makeserial where ms_checkno='" + ob_checkno.Text + "' and ms_status<>3 and rownum=1) where ms_checkno='" + ob_checkno.Text + "' and ms_status<>3 ");
                     sql.Add("update makeserial set ms_stepcode='" + LastStepCode[LastStepCode.Length - 1] + "',ms_nextstepcode='" + User.CurrentStepCode + "',ms_status=1 where ms_checkno='" + ob_checkno.Text + "'");
                     sql.Add("update makecraftdetail set mcd_inqty=mcd_inqty-" + batchqty + ",mcd_outqty = mcd_outqty - " + batchqty + ",mcd_okqty = mcd_okqty -" + batchqty + " where mcd_macode='" + ob_makecode.Text + "' and mcd_stepcode='" + User.CurrentStepCode + "'");
                     dh.ExecuteSQLTran(sql.ToArray());
@@ -337,7 +334,6 @@ namespace UAS_MES.OQC
                 else if (Type == "通过")
                 {
                     //更新下一工序
-
                     LogicHandler.UpdateOQCMessage(ms_sncode.Text, ob_checkno.Text, ob_makecode.Text, Kind, User.UserSourceCode, User.UserName, Result, out ErrorMessage);
                     sql.Clear();
                     sql.Append("insert into MakeProcess(mp_id,mp_makecode,mp_maid, mp_mscode,mp_sncode,mp_stepcode,mp_stepname,");

+ 97 - 74
UAS-MES/FunctionCode/OQC/OQC_SamplingDataCollection.Designer.cs

@@ -55,19 +55,13 @@
             this.ob_prodcode = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.ob_makecode = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.ChoosedDGV = new UAS_MES.CustomControl.DataGrid_View.DataGridViewExpand();
-            this.or_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.bc_code1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.bc_name1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.WaitChooseDGV = new UAS_MES.CustomControl.DataGrid_View.DataGridViewWithCheckBox();
-            this.ChooseAll = new System.Windows.Forms.DataGridViewCheckBoxColumn();
-            this.bc_code = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.bc_name = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.ob_remark = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.sncode = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.CheckTypeDGV = new UAS_MES.CustomControl.DataGrid_View.DataGridViewWithCheckBox();
             this.choose = new System.Windows.Forms.DataGridViewCheckBoxColumn();
             this.oi_itemcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.oi_checkkind = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.ci_name = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.oi_sampleqty = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.oi_checkqty = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.oi_ng = new System.Windows.Forms.DataGridViewCheckBoxColumn();
@@ -93,6 +87,14 @@
             this.ob_makecode_dgv = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.obd_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.BadGroupCode = new UAS_MES.CustomControl.ComBoxWithFocus.ComBoxWithFocus();
+            this.ChooseAll = new System.Windows.Forms.DataGridViewCheckBoxColumn();
+            this.bg_code = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.bc_code = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.bc_name = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.or_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.bg_code1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.bc_code1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.bc_name1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             ((System.ComponentModel.ISupportInitialize)(this.ChoosedDGV)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.WaitChooseDGV)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.CheckTypeDGV)).BeginInit();
@@ -209,9 +211,9 @@
             this.label9.Location = new System.Drawing.Point(621, 218);
             this.label9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label9.Name = "label9";
-            this.label9.Size = new System.Drawing.Size(92, 27);
+            this.label9.Size = new System.Drawing.Size(132, 27);
             this.label9.TabIndex = 192;
-            this.label9.Text = "待选不良";
+            this.label9.Text = "待选不良分组";
             // 
             // sncode_label
             // 
@@ -433,6 +435,7 @@
             this.ChoosedDGV.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
             this.ChoosedDGV.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
             this.or_id,
+            this.bg_code1,
             this.bc_code1,
             this.bc_name1});
             this.ChoosedDGV.Location = new System.Drawing.Point(1080, 255);
@@ -443,35 +446,13 @@
             this.ChoosedDGV.Size = new System.Drawing.Size(325, 321);
             this.ChoosedDGV.TabIndex = 205;
             // 
-            // or_id
-            // 
-            this.or_id.DataPropertyName = "or_id";
-            this.or_id.HeaderText = "or_id";
-            this.or_id.Name = "or_id";
-            this.or_id.Visible = false;
-            // 
-            // bc_code1
-            // 
-            this.bc_code1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
-            this.bc_code1.DataPropertyName = "bc_code";
-            this.bc_code1.HeaderText = "不良代码";
-            this.bc_code1.Name = "bc_code1";
-            this.bc_code1.ReadOnly = true;
-            // 
-            // bc_name1
-            // 
-            this.bc_name1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
-            this.bc_name1.DataPropertyName = "bc_name";
-            this.bc_name1.HeaderText = "不良名称 ";
-            this.bc_name1.Name = "bc_name1";
-            this.bc_name1.ReadOnly = true;
-            // 
             // WaitChooseDGV
             // 
             this.WaitChooseDGV.AllowUserToAddRows = false;
             this.WaitChooseDGV.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
             this.WaitChooseDGV.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
             this.ChooseAll,
+            this.bg_code,
             this.bc_code,
             this.bc_name});
             this.WaitChooseDGV.Location = new System.Drawing.Point(629, 255);
@@ -484,29 +465,6 @@
             this.WaitChooseDGV.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.WaitChooseDGV_CellContentClick);
             this.WaitChooseDGV.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.WaitChooseDGV_DataError);
             // 
-            // ChooseAll
-            // 
-            this.ChooseAll.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
-            this.ChooseAll.DataPropertyName = "ChooseAll";
-            this.ChooseAll.HeaderText = "勾选";
-            this.ChooseAll.Name = "ChooseAll";
-            this.ChooseAll.Resizable = System.Windows.Forms.DataGridViewTriState.False;
-            this.ChooseAll.Width = 60;
-            // 
-            // bc_code
-            // 
-            this.bc_code.DataPropertyName = "bc_code";
-            this.bc_code.HeaderText = "不良分组";
-            this.bc_code.Name = "bc_code";
-            this.bc_code.ReadOnly = true;
-            // 
-            // bc_name
-            // 
-            this.bc_name.DataPropertyName = "bc_name";
-            this.bc_name.HeaderText = "分组名称";
-            this.bc_name.Name = "bc_name";
-            this.bc_name.ReadOnly = true;
-            // 
             // ob_remark
             // 
             this.ob_remark.AllPower = null;
@@ -547,7 +505,7 @@
             this.CheckTypeDGV.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
             this.choose,
             this.oi_itemcode,
-            this.oi_checkkind,
+            this.ci_name,
             this.oi_sampleqty,
             this.oi_checkqty,
             this.oi_ng,
@@ -576,20 +534,19 @@
             // 
             // oi_itemcode
             // 
-            this.oi_itemcode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
             this.oi_itemcode.DataPropertyName = "oi_itemcode";
             this.oi_itemcode.HeaderText = "项目编号";
             this.oi_itemcode.Name = "oi_itemcode";
+            this.oi_itemcode.Visible = false;
             // 
-            // oi_checkkind
+            // ci_name
             // 
-            this.oi_checkkind.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
-            this.oi_checkkind.DataPropertyName = "oi_checkkind";
+            this.ci_name.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+            this.ci_name.DataPropertyName = "ci_name";
             dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
-            this.oi_checkkind.DefaultCellStyle = dataGridViewCellStyle2;
-            this.oi_checkkind.HeaderText = "项目名称";
-            this.oi_checkkind.Name = "oi_checkkind";
-            this.oi_checkkind.Width = 96;
+            this.ci_name.DefaultCellStyle = dataGridViewCellStyle2;
+            this.ci_name.HeaderText = "项目名称";
+            this.ci_name.Name = "ci_name";
             // 
             // oi_sampleqty
             // 
@@ -609,7 +566,7 @@
             // 
             // oi_ng
             // 
-            this.oi_ng.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+            this.oi_ng.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
             this.oi_ng.DataPropertyName = "oi_ng";
             this.oi_ng.HeaderText = "是否通过";
             this.oi_ng.Name = "oi_ng";
@@ -624,19 +581,20 @@
             this.oi_leveldefect.Name = "oi_leveldefect";
             this.oi_leveldefect.Resizable = System.Windows.Forms.DataGridViewTriState.True;
             this.oi_leveldefect.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
-            this.oi_leveldefect.Width = 80;
             // 
             // ois_remark
             // 
             this.ois_remark.DataPropertyName = "ois_remark";
             this.ois_remark.HeaderText = "备注";
             this.ois_remark.Name = "ois_remark";
+            this.ois_remark.Visible = false;
             // 
             // ois_status
             // 
             this.ois_status.DataPropertyName = "ois_status";
             this.ois_status.HeaderText = "是否检验";
             this.ois_status.Name = "ois_status";
+            this.ois_status.Visible = false;
             // 
             // ChooseedReject
             // 
@@ -896,12 +854,75 @@
             // BadGroupCode
             // 
             this.BadGroupCode.FormattingEnabled = true;
-            this.BadGroupCode.Location = new System.Drawing.Point(720, 222);
+            this.BadGroupCode.Location = new System.Drawing.Point(760, 221);
             this.BadGroupCode.Name = "BadGroupCode";
             this.BadGroupCode.Size = new System.Drawing.Size(173, 23);
             this.BadGroupCode.TabIndex = 219;
             this.BadGroupCode.SelectedIndexChanged += new System.EventHandler(this.BadGroupCode_SelectedIndexChanged);
             // 
+            // ChooseAll
+            // 
+            this.ChooseAll.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+            this.ChooseAll.DataPropertyName = "ChooseAll";
+            this.ChooseAll.HeaderText = "勾选";
+            this.ChooseAll.Name = "ChooseAll";
+            this.ChooseAll.Resizable = System.Windows.Forms.DataGridViewTriState.False;
+            this.ChooseAll.Width = 60;
+            // 
+            // bg_code
+            // 
+            this.bg_code.DataPropertyName = "bg_code";
+            this.bg_code.HeaderText = "不良组别编号";
+            this.bg_code.Name = "bg_code";
+            this.bg_code.Visible = false;
+            // 
+            // bc_code
+            // 
+            this.bc_code.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+            this.bc_code.DataPropertyName = "bc_code";
+            this.bc_code.HeaderText = "不良代码";
+            this.bc_code.Name = "bc_code";
+            this.bc_code.ReadOnly = true;
+            this.bc_code.Width = 130;
+            // 
+            // bc_name
+            // 
+            this.bc_name.DataPropertyName = "bc_name";
+            this.bc_name.HeaderText = "不良名称";
+            this.bc_name.Name = "bc_name";
+            this.bc_name.ReadOnly = true;
+            // 
+            // or_id
+            // 
+            this.or_id.DataPropertyName = "or_id";
+            this.or_id.HeaderText = "or_id";
+            this.or_id.Name = "or_id";
+            this.or_id.Visible = false;
+            // 
+            // bg_code1
+            // 
+            this.bg_code1.DataPropertyName = "bg_code";
+            this.bg_code1.HeaderText = "不良组别编号";
+            this.bg_code1.Name = "bg_code1";
+            this.bg_code1.Visible = false;
+            // 
+            // bc_code1
+            // 
+            this.bc_code1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+            this.bc_code1.DataPropertyName = "bc_code";
+            this.bc_code1.HeaderText = "不良代码";
+            this.bc_code1.Name = "bc_code1";
+            this.bc_code1.ReadOnly = true;
+            this.bc_code1.Width = 130;
+            // 
+            // bc_name1
+            // 
+            this.bc_name1.DataPropertyName = "bc_name";
+            this.bc_name1.HeaderText = "不良名称 ";
+            this.bc_name1.Name = "bc_name1";
+            this.bc_name1.ReadOnly = true;
+            this.bc_name1.Width = 151;
+            // 
             // OQC_SamplingDataCollection
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
@@ -1015,20 +1036,22 @@
         private System.Windows.Forms.Label ob_maxngacceptqty_label;
         private System.Windows.Forms.Label ob_projectcode_label;
         private CustomControl.ComBoxWithFocus.ComBoxWithFocus BadGroupCode;
-        private System.Windows.Forms.DataGridViewCheckBoxColumn ChooseAll;
-        private System.Windows.Forms.DataGridViewTextBoxColumn bc_code;
-        private System.Windows.Forms.DataGridViewTextBoxColumn bc_name;
-        private System.Windows.Forms.DataGridViewTextBoxColumn or_id;
-        private System.Windows.Forms.DataGridViewTextBoxColumn bc_code1;
-        private System.Windows.Forms.DataGridViewTextBoxColumn bc_name1;
         private System.Windows.Forms.DataGridViewCheckBoxColumn choose;
         private System.Windows.Forms.DataGridViewTextBoxColumn oi_itemcode;
-        private System.Windows.Forms.DataGridViewTextBoxColumn oi_checkkind;
+        private System.Windows.Forms.DataGridViewTextBoxColumn ci_name;
         private System.Windows.Forms.DataGridViewTextBoxColumn oi_sampleqty;
         private System.Windows.Forms.DataGridViewTextBoxColumn oi_checkqty;
         private System.Windows.Forms.DataGridViewCheckBoxColumn oi_ng;
         private System.Windows.Forms.DataGridViewComboBoxColumn oi_leveldefect;
         private System.Windows.Forms.DataGridViewTextBoxColumn ois_remark;
         private System.Windows.Forms.DataGridViewTextBoxColumn ois_status;
+        private System.Windows.Forms.DataGridViewCheckBoxColumn ChooseAll;
+        private System.Windows.Forms.DataGridViewTextBoxColumn bg_code;
+        private System.Windows.Forms.DataGridViewTextBoxColumn bc_code;
+        private System.Windows.Forms.DataGridViewTextBoxColumn bc_name;
+        private System.Windows.Forms.DataGridViewTextBoxColumn or_id;
+        private System.Windows.Forms.DataGridViewTextBoxColumn bg_code1;
+        private System.Windows.Forms.DataGridViewTextBoxColumn bc_code1;
+        private System.Windows.Forms.DataGridViewTextBoxColumn bc_name1;
     }
 }

+ 20 - 14
UAS-MES/FunctionCode/OQC/OQC_SamplingDataCollection.cs

@@ -83,7 +83,7 @@ namespace UAS_MES.OQC
                 GetBatch.PerformClick();
                 if (CheckSnCode())
                 {
-                    dt = (DataTable)dh.ExecuteSql("select or_id,or_reasoncode bc_code, oi_description bc_name from OQCNGReason where or_checkno='" + ob_checkno.Text + "' and or_sncode='" + sncode.Text + "'", "select");
+                    dt = (DataTable)dh.ExecuteSql("select or_id,or_badcode bc_code, or_description bc_name from OQCNGReason where or_checkno='" + ob_checkno.Text + "' and or_sncode='" + sncode.Text + "'", "select");
                     BaseUtil.FillDgvWithDataTable(ChoosedDGV, dt);
                     GetBatchTypeGridData();
                 }
@@ -154,16 +154,16 @@ namespace UAS_MES.OQC
                 checkkind += ("'" + dt.Rows[i]["oi_checkkind"].ToString() + "',");
             }
             sql.Clear();
-            sql.Append("select 1 choose,oi_itemcode,oi_checkkind,oi_sampleqty,nvl((oi_checkqty),0) oi_checkqty, ");
+            sql.Append("select 1 choose,ci_name,oi_itemcode,oi_checkkind,oi_sampleqty,nvl((oi_checkqty),0) oi_checkqty, ");
             sql.Append("nvl(ois_id,0) ois_id,nvl(ois_ifng,0) oi_ng,nvl(ois_defectlevel,'-1') oi_leveldefect, ");
             sql.Append("ois_remark,case nvl(ois_id,0) when 0 then '未检验' else '已检验' end ois_status ");
-            sql.Append("from OQCItems left join OQCItemSamples on  ois_sncode='" + sncode.Text + "' and ois_checkno=oi_checkno and ");
+            sql.Append("from OQCItems left join  QUA_CHECKITEM on oi_itemcode=ci_code left join OQCItemSamples on  ois_sncode='" + sncode.Text + "' and ois_checkno=oi_checkno and ");
             sql.Append("ois_itemcode=oi_itemcode and ois_projectcode = oi_projectcode where oi_checkno ='" + ob_checkno.Text + "' ");
             sql.Append("and oi_checkkind in (" + checkkind.Substring(0, checkkind.Length - 1) + ")");
             dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
             BaseUtil.FillDgvWithDataTable(CheckTypeDGV, dt);
             sql.Clear();
-            sql.Append("select bg_code,bg_name from PRODUCTBADGROUP left join productkind on ");
+            sql.Append("select bg_code,bg_code||':'||bg_name bg_name from PRODUCTBADGROUP left join productkind on ");
             sql.Append("pk_code= pb_kindcode left join product on pr_kind=pk_name left join ");
             sql.Append("badgroup on  bg_code=pb_badgroup where pr_code='" + ob_prodcode.Text + "'");
             BadCode = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
@@ -234,8 +234,6 @@ namespace UAS_MES.OQC
                                 ois_remark_insert.Add(Savedt.Rows[i]["ois_remark"].ToString());
                             }
                         }
-                        //判断是否含不通过的内容
-
                         //执行批量更新的SQL
                         if (ois_id_update.Count > 0)
                         {
@@ -258,19 +256,21 @@ namespace UAS_MES.OQC
                         //采集不良信息
                         List<string> bc_code = new List<string>();
                         List<string> bc_name = new List<string>();
+                        List<string> bg_code = new List<string>();
                         for (int i = 0; i < ChoosedDGV.RowCount; i++)
                         {
-                            bc_code.Add(ChoosedDGV.Rows[i].Cells[1].Value.ToString());
-                            bc_name.Add(ChoosedDGV.Rows[i].Cells[2].Value.ToString());
+                            bc_code.Add(ChoosedDGV.Rows[i].Cells["bc_code1"].Value.ToString());
+                            bc_name.Add(ChoosedDGV.Rows[i].Cells["bc_name1"].Value.ToString());
+                            bg_code.Add(ChoosedDGV.Rows[i].Cells["bg_code1"].Value.ToString());
                         }
                         if (bc_name.Count > 0)
                         {
-                            dh.UpdateByCondition("makeserial", "ms_badtimes=ms_badtimes+1", "ms_sncode='" + sncode.Text + "'");
+                            //dh.UpdateByCondition("makeserial", "ms_badtimes=ms_badtimes+1", "ms_sncode='" + sncode.Text + "'");
                             dh.ExecuteSql("delete from OQCNGReason where or_sncode='" + sncode.Text + "' and or_checkno='" + ob_checkno.Text + "'", "delete");
                             sql.Clear();
-                            sql.Append("insert into OQCNGReason(or_id, or_checkno, or_makecode, or_sncode, or_reasoncode, oi_description, oi_remark)");
-                            sql.Append("values (OQCNGReason_seq.nextval,'" + ob_checkno.Text + "','" + ob_makecode.Text + "','" + sncode.Text + "',:a,:b,'" + ob_remark.Text + "')");
-                            dh.BatchInsert(sql.GetString(), new string[] { "a", "b" }, bc_code.ToArray(), bc_name.ToArray());
+                            sql.Append("insert into OQCNGReason(or_id, or_checkno, or_makecode, or_sncode, or_badcode, or_description, or_remark,or_bgcode)");
+                            sql.Append("values (OQCNGReason_seq.nextval,'" + ob_checkno.Text + "','" + ob_makecode.Text + "','" + sncode.Text + "',:a,:b,'" + ob_remark.Text + "',:c)");
+                            dh.BatchInsert(sql.GetString(), new string[] { "a", "b","c" }, bc_code.ToArray(), bc_name.ToArray(), bg_code.ToArray());
                         }
                         //更新项目编号中的抽检数、不合格数,根据采样项目记录
                         sql.Clear();
@@ -278,6 +278,11 @@ namespace UAS_MES.OQC
                         sql.Append("nvl(ois_ifng,0)=0 then 0 else 1 end),0) ,count(1) from OQCItemSamples where ois_checkno=oi_checkno ");
                         sql.Append("and ois_itemcode=oi_itemcode)where oi_checkno ='" + ob_checkno.Text + "' and oi_projectcode ='" + ob_projectcode.Text + "'");
                         dh.ExecuteSql(sql.GetString(), "update");
+                        //含有不良的将序列号更新为不良
+                        if (IfContainNG)
+                            dh.ExecuteSql("update makeserial set ms_status=3 where ms_sncode='" + sncode.Text + "'", "update");
+                        else
+                            dh.ExecuteSql("update makeserial set ms_status=1 where ms_sncode='" + sncode.Text + "'", "update");
                         //更新检验状态,如果是待检验的更新为检验中
                         dh.ExecuteSql("update OQCBatch set ob_status='CHECKING' where ob_checkno='" + ob_checkno.Text + "' and ob_status='UNCHECK'", "update");
                         //更新批次中的合格数不合格数:用抽检批检验项目表获取最大的抽检数和不合格数
@@ -377,7 +382,8 @@ namespace UAS_MES.OQC
             dt = BaseUtil.filterDataTable(dt, "ChooseAll<>0");
             if (dt.Rows.Count > 0)
             {
-                BaseUtil.FillDgvWithDataTable(ChoosedDGV, dt);
+                (ChoosedDGV.DataSource as DataTable).Merge(dt);
+                //BaseUtil.FillDgvWithDataTable(ChoosedDGV, dt);
             }
             else OperateResult.AppendText(">>请勾选不良明细\n", Color.Red);
         }
@@ -444,7 +450,7 @@ namespace UAS_MES.OQC
         {
             string bg_code = BadGroupCode.SelectedValue.ToString();
             sql.Clear();
-            sql.Append("select 0 ChooseAll,bc_code,bc_name from badgroupdetail left join badgroup on bgd_bgcode=bg_code ");
+            sql.Append("select 0 ChooseAll,bc_code,bc_name,bg_code from badgroupdetail left join badgroup on bgd_bgcode=bg_code ");
             sql.Append("left join badcode on bgd_badcode=bc_code where bg_code='" + ((bg_code != "" && bg_code != "System.Data.DataRowView") ? bg_code.ToString() : "") + "' and bg_code is not null ");
             sql.Append(" order by bc_code");
             DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");

+ 37 - 10
UAS-MES/FunctionCode/OQC/OQC_SamplingDataCollection.resx

@@ -252,37 +252,52 @@
   <metadata name="or_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <metadata name="bg_code1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
   <metadata name="bc_code1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
   <metadata name="bc_name1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="or_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <metadata name="ChooseAll.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="bc_code1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <metadata name="bg_code.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="bc_name1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <metadata name="bc_code.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="ChooseAll.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <metadata name="bc_name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="bc_code.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <metadata name="choose.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="bc_name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <metadata name="oi_itemcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="ChooseAll.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <metadata name="ci_name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="bc_code.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <metadata name="oi_sampleqty.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="bc_name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <metadata name="oi_checkqty.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="oi_ng.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="oi_leveldefect.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="ois_remark.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="ois_status.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
   <metadata name="choose.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
@@ -291,7 +306,7 @@
   <metadata name="oi_itemcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="oi_checkkind.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <metadata name="ci_name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
   <metadata name="oi_sampleqty.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
@@ -758,4 +773,16 @@
   <metadata name="obd_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <metadata name="ChooseAll.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="bg_code.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="bc_code.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="bc_name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
 </root>

+ 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);

+ 67 - 53
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;
         //屏幕宽度
@@ -52,35 +53,71 @@ namespace UAS_MES.Query
         {
             if (e.KeyCode == Keys.Enter)
             {
-                if (Step != null && Step.Count > 0)
+                dt = (DataTable)dh.ExecuteSql("select ms_status,ms_paststep,ms_stepcode from makeserial where ms_sncode='" + sn_code.Text + "'", "select");
+                if (dt.Rows.Count > 0)
                 {
-                    for (int i = 0; i < Step.Count; i++)
+                    if (Step != null && Step.Count > 0)
                     {
-                        Controls.Remove(Controls[i + Step[i] + "_label"]);
+                        Step.Clear();
+                        SerialPanel.Controls.Clear();
+                        PaintColor.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");
-                dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-                Step = new Dictionary<int, string>();
-                PastStep = dh.getFieldDataByCondition("makeserial", "ms_paststep", "ms_sncode='" + sn_code.Text + "'").ToString();
-                for (int i = 0; i < dt.Rows.Count + 2; i++)
-                {
-                    if (i == 0)
-                        Step.Add(i, "开始");
-                    else if (i == dt.Rows.Count + 1)
-                        Step.Add(i, "结束");
+                    //执行过的步骤
+                    PastStep = dt.Rows[0]["ms_paststep"].ToString();
+                    //如果为不良的时候
+                    string BadStep = "";
+                    if (dt.Rows[0]["ms_status"].ToString() == "3")
+                    {
+                        BadStep = dt.Rows[0]["ms_stepcode"].ToString();
+                    }
+                    //查询执行过的步骤
+                    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");
+                    dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                    Step = new Dictionary<int, string>();
+                    for (int i = 0; i < dt.Rows.Count + 2; i++)
+                    {
+                        if (i == 0)
+                            Step.Add(i, "开始");
+                        else if (i == dt.Rows.Count + 1)
+                            Step.Add(i, "结束");
+                        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()))
+                        {
+                            if (BadStep != dt.Rows[i]["CD_STEPCODE"].ToString())
+                            {
+                                PaintColor.Add(Brushes.Green);
+                            }
+                            else
+                            {
+                                PaintColor.Add(Brushes.Red);
+                            }
+                        }
+                        else
+                            PaintColor.Add(Brushes.White);
+                    }
+                    //完工添加绿色,未完工添加红色
+                    if (dh.CheckExist("Makeserial", "ms_sncode='" + sn_code.Text + "' and ms_status=2"))
+                        PaintColor.Add(Brushes.Green);
                     else
-                        Step.Add(i, dt.Rows[i - 1]["CD_STEPCODE"].ToString());
+                        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");
+                    BaseUtil.FillDgvWithDataTable(CraftInfDgv, dt);
                 }
-                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");
-                BaseUtil.FillDgvWithDataTable(CraftInfDgv, dt);
+                else MessageBox.Show("序列号" + sn_code.Text + "不存在");
             }
         }
 
@@ -105,7 +142,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 +165,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 +189,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);
                             }

+ 1 - 1
UAS-MES/PublicMethod/BaseUtil.cs

@@ -622,7 +622,7 @@ namespace UAS_MES.PublicMethod
         /// <param name="dgv"></param>
         /// <param name="dt"></param>
         /// <param name="CheckBox"></param>
-        public static void FillExpandDgvWithDataTable(DataGridViewExpand dgv, DataTable dt, bool CheckBox,bool CheckBoxTrue)
+        public static void FillExpandDgvWithDataTable(DataGridViewExpand dgv, DataTable dt, bool CheckBox, bool CheckBoxTrue)
         {
             CleanDGVData(dgv);
             if (CheckBox)

+ 11 - 16
UAS-MES/PublicMethod/LogicHandler.cs

@@ -790,11 +790,11 @@ namespace UAS_MES.PublicMethod
                     }
                     break;
                 case "OQCRESULTDETERMINE":
-                    //更新合格数和不合格数
                     sql.Clear();
-                    sql.Append("update OQCBATCH set (ob_ngqty,ob_okqty)=(select nvl(max(oi_ngqty), 0),max(oi_checkqty)-nvl(max(oi_ngqty) ");
-                    sql.Append(",0) from OQCItems where oi_checkno='" + iCheckNo + "') where ob_checkno='" + iCheckNo + "'");
-                    dh.ExecuteSql(sql.ToString(), "update");
+                    sql.Append("select count(1)from (select ois_sncode from OQCITEMSAMPLES where ");
+                    sql.Append("ois_checkno = '" + iCheckNo + "' and ois_ifng = 1 group by ois_sncode)");
+                    string ngqty = (dh.ExecuteSql(sql.ToString(), "select") as DataTable).Rows[0][0].ToString();
+                    dh.ExecuteSql("update OQCBATCH set ob_ngqty='" + ngqty + "',ob_okqty=(select max(oi_checkqty)-'" + ngqty + "' from OQCItems where oi_checkno ='" + iCheckNo + "') where ob_checkno ='" + iCheckNo + "'", "update");
                     //查询Form数据
                     sql.Clear();
                     sql.Append("select ob_id,ob_aqlcode,ob_makecode,ob_status,ob_prodcode,(select max(oi_checkqty)from OQCItems where oi_checkno='" + iCheckNo + "') oi_checkqty,");
@@ -1016,7 +1016,7 @@ namespace UAS_MES.PublicMethod
             //之前保存的不良就不再调用
             if (ms_status != "3")
             {
-                dh.UpdateByCondition("makeserial", "ms_paststep = ms_paststep ||'," + StepCode + "',ms_status=3,ms_badtimes=ms_badtimes+1", "ms_sncode='" + iSnCode + "'");
+                dh.UpdateByCondition("makeserial", "ms_paststep = ms_paststep ||'," + StepCode + "',ms_status=3", "ms_sncode='" + iSnCode + "'");
                 SetStepFinish(iMakeCode, iSourceCode, iSnCode, "不良采集", iResult, iUserCode, out oErrorMessage);
             }
             return true;
@@ -1217,26 +1217,21 @@ namespace UAS_MES.PublicMethod
             }
             GetStepCodeAndNameAndLineBySource(iSourceCode, ref StepCode, ref StepName, ref LineCode);
             //查询批次和批数量
-            int batchqty = 0;
-            DataTable dt = (DataTable)dh.ExecuteSql("select count(ms_checkno) count,ms_checkno from makeserial where ms_checkno='" + iCheckno + "' group by ms_checkno", "select");
-            if (dt.Rows.Count > 0)
-            {
-                batchqty = int.Parse(dt.Rows[0]["count"].ToString());
-            }
+            string batchqty = dh.getFieldDataByCondition("oqcbatch", "ob_nowcheckqty", "ob_checkno='" + iCheckno + "'").ToString();
             string nextstepcode = dh.getFieldDataByCondition("make left join craft on ma_craftcode=cr_code and ma_prodcode=cr_prodcode left join craftdetail on cr_id = cd_crid", "cd_nextstepcode", "ma_code='" + iMakeCode + "' and cd_stepcode='" + StepCode + "'").ToString();
-            if (iResult.Contains("批次通过") && dt.Rows.Count > 0)
+            if (iResult.Contains("批次通过"))
             {
                 //更新执行的数量
                 sqls.Add("update makecraftdetail set mcd_inqty=mcd_inqty+" + batchqty + ",mcd_outqty = mcd_outqty + " + batchqty + ",mcd_okqty = mcd_okqty + " + batchqty + " where mcd_macode='" + iMakeCode + "' and mcd_stepcode='" + StepCode + "' ");
                 //更新makeSerial 的下一工序
-                sqls.Add("update makeserial set ms_paststep = ms_paststep || '," + StepCode + "',ms_stepcode='" + StepCode + "',ms_nextstepcode='" + nextstepcode + "' where ms_checkno='" + iCheckno + "'");
+                sqls.Add("update makeserial set ms_paststep = ms_paststep || '," + StepCode + "',ms_stepcode='" + StepCode + "',ms_nextstepcode='" + nextstepcode + "' where ms_checkno='" + iCheckno + "' and ms_status<>3");
             }
             else
             {
                 //更新执行的数量
                 sqls.Add("update makecraftdetail set mcd_inqty=mcd_inqty+1,mcd_outqty = mcd_outqty + 1,mcd_okqty = mcd_okqty + 1 where mcd_macode='" + iMakeCode + "' and mcd_stepcode='" + StepCode + "' ");
                 //更新makeSerial 的下一工序
-                sqls.Add("update makeserial set ms_paststep = ms_paststep || '," + StepCode + "',ms_stepcode='" + StepCode + "',ms_nextstepcode='" + nextstepcode + "' where ms_checkno='" + iCheckno + "'");
+                sqls.Add("update makeserial set ms_paststep = ms_paststep || '," + StepCode + "',ms_stepcode='" + StepCode + "',ms_nextstepcode='" + nextstepcode + "' where ms_checkno='" + iCheckno + "' and ms_status<>3");
             }
             //更新序列号已经采集的工序 ms_paststep 已采集数据,更新下一工序
             dh.ExecuteSQLTran(sqls.ToArray());
@@ -1247,12 +1242,12 @@ namespace UAS_MES.PublicMethod
                 if (iResult.Contains("批次通过"))
                 {
                     sqls.Add("update make set ma_madeqty=ma_madeqty+" + batchqty + " where ma_code='" + iMakeCode + "'");
-                    sqls.Add("update makeserial set ms_status=2 where ms_checkno='" + iCheckno + "'");
+                    sqls.Add("update makeserial set ms_status=2 where ms_checkno='" + iCheckno + "' and ms_status<>3");
                 }
                 else
                 {
                     sqls.Add("update make set ma_madeqty=ma_madeqty+1  where ma_code='" + iMakeCode + "'");
-                    sqls.Add("update makeserial set ms_status=2 where ms_checkno='" + iCheckno + "'");
+                    sqls.Add("update makeserial set ms_status=2 where ms_checkno='" + iCheckno + "' and ms_status<>3");
                 }
                 dh.ExecuteSQLTran(sqls.ToArray());
                 sqls.Clear();