src/main/java/com/zy/asrs/controller/OrderController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/application.yml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/webapp/static/js/order/order.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/webapp/views/order/order.html | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/zy/asrs/controller/OrderController.java
@@ -10,6 +10,7 @@ import com.zy.asrs.entity.*; import com.zy.asrs.entity.param.OrderDomainParam; import com.zy.asrs.service.*; import com.zy.common.CodeRes; import com.zy.common.model.DetlDto; import com.zy.common.web.BaseController; import org.springframework.beans.factory.annotation.Autowired; @@ -336,6 +337,18 @@ } return R.ok(); } @RequestMapping(value = "/order/print/auth") @ManagerAuth(memo = "订单编码打印") public R orderPrint(@RequestParam(value = "param[]") String[] param) { if(Cools.isEmpty(param)) { return R.parse(CodeRes.EMPTY); } List<OrderDetl> res = new ArrayList<>(); for (String orderNo : param){ res = orderDetlService.selectList(new EntityWrapper<OrderDetl>().eq("order_no", orderNo)); } return R.ok().add(res); } @RequestMapping("/order/in") public R in(@RequestBody JSONObject param){ src/main/resources/application.yml
@@ -1,5 +1,5 @@ server: port: 8081 port: 8080 servlet: context-path: /@pom.build.finalName@ src/main/webapp/static/js/order/order.js
@@ -1,4 +1,5 @@ var insTbCount = 0; var printMatCodeNos = []; layui.config({ base: baseUrl + "/static/layui/lay/modules/" }).use(['layer', 'form', 'table', 'util', 'admin', 'xmSelect', 'laydate'], function () { @@ -82,15 +83,59 @@ $("#orderAddBtn").click(function () { showEditModel(); }); function btnPrint(id, orderNo, number) { printMatCodeNos.push(orderNo) var templateNo = 3; $.ajax({ url: baseUrl+"/order/print/auth", headers: {'token': localStorage.getItem('token')}, data: {param: printMatCodeNos}, method: 'POST', async: false, success: function (res) { if (res.code === 200){ layer.closeAll(); console.log(res); for (let i=0;i<res.data.length;i++){ var templateDom = $("#templatePreview"+templateNo); var className = templateDom.attr("class"); if (className === 'template-barcode') { res.data[i]["barcodeUrl"]=baseUrl+"/mac/code/auth?type=1¶m="+res.data[i].orderNo+ ";"+res.data[i].matnr+";"+res.data[i].batch; } else { res.data[i]["barcodeUrl"]=baseUrl+"/mac/code/auth?type=2¶m="+res.data[i].orderNo+ ";"+res.data[i].matnr+";"+res.data[i].batch; } } var tpl = templateDom.html(); var template = Handlebars.compile(tpl); var html = template(res); var box = $("#box"); box.html(html);box.show(); box.print({mediaPrint:true}); box.hide(); } else if (res.code === 403){ top.location.href = baseUrl+"/"; }else { layer.msg(res.msg) } } }) } // 工具条点击事件 table.on('tool(order)', function (obj) { var data = obj.data; var layEvent = obj.event; if (layEvent === 'edit') { showEditModel(data); } else if (layEvent === 'del') { doDel(data.id); }else if (layEvent === 'btnPrint') { btnPrint(data.id, data.orderNo, 4); } else if (layEvent === 'complete') { doModify(data.id, data.orderNo, 4); } else if (layEvent === 'look') { src/main/webapp/views/order/order.html
@@ -84,6 +84,7 @@ </div> </div> </div> <div id="box" style="display: block"></div> <!-- 表格操作列 --> <script type="text/html" id="operate"> {{# if (d.settle == 0 || d.settle == 1) { }} @@ -93,6 +94,7 @@ {{# if (d.settle == 2) { }} <a class="layui-btn layui-btn-primary layui-border-blue layui-btn-xs btn-complete" lay-event="complete">完结</a> {{# } }} <a class="layui-btn layui-btn-primary layui-border-blue layui-btn-xs btn-complete" lay-event="btnPrint">打印</a> </script> <!-- 表格操作列 --> <script type="text/html" id="tbLook"> @@ -186,6 +188,7 @@ <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script> <script type="text/javascript" src="../../static/js/handlebars/handlebars-v4.5.3.js"></script> <script type="text/javascript" src="../../static/js/jquery/jQuery.print.js"></script> <script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script> <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script> <script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script> @@ -197,6 +200,50 @@ <option value="{{docId}}">{{docName}}</option> {{/each}} </script> <script type="text/template" id="templatePreview3" class="template-qrcode"> {{#each data}} <table class="contain" width="280" style="overflow: hidden;font-size: xx-small;table-layout: fixed;"> <thead></thead> <tbody style="font-weight: bold"> <tr style="height: 30px;"> <td align="center" scope="col" colspan="1">商品</td> <td align="lift" colspan="4" style="padding-left: 8px;overflow:hidden; white-space:nowrap; text-overflow:ellipsis;">{{this.maktx}}</td> <td align="center" scope="col" colspan="3" rowspan="3"> <img class="template-code template-qrcode" src="{{this.barcodeUrl}}" width="80%"> </td> </tr> <tr style="height: 30px"> <td align="center" scope="col" colspan="1">料号</td> <!-- overflow:hidden; 溢出隐藏 white-space:nowrap; text-overflow:ellipsis;--> <!-- word-break : break-all; 超出自动换行--> <td align="lift" colspan="4" style="padding-left: 8px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis;">{{this.matnr}}</td> </tr> <tr style="height: 30px"> <td align="center" scope="col" colspan="1">日期</td> <td align="lift" colspan="4" style="padding-left: 8px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis;">{{this.createTime$}}</td> </tr> <tr style="height: 30px"> <td align="center" scope="col" colspan="1">牌号</td> <td align="lift" colspan="3" style="padding-left: 8px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis;">{{this.brand}}</td> <td align="center" scope="col" colspan="1">批号</td> <td align="lift" colspan="3" style="padding-left: 8px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis;">{{this.batch}}</td> </tr> <tr style="height: 30px"> <td align="center" scope="col" colspan="1">数量</td> <td align="lift" colspan="3" style="padding-left: 8px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis;">{{this.anfme}}</td> <td align="center" scope="col" colspan="1">状态</td> <td align="lift" colspan="3" style="padding-left: 8px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis;">{{this.status$}}</td> </tr> </tbody> </table> <div style="height: 20px"> </div> {{/each}} </script> </body> </html>