Commit 3f08c4fc by 胡懿

修改盘盈入库代码逻辑,修改盘盈入库二维码生成逻辑

parent 43caaa0e
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
a.marking AS "marking", a.marking AS "marking",
a.shelves_ids AS "shelvesIds", a.shelves_ids AS "shelvesIds",
a.warehouse_ids AS "warehouseIds", a.warehouse_ids AS "warehouseIds",
a.num AS "num",
a.qr_id AS "qrCode.id", a.qr_id AS "qrCode.id",
qrCode.url AS "qrCode.url", qrCode.url AS "qrCode.url",
qrCode.state AS "qrCode.state", qrCode.state AS "qrCode.state",
......
...@@ -321,8 +321,9 @@ public class DrawQrcodeUtil { ...@@ -321,8 +321,9 @@ public class DrawQrcodeUtil {
public static BufferedImage createAssetImageNew2(File qrcodeFile,QrCode qrCode) throws IOException { public static BufferedImage createAssetImageNew2(File qrcodeFile,QrCode qrCode) throws IOException {
ProfitWarehousingInfo profitWarehousingInfo = qrCode.getProfitWarehousingInfo(); ProfitWarehousingInfo profitWarehousingInfo = qrCode.getProfitWarehousingInfo();
QRcodeSize qRcodeSize = null; QRcodeSize qRcodeSize = null;
qRcodeSize = new QRcodeSize(8,200,1400,78,200,200,1200,1200,new Color(34,25,21)); qRcodeSize = new QRcodeSize(8,800,1800,78,800,200,1600,1600,new Color(34,25,21));
BufferedImage bgImage = new BufferedImage(1600, 2400, BufferedImage.TYPE_4BYTE_ABGR); // BufferedImage bgImage = new BufferedImage(1600, 2400, BufferedImage.TYPE_4BYTE_ABGR);
BufferedImage bgImage = new BufferedImage(3200, 2400, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = bgImage.createGraphics(); Graphics2D g2 = bgImage.createGraphics();
BufferedImage qrcodeImage = ImageIO.read(qrcodeFile); BufferedImage qrcodeImage = ImageIO.read(qrcodeFile);
...@@ -334,12 +335,12 @@ public class DrawQrcodeUtil { ...@@ -334,12 +335,12 @@ public class DrawQrcodeUtil {
, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); , RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
g2.setRenderingHints(rh); g2.setRenderingHints(rh);
Font font = new Font("黑体",Font.BOLD,16 * qRcodeSize.getInitfontSize()); Font font = new Font("等线",Font.PLAIN,100);
g2.setFont(font); //设置字体:字体、字号、大小 g2.setFont(font); //设置字体:字体、字号、大小
g2.setColor(qRcodeSize.color);//设置背景颜色 g2.setColor(qRcodeSize.color);//设置背景颜色
// g2.setBackground(c); // g2.setBackground(c);
int contentX = qRcodeSize.getInitContentX(); int contentX = qRcodeSize.getInitContentX();
int contentY = qRcodeSize.getInitContentY() + 200; int contentY = qRcodeSize.getInitContentY() + 150;
//写二维码 //写二维码
g2.drawImage(qrcodeImage,qRcodeSize.getQrcodeX(),qRcodeSize.getQrcodeY(),qRcodeSize.getQrcodeWidth(),qRcodeSize.getQrcodeHeight(),null,null); g2.drawImage(qrcodeImage,qRcodeSize.getQrcodeX(),qRcodeSize.getQrcodeY(),qRcodeSize.getQrcodeWidth(),qRcodeSize.getQrcodeHeight(),null,null);
...@@ -347,39 +348,22 @@ public class DrawQrcodeUtil { ...@@ -347,39 +348,22 @@ public class DrawQrcodeUtil {
String contentTitle1 = "货品名称:"; String contentTitle1 = "货品名称:";
int contentTitle1Width = g2.getFontMetrics().stringWidth(contentTitle1); int contentTitle1Width = g2.getFontMetrics().stringWidth(contentTitle1);
g2.drawString(contentTitle1,contentX,contentY); g2.drawString(contentTitle1,contentX,contentY);
String name = formatContent(profitWarehousingInfo.getName(),10); String name = formatContent(profitWarehousingInfo.getType().getName(),10);
AttributedString as = new AttributedString(name); AttributedString as = new AttributedString(name);
as.addAttribute(TextAttribute.FONT, font); as.addAttribute(TextAttribute.FONT, font);
as.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_LOW_DASHED, 0, name.length()); as.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_LOW_DASHED, 0, name.length());
g2.drawString(as.getIterator(),contentX+contentTitle1Width,contentY); g2.drawString(as.getIterator(),contentX+contentTitle1Width,contentY);
//写入货品类型
String contentTitle2 = "货品类型:";
int contentTitle2Width = g2.getFontMetrics().stringWidth(contentTitle2);
g2.drawString(contentTitle2,contentX,contentY+200);
String typeName = formatContent(profitWarehousingInfo.getType().getName(),10);
as = new AttributedString(typeName);
as.addAttribute(TextAttribute.FONT, font);
as.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_LOW_DASHED, 0, typeName.length());
g2.drawString(as.getIterator(),contentX+contentTitle2Width,contentY+200);
//写入物资编码
String contentTitle4 = "物资编码:"; String contentTitle4 = "物资编码:";
int contentTitle4Width = g2.getFontMetrics().stringWidth(contentTitle4); int contentTitle4Width = g2.getFontMetrics().stringWidth(contentTitle4);
g2.drawString(contentTitle4,contentX,contentY+400); g2.drawString(contentTitle4,contentX,contentY+150);
String code = qrCode.getCode(); String code = qrCode.getCode();
if (code.length() > 10) { as = new AttributedString(code);
String str1 = code.substring(0, 9); as.addAttribute(TextAttribute.FONT, font);
str1 = formatContent(str1,10); as.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_LOW_DASHED, 0, code.length());
as = new AttributedString(str1); g2.drawString(as.getIterator(),contentX+contentTitle4Width,contentY+150);
as.addAttribute(TextAttribute.FONT, font);
as.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_LOW_DASHED, 0, str1.length());
g2.drawString(as.getIterator(),contentX+contentTitle4Width,contentY+400);
String str2 = code.substring(9, code.length());
str2 = formatContent(str2,10);
as = new AttributedString(str2);
as.addAttribute(TextAttribute.FONT, font);
as.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_LOW_DASHED, 0, str2.length());
g2.drawString(as.getIterator(),contentX+contentTitle4Width,contentY+600);
}
return bgImage; return bgImage;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment