Beispiel #1
0
        void btnTest_Click(object sender, EventArgs e)
        {
            if (this.ValidateData() == false)
            {
                return;
            }
            TSCPrintHelper.openport(JERPBiz.Config.ConfigInfo.GetBoxItemPrinter());
            TSCPrintHelper.clearbuffer();
            TSCPrintHelper.setup(
                this.txtWidth.Text,
                this.txtHeight.Text,
                "8",
                "10",
                "0",
                this.txtMargin.Text,
                this.txtOffset.Text);
            TSCPrintHelper.sendcommand("DIRECTION 1");
            int cnt = int.Parse(this.txtRepeat.Text) + 1;

            for (int i = 0; i < cnt; i++)
            {
                foreach (DataRow drow in this.dtblFormatColumn.Rows)
                {
                    this.ExportRow(drow);
                }
                TSCPrintHelper.printlabel("1", "1");
            }
            TSCPrintHelper.clearbuffer();
            TSCPrintHelper.closeport();
        }
        public void Export(DataRow[] drows)
        {
            if (drows.Length == 0)
            {
                return;
            }
            this.FormatEntity.LoadData();
            this.dtblFormatColumn = this.accFormatColumn.GetDataBoxItemFormatColumn().Tables[0];
            if ((this.FormatEntity.FormatID == -1) ||
                (this.dtblFormatColumn.Rows.Count == 0))
            {
                MessageBox.Show("未设格式参数");
                return;
            }
            DataTable dtblBarcode = drows[0].Table.Clone();

            foreach (DataRow drow in drows)
            {
                dtblBarcode.ImportRow(drow);
                for (int i = 0; i < this.FormatEntity.Repeat; i++)
                {
                    dtblBarcode.ImportRow(drow);
                }
            }
            TSCPrintHelper.openport(this.Printer);
            TSCPrintHelper.clearbuffer();
            TSCPrintHelper.setup(
                this.FormatEntity.Width,
                this.FormatEntity.Height,
                "10",
                "10",
                "0",
                this.FormatEntity.Margin,
                this.FormatEntity.Offset);
            TSCPrintHelper.sendcommand("DIRECTION 1");
            int ln   = dtblBarcode.Rows.Count;
            int irow = 0;

            while (irow < ln)
            {
                TSCPrintHelper.clearbuffer();
                foreach (DataRow drowColumn in this.dtblFormatColumn.Rows)
                {
                    if (irow < ln)
                    {
                        this.ExportRow(dtblBarcode.Rows[irow], drowColumn);
                        irow++;
                    }
                    else
                    {
                        break;
                    }
                }
                TSCPrintHelper.printlabel("1", "1");
            }
            TSCPrintHelper.clearbuffer();
            TSCPrintHelper.closeport();
        }