ソースを参照

修改彩盒上料打印内容

章政 8 年 前
コミット
cbfcee6dd5

+ 34 - 35
UAS-MES/FunctionCode/Make/Make_ColorBoxLoadPrint.Designer.cs

@@ -36,13 +36,14 @@
             this.label4 = new System.Windows.Forms.Label();
             this.ms_sncode_label = new System.Windows.Forms.Label();
             this.pr_detail_label = new System.Windows.Forms.Label();
-            this.sncode = new System.Windows.Forms.Label();
+            this.PrintLabel_label = new System.Windows.Forms.Label();
             this.label2 = new System.Windows.Forms.Label();
             this.PrintLabel = new System.Windows.Forms.ComboBox();
             this.ms_sncode = new System.Windows.Forms.Label();
             this.load = new System.Windows.Forms.RadioButton();
             this.unload = new System.Windows.Forms.RadioButton();
             this.code_label = new System.Windows.Forms.Label();
+            this.PrintNum = new System.Windows.Forms.NumericUpDown();
             this.code = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.Printer = new UAS_MES.CustomControl.ComBoxWithFocus.PrinterCombox();
             this.mcd_remainqty = new UAS_MES.CustomControl.ValueLabel.ValueNumLabel(this.components);
@@ -50,8 +51,8 @@
             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.OperateResult = new UAS_MES.CustomControl.RichText.RichTextAutoBottom();
+            ((System.ComponentModel.ISupportInitialize)(this.PrintNum)).BeginInit();
             this.SuspendLayout();
             // 
             // ms_makecode_label
@@ -110,7 +111,7 @@
             | System.Windows.Forms.AnchorStyles.Left)));
             this.ms_sncode_label.AutoSize = true;
             this.ms_sncode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ms_sncode_label.Location = new System.Drawing.Point(19, 60);
+            this.ms_sncode_label.Location = new System.Drawing.Point(19, 62);
             this.ms_sncode_label.Name = "ms_sncode_label";
             this.ms_sncode_label.Size = new System.Drawing.Size(58, 21);
             this.ms_sncode_label.TabIndex = 145;
@@ -126,15 +127,15 @@
             this.pr_detail_label.TabIndex = 146;
             this.pr_detail_label.Text = "产品名称";
             // 
-            // sncode
+            // PrintLabel_label
             // 
-            this.sncode.AutoSize = true;
-            this.sncode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.sncode.Location = new System.Drawing.Point(730, 65);
-            this.sncode.Name = "sncode";
-            this.sncode.Size = new System.Drawing.Size(42, 21);
-            this.sncode.TabIndex = 160;
-            this.sncode.Text = "标签";
+            this.PrintLabel_label.AutoSize = true;
+            this.PrintLabel_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.PrintLabel_label.Location = new System.Drawing.Point(730, 62);
+            this.PrintLabel_label.Name = "PrintLabel_label";
+            this.PrintLabel_label.Size = new System.Drawing.Size(42, 21);
+            this.PrintLabel_label.TabIndex = 160;
+            this.PrintLabel_label.Text = "标签";
             // 
             // label2
             // 
@@ -150,8 +151,8 @@
             // 
             this.PrintLabel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
             this.PrintLabel.FormattingEnabled = true;
-            this.PrintLabel.Location = new System.Drawing.Point(808, 65);
-            this.PrintLabel.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.PrintLabel.Location = new System.Drawing.Point(808, 62);
+            this.PrintLabel.Margin = new System.Windows.Forms.Padding(2);
             this.PrintLabel.Name = "PrintLabel";
             this.PrintLabel.Size = new System.Drawing.Size(152, 20);
             this.PrintLabel.TabIndex = 162;
@@ -160,7 +161,7 @@
             // 
             this.ms_sncode.AutoSize = true;
             this.ms_sncode.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.ms_sncode.Location = new System.Drawing.Point(112, 60);
+            this.ms_sncode.Location = new System.Drawing.Point(112, 62);
             this.ms_sncode.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
             this.ms_sncode.Name = "ms_sncode";
             this.ms_sncode.Size = new System.Drawing.Size(0, 21);
