Browse Source

镝泰MES程序调整提交

caosy 5 years ago
parent
commit
a0545f8782

+ 6 - 6
UAS_MES_NEW/CustomControl/TextBoxWithIcon/BlurSearch.cs

@@ -131,10 +131,10 @@ namespace UAS_MES_NEW.CustomControl.TextBoxWithIcon
         {
             if (TableName1 != null && EnterTextBox.Focused)
             {
-                string con = Field1 + " like '%" + EnterTextBox.Text + "%' and rownum<=10 ";
+                string con = Field1 + " like '%" + EnterTextBox.Text + "%'  ";
                 if (condition != "" && condition != null)
                 {
-                    con = Field1 + " like '%" + EnterTextBox.Text + "%' and rownum<=10 and " + condition;
+                    con = Field1 + " like '%" + EnterTextBox.Text + "%' and " + condition;
                 }
                 dt = dh.getFieldsDatasByCondition(TableName1, new string[] { Field1, valueField, "rownum" }, con.ToUpper());
                 if (dt.Rows.Count > 0)
@@ -146,7 +146,7 @@ namespace UAS_MES_NEW.CustomControl.TextBoxWithIcon
                     }
                     //每次数据查询之后将索引重置
                     ItemSelectIndex = 0;
-                    ListBox.Height = ListBox.ItemHeight * (dt.Rows.Count + 1);
+                    ListBox.Height = ListBox.ItemHeight  *10;
                     ListBox.Visible = true;
                     Height = ListBox.Height + EnterTextBox.Height;
                 }
@@ -209,10 +209,10 @@ namespace UAS_MES_NEW.CustomControl.TextBoxWithIcon
 
         private void EnterTextBox_Enter(object sender, EventArgs e)
         {
-            string con = Field1 + " like '%" + EnterTextBox.Text + "%' and rownum<=10 ";
+            string con = Field1 + " like '%" + EnterTextBox.Text + "%' ";
             if (condition != "" && condition != null)
             {
-                con = Field1 + " like '%" + EnterTextBox.Text + "%' and rownum<=10 and " + condition;
+                con = Field1 + " like '%" + EnterTextBox.Text + "%' and " + condition;
             }
             dt = dh.getFieldsDatasByCondition(TableName1, new string[] { Field1, valueField, "rownum" }, con.ToUpper());
             if (dt.Rows.Count > 0)
@@ -224,7 +224,7 @@ namespace UAS_MES_NEW.CustomControl.TextBoxWithIcon
                 }
                 //每次数据查询之后将索引重置
                 ItemSelectIndex = 0;
-                ListBox.Height = ListBox.ItemHeight * (dt.Rows.Count + 1);
+                ListBox.Height = ListBox.ItemHeight * 10;
                 ListBox.Visible = true;
                 Height = ListBox.Height + EnterTextBox.Height;
             }

+ 47 - 26
UAS_MES_NEW/FunctionCode/Make/Make_ColorBoxWeigh.Designer.cs

@@ -78,7 +78,6 @@
             this.StopWeight = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
             this.StartWeight = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
             this.Confirm = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
-            this.ms_makecode = new UAS_MES_NEW.CustomControl.ValueLabel.ValueLabel();
             this.ma_qty = new UAS_MES_NEW.CustomControl.ValueLabel.ValueLabel();
             this.pr_detail = new UAS_MES_NEW.CustomControl.ValueLabel.ValueLabel();
             this.ma_salecode = new UAS_MES_NEW.CustomControl.ValueLabel.ValueLabel();
@@ -86,6 +85,8 @@
             this.normalButton1 = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
             this.sncode = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.SnCollectionBox();
             this.OperateResult = new UAS_MES_NEW.CustomControl.RichText.RichTextAutoBottom();
+            this.LockMakeCode = new UAS_MES_NEW.CustomControl.CustomCheckBox.LockCheckBox();
+            this.ma_code = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.MaCodeSearchTextBox();
             this.panel4.SuspendLayout();
             this.groupBoxWithBorder2.SuspendLayout();
             this.SuspendLayout();
@@ -344,7 +345,7 @@
             this.locksalecode.CheckState = System.Windows.Forms.CheckState.Checked;
             this.locksalecode.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.locksalecode.ForeColor = System.Drawing.Color.Red;
-            this.locksalecode.Location = new System.Drawing.Point(273, 266);
+            this.locksalecode.Location = new System.Drawing.Point(410, 561);
             this.locksalecode.Name = "locksalecode";
             this.locksalecode.Size = new System.Drawing.Size(96, 16);
             this.locksalecode.TabIndex = 204;
@@ -387,7 +388,7 @@
             // 
             this.StepCount.LineCode = null;
             this.StepCount.Location = new System.Drawing.Point(773, 146);
-            this.StepCount.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.StepCount.Margin = new System.Windows.Forms.Padding(2);
             this.StepCount.Name = "StepCount";
             this.StepCount.Size = new System.Drawing.Size(80, 22);
             this.StepCount.Source = null;
@@ -454,7 +455,7 @@
             // 
             this.ob_checkno_label.AutoSize = true;
             this.ob_checkno_label.Font = new System.Drawing.Font("微软雅黑", 13F);
-            this.ob_checkno_label.Location = new System.Drawing.Point(20, 73);
+            this.ob_checkno_label.Location = new System.Drawing.Point(19, 72);
             this.ob_checkno_label.Name = "ob_checkno_label";
             this.ob_checkno_label.Size = new System.Drawing.Size(82, 24);
             this.ob_checkno_label.TabIndex = 180;
@@ -464,7 +465,7 @@
             // 
             this.ob_checkno.AutoSize = true;
             this.ob_checkno.Font = new System.Drawing.Font("微软雅黑", 13F);
