Просмотр исходного кода

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

caosy 6 лет назад
Родитель
Сommit
86071e5bbf

+ 68 - 8
UAS-MES/FunctionCode/Make/Make_SMTStencil.Designer.cs

@@ -42,6 +42,8 @@
             this.ma_qty = new System.Windows.Forms.Label();
             this.su_singlepringqty1_label = new System.Windows.Forms.Label();
             this.SU_RETURNIFCLEAN = new System.Windows.Forms.CheckBox();
+            this.em_code_label = new System.Windows.Forms.Label();
+            this.em_code = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.su_singlepringqty1 = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.st_table = new UAS_MES.CustomControl.ComBoxWithFocus.ComBoxWithFocus();
             this.Receive = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
@@ -62,6 +64,8 @@
             this.li_code = new UAS_MES.CustomControl.TextBoxWithIcon.SearchTextBox();
             this.ma_prodcode = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.ma_code = new UAS_MES.CustomControl.TextBoxWithIcon.SearchTextBox();
+            this.em_code1 = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
+            this.em_code1_label = new System.Windows.Forms.Label();
             ((System.ComponentModel.ISupportInitialize)(this.ToolsBom)).BeginInit();
             this.SuspendLayout();
             // 
@@ -112,7 +116,7 @@
             // 
             this.RadioReturn.AutoSize = true;
             this.RadioReturn.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.RadioReturn.Location = new System.Drawing.Point(6, 521);
+            this.RadioReturn.Location = new System.Drawing.Point(6, 549);
             this.RadioReturn.Name = "RadioReturn";
             this.RadioReturn.Size = new System.Drawing.Size(55, 24);
             this.RadioReturn.TabIndex = 78;
@@ -145,7 +149,7 @@
             // 
             this.SU_DEVCODE1_label.AutoSize = true;
             this.SU_DEVCODE1_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.SU_DEVCODE1_label.Location = new System.Drawing.Point(59, 524);
+            this.SU_DEVCODE1_label.Location = new System.Drawing.Point(59, 552);
             this.SU_DEVCODE1_label.Name = "SU_DEVCODE1_label";
             this.SU_DEVCODE1_label.Size = new System.Drawing.Size(74, 21);
             this.SU_DEVCODE1_label.TabIndex = 87;
@@ -155,7 +159,7 @@
             // 
             this.st_combinenumber_label.AutoSize = true;
             this.st_combinenumber_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.st_combinenumber_label.Location = new System.Drawing.Point(266, 524);
+            this.st_combinenumber_label.Location = new System.Drawing.Point(266, 552);
             this.st_combinenumber_label.Name = "st_combinenumber_label";
             this.st_combinenumber_label.Size = new System.Drawing.Size(90, 21);
             this.st_combinenumber_label.TabIndex = 89;
@@ -194,13 +198,37 @@
             // 
             this.SU_RETURNIFCLEAN.AutoSize = true;
             this.SU_RETURNIFCLEAN.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.SU_RETURNIFCLEAN.Location = new System.Drawing.Point(492, 523);
+            this.SU_RETURNIFCLEAN.Location = new System.Drawing.Point(692, 550);
             this.SU_RETURNIFCLEAN.Name = "SU_RETURNIFCLEAN";
             this.SU_RETURNIFCLEAN.Size = new System.Drawing.Size(84, 24);
             this.SU_RETURNIFCLEAN.TabIndex = 110;
             this.SU_RETURNIFCLEAN.Text = "是否清洗";
             this.SU_RETURNIFCLEAN.UseVisualStyleBackColor = true;
             // 
+            // em_code_label
+            // 
+            this.em_code_label.AutoSize = true;
+            this.em_code_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.em_code_label.Location = new System.Drawing.Point(59, 524);
+            this.em_code_label.Name = "em_code_label";
+            this.em_code_label.Size = new System.Drawing.Size(74, 21);
+            this.em_code_label.TabIndex = 111;
+            this.em_code_label.Text = "人员编号";
+            // 
+            // em_code
+            // 
+            this.em_code.AllPower = null;
+            this.em_code.BackColor = System.Drawing.Color.White;
+            this.em_code.ID = null;
+            this.em_code.Location = new System.Drawing.Point(139, 525);
+            this.em_code.Name = "em_code";
+            this.em_code.Power = null;
+            this.em_code.Size = new System.Drawing.Size(120, 21);
+            this.em_code.Str = null;
+            this.em_code.Str1 = null;
+            this.em_code.Str2 = null;
+            this.em_code.TabIndex = 112;
+            // 
             // su_singlepringqty1
             // 
             this.su_singlepringqty1.AllPower = null;
@@ -253,7 +281,7 @@
             this.Return.DownImage = ((System.Drawing.Image)(resources.GetObject("Return.DownImage")));
             this.Return.Image = null;
             this.Return.IsShowBorder = true;
-            this.Return.Location = new System.Drawing.Point(582, 522);
+            this.Return.Location = new System.Drawing.Point(782, 548);
             this.Return.MoveImage = ((System.Drawing.Image)(resources.GetObject("Return.MoveImage")));
             this.Return.Name = "Return";
             this.Return.NormalImage = ((System.Drawing.Image)(resources.GetObject("Return.NormalImage")));
@@ -269,7 +297,7 @@
             this.st_combinenumber.AllPower = null;
             this.st_combinenumber.BackColor = System.Drawing.Color.White;
             this.st_combinenumber.ID = null;
-            this.st_combinenumber.Location = new System.Drawing.Point(360, 525);
+            this.st_combinenumber.Location = new System.Drawing.Point(360, 553);
             this.st_combinenumber.Name = "st_combinenumber";
             this.st_combinenumber.Power = null;
             this.st_combinenumber.Size = new System.Drawing.Size(120, 21);
@@ -283,7 +311,7 @@
             this.SU_DEVCODE1.AllPower = null;
             this.SU_DEVCODE1.BackColor = System.Drawing.Color.White;
             this.SU_DEVCODE1.ID = null;
-            this.SU_DEVCODE1.Location = new System.Drawing.Point(139, 525);
+            this.SU_DEVCODE1.Location = new System.Drawing.Point(139, 553);
             this.SU_DEVCODE1.Name = "SU_DEVCODE1";
             this.SU_DEVCODE1.Power = null;
             this.SU_DEVCODE1.Size = new System.Drawing.Size(120, 21);
@@ -449,11 +477,39 @@
             this.ma_code.TextBoxEnable = true;
             this.ma_code.TextKeyDown += new UAS_MES.CustomControl.TextBoxWithIcon.SearchTextBox.OnTextKeyDown(this.ma_code_TextKeyDown);
             // 
+            // em_code1
+            // 
+            this.em_code1.AllPower = null;
+            this.em_code1.BackColor = System.Drawing.Color.White;
+            this.em_code1.ID = null;
+            this.em_code1.Location = new System.Drawing.Point(566, 553);
+            this.em_code1.Name = "em_code1";
+            this.em_code1.Power = null;
+            this.em_code1.Size = new System.Drawing.Size(120, 21);
+            this.em_code1.Str = null;
+            this.em_code1.Str1 = null;
+            this.em_code1.Str2 = null;
+            this.em_code1.TabIndex = 114;
+            // 
+            // em_code1_label
+            // 
+            this.em_code1_label.AutoSize = true;
+            this.em_code1_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.em_code1_label.Location = new System.Drawing.Point(486, 552);
+            this.em_code1_label.Name = "em_code1_label";
+            this.em_code1_label.Size = new System.Drawing.Size(74, 21);
+            this.em_code1_label.TabIndex = 113;
+            this.em_code1_label.Text = "人员编号";
+            // 
             // Make_SMTStencil
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(908, 551);
+            this.ClientSize = new System.Drawing.Size(908, 580);
+            this.Controls.Add(this.em_code1);
+            this.Controls.Add(this.em_code1_label);
+            this.Controls.Add(this.em_code);
+            this.Controls.Add(this.em_code_label);
             this.Controls.Add(this.SU_RETURNIFCLEAN);
             this.Controls.Add(this.su_singlepringqty1);
             this.Controls.Add(this.su_singlepringqty1_label);
@@ -526,5 +582,9 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn su_table;
         private System.Windows.Forms.DataGridViewTextBoxColumn su_usemacode;
         private System.Windows.Forms.CheckBox SU_RETURNIFCLEAN;
+        private CustomControl.TextBoxWithIcon.EnterTextBox em_code;
+        private System.Windows.Forms.Label em_code_label;
+        private CustomControl.TextBoxWithIcon.EnterTextBox em_code1;
+        private System.Windows.Forms.Label em_code1_label;
     }
 }

+ 56 - 26
UAS-MES/FunctionCode/Make/Make_SMTStencil.cs

@@ -46,7 +46,6 @@ namespace UAS_MES.Make
             ma_code.SelectField = "ma_code # 工单号,ma_prodcode # 产品编号,ma_qty # 工单数量,pr_detail # 产品名称,ma_softversion # 软件版本,ma_salecode # 销售单号,pr_sendchecktype # 产品送检方式";
             ma_code.FormName = Name;
             ma_code.SetValueField = new string[] { "ma_code", "ma_prodcode", "ma_qty", "pr_detail", "ma_softversion", "ma_salecode", "nvl(pr_sendchecktype,'LineCode')pr_sendchecktype" };
-            ma_code.Condition = "ma_statuscode in('STARTED','AUDITED')";
             ma_code.DbChange += Ma_code_DbChange;
 
             li_code.TableName = "Line";
@@ -112,24 +111,45 @@ namespace UAS_MES.Make
             {
                 MessageBox.Show("钢网编号" + SU_DEVCODE.Text + "不存在或者未审核");
             }