@@ -172,7 +173,7 @@
             this.load.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.load.ForeColor = System.Drawing.Color.Blue;
             this.load.Location = new System.Drawing.Point(22, 422);
-            this.load.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.load.Margin = new System.Windows.Forms.Padding(2);
             this.load.Name = "load";
             this.load.Size = new System.Drawing.Size(60, 25);
             this.load.TabIndex = 164;
@@ -186,7 +187,7 @@
             this.unload.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.unload.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
             this.unload.Location = new System.Drawing.Point(126, 422);
-            this.unload.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.unload.Margin = new System.Windows.Forms.Padding(2);
             this.unload.Name = "unload";
             this.unload.Size = new System.Drawing.Size(60, 25);
             this.unload.TabIndex = 165;
@@ -205,6 +206,18 @@
             this.code_label.TabIndex = 167;
             this.code_label.Text = "录入框";
             // 
+            // PrintNum
+            // 
+            this.PrintNum.Location = new System.Drawing.Point(808, 112);
+            this.PrintNum.Name = "PrintNum";
+            this.PrintNum.Size = new System.Drawing.Size(149, 21);
+            this.PrintNum.TabIndex = 168;
+            this.PrintNum.Value = new decimal(new int[] {
+            1,
+            0,
+            0,
+            0});
+            // 
             // code
             // 
             this.code.AllPower = null;
@@ -283,21 +296,6 @@
             this.ms_makecode.Size = new System.Drawing.Size(0, 21);
             this.ms_makecode.TabIndex = 152;
             // 
-            // PrintNum
-            // 
-            this.PrintNum.AllPower = null;
-            this.PrintNum.BackColor = System.Drawing.Color.White;
-            this.PrintNum.ID = null;
-            this.PrintNum.Location = new System.Drawing.Point(808, 112);
-            this.PrintNum.Name = "PrintNum";
-            this.PrintNum.Negative = false;
-            this.PrintNum.Power = null;
-            this.PrintNum.Size = new System.Drawing.Size(154, 21);
-            this.PrintNum.Str = null;
-            this.PrintNum.Str1 = null;
-            this.PrintNum.Str2 = null;
-            this.PrintNum.TabIndex = 151;
-            // 
             // OperateResult
             // 
             this.OperateResult.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@@ -312,6 +310,7 @@
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(969, 452);
+            this.Controls.Add(this.PrintNum);
             this.Controls.Add(this.code_label);
             this.Controls.Add(this.code);
             this.Controls.Add(this.unload);
@@ -319,14 +318,13 @@
             this.Controls.Add(this.ms_sncode);
             this.Controls.Add(this.PrintLabel);
             this.Controls.Add(this.label2);
-            this.Controls.Add(this.sncode);
+            this.Controls.Add(this.PrintLabel_label);
             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.pr_detail);
             this.Controls.Add(this.ms_makecode);
-            this.Controls.Add(this.PrintNum);
             this.Controls.Add(this.pr_detail_label);
             this.Controls.Add(this.ms_sncode_label);
             this.Controls.Add(this.OperateResult);
@@ -342,6 +340,7 @@
             this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.标签打印_FormClosing);
             this.Load += new System.EventHandler(this.标签打印_Load);
             this.SizeChanged += new System.EventHandler(this.标签打印_SizeChanged);
+            ((System.ComponentModel.ISupportInitialize)(this.PrintNum)).EndInit();
             this.ResumeLayout(false);
             this.PerformLayout();
 
@@ -356,14 +355,13 @@
         private CustomControl.RichText.RichTextAutoBottom OperateResult;
         private System.Windows.Forms.Label ms_sncode_label;
         private System.Windows.Forms.Label pr_detail_label;
-        private CustomControl.TextBoxWithIcon.NumOnlyTextBox PrintNum;
         private CustomControl.ValueLabel.ValueLabel ms_makecode;
         private CustomControl.ValueLabel.ValueLabel pr_detail;
         private CustomControl.ValueLabel.ValueLabel pr_code;
         private CustomControl.ValueLabel.ValueNumLabel mcd_okqty;
         private CustomControl.ValueLabel.ValueNumLabel mcd_remainqty;
         private CustomControl.ComBoxWithFocus.PrinterCombox Printer;
