|
|
|
@ -50,6 +50,124 @@ public class AsPrint {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void printAsCodeNew(String code,String barCode, String channel, String country, String num,String sum,
|
|
|
|
|
int offset, boolean hasPlan) throws IOException {
|
|
|
|
|
|
|
|
|
|
if (hasPlan) {
|
|
|
|
|
PrintPlanNew(code,barCode, channel, country, num, sum, offset);
|
|
|
|
|
} else {
|
|
|
|
|
PrintNoPlanNew(code,barCode,num,sum,offset);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void PrintPlanNew(String code,String barCode, String channel, String country, String num,String sum,
|
|
|
|
|
int offset) throws IOException {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int cx = 0;
|
|
|
|
|
int cy = 0;
|
|
|
|
|
int cSize = 0;
|
|
|
|
|
if(country.length()>5){
|
|
|
|
|
cSize = 55;
|
|
|
|
|
cx = 55;
|
|
|
|
|
cy = 220;
|
|
|
|
|
country = country.substring(0,4)+"\n"+country.substring(4);
|
|
|
|
|
}else if(country.length()==5){
|
|
|
|
|
cSize = 50;
|
|
|
|
|
cx = 40;
|
|
|
|
|
cy = 250;
|
|
|
|
|
}else {
|
|
|
|
|
cSize = 60;
|
|
|
|
|
cy = 245;
|
|
|
|
|
cx = 85-country.length()*15;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cpclPrinter.setForm(0, 203, 203, 800, 575, 0, 1);
|
|
|
|
|
cpclPrinter.setMedia(CPCLConst.LK_CPCL_LABEL);
|
|
|
|
|
cpclPrinter.setJustification(CPCLConst.LK_CPCL_CENTER);
|
|
|
|
|
cpclPrinter.printBox(0, 10, 570, 800, 3);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cpclPrinter.printLine(0, 160, 570, 160, 3);
|
|
|
|
|
|
|
|
|
|
cpclPrinter.printLine(0, 400, 570, 400, 3);
|
|
|
|
|
|
|
|
|
|
cpclPrinter.printLine(0, 560, 570, 560, 3);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cpclPrinter.printAndroidFont(50, 50, Typeface.DEFAULT_BOLD, true, code, 575, 65);
|
|
|
|
|
|
|
|
|
|
cpclPrinter.printAndroidFont(cx, cy, Typeface.DEFAULT_BOLD, true, country,
|
|
|
|
|
575, cSize);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cpclPrinter.printAndroidFont(90, 440, Typeface.DEFAULT, false, channel, 575, 40);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cpclPrinter.printAndroidFont(160, 745, Typeface.DEFAULT, false, barCode, 575, 28);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cpclPrinter.printLine(333, 110, 333, 350, 3);
|
|
|
|
|
|
|
|
|
|
cpclPrinter.setCPCLBarcode(0, 0, 0);
|
|
|
|
|
cpclPrinter.printCPCLBarcode(CPCLConst.LK_CPCL_0_ROTATION,
|
|
|
|
|
CPCLConst.LK_CPCL_BCS_128, 1, CPCLConst.LK_CPCL_BCS_4RATIO,
|
|
|
|
|
150, 0, 580, barCode, 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// cpclPrinter.printAndroidFont(700, 440, Typeface.DEFAULT, false, barCode, 575, 20);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// cpclPrinter.setCPCLBarcode(0, 0, 0);
|
|
|
|
|
// cpclPrinter.printCPCLBarcode(CPCLConst.LK_CPCL_0_ROTATION, CPCLConst.LK_CPCL_BCS_128, 1, CPCLConst.LK_CPCL_BCS_4RATIO, 130, 0, 26, code, 0);
|
|
|
|
|
// cpclPrinter.printCPCLText(0, 0, 3, 0, 170, code, 0);
|
|
|
|
|
// cpclPrinter.printLine(0, 220, 535, 220, 3);
|
|
|
|
|
// cpclPrinter.setJustification(CPCLConst.LK_CPCL_LEFT);
|
|
|
|
|
// cpclPrinter.printAndroidFont(40, 240, Typeface.DEFAULT_BOLD, true, "渠道名称:", 575, 30);
|
|
|
|
|
// cpclPrinter.printAndroidFont(170, 240, Typeface.DEFAULT, channel, 575, 30);
|
|
|
|
|
// cpclPrinter.printAndroidFont(40, 300, Typeface.DEFAULT, "目的地:" + country, 575, 30);
|
|
|
|
|
// cpclPrinter.printAndroidFont(400 - offset, 300, Typeface.DEFAULT_BOLD, true, "件数:", 575, 30);
|
|
|
|
|
// cpclPrinter.printAndroidFont(480 - offset, 300, Typeface.DEFAULT, countStr, 575, 30);
|
|
|
|
|
cpclPrinter.printForm();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void PrintNoPlanNew(String code,String barCode, String num,String sum,
|
|
|
|
|
int offset) throws IOException {
|
|
|
|
|
|
|
|
|
|
cpclPrinter.setForm(0, 203, 203, 500, 575, 0, 1);
|
|
|
|
|
cpclPrinter.setMedia(CPCLConst.LK_CPCL_LABEL);
|
|
|
|
|
cpclPrinter.setJustification(CPCLConst.LK_CPCL_CENTER);
|
|
|
|
|
// cpclPrinter.setCPCLBarcode(0, 0, 0);
|
|
|
|
|
// cpclPrinter.printCPCLBarcode(CPCLConst.LK_CPCL_0_ROTATION, CPCLConst.LK_CPCL_BCS_128, 1, CPCLConst.LK_CPCL_BCS_4RATIO, 130, 0, 26, code, 0);
|
|
|
|
|
// cpclPrinter.printCPCLText(0, 0, 3, 0, 170, code, 0);
|
|
|
|
|
// cpclPrinter.printLine(0, 220, 535, 220, 3);
|
|
|
|
|
// cpclPrinter.setJustification(CPCLConst.LK_CPCL_LEFT);
|
|
|
|
|
// cpclPrinter.printAndroidFont(40, 240, Typeface.DEFAULT_BOLD, true, "未建计划", 575, 50);
|
|
|
|
|
// cpclPrinter.printAndroidFont(400, 240, Typeface.DEFAULT_BOLD, true, "件数:", 575, 50);
|
|
|
|
|
// cpclPrinter.printAndroidFont(400 - offset, 300, Typeface.DEFAULT, countStr, 575, 30);
|
|
|
|
|
cpclPrinter.printForm();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void printNewPlan(String code, String channel, String country, String countStr, int offset,
|
|
|
|
|
Bitmap imgCode, Bitmap imgChannel, Bitmap imgCountry,
|
|
|
|
|
Bitmap imgBarCode,Bitmap imgNum,Bitmap imgSum) throws IOException {
|
|
|
|
|