Przeglądaj źródła

卡通箱称重操作完置空

shim 8 lat temu
rodzic
commit
ba540410cc

+ 1 - 0
UAS-MES/FunctionCode/Make/Make_CartonBoxWeigh.cs

@@ -124,6 +124,7 @@ namespace UAS_MES.Make
                 {
                     OperateResult.AppendText(">>箱号" + outboxcode.Text + "不存在\n", Color.Red);
                 }
+                outboxcode.Text = "";
             }
         }
 

+ 4 - 4
UAS-MES/FunctionCode/Make/Make_ColorBoxWeigh.cs

@@ -89,7 +89,7 @@ namespace UAS_MES.Make
                             dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                             if (dt.Rows[0]["CN"].ToString() != "0")
                             {
-                                OperateResult.AppendText(">>物料:" + pr_code.Text + " ,岗位用料不足\n", Color.Red);
+                                OperateResult.AppendText(">>物料:" + pr_code.Text + " ,岗位用料不足\n", Color.Red,sncode);
                                 return;
                             }
                         }
@@ -104,17 +104,17 @@ namespace UAS_MES.Make
                             Temp1.Text = sncode.Text;
                         }
                         else
-                            OperateResult.AppendText(">>检测未通过\n", Color.Red);
+                            OperateResult.AppendText(">>检测未通过\n", Color.Red,sncode);
                     }
                     else
                     {
-                        OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
+                        OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red,sncode);
                     }
                     sncode.Text = "";
                 }
                 else
                 {
-                    OperateResult.AppendText(">>序列号不存在\n", Color.Red);
+                    OperateResult.AppendText(">>序列号不存在\n", Color.Red,sncode);
                     return;
                 }
             }

+ 112 - 110
UAS-MES/FunctionCode/Make/Make_FuselageLabelPrint.Designer.cs

@@ -32,22 +32,22 @@
             this.PrintLabel = new System.Windows.Forms.ComboBox();
             this.label2 = new System.Windows.Forms.Label();
             this.label1 = new System.Windows.Forms.Label();
-            this.Printer = new UAS_MES.CustomControl.ComBoxWithFocus.PrinterCombox();
-            this.mcd_remainqty = new UAS_MES.CustomControl.ValueLabel.ValueNumLabel(this.components);
-            this.mcd_okqty = new UAS_MES.CustomControl.ValueLabel.ValueNumLabel(this.components);
-            this.pr_code = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
-            this.pr_detail = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
-            this.ms_makecode = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
-            this.PrintNum = new UAS_MES.CustomControl.TextBoxWithIcon.NumOnlyTextBox();
             this.pr_detail_label = new System.Windows.Forms.Label();
             this.sncode_label = new System.Windows.Forms.Label();
-            this.sncode = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
-            this.OperateResult = new UAS_MES.CustomControl.RichText.RichTextAutoBottom();
             this.label4 = new System.Windows.Forms.Label();
             this.mcd_remainqty_label = new System.Windows.Forms.Label();
             this.mcd_okqty_label = new System.Windows.Forms.Label();
             this.pr_code_label = new System.Windows.Forms.Label();
             this.ms_makecode_label = new System.Windows.Forms.Label();
+            this.Printer = new UAS_MES.CustomControl.ComBoxWithFocus.PrinterCombox();
+            this.mcd_remainqty = new UAS_MES.CustomControl.ValueLabel.ValueNumLabel(this.components);
+            this.mcd_okqty = new UAS_MES.CustomControl.ValueLabel.ValueNumLabel(this.components);
+            this.ma_prodcode = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
+            this.pr_detail = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
+            this.PrintNum = new UAS_MES.CustomControl.TextBoxWithIcon.NumOnlyTextBox();
+            this.sncode = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
+            this.OperateResult = new UAS_MES.CustomControl.RichText.RichTextAutoBottom();
+            this.ma_code = new System.Windows.Forms.Label();
             this.SuspendLayout();
             // 
             // PrintLabel
@@ -82,10 +82,89 @@
             this.label1.TabIndex = 179;
             this.label1.Text = "标签";
             // 
