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) { DataTable dt = dh.getFieldsDataByCondition("package_view", new string[] { "pa_makecode", "pa_prodcode" }, "pa_outboxcode='" + pa_outboxcode.Text + "'"); string pr_code = ""; if (dt.Rows.Count > 0) { ma_code.Text = dt.Rows[0]["pa_makecode"].ToString(); pr_code = dt.Rows[0]["pa_prodcode"].ToString(); } 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; } } if (pa_outboxcode.Text != "") { string WorkProcess = dh.getFieldDataByCondition("configs", "data", "CODE='WorkProcess' and caller='MESSetting'").ToString(); if (WorkProcess == "1") { string Err = ""; if (!LogicHandler.CheckSNInfo(pa_outboxcode.Text, pr_code, ma_code.Text.Replace("-1", ""), "客户端", out Err)) { OperateResult.AppendText(">>" + Err + "\n", Color.Black); return; } } } for (int i = 0; i < dt.Rows.Count; i++) { outboxcode = dt.Rows[i]["pa_outboxcode"].ToString(); if (Print.BarTender(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, ma_code.Text, User.UserLineCode, User.UserSourceCode, "包装标签打印", "打印成功", outboxcode, ""); } } } } }