| | |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.TrayCode; |
| | | import com.zy.asrs.entity.param.TrayCodeParam; |
| | | import com.zy.asrs.service.TrayCodeService; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/trayCode/list/auth") |
| | | @ManagerAuth |
| | | // @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | |
| | | } |
| | | |
| | | @PostMapping(value = "/trayCode/print/preview") |
| | | @ManagerAuth |
| | | public R printPreview(@RequestParam TrayCodeParam param) { |
| | | if (param.getCount() <= 0) { |
| | | // @ManagerAuth |
| | | public R printPreview(@RequestParam String startNo, |
| | | @RequestParam Integer count, |
| | | @RequestParam Integer type) { |
| | | if (count <= 0) { |
| | | return R.error("数量必须大于零"); |
| | | } |
| | | List<Map<String, Object>> res = new ArrayList<>(); |
| | | for (int i = 0; i<param.getCount(); i++) { |
| | | res.add(Cools.add("item", String.valueOf(Integer.parseInt(param.getStartNo())+i))); |
| | | for (int i = 0; i<count; i++) { |
| | | res.add(Cools.add("item", String.valueOf(Integer.parseInt(startNo)+i))); |
| | | } |
| | | return R.ok().add(res); |
| | | } |
| | | |
| | | @RequestMapping(value = "/trayCode/print/auth") |
| | | @ManagerAuth(memo = "托盘码打印") |
| | | // @ManagerAuth(memo = "托盘码打印") |
| | | public R print(@RequestParam String startNo, |
| | | @RequestParam Integer count, |
| | | @RequestParam Integer type){ |
| | |
| | | layer.open({ |
| | | type: 1, |
| | | title: '生成托盘码', |
| | | offset: '100px', |
| | | area: ['360px'], |
| | | shade: 0.1, |
| | | // offset: '100px', |
| | | // area: ['360px'], |
| | | // shade: 0.1, |
| | | content: $('#print-windows'), |
| | | success: function(layero, index){ |
| | | layer.iframeAuto(index) |
| | | }, |
| | | end: function () { |
| | | } |
| | | }); |
| | | break; |
| | | case 'exportData': |
| | |
| | | }); |
| | | |
| | | form.on('submit(print)', function (data) { |
| | | // $.ajax({ |
| | | // url: baseUrl+"/trayCode/print/preview", |
| | | // headers: {'token': localStorage.getItem('token')}, |
| | | // data: { |
| | | // startNo: $('#startNo'), |
| | | // count: $('#count'), |
| | | // type: $("input[name='type']:checked").val() |
| | | // }, |
| | | // method: 'POST', |
| | | // async: false, |
| | | // success: function (res) { |
| | | // if (res.code === 200){ |
| | | // for (let i=0;i<res.data.length;i++){ |
| | | // res.data[i]["barcodeUrl"]=baseUrl+"/macCode/code/auth?type=1¶m="+res.data[i].item; |
| | | // } |
| | | // var tpl = $('#trayCodeTemplate').html(); |
| | | // var template = Handlebars.compile(tpl); |
| | | // var html = template(res); |
| | | // let box = $("#printBox"); |
| | | // // box.html(html); |
| | | // // box.show(); |
| | | // // box.print(); |
| | | // // box.hide(); |
| | | // // parent.layer.close(parent.layer.getFrameIndex(window.name)); |
| | | // } else if (res.code === 403){ |
| | | // top.location.href = baseUrl+"/"; |
| | | // }else { |
| | | // layer.msg(res.msg) |
| | | // } |
| | | // } |
| | | // }) |
| | | $.ajax({ |
| | | url: baseUrl+"/trayCode/print/preview", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: data.field, |
| | | method: 'POST', |
| | | async: false, |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | for (let i=0;i<res.data.length;i++){ |
| | | res.data[i]["barcodeUrl"]=baseUrl+"/macCode/code/auth?type=1¶m="+res.data[i].item; |
| | | } |
| | | var tpl = $('#trayCodeTemplate').html(); |
| | | var template = Handlebars.compile(tpl); |
| | | var html = template(res); |
| | | let box = $("#printBox"); |
| | | box.html(html); |
| | | box.show(); |
| | | box.print(); |
| | | box.hide(); |
| | | layer.closeAll(); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | }else { |
| | | layer.msg(res.msg) |
| | | } |
| | | } |
| | | }) |
| | | }); |
| | | |
| | | |
| | | $('#cancel').click(function () { |
| | | layer.closeAll(); |
| | | }) |
| | | }); |
| | | |
| | | |
| | | $('#print').click(function () { |
| | | |
| | | }); |
| | | |
| | | $('#cancel').click(function () { |
| | | // layer.close(layer.getFrameIndex(window.name)); |
| | | }) |
| | | |
| | | // 关闭动作 |
| | | $(document).on('click','#data-detail-close', function () { |
| | |
| | | <link rel="stylesheet" href="../../static/css/cool.css" media="all"> |
| | | <link rel="stylesheet" href="../../static/css/common.css" media="all"> |
| | | <link rel="stylesheet" href="../../static/css/print.css" media="all"> |
| | | <link rel="stylesheet" href="../../static/css/optimize.css" media="all"> |
| | | <style> |
| | | #print-windows .layui-form { |
| | | padding: 25px 30px 0 0; |
| | | } |
| | | #print-windows .layui-form-label { |
| | | padding: 8px 15px; |
| | | box-sizing: content-box; |
| | | -webkit-box-sizing: content-box; |
| | | } |
| | | #print-windows .layui-form-required:before { |
| | | content: "*"; |
| | | display: inline-block; |
| | | font-family: SimSun,serif; |
| | | margin-right: 4px; |
| | | font-size: 14px; |
| | | line-height: 1; |
| | | color: #ed4014; |
| | | } |
| | | #print-windows .layui-input { |
| | | height: 36px; |
| | | border-radius: 4px; |
| | | } |
| | | #print-windows .cool-button-contain { |
| | | text-align: right; |
| | | margin: 20px 0; |
| | | } |
| | | #print-windows .layui-form-radio>i:hover, .layui-form-radioed>i { |
| | | color: #007bff; |
| | | } |
| | | #print-windows .layui-btn { |
| | | height: 36px; |
| | | line-height: 36px; |
| | | border-radius: 4px; |
| | | box-shadow: 0 1px 0 rgba(0,0,0,.03); |
| | | } |
| | | #print-windows .layui-btn-primary:hover { |
| | | border-color: #777777; |
| | | } |
| | | </style> |
| | | </head> |
| | | <body> |
| | | |
| | |
| | | <iframe id="detail-iframe" scrolling="auto" style="display:none;"></iframe> |
| | | |
| | | <div id="print-windows" style="display: none"> |
| | | <form class="layui-form" > |
| | | <div class="layui-form"> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label layui-form-required">起始序列:</label> |
| | | <div class="layui-input-block"> |
| | |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item cool-button-contain"> |
| | | <button class="layui-btn layui-btn-normal" id="print" >打印</button> |
| | | <button class="layui-btn layui-btn-normal" id="print" lay-filter="print" lay-submit="">打印</button> |
| | | <button class="layui-btn layui-btn-primary" id="cancel">取消</button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | </div> |
| | | |
| | | </body> |