+            // pr_detail_label
+            // 
+            this.pr_detail_label.AutoSize = true;
+            this.pr_detail_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.pr_detail_label.Location = new System.Drawing.Point(686, 67);
+            this.pr_detail_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.pr_detail_label.Name = "pr_detail_label";
+            this.pr_detail_label.Size = new System.Drawing.Size(110, 31);
+            this.pr_detail_label.TabIndex = 171;
+            this.pr_detail_label.Text = "产品名称";
+            // 
+            // sncode_label
+            // 
+            this.sncode_label.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            | System.Windows.Forms.AnchorStyles.Left)));
+            this.sncode_label.AutoSize = true;
+            this.sncode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.sncode_label.Location = new System.Drawing.Point(29, 678);
+            this.sncode_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.sncode_label.Name = "sncode_label";
+            this.sncode_label.Size = new System.Drawing.Size(86, 31);
+            this.sncode_label.TabIndex = 170;
+            this.sncode_label.Text = "序列号";
+            // 
+            // label4
+            // 
+            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(686, 140);
+            this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label4.Name = "label4";
+            this.label4.Size = new System.Drawing.Size(110, 31);
+            this.label4.TabIndex = 167;
+            this.label4.Text = "打印张数";
+            // 
+            // mcd_remainqty_label
+            // 
+            this.mcd_remainqty_label.AutoSize = true;
+            this.mcd_remainqty_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.mcd_remainqty_label.Location = new System.Drawing.Point(358, 140);
+            this.mcd_remainqty_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.mcd_remainqty_label.Name = "mcd_remainqty_label";
+            this.mcd_remainqty_label.Size = new System.Drawing.Size(86, 31);
+            this.mcd_remainqty_label.TabIndex = 166;
+            this.mcd_remainqty_label.Text = "剩余数";
+            // 
+            // mcd_okqty_label
+            // 
+            this.mcd_okqty_label.AutoSize = true;
+            this.mcd_okqty_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.mcd_okqty_label.Location = new System.Drawing.Point(29, 140);
+            this.mcd_okqty_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.mcd_okqty_label.Name = "mcd_okqty_label";
+            this.mcd_okqty_label.Size = new System.Drawing.Size(110, 31);
+            this.mcd_okqty_label.TabIndex = 165;
+            this.mcd_okqty_label.Text = "打印计数";
+            // 
+            // pr_code_label
+            // 
+            this.pr_code_label.AutoSize = true;
+            this.pr_code_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.pr_code_label.Location = new System.Drawing.Point(358, 67);
+            this.pr_code_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.pr_code_label.Name = "pr_code_label";
+            this.pr_code_label.Size = new System.Drawing.Size(110, 31);
+            this.pr_code_label.TabIndex = 164;
+            this.pr_code_label.Text = "产品编号";
+            // 
+            // ms_makecode_label
+            // 
+            this.ms_makecode_label.AutoSize = true;
+            this.ms_makecode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.ms_makecode_label.Location = new System.Drawing.Point(29, 67);
+            this.ms_makecode_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.ms_makecode_label.Name = "ms_makecode_label";
+            this.ms_makecode_label.Size = new System.Drawing.Size(110, 31);
+            this.ms_makecode_label.TabIndex = 163;
+            this.ms_makecode_label.Text = "归属工单";
+            // 
             // Printer
             // 
             this.Printer.Location = new System.Drawing.Point(1213, 65);
-            this.Printer.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
+            this.Printer.Margin = new System.Windows.Forms.Padding(6);
             this.Printer.Name = "Printer";
             this.Printer.Size = new System.Drawing.Size(228, 37);
             this.Printer.TabIndex = 178;
@@ -112,15 +191,16 @@
             this.mcd_okqty.TabIndex = 176;
             this.mcd_okqty.Text = "0";
             // 
-            // pr_code
+            // ma_prodcode
             // 
-            this.pr_code.AutoSize = true;
-            this.pr_code.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_code.Location = new System.Drawing.Point(501, 67);
-            this.pr_code.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
-            this.pr_code.Name = "pr_code";
-            this.pr_code.Size = new System.Drawing.Size(0, 31);
-            this.pr_code.TabIndex = 175;
+            this.ma_prodcode.AutoSize = true;
+            this.ma_prodcode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.ma_prodcode.Location = new System.Drawing.Point(501, 67);
+            this.ma_prodcode.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.ma_prodcode.Name = "ma_prodcode";
+            this.ma_prodcode.Size = new System.Drawing.Size(0, 31);
+            this.ma_prodcode.TabIndex = 175;
+            this.ma_prodcode.TextChanged += new System.EventHandler(this.pr_code_TextChanged);
             // 
             // pr_detail
             // 
@@ -132,16 +212,6 @@
             this.pr_detail.Size = new System.Drawing.Size(0, 31);
             this.pr_detail.TabIndex = 174;
             // 
-            // ms_makecode
-            // 
-            this.ms_makecode.AutoSize = true;
-            this.ms_makecode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ms_makecode.Location = new System.Drawing.Point(170, 67);
-            this.ms_makecode.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
-            this.ms_makecode.Name = "ms_makecode";
-            this.ms_makecode.Size = new System.Drawing.Size(0, 31);
-            this.ms_makecode.TabIndex = 173;
-            // 
             // PrintNum
             // 
             this.PrintNum.AllPower = null;
@@ -160,30 +230,6 @@
             this.PrintNum.TabIndex = 172;
             this.PrintNum.Text = "1";
             // 
-            // pr_detail_label
-            // 
-            this.pr_detail_label.AutoSize = true;
-            this.pr_detail_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_detail_label.Location = new System.Drawing.Point(686, 67);
-            this.pr_detail_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
-            this.pr_detail_label.Name = "pr_detail_label";
-            this.pr_detail_label.Size = new System.Drawing.Size(110, 31);
-            this.pr_detail_label.TabIndex = 171;
-            this.pr_detail_label.Text = "产品名称";
-            // 
-            // sncode_label
-            // 
-            this.sncode_label.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
-            | System.Windows.Forms.AnchorStyles.Left)));
-            this.sncode_label.AutoSize = true;
-            this.sncode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.sncode_label.Location = new System.Drawing.Point(29, 678);
-            this.sncode_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
-            this.sncode_label.Name = "sncode_label";
-            this.sncode_label.Size = new System.Drawing.Size(86, 31);
-            this.sncode_label.TabIndex = 170;
-            this.sncode_label.Text = "序列号";
-            // 
             // sncode
             // 
             this.sncode.AllPower = "ifall";
