Browse Source

Merge branch 'master' of http://git.ds-bay.com/project/wms

lsp 4 years ago
parent
commit
fffeb85a66

+ 78 - 0
wms-operate/src/main/java/com/lote/wms/controller/operate/base/basic/Barcode4jController.java

@@ -0,0 +1,78 @@
+package com.lote.wms.controller.operate.base.basic;
+
+import com.lote.wms.common.core.web.model.Result;
+import com.lote.wms.common.utils.FileServerClient;
+import com.lote.wms.common.utils.StringUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.krysalis.barcode4j.HumanReadablePlacement;
+import org.krysalis.barcode4j.impl.code128.Code128Bean;
+import org.krysalis.barcode4j.output.bitmap.BitmapCanvasProvider;
+import org.krysalis.barcode4j.tools.UnitConv;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.awt.image.BufferedImage;
+
+/**
+ *
+ * 条码生成(新)
+ * controller版本
+ *
+ * @author 小问号
+ */
+@RestController
+@RequestMapping("/barcode4j")
+public class Barcode4jController {
+
+
+    @GetMapping
+    public Result generateBarcode(HttpServletRequest req, HttpServletResponse resp) throws Exception {
+        String msg = req.getParameter("msg");
+        boolean quietZone = Boolean.getBoolean(req.getParameter("quietZone"));
+        String moduleWidthStr = req.getParameter("moduleWidth");
+        String fmt = req.getParameter("fmt");
+        String height = req.getParameter("height");
+        String hrp = req.getParameter("hrp");
+        String qz = req.getParameter("qz");
+        String dpiStr = req.getParameter("dpi");
+        Code128Bean bean = new Code128Bean();
+        bean.setMsgPosition(HumanReadablePlacement.HRP_NONE);// 不要文字
+
+        // 精细度
+        int dpi = 150;
+        if (dpiStr != null) {
+            dpi = Integer.valueOf(dpiStr);
+        }
+        // module宽度
+        double moduleWidth = UnitConv.in2mm(1.0f / dpi);
+        if (moduleWidthStr != null) {
+            moduleWidth = Double.valueOf(moduleWidthStr);
+        }
+
+        // 配置对象
+        bean.setModuleWidth(Double.valueOf(moduleWidth));
+        bean.doQuietZone(quietZone);
+        bean.setQuietZone(Double.valueOf(qz));
+        bean.setHeight(Double.valueOf(height));
+
+        String format = "image/png";
+
+        // 输出到流
+        BitmapCanvasProvider canvas = new BitmapCanvasProvider(resp.getOutputStream(), format, dpi,
+                BufferedImage.TYPE_BYTE_BINARY, false, 0);
+
+        // 生成条形码
+        bean.generateBarcode(canvas, msg);
+
+        // 结束绘制
+        canvas.finish();
+
+        return Result.success("生成成功");
+    }
+}

+ 261 - 0
wms-operate/src/main/resources/static/ui/views/outstock/order/printWaybill/st_ldp.html

