123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- 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_SpecialReport : Form
- {
- DataHelper dh = SystemInf.dh;
- Seagull.BarTender.Print.Engine engine = new Seagull.BarTender.Print.Engine();
- LabelFormatDocument format;
- public Query_SpecialReport()
- {
- InitializeComponent();
- }
- private void Export_Click(object sender, EventArgs e)
- {
- ExcelExport("");
- }
- //选择导出Excel时是选择导出数据的还是模板
- private void ExcelExport(string DataOrTemplet)
- {
- for (int i = int.Parse(Rn.Text); i < int.Parse(Num.Text); i = i + 4)
- {
- int temp = i;
- for (int j = 0; j < format.SubStrings.Count; j++)
- {
- switch (format.SubStrings[j].Name)
- {
- case "RN1":
- format.SubStrings[j].Value = (Prefix.Text + Date.Value.ToString("yymmdd") + lpad(4, (temp).ToString()));
- break;
- case "RN2":
- format.SubStrings[j].Value = (Prefix.Text + Date.Value.ToString("yymmdd") + lpad(4, (temp + 1).ToString()));
- break;
- case "RN3":
- format.SubStrings[j].Value = (Prefix.Text + Date.Value.ToString("yymmdd") + lpad(4, (temp + 2).ToString()));
- break;
- case "RN4":
- format.SubStrings[j].Value = (Prefix.Text + Date.Value.ToString("yymmdd") + lpad(4, (temp + 3).ToString()));
- break;
- default:
- break;
- }
- }
- }
- format.PrintSetup.PrinterName = Printer.Text;
- format.PrintSetup.IdenticalCopiesOfLabel = 1;
- format.Print();
- }
- private void Query_SpecialReport_Load(object sender, EventArgs e)
- {
- format = engine.Documents.Open("Label.btw");
- }
- private static string lpad(int length, string number)
- {
- while (number.Length < length)
- {
- number = "0" + number;
- }
- number = number.Substring(number.Length - length, length);
- return number;
- }
- private void inoutno_TextChanged(object sender, EventArgs e)
- {
- }
- }
- }
|