-            this.ob_checkno.Location = new System.Drawing.Point(114, 73);
+            this.ob_checkno.Location = new System.Drawing.Point(113, 72);
             this.ob_checkno.Name = "ob_checkno";
             this.ob_checkno.Size = new System.Drawing.Size(0, 24);
             this.ob_checkno.TabIndex = 179;
@@ -474,7 +475,7 @@
             // 
             this.ob_nowcheckqty.AutoSize = true;
             this.ob_nowcheckqty.Font = new System.Drawing.Font("微软雅黑", 13F);
-            this.ob_nowcheckqty.Location = new System.Drawing.Point(289, 27);
+            this.ob_nowcheckqty.Location = new System.Drawing.Point(288, 26);
             this.ob_nowcheckqty.Name = "ob_nowcheckqty";
             this.ob_nowcheckqty.Size = new System.Drawing.Size(0, 24);
             this.ob_nowcheckqty.TabIndex = 178;
@@ -483,7 +484,7 @@
             // 
             this.ob_batchqty.AutoSize = true;
             this.ob_batchqty.Font = new System.Drawing.Font("微软雅黑", 13F);
-            this.ob_batchqty.Location = new System.Drawing.Point(114, 27);
+            this.ob_batchqty.Location = new System.Drawing.Point(113, 26);
             this.ob_batchqty.Name = "ob_batchqty";
             this.ob_batchqty.Size = new System.Drawing.Size(0, 24);
             this.ob_batchqty.TabIndex = 177;
@@ -492,7 +493,7 @@
             // 
             this.ob_nowcheckqty_label.AutoSize = true;
             this.ob_nowcheckqty_label.Font = new System.Drawing.Font("微软雅黑", 13F);
-            this.ob_nowcheckqty_label.Location = new System.Drawing.Point(195, 27);
+            this.ob_nowcheckqty_label.Location = new System.Drawing.Point(194, 26);
             this.ob_nowcheckqty_label.Name = "ob_nowcheckqty_label";
             this.ob_nowcheckqty_label.Size = new System.Drawing.Size(82, 24);
             this.ob_nowcheckqty_label.TabIndex = 176;
@@ -502,7 +503,7 @@
             // 
             this.ob_batchqty_label.AutoSize = true;
             this.ob_batchqty_label.Font = new System.Drawing.Font("微软雅黑", 13F);
-            this.ob_batchqty_label.Location = new System.Drawing.Point(20, 27);
+            this.ob_batchqty_label.Location = new System.Drawing.Point(19, 26);
             this.ob_batchqty_label.Name = "ob_batchqty_label";
             this.ob_batchqty_label.Size = new System.Drawing.Size(82, 24);
             this.ob_batchqty_label.TabIndex = 175;
@@ -640,18 +641,6 @@
             this.Confirm.UseVisualStyleBackColor = true;
             this.Confirm.Click += new System.EventHandler(this.Confirm_Click);
             // 
-            // ms_makecode
-            // 
-            this.ms_makecode.AutoSize = true;
-            this.ms_makecode.CutLength = null;
-            this.ms_makecode.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ms_makecode.Location = new System.Drawing.Point(129, 261);
-            this.ms_makecode.MaximumSize = new System.Drawing.Size(150, 0);
-            this.ms_makecode.Name = "ms_makecode";
-            this.ms_makecode.Size = new System.Drawing.Size(0, 27);
-            this.ms_makecode.TabIndex = 77;
-            this.ms_makecode.Tag = "1";
-            // 
             // ma_qty
             // 
             this.ma_qty.AutoSize = true;
@@ -749,11 +738,43 @@
             this.OperateResult.TabIndex = 58;
             this.OperateResult.Text = "";
             // 
+            // LockMakeCode
+            // 
+            this.LockMakeCode.AutoSize = true;
+            this.LockMakeCode.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.LockMakeCode.LeaveEvent = false;
+            this.LockMakeCode.Location = new System.Drawing.Point(280, 268);
+            this.LockMakeCode.Name = "LockMakeCode";
+            this.LockMakeCode.Size = new System.Drawing.Size(51, 21);
+            this.LockMakeCode.TabIndex = 206;
+            this.LockMakeCode.Text = "锁定";
+            this.LockMakeCode.UseVisualStyleBackColor = true;
+            // 
+            // ma_code
+            // 
+            this.ma_code.AllPower = null;
+            this.ma_code.Caller = null;
+            this.ma_code.Condition = null;
+            this.ma_code.DBTitle = null;
+            this.ma_code.FormName = null;
+            this.ma_code.Location = new System.Drawing.Point(114, 267);
+            this.ma_code.Name = "ma_code";
+            this.ma_code.Power = null;
+            this.ma_code.ReturnData = null;
+            this.ma_code.SelectField = null;
+            this.ma_code.SetValueField = null;
+            this.ma_code.Size = new System.Drawing.Size(149, 21);
+            this.ma_code.TabIndex = 205;
+            this.ma_code.TableName = null;
+            this.ma_code.TextBoxEnable = true;
+            // 
             // Make_ColorBoxWeigh
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1013, 584);
+            this.Controls.Add(this.LockMakeCode);
+            this.Controls.Add(this.ma_code);
             this.Controls.Add(this.locksalecode);
             this.Controls.Add(this.CollectRemark);
             this.Controls.Add(this.Remark);
@@ -782,7 +803,6 @@
             this.Controls.Add(this.StopWeight);
             this.Controls.Add(this.StartWeight);
             this.Controls.Add(this.Confirm);
-            this.Controls.Add(this.ms_makecode);
             this.Controls.Add(this.ma_qty);
             this.Controls.Add(this.pr_detail);
             this.Controls.Add(this.ma_salecode);