+            //限制钢网使用的产品
             dt = (DataTable)dh.ExecuteSql("select 1 from STENILCANUSEPRO where sp_stcode='" + SU_DEVCODE.Text + "' and sp_prodcode='" + ma_prodcode.Text + "'", "select");
             if (dt.Rows.Count == 0)
             {
                 MessageBox.Show("钢网编号" + SU_DEVCODE.Text + "不能在产品" + ma_prodcode.Text + "中使用");
                 return;
             }
-            sql.Clear();
-            sql.Append("update StencilUse set su_usedate=sysdate,SU_USEPRODCODE='" + ma_prodcode.Text + "',su_usemacode='" + ma_code.Text + "', ");
-            sql.Append("su_useman='" + User.UserName + "',SU_TABLE='" + st_table.Text + "',su_singlepringqty='" + su_singlepringqty1.Text + "',");
-            sql.Append("su_stverison='" + version + "',SU_STATUS='在线',su_linecode='" + li_code.Text + "' ");
-            sql.Append("where su_id=(select max(su_id) from stenciluse where su_stcode='" + SU_DEVCODE.Text + "')");
-            dh.ExecuteSql(sql.ToString(), "update");
-            dh.ExecuteSql("update Stencil set ST_USESTATUS='在线' where st_code='" + SU_DEVCODE.Text + "'", "update");
-            MessageBox.Show("领用成功");
-            st_table.SelectedItem = null;
-            SU_DEVCODE.Text = "";
-            Receive.Enabled = false;
-            LoadGridData();
+            //一条线只能在线一个钢网
+            dt = (DataTable)dh.ExecuteSql("select su_stcode from stenciluse where su_linecode='" + li_code.Text + "' and su_status='在线'", "select");
+            if (dt.Rows.Count > 0)
+            {
+                MessageBox.Show("线别" + li_code.Text + "已有领用的钢网" + dt.Rows[0]["su_stcode"].ToString() + ",请先退回");
+                return;
+            }
+            else
+            {
+                dt = (DataTable)dh.ExecuteSql("select em_name from employee where em_code='" + em_code.Text + "'", "select");
+                if (dt.Rows.Count > 0)
+                {
+                    string em_name = dt.Rows[0]["em_name"].ToString();
+                    sql.Clear();
+                    sql.Append("insert into StencilUse(su_id,SU_USEPRODCODE,su_stid,su_linecode,su_stcode,su_usedate,su_useman,SU_USEMANCODE,SU_TABLE,su_usemacode,su_singlepringqty,su_stverison,SU_STATUS)");
+                    sql.Append("select StencilUse_seq.nextval,'" + ma_prodcode.Text + "',st_id,'" + li_code.Text + "','" + SU_DEVCODE.Text + "',sysdate,'" + em_name + "','" + em_code.Text + "','" + st_table.Text + "','" + ma_code.Text + "'");
+                    sql.Append(",'" + su_singlepringqty1.Text + "',st_version,'在线' from ");
+                    sql.Append("Stencil where st_code='" + SU_DEVCODE.Text + "'");
+                    dh.ExecuteSql(sql.ToString(), "insert");
+                    dh.ExecuteSql("update Stencil set ST_USESTATUS='在线' where st_code='" + SU_DEVCODE.Text + "'", "update");
+                    MessageBox.Show("领用成功");
+                    st_table.SelectedItem = null;
+                    SU_DEVCODE.Text = "";
+                    em_code.Text = "";
+                    Receive.Enabled = false;
+                    LoadGridData();
+                }
+                else
+                {
+                    MessageBox.Show("人员编号" + em_code.Text + "不存在");
+                }
+            }
         }
 
         private void Return_Click(object sender, EventArgs e)
@@ -156,19 +176,29 @@ namespace UAS_MES.Make
                     MessageBox.Show("钢网编号" + SU_DEVCODE1.Text + "不存在或者未审核");
                 }
                 string St_USECOUNT = dt.Rows[0]["St_USECOUNT"].ToString();
-                sql.Clear();
-                sql.Append("update StencilUse set SU_BACKDATE=sysdate,");
-                sql.Append("SU_THISUSETIMES='" + st_combinenumber.Text + "',SU_STATUS='借出',su_usecount=" + (St_USECOUNT == "" ? "0" : St_USECOUNT) + "+" + st_combinenumber.Text);
-                sql.Append(",SU_RETURNIFCLEAN='" + (SU_RETURNIFCLEAN.Checked ? "-1" : "0") + "' where su_id=(select max(su_id) from stenciluse where su_stcode='" + SU_DEVCODE1.Text + "')");
-                dh.ExecuteSql(sql.ToString(), "update");
-                sql.Clear();
-                sql.Append("update Stencil set St_USECOUNT=nvl(St_USECOUNT,0)+" + st_combinenumber.Text + ",ST_USESTATUS='借出' where st_code='" + SU_DEVCODE1.Text + "'");
-                dh.ExecuteSql(sql.ToString(), "update");
-                MessageBox.Show("钢网" + SU_DEVCODE1.Text + "退回成功!");
-                SU_DEVCODE1.Text = "";
-                st_combinenumber.Text = "";
-                SU_RETURNIFCLEAN.Checked = false;
-                Confirm.PerformClick();
+                dt = (DataTable)dh.ExecuteSql("select em_name from employee where em_code='" + em_code1.Text + "'", "select");
+                if (dt.Rows.Count > 0)
+                {
+                    sql.Clear();
+                    sql.Append("update StencilUse set SU_BACKDATE=sysdate,su_returnmancode='" + em_code1.Text + "',");
+                    sql.Append("SU_THISUSETIMES='" + st_combinenumber.Text + "',SU_STATUS='借出',su_usecount=" + (St_USECOUNT == "" ? "0" : St_USECOUNT) + "+" + st_combinenumber.Text);
+                    sql.Append(",SU_RETURNIFCLEAN='" + (SU_RETURNIFCLEAN.Checked ? "-1" : "0") + "' where su_id=(select max(su_id) from stenciluse where su_stcode='" + SU_DEVCODE1.Text + "' and su_status='在线')");
+                    dh.ExecuteSql(sql.ToString(), "update");
+                    sql.Clear();
+                    sql.Append("update Stencil set St_USECOUNT=nvl(St_USECOUNT,0)+" + st_combinenumber.Text + ",ST_USESTATUS='借出' where st_code='" + SU_DEVCODE1.Text + "'");
+                    dh.ExecuteSql(sql.ToString(), "update");
+                    MessageBox.Show("钢网" + SU_DEVCODE1.Text + "退回成功!");
+                    SU_DEVCODE1.Text = "";
+                    st_combinenumber.Text = "";
+                    em_code1.Text = "";
+                    SU_RETURNIFCLEAN.Checked = false;
+                    Confirm.PerformClick();
+                }
+                else
+                {
+                    MessageBox.Show("人员编号" + em_code1.Text + "不存在");
+                }
+
             }
             else
             {

+ 1 - 1
UAS-MES/FunctionCode/Make/Make_SMTStockStencil.cs

@@ -143,7 +143,7 @@ namespace UAS_MES.Make
                     sql.Clear();
                     sql.Append("update StencilUse set SU_BACKDATE=sysdate,SU_ENSIONA='" + ST_ENSIONA.Text + "',SU_ENSIONB='" + ST_ENSIONB.Text + "',SU_ENSIONC='" + ST_ENSIONC.Text + "',SU_ENSIOND='" + ST_ENSIOND.Text + "',");
                     sql.Append("SU_ENSIONE='" + ST_ENSIONE.Text + "',SU_STATUS='在仓'");
-                    sql.Append(",SU_RETURNIFCLEAN='" + (SU_RETURNIFCLEAN.Checked ? "-1" : "0") + "' where su_id=(select max(su_id) from stenciluse where su_stcode='" + SU_DEVCODE1.Text + "')");
+                    sql.Append(",SU_RETURNIFCLEAN='" + (SU_RETURNIFCLEAN.Checked ? "-1" : "0") + "' where su_id=(select max(su_id) from stenciluse where su_stcode='" + SU_DEVCODE1.Text + "' and su_status='借出')");
                     dh.ExecuteSql(sql.ToString(), "update");
                     sql.Clear();
                     sql.Append("update Stencil set ST_USESTATUS='在仓',ST_ENSIONA='" + ST_ENSIONA.Text + "',ST_ENSIONB='" + ST_ENSIONB.Text + "',");

+ 1 - 1
UAS-出货标签管理(吉利通)/CustomControl/DataGridViewWithSerialNum.cs

@@ -15,7 +15,7 @@ namespace UAS_LabelMachine.CustomControl
 
         protected override void OnRowPostPaint(DataGridViewRowPostPaintEventArgs e)
         {
-            e.Graphics.DrawString((e.RowIndex + 1).ToString(), e.InheritedRowStyle.Font, solidBrush, e.RowBounds.Location.X + 15, e.RowBounds.Location.Y + 5);
+            e.Graphics.DrawString((e.RowIndex + 1).ToString(), new System.Drawing.Font("宋体", 8.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))), solidBrush, e.RowBounds.Location.X + 5, e.RowBounds.Location.Y + 5);
             base.OnRowPostPaint(e);
         }
 

+ 186 - 0
UAS-出货标签管理(贸易版)/PublicMethod/Print.cs

