Browse Source

CodeSoft版本修改

章政 6 years ago
parent
commit
dbb0b1952d

+ 0 - 4
UAS-出货标签管理/Login.cs

@@ -15,8 +15,6 @@ namespace UAS_LabelMachine
         DataHelper dh;
         DataTable dt;
 
-     
-
         public Login()
         {
             InitializeComponent();
@@ -32,8 +30,6 @@ namespace UAS_LabelMachine
 
         private void Login_Load(object sender, EventArgs e)
         {
-            Engine engine = new Engine(true);
-            LabelFormatDocument format = engine.Documents.Open(@"C:\Users\callm\Desktop\GI-1A-5D.btw");
             dh = new DataHelper();
             SystemInf.dh = dh;
             //获取账套信息

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

@@ -174,6 +174,11 @@ namespace UAS_LabelMachine
         {
             //杀死之前全部未关闭的进程
             Process[] processes = System.Diagnostics.Process.GetProcessesByName("lppa");
+            Process[] processes1 = System.Diagnostics.Process.GetProcessesByName("bartend");
+            for (int i = 0; i < processes1.Length; i++)
+            {
+                processes1[i].Kill();
+            }
             for (int i = 0; i < processes.Length; i++)
             {
                 processes[i].Kill();
@@ -248,7 +253,7 @@ namespace UAS_LabelMachine
             asc.controllInitializeSize(this);
             asc.controlAutoSize(this);
             //实例化打印进程,如果没有配置默认使用BarTener
-            string Code = dh.GetConfig("", "").ToString();
+            string Code =  dh.GetConfig("PrintMethod", "CodeOrBar").ToString() ;
             if (Code == "")
             {
                 try
@@ -1039,12 +1044,11 @@ namespace UAS_LabelMachine
                 }
             if (SingleLabelCombox.Text != "")
             {
-                SingleDoc = lbl.Documents.Open(ftpOperater.DownLoadTo + SingleLabelCombox.Text);
-                SingleDoc.Printer.SwitchTo(SingleLabelPrinter.Text);
-                SingleLabelParam = (DataTable)dh.ExecuteSql("select lp_name,lp_sql from label left join LABELPARAMETER on la_id= lp_laid where la_id=" + SingleLabelCombox.SelectedValue.ToString().Split('#')[0], "select");
-                for (int i = 0; i < SingleDoc.Variables.FreeVariables.Count; i++)
+                if (PrintMethod == "CodeSoft")
                 {
-                    SingleParam.Add(SingleDoc.Variables.FreeVariables.Item(i + 1).Name);
+                    SingleDoc = lbl.Documents.Open(ftpOperater.DownLoadTo + SingleLabelCombox.Text);
+                    SingleDoc.Printer.SwitchTo(SingleLabelPrinter.Text);
+                    SingleLabelParam = (DataTable)dh.ExecuteSql("select lp_name,lp_sql from label left join LABELPARAMETER on la_id= lp_laid where la_id=" + SingleLabelCombox.SelectedValue.ToString().Split('#')[0], "select");
                 }
             }
             sql.Clear();
@@ -1069,9 +1073,12 @@ namespace UAS_LabelMachine
                 }
             if (MidLabelCombox.Text != "")
             {
-                MidDoc = lbl.Documents.Open(ftpOperater.DownLoadTo + MidLabelCombox.Text);
-                MidDoc.Printer.SwitchTo(MidLabelPrinter.Text);
-                MidLabelParam = (DataTable)dh.ExecuteSql("select lp_name,lp_sql from label left join LABELPARAMETER on la_id= lp_laid where la_id=" + MidLabelCombox.SelectedValue.ToString().Split('#')[0], "select");
+                if (PrintMethod == "CodeSoft")
+                {
+                    MidDoc = lbl.Documents.Open(ftpOperater.DownLoadTo + MidLabelCombox.Text);
+                    MidDoc.Printer.SwitchTo(MidLabelPrinter.Text);
+                    MidLabelParam = (DataTable)dh.ExecuteSql("select lp_name,lp_sql from label left join LABELPARAMETER on la_id= lp_laid where la_id=" + MidLabelCombox.SelectedValue.ToString().Split('#')[0], "select");
+                }
             }
             //缓存中盒参数
             sql.Clear();
@@ -1096,14 +1103,17 @@ namespace UAS_LabelMachine
                 }
             if (OutBoxCombox.Text != "")
             {
-                OutBoxDoc = lbl.Documents.Open(ftpOperater.DownLoadTo + OutBoxCombox.Text);
-                OutBoxDoc.Printer.SwitchTo(OutBoxPrinter.Text);
-                OutLabelParam = (DataTable)dh.ExecuteSql("select lp_name,lp_sql,lp_valuetype from label left join LABELPARAMETER on la_id= lp_laid where la_id=" + OutBoxCombox.SelectedValue.ToString().Split('#')[0], "select");
+                if (PrintMethod == "CodeSoft")
+                {
+                    OutBoxDoc = lbl.Documents.Open(ftpOperater.DownLoadTo + OutBoxCombox.Text);
+                    OutBoxDoc.Printer.SwitchTo(OutBoxPrinter.Text);
+                    OutLabelParam = (DataTable)dh.ExecuteSql("select lp_name,lp_sql,lp_valuetype from label left join LABELPARAMETER on la_id= lp_laid where la_id=" + OutBoxCombox.SelectedValue.ToString().Split('#')[0], "select");
+                }
             }
             //缓存外箱参数
             ComBoxClickChangeLabelDoc = true;
-            GetSingleBoxData();
-            GetMidBoxData();
+            GetSingleBoxData(PrintMethod);
+            GetMidBoxData(PrintMethod);
         }
         bool InitGetLabel = true;
         /// <summary>
@@ -1188,11 +1198,6 @@ namespace UAS_LabelMachine
                     MessageBox.Show("中盘标签未维护参数");
                 }
             }