@@ -804,11 +824,11 @@
             this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.彩盒称重_FormClosing);
             this.Load += new System.EventHandler(this.Make_ColorBoxWeigh_Load);
             this.SizeChanged += new System.EventHandler(this.彩盒称重_SizeChanged);
-            this.panel4.ResumeLayout(true);
+            this.panel4.ResumeLayout(false);
             this.panel4.PerformLayout();
-            this.groupBoxWithBorder2.ResumeLayout(true);
+            this.groupBoxWithBorder2.ResumeLayout(false);
             this.groupBoxWithBorder2.PerformLayout();
-            this.ResumeLayout(true);
+            this.ResumeLayout(false);
             this.PerformLayout();
 
         }
@@ -832,7 +852,6 @@
         private CustomControl.ValueLabel.ValueLabel ma_salecode;
         private CustomControl.ValueLabel.ValueLabel pr_detail;
         private CustomControl.ValueLabel.ValueLabel ma_qty;
-        private CustomControl.ValueLabel.ValueLabel ms_makecode;
         private CustomControl.ValueLabel.ValueLabel pr_code;
         private CustomControl.ValueLabel.ValueLabel pr_colorboxgw;
         private CustomControl.ButtonUtil.NormalButton Confirm;
@@ -870,5 +889,7 @@
         private System.Windows.Forms.CheckBox CollectRemark;
         private System.Windows.Forms.CheckBox locksalecode;
         public System.Windows.Forms.Label ob_checkno;
+        private CustomControl.CustomCheckBox.LockCheckBox LockMakeCode;
+        private CustomControl.TextBoxWithIcon.MaCodeSearchTextBox ma_code;
     }
 }

+ 49 - 20
UAS_MES_NEW/FunctionCode/Make/Make_ColorBoxWeigh.cs

@@ -38,6 +38,8 @@ namespace UAS_MES_NEW.Make
         string LastSncode;
         bool WeightChange = false;
 
+        DataTable Dbfind;
+
         Regex re = new Regex("\\d+.\\d+\\w+");
 
         string ErrorMessage;
@@ -62,6 +64,16 @@ namespace UAS_MES_NEW.Make
             SetLoadingWindow stw = new SetLoadingWindow(InitPrint, "初始化打印程序");
             BaseUtil.SetFormCenter(stw);
             stw.ShowDialog();
+            //设置锁定工单
+            LockMakeCode.GetMakeCodeCtl(ma_code);
+            ma_code.SetLockCheckBox(LockMakeCode);
+            //工单号放大镜配置
+            ma_code.TableName = "make left join product on ma_prodcode=pr_code";
+            ma_code.SelectField = "ma_code # 工单号,pr_code # 产品编号,pr_detail # 产品名称";
+            ma_code.FormName = Name;
+            ma_code.SetValueField = new string[] { "ma_code", "pr_code", "pr_detail" };
+            ma_code.Condition = "ma_statuscode='STARTED'";
+            ma_code.DbChange += Ma_code_DbChange;
             StartWeight.PerformClick();
             dh = SystemInf.dh;
             StepCount.StepCode = User.CurrentStepCode;
@@ -71,6 +83,22 @@ namespace UAS_MES_NEW.Make
             StepCount.Start();
         }
 