@@ -0,0 +1,186 @@
+using LabelManager2;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Text;
+using UAS_LabelMachine.Entity;
+
+namespace UAS_LabelMachine.PublicMethod
+{
+    class Print
+    {
+        public class CodeSoft
+        {
+            public static void SinglePrint(Document SingleDoc, DataTable SingleLabelParam, string pib_id)
+            {
+                StringBuilder sql = new StringBuilder();
+                sql.Clear();
+                for (int j = 0; j < SingleDoc.Variables.FormVariables.Count; j++)
+                {
+                    DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(j + 1).Name + "'");
+                    if (dr1.Length > 0)
+                    {
+                        if (dr1[0]["lp_valuetype"].ToString() == "字符串")
+                            sql.Append(dr1[0]["lp_sql"].ToString() + ",");
+                    }
+                }
+                sql.Append("1,");
+                DataTable dt = (DataTable)SystemInf.sdh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_id=" + pib_id, "select");
+                for (int j = 0; j < SingleDoc.Variables.FormVariables.Count; j++)
+                {
+                    DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(j + 1).Name + "'");
+                    if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "SQL值")
+                    {
+                        DataTable dt1 = (DataTable)SystemInf.sdh.ExecuteSql(dr1[0]["lp_sql"].ToString().Replace("{1}", pib_id), "select");
+                        if (dt1.Rows.Count > 0)
+                        {
+                            SingleDoc.Variables.FormVariables.Item(j + 1).Value = dt1.Rows[0][0].ToString();
+                        }
+                    }
+                    else if (dr1.Length > 0)
+                    {
+                        SingleDoc.Variables.FormVariables.Item(j + 1).Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
+                    }
+                    if (SingleDoc.Variables.FormVariables.Item(j + 1).Value == "")
+                    {
+                        dr1 = UAS_出货标签打印.Attach.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(j + 1).Name + "'");
+                        if (dr1.Length > 0)
+                            SingleDoc.Variables.FormVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
+                    }
+                }
+                SingleDoc.PrintDocument();
+            }
+
+            public static void MidPrint(Document MidDoc, DataTable MidLabelParam, string pi_inoutno, string pib_id, string pib_outboxcode1)
+            {
+                StringBuilder sql = new StringBuilder();
+                //查询参数名称相同的获取到取值字段
+                for (int j = 0; j < MidDoc.Variables.FormVariables.Count; j++)
+                {
+                    DataRow[] dr1 = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FormVariables.Item(j + 1).Name + "'");
+                    if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串")
+                    {
+                        sql.Append(dr1[0]["lp_sql"].ToString() + ",");
+                    }
+                }
+                sql.Append("1,");
+                DataTable dt = (DataTable)SystemInf.sdh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_inoutno='" + pi_inoutno + "' and pib_outboxcode1=" + (pib_outboxcode1 == "" ? "0" : pib_outboxcode1), "select");
+                for (int j = 0; j < MidDoc.Variables.FormVariables.Count; j++)
+                {
+                    DataRow[] dr1 = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FormVariables.Item(j + 1).Name + "'");
+                    if (dr1.Length == 0)
+                        dr1 = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FormVariables.Item(j + 1).Name.Replace("_1", "") + "'");
+                    if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串")
+                    {
+                        MidDoc.Variables.FormVariables.Item(j + 1).Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
+                    }
+                    //SQL判断多个值的时候
+                    if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "SQL值")
+                    {
+                        DataTable dt1 = (DataTable)SystemInf.sdh.ExecuteSql(dr1[0]["lp_sql"].ToString().Replace("{1}", "'" + pi_inoutno + "'").Replace("{2}", pib_outboxcode1), "select");
+                        for (int i = 0; i < dt1.Rows.Count; i++)
+                        {
+                            for (int k = 0; k < MidDoc.Variables.FormVariables.Count; k++)
+                            {
+                                if (i == 0 & MidDoc.Variables.FormVariables.Item(k + 1).Name == dr1[0]["lp_name"].ToString())
+                                {
+                                    MidDoc.Variables.FormVariables.Item(k + 1).Value = dt1.Rows[0][0].ToString();
+                                }
+                                //使用SN开头的参数赋值SN1,SN2,SN3等参数
+                                if (MidDoc.Variables.FormVariables.Item(k + 1).Name == (dr1[0]["lp_name"].ToString() + "_" + (i + 1)))
+                                {
+                                    MidDoc.Variables.FormVariables.Item(k + 1).Value = dt1.Rows[i][0].ToString();
+                                }
+                            }
+                        }
+                    }
+                    if (MidDoc.Variables.FormVariables.Item(j + 1).Value == "")
+                    {
+                        dr1 = UAS_出货标签打印.Attach.Select("lp_name='" + MidDoc.Variables.FormVariables.Item(j + 1).Name + "'");
+                        if (dr1.Length > 0)
+                            MidDoc.Variables.FormVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
+                    }
+                }
+                MidDoc.PrintDocument();
+            }
+
+            public static void OutPrint(Document OutBoxDoc, DataTable OutLabelParam, string pi_inoutno, string pib_id, string pib_outboxcode2)
+            {
+                StringBuilder sql = new StringBuilder();
+                sql.Clear();
+                for (int j = 0; j < OutBoxDoc.Variables.FormVariables.Count; j++)
+                {
+                    DataRow[] dr1 = OutLabelParam.Select("lp_name='" + OutBoxDoc.Variables.FormVariables.Item(j + 1).Name + "'");
+                    if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串")
+                    {
+                        sql.Append(dr1[0]["lp_sql"].ToString() + ",");
+                    }
+                }
+                sql.Append("1,");
+                DataTable dt = (DataTable)SystemInf.sdh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_inoutno='" + pi_inoutno + "' and pib_outboxcode2=" + (pib_outboxcode2 == "" ? "0" : pib_outboxcode2), "select");
+                if (dt.Rows.Count > 0)
+                {
+                    for (int j = 0; j < OutBoxDoc.Variables.FormVariables.Count; j++)
+                    {
+                        DataRow[] dr1 = OutLabelParam.Select("lp_name='" + OutBoxDoc.Variables.FormVariables.Item(j + 1).Name + "'");
+                        //多参数命名
+                        if (dr1.Length == 0)
+                            dr1 = OutLabelParam.Select("lp_name='" + OutBoxDoc.Variables.FormVariables.Item(j + 1).Name.Replace("_1", "") + "'");
+                        if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串")
+                        {
+                            OutBoxDoc.Variables.FormVariables.Item(j + 1).Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
+                        }
+                        //SQL判断多个值的时候
+                        if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "SQL值")
+                        {
+                            DataTable dt1 = (DataTable)SystemInf.sdh.ExecuteSql(dr1[0]["lp_sql"].ToString().Replace("{1}", "'" + pi_inoutno + "'").Replace("{2}", pib_outboxcode2), "select");
+                            for (int i = 0; i < dt1.Rows.Count; i++)
+                            {
+                                for (int k = 0; k < OutBoxDoc.Variables.FormVariables.Count; k++)
+                                {
+                                    if (i == 0 & OutBoxDoc.Variables.FormVariables.Item(k + 1).Name == dr1[0]["lp_name"].ToString())
+                                    {
+                                        OutBoxDoc.Variables.FormVariables.Item(k + 1).Value = dt1.Rows[0][0].ToString();
+                                    }
+                                    //使用SN开头的参数赋值SN1,SN2,SN3等参数
+                                    if (OutBoxDoc.Variables.FormVariables.Item(k + 1).Name == (dr1[0]["lp_name"].ToString() + "_" + (i + 1)))
+                                    {
+                                        OutBoxDoc.Variables.FormVariables.Item(k + 1).Value = dt1.Rows[i][0].ToString();
+                                    }
+                                    if (dr1[0]["lp_sql"].ToString().Contains("pib_year"))
+                                    {
+                                        string date = dt1.Rows[0][0].ToString();
+                                    }
+                                }
+                            }
+                        }
+                        if (OutBoxDoc.Variables.FormVariables.Item(j + 1).Value == "")
+                        {
+                            dr1 = UAS_出货标签打印.Attach.Select("lp_name='" + OutBoxDoc.Variables.FormVariables.Item(j + 1).Name + "'");
+                            if (dr1.Length > 0)
+                                OutBoxDoc.Variables.FormVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
+                        }
+                    }
+                    OutBoxDoc.PrintDocument();
+                }
+            }
+        }
+
+        public class BarTender
+        {
+            public static void SinglePrint()
+            {
+
+            }
+            public static void MidPrint()
+            {
+
+            }
+            public static void OutPrint()
+            {
+
+            }
+        }
+    }
+}

+ 1 - 0
UAS-出货标签管理(贸易版)/UAS-出货标签管理(贸易版).csproj

@@ -243,6 +243,7 @@
     <Compile Include="PublicMethod\GlobalEventsHandler.cs" />
     <Compile Include="PublicMethod\HttpHandler.cs" />
     <Compile Include="PublicMethod\LogManager.cs" />
+    <Compile Include="PublicMethod\Print.cs" />
     <Compile Include="PublicMethod\SqliteDBHelper.cs" />
     <Compile Include="Service References\Vivo_BoxReelRelation\Reference.cs">
       <AutoGen>True</AutoGen>

+ 4 - 142
UAS-出货标签管理(贸易版)/UAS_出货标签管理.cs

@@ -142,7 +142,7 @@ namespace UAS_LabelMachine
 
         List<string> OutParam = new List<string>();
 