-            string la_id = SingleLabelCombox.SelectedValue.ToString().Split('#')[0];
-            string cl_labelname = SingleLabelCombox.Text;
-            string LabelUrl = dh.getFieldDataByCondition("label left join customerlabel on la_code=cl_labelcode", "cl_labelurl", "la_id='" + la_id + "' and cl_labelname='" + cl_labelname + "'").ToString();
-            //查询该模板维护的所有参数
-            dt = (DataTable)dh.ExecuteSql("select lp_name,lp_sql from label left join LABELPARAMETER on la_id= lp_laid where la_id=" + la_id, "select");
             if (SingleLabelParam.Rows.Count > 0 && LabelInf.Rows.Count > 0)
             {
                 //每次打印清除之前缓存的行号和ID,后面会判断需要打印的数据重新加载
@@ -1222,9 +1227,9 @@ namespace UAS_LabelMachine
                 }
                 //打印的时候如果不存在数据开始缓存
                 if (SingleBoxCacheData.Rows.Count == 0)
-                    GetSingleBoxData();
+                    GetSingleBoxData(PrintMethod);
                 if (MidBoxCacheData.Rows.Count == 0)
-                    GetMidBoxData();
+                    GetMidBoxData(PrintMethod);
                 for (int i = 0; i < LabelInf.RowCount; i++)
                 {
                     if (i + 1 < LabelInf.RowCount)
@@ -1299,161 +1304,167 @@ namespace UAS_LabelMachine
         /// <summary>
         /// 缓存单盘的数据
         /// </summary>
-        private void GetSingleBoxData()
+        private void GetSingleBoxData(string PrintMethod)
         {
-            if (SingleDoc == null)
-                return;
-            for (int i = 0; i < LabelInf.Rows.Count; i++)
-            {
-                if (!SingleID.Contains(LabelInf.Rows[i].Cells["pib_id1"].Value.ToString()))
-                    SingleID.Add(LabelInf.Rows[i].Cells["pib_id1"].Value.ToString());
-                //如果不存在中盒号则进行添加
-                if (!MidIDAndOutboxcode.ContainsValue(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()))
-                    MidIDAndOutboxcode.Add(LabelInf.Rows[i].Cells["pib_id1"].Value.ToString(), LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString());
-            }
-            //id数组
-            string[] pib_id_arr = SingleID.ToArray();
-            //将所有的列存在在这里
-            List<DataTable> AllSingleBoxCacheData = new List<DataTable>();
-            //每五百条拼接一次条件
-            //手动添加ID列
-            DataColumn datacolumn = new DataColumn("pib_id");
-            if (!SingleBoxCacheData.Columns.Contains("pib_id"))
-                SingleBoxCacheData.Columns.Add(datacolumn);
-            //获取打印的SQL
-            try
+            if (PrintMethod == "CodeSoft")
             {
-                for (int j = 0; j < SingleDoc.Variables.FreeVariables.Count; j++)
+                if (SingleDoc == null)
+                    return;
+                for (int i = 0; i < LabelInf.Rows.Count; i++)
                 {
-                    //将维护的模板参数和模板本身的参数名称进行比对
-                    for (int k = 0; k < SingleLabelParam.Rows.Count; k++)
+                    if (!SingleID.Contains(LabelInf.Rows[i].Cells["pib_id1"].Value.ToString()))
+                        SingleID.Add(LabelInf.Rows[i].Cells["pib_id1"].Value.ToString());
+                    //如果不存在中盒号则进行添加
+                    if (!MidIDAndOutboxcode.ContainsValue(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()))
+                        MidIDAndOutboxcode.Add(LabelInf.Rows[i].Cells["pib_id1"].Value.ToString(), LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString());
+                }
+                //id数组
+                string[] pib_id_arr = SingleID.ToArray();
+                //将所有的列存在在这里
+                List<DataTable> AllSingleBoxCacheData = new List<DataTable>();
+                //每五百条拼接一次条件
+                //手动添加ID列
+                DataColumn datacolumn = new DataColumn("pib_id");
+                if (!SingleBoxCacheData.Columns.Contains("pib_id"))
+                    SingleBoxCacheData.Columns.Add(datacolumn);
+                //获取打印的SQL
+                try
+                {
+                    for (int j = 0; j < SingleDoc.Variables.FreeVariables.Count; j++)
                     {
-                        if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name == SingleLabelParam.Rows[k]["lp_name"].ToString())
+                        //将维护的模板参数和模板本身的参数名称进行比对
+                        for (int k = 0; k < SingleLabelParam.Rows.Count; k++)
                         {
-                            DataColumn dc = new DataColumn(SingleDoc.Variables.FreeVariables.Item(j + 1).Name);
-                            SingleBoxCacheData.Columns.Add(dc);
-                            SingleBoxArgument.Add(SingleDoc.Variables.FreeVariables.Item(j + 1).Name);
-                            string sql = SingleLabelParam.Rows[k]["lp_sql"].ToString();
-                            sql = sql.Substring(0, sql.IndexOf("{"));
-                            sql = sql.Substring(0, sql.LastIndexOf("="));
-                            DataTable temp = dh.getFieldsDatasByCondition(sql.Replace(" from ", " ,pib_id PIBID from ") + " in (select pib_id from PRODIOBARCODE where pib_inoutno='" + pi_inoutno.Text + "') ORDER by pib_id");
-                            temp.Columns[0].ColumnName = SingleDoc.Variables.FreeVariables.Item(j + 1).Name;
-                            AllSingleBoxCacheData.Add(temp);
+                            if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name == SingleLabelParam.Rows[k]["lp_name"].ToString())
+                            {
+                                DataColumn dc = new DataColumn(SingleDoc.Variables.FreeVariables.Item(j + 1).Name);
+                                SingleBoxCacheData.Columns.Add(dc);
+                                SingleBoxArgument.Add(SingleDoc.Variables.FreeVariables.Item(j + 1).Name);
+                                string sql = SingleLabelParam.Rows[k]["lp_sql"].ToString();
+                                sql = sql.Substring(0, sql.IndexOf("{"));
+                                sql = sql.Substring(0, sql.LastIndexOf("="));
+                                DataTable temp = dh.getFieldsDatasByCondition(sql.Replace(" from ", " ,pib_id PIBID from ") + " in (select pib_id from PRODIOBARCODE where pib_inoutno='" + pi_inoutno.Text + "') ORDER by pib_id");
+                                temp.Columns[0].ColumnName = SingleDoc.Variables.FreeVariables.Item(j + 1).Name;
+                                AllSingleBoxCacheData.Add(temp);
+                            }
                         }
                     }
-                }
-                DataTable[] Temp = AllSingleBoxCacheData.ToArray();
-                //将所有数据写入到CacheData中
-                if (Temp.Length > 0)
-                    for (int i = 0; i < Temp[0].Rows.Count; i++)
-                    {
-                        DataRow dr = SingleBoxCacheData.NewRow();
-                        dr["pib_id"] = pib_id_arr[i];
-                        //由于之前加了一个ID列,导致j从1开始
-                        for (int j = 1; j < SingleBoxCacheData.Columns.Count; j++)
+                    DataTable[] Temp = AllSingleBoxCacheData.ToArray();
+                    //将所有数据写入到CacheData中
+                    if (Temp.Length > 0)
+                        for (int i = 0; i < Temp[0].Rows.Count; i++)
                         {
-                            dr[Temp[j - 1].Columns[0].ColumnName] = (Temp[j - 1].Select("PIBID=" + pib_id_arr[i]))[0][0];
+                            DataRow dr = SingleBoxCacheData.NewRow();
+                            dr["pib_id"] = pib_id_arr[i];
+                            //由于之前加了一个ID列,导致j从1开始
+                            for (int j = 1; j < SingleBoxCacheData.Columns.Count; j++)
+                            {
+                                dr[Temp[j - 1].Columns[0].ColumnName] = (Temp[j - 1].Select("PIBID=" + pib_id_arr[i]))[0][0];
+                            }
+                            SingleBoxCacheData.Rows.Add(dr);
                         }
-                        SingleBoxCacheData.Rows.Add(dr);
-                    }
-            }
-            catch (Exception)
-            {
+                }
+                catch (Exception)
+                {
 
-                SingleBoxArgument.Clear();
-                SingleBoxCacheData.Clear();
-                BaseUtil.CleanDataTable(SingleBoxCacheData);
+                    SingleBoxArgument.Clear();
+                    SingleBoxCacheData.Clear();
+                    BaseUtil.CleanDataTable(SingleBoxCacheData);
+                }
             }
         }
 
         /// <summary>
         /// 缓存中盒的数据
         /// </summary>