-        private System.Windows.Forms.Label sncode;
+        private System.Windows.Forms.Label PrintLabel_label;
         private System.Windows.Forms.Label label2;
         private System.Windows.Forms.ComboBox PrintLabel;
         private System.Windows.Forms.Label ms_sncode;
@@ -371,5 +369,6 @@
         private System.Windows.Forms.RadioButton unload;
         private CustomControl.TextBoxWithIcon.EnterTextBox code;
         private System.Windows.Forms.Label code_label;
+        private System.Windows.Forms.NumericUpDown PrintNum;
     }
 }

+ 118 - 107
UAS-MES/FunctionCode/Make/Make_ColorBoxLoadPrint.cs

@@ -7,6 +7,8 @@ using UAS_MES.DataOperate;
 using UAS_MES.PublicMethod;
 using UAS_MES.Entity;
 using LabelManager2;
+using System.Threading;
+using UAS_MES.PublicForm;
 
 namespace UAS_MES.Make
 {
@@ -27,8 +29,12 @@ namespace UAS_MES.Make
 
         string ErrorMessage = "";
 
+        System.DateTime[] indate;
+
         ApplicationClass lbl;
 
+        Thread InitPrint;
+
         public Make_ColorBoxLoadPrint()
         {
             InitializeComponent();
@@ -40,6 +46,14 @@ namespace UAS_MES.Make
             dh = new DataHelper();
             code.Focus();
             asc.controllInitializeSize(this);
+            InitPrint = new Thread(InPrint);
+            SetLoadingWindow stw = new SetLoadingWindow(InitPrint, "初始化打印程序");
+            BaseUtil.SetFormCenter(stw);
+            stw.ShowDialog();
+        }
+
+        private void InPrint()
+        {
             lbl = new ApplicationClass();
         }
 
@@ -52,129 +66,120 @@ namespace UAS_MES.Make
                     OperateResult.AppendText(">>输入内容不能为空\n", Color.Red);
                     return;
                 }