-        DataTable Attach;
+        public static DataTable Attach;
 
         public UAS_出货标签打印(string Master)
         {
@@ -643,42 +643,7 @@ namespace UAS_LabelMachine
 
         private void AutoPrintSingleLabel(string pib_id)
         {
-            StringBuilder sql = new StringBuilder();
-            sql.Clear();
-            for (int j = 0; j < SingleDoc.Variables.FormVariables.Count; j++)
-            {
-                DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(j + 1).Name + "'");
-                if (dr1.Length > 0)
-                {
-                    if (dr1[0]["lp_valuetype"].ToString() == "字符串")
-                        sql.Append(dr1[0]["lp_sql"].ToString() + ",");
-                }
-            }
-            sql.Append("1,");
-            DataTable dt = (DataTable)sdh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_id=" + pib_id, "select");
-            for (int j = 0; j < SingleDoc.Variables.FormVariables.Count; j++)
-            {
-                DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(j + 1).Name + "'");
-                if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "SQL值")
-                {
-                    DataTable dt1 = (DataTable)sdh.ExecuteSql(dr1[0]["lp_sql"].ToString().Replace("{1}", pib_id), "select");
-                    if (dt1.Rows.Count > 0)
-                    {
-                        SingleDoc.Variables.FormVariables.Item(j + 1).Value = dt1.Rows[0][0].ToString();
-                    }
-                }
-                else if (dr1.Length > 0)
-                {
-                    SingleDoc.Variables.FormVariables.Item(j + 1).Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
-                }
-                if (SingleDoc.Variables.FormVariables.Item(j + 1).Value == "")
-                {
-                    dr1 = Attach.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(j + 1).Name + "'");
-                    if (dr1.Length > 0)
-                        SingleDoc.Variables.FormVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
-                }
-            }
-            SingleDoc.PrintDocument();
+            Print.CodeSoft.SinglePrint(SingleDoc, SingleLabelParam, pib_id);
             LabelInf.Rows[CurrentRowIndex].Cells["pib_ifprint"].Value = true;
         }
 
@@ -1453,56 +1418,8 @@ namespace UAS_LabelMachine
             //获取对应行的pib_id
             string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
             string pib_outboxcode1 = LabelInf.Rows[rowindex].Cells["pib_outboxcode1"].Value.ToString();
-            sql.Clear();
+            Print.CodeSoft.MidPrint(MidDoc, MidLabelParam, pi_inoutno.Text, pib_id, pib_outboxcode1);
 
-            //查询参数名称相同的获取到取值字段
-            for (int j = 0; j < MidDoc.Variables.FormVariables.Count; j++)
-            {
-                DataRow[] dr1 = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FormVariables.Item(j + 1).Name + "'");
-                if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串")
-                {
-                    sql.Append(dr1[0]["lp_sql"].ToString() + ",");
-                }
-            }
-            sql.Append("1,");
-            DataTable dt = (DataTable)sdh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode1=" + (pib_outboxcode1 == "" ? "0" : pib_outboxcode1), "select");
-            for (int j = 0; j < MidDoc.Variables.FormVariables.Count; j++)
-            {
-                DataRow[] dr1 = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FormVariables.Item(j + 1).Name + "'");
-                if (dr1.Length == 0)
-                    dr1 = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FormVariables.Item(j + 1).Name.Replace("_1", "") + "'");
-                if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串")
-                {
-                    MidDoc.Variables.FormVariables.Item(j + 1).Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
-                }
-                //SQL判断多个值的时候
-                if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "SQL值")
-                {
-                    DataTable dt1 = (DataTable)sdh.ExecuteSql(dr1[0]["lp_sql"].ToString().Replace("{1}", "'" + pi_inoutno.Text + "'").Replace("{2}", pib_outboxcode1), "select");
-                    for (int i = 0; i < dt1.Rows.Count; i++)
-                    {
-                        for (int k = 0; k < MidDoc.Variables.FormVariables.Count; k++)
-                        {
-                            if (i == 0 & MidDoc.Variables.FormVariables.Item(k + 1).Name == dr1[0]["lp_name"].ToString())
-                            {
-                                MidDoc.Variables.FormVariables.Item(k + 1).Value = dt1.Rows[0][0].ToString();
-                            }
-                            //使用SN开头的参数赋值SN1,SN2,SN3等参数
-                            if (MidDoc.Variables.FormVariables.Item(k + 1).Name == (dr1[0]["lp_name"].ToString() + "_" + (i + 1)))
-                            {
-                                MidDoc.Variables.FormVariables.Item(k + 1).Value = dt1.Rows[i][0].ToString();
-                            }
-                        }
-                    }
-                }
-                if (MidDoc.Variables.FormVariables.Item(j + 1).Value == "")
-                {
-                    dr1 = Attach.Select("lp_name='" + MidDoc.Variables.FormVariables.Item(j + 1).Name + "'");
-                    if (dr1.Length > 0)
-                        MidDoc.Variables.FormVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
-                }
-            }
-            MidDoc.PrintDocument();
         }
 
         private void OutBoxCodePrint(int rowindex)
@@ -1510,62 +1427,7 @@ namespace UAS_LabelMachine
             //获取对应行的pib_id
             string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
             string pib_outboxcode2 = LabelInf.Rows[rowindex].Cells["pib_outboxcode2"].Value.ToString();
-            sql.Clear();
-            for (int j = 0; j < OutBoxDoc.Variables.FormVariables.Count; j++)
-            {
-                DataRow[] dr1 = OutLabelParam.Select("lp_name='" + OutBoxDoc.Variables.FormVariables.Item(j + 1).Name + "'");
-                if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串")
-                {
-                    sql.Append(dr1[0]["lp_sql"].ToString() + ",");
-                }
-            }
-            sql.Append("1,");
-            DataTable dt = (DataTable)sdh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2=" + (pib_outboxcode2 == "" ? "0" : pib_outboxcode2), "select");
-            if (dt.Rows.Count > 0)
-            {
-                for (int j = 0; j < OutBoxDoc.Variables.FormVariables.Count; j++)
-                {
-                    DataRow[] dr1 = OutLabelParam.Select("lp_name='" + OutBoxDoc.Variables.FormVariables.Item(j + 1).Name + "'");
-                    //多参数命名
-                    if (dr1.Length == 0)
-                        dr1 = OutLabelParam.Select("lp_name='" + OutBoxDoc.Variables.FormVariables.Item(j + 1).Name.Replace("_1", "") + "'");
-                    if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串")
-                    {
-                        OutBoxDoc.Variables.FormVariables.Item(j + 1).Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
-                    }
-                    //SQL判断多个值的时候
-                    if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "SQL值")
-                    {
-                        DataTable dt1 = (DataTable)sdh.ExecuteSql(dr1[0]["lp_sql"].ToString().Replace("{1}", "'" + pi_inoutno.Text + "'").Replace("{2}", pib_outboxcode2), "select");
-                        for (int i = 0; i < dt1.Rows.Count; i++)
-                        {
-                            for (int k = 0; k < OutBoxDoc.Variables.FormVariables.Count; k++)
-                            {
-                                if (i == 0 & OutBoxDoc.Variables.FormVariables.Item(k + 1).Name == dr1[0]["lp_name"].ToString())
-                                {
-                                    OutBoxDoc.Variables.FormVariables.Item(k + 1).Value = dt1.Rows[0][0].ToString();
-                                }
-                                //使用SN开头的参数赋值SN1,SN2,SN3等参数
-                                if (OutBoxDoc.Variables.FormVariables.Item(k + 1).Name == (dr1[0]["lp_name"].ToString() + "_" + (i + 1)))
-                                {
-                                    OutBoxDoc.Variables.FormVariables.Item(k + 1).Value = dt1.Rows[i][0].ToString();
-                                }
-                                if (dr1[0]["lp_sql"].ToString().Contains("pib_year"))
-                                {
-                                    string date = dt1.Rows[0][0].ToString();
-                                }
-                            }
-                        }
-                    }
-                    if (OutBoxDoc.Variables.FormVariables.Item(j + 1).Value == "")
-                    {
-                        dr1 = Attach.Select("lp_name='" + OutBoxDoc.Variables.FormVariables.Item(j + 1).Name + "'");
-                        if (dr1.Length > 0)
-                            OutBoxDoc.Variables.FormVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
-                    }
-                }
-                OutBoxDoc.PrintDocument();
-            }
+            Print.CodeSoft.OutPrint(OutBoxDoc, OutLabelParam, pi_inoutno.Text, pib_id, pib_outboxcode2);
         }
 
         private void CleanDetail_Click(object sender, EventArgs e)

+ 3 - 5
UAS-出货标签管理/CustomControl/PrinterCombox.Designer.cs

@@ -37,19 +37,17 @@
             this.PrinterList.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
             this.PrinterList.FormattingEnabled = true;
             this.PrinterList.Location = new System.Drawing.Point(0, 0);
-            this.PrinterList.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
             this.PrinterList.Name = "PrinterList";
-            this.PrinterList.Size = new System.Drawing.Size(284, 26);
+            this.PrinterList.Size = new System.Drawing.Size(189, 20);
             this.PrinterList.TabIndex = 0;
             // 
             // PrinterCombox
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.Controls.Add(this.PrinterList);
-            this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
             this.Name = "PrinterCombox";
-            this.Size = new System.Drawing.Size(284, 28);
+            this.Size = new System.Drawing.Size(189, 19);
             this.Load += new System.EventHandler(this.PrinterCombox_Load);
             this.ResumeLayout(false);
 

+ 1 - 1
UAS-出货标签管理/CustomControl/PrinterCombox.cs

@@ -21,7 +21,7 @@ namespace UAS_LabelMachine.CustomControl
         {
             get
             {
-                return PrinterList.Text; 
+                return PrinterList.Text;
             }
 
             set

+ 3 - 2
UAS-出货标签管理/Login.cs

@@ -1,4 +1,5 @@
-using System;
+using Seagull.BarTender.Print;
+using System;
 using System.Data;
 using System.Drawing;
 using System.Drawing.Drawing2D;
@@ -20,7 +21,7 @@ namespace UAS_LabelMachine
             StartPosition = FormStartPosition.CenterScreen;
         }
 
