Skip to content

发货单示例

发货单示例,包含

  • 页眉、页脚
  • 动态表格

发货单模板示例

xml
<?xml version="1.0" encoding="UTF-8"?>
<page
	xmlns="http://cloudprint.cainiao.com/print"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://cloudprint.cainiao.com/print http://cloudprint-docs-resource.oss-cn-shanghai.aliyuncs.com/lpml_schema.xsd"
	xmlns:editor="http://cloudprint.cainiao.com/schema/editor"
	width="210" height="297" splitable="true">
	<!--页眉数据-->
	<header width="202" height="30" style="zIndex:1;overflow:visible;">
		<layout left="95" top="10" width="38" height="10" editor:_for_="element_text_013B301D21C4C418" style="zIndex:7;overflow:visible;">
			<text style="fontSize:22;valign:middle;fontFamily:宋体">
			<![CDATA[拣选单]]>
			</text>
		</layout>
	</header>
	
	
	<!-- content 内容(页面高度 - 页眉高度 - 页脚高度)-->
	<!-- 相对布局(只指定宽度不要指定高度):最外层 layout 指定布局方式 水平/ 垂直-->
	<layout width="203" orientation="vertical">
	
		<!-- 相对布局:内一层 layout 指定相对布局元素(不要指定 top left)-->
		
		
		<layout  width="200" style="zIndex:21;overflow:visible;">
			<table style="borderWidth:1;cellBorderWidth:1"  editor:key="_data.tabletest" width="100">
				<!--表头部分-->
				<tr>
					<th width="60"> 
						<text style="fontSize:10;valign:middle;align:center;fontWeight:bold;fontFamily:Arial">
						<![CDATA[货品名称]]>
						</text>
					</th>
					<th width="40"> 
						<text style="fontSize:10;valign:middle;align:center;fontWeight:bold;fontFamily:Arial">
						<![CDATA[数量]]>
						</text>
					</th>
				</tr>
				
				<!--表格动态部分-->
				<%for(var i=0; i<_data.tabletest.length; i++){%>
				<tr>
					<td > 
						<text style="fontSize:10;fontFamily:Arial">
						<![CDATA[<%=_data.tabletest[i].products%>]]>
						</text>
					</td>
					<td > 
						<text style="fontSize:12;fontFamily:Arial;align:center;">
						<![CDATA[<%=_data.tabletest[i].count%>]]>
						</text>
					</td>
				</tr>
				<%}%>
			</table>
		</layout>
	</layout>
		
	<!--页脚数据-->
	<footer width="205" height="10" style="zIndex:1;overflow:visible;">
		<!--页面索引 当前页数:currentPageNumber 总页数:totalPageNumber-->
	    <layout left="10" top="0" width="60" height="10" style="zIndex:1;overflow:visible;">
			<pageIndex format="第currentPageNumber页 共totalPageNumber页" style="fontSize:12;fontFamily:Arial">
			</pageIndex>
		</layout>
		
		<layout left="100" top="0" width="100" height="10" editor:_for_="element_text_27D6C882A354D44A" style="zIndex:23;overflow:visible;">
			<text style="fontSize:12;fontFamily:Arial">
			<![CDATA[打印人:XXX 打印时间:<%=_context.formatStartTime('yyyy-MM-dd HH:mm:ss')%>]]>
			</text>
		</layout>
	</footer>

