ソースを参照

Merge branch 'master' of ssh://10.10.101.21/source/mes-client

Hcsy 8 年 前
コミット
2ca4d20457

+ 2 - 1
UAS-MES/CustomControl/TextBoxWithIcon/SNCodeEnterTextBox.cs

@@ -98,7 +98,8 @@ namespace UAS_MES.CustomControl.TextBoxWithIcon
             { 
                 if (CapsLockStatus)
                 {
-                    BaseUtil.ShowError("请关闭大写后进行采集");
+                    Text = "";
+                    BaseUtil.ShowError("请关闭大写锁定键[Caps Lock]");
                 }
             }
         }

+ 5 - 9
UAS-MES/DataOperate/DataHelper.cs

@@ -75,6 +75,7 @@ namespace UAS_MES.DataOperate
             }
         }
 
+
         /// <summary>
         /// 执行打印的SQL
         /// </summary>
@@ -95,10 +96,12 @@ namespace UAS_MES.DataOperate
                     sb.Append(Param[i] + ":Param" + i);
                 }
                 command = new OracleCommand(sb.ToString(), connection);
+
                 for (int i = 0; i < ParamNum; i++)
                 {
                     command.Parameters.Add("Param" + i, OracleDbType.Varchar2, Parameters[i], ParameterDirection.Input);
                 }
+
                 OracleDataAdapter ad = new OracleDataAdapter(command);
                 DataTable dt = new DataTable();
                 ad.Fill(dt);
@@ -109,16 +112,8 @@ namespace UAS_MES.DataOperate
             return "参数错误,请检查SQL语句";
         }
 
-        public void GetSerialNumByCaller(string iCaller, out string SerialNum)
-        {
-            SerialNum = "";
-            string[] param = new string[] { iCaller, "2", SerialNum };
-            CallProcedure("SP_GETMAXNUMBER", ref param);
-            SerialNum = param[2];
-        }
-
         /// <summary>
-        /// 获取指定表的记录的条数,带条件
+        /// 获取指定表的记录的条数 ,带条件
         /// </summary>
         /// <returns></returns>
         public int getRowCount(string TableName, string Condition)
@@ -614,6 +609,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));
             }