@@ -201,6 +247,7 @@
             this.sncode.Str2 = null;
             this.sncode.TabIndex = 169;
             this.sncode.Tag = "ifwrite";
+            this.sncode.KeyDown += new System.Windows.Forms.KeyEventHandler(this.sn_code_KeyDown);
             // 
             // OperateResult
             // 
@@ -212,75 +259,30 @@
             this.OperateResult.TabIndex = 168;
             this.OperateResult.Text = "";
             // 
-            // label4
-            // 
-            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(686, 140);
-            this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
-            this.label4.Name = "label4";
-            this.label4.Size = new System.Drawing.Size(110, 31);
-            this.label4.TabIndex = 167;
-            this.label4.Text = "打印张数";
-            // 
-            // mcd_remainqty_label
-            // 
-            this.mcd_remainqty_label.AutoSize = true;
-            this.mcd_remainqty_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.mcd_remainqty_label.Location = new System.Drawing.Point(358, 140);
-            this.mcd_remainqty_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
-            this.mcd_remainqty_label.Name = "mcd_remainqty_label";
-            this.mcd_remainqty_label.Size = new System.Drawing.Size(86, 31);
-            this.mcd_remainqty_label.TabIndex = 166;
-            this.mcd_remainqty_label.Text = "剩余数";
-            // 
-            // mcd_okqty_label
-            // 
-            this.mcd_okqty_label.AutoSize = true;
-            this.mcd_okqty_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.mcd_okqty_label.Location = new System.Drawing.Point(29, 140);
-            this.mcd_okqty_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
-            this.mcd_okqty_label.Name = "mcd_okqty_label";
-            this.mcd_okqty_label.Size = new System.Drawing.Size(110, 31);
-            this.mcd_okqty_label.TabIndex = 165;
-            this.mcd_okqty_label.Text = "打印计数";
+            // ma_code
             // 
-            // pr_code_label
-            // 
-            this.pr_code_label.AutoSize = true;
-            this.pr_code_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_code_label.Location = new System.Drawing.Point(358, 67);
-            this.pr_code_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
-            this.pr_code_label.Name = "pr_code_label";
-            this.pr_code_label.Size = new System.Drawing.Size(110, 31);
-            this.pr_code_label.TabIndex = 164;
-            this.pr_code_label.Text = "产品编号";
-            // 
-            // ms_makecode_label
-            // 
-            this.ms_makecode_label.AutoSize = true;
-            this.ms_makecode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ms_makecode_label.Location = new System.Drawing.Point(29, 67);
-            this.ms_makecode_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
-            this.ms_makecode_label.Name = "ms_makecode_label";
-            this.ms_makecode_label.Size = new System.Drawing.Size(110, 31);
-            this.ms_makecode_label.TabIndex = 163;
-            this.ms_makecode_label.Text = "归属工单";
+            this.ma_code.AutoSize = true;
+            this.ma_code.Font = new System.Drawing.Font("微软雅黑", 12F);
+            this.ma_code.Location = new System.Drawing.Point(157, 67);
+            this.ma_code.Name = "ma_code";
+            this.ma_code.Size = new System.Drawing.Size(0, 31);
+            this.ma_code.TabIndex = 182;
             // 
             // Make_FuselageLabelPrint
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(1488, 764);
+            this.AutoSize = true;
+            this.ClientSize = new System.Drawing.Size(1468, 731);
+            this.Controls.Add(this.ma_code);
             this.Controls.Add(this.PrintLabel);
             this.Controls.Add(this.label2);
             this.Controls.Add(this.label1);
             this.Controls.Add(this.Printer);
             this.Controls.Add(this.mcd_remainqty);
             this.Controls.Add(this.mcd_okqty);
-            this.Controls.Add(this.pr_code);
+            this.Controls.Add(this.ma_prodcode);
             this.Controls.Add(this.pr_detail);
-            this.Controls.Add(this.ms_makecode);
             this.Controls.Add(this.PrintNum);
             this.Controls.Add(this.pr_detail_label);
             this.Controls.Add(this.sncode_label);
@@ -313,9 +315,8 @@
         private CustomControl.ComBoxWithFocus.PrinterCombox Printer;
         private CustomControl.ValueLabel.ValueNumLabel mcd_remainqty;
         private CustomControl.ValueLabel.ValueNumLabel mcd_okqty;
-        private CustomControl.ValueLabel.ValueLabel pr_code;
+        private CustomControl.ValueLabel.ValueLabel ma_prodcode;
         private CustomControl.ValueLabel.ValueLabel pr_detail;
-        private CustomControl.ValueLabel.ValueLabel ms_makecode;
         private CustomControl.TextBoxWithIcon.NumOnlyTextBox PrintNum;
         private System.Windows.Forms.Label pr_detail_label;
         private System.Windows.Forms.Label sncode_label;
@@ -326,5 +327,6 @@
         private System.Windows.Forms.Label mcd_okqty_label;
         private System.Windows.Forms.Label pr_code_label;
         private System.Windows.Forms.Label ms_makecode_label;