-        protected override void WndProc(ref Message m)
+        protected override void WndProc(ref System.Windows.Forms.Message m)
         {
             //拦截双击标题栏、移动窗体的系统消息  
             if (m.Msg != 0xA3)

+ 141 - 0
UAS-出货标签管理/PublicMethod/Print.cs

@@ -0,0 +1,141 @@
+using LabelManager2;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Text;
+using UAS_LabelMachine.Entity;
+
+namespace UAS_LabelMachine.PublicMethod
+{
+    class Print
+    {
+        public class CodeSoft
+        {
+            public static void SinglePrint(Document SingleDoc, string[] arg, string pib_id)
+            {
+                DataRow[] dr = UAS_出货标签打印.SingleBoxCacheData.Select("pib_id=" + pib_id);
+                for (int j = 0; j < SingleDoc.Variables.FreeVariables.Count; j++)
+                {
+                    if (arg.Contains(SingleDoc.Variables.FreeVariables.Item(j + 1).Name))
+                        SingleDoc.Variables.FreeVariables.Item(j + 1).Value = dr[0][SingleDoc.Variables.FreeVariables.Item(j + 1).Name].ToString();
+                    if (SingleDoc.Variables.FreeVariables.Item(j + 1).Value == "")
+                    {
+                        DataRow[] dr1 = UAS_出货标签打印.Attach.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name + "'");
+                        if (dr1.Length > 0)
+                        {
+                            SingleDoc.Variables.FreeVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
+                        }
+                    }
+                }
+                SingleDoc.PrintDocument();
+            }
+
+            public static void MidPrint(Document MidDoc, DataTable MidLabelParam, string[] arg, string pib_id, string pib_outboxcode1)
+            {
+                for (int j = 0; j < MidDoc.Variables.FreeVariables.Count; j++)
+                {
+                    //将维护的模板参数和模板本身的参数名称进行比对
+                    for (int k = 0; k < MidLabelParam.Rows.Count; k++)
+                    {
+                        //名称相等的时候,取SQL进行值的查询
+                        if (MidDoc.Variables.FreeVariables.Item(j + 1).Name == MidLabelParam.Rows[k]["lp_name"].ToString())
+                        {
+                            //获取对应行的pib_id
+                            //获取打印执行的SQL
+                            string sql = MidLabelParam.Rows[k]["lp_sql"].ToString();
+                            try
+                            {
+                                //获取打印执行的SQL
+                                if (sql.IndexOf("{") == 0)
+                                {
+                                    MidDoc.Variables.FreeVariables.Item(j + 1).Value = SystemInf.dh.GetLabelParam(sql).ToString();
+                                }
+                                else
+                                {
+                                    DataRow[] dr = UAS_出货标签打印.MidBoxCacheData.Select("pib_outboxcode1='" + pib_outboxcode1 + "'");
+                                    if (arg.Contains(MidDoc.Variables.FreeVariables.Item(j + 1).Name))
+                                    {
+                                        if (dr.Length > 0)
+                                        {
+                                            MidDoc.Variables.FreeVariables.Item(j + 1).Value = dr[0][MidDoc.Variables.FreeVariables.Item(j + 1).Name].ToString();
+                                        }
+                                    }
+                                    if (MidDoc.Variables.FreeVariables.Item(j + 1).Value == "")
+                                    {
+                                        DataRow[] dr1 = UAS_出货标签打印.Attach.Select("lp_name='" + MidDoc.Variables.FreeVariables.Item(j + 1).Name + "'");
+                                        if (dr1.Length > 0)
+                                        {
+                                            MidDoc.Variables.FreeVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
+                                        }
+                                    }
+                                }
+                            }
+                            catch (Exception)
+                            {
+                                return;
+                            }
+                        }
+                    }
+                }
+                MidDoc.PrintDocument();
+            }
+
+            public static void OutPrint(Document OutBoxDoc, DataTable OutLabelParam, string pib_id, string pib_outboxcode2)
+            {
+                for (int j = 0; j < OutBoxDoc.Variables.FreeVariables.Count; j++)
+                {
+                    //将维护的模板参数和模板本身的参数名称进行比对
+                    for (int k = 0; k < OutLabelParam.Rows.Count; k++)
+                    {
+                        //名称相等的时候,取SQL进行值的查询
+                        if (OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name == OutLabelParam.Rows[k]["lp_name"].ToString())
+                        {
+                            //获取对应行的pib_id
+                            //获取打印执行的SQL
+                            string sql = OutLabelParam.Rows[k]["lp_sql"].ToString();
+                            //select * from productiobarcode where pib_id={pib_id} and pib_outboxcode1={pib_outboxcode1}
+                            try
+                            {
+                                string ExeSQL = "";
+                                ExeSQL = sql.ToLower().Replace("{pib_id}", "'" + pib_id + "'");
+                                ExeSQL = ExeSQL.Replace("{pib_outboxcode2}", "'" + pib_outboxcode2 + "'");
+                                OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = SystemInf.dh.GetLabelParam(ExeSQL).ToString();
+                                if (OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value == "")
+                                {
+                                    DataRow[] dr1 = UAS_出货标签打印.Attach.Select("lp_name='" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name + "'");
+                                    if (dr1.Length > 0)
+                                    {
+                                        OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
+                                    }
+                                }
+                                LogManager.DoLog("打印参数【" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name + "】赋值," + "取值SQL:" + ExeSQL + ",取到值" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value);
+                            }
+                            catch (Exception)
+                            {
+                                return;
+                            }
+                        }
+                    }
+                }
+                OutBoxDoc.PrintDocument();
+            }
+        }
+
+        public class BarTender
+        {
+            public static void SinglePrint()
+            {
+
+            }
+            public static void MidPrint()
+            {
+
+            }
+            public static void OutPrint()
+            {
+
+            }
+        }
+    }
+}

+ 11 - 10
UAS-出货标签管理/UAS-出货标签管理.csproj

@@ -48,7 +48,7 @@
     <BootstrapperEnabled>true</BootstrapperEnabled>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <PlatformTarget>AnyCPU</PlatformTarget>
+    <PlatformTarget>x86</PlatformTarget>
     <DebugSymbols>true</DebugSymbols>
     <DebugType>full</DebugType>
     <Optimize>false</Optimize>
@@ -110,6 +110,7 @@
     <Reference Include="Oracle.ManagedDataAccess">
       <HintPath>tool\Oracle.ManagedDataAccess.dll</HintPath>
     </Reference>
+    <Reference Include="Seagull.BarTender.Print, Version=10.1.4.1, Culture=neutral, PublicKeyToken=109ff779a1b4cbc7, processorArchitecture=x86" />
     <Reference Include="System" />
     <Reference Include="System.configuration" />
     <Reference Include="System.Core" />
@@ -127,6 +128,12 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="BartenderPreview.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="BartenderPreview.Designer.cs">
+      <DependentUpon>BartenderPreview.cs</DependentUpon>
+    </Compile>
     <Compile Include="CustomControl\BlurSearch.cs">
       <SubType>UserControl</SubType>
     </Compile>
@@ -289,6 +296,9 @@
     <Compile Include="附件内容打印.Designer.cs">
       <DependentUpon>附件内容打印.cs</DependentUpon>
     </Compile>
+    <EmbeddedResource Include="BartenderPreview.resx">
+      <DependentUpon>BartenderPreview.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="CustomControl\BlurSearch.resx">
       <DependentUpon>BlurSearch.cs</DependentUpon>
     </EmbeddedResource>
@@ -674,15 +684,6 @@
     <None Include="Resources\preview_16px_25980_easyicon.net.png" />
   </ItemGroup>
   <ItemGroup>
-    <COMReference Include="BarTender">
-      <Guid>{D58562C1-E51B-11CF-8941-00A024A9083F}</Guid>
-      <VersionMajor>7</VersionMajor>
-      <VersionMinor>75</VersionMinor>
-      <Lcid>0</Lcid>
-      <WrapperTool>tlbimp</WrapperTool>
-      <Isolated>False</Isolated>
-      <EmbedInteropTypes>False</EmbedInteropTypes>
-    </COMReference>
     <COMReference Include="stdole">
       <Guid>{00020430-0000-0000-C000-000000000046}</Guid>
       <VersionMajor>2</VersionMajor>

+ 20 - 20
UAS-出货标签管理/UAS_出货标签管理.Designer.cs

@@ -152,6 +152,7 @@
             this.pib_outboxcode2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pi_inoutno = new UAS_LabelMachine.CustomControl.EnterTextBox();
             this.SingleLabel = new UAS_LabelMachine.CustomControl.GroupBoxWithBorder.GroupBoxWithBorder();
+            this.CancelOPPOPlate = new System.Windows.Forms.Button();
             this.OPPOPlate = new System.Windows.Forms.Button();
             this.ViVoPlate = new System.Windows.Forms.Button();
             this.SingleLabelPrinter = new UAS_LabelMachine.CustomControl.PrinterCombox();
@@ -180,7 +181,6 @@
             this.OutBoxLabelPrint = new System.Windows.Forms.Button();
             this.OutBoxLabelAutoPrint = new System.Windows.Forms.CheckBox();
             this.OutBoxCombox = new System.Windows.Forms.ComboBox();
-            this.CancelOPPOPlate = new System.Windows.Forms.Button();
             ((System.ComponentModel.ISupportInitialize)(this.Si_ItemDGV)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.MidSource)).BeginInit();
             this.groupBoxWithBorder1.SuspendLayout();
@@ -1425,6 +1425,19 @@
             this.SingleLabel.TabStop = false;
             this.SingleLabel.Text = "单盘标签";
             // 
+            // CancelOPPOPlate
+            // 
+            this.CancelOPPOPlate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+            this.CancelOPPOPlate.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.CancelOPPOPlate.Location = new System.Drawing.Point(10, 169);
+            this.CancelOPPOPlate.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.CancelOPPOPlate.Name = "CancelOPPOPlate";
+            this.CancelOPPOPlate.Size = new System.Drawing.Size(80, 26);
+            this.CancelOPPOPlate.TabIndex = 43;
+            this.CancelOPPOPlate.Text = "取消Oppo";
+            this.CancelOPPOPlate.UseVisualStyleBackColor = true;
+            this.CancelOPPOPlate.Click += new System.EventHandler(this.CancelOPPOPlate_Click);
+            // 
             // OPPOPlate
             // 
             this.OPPOPlate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -1457,7 +1470,7 @@
             this.SingleLabelPrinter.Location = new System.Drawing.Point(6, 78);
             this.SingleLabelPrinter.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6);
             this.SingleLabelPrinter.Name = "SingleLabelPrinter";