+        private void Ma_code_DbChange(object sender, EventArgs e)
+        {
+            Dbfind = ma_code.ReturnData;
+            BaseUtil.SetFormValue(this.Controls, Dbfind);
+            //获取工单的其他信息
+            sql.Clear();
+            sql.Append("select ma_code,nvl(mcd_okqty,0) mcd_okqty,ma_prodcode as pr_code ,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='" + ma_code.Text + "' and mcd_stepcode='" + User.CurrentStepCode + "'");
+            dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+            if (dt.Rows.Count > 0)
+            {
+                BaseUtil.SetFormValue(this.Controls, dt);
+            }
+        }
+
         private void InPrint()
         {
             try
@@ -90,8 +118,18 @@ namespace UAS_MES_NEW.Make
             {
                 if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out ErrorMessage))
                 {
+                   string oMakeCode = "";
+                   string oMsID = "";
+                   if (LogicHandler.CheckStepSNAndMacode(ma_code.Text, User.UserSourceCode, sncode.Text, User.UserCode, out oMakeCode, out oMsID, out ErrorMessage))
+                   {
+                      //string nextstepcode = dh.getFieldDataByCondition("makeserial", "ms_nextstepcode", "ms_id='" + oMsID + "'").ToString();
+                      //if (nextstepcode != User.CurrentStepCode)
+                      //{
+                      //    OperateResult.AppendText("<<序列号:" + sncode.Text + "下一工序是" + nextstepcode + ",不是当前岗位的工序\n", Color.Red, sncode);
+                      //    return;
+                      //}
                     sql.Clear();
-                    sql.Append("select ms_makecode,ma_qty,ma_salecode,pr_detail,pr_colorboxunit,pr_code,pr_colorboxgw,");
+                    sql.Append("select ms_makecode ma_code,ma_qty,ma_salecode,pr_detail,pr_colorboxunit,pr_code,pr_colorboxgw,");
                     sql.Append("pr_colorboxunit,pr_colorboxmaxw,pr_colorboxminw,nvl(PR_CHECKCOLORBOXW,'0') PR_CHECKCOLORBOXW,nvl(pr_sendchecktype,'LineCode')");
                     sql.Append("pr_sendchecktype from makeserial left join make on ms_makecode=ma_code left join product on ");
                     sql.Append("ms_prodcode=pr_code where ms_sncode='" + sncode.Text + "' order by ms_id desc");
@@ -121,16 +159,7 @@ namespace UAS_MES_NEW.Make
                             pr_colorboxgw.Text = Weight + "±" + (MaxWeight - Weight) + dt.Rows[0]["pr_colorboxunit"].ToString();
                         else
                             pr_colorboxgw.Text = MinWeight + "-" + MaxWeight + dt.Rows[0]["pr_colorboxunit"].ToString();
-                        string oMakeCode = "";
-                        string oMsID = "";
-                        if (LogicHandler.CheckStepSNAndMacode(ms_makecode.Text, User.UserSourceCode, sncode.Text, User.UserCode, out oMakeCode, out oMsID, out ErrorMessage))
-                        {
-                            string nextstepcode = dh.getFieldDataByCondition("makeserial", "ms_nextstepcode", "ms_id='" + oMsID + "'").ToString();
-                            if (nextstepcode != User.CurrentStepCode)
-                            {
-                                OperateResult.AppendText("<<序列号:" + sncode.Text + "下一工序是" + nextstepcode + ",不是当前岗位的工序\n", Color.Red, sncode);
-                                return;
-                            }
+                    
                             //如果未打开串口设置为0
                             //if (pr_colorboxunit.Text == "kg" && !WeightChange)
                             //{
@@ -148,21 +177,21 @@ namespace UAS_MES_NEW.Make
                                 if ((ActualWeight >= MinWeight) && (ActualWeight <= MaxWeight))
                                 {
                                     OperateResult.AppendText(">>彩盒" + sncode.Text + "重量检测检测合格\n", Color.Green);
-                                    LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode.Text, User.UserLineCode, User.UserSourceCode, "彩盒称重:" + weight.Text, "称量合格", sncode.Text, "");
+                                    LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "彩盒称重:" + weight.Text, "称量合格", sncode.Text, "");
                                     LogicHandler.RecordProdWeight(sncode.Text, "SN", float.Parse(ActualWeight.ToString()), "kg", User.UserLineCode, pr_code.Text, User.UserSourceCode, User.UserName);
                                     dh.ExecuteSql("update makeserial set ms_grossw='" + ActualWeight + "' where ms_id='" + oMsID + "'", "update");
                                 }
                                 else
                                 {
                                     OperateResult.AppendText(">>彩盒" + sncode.Text + "重量检测未通过\n", Color.Red);
-                                    LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode.Text, User.UserLineCode, User.UserSourceCode, "彩盒称重:" + weight.Text, "称量不合格", sncode.Text, "");
+                                    LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "彩盒称重:" + weight.Text, "称量不合格", sncode.Text, "");
                                     LogicHandler.RecordProdWeight(sncode.Text, "SN", float.Parse(ActualWeight.ToString()), "kg", User.UserLineCode, pr_code.Text, User.UserSourceCode, User.UserName);
                                     return;
                                 }
                             }
                             else
                             {
-                                LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode.Text, User.UserLineCode, User.UserSourceCode, "彩盒称重:" + weight.Text, "称量完成", sncode.Text, "");
+                                LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "彩盒称重:" + weight.Text, "称量完成", sncode.Text, "");
                                 LogicHandler.RecordProdWeight(sncode.Text, "SN", float.Parse(ActualWeight.ToString()), "kg", User.UserLineCode, pr_code.Text, User.UserSourceCode, User.UserName);
                                 dh.ExecuteSql("update makeserial set ms_grossw='" + ActualWeight + "' where ms_id='" + oMsID + "'", "update");
                             }
@@ -173,7 +202,7 @@ namespace UAS_MES_NEW.Make
                             WeighRecord.Items.Add(lsi);
                             OperateResult.AppendText(">>彩盒" + sncode.Text + "称重完成\n", Color.Green);
                             //显示最近的三个称量记录
-                            if (LogicHandler.SetStepResult(ms_makecode.Text, User.UserSourceCode, sncode.Text, "彩盒称量", "称量合格", User.UserCode, out ErrorMessage))
+                            if (LogicHandler.SetStepResult(ma_code.Text, User.UserSourceCode, sncode.Text, "彩盒称量", "称量合格", User.UserCode, out ErrorMessage))
                             {
                                 //提示正确返回时传递的信息
                                 if (ErrorMessage.Contains("AFTERSUCCESS"))
@@ -197,7 +226,7 @@ namespace UAS_MES_NEW.Make
                         }
                         else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, sncode);
                     }
-                    else OperateResult.AppendText(">>序列号不存在\n", Color.Red, sncode);
+                    else OperateResult.AppendText(">>"+ErrorMessage+"\n", Color.Red, sncode);
                 }
                 else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, sncode);
             }
@@ -272,7 +301,7 @@ namespace UAS_MES_NEW.Make
             {
                 //doc = lbl.Documents.Open(PrintLabel.Text);
                 string oErrorMessage;
-                if (!Print.CodeSoft(Tag.ToString(), ref lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, sncode.Text, int.Parse(PrintNum.Text), ms_makecode.Text, pr_code.Text, "彩盒标", "0", out oErrorMessage))
+                if (!Print.CodeSoft(Tag.ToString(), ref lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, sncode.Text, int.Parse(PrintNum.Text), ma_code.Text, pr_code.Text, "彩盒标", "0", out oErrorMessage))
                 {
                     OperateResult.AppendText(oErrorMessage + "\n", Color.Red);
                 }
@@ -333,9 +362,9 @@ namespace UAS_MES_NEW.Make
             ob_nowcheckqty.ForeColor = Color.Black;
             SendCheck.Enabled = false;
             OperateResult.AppendText(">>批次" + ob_checkno.Text + "送检成功\n", Color.Green);
-            LogicHandler.InsertMakeProcess(LastSncode, ms_makecode.Text, User.UserSourceCode, "手动送检", "手动送检成功", User.UserCode);
+            LogicHandler.InsertMakeProcess(LastSncode, ma_code.Text, User.UserSourceCode, "手动送检", "手动送检成功", User.UserCode);
             //记录操作日志
-            LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode.Text, User.UserLineCode, User.UserSourceCode, "手动送检", "手动送检成功", "", ob_checkno.Text);
+            LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "手动送检", "手动送检成功", "", ob_checkno.Text);
             ob_checkno.Text = "";
         }
 
