展开全部
/**
* 这是一部分代码
*/
package com.mqney.barcode.tsc.templet;
import ookj.ui.pub.messagedailog.MessageDailog;
import com.mqney.barcode.tsc.TscBarcode;
import com.mqney.barcode.tsc.TscClearbuffer;
import com.mqney.barcode.tsc.TscCloseport;
//import com.mqney.barcode.tsc.TscSendcommand;
import com.mqney.barcode.tsc.TscWindowsfont;
import com.mqney.barcode.tsc.impl.TscBarcodeDefault;
import com.mqney.barcode.tsc.impl.TscOpenportDefault;
import com.mqney.barcode.tsc.impl.TscPrintlabelDefault;
import com.mqney.barcode.tsc.impl.TscSetupDefault;
import com.mqney.barcode.tsc.impl.TscWindowsfontDefault;
import com.mqney.barcode.util.ReadTscProperties;
import com.mqney.barcode.util.RunTscDllFunction;
import com.mqney.barcode.util.TextToParagraph;
/**
* @author pinkfloyd
*
*/
public class SonqaoReportPrint {
public void init(SonqaoReportBean[] srbs){
try{if(srbs==null||srbs.length==0){
return;
}
int num = srbs.length;
/**
* DIRECTION可以,62616964757a686964616fe78988e69d8331333330326663RSS、CIRCLE不行。
*/
// TscSendcommand ts = new TscSendcommand("DIRECTION 1,1");
// TscSendcommand ts = new TscSendcommand("RSS 300,300,\"UCC128CCC\",270,2,2,25,\"1234567890|ABCDEFG\"");
// TscSendcommand ts = new TscSendcommand("CIRCLE 40,16,10,2");
// rdf.RunDllFunctionTSC(ts);
for(int i=0; i
SonqaoReportBean srb = srbs[i];
if(srb==null){
continue;
}
RunTscDllFunction rdf = new RunTscDllFunction();
TextToParagraph ttp = new TextToParagraph();
MessageDailog md = new MessageDailog();
TscOpenportDefault tod = new TscOpenportDefault();
ReadTscProperties rtp = new ReadTscProperties();
tod.setPrinter(rtp.getValue(ReadTscProperties.TSC_REPORT_PATH));
rdf.RunDllFunctionTSC(tod);
TscSetupDefault tsd = new TscSetupDefault();
tsd.setLabelWidth("100");
tsd.setLabelHeight("70");
rdf.RunDllFunctionTSC(tsd);
TscClearbuffer tcb = new TscClearbuffer();
rdf.RunDllFunctionTSC(tcb);
TscWindowsfontDefault twd;
twd = new TscWindowsfontDefault(40,16,36,"单位:");
twd.setFontStyle(TscWindowsfont.FONT_STYLE_BOLD);
rdf.RunDllFunctionTSC(twd);
twd = new TscWindowsfontDefault(40,88,36,"姓名:");
twd.setFontStyle(TscWindowsfont.FONT_STYLE_BOLD);
rdf.RunDllFunctionTSC(twd);
twd = new TscWindowsfontDefault(40,152,36,"信息:");
twd.setFontStyle(TscWindowsfont.FONT_STYLE_BOLD);
rdf.RunDllFunctionTSC(twd);
twd = new TscWindowsfontDefault(40,216,36,"部门:");
twd.setFontStyle(TscWindowsfont.FONT_STYLE_BOLD);
rdf.RunDllFunctionTSC(twd);
String[] s0 = ttp.textToParaVoid(srb.getGongsi(), 40);
if(s0==null||s0.length==0){
md.showWarningMessage("getGongsi");
}else{
int num0 = s0.length;
for(int j=0; j
twd = new TscWindowsfontDefault(140,16+(j*32),32,s0[j]);
// twd.setFontUnderline(TscWindowsfont.FONT_UNDERLINE_WITH);
rdf.RunDllFunctionTSC(twd);
}
}
twd = new TscWindowsfontDefault(140,80,40,srb.getXingming());
rdf.RunDllFunctionTSC(twd);
String[] s2 = ttp.textToParaVoid(srb.getXinxi(), 40);
if(s2==null||s2.length==0){
md.showWarningMessage("getXinxi");
}else{
int num2 = s2.length;
for(int j=0; j
twd = new TscWindowsfontDefault(140,152+j*32,32,s2[j]);
// twd.setFontUnderline(TscWindowsfont.FONT_UNDERLINE_WITH);
rdf.RunDllFunctionTSC(twd);
}
}
String[] s3 = ttp.textToParaVoid(srb.getBumen(), 40);
if(s3==null||s3.length==0){
md.showWarningMessage("getBumen");
}else{
int num3 = s3.length;
for(int j=0; j
twd = new TscWindowsfontDefault(140,216+j*32,32,s3[j]);
// twd.setFontUnderline(TscWindowsfont.FONT_UNDERLINE_WITH);
rdf.RunDllFunctionTSC(twd);
}
}
TscBarcodeDefault tbd;
tbd = new TscBarcodeDefault("216","360","48",srb.getBarcode());
tbd.setNarrowBarRatioX(TscBarcode.NARROW_BARRATIO_3);
tbd.setNarrowBarRatioY(TscBarcode.NARROW_BARRATIO_3);
rdf.RunDllFunctionTSC(tbd);
twd = new TscWindowsfontDefault(160,500,32,srb.getSonqao());
rdf.RunDllFunctionTSC(twd);
TscPrintlabelDefault tpd = new TscPrintlabelDefault();
tpd.setLabelCopies("1");
tpd.setLabelSets("1");
rdf.RunDllFunctionTSC(tpd);
TscCloseport tc = new TscCloseport();
rdf.RunDllFunctionTSC(tc);
}
}catch(Exception e){
e.printStackTrace();
}
}
}
本回答由提问者推荐
已赞过
已踩过<
你对这个回答的评价是?
评论
收起