瀏覽代碼

抽样计划维护调整

章政 8 年之前
父節點
當前提交
3c490f7a55

+ 23 - 14
UAS-MES/FunctionCode/OQC/OQC_PlanMaintain.cs

@@ -59,6 +59,8 @@ namespace UAS_MES.OQC
                 {
                     BaseUtil.SetFormValue(Controls, dt[0]);
                     BaseUtil.FillDgvWithDataTable(CheckTypeDGV, dt[1]);
+                    ob_aqlcode.Text = "";
+                    ob_aqlcode.Text = dt[0].Rows[0]["ob_aqlcode"].ToString();
                 }
                 else
                 {
@@ -93,7 +95,6 @@ namespace UAS_MES.OQC
                         if (!(int.Parse(CheckTypeDGV.Rows[i].Cells["oi_sampleqty"].Value.ToString()) > int.Parse(ob_batchqty.Text == "" ? "0" : ob_batchqty.Text)))
                         {
                             //ID不为0的时候进行更新操作,ID为0的时候进行插入操作
-                            Console.WriteLine(CheckTypeDGV.Rows[i].Cells["oi_id"].Value.ToString());
                             if (CheckTypeDGV.Rows[i].Cells["oi_id"].Value.ToString() != "0")
                             {
                                 ci_kind_update.Add(CheckTypeDGV.Rows[i].Cells["ci_kind"].Value.ToString());
@@ -153,21 +154,24 @@ namespace UAS_MES.OQC
         {
             if (ob_aqlcode.Text != "" || ob_maxngacceptqty.Text != "")
             {
-                SaveConfiguration_Click(sender, e);
-                Checkob_maxngacceptqty();
-                GetBatch.PerformClick();
+                if (Checkob_maxngacceptqty())
+                {
+                    SaveConfiguration_Click(sender, e);
+                    GetBatch.PerformClick();
+                }
             }
             else
                 OperateResult.AppendText(">>AQL和最大不合格允许通过数至少填写一个\n", Color.Red);
         }
 
         //对于最大不合格允通过数的校验
-        private void Checkob_maxngacceptqty()
+        private bool Checkob_maxngacceptqty()
         {
             if (ob_maxngacceptqty.Text == "0" || ob_maxngacceptqty.Text == "" || int.Parse(ob_maxngacceptqty.Text) < 0)
             {
                 OperateResult.AppendText(">>最大不合格允通过数必须大于0\n", Color.Red);
                 ob_maxngacceptqty.Text = null;
+                return false;
             }
             else
             {
@@ -175,10 +179,12 @@ namespace UAS_MES.OQC
                 if (result > 0)
                 {
                     OperateResult.AppendText(">>保存成功\n", Color.Green);
+                    return true;
                 }
                 else
                 {
                     OperateResult.AppendText(">>保存失败\n", Color.Red);
+                    return false;
                 }
             }
         }
@@ -208,18 +214,21 @@ namespace UAS_MES.OQC
 
         private void ob_aqlcode_UserControlTextChanged(object sender, EventArgs e)
         {
-            dt = (DataTable)dh.ExecuteSql("select nvl(ad_minqty,0)ad_minqty,nvl(ad_maxqty,0)ad_maxqty,nvl(ad_maxngacceptqty,0)ad_maxngacceptqty,ad_qty from QUA_Aql left join qua_aqldetail on ad_alid=al_id where al_code='" + ob_aqlcode.Text + "'", "select");
-            if (dt.Rows.Count > 0)
+            if (ob_aqlcode.Text != "")
             {
-                for (int i = 0; i < dt.Rows.Count; i++)
+                dt = (DataTable)dh.ExecuteSql("select nvl(ad_minqty,0)ad_minqty,nvl(ad_maxqty,0)ad_maxqty,nvl(ad_maxngacceptqty,0)ad_maxngacceptqty,ad_qty from QUA_Aql left join qua_aqldetail on ad_alid=al_id where al_code='" + ob_aqlcode.Text + "'", "select");
+                if (dt.Rows.Count > 0)
                 {
-                    int batchqty = int.Parse(ob_batchqty.Text == "" ? "0" : ob_batchqty.Text);
-                    int minqty = int.Parse(dt.Rows[i]["ad_minqty"].ToString());
-                    int maxqty = int.Parse(dt.Rows[i]["ad_maxqty"].ToString());
-                    if (batchqty > minqty && batchqty <= maxqty)
+                    for (int i = 0; i < dt.Rows.Count; i++)
                     {
-                        ob_maxngacceptqty.Text = dt.Rows[i]["ad_maxngacceptqty"].ToString();
-                        ad_qty.Text = dt.Rows[i]["ad_qty"].ToString();
+                        int batchqty = int.Parse(ob_batchqty.Text == "" ? "0" : ob_batchqty.Text);
+                        int minqty = int.Parse(dt.Rows[i]["ad_minqty"].ToString());
+                        int maxqty = int.Parse(dt.Rows[i]["ad_maxqty"].ToString());
+                        if (batchqty > minqty && batchqty <= maxqty)
+                        {
+                            ob_maxngacceptqty.Text = dt.Rows[i]["ad_maxngacceptqty"].ToString();
+                            ad_qty.Text = dt.Rows[i]["ad_qty"].ToString();
+                        }
                     }
                 }
             }

+ 56 - 56
UAS-MES/FunctionCode/OQC/OQC_PlanMaintain.designer.cs

@@ -57,16 +57,16 @@
             this.RefreshConfiguration = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.Save = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.CheckTypeDGV = new UAS_MES.CustomControl.DataGrid_View.DataGridViewWithSerialNum();
-            this.Choose = new System.Windows.Forms.DataGridViewCheckBoxColumn();
-            this.oi_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.ci_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.ci_kind = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.oi_sampleqty = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.ob_prodcode = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.ob_batchqty = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.obd_outboxcode = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.ob_checkno = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.ms_sncode = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
+            this.Choose = new System.Windows.Forms.DataGridViewCheckBoxColumn();
+            this.oi_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.ci_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.ci_kind = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.oi_sampleqty = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.panel2.SuspendLayout();
             this.panel1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.CheckTypeDGV)).BeginInit();
@@ -478,49 +478,6 @@
             this.CheckTypeDGV.Size = new System.Drawing.Size(993, 398);
             this.CheckTypeDGV.TabIndex = 167;
             // 
-            // 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_id
-            // 
-            this.oi_id.DataPropertyName = "oi_id";
-            this.oi_id.HeaderText = "oi_id";
-            this.oi_id.Name = "oi_id";
-            this.oi_id.Visible = false;
-            // 
-            // ci_id
-            // 
-            this.ci_id.DataPropertyName = "ci_id";
-            this.ci_id.HeaderText = "ci_id";
-            this.ci_id.Name = "ci_id";
-            this.ci_id.ReadOnly = true;
-            this.ci_id.Visible = false;
-            // 
-            // ci_kind
-            // 
-            this.ci_kind.DataPropertyName = "ci_kind";
-            this.ci_kind.HeaderText = "检验类型";
-            this.ci_kind.Name = "ci_kind";
-            this.ci_kind.ReadOnly = true;
-            this.ci_kind.Resizable = System.Windows.Forms.DataGridViewTriState.True;
-            this.ci_kind.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
-            this.ci_kind.Width = 150;
-            // 
-            // oi_sampleqty
-            // 
-            this.oi_sampleqty.DataPropertyName = "oi_sampleqty";
-            this.oi_sampleqty.HeaderText = "样本数量";
-            this.oi_sampleqty.Name = "oi_sampleqty";
-            this.oi_sampleqty.Resizable = System.Windows.Forms.DataGridViewTriState.True;
-            this.oi_sampleqty.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
-            this.oi_sampleqty.Width = 150;
-            // 
             // ob_prodcode
             // 
             this.ob_prodcode.AllPower = null;
@@ -607,6 +564,49 @@
             this.ms_sncode.Tag = "NoAuto";
             this.ms_sncode.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ms_sncode_KeyDown);
             // 
+            // 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_id
+            // 
+            this.oi_id.DataPropertyName = "oi_id";
+            this.oi_id.HeaderText = "oi_id";
+            this.oi_id.Name = "oi_id";
+            this.oi_id.Visible = false;
+            // 
+            // ci_id
+            // 
+            this.ci_id.DataPropertyName = "ci_id";
+            this.ci_id.HeaderText = "ci_id";
+            this.ci_id.Name = "ci_id";
+            this.ci_id.ReadOnly = true;
+            this.ci_id.Visible = false;
+            // 
+            // ci_kind
+            // 
+            this.ci_kind.DataPropertyName = "ci_kind";
+            this.ci_kind.HeaderText = "检验类型";
+            this.ci_kind.Name = "ci_kind";
+            this.ci_kind.ReadOnly = true;
+            this.ci_kind.Resizable = System.Windows.Forms.DataGridViewTriState.True;
+            this.ci_kind.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
+            this.ci_kind.Width = 150;
+            // 
+            // oi_sampleqty
+            // 
+            this.oi_sampleqty.DataPropertyName = "oi_sampleqty";
+            this.oi_sampleqty.HeaderText = "样本数量";
+            this.oi_sampleqty.Name = "oi_sampleqty";
+            this.oi_sampleqty.Resizable = System.Windows.Forms.DataGridViewTriState.True;
+            this.oi_sampleqty.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
+            this.oi_sampleqty.Width = 150;
+            // 
             // OQC_PlanMaintain
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
@@ -643,12 +643,12 @@
             this.Text = "抽样计划维护";
             this.Load += new System.EventHandler(this.抽样计划维护_Load);
             this.SizeChanged += new System.EventHandler(this.抽样计划维护_SizeChanged);
-            this.panel2.ResumeLayout(false);
+            this.panel2.ResumeLayout(true);
             this.panel2.PerformLayout();
-            this.panel1.ResumeLayout(false);
+            this.panel1.ResumeLayout(true);
             this.panel1.PerformLayout();
             ((System.ComponentModel.ISupportInitialize)(this.CheckTypeDGV)).EndInit();
-            this.ResumeLayout(false);
+            this.ResumeLayout(true);
             this.PerformLayout();
 
         }
