using Seagull.BarTender.Print; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using UAS_MES_NEW.DataOperate; using UAS_MES_NEW.Entity; using UAS_MES_NEW.PublicMethod; namespace UAS_MES_NEW.Query { public partial class Query_SOP : Form { DataHelper dh = SystemInf.dh; Engine engine; public Query_SOP() { InitializeComponent(); } private void Export_Click(object sender, EventArgs e) { } //选择导出Excel时是选择导出数据的还是模板 private void ExcelExport(string DataOrTemplet) { } DataTable _dt; private void Query_SpecialReport_Load(object sender, EventArgs e) { try { engine = new Engine(true); } catch (Exception) { MessageBox.Show("未正确安装Bartender软件"); } _dt = (DataTable)dh.ExecuteSql("select la_id,la_url,la_isdefault from label where la_prodcode='BQDY' and la_templatetype='卡通箱标' and la_statuscode='AUDITED' order by la_isdefault", "select"); PrintLabel.DataSource = _dt; PrintLabel.DisplayMember = "la_url"; PrintLabel.ValueMember = "la_id"; } private void Sn_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData == Keys.Enter) { } } private void Print_Click(object sender, EventArgs e) { string makecode = dh.getFieldDataByCondition("package_view", "pa_makecode", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString(); if (makecode != "") { ma_code.Text = makecode; } DataTable dt = (DataTable)dh.ExecuteSql("select * from package_view where pa_makecode='" + ma_code.Text + "'", "select"); string ErrorMessage = ""; string outboxcode = ""; if (dt.Rows.Count == 0) { OperateResult.AppendText(">>工单" + ma_code.Text + "不存在装箱记录\n", Color.Black); return; } if (pa_outboxcode.Text != "") { dt = (DataTable)dh.ExecuteSql("select * from package_view where pa_makecode='" + ma_code.Text + "' and pa_outboxcode='" + pa_outboxcode.Text + "'", "select"); if (dt.Rows.Count == 0) { OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "不存在装箱记录\n", Color.Black); return; } } for (int i = 0; i < dt.Rows.Count; i++) { outboxcode = dt.Rows[i]["pa_outboxcode"].ToString(); if (Print.BarTenderS(Tag.ToString(), ref engine, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrintList.Text, outboxcode, 1, "", "", "卡通箱标", "0", out ErrorMessage)) { OperateResult.AppendText(">>开始打印箱号" + outboxcode + "\n", Color.Black); LogicHandler.DoCommandLog("LabelPrint", User.UserCode, makecode, User.UserLineCode, User.UserSourceCode, "包装标签打印", "打印成功", outboxcode, ""); } } } } }