@@ -441,7 +470,7 @@ namespace UAS_MES_NEW.Make
 
         private void LoadCollectedNum()
         {
-            dt = (DataTable)dh.ExecuteSql("select mcd_inqty,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");
+            dt = (DataTable)dh.ExecuteSql("select mcd_inqty,ma_qty-mcd_inqty mcd_remainqty from make left join makecraftdetail on mcd_macode=ma_code where ma_code='" + ma_code.Text + "' and mcd_stepcode='" + User.CurrentStepCode + "'", "select");
             BaseUtil.SetFormValue(Controls, dt);
         }
     }

+ 39 - 17
UAS_MES_NEW/FunctionCode/OQC/OQC_BatchResultJudge.Designer.cs

@@ -46,6 +46,8 @@
             this.Remark = new System.Windows.Forms.RichTextBox();
             this.label5 = new System.Windows.Forms.Label();
             this.ob_status_label = new System.Windows.Forms.Label();
+            this.normalButton1 = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
+            this.ob_maxngacceptqty = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.ob_status = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.ob_source = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.ob_id = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.EnterTextBox();
@@ -69,7 +71,6 @@
             this.WithdrawRejection = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
             this.BatchPass = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
             this.Clean = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
-            this.ob_maxngacceptqty = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.SuspendLayout();
             // 
             // ob_batchqty_label
@@ -221,6 +222,7 @@
             this.Remark.Name = "Remark";
             this.Remark.Size = new System.Drawing.Size(411, 225);
             this.Remark.TabIndex = 225;
+            this.Remark.Tag = "Remark";
             this.Remark.Text = "";
             // 
             // label5
@@ -243,6 +245,39 @@
             this.ob_status_label.TabIndex = 232;
             this.ob_status_label.Text = "批次状态";
             // 
+            // normalButton1
+            // 
+            this.normalButton1.AllPower = null;
+            this.normalButton1.BackColor = System.Drawing.Color.Transparent;
+            this.normalButton1.DownImage = ((System.Drawing.Image)(resources.GetObject("normalButton1.DownImage")));
+            this.normalButton1.Image = null;
+            this.normalButton1.IsShowBorder = true;
+            this.normalButton1.Location = new System.Drawing.Point(428, 396);
+            this.normalButton1.MoveImage = ((System.Drawing.Image)(resources.GetObject("normalButton1.MoveImage")));
+            this.normalButton1.Name = "normalButton1";
+            this.normalButton1.NormalImage = ((System.Drawing.Image)(resources.GetObject("normalButton1.NormalImage")));
+            this.normalButton1.Power = null;
+            this.normalButton1.Size = new System.Drawing.Size(75, 28);
+            this.normalButton1.TabIndex = 234;
+            this.normalButton1.Text = "保存备注";
+            this.normalButton1.UseVisualStyleBackColor = false;
+            this.normalButton1.Click += new System.EventHandler(this.normalButton1_Click);
+            // 
+            // ob_maxngacceptqty
+            // 
+            this.ob_maxngacceptqty.AllPower = "";
+            this.ob_maxngacceptqty.BackColor = System.Drawing.Color.White;
+            this.ob_maxngacceptqty.ID = null;
+            this.ob_maxngacceptqty.Location = new System.Drawing.Point(201, 398);
+            this.ob_maxngacceptqty.Name = "ob_maxngacceptqty";
+            this.ob_maxngacceptqty.Power = "";
+            this.ob_maxngacceptqty.Size = new System.Drawing.Size(194, 21);
+            this.ob_maxngacceptqty.Str = null;
+            this.ob_maxngacceptqty.Str1 = null;
+            this.ob_maxngacceptqty.Str2 = null;
+            this.ob_maxngacceptqty.TabIndex = 233;
+            this.ob_maxngacceptqty.Tag = "NoAuto";
+            // 
             // ob_status
             // 
             this.ob_status.AllPower = null;
@@ -628,26 +663,12 @@
             this.Clean.UseVisualStyleBackColor = true;
             this.Clean.Click += new System.EventHandler(this.Clean_Click);
             // 
-            // ob_maxngacceptqty
-            // 
-            this.ob_maxngacceptqty.AllPower = "";
-            this.ob_maxngacceptqty.BackColor = System.Drawing.Color.White;
-            this.ob_maxngacceptqty.ID = null;
-            this.ob_maxngacceptqty.Location = new System.Drawing.Point(201, 398);
-            this.ob_maxngacceptqty.Name = "ob_maxngacceptqty";
-            this.ob_maxngacceptqty.Power = "";
-            this.ob_maxngacceptqty.Size = new System.Drawing.Size(194, 21);
-            this.ob_maxngacceptqty.Str = null;
-            this.ob_maxngacceptqty.Str1 = null;
-            this.ob_maxngacceptqty.Str2 = null;
-            this.ob_maxngacceptqty.TabIndex = 233;
-            this.ob_maxngacceptqty.Tag = "NoAuto";
-            // 
             // OQC_BatchResultJudge
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(975, 537);
+            this.Controls.Add(this.normalButton1);
             this.Controls.Add(this.ob_maxngacceptqty);
             this.Controls.Add(this.ob_status_label);
             this.Controls.Add(this.ob_status);
@@ -696,7 +717,7 @@
             this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.OQC_BatchResultJudge_FormClosing);
             this.Load += new System.EventHandler(this.抽检批维护_Load);
             this.SizeChanged += new System.EventHandler(this.抽检批维护_SizeChanged);
