| | |
| | | // 点击打印,系统判断是否已经执行完成,如果已经完成,直接打印,如果未完成则先执行完成 |
| | | function printBill() { |
| | | if (!recordData) { |
| | | layer.alert("没有获取到业务数据,不支持打印!"); |
| | | alertError("没有获取到业务数据,打印被拒绝!"); |
| | | return; |
| | | } |
| | | // 从后台获取模版并打印 |
| | |
| | | // 合并更新當前编辑数据 |
| | | Object.assign(recordData, data); |
| | | |
| | | printBillStep2(); |
| | | } |
| | | |
| | | // 点击打印,先执行系统默认执行完成卡回收 |
| | | function printBillStep2() { |
| | | var index = layer.load(); |
| | | $.ajax({ |
| | | type: "POST", |
| | | url: "../../basic/inout-report/inout-bill-weight", |
| | | url: "../../basic/inout/report/bill-weight", |
| | | dataType: "json", |
| | | contentType: "application/json;charset=UTF-8", |
| | | data: JSON.stringify(recordData), |
| | | success: function (result) { |
| | | layer.close(index); |
| | | if (result.code != "0000") { |
| | | layer.msg(result.msg); |
| | | alertError(result.msg); |
| | | } else { |
| | | layer.msg("开始渲染打印单……"); |
| | | if (companyId && companyId == "5016") { |
| | | print5016Weight(result.data); |
| | | } else { |
| | | printWeight(result.data); |
| | | } |
| | | printWeight(result.data); |
| | | } |
| | | }, |
| | | error: function () { |
| | | layer.close(index); |
| | | layer.msg("获取打印模版失败,请联系管理员查看原因!!"); |
| | | alertError("获取打印模版失败,请联系管理员查看原因"); |
| | | } |
| | | }); |
| | | } |
| | |
| | | form.render(); |
| | | recordData = null; |
| | | weightDto.weight = 0.0; |
| | | |
| | | $("#weightValue").text("0.0"); |
| | | $("#img_scale_statule").attr("src", "../../static/images/icon-red.png"); |
| | | |
| | | //称重可以复用 |
| | | $("#btn-weight").removeClass("layui-btn-disabled"); |
| | | $("#btn-weight").attr("disabled", false); |
| | | } |
| | | |
| | | function flushPage() { |
| | | layer.confirm('确定要刷新页面吗?', {icon: 3, title: '提示'}, function (index) { |
| | | resetForm(); |
| | | layer.msg("页面重置完成,请重新操作……"); |
| | | layer.close(index); |
| | | }); |
| | | } |
| | |
| | | |
| | | // 当前完成 |
| | | function submit() { |
| | | if (null == recordData) { |
| | | notify("没有数据可以提交", null); |
| | | if (!recordData) { |
| | | alertError("没有业务数据信息,执行被拒绝"); |
| | | return; |
| | | } |
| | | var data = form.val("form-data"); |
| | | |
| | | if (!data.depotId) { |
| | | notify("装卸仓库必须填写", null); |
| | | alertError("提示:装卸仓库必填"); |
| | | return; |
| | | } |
| | | if (!data.customerName) { |
| | | alertError("提示:客户名称必填"); |
| | | return; |
| | | } |
| | | |
| | | // 校验-入库满车称重 |
| | | if (InoutProgress.WEIGHT_FULL == recordData.progress) { |
| | | if (data.fullWeight <= 0.0) { |
| | | notify("满车称重信息必填!!", null); |
| | | return; |
| | | } |
| | | if (!data.customerName) { |
| | | notify("客户名称必填!!", null); |
| | | return; |
| | | } |
| | | } else { |
| | | if (data.emptyWeight <= 0.0) { |
| | | notify("空车称重信息必填!!", null); |
| | | return; |
| | | } |
| | | if (!data.foodVariety) { |
| | | notify("粮食品种必填!!", null); |
| | | return; |
| | | } |
| | | if (!data.settleWeight || data.settleWeight <= 0.0) { |
| | | notify("结算重量合规,请核对!!", null); |
| | | alertError("提示:满车称重信息必填"); |
| | | return; |
| | | } |
| | | } |
| | | // 合并更新當前编辑数据 |
| | | if (InoutProgress.WEIGHT_EMPTY == recordData.progress) { |
| | | if (data.emptyWeight <= 0.0) { |
| | | alertError("提示:空车称重信息必填"); |
| | | return; |
| | | } |
| | | if (!data.foodVariety) { |
| | | alertError("提示:粮食品种必填"); |
| | | return; |
| | | } |
| | | |
| | | if (!data.settleWeight || data.settleWeight <= 0.0) { |
| | | alertError("结算重量不合规,请核对"); |
| | | return; |
| | | } |
| | | if (!data.recordWeight || data.recordWeight <= 0.0) { |
| | | alertError("入库重量不合规,请核对"); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | //合并数据 |
| | | Object.assign(recordData, data); |
| | | |
| | | // 获取照片 |
| | |
| | | var index = layer.load(); |
| | | $.ajax({ |
| | | type: "POST", |
| | | url: "../../basic/inout/inout-next-step", |
| | | url: "../../basic/inout/submit-weight", |
| | | dataType: "json", |
| | | contentType: "application/json;charset=UTF-8", |
| | | data: JSON.stringify(recordData), |
| | |
| | | }, |
| | | error: function () { |
| | | layer.close(index); |
| | | notify("提交失败,请重新尝试", null); |
| | | alertError("提交失败,请重新尝试"); |
| | | } |
| | | }); |
| | | |
| | | //以下逻辑为增加一个语音通知的调用方法,不考虑返回结果--后台调用 |
| | | var curWeight = recordData.fullWeight; |
| | | if (InoutProgress.WEIGHT_EMPTY == recordData.progress) { |
| | | curWeight = recordData.emptyWeight; |
| | | } |
| | | var param = { |
| | | sort: $("#scaleName").val(), |
| | | weight: curWeight, |
| | | inoutProgress: recordData.progress, |
| | | deptId: recordData.deptId, |
| | | companyId: recordData.companyId, |
| | | plateNum: recordData.plateNum |
| | | }; |
| | | $.ajax({ |
| | | type: "POST", |
| | | url: "../../inout/api/notice-weight-done", |
| | | dataType: "json", |
| | | contentType: "application/json;charset=UTF-8", |
| | | data: JSON.stringify(param) |
| | | }); |
| | | } |
| | | |