-        private void GetMidBoxData()
+        private void GetMidBoxData(string PrintMethod)
         {
-            if (MidDoc == null)
-                return;
-            StringBuilder pib_condition_string = new StringBuilder();
-            StringBuilder pib_qtycondition_string = new StringBuilder();
-            for (int i = 0; i < LabelInf.Rows.Count; i++)
+            if (PrintMethod == "CodeSoft")
             {
-                //如果不存在中盒号则进行添加
-                if (!MidIDAndOutboxcode.ContainsValue(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()))
+                if (MidDoc == null)
+                    return;
+                StringBuilder pib_condition_string = new StringBuilder();
+                StringBuilder pib_qtycondition_string = new StringBuilder();
+                for (int i = 0; i < LabelInf.Rows.Count; i++)
+                {
+                    //如果不存在中盒号则进行添加
+                    if (!MidIDAndOutboxcode.ContainsValue(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()))
+                    {
+                        MidIDAndOutboxcode.Add(LabelInf.Rows[i].Cells["pib_id1"].Value.ToString(), LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString());
+                    }
+                }
+                //id数组
+                string[] pib_id_arr = MidIDAndOutboxcode.Keys.ToArray();
+                string[] pib_outbox_arr = MidIDAndOutboxcode.Values.ToArray();
+                if (pib_id_arr.Length == 0)
                 {
-                    MidIDAndOutboxcode.Add(LabelInf.Rows[i].Cells["pib_id1"].Value.ToString(), LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString());
+                    MessageBox.Show("未勾选打印明细");
+                    return;
                 }
-            }
-            //id数组
-            string[] pib_id_arr = MidIDAndOutboxcode.Keys.ToArray();
-            string[] pib_outbox_arr = MidIDAndOutboxcode.Values.ToArray();
-            if (pib_id_arr.Length == 0)
-            {
-                MessageBox.Show("未勾选打印明细");
-                return;
-            }
-            //记录一个ID用来取中盒的数量
-            string pib_id = pib_id_arr[0];
-            //id个数
-            //将所有的列存在在这里
-            List<DataTable> AllMidBoxCacheData = new List<DataTable>();
-            //每五百条拼接一次条件
-            //手动添加ID列
-            DataColumn IDColumn = new DataColumn("pib_id");
-            DataColumn OutBoxColumn = new DataColumn("pib_outboxcode1");
-            if (!MidBoxCacheData.Columns.Contains("pib_id"))
-                MidBoxCacheData.Columns.Add(IDColumn);
-            if (!MidBoxCacheData.Columns.Contains("pib_outboxcode1"))
-                MidBoxCacheData.Columns.Add(OutBoxColumn);
-            if (MidLabelCombox.SelectedValue == null)
-            {
-                return;
-            }
-            string la_id = MidLabelCombox.SelectedValue.ToString().Split('#')[0];
-            for (int j = 0; j < MidDoc.Variables.FreeVariables.Count; j++)
-            {
-                //将维护的模板参数和模板本身的参数名称进行比对
-                for (int k = 0; k < MidLabelParam.Rows.Count; k++)
+                //记录一个ID用来取中盒的数量
+                string pib_id = pib_id_arr[0];
+                //id个数
+                //将所有的列存在在这里
+                List<DataTable> AllMidBoxCacheData = new List<DataTable>();
+                //每五百条拼接一次条件
+                //手动添加ID列
+                DataColumn IDColumn = new DataColumn("pib_id");
+                DataColumn OutBoxColumn = new DataColumn("pib_outboxcode1");
+                if (!MidBoxCacheData.Columns.Contains("pib_id"))
+                    MidBoxCacheData.Columns.Add(IDColumn);
+                if (!MidBoxCacheData.Columns.Contains("pib_outboxcode1"))
+                    MidBoxCacheData.Columns.Add(OutBoxColumn);
+                if (MidLabelCombox.SelectedValue == null)
                 {
-                    if (MidDoc.Variables.FreeVariables.Item(j + 1).Name == MidLabelParam.Rows[k]["lp_name"].ToString())
+                    return;
+                }
+                string la_id = MidLabelCombox.SelectedValue.ToString().Split('#')[0];
+                for (int j = 0; j < MidDoc.Variables.FreeVariables.Count; j++)
+                {
+                    //将维护的模板参数和模板本身的参数名称进行比对
+                    for (int k = 0; k < MidLabelParam.Rows.Count; k++)
                     {
-                        DataColumn dc = new DataColumn(MidDoc.Variables.FreeVariables.Item(j + 1).Name);
-                        MidBoxCacheData.Columns.Add(dc);
-                        MidBoxArgument.Add(MidDoc.Variables.FreeVariables.Item(j + 1).Name);
-                        string sql = MidLabelParam.Rows[k]["lp_sql"].ToString();
-                        //如果打印的含有数量
-                        if (sql.ToLower().Contains("pib_qty"))
+                        if (MidDoc.Variables.FreeVariables.Item(j + 1).Name == MidLabelParam.Rows[k]["lp_name"].ToString())
                         {
-                            sql = sql.Substring(0, sql.IndexOf("{")) + pib_id + sql.Substring(sql.IndexOf("}") + 1);
-                            sql = sql.Substring(0, sql.LastIndexOf("=")) + " in (select distinct pib_outboxcode1 from PRODIOBARCODE where pib_inoutno='" + pi_inoutno.Text + "')" + sql.Substring(sql.LastIndexOf("}") + 1);
-                        }
-                        else
-                        {
-                            sql = sql.Substring(0, sql.IndexOf("{"));
-                            sql = sql.Substring(0, sql.LastIndexOf("="));
-                            sql = sql + " in (select distinct pib_outboxcode1 from PRODIOBARCODE where pib_inoutno='" + pi_inoutno.Text + "')" + " and pib_inoutno='" + pi_inoutno.Text + "' order by to_number(pib_outboxcode1)";
+                            DataColumn dc = new DataColumn(MidDoc.Variables.FreeVariables.Item(j + 1).Name);
+                            MidBoxCacheData.Columns.Add(dc);
+                            MidBoxArgument.Add(MidDoc.Variables.FreeVariables.Item(j + 1).Name);
+                            string sql = MidLabelParam.Rows[k]["lp_sql"].ToString();
+                            //如果打印的含有数量
+                            if (sql.ToLower().Contains("pib_qty"))
+                            {
+                                sql = sql.Substring(0, sql.IndexOf("{")) + pib_id + sql.Substring(sql.IndexOf("}") + 1);
+                                sql = sql.Substring(0, sql.LastIndexOf("=")) + " in (select distinct pib_outboxcode1 from PRODIOBARCODE where pib_inoutno='" + pi_inoutno.Text + "')" + sql.Substring(sql.LastIndexOf("}") + 1);
+                            }
+                            else
+                            {
+                                sql = sql.Substring(0, sql.IndexOf("{"));
+                                sql = sql.Substring(0, sql.LastIndexOf("="));
+                                sql = sql + " in (select distinct pib_outboxcode1 from PRODIOBARCODE where pib_inoutno='" + pi_inoutno.Text + "')" + " and pib_inoutno='" + pi_inoutno.Text + "' order by to_number(pib_outboxcode1)";
+                            }
+                            DataTable temp = dh.getFieldsDatasByCondition(sql);
+                            temp.Columns[0].ColumnName = MidDoc.Variables.FreeVariables.Item(j + 1).Name;
+                            AllMidBoxCacheData.Add(temp);
                         }
-                        DataTable temp = dh.getFieldsDatasByCondition(sql);
-                        temp.Columns[0].ColumnName = MidDoc.Variables.FreeVariables.Item(j + 1).Name;
-                        AllMidBoxCacheData.Add(temp);
                     }
                 }
-            }
-            DataTable[] Temp = AllMidBoxCacheData.ToArray();
-            //将所有数据写入到CacheData中
-            if (Temp.Length > 0)
-            {
-                for (int i = 0; i < pib_id_arr.Length; i++)
+                DataTable[] Temp = AllMidBoxCacheData.ToArray();
+                //将所有数据写入到CacheData中
+                if (Temp.Length > 0)
                 {
-                    DataRow dr = MidBoxCacheData.NewRow();
-                    dr["pib_id"] = pib_id_arr[i];
-                    dr["pib_outboxcode1"] = pib_outbox_arr[i];
-                    //由于之前加了一个ID列和箱号,导致j从2开始
-                    for (int j = 2; j < MidBoxCacheData.Columns.Count; j++)
+                    for (int i = 0; i < pib_id_arr.Length; i++)
                     {
-                        //选出勾选的中盒号
-                        dr[Temp[j - 2].Columns[0].ColumnName] = Temp[j - 2].Select("PIB_OUTBOXCODE1='" + pib_outbox_arr[i] + "'")[0][0];
+                        DataRow dr = MidBoxCacheData.NewRow();
+                        dr["pib_id"] = pib_id_arr[i];
+                        dr["pib_outboxcode1"] = pib_outbox_arr[i];
+                        //由于之前加了一个ID列和箱号,导致j从2开始
+                        for (int j = 2; j < MidBoxCacheData.Columns.Count; j++)
+                        {
+                            //选出勾选的中盒号
+                            dr[Temp[j - 2].Columns[0].ColumnName] = Temp[j - 2].Select("PIB_OUTBOXCODE1='" + pib_outbox_arr[i] + "'")[0][0];
+                        }
+                        MidBoxCacheData.Rows.Add(dr);
                     }
-                    MidBoxCacheData.Rows.Add(dr);
                 }
             }
         }