-            this.ResumeLayout(true);
+            this.ResumeLayout(false);
             this.PerformLayout();
 
         }
@@ -743,5 +764,6 @@
         private CustomControl.TextBoxWithIcon.EnterTextBox ob_status;
         private System.Windows.Forms.Label ob_status_label;
         private CustomControl.TextBoxWithIcon.EnterTextBox ob_maxngacceptqty;
+        private CustomControl.ButtonUtil.NormalButton normalButton1;
     }
 }

+ 13 - 0
UAS_MES_NEW/FunctionCode/OQC/OQC_BatchResultJudge.cs

@@ -348,5 +348,18 @@ namespace UAS_MES_NEW.OQC
         {
             dh.Dispose();
         }
+
+        private void normalButton1_Click(object sender, EventArgs e)
+        {
+            if (ob_checkno.Text != "")
+            {
+                dh.UpdateByCondition("oqcbatch", "ob_remark = '" + Remark.Text + "'", "ob_checkno = '" + ob_checkno.Text + "'");
+                OperateResult.AppendText(">>抽检批" + ob_checkno.Text + "备注维护完成\n", Color.Green);
+            }
+            else
+            {
+                OperateResult.AppendText(">>抽检批号不可为空\n", Color.Red);
+            }
+        }
     }
 }

+ 38 - 0
UAS_MES_NEW/FunctionCode/OQC/OQC_BatchResultJudge.resx

@@ -118,6 +118,44 @@
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
   <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+  <data name="normalButton1.DownImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
+        dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAFcSURBVFhH5di7UsJAFMbxtDT6QMI76IAFT0npIE0K
+        GcRORxHklpAIBHLfbILV8XxeNsMznJ35F5vu+82kWYuILD4N7oq75roCw27sb/x5WBdc27btntY64o/i
+        DnZjPxy4S6A0R6PHO1WUNHc9ep4uxIXd2D8eP/XZowWUThBG+n3p0stsKbbJ0qFDFFfscQuUbpzm9Pqx
+        Eh8c4PGLkuX0Nl+LDw4GJckUTRaO+OBQo+SKpitXfHAwKClfZuuN+OBgUDJV0NzxxAeHM5TFxhffGUpe
+        aFp5n+KDg0FRfHH8nfjgUKPoktztXnxwMCgFX7xdID441ChlRf7+ID44GBTNl21wFB8capSqot0xFB8c
+        /lE6Wa70IU5oH0Ziw/5cFebpoPUwHPbL04nCJKUgisWF3dgPB3gABc9v7fvBoBcnaVKdvkha2I39cPjx
+        oPrhusndcPinpIXd2N8gIusbTaFspKtR2SQAAAAASUVORK5CYII=
+</value>
+  </data>
+  <data name="normalButton1.MoveImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
+        dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAFzSURBVFhH5djNSgJRGMZxL2P2gTfQFbZvHSEZFBEW
+        CEIQBEIgVFiS9qXWoDmp4/fHzDmjM2a+vU/QqUVX0DvwXxxn9fwYXJwYEcXWNzIWt83dcq7AsBv7LXgA
+        ZI0r71/aaqjCJf8o7sFu7IcDFwdK4vimrv1oSZXRnArdQFzYjf3pQkOzRxIoVWc6X5X6M7ruBGIr9mbU
+        9MIVe9hAcXvBO125WnxwgMcXSpcPF20tPjgYlI5eUK6lxAcHg9Lmw3nTFx8cDEpLLSjr+OKDg0FpqojO
+        Gp744GBQ3vyITutT8cHBoDheRCe1ifjgYFBe+ZCxJ+KDg0GpT0NKv4zFBweDUpuEdFQdiQ8OBsXmw2Fl
+        JD44/KCM53TwNBQfHAzKMx/2Hgfig8M3SrXYUasUfz67DwOxYf9dV5urg+RWzta4aEnxn83OfV9c2I39
+        cIAHUOJceTNbUfmW94GX0sJu7IcDPH5fXCe4EvfXxe5/D7ux3yKi2CfkPhTy27lqkwAAAABJRU5ErkJg
+        gg==
+</value>
+  </data>
+  <data name="normalButton1.NormalImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
+        dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAGVSURBVFhH5di7agJRFIXhDSKoYBQEC8FCECwEQRBE
+        4uUVEtTiPKVlom2wttM6IfF+15njXHRnL19jD/zFmanWV8zAEDNTp9OJS6/Sm2QUht3YH4cHtdvtF6k7
+        mUwG1tqd3FR3YTf2w0FKUVOu6XT68Xgw3+8PtWH/bDYbCkeLGo1Gz/d9JwzvrL0gCKx49KlerxtIBUGo
+        PjjAg2q1mqDc2fN99cEBHlStVk0oB+t56oMDPKhSqZggDNm1N/XBAR5ULpeNvGD46rrqgwM8qFQqGV8O
+        56ujPjjAg4rFosFL5ni5qA8O8KBCoWBuns/701l9cIAH5fN5QfF4dzipDw7woFwuZ+zN483+oD44wIOy
+        2azB52i13asPDvCgTCZjHGt5sdmqDw7woHQ6bRzX8ny1UR8c4EHJZNJc5fC7XKsPDvCgRCLR2x9Pzt9q
+        zT+Lpdqw/3A6W/HoUywWa32Nx8OL4zwffM8X6sJu7IcDPCgajaak7udoNNjsdgc81BZ2Yz8c4PH8cR2J
+        ROJSU3qXjMKwG/vjzEz/skOI3Zqgv7AAAAAASUVORK5CYII=
+</value>
+  </data>
   <data name="GetBatch.DownImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m

+ 2 - 1
UAS_MES_NEW/FunctionCode/OQC/OQC_SamplingDataCollection.cs

