Commit 9d627891 authored by 鲁鑫's avatar 鲁鑫

条形码生成格式调整;领料单打印

parent 3bd2ba83
......@@ -39,6 +39,8 @@ function loadGrid() {
width: "100%",
height: "100%",
heightDiff: -8,
sortName: 'fillinDate',
sortOrder: 'desc',
checkbox: true,
fixedCellHeight: true,
selectRowButtonOnly: true,
......
......@@ -14,24 +14,28 @@
</head>
<body>
<div class="billTitle">物品领料单</div>
<span class="fs" style="font-family:SimSun;position: absolute;right: 90px;top: 0">
<img class="barcode" src="${barCode}"></img>
</span>
<div class="blank_div"></div>
<table cellspacing="0px" cellpadding="0px" class="tablePrint">
<colgroup>
<col width='50%'/>
<col width="50%"/>
<col width='70%'/>
<col width="30%"/>
</colgroup>
<tr>
<td class="left">领料部门:${kostlName?default("")?html}</td>
<td class="right">领料单号:${message?default("")?html}</td>
<td class="left">领料单号:${message?default("")?html}</td>
</tr>
</table>
<table cellspacing="0px" cellpadding="0px" class="tablePrint">
<colgroup>
<col width='50%'/>
<col width="50%"/>
<col width='70%'/>
<col width="30%"/>
</colgroup>
<tr>
<td class="left">领料类型:${personMemberName?default("")?html}</td>
<td class="right">列印日期:${fillinDate?default("")?html}</td>
<td class="left">列印日期:${fillinDate?default("")?html}</td>
</tr>
</table>
<table cellspacing="0px" cellpadding="0px" class="tableBorder">
......@@ -83,6 +87,34 @@
<td class="center">${count?default("")?html}</td>
</tr>
</table>
<table cellspacing="0px" cellpadding="0px" class="tablePrint">
<colgroup>
<col width='20%'/>
<col width="20%"/>
<col width="20%"/>
<col width="20%"/>
<col width="20%"/>
</colgroup>
<tr>
<td class="left">记账:</td>
<td class="left">发料人:</td>
<td class="left">核准:</td>
<td class="left">审批:</td>
<td class="left">领料人:${personMemberName?default("")?html}</td>
</tr>
</table>
<table cellspacing="0px" cellpadding="0px" class="tablePrint">
<colgroup>
<col width='33%'/>
<col width="33%"/>
<col width="33%"/>
</colgroup>
<tr>
<td class="left">第一联:生产部(白)</td>
<td class="left">第二联:仓库(黄)</td>
<td class="left">第三联:存根(红)</td>
</tr>
</table>
</body>
</html>
......@@ -54,18 +54,18 @@ public class CommonUtils {
}
public static void generateBarCode128(String msg, String imgType, OutputStream out)
public static void generateBarCode128(String msg, String imgType, OutputStream out,int dpi, double height, HumanReadablePlacement placement)
throws IOException {
if (msg == null || out == null) {
return;
}
Code128Bean bean = new Code128Bean();
int dpi = 100;
//int dpi = 100;
// module宽度 UnitConv.in2mm(1.f / dpi);
double moduleWidth = 0.4;
double moduleWidth = 0.3;
bean.setModuleWidth(moduleWidth);
bean.setMsgPosition(HumanReadablePlacement.HRP_BOTTOM);
bean.setHeight(10);
bean.setMsgPosition(placement);
bean.setHeight(height);
bean.doQuietZone(false);
......@@ -75,11 +75,11 @@ public class CommonUtils {
canvas.finish();
}
public static File genBarCode128(String msg, String imgType, File file)
public static File genBarCode128(String msg, String imgType, File file, int dpi, double height, HumanReadablePlacement placement)
throws IOException {
FileOutputStream out = new FileOutputStream(file);
try {
generateBarCode128(msg,imgType, out);
generateBarCode128(msg,imgType, out,dpi,height,placement);
} finally {
if (out != null) {
out.close();
......
......@@ -143,7 +143,10 @@ public class NonProducePickApplicationImpl extends FlowBroker implements NonProd
} else {
nonProducePick = (NonProducePick) commonDomainService.loadAndFillinProperties(nonProducePick);
}
this.checkNonProducePickNum(nonProducePickItems, nonProducePick.getWerks());
//还未创建预留单之前都需要校验数量
if (StringUtil.isBlank(nonProducePick.getMessage())){
this.checkNonProducePickNum(nonProducePickItems, nonProducePick.getWerks());
}
nonProducePick = nonProducePickRepository.save(nonProducePick);
nonProducePickItemApplication.saveNonProducePickItems(nonProducePick.getId(),nonProducePickItems);
return nonProducePick.getId();
......@@ -164,7 +167,9 @@ public class NonProducePickApplicationImpl extends FlowBroker implements NonProd
List<SapResult> resultList = JSONObject.parseArray(execute, SapResult.class);
SapResult sapResult = resultList.get(0);
if (!"S".equals(sapResult.getTYPE())){
throw new RuntimeException("数据传输失败,"+ sapResult.getMESSAGE());
List<String> stringList = resultList.stream().map(SapResult::getMESSAGE).collect(Collectors.toList());
String message = String.join(";", stringList);
throw new RuntimeException(message);
}
} catch (IOException e) {
throw new RuntimeException(e);
......
......@@ -3,6 +3,7 @@ package com.huigou.topsun.sap.nonProducePick.controller;
import com.huigou.context.Operator;
import com.huigou.context.OrgUnit;
import com.huigou.data.domain.query.QueryPageRequest;
import com.huigou.topsun.common.CommonUtils;
import com.huigou.topsun.ep.change.domain.query.EpChangeFormQueryRequest;
import com.huigou.topsun.sap.nonProducePick.application.NonProducePickApplication;
import com.huigou.topsun.sap.nonProducePick.application.NonProducePickItemApplication;
......@@ -14,10 +15,13 @@ import com.huigou.uasp.bmp.common.BizBillStatus;
import com.huigou.uasp.client.CommonController;
import com.huigou.util.ClassHelper;
import com.huigou.util.SDO;
import org.krysalis.barcode4j.HumanReadablePlacement;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import javax.annotation.Resource;
import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
......@@ -91,6 +95,17 @@ public class NonProducePickController extends CommonController {
map.put("itemList", itemList);
BigDecimal bigDecimal = itemList.stream().map(NonProducePickItem::getErfmg).reduce(BigDecimal.ZERO, BigDecimal::add);
map.put("count",bigDecimal);
File file = new File(nonProducePick.getMessage()+".png");
if(!file.exists()) {
String IMG_TYPE_PNG = "image/png";
try {
map.put("barCode", CommonUtils.genBarCode128(nonProducePick.getMessage(), IMG_TYPE_PNG, file,128,10, HumanReadablePlacement.HRP_NONE));
} catch (IOException e) {
throw new RuntimeException("条形码生成失败:" + e.getMessage());
}
} else {
map.put("barCode",file);
}
String pintPage = String.format("/print/topsun/nonProducePick.ftl");
return outputAndProcUnitHandlerPDF(pintPage, id, map);
}
......
......@@ -35,6 +35,7 @@ import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.runtime.ProcessInstance;
import org.krysalis.barcode4j.HumanReadablePlacement;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
......@@ -295,7 +296,7 @@ public class SapPermitApplicationImpl extends FlowBroker implements SapPermitApp
File file = new File("bar-"+permit.getBillCode()+".png");
if(!file.exists()) {
String IMG_TYPE_PNG = "image/png";
data.put("barCode", CommonUtils.genBarCode128(permit.getBillCode(), IMG_TYPE_PNG, file));
data.put("barCode", CommonUtils.genBarCode128(permit.getBillCode(), IMG_TYPE_PNG, file,128,10, HumanReadablePlacement.HRP_NONE));
} else {
data.put("barCode",file);
}
......
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