-                //string Omakecode;
-                //string Omsid;
-                //string Oerrormessage;
-                //LogicHandler.CheckStepSNAndMacode(ms_makecode.Text, User.UserSourceCode, code.Text, User.UserCode, out Omakecode, out Omsid, out Oerrormessage)
-                //通过输入指定字符来设置当前执行的步骤
-                if (load.Checked = true)
-                    OperateResult.AppendText(">>开始执行上料工序\n", Color.Green);
-                else if (unload.Checked = true)
-                    OperateResult.AppendText(">>开始执行下料工序\n", Color.Green);
-                if (ms_makecode.Text == "")
-                {
-                    if (!LogicHandler.GetMakeInfo(code.Text, out ma_code, out ErrorMessage))
-                    {
-                        OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
-                    }
-                }
-                if (ms_makecode.Text != ma_code || ma_code == "")
+                if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out ErrorMessage))
                 {
-                    //ma_code不为空的时候表示不是第一次加载,提示用户切换工单
-                    if (ma_code != "" && ms_makecode.Text != "")
-                    {
-                        OperateResult.AppendText(">>切换工单至工单号" + ma_code + "\n", Color.Red);
-                    }
-                    sql.Clear();
-                    sql.Append("select ma_code as ms_makecode,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", code.Text);
-                    if (dt.Rows.Count > 0)
+                    string Msid;
+                    if (ms_makecode.Text == "")
                     {
-                        BaseUtil.SetFormValue(this.Controls, dt);
-                        sncode.Text = code.Text;
-                    }
-                    else
-                    {
-                        OperateResult.AppendText(">>序列号" + code.Text + "不存在\n", Color.Red);
-                        return;
+                        if (!LogicHandler.GetMakeInfo(code.Text, out ma_code, out ErrorMessage))
+                        {
+                            OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
+                        }
                     }
-                    //判断当前的执行状态 ,Loading表示执行上料操作,UnLoading表示执行下料操作
-                    if (load.Checked = true)
+                    if (ms_makecode.Text != ma_code || ListA.Rows.Count == 0)
                     {
-                        string Omakecode;
-                        string Omsid;
-                        //string Oerrormessage;
-                        //检测当前序列号和岗位资源是否对应
-                        if (LogicHandler.CheckStepSNAndMacode(ms_makecode.Text, User.UserSourceCode, code.Text, User.UserCode, out Omakecode, out Omsid, out ErrorMessage))
+                        if (LogicHandler.CheckStepSNAndMacode(ms_makecode.Text, User.UserSourceCode, code.Text, User.UserCode, out ma_code, out Msid, out ErrorMessage) || ListA.Rows.Count > 0)
                         {
-                            //判断当前工序是否是上料工序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='" + code.Text + "' and ms_makecode='" + ms_makecode.Text + "'");
-                            dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                            sql.Append("select ms_makecode,ms_sncode,ma_qty,pr_detail,pr_code from makeserial left join make on ");
+                            sql.Append("ms_makecode=ma_code left join product on ms_prodcode=pr_code where ms_sncode=:sncode");
+                            dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select", code.Text);
                             if (dt.Rows.Count > 0)
                             {
-                                //如果是上料工序
-                                if (dt.Rows[0]["cd_ifinput"].ToString() != "0")
+                                BaseUtil.SetFormValue(this.Controls, dt);
+                                LoadCollectNum();
+                                if (PrintLabel.SelectedValue == null)
                                 {
-                                    // 查询没有结果,提示该上料工序没有需要上料的数据,请先维护对应的数据
-                                    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]["cr_code"].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);
-                                    }
+                                    OperateResult.AppendText(">>产品编号:" + pr_code.Text + "未维护机身标签\n", Color.Red);
+                                    return;
                                 }
-                                if (dt.Rows[0]["cd_iftest"].ToString() != "0")
+                                ms_sncode.Text = code.Text;
+                            }
+                            //判断当前的执行状态 ,Loading表示执行上料操作,UnLoading表示执行下料操作
+                            if (load.Checked == true)
+                            {
+                                OperateResult.AppendText(">>开始执行上料工序\n");
+                                //判断当前工序是否是上料工序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='" + code.Text + "' and ms_makecode='" + ms_makecode.Text + "'");
+                                dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                                if (dt.Rows.Count > 0)
                                 {
-                                    DoTestProcedure();
+                                    //如果是上料工序
+                                    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]["cr_code"].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");
+                                            code.Clear();
+                                        }
+                                    }
+                                    if (dt.Rows[0]["cd_iftest"].ToString() != "0")
+                                        DoTestProcedure();
                                 }
                             }
+                            //如果执行的是下料操作
+                            else if (unload.Checked == true)
+                            {
+                                OperateResult.AppendText(">>开始执行下料工序\n");
+                                if (LogicHandler.SetMaterialDown(ms_sncode.Text, code.Text, User.UserSourceCode, User.CurrentStepCode, User.UserName, out ErrorMessage))
+                                    OperateResult.AppendText(">>条码" + code.Text + "下料成功\n", Color.Green);
+                                else
+                                    OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
+                            }
                         }