@@ -683,15 +683,15 @@
         private System.Windows.Forms.Label pr_detail_label;
         private CustomControl.TextBoxWithIcon.EnterTextBox pr_detail;
         private CustomControl.TextBoxWithIcon.SearchTextBox ob_aqlcode;
-        private System.Windows.Forms.DataGridViewCheckBoxColumn Choose;
-        private System.Windows.Forms.DataGridViewTextBoxColumn oi_id;
-        private System.Windows.Forms.DataGridViewTextBoxColumn ci_id;
-        private System.Windows.Forms.DataGridViewTextBoxColumn ci_kind;
-        private System.Windows.Forms.DataGridViewTextBoxColumn oi_sampleqty;
         private CustomControl.TextBoxWithIcon.TextBoxNumOnly ob_maxngacceptqty;
         private CustomControl.TextBoxWithIcon.EnterTextBox ob_status;
         private System.Windows.Forms.Panel panel1;
         private System.Windows.Forms.Label ad_qty_label;
         private CustomControl.TextBoxWithIcon.TextBoxNumOnly ad_qty;
+        private System.Windows.Forms.DataGridViewCheckBoxColumn Choose;
+        private System.Windows.Forms.DataGridViewTextBoxColumn oi_id;
+        private System.Windows.Forms.DataGridViewTextBoxColumn ci_id;
+        private System.Windows.Forms.DataGridViewTextBoxColumn ci_kind;
+        private System.Windows.Forms.DataGridViewTextBoxColumn oi_sampleqty;
     }
 }

