Bladeren bron

添加OQC工序验证

章政 8 jaren geleden
bovenliggende
commit
ad51e3f220

+ 142 - 99
UAS-MES/FunctionCode/OQC/OQC_BatchResultJudge.cs

@@ -16,6 +16,11 @@ namespace UAS_MES.OQC
         DataHelper dh;
         LogStringBuilder sql = new LogStringBuilder();
         DataTable dt;
+        string ErrorMessage = "";
+        /// <summary>
+        /// 是否通过资源验证
+        /// </summary>
+        bool PassCheckStep = false;
         public OQC_BatchResultJudge()
         {
             InitializeComponent();
@@ -30,70 +35,84 @@ namespace UAS_MES.OQC
 
         private void GetBatch_Click(object sender, EventArgs e)
         {
-            string ErrorMessage = "";
-            DataTable[] dt = LogicHandler.GetOQCBatch(ms_sncode.Text, obd_outboxcode.Text, ob_checkno.Text, "OQCResultDetermine", out ErrorMessage);
-            if (ErrorMessage == "")
-            {
-                BaseUtil.SetFormValue(Controls, dt[0]);
-            }
-            else
+            if (CheckStep())
             {
-                BaseUtil.CleanForm(this);
-                OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
-            }
-            switch (ob_result.Text)
-            {
-                case "OK":
-                    BatchPass.Enabled = false;
-                    BatchRejection.Enabled = false;
-                    ForcePass.Enabled = false;
-                    ForceRejection.Enabled = false;
-                    WithdrawPass.Enabled = true;
-                    WithdrawRejection.Enabled = false;
-                    break;
-                case "FOK":
-                    BatchPass.Enabled = false;
-                    BatchRejection.Enabled = false;
-                    ForcePass.Enabled = false;
-                    ForceRejection.Enabled = false;
-                    WithdrawPass.Enabled = true;
-                    WithdrawRejection.Enabled = false;
-                    break;
-                case "NG":
-                    BatchPass.Enabled = false;
-                    BatchRejection.Enabled = false;
-                    ForcePass.Enabled = false;
-                    ForceRejection.Enabled = false;
-                    WithdrawPass.Enabled = false;
-                    WithdrawRejection.Enabled = true;
-                    break;
-                case "FNG":
+                PassCheckStep = true;
+                string ErrorMessage = "";
+                DataTable[] dt = LogicHandler.GetOQCBatch(ms_sncode.Text, obd_outboxcode.Text, ob_checkno.Text, "OQCResultDetermine", out ErrorMessage);
+                if (ErrorMessage == "")
+                {
+                    BaseUtil.SetFormValue(Controls, dt[0]);
+                    switch (ob_result.Text)
+                    {
+                        case "OK":
+                            BatchPass.Enabled = false;
+                            BatchRejection.Enabled = false;
+                            ForcePass.Enabled = false;
+                            ForceRejection.Enabled = false;
+                            WithdrawPass.Enabled = true;
+                            WithdrawRejection.Enabled = false;
+                            break;
+                        case "FOK":
+                            BatchPass.Enabled = false;
+                            BatchRejection.Enabled = false;
+                            ForcePass.Enabled = false;
+                            ForceRejection.Enabled = false;
+                            WithdrawPass.Enabled = true;
+                            WithdrawRejection.Enabled = false;
+                            break;
+                        case "NG":
+                            BatchPass.Enabled = false;
+                            BatchRejection.Enabled = false;
+                            ForcePass.Enabled = false;
+                            ForceRejection.Enabled = false;
+                            WithdrawPass.Enabled = false;
+                            WithdrawRejection.Enabled = true;
+                            break;
+                        case "FNG":
+                            BatchPass.Enabled = false;
+                            BatchRejection.Enabled = false;
+                            ForcePass.Enabled = false;
+                            ForceRejection.Enabled = false;
+                            WithdrawPass.Enabled = false;
+                            WithdrawRejection.Enabled = true;
+                            break;
+                        case "":
+                            if (ob_checkno.Text != "")
+                            {
+                                BatchPass.Enabled = true;
+                                BatchRejection.Enabled = true;
+                                ForcePass.Enabled = true;
+                                ForceRejection.Enabled = true;
+                                WithdrawPass.Enabled = true;
+                                WithdrawRejection.Enabled = true;
+                            }
+                            break;
+                        default:
+                            break;
+                    }
+                }
+                else
+                {
+                    BaseUtil.CleanForm(this);
                     BatchPass.Enabled = false;
                     BatchRejection.Enabled = false;
                     ForcePass.Enabled = false;
                     ForceRejection.Enabled = false;
                     WithdrawPass.Enabled = false;
-                    WithdrawRejection.Enabled = true;
-                    break;
-                case "":
-                    if (ob_checkno.Text != "")
-                    {
-                        BatchPass.Enabled = true;
-                        BatchRejection.Enabled = true;
-                        ForcePass.Enabled = true;
-                        ForceRejection.Enabled = true;
-                        WithdrawPass.Enabled = true;
-                        WithdrawRejection.Enabled = true;
-                    }
-                    break;
-                default:
-                    break;
+                    WithdrawRejection.Enabled = false;
+                    OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
+                }
+            }
+            else
+            {
+                PassCheckStep = false;
             }
         }
 
         private void BatchPass_Click(object sender, EventArgs e)
         {
-            if (CheckBefore())
+            if (CheckBefore() && PassCheckStep)
             {
                 if (int.Parse(ob_ngqty.Text == "" ? "0" : ob_ngqty.Text) <= int.Parse(ob_maxngacceptqty.Text == "" ? ob_maxngacceptqty.Text : ob_maxngacceptqty.Text))
                 {
@@ -109,7 +128,7 @@ namespace UAS_MES.OQC
 
         private void BatchRejection_Click(object sender, EventArgs e)
         {
-            if (CheckBefore())
+            if (CheckBefore() && PassCheckStep)
             {
                 sql.Clear();
                 sql.Append("select max(nvl(ad_maxngacceptqty,0)) maxngacceptqty from QUA_Aql,QUA_AqlDetail where al_id=ad_alid ");
@@ -146,72 +165,85 @@ namespace UAS_MES.OQC
 
         private void ForcePass_Click(object sender, EventArgs e)
         {
-            dh.ExecuteSql("update OQCBatch set ob_status='OK' ,ob_result='FOK' where ob_checkno='" + ob_checkno.Text + "'", "select");
-            DoLog("强制通过", "强制通过成功", "通过");
-            GetBatch.PerformClick();
-            OperateResult.AppendText(">>强制通过批" + ob_checkno.Text + "成功\n", Color.Green);
+            if (PassCheckStep)
+            {
+                dh.ExecuteSql("update OQCBatch set ob_status='OK' ,ob_result='FOK' where ob_checkno='" + ob_checkno.Text + "'", "select");
+                DoLog("强制通过", "强制通过成功", "通过");
+                GetBatch.PerformClick();
+                OperateResult.AppendText(">>强制通过批" + ob_checkno.Text + "成功\n", Color.Green);
+            }
         }
 
         private void ForceRejection_Click(object sender, EventArgs e)
         {
-            dh.ExecuteSql("update OQCBatch set ob_status='NG' ,ob_result='FNG' where ob_checkno='" + ob_checkno.Text + "'", "select");
-            DoLog("强制判退通过", "强制判退通过成功", "判退");
-            GetBatch.PerformClick();
-            OperateResult.AppendText(">>强制撤销批" + ob_checkno.Text + "成功\n", Color.Green);
+            if (PassCheckStep)
+            {
+                dh.ExecuteSql("update OQCBatch set ob_status='NG' ,ob_result='FNG' where ob_checkno='" + ob_checkno.Text + "'", "select");
+                DoLog("强制判退通过", "强制判退通过成功", "判退");
+                GetBatch.PerformClick();
+                OperateResult.AppendText(">>强制撤销批" + ob_checkno.Text + "成功\n", Color.Green);
+            }
         }
 
         private void WithdrawPass_Click(object sender, EventArgs e)
         {
-            if (ob_result.Text == "OK" || ob_result.Text == "FOK")
-            {
-                dh.ExecuteSql("update OQCBatch set ob_status='CHECKING' ,ob_result='' where ob_checkno='" + ob_checkno.Text + "'", "select");
-                ob_result.Text = "";
-                DoLog("撤销通过", "撤销通过成功", "撤销");
-                OperateResult.AppendText(">>撤销通过批" + ob_checkno.Text + "成功\n", Color.Green);
-                GetBatch.PerformClick();
-            }
-            else
+            if (PassCheckStep)
             {
-                OperateResult.AppendText(">>该抽检批次未通过,无需撤销通过\n", Color.Red);
+                if (ob_result.Text == "OK" || ob_result.Text == "FOK")
+                {
+                    dh.ExecuteSql("update OQCBatch set ob_status='CHECKING' ,ob_result='' where ob_checkno='" + ob_checkno.Text + "'", "select");
+                    ob_result.Text = "";
+                    DoLog("撤销通过", "撤销通过成功", "撤销");
+                    OperateResult.AppendText(">>撤销通过批" + ob_checkno.Text + "成功\n", Color.Green);
+                    GetBatch.PerformClick();
+                }
+                else
+                {
+                    OperateResult.AppendText(">>该抽检批次未通过,无需撤销通过\n", Color.Red);
+                }
             }
         }
 
         private void WithdrawRejection_Click(object sender, EventArgs e)
         {
-            if (ob_result.Text == "NG" || ob_result.Text == "FNG")
+            if (PassCheckStep)
             {
-                dt = (DataTable)dh.ExecuteSql("select re_statuscode from rework where re_checkno='" + ob_checkno.Text + "'", "select");
-                if (dt.Rows.Count > 0)
+                if (ob_result.Text == "NG" || ob_result.Text == "FNG")
                 {
-                    if (dt.Rows[0]["re_statuscode"].ToString() == "AUDITED")
-                    {
-                        OperateResult.AppendText(">>该批次存在已审核的返修工单,不允许撤销\n", Color.Red);
-                        return;
-                    }
-                    else
+                    dt = (DataTable)dh.ExecuteSql("select re_statuscode from rework where re_checkno='" + ob_checkno.Text + "'", "select");
+                    if (dt.Rows.Count > 0)
                     {
-                        string logout_confirm = MessageBox.Show("已存在返修工单,撤销会删除该工单,是否继续", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
-                        if (logout_confirm == "Yes")
+                        if (dt.Rows[0]["re_statuscode"].ToString() == "AUDITED")
                         {
-                            dh.ExecuteSql("delete from reworkdetail where rd_checkno='" + ob_checkno.Text + "' ", "delete");
-                            dh.ExecuteSql("delete from rework where re_checkno='" + ob_checkno.Text + "' ", "delete");
+                            OperateResult.AppendText(">>该批次存在已审核的返修工单,不允许撤销\n", Color.Red);
+                            return;
+                        }
+                        else
+                        {
+                            string logout_confirm = MessageBox.Show("已存在返修工单,撤销会删除该工单,是否继续", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
+                            if (logout_confirm == "Yes")
+                            {
+                                dh.ExecuteSql("delete from reworkdetail where rd_checkno='" + ob_checkno.Text + "' ", "delete");
+                                dh.ExecuteSql("delete from rework where re_checkno='" + ob_checkno.Text + "' ", "delete");
+                            }
+                            else return;
                         }
-                        else return;
                     }
+                    dh.ExecuteSql("update OQCBatch set ob_status='CHECKING' ,ob_result='' where ob_checkno='" + ob_checkno.Text + "'", "select");
+                    ob_result.Text = "";
+                    DoLog("撤销判退", "撤销判退成功", "撤销");
+                    OperateResult.AppendText(">>撤销判退成功\n", Color.Green);
+                    GetBatch.PerformClick();
                 }
-                dh.ExecuteSql("update OQCBatch set ob_status='CHECKING' ,ob_result='' where ob_checkno='" + ob_checkno.Text + "'", "select");
-                ob_result.Text = "";
-                DoLog("撤销判退", "撤销判退成功", "撤销");
-                OperateResult.AppendText(">>撤销判退成功\n", Color.Green);
-                GetBatch.PerformClick();
+                else OperateResult.AppendText(">>该抽检批次未判退,无需撤销判退\n", Color.Red);
             }
-            else OperateResult.AppendText(">>该抽检批次未判退,无需撤销判退\n", Color.Red);
         }
 
         private void Clean_Click(object sender, EventArgs e)
         {
             OperateResult.Clear();
         }
+
         /// <summary>
         /// 操作之前通用的验证逻辑
         /// </summary>
@@ -261,11 +293,22 @@ namespace UAS_MES.OQC
                     }
                 }
             }
+            else OperateResult.AppendText(">>状态未在检验中的批次不允许进行判断\n", Color.Red);
+
+            return false;
+        }
+
+        private bool CheckStep()
+        {
+            if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out ErrorMessage))
+            {
+                return true;
+            }
             else
             {
-                OperateResult.AppendText(">>状态未在检验中的批次不允许进行判断\n", Color.Red);
+                OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
+                return false;
             }
-            return false;
         }
 
         //记录操作日志
@@ -296,15 +339,15 @@ namespace UAS_MES.OQC
                 else if (Type == "通过")
                 {
                     //更新下一工序
-                    string ErrorMessage = "";
-                    LogicHandler.UpdateOQCMessage(ms_sncode.Text,ob_checkno.Text, ob_makecode.Text, Kind, User.UserSourceCode, User.UserName, Result, out ErrorMessage);
+
+                    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,");
                     sql.Append("mp_craftcode,mp_craftname,mp_kind,mp_result,mp_indate,mp_inman,mp_wccode,mp_linecode,mp_sourcecode,mp_snstatus,mp_sncheckno,mp_snoutboxcode)");
-                    sql.Append("select MakeProcess_seq.nextval, ma_code,ma_id,ms_code,ms_sncode,mcd_stepcode,mcd_stepname,");
+                    sql.Append("select MakeProcess_seq.nextval, ma_code,ma_id,ms_code,ms_sncode,st_code,st_name,");
                     sql.Append("ma_craftcode,ma_craftname,'" + Kind + "','" + Result + "',sysdate,'" + User.UserCode + "',ma_wccode,'" + User.UserLineCode + "','" + User.UserSourceCode + "',");
-                    sql.Append("ms_status,ms_checkno,ms_outboxcode from make left join makecraftdetail on mcd_macode=ma_code left join makeserial on ms_makecode=ma_code ");
-                    sql.Append("where  ms_checkno='" + ob_checkno.Text + "' and mcd_stepcode='" + User.CurrentStepCode + "'");
+                    sql.Append("ms_status,ms_checkno,ms_outboxcode from make left join makeserial on ms_makecode=ma_code left join step on st_code=ms_stepcode ");
+                    sql.Append("where  ms_checkno='" + ob_checkno.Text + "' and st_code='" + User.CurrentStepCode + "'");
                     dh.ExecuteSql(sql.GetString(), "insert");
                 }
             }

+ 44 - 22
UAS-MES/FunctionCode/OQC/OQC_Inspection.cs

@@ -19,6 +19,8 @@ namespace UAS_MES.OQC
         DataTable dt;
         //用来存放已打开过的行
         List<DataGridViewRow> dgvr = new List<DataGridViewRow>();
+        string ErrorMessage = "";
+
         public OQC_Inspection()
         {
             InitializeComponent();
@@ -43,16 +45,19 @@ namespace UAS_MES.OQC
 
         private void NewBatch_Click(object sender, EventArgs e)
         {
-            string ob_id = dh.GetSEQ("OQCBatch_SEQ");
-            string checkno = dh.GetSerialNumberByCaller("OQC!Inspection");
-            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");
-            sql.Clear();
-            //记录操作日志
-            LogicHandler.InsertMessageLog(User.UserName, "生成新批", "成功", "", "");
-            //生成成功,将批次号,以及批次状态写入页面
-            BaseUtil.SetFormValue(Controls, dh.getFieldsDataByCondition("OQCBatch", new string[] { "ob_checkno", "ob_status" }, "ob_id='" + ob_id + "'"));
+            if (CheckStep())
+            {
+                string ob_id = dh.GetSEQ("OQCBatch_SEQ");
+                string checkno = dh.GetSerialNumberByCaller("OQC!Inspection");
+                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");
+                sql.Clear();
+                //记录操作日志
+                LogicHandler.InsertMessageLog(User.UserName, "生成新批", "成功", "", "");
+                //生成成功,将批次号,以及批次状态写入页面
+                BaseUtil.SetFormValue(Controls, dh.getFieldsDataByCondition("OQCBatch", new string[] { "ob_checkno", "ob_status" }, "ob_id='" + ob_id + "'"));
+            }
         }
 
         private void 生成送检批_SizeChanged(object sender, EventArgs e)
@@ -140,17 +145,19 @@ namespace UAS_MES.OQC
 
         private void GetBatch_Click(object sender, EventArgs e)
         {
-            string ErrorMessage = "";
-            DataTable[] dt = LogicHandler.GetOQCBatch(ms_sncode.Text, obd_outboxcode.Text, ob_checkno.Text, "OQCSendCheck", out ErrorMessage);
-            if (ErrorMessage == "")
-            {
-                BaseUtil.SetFormValue(Controls, dt[0]);
-                BaseUtil.FillExpandDgvWithDataTable(CheckBatchDGV, dt[1], true);
-            }
-            else
+            if (CheckStep())
             {
-                 BaseUtil.CleanForm(this);
-                OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
+                DataTable[] dt = LogicHandler.GetOQCBatch(ms_sncode.Text, obd_outboxcode.Text, ob_checkno.Text, "OQCSendCheck", out ErrorMessage);
+                if (ErrorMessage == "")
+                {
+                    BaseUtil.SetFormValue(Controls, dt[0]);
+                    BaseUtil.FillExpandDgvWithDataTable(CheckBatchDGV, dt[1], true);
+                }
+                else
+                {
+                    BaseUtil.CleanForm(this);
+                    OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
+                }
             }
         }
 
@@ -159,6 +166,19 @@ namespace UAS_MES.OQC
 
         }
 
+        private bool CheckStep()
+        {
+            if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out ErrorMessage))
+            {
+                return true;
+            }
+            else
+            {
+                OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
+                return false;
+            }
+        }
+
         private void CheckBatchDGV_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
         {
             if (!dgvr.Contains(CheckBatchDGV.Rows[e.RowIndex]))
@@ -238,8 +258,10 @@ namespace UAS_MES.OQC
 
         private void RemoveAll_Click(object sender, EventArgs e)
         {
-            if (CheckBatchDGV.Rows.Count > 0) {
-                if (MessageBox.Show(this.ParentForm, "确认移除全部箱号?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString() == "Yes") {
+            if (CheckBatchDGV.Rows.Count > 0)
+            {
+                if (MessageBox.Show(this.ParentForm, "确认移除全部箱号?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString() == "Yes")
+                {
                     DataTable dt = (DataTable)dh.ExecuteSql("select ob_status,ob_source from OQCBatch where ob_checkno='" + ob_checkno.Text + "'", "select");
                     if (dt.Rows.Count > 0)
                     {

+ 17 - 9
UAS-MES/FunctionCode/OQC/OQC_PlanMaintain.cs

@@ -5,6 +5,7 @@ using System.Drawing;
 using System.Text;
 using System.Windows.Forms;
 using UAS_MES.DataOperate;
+using UAS_MES.Entity;
 using UAS_MES.PublicMethod;
 
 namespace UAS_MES.OQC
@@ -52,26 +53,33 @@ namespace UAS_MES.OQC
         /// <param name="e"></param>
         private void GetBatch_Click(object sender, EventArgs e)
         {
-            DataTable[] dt = LogicHandler.GetOQCBatch(ms_sncode.Text, obd_outboxcode.Text, ob_checkno.Text, "OQCPlanMaintain", out ErrorMessage);
-            if (dt != null)
+            if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out ErrorMessage))
             {
-                if (ErrorMessage == "")
+                DataTable[] dt = LogicHandler.GetOQCBatch(ms_sncode.Text, obd_outboxcode.Text, ob_checkno.Text, "OQCPlanMaintain", out ErrorMessage);
+                if (dt != null)
                 {
-                    BaseUtil.SetFormValue(Controls, dt[0]);
-                    BaseUtil.FillDgvWithDataTable(CheckTypeDGV, dt[1]);
-                    ob_aqlcode.Text = "";
-                    ob_aqlcode.Text = dt[0].Rows[0]["ob_aqlcode"].ToString();
+                    if (ErrorMessage == "")
+                    {
+                        BaseUtil.SetFormValue(Controls, dt[0]);
+                        BaseUtil.FillDgvWithDataTable(CheckTypeDGV, dt[1]);
+                        ob_aqlcode.Text = "";
+                        ob_aqlcode.Text = dt[0].Rows[0]["ob_aqlcode"].ToString();
+                    }
+                    else
+                    {
+                        BaseUtil.CleanForm(this);
+                        OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
+                        ErrorMessage = "";
+                    }
                 }
                 else
                 {
                     BaseUtil.CleanForm(this);
                     OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
-                    ErrorMessage = "";
                 }
             }
             else
             {
-                BaseUtil.CleanForm(this);
                 OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
             }
         }

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

@@ -216,7 +216,7 @@
             this.panel1.Controls.Add(this.ob_aqlcode);
             this.panel1.Controls.Add(this.ob_aqlcode_label);
             this.panel1.Controls.Add(this.ob_maxacceptqty_label);
-            this.panel1.Location = new System.Drawing.Point(33, 162);
+            this.panel1.Location = new System.Drawing.Point(33, 158);
             this.panel1.Margin = new System.Windows.Forms.Padding(4);
             this.panel1.Name = "panel1";
             this.panel1.Size = new System.Drawing.Size(993, 120);
@@ -564,9 +564,9 @@
             // 
             // ChooseAll
             // 
-            this.ChooseAll.Location = new System.Drawing.Point(33, 289);
+            this.ChooseAll.Location = new System.Drawing.Point(33, 286);
             this.ChooseAll.Name = "ChooseAll";
-            this.ChooseAll.Size = new System.Drawing.Size(75, 23);
+            this.ChooseAll.Size = new System.Drawing.Size(50, 23);
             this.ChooseAll.TabIndex = 194;
             this.ChooseAll.Text = "全选";
             this.ChooseAll.UseVisualStyleBackColor = true;

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

@@ -526,19 +526,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>

+ 15 - 7
UAS-MES/FunctionCode/OQC/OQC_SamplingDataCollection.cs

@@ -26,6 +26,8 @@ namespace UAS_MES.OQC
 
         DataTable TempForBadGroup = new DataTable();
 
+        string ErrorMessage = "";
+
         public OQC_SamplingDataCollection()
         {
             InitializeComponent();
@@ -46,18 +48,24 @@ namespace UAS_MES.OQC
 
         private void GetBatch_Click(object sender, EventArgs e)
         {
-            string ErrorMessage = "";
-            DataTable[] dt = LogicHandler.GetOQCBatch(ms_sncode.Text, obd_outboxcode.Text, ob_checkno.Text, "OQCDataCollection", out ErrorMessage);
-            if (ErrorMessage == "")
+            if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out ErrorMessage))
             {
-                BaseUtil.SetFormValue(Controls, dt[0]);
-                if (ob_aqlcode.Text == "")
+                DataTable[] dt = LogicHandler.GetOQCBatch(ms_sncode.Text, obd_outboxcode.Text, ob_checkno.Text, "OQCDataCollection", out ErrorMessage);
+                if (ErrorMessage == "")
                 {
+                    BaseUtil.SetFormValue(Controls, dt[0]);
+                    if (ob_aqlcode.Text == "")
+                    {
 
+                    }
+                    dgvr.Clear();
                 }
-                dgvr.Clear();
+                else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
+            }
+            else
+            {
+                OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
             }
-            else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
         }
 
         private void Clean_Click(object sender, EventArgs e)

+ 39 - 37
UAS-MES/FunctionCode/Query/Query_ExeProgress.Designer.cs

@@ -57,9 +57,10 @@
             // 
             this.sn_code_label.AutoSize = true;
             this.sn_code_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.sn_code_label.Location = new System.Drawing.Point(10, 11);
+            this.sn_code_label.Location = new System.Drawing.Point(13, 14);
+            this.sn_code_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.sn_code_label.Name = "sn_code_label";
-            this.sn_code_label.Size = new System.Drawing.Size(58, 21);
+            this.sn_code_label.Size = new System.Drawing.Size(72, 27);
             this.sn_code_label.TabIndex = 183;
             this.sn_code_label.Text = "序列号";
             // 
@@ -68,10 +69,10 @@
             this.SerialPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
             | System.Windows.Forms.AnchorStyles.Right)));
             this.SerialPanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
-            this.SerialPanel.Location = new System.Drawing.Point(14, 107);
-            this.SerialPanel.Margin = new System.Windows.Forms.Padding(2);
+            this.SerialPanel.Location = new System.Drawing.Point(19, 134);
+            this.SerialPanel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.SerialPanel.Name = "SerialPanel";
-            this.SerialPanel.Size = new System.Drawing.Size(950, 254);
+            this.SerialPanel.Size = new System.Drawing.Size(1265, 316);
             this.SerialPanel.TabIndex = 194;
             this.SerialPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.SerialPanel_Paint);
             // 
@@ -88,11 +89,11 @@
             this.mp_indate,
             this.ma_craftcode,
             this.ma_linecode});
-            this.CraftInfDgv.Location = new System.Drawing.Point(0, 388);
-            this.CraftInfDgv.Margin = new System.Windows.Forms.Padding(2);
+            this.CraftInfDgv.Location = new System.Drawing.Point(0, 485);
+            this.CraftInfDgv.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.CraftInfDgv.Name = "CraftInfDgv";
             this.CraftInfDgv.RowTemplate.Height = 27;
-            this.CraftInfDgv.Size = new System.Drawing.Size(975, 190);
+            this.CraftInfDgv.Size = new System.Drawing.Size(1300, 238);
             this.CraftInfDgv.TabIndex = 193;
             // 
             // groupBoxWithBorder1
@@ -107,9 +108,11 @@
             this.groupBoxWithBorder1.Controls.Add(this.label2);
             this.groupBoxWithBorder1.Controls.Add(this.label3);
             this.groupBoxWithBorder1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.groupBoxWithBorder1.Location = new System.Drawing.Point(12, 40);
+            this.groupBoxWithBorder1.Location = new System.Drawing.Point(16, 50);
+            this.groupBoxWithBorder1.Margin = new System.Windows.Forms.Padding(4);
             this.groupBoxWithBorder1.Name = "groupBoxWithBorder1";
-            this.groupBoxWithBorder1.Size = new System.Drawing.Size(953, 40);
+            this.groupBoxWithBorder1.Padding = new System.Windows.Forms.Padding(4);
+            this.groupBoxWithBorder1.Size = new System.Drawing.Size(1271, 50);
             this.groupBoxWithBorder1.TabIndex = 192;
             this.groupBoxWithBorder1.TabStop = false;
             this.groupBoxWithBorder1.Text = "颜色说明";
@@ -118,9 +121,10 @@
             // pictureBox2
             // 
             this.pictureBox2.BackColor = System.Drawing.Color.Green;
-            this.pictureBox2.Location = new System.Drawing.Point(99, 12);
+            this.pictureBox2.Location = new System.Drawing.Point(132, 15);
+            this.pictureBox2.Margin = new System.Windows.Forms.Padding(4);
             this.pictureBox2.Name = "pictureBox2";
-            this.pictureBox2.Size = new System.Drawing.Size(60, 20);
+            this.pictureBox2.Size = new System.Drawing.Size(80, 25);
             this.pictureBox2.TabIndex = 187;
             this.pictureBox2.TabStop = false;
             // 
@@ -128,27 +132,30 @@
             // 
             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(648, 10);
+            this.label4.Location = new System.Drawing.Point(864, 12);
+            this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label4.Name = "label4";
-            this.label4.Size = new System.Drawing.Size(74, 21);
+            this.label4.Size = new System.Drawing.Size(92, 27);
             this.label4.TabIndex = 191;
             this.label4.Text = "尚未执行";
             // 
             // pictureBox1
             // 
             this.pictureBox1.BackColor = System.Drawing.Color.Red;
-            this.pictureBox1.Location = new System.Drawing.Point(338, 12);
+            this.pictureBox1.Location = new System.Drawing.Point(451, 15);
+            this.pictureBox1.Margin = new System.Windows.Forms.Padding(4);
             this.pictureBox1.Name = "pictureBox1";
-            this.pictureBox1.Size = new System.Drawing.Size(60, 20);
+            this.pictureBox1.Size = new System.Drawing.Size(80, 25);
             this.pictureBox1.TabIndex = 186;
             this.pictureBox1.TabStop = false;
             // 
             // pictureBox3
             // 
             this.pictureBox3.BackColor = System.Drawing.Color.White;
-            this.pictureBox3.Location = new System.Drawing.Point(581, 12);
+            this.pictureBox3.Location = new System.Drawing.Point(775, 15);
+            this.pictureBox3.Margin = new System.Windows.Forms.Padding(4);
             this.pictureBox3.Name = "pictureBox3";
-            this.pictureBox3.Size = new System.Drawing.Size(60, 20);
+            this.pictureBox3.Size = new System.Drawing.Size(80, 25);
             this.pictureBox3.TabIndex = 190;
             this.pictureBox3.TabStop = false;
             // 
@@ -156,9 +163,10 @@
             // 
             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(166, 10);
+            this.label2.Location = new System.Drawing.Point(221, 12);
+            this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(122, 21);
+            this.label2.Size = new System.Drawing.Size(152, 27);
             this.label2.TabIndex = 188;
             this.label2.Text = "已执行且为良品";
             // 
@@ -166,9 +174,10 @@
             // 
             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(405, 10);
+            this.label3.Location = new System.Drawing.Point(540, 12);
+            this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label3.Name = "label3";
-            this.label3.Size = new System.Drawing.Size(138, 21);
+            this.label3.Size = new System.Drawing.Size(172, 27);
             this.label3.TabIndex = 189;
             this.label3.Text = "已执行且为不良品";
             // 
@@ -177,10 +186,11 @@
             this.sn_code.AllPower = null;
             this.sn_code.BackColor = System.Drawing.Color.White;
             this.sn_code.ID = null;
-            this.sn_code.Location = new System.Drawing.Point(92, 13);
+            this.sn_code.Location = new System.Drawing.Point(123, 16);
+            this.sn_code.Margin = new System.Windows.Forms.Padding(4);
             this.sn_code.Name = "sn_code";
             this.sn_code.Power = null;
-            this.sn_code.Size = new System.Drawing.Size(145, 21);
+            this.sn_code.Size = new System.Drawing.Size(192, 25);
             this.sn_code.Str = null;
             this.sn_code.Str1 = null;
             this.sn_code.Str2 = null;
@@ -191,19 +201,15 @@
             // mp_sncode
             // 
             this.mp_sncode.DataPropertyName = "mp_sncode";
-            this.mp_sncode.Frozen = true;
             this.mp_sncode.HeaderText = "序列号";
             this.mp_sncode.Name = "mp_sncode";
-            this.mp_sncode.ReadOnly = true;
             this.mp_sncode.Width = 120;
             // 
             // mp_makecode
             // 
             this.mp_makecode.DataPropertyName = "mp_makecode";
-            this.mp_makecode.Frozen = true;
             this.mp_makecode.HeaderText = "工单代码";
             this.mp_makecode.Name = "mp_makecode";
-            this.mp_makecode.ReadOnly = true;
             this.mp_makecode.Width = 120;
             // 
             // ma_prodcode
@@ -211,7 +217,6 @@
             this.ma_prodcode.DataPropertyName = "ma_prodcode";
             this.ma_prodcode.HeaderText = "产品代码";
             this.ma_prodcode.Name = "ma_prodcode";
-            this.ma_prodcode.ReadOnly = true;
             this.ma_prodcode.Width = 120;
             // 
             // mp_sourcecode
@@ -219,7 +224,6 @@
             this.mp_sourcecode.DataPropertyName = "mp_sourcecode";
             this.mp_sourcecode.HeaderText = "资源编号";
             this.mp_sourcecode.Name = "mp_sourcecode";
-            this.mp_sourcecode.ReadOnly = true;
             this.mp_sourcecode.Width = 120;
             // 
             // mp_indate
@@ -227,7 +231,6 @@
             this.mp_indate.DataPropertyName = "mp_indate";
             this.mp_indate.HeaderText = "过站时间";
             this.mp_indate.Name = "mp_indate";
-            this.mp_indate.ReadOnly = true;
             this.mp_indate.Width = 120;
             // 
             // ma_craftcode
@@ -235,7 +238,6 @@
             this.ma_craftcode.DataPropertyName = "ma_craftcode";
             this.ma_craftcode.HeaderText = "途程代码";
             this.ma_craftcode.Name = "ma_craftcode";
-            this.ma_craftcode.ReadOnly = true;
             this.ma_craftcode.Width = 120;
             // 
             // ma_linecode
@@ -243,32 +245,32 @@
             this.ma_linecode.DataPropertyName = "ma_linecode";
             this.ma_linecode.HeaderText = "产线";
             this.ma_linecode.Name = "ma_linecode";
-            this.ma_linecode.ReadOnly = true;
             this.ma_linecode.Width = 120;
             // 
             // Query_ExeProgress
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(975, 578);
+            this.ClientSize = new System.Drawing.Size(1300, 722);
             this.Controls.Add(this.SerialPanel);
             this.Controls.Add(this.CraftInfDgv);
             this.Controls.Add(this.groupBoxWithBorder1);
             this.Controls.Add(this.sn_code);
             this.Controls.Add(this.sn_code_label);
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
+            this.Margin = new System.Windows.Forms.Padding(4);
             this.Name = "Query_ExeProgress";
             this.Tag = "Query!ExeProgress";
             this.Text = "工单执行进度";
             this.Load += new System.EventHandler(this.工单执行进度_Load);
             this.SizeChanged += new System.EventHandler(this.工单执行进度_SizeChanged);
             ((System.ComponentModel.ISupportInitialize)(this.CraftInfDgv)).EndInit();
-            this.groupBoxWithBorder1.ResumeLayout(false);
+            this.groupBoxWithBorder1.ResumeLayout(true);
             this.groupBoxWithBorder1.PerformLayout();
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit();
-            this.ResumeLayout(false);
+            this.ResumeLayout(true);
             this.PerformLayout();
 
         }

