public void LabelPrintTaskPan(PanBarCode[] PanTaskID) { try { openport("TSC TTP-243E Plus"); sendcommand("SIZE 100 mm,35 mm"); sendcommand("GAP 2 mm,0"); sendcommand("SPEED 4"); sendcommand("DENSITY 7"); sendcommand("DIRECTION 0"); sendcommand("OFFSET 0.00"); sendcommand("REFERENCE 0,0"); sendcommand("SET PEEL OFF"); sendcommand("SET CUTTER OFF"); sendcommand("HOME"); clearbuffer(); downloadpcx("Name.pcx", "NAME.PCX"); for (int i = PanTaskID.GetLowerBound(0); i <= PanTaskID.GetUpperBound(0); i += 2) { clearbuffer(); sendcommand("BOX 15,20,380,250,2"); windowsfont(0x2d, 0x19, 0x19, 0, 0, 0, "黑体", PanTaskID[i].strPanType); barcode("75", "60", "128", "100", "0", "0", "2", "4", PanTaskID[i].strTaskID); printerfont("45", "160", "4", "0", "1", "1", PanTaskID[i].strTaskID); sendcommand("PUTPCX 25,200,\"NAME.PCX\""); if ((i + 1) <= PanTaskID.GetUpperBound(0)) { sendcommand("BOX 425,20,790,250,2"); windowsfont(0x1c7, 0x19, 0x19, 0, 0, 0, "黑体", PanTaskID[i + 1].strPanType); barcode("485", "50", "128", "110", "0", "0", "2", "4", PanTaskID[i + 1].strTaskID); printerfont("455", "160", "4", "0", "1", "1", PanTaskID[i + 1].strTaskID); sendcommand("PUTPCX 435,200,\"NAME.PCX\""); } printlabel("1", "1"); } closeport(); } catch { } }
private void buttonPrintPanSingle_Click(object sender, EventArgs e) { if (this.listVwPrintPanID.Items.Count > 0) { PanBarCode[] panTaskID = new PanBarCode[this.listVwPrintPanID.Items.Count]; for (int i = 0; i < this.listVwPrintPanID.Items.Count; i++) { panTaskID[i].strTaskID = this.listVwPrintPanID.Items[i].SubItems[1].Text; panTaskID[i].strPanType = this.listVwPrintPanID.Items[i].SubItems[2].Text; panTaskID[i].strCount = this.listVwPrintPanID.Items[i].SubItems[3].Text; } new Print().LabelPrintTaskPan(panTaskID); this.textPanIDSingle.Text = "M"; this.listVwPrintPanID.Items.Clear(); } }
private void btn_PrintCode_Click(object sender, EventArgs e) { int boxCapability = new MbTask().GetBoxCapability(); try { if (this.dgv_Mboard.SelectedCells[2].Value.ToString().Trim() != "清洗烘干") { MessageBox.Show("只有清洗烘干工序可以打印条形码", "底板任务查询", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { PanBarCode[] codeArray; if ((int.Parse(this.dgv_Mboard.SelectedCells[3].Value.ToString()) % boxCapability) != 0) { int num1 = int.Parse(this.dgv_Mboard.SelectedCells[3].Value.ToString()) / boxCapability; } else { int num3 = int.Parse(this.dgv_Mboard.SelectedCells[3].Value.ToString()) / boxCapability; } string queryStr = "select * from t_pantaskinfo where left(pantaskid,12)='" + this.dgv_Mboard.SelectedCells[0].Value.ToString() + "'"; DataSet set = new Sql2KDataAccess().Run_SqlText(queryStr); if ((set != null) && (set.Tables[0].Rows.Count > 0)) { codeArray = new PanBarCode[set.Tables[0].Rows.Count]; for (int i = 0; i < set.Tables[0].Rows.Count; i++) { codeArray[i].strCount = set.Tables[0].Rows[i]["pancount"].ToString(); codeArray[i].strTaskID = set.Tables[0].Rows[i]["pantaskid"].ToString(); codeArray[i].strPanType = this.dgv_Mboard.SelectedCells[1].Value.ToString(); } } else { codeArray = new PanBarCode[0]; } new Print().LabelPrintTaskPan(codeArray); } } catch (Exception exception) { MessageBox.Show("打印条形码时发生错误\n" + exception.Message, "底板任务管理", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void btn_PrintBarCode_Click(object sender, EventArgs e) { int boxCapability = new MbTask().GetBoxCapability(); try { foreach (ListViewItem item in this.Lvw_MbTask.CheckedItems) { PanBarCode[] codeArray; if (item.SubItems[2].Text.ToString().Trim() != "清洗烘干") { MessageBox.Show("只有清洗烘干工序可以打印条形码", "底板任务管理", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } int num2 = ((int.Parse(item.SubItems[3].Text.ToString()) % boxCapability) == 0) ? (int.Parse(item.SubItems[3].Text.ToString()) / boxCapability) : ((int.Parse(item.SubItems[3].Text.ToString()) / boxCapability) + 1); string queryStr = "select * from t_pantaskinfo where left(pantaskid,12)='" + item.Text + "'"; DataSet set = new Sql2KDataAccess().Run_SqlText(queryStr); if ((set != null) && (set.Tables[0].Rows.Count > 0)) { codeArray = new PanBarCode[set.Tables[0].Rows.Count]; for (int i = 0; i < set.Tables[0].Rows.Count; i++) { codeArray[i].strCount = set.Tables[0].Rows[i]["pancount"].ToString(); codeArray[i].strTaskID = set.Tables[0].Rows[i]["pantaskid"].ToString(); codeArray[i].strPanType = item.SubItems[1].Text; } } else { codeArray = new PanBarCode[0]; } new Print().LabelPrintTaskPan(codeArray); } } catch (Exception exception) { MessageBox.Show("打印条形码时发生错误\n" + exception.Message, "底板任务管理", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }