| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- $('#lager').click(function () {
- $('#iframe1').contentWindow.location.reload('lager.html');
- });
- Controller.api.bindevent();
- },
- // lager: function () {
- // // 初始化表格参数配置
- // Table.api.init({
- // extend: {
- // index_url: 'deliver/lager', // 替换为你的后端接口地址
- // }
- // });
- //
- // var table = $("#table");
- //
- // // 初始化表格
- // table.bootstrapTable({
- // url: $.fn.bootstrapTable.defaults.extend.index_url,
- // toolbar: '#toolbar', // 工具栏选择器(如果有)
- // pk: 'id', // 主键字段
- // sortName: 'id', // 默认排序字段
- //
- // pagination: true, // 启用分页
- // sidePagination: 'server', // 服务器端分页
- // pageSize: 10, // 每页数量
- // pageList: [10, 25, 50, 100], // 可选页数
- // search: false, // 是否启用搜索
- // commonSearch: true, // 是否启用 FastAdmin 搜索栏
- // queryParams: function (params) {
- // return {
- // offset: params.offset,
- // limit: params.limit,
- // filter: JSON.stringify(params.filter), // 搜索条件
- // op: JSON.stringify(params.op) // 搜索操作符
- // };
- // },
- //
- // columns: [
- // {field: 'bach', title: '工单号'},
- // {field: 'tray_num', title: '托盘号'},
- // {field: 'matter_name', title: '物料名称'},
- // {field: 'bach', title: '批次号'},
- // {field: 'total_boxes', title: '每托箱数'},
- // {field: 'tray_num', title: '每层箱数'},
- // {field: 'box_num', title: '每托层数'},
- // {field: 'pallet_height', title: '每托高度'},
- // {field: 'larger_num', title: '总箱数'},
- // {field: 'manufacture_date', title: '生产日期'},
- // {field: 'code', title: '大件编码'},
- // // 添加更多字段...
- // ]
- // });
- //
- // // 绑定事件
- // Table.api.bindevent(table);
- // },
- lager: function () {
- // 初始化表格参数配置
- Table.api.init();
- this.table.first();
- this.table.second();
- Controller.api.bindevent();
- },
- table:{
- first:function (){
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: 'deliver/lager', // 请求的 URL
- pk: 'id', // 主键字段
- height: 700, // 表格的高度
- sortName: 'id', // 默认排序字段
- sortOrder: 'desc', // 默认排序顺序
- pageSize: 50, // 每页显示 10 条数据
- pageList: [10, 25, 50, 100,'ALL'], // 分页条数选择器
- searchFormVisible: true, // 是否显示搜索框
- onClickRow:function(row, $element, field)
- {
- // 点击行事件
- $("#myTabContent1 .form-commonsearch input[name='large_id']").val(row.id);
- $("#myTabContent1 .btn-refresh").trigger("click");
- },
- search: false, // 禁用默认搜索框
- showToggle: false, // 隐藏切换按钮
- showColumns: false, // 隐藏列选择按钮
- showExport: false, // 隐藏导出按钮
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: 'ID', visible:false,operate: false},
- {field: 'bach', title: __('批次号'),operate: "LIKE"},
- {field: 'l_flow', title: __('托盘号'), operate: false},
- {field: 'matter_name', title: __('产品名称'), operate: 'LIKE',searchList: $.getJSON("deliver/matterName")},
- {field: 'total_boxes', title: "每托箱数", operate: false},
- {field: 'tray_num', title: "每层箱数", operate: false},
- {field: 'box_num', title: "每托层数", operate: false},
- {field: 'pallet_height', title: "每托高度", operate: false},
- {
- field: 'pallet_size',
- title: '托盘规格',
- operate: false,
- width: 120,
- formatter: function (value, row, index) {
- return row.pallet_length + ' * ' + row.pallet_width;
- }
- },
- // {field: 'small_num', title: "托盘数", operate: false},
- {field: 'larger_num', title: "总箱数", operate: false},
- {field: 'manufacture_date', title: '生产日期', operate: 'RANGE', addclass: 'datetimerange',datetimeFormat:'YYYY-MM-DD', formatter: Table.api.formatter.datetime},
- {field: 'code', title: __('大件编码'), operate: false},
- // {field: 'small_num', title: __('小件数'),operate: false},
- ]
- ]
- });
- // 监听复选框点击事件
- $('#table').on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table', function(e, rows) {
- var selectedData = table.bootstrapTable('getSelections'); // 获取选中的数据
- // 计算选中的大件数量和小件数量
- // 大件数量(选中的行数)
- var largeItemCount = selectedData.length;
- var smallItemCount = selectedData.reduce(function(total, row) {
- // 累加每个选中项的 small_num
- return total + (row.small_num || 0);
- }, 0);
- // 更新页面上的提示信息
- $('p span').eq(1).text(largeItemCount); // 更新大件数量
- $('p span').eq(3).text(smallItemCount); // 更新小件数量
- });
- //导出发货按钮
- $('.btn-print').on('click',function () {
- var ids = Table.api.selectedids(table);
- if (ids.length === 0){
- alert('至少选择一个大件');
- }
- var lager = ids.toString();
- // window.location.href = 'print?lager_id='+lager;
- Fast.api.ajax({
- url:'deliver/print',
- data:{lager_id:lager},
- },function (data,res) {
- if (res.code == 1){
- window.location.href = '/'+res.data;
- table.bootstrapTable('refresh');
- }
- return false;
- },function (data,res) {
- if (res.code == 0){
- layer.confirm(res.msg);
- }
- return false;
- })
- })
- // 为表格绑定事件
- Table.api.bindevent(table);
- //去掉时间区间记忆
- table.on('post-body.bs.table',function (e,settings,json,xhr) {
- $('.datetimerange').each(function () {
- $(this).attr('autocomplete','off');
- })
- });
- }, second:function(){
- //小件列表
- var smallTable = $('#small_table');
- smallTable.bootstrapTable({
- url:'deliver/smallList',
- height: 600,
- toolbar: '#toolbar1',
- search:false,
- // commonSearch:false,
- showToggle:false,
- showColumns:false,
- showExport:false,
- columns: [
- [
- {field: 'large_id',title: __('大件id'),operate: 'LIKE',visible:false},
- {field: 'code', title: __('小件标签代码'),operate: false},
- {field: 'l_flow', title: __('当前序号'),operate: false},
- {field: 'print_num', title: __('打印次数'),operate: false},
- {field: 'status', title: __('状态'),searchList: {"0":'正常',"1":'已删除'},operate: false,formatter: Table.api.formatter.status},
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(smallTable);
- }
- },
- apply: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'deliver/apply' + location.search,
- goods_url: 'deliver/goods',
- del_url:'deliver/apply_del',
- table:'deliver'
- }
- });
- var table = $("#table2");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- height:400,
- sortName: 'id',
- searchFormVisible:true,
- search:false,
- showToggle:false,
- showColumns:false,
- showExport:false,
- fixedColumns: true,
- fixedRightNumber: 1,
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: __('Id'),visible:false,operate: false},
- {field: 'large_num', title: '托盘数量', operate: false},
- {field: 'matter_name', title: '产品名称', operate: 'LIKE',searchList: $.getJSON("deliver/matterName")},
- {field: 'total_boxes', title: '每箱托数', operate: false},
- {field: 'tray_num', title: '每层箱数', operate: false},
- {field: 'box_num', title: '每托层数', operate: false},
- {field: 'pallet_height', title: '托盘高度', operate: false},
- {
- field: 'pallet_size',
- title: '托盘规格',
- operate: false,
- width: 120,
- formatter: function (value, row, index) {
- return row.pallet_length + ' * ' + row.pallet_width;
- }
- },
- // {field: 'small_num', title: '总箱数', operate: false},
- {field: 'larger_num', title: '总箱数', operate: false},
- // {field: 'matter_no', title: '产品编码', operate: false},
- {field: 'username', title: '所属用户', operate: 'LIKE'},
- // {field: 'large_num', title: '大件数量', operate: false},
- // {field: 'small_num', title: '小件数量', operate: false},
- {field: 'create_time', title: '创建时间', operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.datetime},
- {field: 'file_dir', title: '下载路径', operate: false,formatter: function (value,row,index) {
- if (row.status == 0){
- return "<a href=/"+value+">点击下载</a>";
- }else {
- return "不支持下载";
- }
- }},
- {field: 'status', title: '状态', operate: 'LIKE',searchList: {"0":'待发货',"1":'已删除'}, formatter: Table.api.formatter.status},
- {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
- ]
- ],
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- //发货按钮
- $('.btn-goods').on('click',function () {
- var ids = Table.api.selectedids(table);
- if (ids.length === 0){
- alert('至少选择一个订单');
- }
- var id_str = ids.toString();
- Fast.api.open('deliver/goods?ids='+id_str,'发货信息',{area:["60%","60%"]})
- });
- //去掉时间区间输入记忆
- table.on('post-body.bs.table',function (e,settings,json,xhr) {
- $('.datetimerange').each(function () {
- $(this).attr('autocomplete','off');
- })
- });
- Controller.api.bindevent();
- },
- goods: function () {
- $('#apply_btn').click(function () {
- var ids = $('#goods_id').val();
- var order_number = $('#c-order_number').val();
- if (order_number == null || order_number === ''){
- layer.confirm('订单号不能为空');
- }
- var deliveryman = $('#c-deliveryman').val();
- if (deliveryman == null || deliveryman === ''){
- layer.confirm('司机名称不能为空');
- }
- var shr_phone = $('#c-shr_phone').val();
- if (shr_phone == null || shr_phone === ''){
- layer.confirm('手机号不能为空');
- }
- var plate_number = $('#c-plate_number').val();
- if (plate_number == null || plate_number === ''){
- layer.confirm('车牌号不能为空');
- }
- var note = $('#c-note').val();
- Fast.api.ajax({
- url:'deliver/apply_add',
- data:{
- ids:ids,
- order_number:order_number,
- deliveryman:deliveryman,
- shr_phone:shr_phone,
- plate_number:plate_number,
- note:note,
- }
- },function (data,res) {
- parent.Toastr.success("成功");
- Fast.api.close();
- window.parent.location.reload();
- return false;
- },function (data) {
- parent.Toastr.error('失败');
- Fast.api.close();
- window.parent.location.reload();
- return false;
- })
- });
- Controller.api.bindevent();
- },
- dispatch: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'deliver/dispatch' + location.search,
- del_url:'deliver/dispatch_del',
- table:'deliver'
- }
- });
- var table = $("#table3");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- height:400,
- sortName: 'id',
- searchFormVisible:true,
- showToggle:false,
- showColumns:false,
- showExport:false,
- fixedColumns: true,
- fixedRightNumber: 1,
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: __('Id'),visible:false,operate: false},
- {field: 'shdh', title: '收货单号', operate: false},
- {field: 'order_number', title: '订单号', operate: 'LIKE'},
- {field: 'deliveryman', title: '司机', operate: false},
- {field: 'plate_number', title: '车牌号', operate: false},
- {field: 'supplier_name', title: '供应商名称', operate: 'LIKE'},
- {field: 'create_time', title: '发货时间', operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.datetime},
- {field: 'buttons',
- width: "120px",
- title: __('发货单打印'),
- operate: false,
- table: table,
- events: Table.api.events.operate,
- buttons: [
- {
- name: 'ajax',
- text: __('点击打印'),
- title: __('点击打印'),
- classname: 'btn btn-xs btn-success btn-magic btn-ajax',
- icon: 'fa fa-magic',
- url: 'deliver/printqrcode/id/{ids}',
- success: function (data, res) {
- if (res.code === 1) {
- const arr = res.data.data;
- let totalTray = 0;
- let totalBox = 0;
- const productNames = [];
- const productQuantities = [];
- // 遍历数据,统计数量
- for (let i = 0; i < arr.length; i++) {
- totalTray += parseInt(arr[i].large_num || 0);
- totalBox += parseInt(arr[i].larger_num || 0);
- productNames.push(arr[i].matter_name);
- productQuantities.push(arr[i].total_boxes * arr[i].larger_num);
- }
- // 根据出货数量计算手工盒子数量
- const manualBoxes = productQuantities.reduce((total, qty) => total + qty, 0);
- // 纸质卡片数量可按业务设定(例:每托2张)
- const paperCards = totalTray * totalBox;
- let html = `
- <div style="width: 1100px; height: 100px; position: relative;">
- <div style="float: left">
- <div style="width: 1000px; font-size: 28px; font-weight: bold; text-align: center; line-height: 50px;">${res.data.supplier_name}</div>
- <div style="width: 1000px; font-size: 24px; text-align: center; line-height: 50px;">送货单</div>
- </div>
- <div id="qrcode" style="position: absolute; right: 100px; top: -5px; width: 105px; height: 105px;">
- <img src="${res.data.qrcode_add}" style="width: 105px; height: 105px;" id="qrcode_image"/>
- </div>
- </div>
-
- <table style="margin-bottom: 10px; width: 1186px; font-weight: 500; border-collapse: collapse;">
- <tr>
- <td colspan="6" style="border: none;">客户名称:河南中烟工业有限责任公司黄金叶生产制造中心</td>
- <td colspan="4" style="border: none;">送货单号:<span id="shdh">${res.data.shdh}</span></td>
- </tr>
- <tr>
- <td colspan="6" style="border: none;">送货地址:河南省郑州市经开区第三大街9号</td>
- <td colspan="4" style="border: none;">送货日期:<span id="shrq_date">${res.data.shrq_date}</span></td>
- </tr>
- </table>
-
- <div style="width: 1070px; font-size: 20px; text-align: center; border: 1px solid black; border-bottom: none;">
- ${res.data.order_ddbh || ''}${res.data.note || ''}
- </div>
-
- <table style="width: 1070px; border-collapse: collapse; table-layout: fixed; font-size: 16px; text-align: center; margin-top: 0;">
- <tr style="font-weight: bold;">
- <th style="border: 1px solid black;text-align: center;">托盘序号</th>
- <th style="border: 1px solid black;text-align: center; width: 360px;">产品名称</th>
- <th style="border: 1px solid black;text-align: center;">每托箱数</th>
- <th style="border: 1px solid black;text-align: center;">每层箱数</th>
- <th style="border: 1px solid black;text-align: center;">每托层数</th>
- <th style="border: 1px solid black;text-align: center;">每托高度</th>
- <th style="border: 1px solid black;text-align: center;">托盘规格</th>
- <th style="border: 1px solid black;text-align: center;">托盘数</th>
- <th style="border: 1px solid black;text-align: center;">总箱数</th>
- </tr>
- `;
- for (let i = 0; i < arr.length; i++) {
- html += `
- <tr>
- <td style="border: 1px solid black;">第${arr[i].large_ber}托</td>
- <td style="border: 1px solid black;">${arr[i].matter_name}</td>
- <td style="border: 1px solid black;">${arr[i].total_boxes}</td>
- <td style="border: 1px solid black;">${arr[i].tray_num}</td>
- <td style="border: 1px solid black;">${arr[i].box_num}</td>
- <td style="border: 1px solid black;">${arr[i].pallet_height}</td>
- <td style="border: 1px solid black;">${arr[i].pallet_length} * ${arr[i].pallet_width}</td>
- <td style="border: 1px solid black;">${arr[i].large_num}</td>
- <td style="border: 1px solid black;">${arr[i].larger_num}</td>
- </tr>
- `;
- }
- const fillCount = 15 - arr.length;
- for (let i = 0; i < fillCount; i++) {
- html += `
- <tr>
- <td style="border: 1px solid black;"> </td>
- <td style="border: 1px solid black;"></td>
- <td style="border: 1px solid black;"></td>
- <td style="border: 1px solid black;"></td>
- <td style="border: 1px solid black;"></td>
- <td style="border: 1px solid black;"></td>
- <td style="border: 1px solid black;"></td>
- <td style="border: 1px solid black;"></td>
- <td style="border: 1px solid black;"></td>
- </tr>
- `;
- }
- html += `
- <tr style="font-weight: bold;">
- <td style="border: 1px solid black;">合计:</td>
- <td style="border: 1px solid black;"></td>
- <td style="border: 1px solid black;"></td>
- <td style="border: 1px solid black;"></td>
- <td style="border: 1px solid black;"></td>
- <td style="border: 1px solid black;"></td>
- <td style="border: 1px solid black;"></td>
- <td style="border: 1px solid black;">${totalTray}</td>
- <td style="border: 1px solid black;">${totalBox}</td>
- </tr>
- </table>
-
- <table style="margin-top: 20px; width: 1070px; border-collapse: collapse; font-size: 18px;">
- <tr>
- <td colspan="${productNames.length + 2}" style="border: 1px solid black; text-align: left;">
- 总共出货:${totalBox} 箱 = ${totalTray} 托(手工盒子:${manualBoxes} 套,纸质卡片:${paperCards} 张)
- </td>
- </tr>
- <tr>
- <td style="border: 1px solid black; text-align: center;">产品名称</td>
- ${productNames.map(name => `<td style="border: 1px solid black; text-align: center;">${name}</td>`).join('')}
- <td style="border: 1px solid black; text-align: center;">合计</td>
- </tr>
- <tr>
- <td style="border: 1px solid black; text-align: center;">出货数量</td>
- ${productQuantities.map(qty => `<td style="border: 1px solid black; text-align: center;">${qty}</td>`).join('')}
- <td style="border: 1px solid black; text-align: center;">${manualBoxes}</td>
- </tr>
- </table>
-
- <div style="margin-top: 20px; font-size: 14px; font-weight: bold; border: 1px solid black; padding: 10px; text-align: left; width: 1070px;">
- 共 ${totalTray} 托
- <br/>
- 备注:
- <br/>(1) 用唛头笔写上托盘序号,托盘唛头打印贴在每托盘上面,打托的时候混托注意摆放和高度,另外不要漏掉了。
- <br/>(2) 每托烟盒中间放瓦楞,最上面盖个木板,缠绕膜缠结实,护角护好,打打包带,井子形打包
- <br/>(3) 配托后,请提供具体托盘高度及托盘重量。
- </div>
- `;
- $("#printcode").html(html);
- var ee = $('#qrcode_image').attr('src',res.data.qrcode_add);
- // 将打印的区域赋值,进行打印
- ee.on('load',function () {
- var printHTML = document.querySelector('#printcode').innerHTML;
- window.document.body.innerHTML = printHTML;
- window.print();
- window.location.reload(); // 打印完成后重新加载页面
- })
- // const printHTML = document.querySelector('#printcode').innerHTML;
- // document.body.innerHTML = printHTML;
- // window.print();
- // window.location.reload();
- }
- return false;
- },
- error: function (data, ret) {
- return false;
- }
- },
- ],
- formatter: Table.api.formatter.buttons
- },
- {field: 'status', title: '状态', operate: 'LIKE',searchList: {"0":'已发货',"1":'已删除'}, formatter: Table.api.formatter.status},
- {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
- ]
- ],
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- //去掉时间区间输入记忆
- table.on('post-body.bs.table',function (e,settings,json,xhr) {
- $('.datetimerange').each(function () {
- $(this).attr('autocomplete','off');
- })
- });
- Controller.api.bindevent();
- },
- receive: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'deliver/receive' + location.search,
- del_url:'deliver/receive_del',
- table:'deliver'
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- height:500,
- sortName: 'id',
- searchFormVisible:true,
- showToggle:false,
- showColumns:false,
- showExport:false,
- fixedColumns: true,
- fixedRightNumber: 1,
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: __('Id'),visible:false,operate: false},
- {field: 'shdh', title: '送货单号', operate: false},
- {field: 'order_number', title: '订单号', operate: 'LIKE'},
- {field: 'deliveryman', title: '司机', operate: false},
- {field: 'plate_number', title: '车牌号', operate: false},
- {field: 'supplier_name', title: '供应商名称', operate: 'LIKE'},
- {field: 'create_time', title: '发货时间', operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.datetime},
- {field: 'buttons', operate: false,
- width: "120px",
- title: __('发货单打印'),
- table: table,
- events: Table.api.events.operate,
- buttons: [
- {
- name: 'ajax',
- text: __('点击打印'),
- title: __('点击打印'),
- classname: 'btn btn-xs btn-success btn-magic btn-ajax',
- icon: 'fa fa-magic',
- url: 'deliver/printqrcode/id/{ids}',
- // confirm: '确认发送',
- success: function (data,res) {
- if (res.code === 1){
- var arr = res.data.data;
- var note='';
- var html = '<div style="width: 1100px;height: 100px;position: relative;">\n' +
- ' <div style="float: left">\n' +
- ' <div style="width: 1000px;font-weight: 400;font-size: 28px;text-align: center;line-height: 50px;" class="company">'+res.data.supplier_name+'</div>\n' +
- ' <div style="width: 1000px;font-weight: 400;font-size: 24px;text-align: center;line-height: 50px;">送货单</div>\n' +
- ' </div>\n' +
- ' <div id="qrcode" style="display:inline-block;width: 105px;height: 105px;position: absolute;right: 100px;top: -5px;">\n' +
- ' <img src="" style="width: 105px;height: 105px;" id="qrcode_image"/>\n' +
- ' </div>\n' +
- ' </div>\n' +
- ' <table class="tg1" style="margin-top: 3px;border-collapse:collapse;border-spacing:0;font-weight:500;width:1186px">\n' +
- ' <tr class="info">\n' +
- ' <td colspan="6" style="border:none">客户名称:河南中烟工业有限责任公司黄金叶生产制造中心</td>\n' +
- ' <td colspan="4" style="border:none">送货单号:<span style="font-size: 16px;" id="shdh">'+res.data.shdh+'</span></td>\n' +
- ' </tr>\n' +
- ' <tr class="info">\n' +
- ' <td colspan="6" style="border:none">送货地址:河南省郑州市经开区第三大街9号</td>\n' +
- ' <td colspan="4" style="border:none">送货日期:<span style="font-size: 16px;" id="shrq_date">'+res.data.shrq_date+'</span></td>\n' +
- ' </tr>\n' +
- ' </table>\n' +
- ' <br>\n' +
- ' <table class="tg1" style="table-layout:fixed;width: 1186px;border-collapse:collapse;border-spacing:0;font-weight:500; position: relative;" id="table">'+
- ' <tr><th class="tg-s6z2" style="font-family:Arial, sans-serif;font-size:20px;text-align:center;font-weight:500;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:black;">物料名称</th>' +
- ' <th class="tg-s6z2" style="font-family:Arial, sans-serif;font-size:20px;text-align:center;font-weight:500;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:black;">生产批号</th>' +
- ' <th class="tg-s6z2" style="font-family:Arial, sans-serif;font-size:20px;text-align:center;font-weight:500;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:black;">大件</th>' +
- ' <th class="tg-s6z2" style="font-family:Arial, sans-serif;font-size:20px;text-align:center;font-weight:500;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:black;">小件</th>' +
- ' <th class="tg-s6z2" style="font-family:Arial, sans-serif;font-size:20px;text-align:center;font-weight:500;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:black;">单位</th>' +
- ' <th class="tg-s6z2" style="font-family:Arial, sans-serif;font-size:20px;text-align:center;font-weight:500;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:black;">实发数量</th>' +
- ' <th class="tg-s6z2" style="font-family:Arial, sans-serif;font-size:20px;text-align:center;font-weight:500;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:black;">备注</th>' +
- ' <th id="explain" rowspan="'+(res.data.count+1)+'" width="7%" style="border: none"><span style="writing-mode: tb-rl;height: 300px;font-size:16px;text-align: center;">' +
- ' 蓝联(回):业务 黄联(回):运输 '+'<br>'+'白联:存根 红联:财务 绿联:客户</span></th></tr>';
- for (var i=0;i < arr.length;i++){
- html+= '<tr><td class="tg-031e" style="font-family:Arial, sans-serif;font-size:18px;text-align:center;border-style:solid;border-width:1px;overflow:hidden;word-break:break-all;border-color:black;">'+arr[i].matter_name+'</td>';
- html+= '<td class="tg-031e" style="font-family:Arial, sans-serif;font-size:18px;text-align:center;border-style:solid;border-width:1px;overflow:hidden;word-break:break-all;border-color:black;">'+(arr[i].bach_num?arr[i].bach_num:'')+'</td>';
- html+= '<td class="tg-031e" style="font-family:Arial, sans-serif;font-size:18px;text-align:center;border-style:solid;border-width:1px;overflow:hidden;word-break:break-all;border-color:black;">'+arr[i].large_num+'</td>';
- html+= '<td class="tg-031e" style="font-family:Arial, sans-serif;font-size:18px;text-align:center;border-style:solid;border-width:1px;overflow:hidden;word-break:break-all;border-color:black;">'+arr[i].small_num+'</td>';
- if(arr[i].mater_type==1){
- html+= '<td class="tg-031e" style="font-family:Arial, sans-serif;font-size:18px;text-align:center;border-style:solid;border-width:1px;overflow:hidden;word-break:break-all;border-color:black;">万张</td>';
- html+='<td class="tg-031e" style="font-family:Arial, sans-serif;font-size:18px;text-align:center;border-style:solid;border-width:1px;overflow:hidden;word-break:break-all;border-color:black;">'+arr[i].l_num+'</td>';
- html+='<td class="tg-031e" style="font-family:Arial, sans-serif;font-size:18px;text-align:center;border-style:solid;border-width:1px;overflow:hidden;word-break:break-all;border-color:black;">'+arr[i].small_num+'件*'+parseInt(arr[i].num)+'张'+'</td>';
- }else if (arr[i].mater_type==2){
- html+= '<td class="tg-031e" style="font-family:Arial, sans-serif;font-size:18px;text-align:center;border-style:solid;border-width:1px;overflow:hidden;word-break:break-all;border-color:black;">kg</td>';
- html+='<td class="tg-031e" style="font-family:Arial, sans-serif;font-size:18px;text-align:center;border-style:solid;border-width:1px;overflow:hidden;word-break:break-all;border-color:black;">'+arr[i].l_weight +'</td>';
- html+='<td class="tg-031e" style="font-family:Arial, sans-serif;font-size:18px;text-align:center;border-style:solid;border-width:1px;overflow:hidden;word-break:break-all;border-color:black;">'+arr[i].small_num+'件*'+parseFloat(arr[i].num)/1000+'kg'+'</td>';
- }else if (arr[i].mater_type==3){
- html+= '<td class="tg-031e" style="font-family:Arial, sans-serif;font-size:18px;text-align:center;border-style:solid;border-width:1px;overflow:hidden;word-break:break-all;border-color:black;">万支</td>';
- html+='<td class="tg-031e" style="font-family:Arial, sans-serif;font-size:18px;text-align:center;border-style:solid;border-width:1px;overflow:hidden;word-break:break-all;border-color:black;">'+parseFloat(arr[i].num)*parseFloat(arr[i].small_num)/10000+'</td>';
- html+='<td class="tg-031e" style="font-family:Arial, sans-serif;font-size:18px;text-align:center;border-style:solid;border-width:1px;overflow:hidden;word-break:break-all;border-color:black;">'+arr[i].small_num+'件*'+parseInt(arr[i].num)+'支'+'</td>';
- }
- }
- html+= '<tr><td class="tg-031e" style="font-family:Arial, sans-serif;font-size:18px;text-align:center;border-style:solid;border-width:1px;overflow:hidden;word-break:break-all;border-color:black;">送货单备注</td>' +
- ' <td colspan="6" class="tg-031e" style="font-family:Arial, sans-serif;font-size:18px;text-align:center;border-style:solid;border-width:1px;overflow:hidden;word-break:break-all;border-color:black;">'+res.data.note+'</td></tr>'+
- ' </table>\n' +
- ' <table class="tg2" style="margin-top: 3px;border-collapse:collapse;border-spacing:0;font-weight:500;width:1086px;font-size: 16px;">\n' +
- ' <tr class="footer">\n' +
- ' <td colspan="3">发货单位:<span class="company">'+res.data.supplier_name+'</span></td>\n' +
- ' <td colspan="3">司机/司机电话:<span id="deliveryman">'+res.data.deliveryman+' '+res.data.shr_phone+'</span></td>\n' +
- ' <td colspan="3">车牌号:<span id="carid">'+res.data.plate_number+'</span></td>\n' +
- ' </tr>\n' +
- ' <tr class="footer">\n' +
- ' <td colspan="7">发货单位地址:<span id="address">'+res.data.address+'</span></td>\n' +
- ' <td colspan="3">收货单位(签名、盖章)</td>\n' +
- ' </tr>\n' +
- ' </table>'
- $("#printcode").html(html)
- var ee = $('#qrcode_image').attr('src',res.data.qrcode_add);
- // 将打印的区域赋值,进行打印
- ee.on('load',function () {
- var printHTML = document.querySelector('#printcode').innerHTML;
- window.document.body.innerHTML = printHTML;
- window.print();
- window.location.reload(); // 打印完成后重新加载页面
- })
- }
- return false;
- },
- error: function (data, ret) {
- return false;
- }
- },
- ],
- formatter: Table.api.formatter.buttons
- },
- {field: 'status', title: '状态', operate: 'LIKE',searchList: {"0":'未收货',"2":'已收货'},defaultValue:'1', formatter: Table.api.formatter.status},
- {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
- ]
- ],
- });
- $('#receive').click(function (){
- var shdh = $('#shdh').val();
- if (shdh!=''){
- $.get('deliver/receive_add',{'shdh':shdh},function (res){
- if (res.code==1){
- //修改成功
- //1. 提示
- Toastr.success(res.msg)
- //2. 刷新页面
- table.bootstrapTable('refresh');
- }else{
- Toastr.error(res.msg)
- }
- })
- }
- })
- // 为表格绑定事件
- Table.api.bindevent(table);
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- }
- }
- };
- return Controller;
- });
|