@@ -1557,7 +1568,7 @@ namespace UAS_LabelMachine
                         MidOutBoxCodeIndex.Add(i);
                     }
                 }
-                GetMidBoxData();
+                GetMidBoxData(PrintMethod);
                 for (int i = 0; i < MidOutBoxCodeIndex.Count; i++)
                 {
                     MidBoxCodePrint(MidOutBoxCodeIndex[i]);
@@ -1689,7 +1700,7 @@ namespace UAS_LabelMachine
             if (MidBoxCacheData.Rows.Count == 0)
             {
                 MidIDAndOutboxcode.Add(LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString(), LabelInf.Rows[rowindex].Cells["pib_outboxcode1"].Value.ToString());
-                GetMidBoxData();
+                GetMidBoxData(PrintMethod);
             }
             string[] arg = MidBoxArgument.ToArray();
             //获取对应行的pib_id
@@ -1710,6 +1721,8 @@ namespace UAS_LabelMachine
                 string pib_outboxcode2 = LabelInf.Rows[rowindex].Cells["pib_outboxcode2"].Value.ToString();
                 if (PrintMethod == "CodeSoft")
                     Print.CodeSoft.OutPrint(OutBoxDoc, OutLabelParam, pib_id, pib_outboxcode2);
+                else
+                    Print.BarTender.OutPrint();
             }
             catch (Exception ex) { MessageBox.Show(ex.Message); }
         }