@@ -311,7 +311,8 @@ namespace UAS_MES_NEW.OQC
                             sql.Append("select makebad_seq.nextval,ma_code,ms_code,ms_sncode,'" + User.UserCode + "',sysdate,'" + User.CurrentStepCode + "',ms_sourcecode,:bc_code,:bg_code,'',");
                             sql.Append("sp_soncode,:bc_name,'0',:bg_name from make left join makeSerial on ms_makecode=ma_code left join stepProduct on ");
                             sql.Append("sp_mothercode=ma_prodcode and sp_stepcode=ms_nextstepcode where ms_sncode='" + sncode.Text + "' and ms_makecode='" + ob_makecode.Text + "'");
-                            dh.BatchInsert(sql.GetString(), new string[] { "bc_name", "bc_code", "bg_code", "bg_name" }, bc_name.ToArray(), bc_code.ToArray(), bg_code.ToArray(), bg_name.ToArray());
+                            dh.BatchInsert(sql.GetString(), new string[] { "bc_code", "bg_code", "bc_name", "bg_name" }, bc_code.ToArray(), bg_code.ToArray(), bc_name.ToArray(), bg_name.ToArray());
+                            dh.ExecuteSql("update oqcbatchdetail set obd_ifng = -1 where obd_checkno='" + ob_checkno.Text + "' and obd_sncode='" + sncode.Text + "'", "update");
                         }
                         //更新项目编号中的抽检数、不合格数,根据采样项目记录
                         sql.Clear();

+ 1 - 1
UAS_MES_NEW/PublicMethod/BaseUtil.cs

@@ -161,7 +161,7 @@ namespace UAS_MES_NEW.PublicMethod
                     string controlName = ctl[i].Name;
                     string controlsTag = ctl[i].Tag == null ? "" : ctl[i].Tag.ToString();
                     //默认给TextBox和Label赋值