</page>
<?xml version="1.0" encoding="UTF-8"?>
<page
	xmlns="http://cloudprint.cainiao.com/print"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://cloudprint.cainiao.com/print http://cloudprint-docs-resource.oss-cn-shanghai.aliyuncs.com/lpml_schema.xsd"
	xmlns:editor="http://cloudprint.cainiao.com/schema/editor"
	width="210" height="297" splitable="true">
	<!--页眉数据-->
	<header width="202" height="30" style="zIndex:1;overflow:visible;">
		<layout left="95" top="10" width="38" height="10" editor:_for_="element_text_013B301D21C4C418" style="zIndex:7;overflow:visible;">
			<text style="fontSize:22;valign:middle;fontFamily:宋体">
			<![CDATA[拣选单]]>
			</text>
		</layout>
	</header>
	
	
	<!-- content 内容(页面高度 - 页眉高度 - 页脚高度)-->
	<!-- 相对布局(只指定宽度不要指定高度):最外层 layout 指定布局方式 水平/ 垂直-->
	<layout width="203" orientation="vertical">
	
		<!-- 相对布局:内一层 layout 指定相对布局元素(不要指定 top left)-->
		
		
		<layout  width="200" style="zIndex:21;overflow:visible;">
			<table style="borderWidth:1;cellBorderWidth:1"  editor:key="_data.tabletest" width="100">
				<!--表头部分-->
				<tr>
					<th width="60"> 
						<text style="fontSize:10;valign:middle;align:center;fontWeight:bold;fontFamily:Arial">
						<![CDATA[货品名称]]>
						</text>
					</th>
					<th width="40"> 
						<text style="fontSize:10;valign:middle;align:center;fontWeight:bold;fontFamily:Arial">
						<![CDATA[数量]]>
						</text>
					</th>
				</tr>
				
				<!--表格动态部分-->
				<%for(var i=0; i<_data.tabletest.length; i++){%>
				<tr>
					<td > 
						<text style="fontSize:10;fontFamily:Arial">
						<![CDATA[<%=_data.tabletest[i].products%>]]>
						</text>
					</td>
					<td > 
						<text style="fontSize:12;fontFamily:Arial;align:center;">
						<![CDATA[<%=_data.tabletest[i].count%>]]>
						</text>
					</td>
				</tr>
				<%}%>
			</table>
		</layout>
	</layout>
		
	<!--页脚数据-->
	<footer width="205" height="10" style="zIndex:1;overflow:visible;">
		<!--页面索引 当前页数:currentPageNumber 总页数:totalPageNumber-->
	    <layout left="10" top="0" width="60" height="10" style="zIndex:1;overflow:visible;">
			<pageIndex format="第currentPageNumber页 共totalPageNumber页" style="fontSize:12;fontFamily:Arial">
			</pageIndex>
		</layout>
		
		<layout left="100" top="0" width="100" height="10" editor:_for_="element_text_27D6C882A354D44A" style="zIndex:23;overflow:visible;">
			<text style="fontSize:12;fontFamily:Arial">
			<![CDATA[打印人:XXX 打印时间:<%=_context.formatStartTime('yyyy-MM-dd HH:mm:ss')%>]]>
			</text>
		</layout>
	</footer>

</page>

发货单测试数据

json
{
    "cmd": "print",
    "requestID": "123458976",
    "version": "1.0",
    "task": {
        "taskID": "7293666",
        "preview": false,
        "printer": "",
        "notifyMode": "allInOne",
        "adaptPageSize": true,
        "previewType": "pdf",
        "documents": [
            {
                "documentID": "0123456789",
                "contents": [
                    {
                        "data": {
                            "tabletest": [
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                },
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                },
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                },
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                },
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                },
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                },
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                },
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                },
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                },
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                },
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                },
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                },
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                },
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                },
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                },
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                },
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                },
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                }
                            ]
                        },
                        "templateURL": "发货单 URL"
                    }
                ]
            }
        ]
    }
}
{
    "cmd": "print",
    "requestID": "123458976",
    "version": "1.0",
    "task": {
        "taskID": "7293666",
        "preview": false,
        "printer": "",
        "notifyMode": "allInOne",
        "adaptPageSize": true,
        "previewType": "pdf",
        "documents": [
            {
                "documentID": "0123456789",
                "contents": [
                    {
                        "data": {
                            "tabletest": [
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                },
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                },
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                },
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                },
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                },
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                },
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                },
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                },
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                },
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                },
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                },
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                },
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                },
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                },
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                },
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                },
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                },
                                {
                                    "products": "测试商品",
                                    "count": "1"
                                }
                            ]
                        },
                        "templateURL": "发货单 URL"
                    }
                ]
            }
        ]
    }
}