-            this.SingleLabelPrinter.Size = new System.Drawing.Size(142, 30);
+            this.SingleLabelPrinter.Size = new System.Drawing.Size(142, 25);
             this.SingleLabelPrinter.TabIndex = 40;
             // 
             // SingleLabelPrint
@@ -1557,7 +1570,7 @@
             this.MidLabelPrinter.Location = new System.Drawing.Point(6, 78);
             this.MidLabelPrinter.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6);
             this.MidLabelPrinter.Name = "MidLabelPrinter";
-            this.MidLabelPrinter.Size = new System.Drawing.Size(142, 30);
+            this.MidLabelPrinter.Size = new System.Drawing.Size(142, 25);
             this.MidLabelPrinter.TabIndex = 41;
             // 
             // label15
@@ -1701,7 +1714,7 @@
             this.OutBoxPrinter.Location = new System.Drawing.Point(8, 78);
             this.OutBoxPrinter.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6);
             this.OutBoxPrinter.Name = "OutBoxPrinter";
-            this.OutBoxPrinter.Size = new System.Drawing.Size(158, 30);
+            this.OutBoxPrinter.Size = new System.Drawing.Size(158, 25);
             this.OutBoxPrinter.TabIndex = 82;
             // 
             // OutboxCapacity
@@ -1767,19 +1780,6 @@
             this.OutBoxCombox.TabIndex = 78;
             this.OutBoxCombox.SelectedIndexChanged += new System.EventHandler(this.OutBoxCombox_SelectedIndexChanged);
             // 
-            // CancelOPPOPlate
-            // 
-            this.CancelOPPOPlate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
-            this.CancelOPPOPlate.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.CancelOPPOPlate.Location = new System.Drawing.Point(10, 169);
-            this.CancelOPPOPlate.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
-            this.CancelOPPOPlate.Name = "CancelOPPOPlate";
-            this.CancelOPPOPlate.Size = new System.Drawing.Size(80, 26);
-            this.CancelOPPOPlate.TabIndex = 43;
-            this.CancelOPPOPlate.Text = "取消Oppo";
-            this.CancelOPPOPlate.UseVisualStyleBackColor = true;
-            this.CancelOPPOPlate.Click += new System.EventHandler(this.CancelOPPOPlate_Click);
-            // 
             // UAS_出货标签打印
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -1860,7 +1860,6 @@
         private CustomControl.GroupBoxWithBorder.GroupBoxWithBorder OutBoxLabel;
         private CustomControl.EnterTextBox OutBoxNum;
         private System.Windows.Forms.Label label10;
-        private CustomControl.PrinterCombox OutBoxPrinter;
         private System.Windows.Forms.Button OutBoxLabelPrint;
         private System.Windows.Forms.ComboBox OutBoxCombox;
         private System.Windows.Forms.DataGridViewCheckBoxColumn dataGridViewCheckBoxColumn1;
@@ -1890,7 +1889,6 @@
         private System.Windows.Forms.Button MidLabelPrint;
         private System.Windows.Forms.NumericUpDown MidBoxCapacity;
         private System.Windows.Forms.Label label15;
-        private CustomControl.PrinterCombox MidLabelPrinter;
         private System.Windows.Forms.Label label4;
         private System.Windows.Forms.Label label5;
         private CustomControl.EnterTextBox MidLabelNum;
@@ -1898,7 +1896,6 @@
         private System.Windows.Forms.ComboBox SingleLabelCombox;
         private System.Windows.Forms.CheckBox SingleLabelAutoPrint;
         private System.Windows.Forms.Button SingleLabelPrint;
-        private CustomControl.PrinterCombox SingleLabelPrinter;
         private CustomControl.GroupBoxWithBorder.GroupBoxWithBorder SingleLabel;
         private CustomControl.EnterTextBox pi_inoutno;
         private System.Windows.Forms.Label pi_inoutno_label;
@@ -2008,5 +2005,8 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_outboxcode2;
         private CustomControl.SearchTextBox cu_code;
         private System.Windows.Forms.Button CancelOPPOPlate;
+        public CustomControl.PrinterCombox OutBoxPrinter;
+        public CustomControl.PrinterCombox MidLabelPrinter;
+        public CustomControl.PrinterCombox SingleLabelPrinter;
     }
 }

+ 1 - 1
UAS-出货标签管理/UAS_出货标签管理.cs

@@ -2035,7 +2035,7 @@ namespace UAS_LabelMachine
             bool mouseOver = e.CellBounds.Contains(this.PointToClient(Cursor.Position));
             if (e.ColumnIndex > 0)
             {
-                if (LabelInf.Columns[e.ColumnIndex].Name == "pib_custbarcode"|| LabelInf.Columns[e.ColumnIndex].Name == "pib_barcode"||LabelInf.Columns[e.ColumnIndex].Name == "pib_madein" || LabelInf.Columns[e.ColumnIndex].Name == "pib_lotno" || LabelInf.Columns[e.ColumnIndex].Name == "pib_datecode" || LabelInf.Columns[e.ColumnIndex].Name == "pib_outboxcode1" || LabelInf.Columns[e.ColumnIndex].Name == "pib_outboxcode2" || LabelInf.Columns[e.ColumnIndex].Name == "pib_brand")
+                if (LabelInf.Columns[e.ColumnIndex].Name == "pib_custbarcode" || LabelInf.Columns[e.ColumnIndex].Name == "pib_barcode" || LabelInf.Columns[e.ColumnIndex].Name == "pib_madein" || LabelInf.Columns[e.ColumnIndex].Name == "pib_lotno" || LabelInf.Columns[e.ColumnIndex].Name == "pib_datecode" || LabelInf.Columns[e.ColumnIndex].Name == "pib_outboxcode1" || LabelInf.Columns[e.ColumnIndex].Name == "pib_outboxcode2" || LabelInf.Columns[e.ColumnIndex].Name == "pib_brand")
                 {
                     SolidBrush solidBrush = new SolidBrush(Color.FromArgb(51, 153, 255));
                     e.Graphics.FillRectangle(mouseOver ? solidBrush : Brushes.LightSeaGreen, e.CellBounds);

BIN
UAS-出货标签管理/tool/BarTenderPrintClient.dll


BIN
UAS-出货标签管理/tool/Seagull.BarTender.Print.dll


+ 30 - 15
UAS-出货标签管理/客户标签维护.Designer.cs

@@ -33,8 +33,8 @@ namespace UAS_LabelMachine
         private void InitializeComponent()
         {
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(客户标签维护));
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
             this.cl_code_label = new System.Windows.Forms.Label();
             this.cu_name_label = new System.Windows.Forms.Label();
             this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
@@ -86,6 +86,7 @@ namespace UAS_LabelMachine
             this.Screen = new UAS_LabelMachine.CustomControl.NormalButton();
             this.cu_name = new UAS_LabelMachine.CustomControl.EnterTextBox();
             this.PortModel = new System.Windows.Forms.CheckBox();
+            this.BarTender = new System.Windows.Forms.RadioButton();
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.LabelDataGridView)).BeginInit();
             this.SuspendLayout();
@@ -277,13 +278,12 @@ namespace UAS_LabelMachine
             // CodeSoft
             // 
             this.CodeSoft.AutoSize = true;
-            this.CodeSoft.Checked = true;
+            this.CodeSoft.Enabled = false;
             this.CodeSoft.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.CodeSoft.Location = new System.Drawing.Point(1058, 86);
+            this.CodeSoft.Location = new System.Drawing.Point(1049, 76);
             this.CodeSoft.Name = "CodeSoft";
             this.CodeSoft.Size = new System.Drawing.Size(99, 25);
             this.CodeSoft.TabIndex = 161;
-            this.CodeSoft.TabStop = true;
             this.CodeSoft.Text = "CodeSoft";
             this.CodeSoft.UseVisualStyleBackColor = true;
             this.CodeSoft.Visible = false;
@@ -401,16 +401,16 @@ namespace UAS_LabelMachine
             this.cl_status});
             this.LabelDataGridView.Location = new System.Drawing.Point(17, 90);
             this.LabelDataGridView.Name = "LabelDataGridView";
-            dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
-            dataGridViewCellStyle3.BackColor = System.Drawing.Color.Blue;
-            dataGridViewCellStyle3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText;
-            dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight;
-            dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
-            dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
-            this.LabelDataGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle3;
-            dataGridViewCellStyle4.BackColor = System.Drawing.Color.White;
-            this.LabelDataGridView.RowsDefaultCellStyle = dataGridViewCellStyle4;
+            dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
+            dataGridViewCellStyle1.BackColor = System.Drawing.Color.Blue;
+            dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
+            dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
+            dataGridViewCellStyle1.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
+            dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
+            this.LabelDataGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle1;
+            dataGridViewCellStyle2.BackColor = System.Drawing.Color.White;
+            this.LabelDataGridView.RowsDefaultCellStyle = dataGridViewCellStyle2;
             this.LabelDataGridView.RowTemplate.Height = 23;
             this.LabelDataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
             this.LabelDataGridView.Size = new System.Drawing.Size(890, 348);
@@ -608,11 +608,25 @@ namespace UAS_LabelMachine
             this.PortModel.UseVisualStyleBackColor = true;
             this.PortModel.CheckedChanged += new System.EventHandler(this.PortModel_CheckedChanged);
             // 