+ 0 - 15
UAS-MES/FunctionCode/OQC/OQC_PlanMaintain.resx

@@ -788,19 +788,4 @@
   <metadata name="oi_sampleqty.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">
-    <value>True</value>
-  </metadata>
-  <metadata name="oi_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="ci_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="ci_kind.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">
-    <value>True</value>
-  </metadata>
 </root>

+ 1 - 1
UAS-MES/FunctionCode/OQC/OQC_SamplingDataCollection.Designer.cs

@@ -978,7 +978,7 @@
             ((System.ComponentModel.ISupportInitialize)(this.ChoosedDGV)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.WaitChooseDGV)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.CheckTypeDGV)).EndInit();
-            this.ResumeLayout(false);
+            this.ResumeLayout(true);
             this.PerformLayout();
 
         }

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

@@ -863,7 +863,7 @@ namespace UAS_MES.PublicMethod
                             Form.Rows[0]["ob_projectcode"] = qualmethod;
                             pr_id = dh.getFieldDataByCondition("QUA_Project", "pr_id", "pr_code = '" + qualmethod + "'").ToString();
                             sql.Clear();
-                            sql.Append("select nvl(max(oi_id),0)oi_id,ci_kind,nvl(max(oi_sampleqty),0) oi_sampleqty from ");
+                            sql.Append("select nvl(max(oi_id),0) Choose,nvl(max(oi_id),0)oi_id,ci_kind,nvl(max(oi_sampleqty),0) oi_sampleqty from ");
                             sql.Append("QUA_PROJECT left join QUA_ProjectDetail on pd_prid=pr_id left join QUA_CheckItem ");
                             sql.Append("on pd_ciid=ci_id left join OQCITEMS on oi_checkno='" + iCheckNo + "' and ");
                             sql.Append("oi_projectcode='" + qualmethod + "'and oi_projectcode = pr_code and oi_checkkind = ci_kind ");