-                    if (ctl[i] is TextBox || ctl[i] is Label || ctl[i] is SearchTextBox || ctl[i] is MaCodeSearchTextBox || ctl[i] is EnterTextBox || ctl[i] is TextBoxGeneratePaCode || ctl[i] is NumericUpDown || ctl[i] is TextBoxWithTextArea)
+                    if (ctl[i] is TextBox || ctl[i] is Label || ctl[i] is SearchTextBox || ctl[i] is MaCodeSearchTextBox || ctl[i] is EnterTextBox || ctl[i] is TextBoxGeneratePaCode || ctl[i] is NumericUpDown || ctl[i] is TextBoxWithTextArea ||ctl[i] is RichTextBox)
                     {
                         for (int j = 0; j < dt.Columns.Count; j++)
                         {

+ 7 - 2
UAS_MES_NEW/PublicMethod/LogicHandler.cs

@@ -397,7 +397,7 @@ namespace UAS_MES_NEW.PublicMethod
                     break;
                 case "OQCRESULTDETERMINE":
                     sql.Clear();
-                    sql.Append("select ob_id,ob_aqlcode,ob_makecode,ob_status,ob_prodcode,(select max(oi_checkqty)from OQCItems where oi_checkno='" + iCheckNo + "') oi_checkqty,");
+                    sql.Append("select ob_remark Remark,ob_id,ob_aqlcode,ob_makecode,ob_status,ob_prodcode,(select max(oi_checkqty)from OQCItems where oi_checkno='" + iCheckNo + "') oi_checkqty,");
                     sql.Append("ob_nowcheckqty,nvl(ob_okqty,0) ob_okqty,nvl(ob_ngqty,0) ob_ngqty,ob_maxngacceptqty,ob_source,ob_checkno,ob_result from OQCBatch where ob_checkno='" + iCheckNo + "'");
                     Form = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
                     if (Form.Rows.Count == 0)
@@ -773,8 +773,13 @@ namespace UAS_MES_NEW.PublicMethod
             if (dh.CheckExist("oqcbatchdetail", "obd_sncode='" + iSnCode + "'"))
             {
                 string checkno = dh.getFieldDataByCondition("oqcbatchdetail", "obd_checkno", "obd_sncode='" + iSnCode + "'").ToString();
+                string ifng = dh.getFieldDataByCondition("oqcbatchdetail", "obd_ifng", "obd_sncode='" + iSnCode + "'").ToString();
+                if (ifng == "-1")
+                {
+                    dh.ExecuteSql("delete OQCITEMSAMPLES where ois_sncode = '" + iSnCode + "'","select");
+                    dh.ExecuteSql("update oqcbatch set ob_nowcheckqty=ob_nowcheckqty-1,ob_ngqty =  ob_ngqty -1 where ob_checkno='" + checkno + "'", "update");
+                }
                 dh.ExecuteSql("delete from oqcbatchdetail where obd_sncode='" + iSnCode + "'", "delete");
-                dh.ExecuteSql("update oqcbatch set ob_nowcheckqty=ob_nowcheckqty-1 where ob_checkno='" + checkno + "'", "update");
             }
             //之前保存的不良就不再调用
             DataTable dt = dh.getFieldsDataByCondition("makeserial", new string[] { "ms_stepcode", "nvl(ms_ifrework,0)ms_ifrework", "ms_status" }, "ms_sncode='" + iSnCode + "' and ms_makecode='" + iMakeCode + "'");

+ 107 - 0
UAS_MES_NEW/PublicMethod/Print.cs

@@ -6,6 +6,7 @@ using System.IO;
 using UAS_MES_NEW.Entity;
 using System.Text.RegularExpressions;
 using System.Windows.Forms;
+using Seagull.BarTender.Print;
 
 namespace UAS_MES_NEW.PublicMethod
 {
@@ -14,6 +15,7 @@ namespace UAS_MES_NEW.PublicMethod
         static DataHelper dh = SystemInf.dh;
         //CodeSoft打印的驱动和文件
         static Document doc;
+        static LabelFormatDocument doc2;
         ////CodeSoft的打印机
         //string CodeSpft_Printer;
         static FileInfo info;
@@ -207,5 +209,110 @@ namespace UAS_MES_NEW.PublicMethod
             LogicHandler.doLabelPrintLog(SnCode, LabelType, MakeCode, ProdCode, User.UserSourceCode, User.CurrentStepCode, IfRePrint, User.UserCode);
             return true;
         }
+
+
+
+        public static bool SinglePrint(string iCaller, ref Engine lbl, string LabelName, string LaID, string PrinterName, string SnCode, int PrintNum, string MakeCode, string ProdCode, string LabelType, string IfRePrint, out string ErrorMessage)
+        {
+            ErrorMessage = "";
+            DataTable dt = new DataTable();
+            if (IfRePrint != "-1")
+            {
+                if (LabelType == "卡通箱标" || LabelType == "大箱标" || LabelType == "栈板标")
+                {
+                    dt = (DataTable)dh.ExecuteSql("select lpl_id from labelprintlog where lpl_value='" + SnCode + "' and lpl_type='" + LabelType + "' and lpl_stepcode='" + User.CurrentStepCode + "'", "select");
+                }
+                else
+                {
+                    dt = (DataTable)dh.ExecuteSql("select lpl_id from labelprintlog where lpl_value='" + SnCode + "' and lpl_makecode='" + MakeCode + "' and lpl_type='" + LabelType + "' and lpl_stepcode='" + User.CurrentStepCode + "'", "select");
+                }
+                //////如果已经打印过了,则不允许再打印
+                //if (dt.Rows.Count > 0)
+                //{
+                //    ErrorMessage = SnCode + LabelType + "已打印";
+                //    return false;
+                //}
+            }
+            string filelastwritetime = dh.getFieldDataByCondition("label", "la_lastwritetime", "la_id = '" + LaID + "'").ToString();
+            FileInfo PrintFile = new FileInfo(LabelName);
+            //打开模板路径
+            //查询模板对应的取值SQL和参数名称
+            dt = (DataTable)dh.ExecuteSql("select lp_name,lp_sql from label left join LABELPARAMETER on la_id=lp_laid where la_id='" + LaID + "'", "select");
+            StringBuilder sb = new StringBuilder();
+            if (!PrintFile.Exists)
+            {
+                MessageBox.Show("打印文件不存在");
+                return false;
+            }
+            string filechangetime = PrintFile.LastWriteTime.ToString();
+            if (filechangetime != filelastwritetime)
+            {
+                lbl.Dispose();
+                lbl = new Engine(true);
+              //  BaseUtil.WriteLbl();
+                filechangetime = PrintFile.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss");
+                string update = "la_lastwritetime = to_date((regexp_substr('" + filechangetime + "','\\d+.+\\d+')),'yyyy-mm-dd hh24:mi:ss')";
+                dh.UpdateByCondition("label", update, "la_id = '" + LaID + "'");
+            }
+            doc2 = lbl.Documents.Open(LabelName);
+            if (doc2 == null)
+            {
+                MessageBox.Show("标签文件打开失败");
+                return false;
+            }
+            //执行全部的SQL
+            for (int i = 0; i < dt.Rows.Count; i++)
+            {
+                string sql = dt.Rows[i]["lp_sql"].ToString();
+                try
+                {
+                    Regex ConnoteA = new Regex("{\\w+}");
+                    foreach (Match mch in ConnoteA.Matches(sql))
+                    {
+                        string x = mch.Value.Trim();
+                        sql = sql.Replace(x, "'" + SnCode + "'");
+                    }
+                    DataTable Param = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
+                    if (Param.Rows.Count == 0)
+                        continue;
+                    //查询的结果的参数个数大于1需要给标签的多个参数赋值
+                    if (Param.Rows.Count > 0)
+                    {
+                        int LoopTime = Param.Rows.Count > 100 ? 100 : Param.Rows.Count;
+                        for (int j = 0; j < LoopTime; j++)
+                        {
+                            for (int k = 0; k < doc2.SubStrings.Count; k++)
+                            {
+                                if (j == 0 & doc2.SubStrings[k].Name.ToUpper() == dt.Rows[i]["lp_name"].ToString().ToUpper())
+                                {
+                                    doc2.SubStrings[k].Value = Param.Rows[0][0].ToString();
+                                }
+                                //使用SN开头的参数赋值SN1,SN2,SN3等参数
+                                if (doc2.SubStrings[k].Name.ToUpper() == dt.Rows[i]["lp_name"].ToString().ToUpper() + (j + 1))
+                                {
+                                    doc2.SubStrings[k].Value = Param.Rows[j][0].ToString();
+                                }
+                            }
+                        }
+                    }
+                }
+                catch (System.Exception ex)
+                {
+                    MessageBox.Show("SQL维护不正确"+ex.Message);
+                }
+            }
+            LogManager.DoLog(sb.ToString());
+            //保存本次赋值进行打印
+           // doc2.Printer.SwitchTo(PrinterName);
+            doc2.PrintSetup.PrinterName = PrinterName;
+            doc2.PrintSetup.IdenticalCopiesOfLabel = 1;
+            doc2.Print();
+            doc2.Close(SaveOptions.DoNotSaveChanges);
+            LogicHandler.DoCommandLog(iCaller, User.UserCode, "", User.UserLineCode, User.UserSourceCode, "打印", "成功打印", SnCode, "");
+            LogicHandler.doLabelPrintLog(SnCode, LabelType, MakeCode, ProdCode, User.UserSourceCode, User.CurrentStepCode, IfRePrint, User.UserCode);
+            return true;
+        }
+
+
     }
 }