+            // BarTender
+            // 
+            this.BarTender.AutoSize = true;
+            this.BarTender.Enabled = false;
+            this.BarTender.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.BarTender.Location = new System.Drawing.Point(1049, 108);
+            this.BarTender.Name = "BarTender";
+            this.BarTender.Size = new System.Drawing.Size(106, 25);
+            this.BarTender.TabIndex = 193;
+            this.BarTender.Text = "BarTender";
+            this.BarTender.UseVisualStyleBackColor = true;
+            this.BarTender.Visible = false;
+            // 
             // 客户标签维护
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1179, 581);
+            this.Controls.Add(this.BarTender);
             this.Controls.Add(this.PortModel);
             this.Controls.Add(this.pictureBox1);
             this.Controls.Add(this.pagination1);
@@ -716,5 +730,6 @@ namespace UAS_LabelMachine
         private DataGridViewTextBoxColumn cl_status;
         private PictureBox pictureBox1;
         private CheckBox PortModel;
+        private RadioButton BarTender;
     }
 }

+ 33 - 29
UAS-出货标签管理/生成条码.Designer.cs

@@ -37,12 +37,10 @@
             this.MidCapacity_label = new System.Windows.Forms.Label();
             this.ResetSerialNum = new UAS_LabelMachine.CustomControl.NormalButton();
             this.SetMidCapacity = new UAS_LabelMachine.CustomControl.NormalButton();
-            this.MidCapacity = new UAS_LabelMachine.CustomControl.NumOnlyTextBox();
             this.ChooseAll = new UAS_LabelMachine.CustomControl.ChooseAllButton();
             this.GenerateBarCode = new UAS_LabelMachine.CustomControl.NormalButton();
             this.Screen = new UAS_LabelMachine.CustomControl.NormalButton();
             this.ProdIoInfDGV = new UAS_LabelMachine.CustomControl.DataGridViewWithSerialNum();
-            this.pi_inoutno = new UAS_LabelMachine.CustomControl.EnterTextBox();
             this.Choose = new System.Windows.Forms.DataGridViewCheckBoxColumn();
             this.pd_orderdetno = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pd_pdno = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -61,6 +59,8 @@
             this.mid_qty = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.mid_num = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.mid_remain = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pi_inoutno = new UAS_LabelMachine.CustomControl.EnterTextBox();
+            this.MidCapacity = new UAS_LabelMachine.CustomControl.EnterTextBox();
             ((System.ComponentModel.ISupportInitialize)(this.ProdIoInfDGV)).BeginInit();
             this.SuspendLayout();
             // 
@@ -129,7 +129,7 @@
             // ResetSerialNum
             // 
             this.ResetSerialNum.Image = ((System.Drawing.Image)(resources.GetObject("ResetSerialNum.Image")));
-            this.ResetSerialNum.Location = new System.Drawing.Point(529, 78);
+            this.ResetSerialNum.Location = new System.Drawing.Point(661, 78);
             this.ResetSerialNum.Name = "ResetSerialNum";
             this.ResetSerialNum.Size = new System.Drawing.Size(64, 24);
             this.ResetSerialNum.TabIndex = 161;
@@ -148,14 +148,6 @@
             this.SetMidCapacity.UseVisualStyleBackColor = true;
             this.SetMidCapacity.Click += new System.EventHandler(this.SetMidCapacity_Click);
             // 
-            // MidCapacity
-            // 
-            this.MidCapacity.Location = new System.Drawing.Point(787, 29);
-            this.MidCapacity.Name = "MidCapacity";
-            this.MidCapacity.Negative = false;
-            this.MidCapacity.Size = new System.Drawing.Size(121, 21);
-            this.MidCapacity.TabIndex = 159;
-            // 
             // ChooseAll
             // 
             this.ChooseAll.Location = new System.Drawing.Point(1, 102);
@@ -168,7 +160,7 @@
             // GenerateBarCode
             // 
             this.GenerateBarCode.Image = ((System.Drawing.Image)(resources.GetObject("GenerateBarCode.Image")));
-            this.GenerateBarCode.Location = new System.Drawing.Point(442, 78);
+            this.GenerateBarCode.Location = new System.Drawing.Point(574, 78);
             this.GenerateBarCode.Name = "GenerateBarCode";
             this.GenerateBarCode.Size = new System.Drawing.Size(64, 24);
             this.GenerateBarCode.TabIndex = 154;
@@ -179,7 +171,7 @@
             // Screen
             // 
             this.Screen.Image = ((System.Drawing.Image)(resources.GetObject("Screen.Image")));
-            this.Screen.Location = new System.Drawing.Point(354, 78);
+            this.Screen.Location = new System.Drawing.Point(486, 78);
             this.Screen.Name = "Screen";
             this.Screen.Size = new System.Drawing.Size(64, 24);
             this.Screen.TabIndex = 153;
@@ -223,19 +215,6 @@
             this.ProdIoInfDGV.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.ProdIoInfDGV_CellEndEdit);
             this.ProdIoInfDGV.CellPainting += new System.Windows.Forms.DataGridViewCellPaintingEventHandler(this.ProdIoInfDGV_CellPainting);
             // 
-            // pi_inoutno
-            // 
-            this.pi_inoutno.ID = null;
-            this.pi_inoutno.Location = new System.Drawing.Point(128, 29);
-            this.pi_inoutno.Name = "pi_inoutno";
-            this.pi_inoutno.Size = new System.Drawing.Size(121, 21);
-            this.pi_inoutno.Str = null;
-            this.pi_inoutno.Str1 = null;
-            this.pi_inoutno.Str2 = null;
-            this.pi_inoutno.TabIndex = 149;
-            this.pi_inoutno.Tag = "cu_name";
-            this.pi_inoutno.KeyDown += new System.Windows.Forms.KeyEventHandler(this.bi_inoutno_KeyDown);
-            // 
             // Choose
             // 
             this.Choose.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
@@ -249,7 +228,7 @@
             this.pd_orderdetno.DataPropertyName = "pd_orderdetno";
             this.pd_orderdetno.HeaderText = "订单序号";
             this.pd_orderdetno.Name = "pd_orderdetno";
-            this.pd_orderdetno.Width = 78;
+            this.pd_orderdetno.Width = 61;
             // 
             // pd_pdno
             // 
@@ -360,14 +339,39 @@
             this.mid_remain.Name = "mid_remain";
             this.mid_remain.ReadOnly = true;
             // 
+            // pi_inoutno
+            // 
+            this.pi_inoutno.ID = null;
+            this.pi_inoutno.Location = new System.Drawing.Point(128, 29);
+            this.pi_inoutno.Name = "pi_inoutno";
+            this.pi_inoutno.Size = new System.Drawing.Size(121, 21);
+            this.pi_inoutno.Str = null;
+            this.pi_inoutno.Str1 = null;
+            this.pi_inoutno.Str2 = null;
+            this.pi_inoutno.TabIndex = 149;
+            this.pi_inoutno.Tag = "cu_name";
+            this.pi_inoutno.KeyDown += new System.Windows.Forms.KeyEventHandler(this.bi_inoutno_KeyDown);
+            // 
+            // MidCapacity
+            // 
+            this.MidCapacity.ID = null;
+            this.MidCapacity.Location = new System.Drawing.Point(783, 30);
+            this.MidCapacity.Name = "MidCapacity";
+            this.MidCapacity.Size = new System.Drawing.Size(121, 21);
+            this.MidCapacity.Str = null;
+            this.MidCapacity.Str1 = null;
+            this.MidCapacity.Str2 = null;
+            this.MidCapacity.TabIndex = 162;
+            this.MidCapacity.Tag = "cu_name";
+            // 
             // 生成条码
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1201, 554);
+            this.Controls.Add(this.MidCapacity);
             this.Controls.Add(this.ResetSerialNum);
             this.Controls.Add(this.SetMidCapacity);
-            this.Controls.Add(this.MidCapacity);
             this.Controls.Add(this.MidCapacity_label);
             this.Controls.Add(this.pr_kind);
             this.Controls.Add(this.pr_kind_label);
@@ -402,7 +406,6 @@
         private System.Windows.Forms.Label pr_kind_label;
         private System.Windows.Forms.ComboBox pr_kind;
         private System.Windows.Forms.Label MidCapacity_label;
-        private CustomControl.NumOnlyTextBox MidCapacity;
         private CustomControl.NormalButton SetMidCapacity;
         private CustomControl.NormalButton ResetSerialNum;
         private System.Windows.Forms.DataGridViewCheckBoxColumn Choose;
@@ -423,5 +426,6 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn mid_qty;
         private System.Windows.Forms.DataGridViewTextBoxColumn mid_num;
         private System.Windows.Forms.DataGridViewTextBoxColumn mid_remain;
+        private CustomControl.EnterTextBox MidCapacity;
     }
 }

+ 44 - 39
UAS-出货标签管理/生成条码.cs

@@ -191,11 +191,11 @@ namespace UAS_LabelMachine
                     string pr_brand = ProdIoInfDGV.Rows[i].Cells["pr_brand"].FormattedValue.ToString();
                     string pr_madein = ProdIoInfDGV.Rows[i].Cells["pr_madein"].FormattedValue.ToString();
                     //总数
-                    int pd_totalqty = int.Parse(ProdIoInfDGV.Rows[i].Cells["pd_totalqty"].FormattedValue.ToString());
+                    double pd_totalqty = double.Parse(ProdIoInfDGV.Rows[i].Cells["pd_totalqty"].FormattedValue.ToString());
                     //本次数量
-                    int pd_qty = int.Parse(ProdIoInfDGV.Rows[i].Cells["pd_qty"].FormattedValue.ToString());
+                    double pd_qty = double.Parse(ProdIoInfDGV.Rows[i].Cells["pd_qty"].FormattedValue.ToString());
                     //最小包装数