-                        else
-                        {
-                            Print.CodeSoft(lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, code.Text);
-                            OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
-                        }
-                    }
-                    //如果执行的是下料操作
-                    else if (unload.Checked = true)
-                    {
-                        string ErrorMessage1 = "";
-                        if (LogicHandler.SetMaterialDown(sncode.Text, code.Text, User.UserSourceCode, User.CurrentStepCode, User.UserName, out ErrorMessage1))
-                            OperateResult.AppendText(">>条码" + code.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)
+                    else {
+                        //如果ListA中没有数据执行的是测试工序
+                        if (ListA.Rows.Count == 0)
                         {
-                            OperateResult.AppendText(">>序列号"+ms_sncode.Text+"对应的工单已经采集完成\n", Color.Green);
-                            code.Text = "";
-                            return;
+                            DoTestProcedure();
                         }
-                        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(sncode.Text, ms_makecode.Text, code.Text, soncode, User.UserSourceCode, User.UserName, sonID, out ErrorMessage))
+                        //存在数据执行的是上料采集
+                        else
                         {
-                            RemainIndex = RemainIndex + 1;
-                            OperateResult.AppendText(">>请采集物料编号为" + ListA.Rows[RemainIndex]["sp_soncode"].ToString() + "的条码\n", Color.Green);
+                            //获取上料需要传递的参数,sp_soncode,sp_id
+                            string soncode = ListA.Rows[RemainIndex]["sp_soncode"].ToString();
+                            string sonID = ListA.Rows[RemainIndex]["sp_id"].ToString();
+                            if (!dh.CheckExist("barcode", "bar_code='" + code.Text + "' and bar_prodcode='" + soncode + "'"))
+                            {
+                                OperateResult.AppendText(">>必须采集物料编号为" + ListA.Rows[RemainIndex]["sp_soncode"].ToString() + "对应的条码\n", Color.Red);
+                                code.Clear();
+                                return;
+                            }
+                            //执行上料
+                            if (LogicHandler.SetMaterialUp(ms_sncode.Text, ms_makecode.Text, code.Text, soncode, User.UserSourceCode, User.UserName, sonID, out ErrorMessage))
+                            {
+                                RemainIndex = RemainIndex + 1;
+                                code.Clear();
+                                if (RemainIndex <= ListA.Rows.Count - 1)
+                                    OperateResult.AppendText(">>请采集物料编号为" + ListA.Rows[RemainIndex]["sp_soncode"].ToString() + "的条码\n");
+                                if (RemainIndex == ListA.Rows.Count)
+                                {
+                                    OperateResult.AppendText(">>序列号" + ms_sncode.Text + "对应的工单已经采集完成\n", Color.Green);
+                                    Print.CodeSoft(lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, code.Text, int.Parse(PrintNum.Text), indate[PrintLabel.SelectedIndex]);
+                                    RemainIndex = 0;
+                                    code.Clear();
+                                    LoadCollectNum();
+                                    BaseUtil.CleanDataTableData(ListA);
+                                    return;
+                                }
+                            }
+                            else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
                         }
-                        else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
                     }
                 }
+                else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
             }
         }
 
@@ -191,7 +196,6 @@ namespace UAS_MES.Make
             //由于打印驱动暂时不可用,暂时注释打印方法
             if (LogicHandler.SetCollectionFinish(code.Text, ms_makecode.Text, User.UserName, User.UserSourceCode, out ErrorMessage1))
             {
-                sncode.Text = "";
                 //如果值为空默认设置为0
                 if (int.Parse(mcd_remainqty.Text) > 0)
                 {
@@ -213,23 +217,30 @@ namespace UAS_MES.Make
                     OperateResult.AppendText(">>该序列号所属工单" + ms_makecode.Text + "已全部采集完成\n", Color.Green);
                 }
             }
-            else
-                MessageBox.Show(ErrorMessage1);
+            else OperateResult.AppendText(">>" + ErrorMessage1 + "\n", Color.Red);
         }
 
         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 + "' order by pl_isdefault desc", "select");
+            dt = (DataTable)dh.ExecuteSql("select pl_labelname,pl_labelcode,pl_indate,pl_labelurl from productlabel where pl_prodcode='" + pr_code.Text + "' order by pl_isdefault desc", "select");
             PrintLabel.DataSource = dt;
             PrintLabel.DisplayMember = "pl_labelname";
             PrintLabel.ValueMember = "pl_labelcode";
             ftpOperater ftp = new ftpOperater();
+            indate = new System.DateTime[dt.Rows.Count];
             for (int i = 0; i < dt.Rows.Count; i++)
             {
-                ftp.Download(dt.Rows[i]["pl_labelname"].ToString());
+                BaseUtil.GetPrintLabel(dt.Rows[i]["pl_labelname"].ToString(), dt.Rows[i]["pl_labelurl"].ToString(), dt.Rows[i]["pl_indate"].ToString());
+                indate[i] = Convert.ToDateTime(dt.Rows[i]["pl_indate"].ToString());
             }
         }
 
+        private void LoadCollectNum()
+        {
+            dt = (DataTable)dh.ExecuteSql("select ma_qty-mcd_inqty mcd_remainqty from make left join makecraftdetail on mcd_macode=ma_code where ma_code='" + ms_makecode.Text + "' and mcd_stepcode='" + User.CurrentStepCode + "'", "select");
+            BaseUtil.SetFormValue(Controls, dt);
+        }
+
         private void 标签打印_FormClosing(object sender, FormClosingEventArgs e)
         {
             lbl.Quit();