+ 6 - 3
UAS-MES/FunctionCode/Query/Query_ExeProgress.cs

@@ -28,6 +28,8 @@ namespace UAS_MES.Query
 
         DataTable dt;
 
+        AutoSizeFormClass asc = new AutoSizeFormClass();
+
         public Query_ExeProgress()
         {
             InitializeComponent();
@@ -38,11 +40,12 @@ namespace UAS_MES.Query
             dh = new DataHelper();
             ScreenWidth = this.Width;
             ScreenHeight = this.Height;
+            asc.controllInitializeSize(this);
         }
 
         private void 工单执行进度_SizeChanged(object sender, EventArgs e)
         {
-
+            asc.controlAutoSize(this);
         }
 
         private void sn_code_KeyDown(object sender, KeyEventArgs e)
@@ -58,8 +61,8 @@ namespace UAS_MES.Query
                 }
                 //查询执行过的步骤
                 sql.Clear();
-                sql.Append("select CD_DETNO, CD_STEPCODE from craft left join craftdetail  on cd_crid = cr_id where ");
-                sql.Append("cr_code=(select ms_craftcode from makeserial where ms_sncode='" + sn_code.Text + "') order by cd_detno");
+                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+"'");
                 dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                 Step = new Dictionary<int, string>();
                 PastStep = dh.getFieldDataByCondition("makeserial", "ms_paststep", "ms_sncode='" + sn_code.Text + "'").ToString();