-                    int pr_zxbzs = int.Parse(ProdIoInfDGV.Rows[i].Cells["pr_zxbzs"].FormattedValue.ToString());
+                    double pr_zxbzs = double.Parse(ProdIoInfDGV.Rows[i].Cells["pr_zxbzs"].FormattedValue.ToString());
                     //中盒容量
                     int mid_qty;
                     try
@@ -210,7 +210,7 @@ namespace UAS_LabelMachine
                     //如果中盘盒数量为1且有尾数则表示一箱未装满
                     int mid_num = int.Parse(ProdIoInfDGV.Rows[i].Cells["mid_num"].FormattedValue.ToString());
                     //中盒尾数
-                    int mid_remain = int.Parse(ProdIoInfDGV.Rows[i].Cells["mid_remain"].FormattedValue.ToString());
+                    double mid_remain = double.Parse(ProdIoInfDGV.Rows[i].Cells["mid_remain"].FormattedValue.ToString());
                     string pib_barcode = dh.getFieldDataByCondition("prodiobarcode", "max(pib_barcode)", "PIB_INOUTNO='" + pi_inoutno.Text + "'").ToString();
                     //中盒数量*中盒容量=需要打印的单盘标签
                     ArrayList<string> midcode = new ArrayList<string>();
@@ -223,11 +223,19 @@ namespace UAS_LabelMachine
                         string mid_code = dh.getFieldDataByCondition("PRODIOBARCODE", "nvl(max(to_number(PIB_OUTBOXCODE1)),0)+" + (j + 1), "PIB_INOUTNO='" + pi_inoutno.Text + "'").ToString();
                         //如果尾数不为0,并且已经遍历到了最后一箱(未装满的箱)
                         int count = 0;
-                        int AddNum = pr_zxbzs;
+                        double AddNum = pr_zxbzs;
                         if (mid_remain != 0 && j + 1 == mid_num)
                         {
                             //剩下的尾数刚好够整数的最小包或者加上一个未装满的最小包
-                            count = mid_remain % pr_zxbzs == 0 ? mid_remain / pr_zxbzs : (mid_remain / pr_zxbzs) + 1;
+                            int num = 0;
+                            if (int.TryParse((mid_remain % pr_zxbzs).ToString(), out num))
+                            {
+                                count = int.Parse(Math.Floor(mid_remain / pr_zxbzs).ToString());
+                            }
+                            else
+                            {
+                                count = int.Parse(Math.Ceiling(mid_remain / pr_zxbzs).ToString());
+                            }
                         }
                         else
                         {
@@ -251,7 +259,7 @@ namespace UAS_LabelMachine
                         sql.Clear();
                         sql.Append("insert into prodiobarcode (PIB_ID,PIB_PRODCODE,PIB_INDATE,PIB_MADEIN,PIB_INOUTNO,PIB_PIID,pib_brand,PIB_BARCODE,PIB_CUSTBARCODE,PIB_PDNO,");
                         sql.Append("PIB_PDID,PIB_PICLASS,PIB_QTY,PIB_PRODID,PIB_OUTBOXCODE1,PIB_IFPRINT,PIB_IFPICK,PIB_ORDERCODE,PIB_CUSTPO,pib_orderdetno)");
-                        sql.Append(" values (prodiobarcode_seq.nextval,'" + pd_prodcode + "',sysdate,'"+ pr_madein + "','" + pi_inoutno.Text + "'," + pi_id + ",'" + pr_brand + "',:barcode,:custbarcode,'" + pd_pdno + "','" + pd_id + "',");
+                        sql.Append(" values (prodiobarcode_seq.nextval,'" + pd_prodcode + "',sysdate,'" + pr_madein + "','" + pi_inoutno.Text + "'," + pi_id + ",'" + pr_brand + "',:barcode,:custbarcode,'" + pd_pdno + "','" + pd_id + "',");
                         sql.Append("'" + pi_class.Text + "',:pib_inqty,'" + pr_id + "',:midcode,0,0,'" + pd_ordercode + "','','" + pd_orderdetno + "')");
                         dh.BatchInsert(sql.ToString(), new string[] { "barcode", "custbarcode", "pib_inqty", "midcode" }, barcode.ToArray(), custbarcode.ToArray(), pib_inqty.ToArray(), midcode.ToArray());
                         //更新最大流水号
@@ -369,37 +377,30 @@ namespace UAS_LabelMachine
         /// <param name="e"></param>
         private void ProdIoInfDGV_CellEndEdit(object sender, DataGridViewCellEventArgs e)
         {
+
             object pr_zxbzs = ProdIoInfDGV.Rows[e.RowIndex].Cells["pr_zxbzs"].Value;
             object pd_qty = ProdIoInfDGV.Rows[e.RowIndex].Cells["pd_qty"].Value;
             object mid_qty = ProdIoInfDGV.Rows[e.RowIndex].Cells["mid_qty"].Value;
             object pd_totalqty = ProdIoInfDGV.Rows[e.RowIndex].Cells["pd_totalqty"].Value;
             if (pr_zxbzs != null && pd_qty != null && mid_qty != null)
             {
-                int 最小包装量 = int.Parse(pr_zxbzs.ToString());
-                int 中盘容量 = int.Parse(mid_qty.ToString());
-                int 本次数量 = int.Parse(pd_qty.ToString());
-                int 总数 = int.Parse(pd_totalqty.ToString());
-                if (最小包装量 > 0)
+                double 最小包装量 = double.Parse(pr_zxbzs.ToString());
+                double 中盘容量 = double.Parse(mid_qty.ToString());
+                double 本次数量 = double.Parse(pd_qty.ToString());
+                double 总数 = double.Parse(pd_totalqty.ToString());
+                //计算中盘数量
+                double mid_num = 本次数量 / (最小包装量 * 中盘容量);
+                int num = 0;
+                if (int.TryParse(mid_num.ToString(), out num))
                 {
-                    if (本次数量 > 总数)
-                    {
-                        MessageBox.Show("本次数量不能大于总数");
-                        return;
-                    }
-                    if (中盘容量 <= 0 || 最小包装量 <= 0)
-                    {
-                        MessageBox.Show("中盘容量和单盘数量必须是正整数");
-                        return;
-                    }
-                    //计算中盘数量
-                    int mid_num = 本次数量 / (最小包装量 * 中盘容量);
-                    //计算中盘尾数
-                    if (本次数量 % (最小包装量 * 中盘容量) == 0)
-                        ProdIoInfDGV.Rows[e.RowIndex].Cells["mid_num"].Value = mid_num;
-                    else
-                        ProdIoInfDGV.Rows[e.RowIndex].Cells["mid_num"].Value = mid_num + 1;
+                    ProdIoInfDGV.Rows[e.RowIndex].Cells["mid_num"].Value = mid_num;
                     ProdIoInfDGV.Rows[e.RowIndex].Cells["mid_remain"].Value = 本次数量 - mid_num * 最小包装量 * 中盘容量;
                 }
+                else
+                {
+                    ProdIoInfDGV.Rows[e.RowIndex].Cells["mid_num"].Value = Math.Floor(mid_num) + 1;
+                    ProdIoInfDGV.Rows[e.RowIndex].Cells["mid_remain"].Value = 本次数量 - Math.Floor(mid_num) * 最小包装量 * 中盘容量;
+                }
             }
         }
 
@@ -417,18 +418,23 @@ namespace UAS_LabelMachine
                     object pd_totalqty = ProdIoInfDGV.Rows[i].Cells["pd_totalqty"].Value;
                     if (pr_zxbzs != null && pd_qty != null && mid_qty != null)
                     {
-                        int 最小包装量 = int.Parse(pr_zxbzs.ToString());
-                        int 中盘容量 = int.Parse(mid_qty.ToString());
-                        int 本次数量 = int.Parse(pd_qty.ToString());
-                        int 总数 = int.Parse(pd_totalqty.ToString());
+                        double 最小包装量 = double.Parse(pr_zxbzs.ToString());
+                        double 中盘容量 = double.Parse(mid_qty.ToString());
+                        double 本次数量 = double.Parse(pd_qty.ToString());
+                        double 总数 = double.Parse(pd_totalqty.ToString());
                         //计算中盘数量
-                        int mid_num = 本次数量 / (最小包装量 * 中盘容量);
-                        //计算中盘尾数
-                        if (本次数量 % (最小包装量 * 中盘容量) == 0)
+                        double mid_num = 本次数量 / (最小包装量 * 中盘容量);
+                        int num = 0;
+                        if (int.TryParse(mid_num.ToString(), out num))
+                        {
                             ProdIoInfDGV.Rows[i].Cells["mid_num"].Value = mid_num;
+                            ProdIoInfDGV.Rows[i].Cells["mid_remain"].Value = 本次数量 - mid_num * 最小包装量 * 中盘容量;
+                        }
                         else
-                            ProdIoInfDGV.Rows[i].Cells["mid_num"].Value = mid_num + 1;
-                        ProdIoInfDGV.Rows[i].Cells["mid_remain"].Value = 本次数量 - mid_num * 最小包装量 * 中盘容量;
+                        {
+                            ProdIoInfDGV.Rows[i].Cells["mid_num"].Value = Math.Floor(mid_num) + 1;
+                            ProdIoInfDGV.Rows[i].Cells["mid_remain"].Value = 本次数量 - Math.Floor(mid_num) * 最小包装量 * 中盘容量;
+                        }
                     }
                 }
             }
@@ -469,7 +475,6 @@ namespace UAS_LabelMachine
                     default:
                         break;
                 }
-
                 dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
                 BaseUtil.FillDgvWithDataTable(ProdIoInfDGV, dt);
             }