+ 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;
     }
 }

+ 17 - 1
UAS-出货标签管理/客户标签维护.cs

@@ -91,6 +91,14 @@ namespace UAS_LabelMachine
             }
             PortModel.Checked = Settings.Default.FTPModel;
             dh = SystemInf.dh;
+            if (dh.GetConfig("PrintMethod", "CodeOrBar").ToString() == "")
+            {
+                CodeSoft.Checked = true;
+            }
+            else
+            {
+                BarTender.Checked = true;
+            }
             condition.Append("");
             ChooseAll.ChooseAll(LabelDataGridView);
             BaseUtil.SetComboxData(la_type, "display", "value", labeltype);
@@ -192,6 +200,10 @@ namespace UAS_LabelMachine
             {
                 LabelSoft = "CodeSoft";
             }
+            if (BarTender.Checked)
+            {
+                LabelSoft = "BarTender";
+            }
             DataTable dt = (DataTable)LabelDataGridView.DataSource;
             //如果有改变的行才传递到后台
             if (dt.GetChanges() != null)
@@ -228,6 +240,10 @@ namespace UAS_LabelMachine
             {
                 openFileDialog1.Filter = "(*.lab)|*.lab";
             }
+            if (BarTender.Checked)
+            {
+                openFileDialog1.Filter = "(*.btw)|*.btw";
+            }
             DialogResult result = openFileDialog1.ShowDialog();
             if (result == DialogResult.OK)
             {
@@ -338,7 +354,7 @@ namespace UAS_LabelMachine
                 {
                     ftpOperater ftp = new ftpOperater(PortModel.Checked);
                     ftp.UpLoadFile(sourcePath, fileName);
-                    string SoftWare = "CodeSoft";
+                    string SoftWare = CodeSoft.Checked ? "CodeSoft" : "BarTender";
                     if (CL_ID2 != null)
                     {
                         sql.Clear();