|
@@ -51,12 +51,12 @@ export const textFormat = function(command,text,maxFontNums,left,top,lightHeight
|
|
if(align=="center"){
|
|
if(align=="center"){
|
|
const ltxt = textArr[i]
|
|
const ltxt = textArr[i]
|
|
const ltlen = getBytesCount(ltxt)/2*fontSize
|
|
const ltlen = getBytesCount(ltxt)/2*fontSize
|
|
- command.setText(left+((maxNums-ltlen)/2)*rowHeight, rowTop, "TSS24.BF2", fontSize, fontSize, ltxt)
|
|
+ command.setText(left+((maxNums-ltlen)/2)*rowHeight-2, rowTop, "TSS24.BF2", fontSize, fontSize, ltxt)
|
|
}
|
|
}
|
|
else{
|
|
else{
|
|
command.setText(left, rowTop, "TSS24.BF2", fontSize, fontSize, textArr[i])
|
|
command.setText(left, rowTop, "TSS24.BF2", fontSize, fontSize, textArr[i])
|
|
}
|
|
}
|
|
- rowTop = rowTop+rowHeight*fontSize+10
|
|
+ rowTop = rowTop+rowHeight*fontSize+5
|
|
}
|
|
}
|
|
return rowTop
|
|
return rowTop
|
|
}
|
|
}
|
|
@@ -72,15 +72,15 @@ export const printText = function(tsc,text){
|
|
}
|
|
}
|
|
|
|
|
|
export const printTempl = function(tsc,data){
|
|
export const printTempl = function(tsc,data){
|
|
- let top = 24
|
|
+ let top = 48
|
|
const left = 8
|
|
const left = 8
|
|
const lightHeight = 24
|
|
const lightHeight = 24
|
|
const pageW = 60
|
|
const pageW = 60
|
|
const pageH = 40
|
|
const pageH = 40
|
|
const maxFontNums = Math.floor((pageW*8-left*2)/lightHeight)
|
|
const maxFontNums = Math.floor((pageW*8-left*2)/lightHeight)
|
|
- const leftMaxFnums = Math.floor(maxFontNums*0.6)
|
|
+ const leftMaxFnums = Math.floor(maxFontNums*0.4)
|
|
- let rightTop = 0
|
|
+ const rightMaxFnums = maxFontNums*0.5
|
|
- let rightLeft = (leftMaxFnums+1.2)*lightHeight
|
|
+ let rightLeft = (leftMaxFnums+1.5)*lightHeight
|
|
|
|
|
|
const command = tsc.jpPrinter.createNew()
|
|
const command = tsc.jpPrinter.createNew()
|
|
command.init()
|
|
command.init()
|
|
@@ -90,22 +90,48 @@ export const printTempl = function(tsc,data){
|
|
|
|
|
|
top = textFormat(command,data.dealerName,maxFontNums,left,top,lightHeight,"center",1)
|
|
top = textFormat(command,data.dealerName,maxFontNums,left,top,lightHeight,"center",1)
|
|
|
|
|
|
- top = top+10
|
|
+ top = top+30
|
|
- rightTop = top
|
|
+
|
|
-
|
|
+ command.setQR(left*3, top, "M", 5, "A", data.barCode)
|
|
-
|
|
|
|
-
|
|
|
|
- top = textFormat(command,data.shelfName +'/'+ data.productCode + '/' + data.productName,leftMaxFnums,left,top,lightHeight,"left",1)
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- top = top+10
|
|
|
|
- top = textFormat(command,data.printDate+' '+data.printUser,leftMaxFnums,left,top,lightHeight,"left",1)
|
|
|
|
|
|
|
|
- const qrtop = textFormat(command,data.shelfPlaceCode,maxFontNums-leftMaxFnums-1.2,rightLeft,rightTop,lightHeight,"center",2)
|
|
+ const rightTop = textFormat(command,data.shelfPlaceCode,rightMaxFnums,rightLeft,top,lightHeight,"left",4)
|
|
|
|
+
|
|
|
|
+ top = rightTop
|
|
|
|
+ top = textFormat(command,data.productCode,rightMaxFnums,rightLeft,top,lightHeight,"left",1)
|
|
|
|
+
|
|
|
|
+ command.setPagePrint(1,data.currentInven)
|
|
|
|
+ return command
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+export const printMiniTempl = function(tsc,data){
|
|
|
|
+ let top = 24
|
|
|
|
+ const left = 4
|
|
|
|
+ const lightHeight = 24
|
|
|
|
+ const pageW = 40
|
|
|
|
+ const pageH = 30
|
|
|
|
+ const maxFontNums = Math.floor((pageW*8-left*2)/lightHeight)
|
|
|
|
+ const leftMaxFnums = Math.floor(maxFontNums*0.5)
|
|
|
|
+ const rightMaxFnums = Math.floor(maxFontNums*0.4)
|
|
|
|
+ let rightLeft = (leftMaxFnums+1)*lightHeight
|
|
|
|
+
|
|
|
|
+ const command = tsc.jpPrinter.createNew()
|
|
|
|
+ command.init()
|
|
|
|
+ command.setSize(pageW, pageH)
|
|
|
|
+ command.setGap(3)
|
|
|
|
+ command.setCls()
|
|
|
|
+
|
|
|
|
+ top = textFormat(command,data.dealerName,maxFontNums,left,top,lightHeight,"center",1)
|
|
|
|
+
|
|
|
|
+ top = top+10
|
|
|
|
|
|
- command.setQR(rightLeft, qrtop, "M", 5, "A", data.barCode)
|
|
+ command.setQR(left, top, "M", 5, "A", data.barCode)
|
|
- command.setPagePrint(1,data.currentInven)
|
|
+
|
|
|
|
+ const rightTop = textFormat(command,data.shelfPlaceCode,rightMaxFnums,rightLeft,top,lightHeight,"left",3)
|
|
|
|
+
|
|
|
|
+ top = rightTop
|
|
|
|
+ top = textFormat(command,data.productCode,rightMaxFnums,rightLeft,top,lightHeight,"left",1)
|
|
|
|
+
|
|
|
|
+ command.setPagePrint(1,data.currentInven)
|
|
return command
|
|
return command
|
|
}
|
|
}
|