+            
             switch (Type.ToUpper())
             {
                 case "SELECT":

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

@@ -39,6 +39,10 @@ namespace UAS_MES.Make
 
         string msid = "";
 
+        string ifrework = "";
+
+        string reworkstatus = "";
+
         string dbtable1 = "(select distinct nvl(dsl_prodcode,msl_prodcode)prodcode from ReduceStepRecord left join devsmtlocation on dsl_linecode=rsd_linecode and dsl_makecode=rsd_macode left join makesmtlocation on msl_linecode=rsd_linecode and msl_makecode=rsd_macode where rsd_macode=':macode'  and rsd_sncode=':sncode') left join product on pr_code=prodcode";
 
         string dbtable2 = "(select distinct nvl(dsl_prodcode,msl_prodcode)prodcode from ReduceStepRecord left join devsmtlocation on dsl_linecode=rsd_linecode and dsl_makecode=rsd_macode left join makesmtlocation on msl_linecode=rsd_linecode and msl_makecode=rsd_macode where rsd_macode=':macode'  and rsd_sncode=':sncode' and ((dsl_location=':msl_location' and dsl_validtime<sysdate and sysdate<dsl_invalidtime) ) or (msl_location=':msl_location' and msl_validtime<sysdate and sysdate<msl_invalidtime)) left join product on pr_code=prodcode";
@@ -89,8 +93,8 @@ namespace UAS_MES.Make
                 if (dt.Rows.Count > 0)
                 {
                     string ms_status = dt.Rows[0]["ms_status"].ToString();
-                    string ifrework = dt.Rows[0]["ms_ifrework"].ToString();
-                    string reworkstatus = dt.Rows[0]["ms_reworkstatus"].ToString();
+                    ifrework = dt.Rows[0]["ms_ifrework"].ToString();
+                    reworkstatus = dt.Rows[0]["ms_reworkstatus"].ToString();
                     //如果不是返修序列号执行原来的步骤
                     if (ifrework == "0")
                     {
@@ -118,7 +122,7 @@ namespace UAS_MES.Make
                             BadCodeTree.Nodes.Clear();
                             return;
                         }
-                        if (reworkstatus != "3")
+                        if (reworkstatus != "0"&& reworkstatus != "3")
                         {
                             OperatResult.AppendText(">>序列号:" + GetSNCode.Text + "不处于维修状态\n", Color.Red);
                             BaseUtil.CleanForm(this);
@@ -288,8 +292,16 @@ namespace UAS_MES.Make
                 OperatResult.AppendText(">>序列号不允许为空\n", Color.Red);
                 return;
             }
+            if (ifrework != "0" && reworkstatus == "0")
+            {
+                if (dh.getRowCount("Makebad", "mb_sncode='"+ms_sncode.Text+"' and mb_status=0") == 0)
+                {
+                    OperatResult.AppendText(">>维修必须维护不良代码\n", Color.Red);
+                    return;
+                }
+            }
             //判断是否所有的不良信息都有维护不良原因
-            DataTable dt = (DataTable)dh.ExecuteSql("select mb_id,bc_name,mbr_mbid from makebad left join makebadreason on mbr_mbid=mb_id left join badcode on mb_badcode=bc_code where mb_sncode='" + ms_sncode.Text + "'", "select");
+            DataTable dt = (DataTable)dh.ExecuteSql("select mb_id,bc_name,mbr_mbid from makebad left join makebadreason on mbr_mbid=mb_id left join badcode on mb_badcode=bc_code where mb_sncode='" + ms_sncode.Text + "' and mb_status=0", "select");
             string ErrorMessage = "";
             for (int i = 0; i < dt.Rows.Count; i++)
             {
@@ -351,7 +363,7 @@ namespace UAS_MES.Make
                     string confirm = MessageBox.Show(this.ParentForm, "此操作不可撤销,是否确认报废", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk).ToString();
                     if (confirm == "Yes")
                     {
-                        DataTable dt = dh.getFieldsDataByCondition("makeserial", new string[] { "nvl(ms_ifrework,0)ms_ifrework", "ms_reworkcode" }, "ms_sncode='" + ms_sncode.Text + "' and ms_makecode='" + macode + "'");
+                        DataTable dt = dh.getFieldsDataByCondition("makeserial", new string[] { "nvl(ms_ifrework,0)ms_ifrework", "ms_reworkcode"}, "ms_sncode='" + ms_sncode.Text + "' and ms_makecode='" + macode + "'");
                         if (dt.Rows.Count > 0)
                         {
                             string ms_ifrework = dt.Rows[0]["ms_ifrework"].ToString();
@@ -363,8 +375,8 @@ namespace UAS_MES.Make
                             else
                             {
                                 sqls.Clear();
-                                sqls.Add("update makeserial set ms_paststep = ms_paststep ||'," + User.CurrentStepCode + "',ms_reworkstatus= 4,ms_nextstepcode='',ms_stepcode='" + User.CurrentStepCode + "' where ms_sncode='" + ms_sncode.Text + "' and ms_makecode='" + macode + "'");
-                                sqls.Add("update oqcbatch set ob_nowcheckqty=ob_nowcheckqty-1 where ob_checkno='" + ms_checkno.Text + "'");
+                                sqls.Add("update makeserial set ms_paststep = ms_paststep ||'," + User.CurrentStepCode + "',ms_status=4,ms_reworkstatus= 4,ms_nextstepcode='',ms_stepcode='" + User.CurrentStepCode + "' where ms_sncode='" + ms_sncode.Text + "' and ms_makecode='" + macode + "'");
+                                sqls.Add("update oqcbatch set ob_nowcheckqty=ob_nowcheckqty-1 where ob_checkno='" + ms_reworkcheckno.Text + "'");
                                 sqls.Add("delete from oqcbatchdetail where obd_sncode='" + ms_sncode.Text + "' and obd_checkno='" + ms_reworkcheckno.Text + "'");
                                 sqls.Add("update ReworkDetail set rd_rwstatus='报废' where rd_reid=(select re_id from rework where re_code='" + reworkcode + "') and rd_sncode='" + reworkcode + "'");
                                 dh.ExecuteSQLTran(sqls.ToArray());
@@ -561,7 +573,7 @@ namespace UAS_MES.Make
 
         private void cr_code_UserControlTextChanged(object sender, EventArgs e)
         {
-            cd_stepcode.Condition = "ST_STATUSCODE='AUDITED' and cr_code='" + cr_code.Text + "' and cr_prodcode='"+ms_prodcode.Text+"'";
+            cd_stepcode.Condition = "ST_STATUSCODE='AUDITED' and cr_code='" + cr_code.Text + "' and cr_prodcode='" + ms_prodcode.Text + "'";
         }
 
         private void Clean_Click(object sender, EventArgs e)

+ 19 - 12
UAS-MES/FunctionCode/OQC/OQC_BatchResultJudge.Designer.cs

@@ -49,7 +49,6 @@
             this.label5 = new System.Windows.Forms.Label();
             this.ob_status_label = new System.Windows.Forms.Label();
             this.ob_status = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
-            this.ob_maxngacceptqty = new UAS_MES.CustomControl.TextBoxWithIcon.TextBoxNumOnly();
             this.ob_source = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.ob_id = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.OperateResult = new UAS_MES.CustomControl.RichText.RichTextAutoBottom();
@@ -72,6 +71,7 @@
             this.WithdrawRejection = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.BatchPass = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.Clean = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
+            this.ob_maxngacceptqty = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.panel2.SuspendLayout();
             this.SuspendLayout();
             // 
@@ -303,15 +303,6 @@
             this.ob_status.TabIndex = 231;
             this.ob_status.Tag = "NoAuto";
             // 
-            // ob_maxngacceptqty
-            // 
-            this.ob_maxngacceptqty.Location = new System.Drawing.Point(283, 532);
-            this.ob_maxngacceptqty.Margin = new System.Windows.Forms.Padding(4);
-            this.ob_maxngacceptqty.Name = "ob_maxngacceptqty";
-            this.ob_maxngacceptqty.Size = new System.Drawing.Size(257, 25);
-            this.ob_maxngacceptqty.TabIndex = 230;
-            this.ob_maxngacceptqty.Text = "0";
-            // 
             // ob_source
             // 
             this.ob_source.AllPower = null;
@@ -703,14 +694,30 @@
             this.Clean.UseVisualStyleBackColor = true;
             this.Clean.Click += new System.EventHandler(this.Clean_Click);
             // 
+            // ob_maxngacceptqty
+            // 
+            this.ob_maxngacceptqty.AllPower = "";
+            this.ob_maxngacceptqty.BackColor = System.Drawing.Color.White;
+            this.ob_maxngacceptqty.ID = null;
+            this.ob_maxngacceptqty.Location = new System.Drawing.Point(268, 534);
+            this.ob_maxngacceptqty.Margin = new System.Windows.Forms.Padding(4);
+            this.ob_maxngacceptqty.Name = "ob_maxngacceptqty";
+            this.ob_maxngacceptqty.Power = "";
+            this.ob_maxngacceptqty.Size = new System.Drawing.Size(257, 25);
+            this.ob_maxngacceptqty.Str = null;
+            this.ob_maxngacceptqty.Str1 = null;
+            this.ob_maxngacceptqty.Str2 = null;
+            this.ob_maxngacceptqty.TabIndex = 233;
+            this.ob_maxngacceptqty.Tag = "NoAuto";
+            // 
             // OQC_BatchResultJudge
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1300, 706);
+            this.Controls.Add(this.ob_maxngacceptqty);
             this.Controls.Add(this.ob_status_label);
             this.Controls.Add(this.ob_status);
-            this.Controls.Add(this.ob_maxngacceptqty);
             this.Controls.Add(this.ob_source);
             this.Controls.Add(this.ob_id);
             this.Controls.Add(this.OperateResult);
@@ -805,8 +812,8 @@
         private CustomControl.RichText.RichTextAutoBottom OperateResult;
         private CustomControl.TextBoxWithIcon.EnterTextBox ob_id;
         private CustomControl.TextBoxWithIcon.EnterTextBox ob_source;
-        private CustomControl.TextBoxWithIcon.TextBoxNumOnly ob_maxngacceptqty;
         private CustomControl.TextBoxWithIcon.EnterTextBox ob_status;
         private System.Windows.Forms.Label ob_status_label;
+        private CustomControl.TextBoxWithIcon.EnterTextBox ob_maxngacceptqty;
     }
 }

+ 1 - 1
UAS-MES/FunctionCode/OQC/OQC_Inspection.cs

@@ -49,7 +49,7 @@ namespace UAS_MES.OQC
             {
                 string ob_id = dh.GetSEQ("OQCBatch_SEQ");
                 string checkno = "";
-                dh.GetSerialNumByCaller("Make!CheckQC",out checkno);
+                LogicHandler.GetSerialNumByCaller("Make!CheckQC",out checkno);
                 sql.Append("insert into OQCBatch (ob_id, ob_checkno ,ob_status, ob_source,ob_indate,ob_checkman) ");
                 sql.Append("values( '" + ob_id + "','" + checkno + "', 'ENTERING', '新增', sysdate, '" + User.UserName + "')");
                 dh.ExecuteSql(sql.GetString(), "insert");

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

@@ -69,7 +69,7 @@ namespace UAS_MES.OQC
                 {
                     if (ErrorMessage == "")
                     {
-                        ad_qty.Text = "";
+                        ob_sampleqty.Text = "";
                         ob_maxngacceptqty.Text = "";
                         BaseUtil.SetFormValue(Controls, dt[0]);
                         BaseUtil.FillDgvWithDataTable(CheckTypeDGV, dt[1]);
@@ -107,7 +107,7 @@ namespace UAS_MES.OQC
                 List<string> ci_kind_update = new List<string>();
                 List<string> oi_sampleqty_update = new List<string>();
                 int ChooseCount = 0;
-                if (int.Parse(ob_maxngacceptqty.Text == "" ? "0" : ob_maxngacceptqty.Text) > int.Parse(ad_qty.Text == "" ? "0" : ad_qty.Text))
+                if (int.Parse(ob_maxngacceptqty.Text == "" ? "0" : ob_maxngacceptqty.Text) > int.Parse(ob_sampleqty.Text == "" ? "0" : ob_sampleqty.Text))
                 {
                     OperateResult.AppendText(">>最大不合格通过数不允许大于抽检数\n", Color.Red);
                     return;
@@ -185,15 +185,8 @@ namespace UAS_MES.OQC
             }
             else
             {
-                int result = (int)dh.ExecuteSql("update OQCBatch set ob_projectcode='" + ob_projectcode.Text + "',ob_remark = '" + ob_remark.Text + "',ob_aqlcode='" + ob_aqlcode.Text + "',ob_maxngacceptqty='" + ob_maxngacceptqty.Text + "' where ob_checkno='" + ob_checkno.Text + "' ", "update");
-                if (result > 0)
-                {
-                    return true;
-                }
-                else
-                {
-                    return false;
-                }
+                int result = (int)dh.ExecuteSql("update OQCBatch set ob_projectcode='" + ob_projectcode.Text + "',ob_remark = '" + ob_remark.Text + "',ob_aqlcode='" + ob_aqlcode.Text + "',ob_maxngacceptqty='" + ob_maxngacceptqty.Text + "',ob_actsampleqty='" + ob_sampleqty.Text + "' where ob_checkno='" + ob_checkno.Text + "' ", "update");
+                return result > 0;
             }
         }
 
@@ -236,7 +229,7 @@ namespace UAS_MES.OQC
                         if (batchqty > minqty && batchqty <= maxqty)
                         {
                             ob_maxngacceptqty.Text = dt.Rows[i]["ad_maxngacceptqty"].ToString();
-                            ad_qty.Text = dt.Rows[i]["ad_qty"].ToString();
+                            ob_sampleqty.Text = dt.Rows[i]["ad_qty"].ToString();
                             Find = true;
                         }
                     }
@@ -244,7 +237,7 @@ namespace UAS_MES.OQC
                 if (!Find)
                 {
                     ob_maxngacceptqty.Text = "";
-                    ad_qty.Text = "";
+                    ob_sampleqty.Text = "";
                 }
             }
         }
@@ -253,7 +246,7 @@ namespace UAS_MES.OQC
         {
             for (int i = 0; i < CheckTypeDGV.Rows.Count; i++)
             {
-                CheckTypeDGV.Rows[i].Cells["oi_sampleqty"].Value = ad_qty.Text;
+                CheckTypeDGV.Rows[i].Cells["oi_sampleqty"].Value = ob_sampleqty.Text;
             }
         }
 

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

@@ -43,8 +43,8 @@
             this.pr_detail_label = new System.Windows.Forms.Label();
             this.panel1 = new System.Windows.Forms.Panel();
             this.ob_maxngacceptqty = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
-            this.ad_qty = new UAS_MES.CustomControl.TextBoxWithIcon.TextBoxNumOnly();
-            this.ad_qty_label = new System.Windows.Forms.Label();
+            this.ob_sampleqty = new UAS_MES.CustomControl.TextBoxWithIcon.TextBoxNumOnly();
+            this.ob_sampleqty_label = new System.Windows.Forms.Label();
             this.ob_remark = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.ob_aqlcode = new UAS_MES.CustomControl.TextBoxWithIcon.SearchTextBox();
             this.pr_detail = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
@@ -55,17 +55,17 @@
             this.GetBatch = 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_nowcheckqty = 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.ChooseAll = new UAS_MES.CustomControl.ButtonUtil.ChooseAllButton();
-            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();
@@ -209,8 +209,8 @@
             // 
             this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
             this.panel1.Controls.Add(this.ob_maxngacceptqty);
-            this.panel1.Controls.Add(this.ad_qty);
-            this.panel1.Controls.Add(this.ad_qty_label);
+            this.panel1.Controls.Add(this.ob_sampleqty);
+            this.panel1.Controls.Add(this.ob_sampleqty_label);
             this.panel1.Controls.Add(this.ob_remark);
             this.panel1.Controls.Add(this.ob_remark_label);
             this.panel1.Controls.Add(this.ob_aqlcode);
@@ -238,26 +238,26 @@
             this.ob_maxngacceptqty.TabIndex = 195;
             this.ob_maxngacceptqty.Tag = "NoAuto";
             // 
-            // ad_qty
+            // ob_sampleqty
             // 
-            this.ad_qty.Location = new System.Drawing.Point(100, 74);
-            this.ad_qty.Margin = new System.Windows.Forms.Padding(4);
-            this.ad_qty.Name = "ad_qty";
-            this.ad_qty.Size = new System.Drawing.Size(204, 25);
-            this.ad_qty.TabIndex = 194;
-            this.ad_qty.Text = "0";
-            this.ad_qty.TextChanged += new System.EventHandler(this.ad_qty_TextChanged_1);
+            this.ob_sampleqty.Location = new System.Drawing.Point(100, 74);
+            this.ob_sampleqty.Margin = new System.Windows.Forms.Padding(4);
+            this.ob_sampleqty.Name = "ob_sampleqty";
+            this.ob_sampleqty.Size = new System.Drawing.Size(204, 25);
+            this.ob_sampleqty.TabIndex = 194;
+            this.ob_sampleqty.Text = "0";
+            this.ob_sampleqty.TextChanged += new System.EventHandler(this.ad_qty_TextChanged_1);
             // 
-            // ad_qty_label
+            // ob_sampleqty_label
             // 
-            this.ad_qty_label.AutoSize = true;
-            this.ad_qty_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ad_qty_label.Location = new System.Drawing.Point(16, 74);
-            this.ad_qty_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
-            this.ad_qty_label.Name = "ad_qty_label";
-            this.ad_qty_label.Size = new System.Drawing.Size(72, 27);
-            this.ad_qty_label.TabIndex = 193;
-            this.ad_qty_label.Text = "样本数";
+            this.ob_sampleqty_label.AutoSize = true;
+            this.ob_sampleqty_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.ob_sampleqty_label.Location = new System.Drawing.Point(16, 74);
+            this.ob_sampleqty_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.ob_sampleqty_label.Name = "ob_sampleqty_label";
+            this.ob_sampleqty_label.Size = new System.Drawing.Size(72, 27);
+            this.ob_sampleqty_label.TabIndex = 193;
+            this.ob_sampleqty_label.Text = "样本数";
             // 
             // ob_remark
             // 
@@ -441,6 +441,50 @@
             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.ReadOnly = true;
+            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;
@@ -536,50 +580,6 @@
             this.ChooseAll.Text = "全选";
             this.ChooseAll.UseVisualStyleBackColor = true;
             // 
-            // 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.ReadOnly = true;
-            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);
@@ -655,8 +655,8 @@
         private CustomControl.TextBoxWithIcon.SearchTextBox ob_aqlcode;
         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.Label ob_sampleqty_label;
+        private CustomControl.TextBoxWithIcon.TextBoxNumOnly ob_sampleqty;
         private CustomControl.ButtonUtil.ChooseAllButton ChooseAll;
         private CustomControl.TextBoxWithIcon.EnterTextBox ob_maxngacceptqty;
         private System.Windows.Forms.DataGridViewCheckBoxColumn Choose;

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

@@ -322,7 +322,8 @@ namespace UAS_MES.OQC
                         sql.Append("select count(1)from (select ois_sncode from OQCITEMSAMPLES where ");
                         sql.Append("ois_checkno = '" + ob_checkno.Text + "' and ois_ifng = 1 group by ois_sncode)");
                         string ngqty = (dh.ExecuteSql(sql.GetString(), "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 ='" + ob_checkno.Text + "') where ob_checkno ='" + ob_checkno.Text + "'", "update");
+                        string checkqty = dh.getFieldDataByCondition("OQCItems", "max(oi_checkqty)", "oi_checkno ='" + ob_checkno.Text + "'").ToString();
+                        dh.ExecuteSql("update OQCBATCH set ob_ngqty='" + ngqty + "',ob_actsampleqty='" + checkqty + "',ob_okqty=('" + checkqty + "'-'" + ngqty + "') where ob_checkno ='" + ob_checkno.Text + "'", "update");
                         OperateResult.AppendText(">>序列号 " + sncode.Text + "操作成功\n", Color.Green);
                         LogicHandler.DoCommandLog(User.UserCode, "", User.UserLineCode, User.UserSourceCode, "抽样数据采集", "检验项目采集成功", sncode.Text, ob_checkno.Text);
                         GetBatch.PerformClick();

+ 8 - 0
UAS-MES/PublicMethod/LogicHandler.cs

@@ -269,6 +269,14 @@ namespace UAS_MES.PublicMethod
                 return false;
         }
 
+        public static void GetSerialNumByCaller(string iCaller, out string SerialNum)
+        {
+            SerialNum = "";
+            string[] param = new string[] { iCaller, "2", SerialNum };
+            dh.CallProcedure("SP_GETMAXNUMBER", ref param);
+            SerialNum = param[2];
+        }
+
         /// <summary>
         /// 判断下一工序是否是送检工序
         /// </summary>