+        private System.Windows.Forms.Label ma_code;
     }
 }

+ 219 - 153
UAS-MES/FunctionCode/Make/Make_FuselageLabelPrint.cs

@@ -20,6 +20,7 @@ namespace UAS_MES.Make
         DataTable ListA = new DataTable();
         //保存make left join makecraftdetail left join product的数据
         // DataTable ListB;
+        DataTable mapB;
         //保存ProductLabel数据
         DataTable ListC;
         //工序编号
@@ -29,7 +30,7 @@ namespace UAS_MES.Make
         //工艺路线编号
         string craftcode;
         //制造单号
-        string ma_code;
+        string make_code;
         //当前工单的序列号
         string sn_code;
         //当前提示的索引
@@ -38,6 +39,8 @@ namespace UAS_MES.Make
         string Step = "Loading";
 
         ApplicationClass lbl;
+        
+        string oErrorMessage = "";
 
         public Make_FuselageLabelPrint()
         {
@@ -54,164 +57,237 @@ namespace UAS_MES.Make
 
         private void sn_code_KeyDown(object sender, KeyEventArgs e)
         {
+            //按下enter键
             if (e.KeyCode == Keys.Enter)
             {
+                //如果输入的值为空的话,提示不能为空
                 if (sncode.Text == "")
                 {
                     OperateResult.AppendText(">>序列号不能为空\n", Color.Red);
                     return;
                 }
-                //通过输入指定字符来设置当前执行的步骤
-                if (sncode.Text == "L")
-                {
-                    Step = " ";
-                    OperateResult.AppendText(">>开始执行上料工序\n", Color.Green);
-                    sncode.Text = "";
-                    return;
-                }
-                else if (sncode.Text == "R")
-                {
-                    Step = "UnLoading";
-                    OperateResult.AppendText(">>开始执行下料工序\n", Color.Green);
-                    sncode.Text = "";
-                    return;
-                }
-                //判断如果该序列号的归属工单和之前查询的是一致的话,就不进行重复数据的查询
-                ma_code = dh.getFieldDataByCondition("makeserial", "ms_makecode", "ms_sncode='" + sncode.Text + "'").ToString();
-                if (ms_makecode.Text != ma_code || ma_code == "")
-                {
-                    //ma_code不为空的时候表示不是第一次加载,提示用户切换工单
-                    if (ma_code != "" && ms_makecode.Text != "")
+                //定义临时变量
+                string oMakeCode = "";
+                string oMsId = "";
+                //调用公共方法CheckStepSNAndMacode判断工序是否正确
+                if (LogicHandler.CheckStepSNAndMacode(ma_code.Text, User.UserSourceCode, sncode.Text,User.UserCode,out oMakeCode,out oMsId, out oErrorMessage)) {
+                    //IF (如果ma_code 为空)THEN
+                    if (ma_code.Text == "")
                     {
-                        OperateResult.AppendText(">>切换工单至工单号" + ma_code + "\n", Color.Red);
-                    }
-                    sql.Clear();
-                    sql.Append("select ma_code,mcd_okqty,ma_qty,ma_qty-mcd_inqty as mcd_remainqty,pr_detail,pr_code ");
-                    sql.Append("from makeserial left join make on ms_makecode=ma_code left join product on ");
-                    sql.Append("ms_prodcode=pr_code left join makecraftdetail on ms_makecode=mcd_macode where ms_sncode=:sncode");
-                    dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select", sncode.Text);
-                    if (dt.Rows.Count > 0)
-                    {
-                        BaseUtil.SetFormValue(this.Controls, dt);
-                        sn_code = sncode.Text;
-                    }
-                    else
-                    {
-                        OperateResult.AppendText(">>序列号" + sncode.Text + "不存在\n", Color.Red);
-                        return;
-                    }
+                        //获取工单的其他信息
+                        sql.Clear();
+                        sql.Append("select ma_code,nvl(mcd_okqty,0),ma_prodcode,pr_detail,");
+                        sql.Append("pr_spec,ma_qty - nvl(mcd_inqty, 0) mcd_remainqty from make left join makecraftdetail on ");
+                        sql.Append("mcd_maid=ma_id left join product on pr_code=ma_prodcode where ma_code='"+oMakeCode+"' and mcd_stepcode='"+User.CurrentStepCode+"'");
+                        mapB = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
+                        //将工单的其他信息赋值到对应的控件
+                        if (mapB.Rows.Count>0) {
+                            BaseUtil.SetFormValue(this.Controls,mapB);
+                        }
 
-                    //判断当前的执行状态 ,Loading表示执行上料操作,UnLoading表示执行下料操作
-                    if (Step == "Loading")
-                    {
+                        //获取对应 产品的机身标的打印模板
                         sql.Clear();
-                        sql.Append("select ma_code,ma_craftcode,ms_nextstepcode, ms_status,ms_stepcode from makeserial ");
-                        sql.Append("left join make on ma_code=ms_makecode where ms_sncode=:sncode or ms_psn=:sncode");
-                        dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select", sncode.Text, sncode.Text);
-                        //记录一些变量
-                        stepcode = dt.Rows[0]["ms_stepcode"].ToString();
-                        nextstepcode = dt.Rows[0]["ms_nextstepcode"].ToString();
-                        craftcode = dt.Rows[0]["ma_craftcode"].ToString();
-                        string ErrorMessage;
-                        bool ifFirst;
-                        //检测当前序列号和岗位资源是否对应
-                        if (LogicHandler.CheckCurrentStepAndIfFirst(sncode.Text, ms_makecode.Text, User.UserSourceCode, Tag.ToString(), out ifFirst, out ErrorMessage))
+                        sql.Append("select * from productlabel where pl_prodcode='"+ma_prodcode.Text+"' and PL_LABELTYPE='彩盒标',");
+                        ListC = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
+                        //查询没有结果就提示
+                        if (ListC.Rows.Count==0) {
+                            OperateResult.AppendText(">>该序列号对应的产品未维护机身标标签模板\n", Color.Red);
+                        }
+
+                        //所选标签不为空
+                        if (PrintLabel.SelectedValue != null)
                         {
-                            //判断当前工序是否是上料工序cd_ifinput或者是否是测试工序cd_iftest
-                            sql.Clear();
-                            sql.Append("select cr_code,cd_stepcode,cd_ifinput,cd_iftest from makeserial left join  craft on ms_craftcode=cr_code left join craftdetail on cd_crid=cr_id and ");
-                            sql.Append("cd_stepcode=ms_nextstepcode where ms_sncode='" + sncode.Text + "' and ms_makecode='" + ms_makecode.Text + "'");
-                            dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-                            if (dt.Rows.Count > 0)
+                            //判断打印数量是否合理
+                            //合理
+                            if (int.Parse(PrintNum.Text) <= int.Parse(mcd_remainqty.Text) && int.Parse(PrintNum.Text) > 0)
                             {
-                                //如果是上料工序
-                                if (dt.Rows[0]["cd_ifinput"].ToString() != "0")
+                                //按照打印张数打印
+                                Print.CodeSoft(lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, sncode.Text, int.Parse(PrintNum.Text));
+                                //提示用户打印成功
+                                OperateResult.AppendText(">>打印成功\n", Color.Green);
+                                //更新打印的数据
+                                LogicHandler.UpdateMakeMessage(sncode.Text, ma_code.Text, "机身标打印", User.UserSourceCode, User.UserName, "机身标打印成功", out oErrorMessage);
+                                //清空输入框的值,聚焦
+                                sncode.Text = "";
+                                sncode.Focus();
+                                //刷新打印数量和剩余数量
+                                mcd_remainqty.Text = int.Parse(mcd_remainqty.Text) - int.Parse(PrintNum.Text) + "";
+                                mcd_okqty.Text = int.Parse(PrintNum.Text)+"";
+
+                                //IF 剩余数=0,则清空form中的数据, 提示用户“工单:xx已经打印完成,>>请输入SN”, 清空mapB,listC 中的数据
+                                if (int.Parse(mcd_remainqty.Text) == 0)
                                 {
-                                    // 查询没有结果,提示该上料工序没有需要上料的数据,请先维护对应的数据
-                                    sql.Clear();
-                                    sql.Append("select sp_id,sp_description,sp_soncode,pr_detail,pr_spec,sp_repcode,pr_id,sp_type,");
-                                    sql.Append("'未采集' sp_ifpick ,sp_prefix,sp_length,sp_regex,sp_regex,sp_ifforsn from stepproduct ");
-                                    sql.Append("left join product on pr_code=sp_soncode  where sp_craftcode='" + dt.Rows[0]["cd_ifinput"].ToString() + "' and sp_stepcode='" + dt.Rows[0]["cd_stepcode"].ToString() + "' ");
-                                    sql.Append("And sp_mothercode='" + pr_code.Text + "' and ((sp_type='物料' and pr_tracekind<>2)or sp_type<>'物料') ");
-                                    sql.Append("order by SP_DETNO asc");
-                                    ListA = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-                                    //获取对应 产品的机身标的打印模板
-                                    if (ListA.Rows.Count > 0)
-                                    {
-                                        OperateResult.AppendText(">>请采集" + ListA.Rows[RemainIndex]["sp_soncode"].ToString() + "的条码\n", Color.Green);
-                                    }
-                                    //未查询到数据时标识是测试工序
-                                    else
-                                    {
-                                        DoTestProcedure();
-                                    }
+                                    BaseUtil.CleanForm(this);
+                                    OperateResult.AppendText(">>工单:"+ma_code.Text+"打印完成,>>请输入SN\n", Color.Green);
                                 }
-                                //同上,如果,iftest不等于0也进入测试工序
-                                else if (dt.Rows[0]["cd_iftest"].ToString() != "0")
-                                {
-                                    DoTestProcedure();
+                                //剩余数量不为0
+                                else {
+                                    //提示用户“>>请输入SN”
+                                    OperateResult.AppendText(">>请输入SN\n", Color.Green);
                                 }
                             }
+                            //打印数量不合理
+                            else
+                            {
+                                OperateResult.AppendText(">>打印数量不合理\n", Color.Red);
+                            }
                         }
-                        else
-                        {
-                            Print.CodeSoft(lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, sncode.Text);
-                            OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
-                        }
-                    }
-                    //如果执行的是下料操作
-                    else if (Step == "UnLoading")
-                    {
-                        string ErrorMessage1 = "";
-                        if (LogicHandler.SetMaterialDown(sn_code, sncode.Text, User.CurrentStepCode, User.UserName, out ErrorMessage1))
-                        {
-                            OperateResult.AppendText(">>条码" + sncode.Text + "下料成功\n", Color.Green);
-                        }
-                        else
-                        {
-                            OperateResult.AppendText(">>" + ErrorMessage1 + "\n", Color.Red);
+                        //标签为空
+                        else {
+                            OperateResult.AppendText(">>无可用标签\n", Color.Red);
                         }
                     }
                 }
-                else
-                {
-                    //如果ListA中没有数据执行的是测试工序
-                    if (ListA.Rows.Count == 0)
-                    {
-                        DoTestProcedure();
-                    }
-                    //存在数据执行的是上料采集
-                    else
-                    {
-                        //如果当前的索引和长度相等则表示采集完成
-                        if (RemainIndex == ListA.Rows.Count - 1)
-                        {
-                            OperateResult.AppendText(">>序列号对应的工单已经采集完成\n", Color.Green);
-                            sn_code = "";
-                            return;
-                        }
-                        string ErrorMessage;
-                        //获取上料需要传递的参数,sp_soncode,sp_id
-                        string soncode = ListA.Rows[RemainIndex]["sp_soncode"].ToString();
-                        string sonID = ListA.Rows[RemainIndex]["sp_id"].ToString();
-                        //执行上料
-                        if (LogicHandler.SetMaterialUp(sn_code, ms_makecode.Text, sncode.Text, soncode, User.UserSourceCode, User.UserName, sonID, out ErrorMessage))
-                        {
-                            RemainIndex = RemainIndex + 1;
-                            OperateResult.AppendText(">>请采集物料编号为" + ListA.Rows[RemainIndex]["sp_soncode"].ToString() + "的条码\n", Color.Green);
-                        }
-                        else
-                        {
-                            OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
-                        }
-                    }
+                else {
+                    OperateResult.AppendText(">>"+oErrorMessage+"\n", Color.Red);
                 }
-            }
-        }
 
-        private void 标签打印_SizeChanged(object sender, EventArgs e)
-        {
-            asc.controlAutoSize(this);
+                //    //通过输入指定字符来设置当前执行的步骤
+                //    if (sncode.Text == "L")
+                //    {
+                //        Step = " ";
+                //        OperateResult.AppendText(">>开始执行上料工序\n", Color.Green);
+                //        sncode.Text = "";
+                //        return;
+                //    }
+                //    else if (sncode.Text == "R")
+                //    {
+                //        Step = "UnLoading";
+                //        OperateResult.AppendText(">>开始执行下料工序\n", Color.Green);
+                //        sncode.Text = "";
+                //        return;
+                //    }
+                //    //判断如果该序列号的归属工单和之前查询的是一致的话,就不进行重复数据的查询
+                //    ma_code = dh.getFieldDataByCondition("makeserial", "ms_makecode", "ms_sncode='" + sncode.Text + "'").ToString();
+                //    if (ms_makecode.Text != ma_code || ma_code == "")
+                //    {
+                //        //ma_code不为空的时候表示不是第一次加载,提示用户切换工单
+                //        if (ma_code != "" && ms_makecode.Text != "")
+                //        {
+                //            OperateResult.AppendText(">>切换工单至工单号" + ma_code + "\n", Color.Red);
+                //        }
+                //        sql.Clear();
+                //        sql.Append("select ma_code,mcd_okqty,ma_qty,ma_qty-mcd_inqty as mcd_remainqty,pr_detail,pr_code ");
+                //        sql.Append("from makeserial left join make on ms_makecode=ma_code left join product on ");
+                //        sql.Append("ms_prodcode=pr_code left join makecraftdetail on ms_makecode=mcd_macode where ms_sncode=:sncode");
+                //        dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select", sncode.Text);
+                //        if (dt.Rows.Count > 0)
+                //        {
+                //            BaseUtil.SetFormValue(this.Controls, dt);
+                //            sn_code = sncode.Text;
+                //        }
+                //        else
+                //        {
+                //            OperateResult.AppendText(">>序列号" + sncode.Text + "不存在\n", Color.Red);
+                //            return;
+                //        }
+
+                //        //判断当前的执行状态 ,Loading表示执行上料操作,UnLoading表示执行下料操作
+                //        if (Step == "Loading")
+                //        {
+                //            sql.Clear();
+                //            sql.Append("select ma_code,ma_craftcode,ms_nextstepcode, ms_status,ms_stepcode from makeserial ");
+                //            sql.Append("left join make on ma_code=ms_makecode where ms_sncode=:sncode or ms_psn=:sncode");
+                //            dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select", sncode.Text, sncode.Text);
+                //            //记录一些变量
+                //            stepcode = dt.Rows[0]["ms_stepcode"].ToString();
+                //            nextstepcode = dt.Rows[0]["ms_nextstepcode"].ToString();
+                //            craftcode = dt.Rows[0]["ma_craftcode"].ToString();
+                //            string ErrorMessage;
+                //            bool ifFirst;
+                //            //检测当前序列号和岗位资源是否对应
+                //            if (LogicHandler.CheckCurrentStepAndIfFirst(sncode.Text, ms_makecode.Text, User.UserSourceCode, Tag.ToString(), out ifFirst, out ErrorMessage))
+                //            {
+                //                //判断当前工序是否是上料工序cd_ifinput或者是否是测试工序cd_iftest
+                //                sql.Clear();
+                //                sql.Append("select cr_code,cd_stepcode,cd_ifinput,cd_iftest from makeserial left join  craft on ms_craftcode=cr_code left join craftdetail on cd_crid=cr_id and ");
+                //                sql.Append("cd_stepcode=ms_nextstepcode where ms_sncode='" + sncode.Text + "' and ms_makecode='" + ms_makecode.Text + "'");
+                //                dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                //                if (dt.Rows.Count > 0)
+                //                {
+                //                    //如果是上料工序
+                //                    if (dt.Rows[0]["cd_ifinput"].ToString() != "0")
+                //                    {
+                //                        // 查询没有结果,提示该上料工序没有需要上料的数据,请先维护对应的数据
+                //                        sql.Clear();
+                //                        sql.Append("select sp_id,sp_description,sp_soncode,pr_detail,pr_spec,sp_repcode,pr_id,sp_type,");
+                //                        sql.Append("'未采集' sp_ifpick ,sp_prefix,sp_length,sp_regex,sp_regex,sp_ifforsn from stepproduct ");
+                //                        sql.Append("left join product on pr_code=sp_soncode  where sp_craftcode='" + dt.Rows[0]["cd_ifinput"].ToString() + "' and sp_stepcode='" + dt.Rows[0]["cd_stepcode"].ToString() + "' ");
+                //                        sql.Append("And sp_mothercode='" + pr_code.Text + "' and ((sp_type='物料' and pr_tracekind<>2)or sp_type<>'物料') ");
+                //                        sql.Append("order by SP_DETNO asc");
+                //                        ListA = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                //                        //获取对应 产品的机身标的打印模板
+                //                        if (ListA.Rows.Count > 0)
+                //                        {
+                //                            OperateResult.AppendText(">>请采集" + ListA.Rows[RemainIndex]["sp_soncode"].ToString() + "的条码\n", Color.Green);
+                //                        }
+                //                        //未查询到数据时标识是测试工序
+                //                        else
+                //                        {
+                //                            DoTestProcedure();
+                //                        }
+                //                    }
+                //                    //同上,如果,iftest不等于0也进入测试工序
+                //                    else if (dt.Rows[0]["cd_iftest"].ToString() != "0")
+                //                    {
+                //                        DoTestProcedure();
+                //                    }
+                //                }
+                //            }
+                //            else
+                //            {
+                //                Print.CodeSoft(lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, sncode.Text);
+                //                OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
+                //            }
+                //        }
+                //        //如果执行的是下料操作
+                //        else if (Step == "UnLoading")
+                //        {
+                //            string ErrorMessage1 = "";
+                //            if (LogicHandler.SetMaterialDown(sn_code, sncode.Text, User.CurrentStepCode, User.UserName, out ErrorMessage1))
+                //            {
+                //                OperateResult.AppendText(">>条码" + sncode.Text + "下料成功\n", Color.Green);
+                //            }
+                //            else
+                //            {
+                //                OperateResult.AppendText(">>" + ErrorMessage1 + "\n", Color.Red);
+                //            }
+                //        }
+                //    }
+                //    else
+                //    {
+                //        //如果ListA中没有数据执行的是测试工序
+                //        if (ListA.Rows.Count == 0)
+                //        {
+                //            DoTestProcedure();
+                //        }
+                //        //存在数据执行的是上料采集
+                //        else
+                //        {
+                //            //如果当前的索引和长度相等则表示采集完成
+                //            if (RemainIndex == ListA.Rows.Count - 1)
+                //            {
+                //                OperateResult.AppendText(">>序列号对应的工单已经采集完成\n", Color.Green);
+                //                sn_code = "";
+                //                return;
+                //            }
+                //            string ErrorMessage;
+                //            //获取上料需要传递的参数,sp_soncode,sp_id
+                //            string soncode = ListA.Rows[RemainIndex]["sp_soncode"].ToString();
+                //            string sonID = ListA.Rows[RemainIndex]["sp_id"].ToString();
+                //            //执行上料
+                //            if (LogicHandler.SetMaterialUp(sn_code, ms_makecode.Text, sncode.Text, soncode, User.UserSourceCode, User.UserName, sonID, out ErrorMessage))
+                //            {
+                //                RemainIndex = RemainIndex + 1;
+                //                OperateResult.AppendText(">>请采集物料编号为" + ListA.Rows[RemainIndex]["sp_soncode"].ToString() + "的条码\n", Color.Green);
+                //            }
+                //            else
+                //            {
+                //                OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
+                //            }
+                //        }
+                //    }
+            }
         }
 
         //执行测试工序
@@ -220,42 +296,37 @@ namespace UAS_MES.Make
             //局部变量ErrorMessage1
             string ErrorMessage1;
             //由于打印驱动暂时不可用,暂时注释打印方法
-            if (LogicHandler.SetCollectionFinish(sncode.Text, ms_makecode.Text, User.UserName, User.UserSourceCode, out ErrorMessage1))
+            if (LogicHandler.SetCollectionFinish(sncode.Text, ma_code.Text, User.UserName, User.UserSourceCode, out ErrorMessage1))
             {
                 sncode.Text = "";
                 //如果值为空默认设置为0
                 if (int.Parse(mcd_remainqty.Text) > 0)
                 {
-                    dh.UpdateByCondition("makecraftdetail", "mcd_okqty=mcd_okqty+1,mcd_inqty=mcd_inqty+1", "mcd_macode='" + ms_makecode.Text + "'");
+                    dh.UpdateByCondition("makecraftdetail", "mcd_okqty=mcd_okqty+1,mcd_inqty=mcd_inqty+1", "mcd_macode='" + ma_code.Text + "'");
                     sql.Clear();
                     sql.Append("select mcd_okqty,ma_qty-mcd_inqty mcd_remainqty from makecraftdetail left join make on ");
-                    sql.Append("ma_code=mcd_macode where mcd_macode='" + ms_makecode.Text + "'");
+                    sql.Append("ma_code=mcd_macode where mcd_macode='" + ma_code.Text + "'");
                     dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                     BaseUtil.SetFormValue(this.Controls, dt);
                     if (mcd_remainqty.Text == "0")
                     {
-                        OperateResult.AppendText(">>工单" + ms_makecode.Text + "采集完成\n", Color.Green);
+                        OperateResult.AppendText(">>工单" + ma_code.Text + "采集完成\n", Color.Green);
                         BaseUtil.CleanForm(this);
                     }
                 }
                 else
                 {
                     BaseUtil.CleanForm(this);
-                    OperateResult.AppendText(">>该序列号所属工单" + ms_makecode.Text + "已全部采集完成\n", Color.Green);
+                    OperateResult.AppendText(">>该序列号所属工单" + ma_code.Text + "已全部采集完成\n", Color.Green);
                 }
             }
             else
                 MessageBox.Show(ErrorMessage1);
         }
 
-        private void 标签打印_Activated(object sender, EventArgs e)
-        {
-            sncode.Focus();
-        }
-
         private void pr_code_TextChanged(object sender, EventArgs e)
         {
-            dt = (DataTable)dh.ExecuteSql("select pl_labelname,pl_labelcode from productlabel where pl_prodcode='" + pr_code.Text + "'", "select");
+            dt = (DataTable)dh.ExecuteSql("select pl_labelname,pl_labelcode from productlabel where pl_prodcode='" + ma_prodcode.Text + "'", "select");
             PrintLabel.DataSource = dt;
             PrintLabel.DisplayMember = "pl_labelname";
             PrintLabel.ValueMember = "pl_labelcode";
@@ -266,11 +337,6 @@ namespace UAS_MES.Make
             }
         }
 
-        private void 标签打印_FormClosing(object sender, FormClosingEventArgs e)
-        {
-            lbl.Quit();
-        }
-
         private void Make_FuselageLabelPrint_Activated(object sender, EventArgs e)
         {
             sncode.Focus();

+ 7 - 4
UAS-MES/FunctionCode/Make/Make_PalletWeigh.cs

@@ -103,7 +103,7 @@ namespace UAS_MES.Make
                     outboxcode.Focus();
                 }
                 else
-                    OperateResult.AppendText(">>" + palletcode_label.Text + palletcode.Text + "不存在\n", Color.Red);
+                    OperateResult.AppendText(">>" + palletcode_label.Text + palletcode.Text + "不存在\n", Color.Red, palletcode);
             }
         }
 
