Browse Source

出库单打印

wanfa99 2 years ago
parent
commit
a2fb5e3dee

+ 9 - 9
jeecg-boot-module-system/src/main/java/org/jeecg/modules/openApi/service/impl/Rdrecord11ServiceImpl.java

@@ -61,7 +61,7 @@ public class Rdrecord11ServiceImpl  implements IRdrecord11Service {
             file.mkdir();
         }
         //查询SQl
-        String sql="select  a.cCode+'_'+b.cBatch as 缸单条码,c.cCusCode as 客户,b.cBatch as 缸号,e.cVenName as 供应商," +
+        String sql="select  a.csysbarcode  as 缸单条码,c.cCusCode as 客户,b.cBatch as 缸号,e.cVenName as 供应商," +
                 "b.cbatchproperty9 as 染厂色号,d.cVenCode as 接收方,b.iQuantity as 数量,b.csocode as 上游订单,b.cdefine26 as 匹数," +
                 "b.comcode as 下游订单,f.cInvName as 物料,a.cCode as 发货单,'描述' as 描述 From rdrecord11 a left join  rdrecords11 b " +
                 "on a.id=b.id left join SO_SOMain c on  b.csocode=c.csocode left join OM_MOMain d on b.comcode=d.cCode " +
@@ -107,14 +107,14 @@ public class Rdrecord11ServiceImpl  implements IRdrecord11Service {
                     backGraphics.setFont(font);
                     backGraphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
 
-                    backGraphics.drawString("缸号:"+onejson.getString("code"),0,bTextSize*0);
-                    backGraphics.drawString("委外订单号:"+onejson.getString("comcode"),0,(bTextSize+5)*1);
-                    backGraphics.drawString("匹数:"+onejson.getString("cdefine26"),0,(bTextSize+5)*2);
-                    backGraphics.drawString("物料:"+onejson.getString("cInvName"),0,(bTextSize+5)*3);
-                    backGraphics.drawString("描述:"+onejson.getString("text"),0,(bTextSize+5)*4);
-                    backGraphics.drawString("关键属性:",0,(bTextSize+5)*5);
-                    backGraphics.drawString("供应商:"+onejson.getString("cVenName"),0,(bTextSize+5)*6);
-                    backGraphics.drawString("接收方:"+onejson.getString("cVenCode"),0,(bTextSize+5)*7);
+                    backGraphics.drawString("缸号:"+onejson.getString("缸单条码"),0,30+bTextSize*0);
+                    backGraphics.drawString("委外订单号:"+onejson.getString("下游订单"),0,30+(bTextSize+5)*1);
+                    backGraphics.drawString("匹数:"+onejson.getString("匹数"),0,30+(bTextSize+5)*2);
+                    backGraphics.drawString("物料:"+onejson.getString("物料"),0,30+(bTextSize+5)*3);
+                    backGraphics.drawString("描述:"+onejson.getString("描述"),0,30+(bTextSize+5)*4);
+                    backGraphics.drawString("关键属性:",0,30+(bTextSize+5)*5);
+                    backGraphics.drawString("供应商:"+onejson.getString("供应商"),0,30+(bTextSize+5)*6);
+                    backGraphics.drawString("接收方:"+onejson.getString("接收方"),0,30+(bTextSize+5)*7);
 
                     //放图片
                     backGraphics.drawImage(bufferedImage, 0,180, bufferedImage.getWidth(), bufferedImage.getHeight(),null);

+ 4 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/util/oConvertUtils.java

@@ -11,6 +11,8 @@ import org.jeecg.modules.system.entity.SysUser;
 
 import javax.imageio.ImageIO;
 import javax.print.*;
+import javax.print.attribute.DocAttributeSet;
+import javax.print.attribute.HashDocAttributeSet;
 import javax.print.attribute.HashPrintRequestAttributeSet;
 import javax.print.attribute.PrintRequestAttributeSet;
 import javax.servlet.http.HttpServletRequest;
@@ -714,13 +716,14 @@ public class oConvertUtils {
         }
         // 设置打印格式,如果未确定类型,可选择autosense
         DocFlavor flavor = DocFlavor.INPUT_STREAM.PNG;
+        DocAttributeSet das = new HashDocAttributeSet();
         // 设置打印参数
         PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
 
         for (int i=0;i<filePath.size();i++){
             File file=new File(filePath.get(0));
             FileInputStream fis = new FileInputStream(file); // 构造待打印的文件流
-            Doc doc = new SimpleDoc(fis, flavor, null);
+            Doc doc = new SimpleDoc(fis, flavor, das);
             DocPrintJob job = service.createPrintJob(); // 创建打印作业
             job.print(doc, aset);
         }