Browse Source

修改OQC不良添加进MakeBad表

章政 8 years ago
parent
commit
44632691d7

+ 0 - 8
UAS-MES/FunctionCode/Make/Make_Repair.cs

@@ -178,14 +178,6 @@ namespace UAS_MES.Make
             sql.Append("mb_badremark from makebad left join badcode on bc_code=mb_badcode left join badgroup ");
             sql.Append("on bg_code=mb_bgcode where mb_sncode='" + (GetSNCode.Text == "" ? ms_sncode.Text : GetSNCode.Text) + "' and mb_makecode='" + macode + "' and mb_status=0");
             dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-            if (dt.Rows.Count == 0 && ms_checkno.Text != "")
-            {
-                sql.Clear();
-                sql.Append("select mb_id,mb_sncode,mb_badcode,mb_bgcode,nvl(bc_name,mb_badcode) bc_name,nvl(bg_name,mb_bgcode) bg_name,");
-                sql.Append("mb_badremark from oqcngreason left join makebad on mb_badcode=or_badcode and mb_bgcode=or_bgcode left join badcode on bc_code=mb_badcode left join badgroup ");
-                sql.Append("on bg_code=mb_bgcode where or_sncode='" + (GetSNCode.Text == "" ? ms_sncode.Text : GetSNCode.Text) + "' and or_makecode='" + macode + "'");
-                dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-            }
             for (int i = 0; i < dt.Rows.Count; i++)
             {
                 //添加根节点

+ 116 - 113
UAS-MES/FunctionCode/OQC/OQC_SamplingDataCollection.Designer.cs

@@ -55,10 +55,6 @@
             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.bg_code1 = 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.bg_code = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -67,6 +63,15 @@
             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.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();
+            this.oi_leveldefect = new System.Windows.Forms.DataGridViewComboBoxColumn();
+            this.ois_remark = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.ois_status = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.ChooseedReject = new UAS_MES.CustomControl.ButtonUtil.ArrowRightButton();
             this.WaitReject = new UAS_MES.CustomControl.ButtonUtil.ArrowLeftButton();
             this.oi_checkqty1 = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
@@ -86,15 +91,10 @@
             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.choose = new System.Windows.Forms.DataGridViewCheckBoxColumn();
-            this.oi_itemcode = 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();
-            this.oi_leveldefect = new System.Windows.Forms.DataGridViewComboBoxColumn();
-            this.ois_remark = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.ois_status = 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();
@@ -446,37 +446,6 @@
             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;
-            // 
-            // 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;
-            // 
             // WaitChooseDGV
             // 
             this.WaitChooseDGV.AllowUserToAddRows = false;
@@ -586,6 +555,82 @@
             this.CheckTypeDGV.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.CheckTypeDGV_CellValueChanged);
             this.CheckTypeDGV.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.CheckTypeDGV_DataError);
             // 
+            // choose
+            // 
+            this.choose.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+            this.choose.DataPropertyName = "choose";
+            this.choose.HeaderText = "勾选";
+            this.choose.Name = "choose";
+            this.choose.Resizable = System.Windows.Forms.DataGridViewTriState.False;
+            this.choose.Width = 60;
+            // 
+            // oi_itemcode
+            // 
+            this.oi_itemcode.DataPropertyName = "oi_itemcode";
+            this.oi_itemcode.HeaderText = "项目编号";
+            this.oi_itemcode.Name = "oi_itemcode";
+            this.oi_itemcode.Visible = false;
+            // 
+            // ci_name
+            // 
+            this.ci_name.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+            this.ci_name.DataPropertyName = "ci_name";
+            dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+            this.ci_name.DefaultCellStyle = dataGridViewCellStyle1;
+            this.ci_name.HeaderText = "项目名称";
+            this.ci_name.Name = "ci_name";
+            this.ci_name.ReadOnly = true;
+            // 
+            // oi_sampleqty
+            // 
+            this.oi_sampleqty.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+            this.oi_sampleqty.DataPropertyName = "oi_sampleqty";
+            this.oi_sampleqty.HeaderText = "样本数";
+            this.oi_sampleqty.Name = "oi_sampleqty";
+            this.oi_sampleqty.ReadOnly = true;
+            this.oi_sampleqty.Width = 96;
+            // 
+            // oi_checkqty
+            // 
+            this.oi_checkqty.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
+            this.oi_checkqty.DataPropertyName = "oi_checkqty";
+            this.oi_checkqty.HeaderText = "已检数";
+            this.oi_checkqty.Name = "oi_checkqty";
+            this.oi_checkqty.ReadOnly = true;
+            this.oi_checkqty.Width = 81;
+            // 
+            // oi_ng
+            // 
+            this.oi_ng.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+            this.oi_ng.DataPropertyName = "oi_ng";
+            this.oi_ng.HeaderText = "是否NG";
+            this.oi_ng.Name = "oi_ng";
+            this.oi_ng.Resizable = System.Windows.Forms.DataGridViewTriState.True;
+            this.oi_ng.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
+            // 
+            // oi_leveldefect
+            // 
+            this.oi_leveldefect.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+            this.oi_leveldefect.DataPropertyName = "oi_leveldefect";
+            this.oi_leveldefect.HeaderText = "缺陷等级";
+            this.oi_leveldefect.Name = "oi_leveldefect";
+            this.oi_leveldefect.Resizable = System.Windows.Forms.DataGridViewTriState.True;
+            this.oi_leveldefect.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
+            // 
+            // 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
             // 
             this.ChooseedReject.Image = ((System.Drawing.Image)(resources.GetObject("ChooseedReject.Image")));
