1
0
Pārlūkot izejas kodu

打印报关表

lsp 4 gadi atpakaļ
vecāks
revīzija
21fb9b9fe9

+ 22 - 5
wms-operate/src/main/java/com/lote/wms/controller/operate/outstock/order/PrintWaybillController.java

@@ -28,9 +28,7 @@ import org.springframework.web.servlet.ModelAndView;
 import javax.annotation.Resource;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 
 @RequestMapping("/outstock/printWaybill")
 @Controller
@@ -119,6 +117,25 @@ public class PrintWaybillController extends AbstractController {
 		view.setViewName("/outstock/order/printCustoms/" + templateName);
 		return view;
 	}
+
+	/**
+	 * 打印报单表
+	 * @param orderIds
+	 * @return
+	 */
+	@RequestMapping("customsHtml")
+	@ResponseBody
+	public Result customsHtml(String orderIds) {
+		List<OutOrderResultVo> voList = new ArrayList<>();
+		// 查询打印运单需要的数据
+		List<String> orderIdArray = StringUtil.stringToList(orderIds, String.class, ",");
+		for (String orderId : orderIdArray){
+			OutOrderResultVo vo = outOrderService.getPrintWaybillData(orderId, this.getUser());
+			voList.add(vo);
+		}
+
+		return Result.success(voList);
+	}
 	
 	/**
 	 * 批量打印
@@ -202,8 +219,8 @@ public class PrintWaybillController extends AbstractController {
 
 	/**
 	 * 更新打印运单状态
-	 * 
-	 * @param orderIdList
+	 * @param isUpdateStatus
+	 * @param orderIds
 	 * @return
 	 */
 	@RequestMapping("printUpdate")

+ 5 - 3
wms-operate/src/main/resources/static/ui/js/outstock/wave/outWave/list.js

@@ -322,9 +322,11 @@ function printWaybill(orderIds){
 	         		    	
 	         		    	$.iMessager.show({title: '温馨提示',msg:'正在打印渠道:'+shipwayCode ,timeout:4000});
 	         		    	
-	         		    	var href = '/outstock/printWaybill/batch?printType=customs&shipwayCode={shipwayCode}&orderIds={orderIds}';//预览
-	         		    	var printUrl = href.replace("{shipwayCode}",shipwayCode).replace("{orderIds}",orderIds);
-	         		    	window.open(printUrl);
+	         		    	//var href = '/outstock/printWaybill/batch?printType=customs&shipwayCode={shipwayCode}&orderIds={orderIds}';//预览
+							// var printUrl = href.replace("{shipwayCode}",shipwayCode).replace("{orderIds}",orderIds);
+							var href = _ctx + '/views/outstock/order/printCustoms/defaultNew.html?orderIds={orderIds}';
+							var printUrl = href.replace("{orderIds}",orderIds);
+							window.open(printUrl);
 	         		    }
 	   	        		//是否刷新
 	   	        		if(isRefresh =='Y'){

+ 90 - 0
wms-operate/src/main/resources/static/ui/views/outstock/order/printCustoms/defaultNew.html

@@ -0,0 +1,90 @@
+<head>
+	<style>
+		/*标签纸打印宽度*/
+		.print-page-label{width:100mm;margin: 0;}
+		/*分页命令*/
+		.change-page{page-break-after: always;font: 12px 'Microsoft Yahei';color: #000;}
+	</style>
+	<link rel="stylesheet" href="/ui/css/print.css" />
+</head>
+
+<!-- print-page-label 限制了页面宽度100mm -->
+<body class="print-page-label" style="width:105mm;">
+</body>
+
+<script type="text/javascript" >
+$(function () {
+	var orderIds = getParam('orderIds');
+	if(orderIds == null || orderIds ==''){
+		return;
+	}
+
+	$.ajax({
+		type: "POST",
+		url: "/outstock/printWaybill/customsHtml",
+		contentType:"application/json",
+		data:orderIds,
+		success: function(msg){
+			console.log(msg);
+			if(msg.code!=0){
+				alert("加载数据失败,"+msg.msg);
+				return;
+			}
+			//填充数据
+			var html = baidu.template('printBody',msg);
+			$("body").html(html);
+			hideLoad();
+		},
+		error: function () {
+			$.iMessager.alert('注意', '网络断开或服务器已停止运行', 'messager-warning');
+		}
+	},"json");
+
+	function hideLoad(){
+		//进度条隐藏
+		Pace.on('hide', function(){
+			console.info('加载完毕');
+		});
+	};
+});
+</script>
+
+<script id="printBody" type="text/html">
+	<%if(data != null){%>
+		<%for(var i=0; i<data.length; i++){%>
+			<div style="border:1px solid  #000;width: 92mm;height: 72mm;padding-left: 1mm;padding-top: 1mm;">
+				<div style="height:16mm;width:100%; text-align: center; border-bottom:1px solid  #000;">
+					<img  style="margin-top:1mm;" src="data:image/png;base64,<%=data.orderNoBarcodeData%>">
+					<div style="font-size: 4mm; margin-left: 1mm;margin-top: 0mm;"><%=data[i].orderNo1%></div>
+				</div>
+
+				<div style="height:17mm;width:100%; text-align: center; border-bottom:1px solid  #000000;">
+					<img  style="margin-top:1mm;" src="data:image/png;base64,<%=data.trackingNoBarcodeData%>">
+					<div style="font-size: 12px; margin-left: 1mm"><%=data[i].trackingNo1%></div>
+				</div>
+
+				<div style="height:20mm;width:100%;text-align: left;">
+					<span style="margin-left: 5px;margin-top: 5px;">
+						报关信息:
+						<%if(data[i].allocationList != null){%>
+							<table style="width: 100%;" border="1px solid #ccc" cellspacing="0" cellpadding="0">
+								<tr>
+									<th>商品条码</th>
+									<th>品名</th>
+									<th>数量</th>
+								</tr>
+								<%for(var j=0; j<data[i].allocationList.length; j++){%>
+									<tr>
+										<td><%=data[i].allocationList[j].barcode%></td>
+										<td><%=data[i].allocationList[j].customsName%></td>
+										<td><%=data[i].allocationList[j].quantity%></td>
+									</tr>
+								<%}%>
+							</table>
+						<%}%>
+					</span>
+				</div>
+			</div>
+		<%}%>
+	<%}%>
+</script>