@@ -126,7 +126,7 @@ namespace UAS_MES.Make
                 BaseUtil.SetFormValue(Controls, dt);
                 sncode = dh.getFieldDataByCondition("makeserial left join package on ms_prodcode=pa_prodcode", "ms_sncode", "pa_outboxcode='" + outboxcode.Text + "'").ToString();
                 //检测当前岗位资源和对应工序是否一致
-                if (LogicHandler.CheckCurrentStepAndIfFirst(sncode, pa_makecode.Text,  User.UserSourceCode, Tag.ToString(), out ifFirst, out ErrorMessage))
+                if (LogicHandler.CheckCurrentStepAndIfFirst(sncode, pa_makecode.Text, User.UserSourceCode, Tag.ToString(), out ifFirst, out ErrorMessage))
                 {
                     if (dt.Rows.Count > 0)
                     {
@@ -161,13 +161,16 @@ namespace UAS_MES.Make
                         }
                         //已装满提示用户已装满
                         else
-                            OperateResult.AppendText(">>" + palletcode.Text + "已装满\n", Color.Red);
+                            OperateResult.AppendText(">>" + palletcode.Text + "已装满\n", Color.Red,palletcode);
                     }
                     else
-                        OperateResult.AppendText(">>" + palletcode_label.Text + palletcode.Text + "不存在\n", Color.Red);
+                        OperateResult.AppendText(">>" + palletcode_label.Text + palletcode.Text + "不存在\n", Color.Red,palletcode);
                 }
                 else
+                {
                     OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
+                }
+                outboxcode.Text = "";
             }
         }