@@ -850,78 +895,36 @@
             this.BadGroupCode.TabIndex = 219;
             this.BadGroupCode.SelectedIndexChanged += new System.EventHandler(this.BadGroupCode_SelectedIndexChanged);
             // 
-            // choose
-            // 
-            this.choose.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
-            this.choose.DataPropertyName = "choose";
-            this.choose.HeaderText = "勾选";
-            this.choose.Name = "choose";
-            this.choose.Resizable = System.Windows.Forms.DataGridViewTriState.False;
-            this.choose.Width = 60;
-            // 
-            // oi_itemcode
-            // 
-            this.oi_itemcode.DataPropertyName = "oi_itemcode";
-            this.oi_itemcode.HeaderText = "项目编号";
-            this.oi_itemcode.Name = "oi_itemcode";
-            this.oi_itemcode.Visible = false;
-            // 
-            // ci_name
-            // 
-            this.ci_name.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
-            this.ci_name.DataPropertyName = "ci_name";
-            dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
-            this.ci_name.DefaultCellStyle = dataGridViewCellStyle1;
-            this.ci_name.HeaderText = "项目名称";
-            this.ci_name.Name = "ci_name";
-            // 
-            // oi_sampleqty
-            // 
-            this.oi_sampleqty.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
-            this.oi_sampleqty.DataPropertyName = "oi_sampleqty";
-            this.oi_sampleqty.HeaderText = "样本数";
-            this.oi_sampleqty.Name = "oi_sampleqty";
-            this.oi_sampleqty.Width = 96;
-            // 
-            // oi_checkqty
-            // 
-            this.oi_checkqty.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
-            this.oi_checkqty.DataPropertyName = "oi_checkqty";
-            this.oi_checkqty.HeaderText = "已检数";
-            this.oi_checkqty.Name = "oi_checkqty";
-            this.oi_checkqty.Width = 81;
-            // 
-            // oi_ng
+            // or_id
             // 
-            this.oi_ng.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
-            this.oi_ng.DataPropertyName = "oi_ng";
-            this.oi_ng.HeaderText = "是否NG";
-            this.oi_ng.Name = "oi_ng";
-            this.oi_ng.Resizable = System.Windows.Forms.DataGridViewTriState.True;
-            this.oi_ng.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
+            this.or_id.DataPropertyName = "or_id";
+            this.or_id.HeaderText = "or_id";
+            this.or_id.Name = "or_id";
+            this.or_id.Visible = false;
             // 
-            // oi_leveldefect
+            // bg_code1
             // 
-            this.oi_leveldefect.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
-            this.oi_leveldefect.DataPropertyName = "oi_leveldefect";
-            this.oi_leveldefect.HeaderText = "缺陷等级";
-            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.bg_code1.DataPropertyName = "bg_code";
+            this.bg_code1.HeaderText = "不良组别编号";
+            this.bg_code1.Name = "bg_code1";
+            this.bg_code1.Visible = false;
             // 
-            // ois_remark
+            // bc_code1
             // 
-            this.ois_remark.DataPropertyName = "ois_remark";
-            this.ois_remark.HeaderText = "备注";
-            this.ois_remark.Name = "ois_remark";
-            this.ois_remark.Visible = false;
+            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 = 140;
             // 
-            // ois_status
+            // bc_name1
             // 
-            this.ois_status.DataPropertyName = "ois_status";
-            this.ois_status.HeaderText = "是否检验";
-            this.ois_status.Name = "ois_status";
-            this.ois_status.Visible = false;
+            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;
             // 
             // OQC_SamplingDataCollection
             // 
@@ -1040,10 +1043,6 @@
         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;
         private System.Windows.Forms.DataGridViewCheckBoxColumn choose;
         private System.Windows.Forms.DataGridViewTextBoxColumn oi_itemcode;
         private System.Windows.Forms.DataGridViewTextBoxColumn ci_name;
@@ -1053,5 +1052,9 @@
         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.DataGridViewTextBoxColumn or_id;
+        private System.Windows.Forms.DataGridViewTextBoxColumn bg_code1;
+        private System.Windows.Forms.DataGridViewTextBoxColumn bc_code1;
+        private System.Windows.Forms.DataGridViewTextBoxColumn bc_name1;
     }
 }

+ 8 - 0
UAS-MES/FunctionCode/OQC/OQC_SamplingDataCollection.cs

@@ -276,6 +276,14 @@ namespace UAS_MES.OQC
                             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());
+                            //插入MakeBad表
+                            sql.Clear();
+                            sql.Append("insert into makebad(mb_id,mb_makecode,mb_mscode,mb_sncode,mb_inman,mb_indate,mb_stepcode");
+                            sql.Append(",mb_sourcecode,mb_badcode,mb_bgcode,mb_badtable,mb_soncode,mb_status)");
+                            sql.Append("select makebad_seq.nextval,ma_code,ms_code,ms_sncode,'" + User.UserCode + "',sysdate,'" + User.CurrentStepCode + "',ms_sourcecode,:bc_code,:bg_code,'',");
+                            sql.Append("sp_soncode,'0' from make left join makeSerial on ms_makecode=ma_code left join stepProduct on ");
+                            sql.Append("sp_mothercode=ma_prodcode and sp_stepcode=ms_nextstepcode where ms_sncode='" + sncode.Text + "'");
+                            dh.BatchInsert(sql.GetString(), new string[] { "bc_code", "bg_code" }, bc_code.ToArray(), bg_code.ToArray());
                         }
                         //更新项目编号中的抽检数、不合格数,根据采样项目记录
                         sql.Clear();