@@ -0,0 +1,261 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+	<style>
+	/*标签纸打印宽度*/
+	.print-page-label{width:100mm;margin: 0;height: 178mm;"}
+	/*分页命令*/
+	.change-page{page-break-after: always;font: 12px 'Microsoft Yahei';color: #000;}
+	</style>
+	<!-- 浏览器标签图片 -->
+	<link rel="shortcut icon" href="./topjui/image/favicon.ico"/>
+	<!-- jQuery相关引用 -->
+	<script type="text/javascript" src="/ui/static/plugins/jquery/jquery.min.js"></script>
+	<script type="text/javascript" src="/ui/static/plugins/jquery/jquery.cookie.js"></script>
+	<script type="text/javascript" src="/ui/static/public/js/baiduTemplate.js"></script>
+	<script type="text/javascript" src="/ui/static/public/js/datefmt.js?v=1"></script>
+	<script type="text/javascript" src="/ui/static/public/js/common.js?v=1"></script>
+	<!-- 日期格式化js -->
+	<script type="text/javascript" src="/ui/static/public/js/datefmt.js?v=1"></script>
+	<!-- 进度条 -->
+	<script src="/ui/static/3rd/pace/pace.js"></script>
+	<link rel="stylesheet" href="/ui/static/3rd/pace/themes/blue/pace-theme-center-simple.css" />
+	<!-- 	<link rel="stylesheet" href="/ui/static/plugins/bootstrap/css/bootstrap.css" /> -->
+
+	<!-- 打印页css -->
+	<link rel="stylesheet" href="/ui/css/print.css" />
+	<style>
+	   .px9 {
+			font-size: 9px;
+			display: inline-block;
+			-webkit-transform: scale(0.75);        /* 12*0.75=9 */
+		}
+	</style>
+</head>
+<!-- print-page-label 限制了页面宽度100mm -->
+<body class="print-page-label">
+</body>
+
+
+
+
+<script type="text/javascript">
+	$(function () {
+		var orderId = getParam('orderId');
+		if(orderId == null || orderId ==''){
+			return;
+		}
+		$.ajax({
+			type: "POST",
+			url: "/outstock/printWaybill/waybillHtml",
+			contentType:"application/json",
+			data:orderId,
+			success: function(msg){
+				console.log(msg);
+				if(msg.code!=0){
+					alert("加载数据失败,"+msg.msg);
+					return
+				}
+				//填充数据
+				var html = baidu.template('printBody',msg);
+				$("body").html(html);
+			},
+			error: function () {
+				$.iMessager.alert('注意', '网络断开或服务器已停止运行', 'messager-warning');
+			}
+		},"json");
+
+
+
+		//180秒后自动关闭
+		setTimeout(function () {
+			window.opener = null; window.close();
+		}, 180000);
+
+
+	});
+</script>
+
+
+<script id="printBody" type="text/html"  class="print-page-label">
+	<div style="border:1px solid  #000;width: 100mm;height: 177mm; "   id="printpage">
+		<div style="width:100%;height: 8mm;padding-top:5px;border-bottom:1px solid  #000;text-align: center;">
+			<div style="float:left; font-size: 11px;font-weight: bold;width:40mm;text-align: left;">
+				<img  src="/ui/static/images/st_logo.png" style="height: 6mm;">
+			</div>
+			<div style="text-align: left; font-size: 11px;font-weight: bold;">95543</div>
+			<div style="text-align: left; font-size: 11px;font-weight: bold;">www.sto.cn</div>
+		</div>
+
+		<div style="width:100%;height: 10mm;text-align:left;border-bottom:1px solid  #000;">
+			&nbsp;<span style="font-size: 9mm;"><b><%=data.extend4%></b></span>
+		</div>
+
+		<div style="width:100%;height: 10mm;text-align:left;border-bottom:1px solid  #000;">
+			<div style="width:8mm;font-weight: bold;font-size: 6mm;float: left;height: 10mm;line-height: 10mm">
+				&nbsp;集
+			</div>
+			<span style="font-size: 8mm;margin-left: 5mm;line-height: 10mm"><b><%=data.extend5%></b></span>
+		</div>
+
+		<div style="width:100%;height: 14mm;border-bottom:1px dashed  #000;" >
+			<div style="width:10mm;font-weight: bold;font-size: 6mm;float: left;height: 14mm;line-height:14mm;">
+				&nbsp;收
+			</div>
+			<div style="float: left;width:80mm;height: 14mm;font-size: 3.5mm;font-weight: bold;">
+				<%=data.receiver.name%>
+					<%=data.receiver.mobileNumber%>&nbsp;&nbsp;
+					<%=data.receiver.phoneNumber%>
+				</br>
+				<%=data.receiver.province%>
+				<%=data.receiver.city%>
+				<%=data.receiver.county%>
+				<%=data.receiver.addressLine1%>
+				<%=data.receiver.addressLine2%>
+			</div>
+		</div>
+		<div style="width:100%;height: 14mm;border-bottom:1px solid  #000;" >
+			<div style="width:10mm;font-weight: bold;font-size: 7mm;float: left;height: 14mm;line-height:14mm;">
+				&nbsp;寄
+			</div>
+			<div style="float: left;width:80mm;height: 14mm;font-size: 3mm;line-height:3.5mm; overflow: hidden;">
+				<%=data.sender.name%>
+				<%=data.sender.mobileNumber%>&nbsp;&nbsp;
+				<%=data.sender.phoneNumber%>
+				</br>
+				<%=data.sender.province%>
+				<%=data.sender.city%>
+				<%=data.sender.addressLine1%>
+				<%=data.sender.addressLine2%>
+			</div>
+		</div>
+
+		<div style="height: 18mm;border-bottom:1px solid  #000;text-align: center;"">
+		<img src="/barcode4j?msg=<%=data.trackingNo1%>&quietZone=false&dpi=150&moduleWidth=0.35&fmt=png&height=8&hrp=none&qz=4"  style="margin-top: 1mm;"/>
+		<br/>
+		<%=data.trackingNo1%>
+	</div>
+	<!-- 		10 10 10 14 14  18  32 = 108-->
+	<div style="height:32mm;width:100%;border-bottom:2mm solid  #000;">
+		<div style="height:22mm;float: left;width: 70mm;font-weight: bold;font-size: 8px;border-right:1px dashed  #000; border-bottom:1px dashed  #000;">
+				<span style="margin-left: 2mm;">
+
+					<%for(var i=0;i<data.allocationList.length;i++){%>
+						&nbsp;<%=data.allocationList[i].barcode%> * <%=data.allocationList[i].quantity%>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+					<%}%>
+				</span>
+		</div>
+		<div style="height:22mm;float: left;width: 28mm;font-weight: normal;border-bottom:1px dashed  #000;">
+			<table style="line-height: 4.5mm;width:28mm;font-size: 12px;font-weight: bold;padding-left: 1mm;">
+				<tr>
+					<td style="wdith:auto;">价值:</td>
+					<td style="width:17mm;text-align: left;"><%=data.productPrice%></td>
+				</tr>
+				<tr>
+					<td>保价:</td>
+					<td></td>
+				</tr>
+				<tr>
+					<td>数量:</td>
+					<td><%=data.productQty%></td>
+				</tr>
+				<tr>
+					<td>重量:</td>
+					<td><%=data.productWeight%></td>
+				</tr>
+			</table>
+		</div>
+
+		<div style="height:10mm;float: left;width: 70mm;font-weight: bold;font-size: 8px;border-right:1px dashed  #000;">
+			<div style="float: right;margin-top: 5mm;">
+				签名栏&nbsp;&nbsp;&nbsp;&nbsp;
+			</div>
+		</div>
+		<div style="height:10mm;float: left;width: 28mm;text-align: center;font-weight: bold;">
+			<span style="font-size: 6mm;line-height: 10mm">已验视</span>
+		</div>
+	</div>
+
+
+	<!-- 下联70mm -->
+	<div style="height:13mm;width:100%; border-bottom:1px solid  #000;padding-top: 1mm;font-size: 14px;">
+<!--		<div style="height: 13mm;width: 30mm;float: left;">&nbsp;&lt;!&ndash;  logo &ndash;&gt;</div>-->
+		<div style="height: 13mm;width: 60mm;float: left;text-align: center;">
+			<img src="/barcode4j?msg=<%=data.trackingNo1%>&quietZone=false&dpi=150&moduleWidth=0.35&fmt=png&height=5&hrp=none&qz=3"  style="margin-top: 0mm;margin-left: 1mm;"/>
+			<br/>
+			<%=data.trackingNo1%>
+		</div>
+	</div>
+
+	<div style="width:100%;height: 14mm;border-bottom:1px solid  #000;" >
+		<div style="width:10mm;font-weight: bold;font-size: 6mm;float: left;height: 14mm;line-height:14mm;">
+			&nbsp;收
+		</div>
+		<div style="float: left;width:80mm;height: 14mm;line-height:4mm; font-size: 3.5mm;font-weight: bold;">
+			<%=data.receiver.name%>
+			<%=data.receiver.mobileNumber%>&nbsp;&nbsp;
+			<%=data.receiver.phoneNumber%>
+			</br>
+			<%=data.receiver.province%>
+			<%=data.receiver.city%>
+			<%=data.receiver.county%>
+			<%=data.receiver.addressLine1%>
+			<%=data.receiver.addressLine2%>
+		</div>
+	</div>
+	<div style="width:100%;height: 14mm;border-bottom:1px solid  #000;" >
+		<div style="width:10mm;font-weight: bold;font-size: 7mm;float: left;height: 14mm;line-height:14mm;">
+			&nbsp;寄
+		</div>
+		<div style="float: left;width:80mm;height: 14mm;font-size: 3mm;line-height:3.5mm; overflow: hidden;">
+			<%=data.sender.name%>
+			<%=data.sender.mobileNumber%>&nbsp;&nbsp;
+			<%=data.sender.phoneNumber%>
+			</br>
+			<%=data.sender.province%>
+			<%=data.sender.city%>
+			<%=data.sender.addressLine1%>
+			<%=data.sender.addressLine2%>
+		</div>
+	</div>
+
+	<!-- 		12 13 12 25  5 5 -->
+	<div style="height:14mm;width:100%;border-bottom:0px solid  #000;padding-top: 1px;">
+		<div style="width:100%;height: 14mm;font-size: 4mm;text-align: left;float: left;">
+				<span style="margin-left: 5px;">
+					<%for(var i=0;i<data.allocationList.length;i++){%>
+						&nbsp;<%=data.allocationList[i].barcode%> * <%=data.allocationList[i].quantity%>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+					<%}%>
+				</span>
+		</div>
+	</div>
+
+	<div style="height:4mm;width:100%;text-align: center; border-bottom:1px dashed  #000;font-size: 10px;">
+		<div style="float: left;margin-left: 2mm;">&nbsp;订单号:<%=data.orderNo1%></div>
+	</div>
+
+	<div style="height:4mm;width:100%;border-bottom:0px solid  #000;font-size: 9px;">
+		<table style="width:100%;height: 4mm;line-height: 4mm;padding-left: 0;">
+			<tr>
+				<td>
+					<div style="float: left;width:33mm;text-align: left;white-space:nowrap" class="px9 ">时间:<%=data.extend10%></div>
+				</td>
+				<td>
+					<div style="float: left; white-space:nowrap" class="px9">查件电话:95543</div>
+				</td>
+				<td>
+					<div style="float: right;white-space:nowrap" class="px9">查件网址:www.sto.cn</div>
+				</td>
+			</tr>
+		</table>
+	</div>
+	</div>
+
+</script>
+
+
+
+
+
+</html>
+