| | |
| | | var recordData = null;// 业务数据信息 |
| | | var snapData;//系统抓拍对象信息 |
| | | var timerWeight; |
| | | var textParam;//设备识别结果 |
| | | var curProgress;//当前详细流程 |
| | | var paramIntelCard;//设备识别结果 |
| | | var paramIdCard;//设备识别结果 |
| | | |
| | | $(function () { |
| | | layui.use(['layer', 'laydate', 'form', 'table', 'util'], function () { |
| | |
| | | //暂无 |
| | | } |
| | | |
| | | // 根据当前操作的按钮ID更新其他按钮状态 |
| | | function flushBtn(btnId) { |
| | | if ("btn-weight" == btnId) {// 称重后可以点击完成称重 |
| | | $("#btn-submit").removeClass("layui-btn-disabled"); |
| | | $("#btn-submit").attr("disabled", false); |
| | | } |
| | | if ("btn-submit" == btnId) { |
| | | $("#btn-submit").addClass("layui-btn-disabled"); |
| | | $("#btn-submit").attr("disabled", true); |
| | | if (InoutProgress.WEIGHT_FULL == recordData.progress) {// 如果是满车称重,则直接当前节点完成 |
| | | resetForm(); |
| | | } else { |
| | | // 完成称重后控制按钮 |
| | | $("#btn-weight").addClass("layui-btn-disabled"); |
| | | $("#btn-weight").attr("disabled", true); |
| | | |
| | | $("#btn-printBill").removeClass("layui-btn-disabled"); |
| | | $("#btn-printBill").attr("disabled", false); |
| | | } |
| | | } |
| | | if ("btn-printBill" == btnId) {// 打印过磅单,说明业务完成 |
| | | $("#btn-weight").removeClass("layui-btn-disabled"); |
| | | $("#btn-weight").attr("disabled", false); |
| | | |
| | | $("#btn-submit").addClass("layui-btn-disabled"); |
| | | $("#btn-submit").attr("disabled", true); |
| | | |
| | | $("#btn-printBill").addClass("layui-btn-disabled"); |
| | | $("#btn-printBill").attr("disabled", true); |
| | | |
| | | resetForm(); |
| | | } |
| | | } |
| | | |
| | | //点击称重 |
| | | function weight() { |
| | | // 没有业务数据不可执行 |
| | | if (!recordData) { |
| | | alertError("没有查询到业务数据,执行被拒绝!!"); |
| | | alertError("没有查询到业务数据,执行被拒绝!"); |
| | | return; |
| | | } |
| | | |
| | | // 如果是空车称重 |
| | | if (InoutProgress.WEIGHT_EMPTY == recordData.progress) { |
| | | form.val("form-data", { |
| | | emptyWeight: weightDto.weight |
| | | }); |
| | | form.render(); |
| | | } |
| | | |
| | | // 如果是满车称重 |
| | | if (InoutProgress.WEIGHT_FULL == recordData.progress) { |
| | | form.val("form-data", { |
| | | fullWeight: weightDto.weight |
| | | }); |
| | | } |
| | | form.render(); |
| | | } |
| | | |
| | | // 点击称重时候自动抓拍数据--增加通知信息 |
| | | layer.msg("系统自动抓拍保留记录……"); |
| | | // 点击称重自动调用抓拍 |
| | | snapData = { |
| | | companyId: companyId, |
| | | deptId: deptId, |
| | | progress: recordData.progress, |
| | | bizType: bizType, |
| | | plateNum: recordData.plateNum, |
| | | |
| | | id1: (null != snapDto1) ? snapDto1.id : null, |
| | | id2: (null != snapDto2) ? snapDto2.id : null, |
| | | id3: (null != snapDto3) ? snapDto3.id : null, |
| | | |
| | | id1: snapDto1.id, |
| | | id2: snapDto2.id, |
| | | id3: snapDto3.id, |
| | | sort: $("#scaleName").val(), |
| | | weight: weightDto.weight |
| | | }; |
| | |
| | | success: function (result) { |
| | | layer.close(index); |
| | | if (result.code != "0000") { |
| | | layer.alert(result.msg); |
| | | alertError(result.msg); |
| | | } else { |
| | | snapData = result.data; |
| | | } |
| | | }, |
| | | error: function () { |
| | | layer.close(index); |
| | | layer.msg("后台调用截图失败,请重新尝试!!"); |
| | | alertError("后台调用截图失败,请重新尝试"); |
| | | } |
| | | }); |
| | | |
| | | //入库第二次称重时调用计算方法 |
| | | //如果是第二次称重,默认执行自动计算 |
| | | if (InoutProgress.WEIGHT_EMPTY == recordData.progress) { |
| | | deAutoByIn("emptyWeight"); |
| | | } |
| | | flushBtn("btn-weight"); |
| | | } |
| | | |
| | | //新的读卡方式 |
| | | //读智慧卡 |
| | | function flushICCard() { |
| | | if (!cardDto.protocol) { |
| | | flushICCard1(); |
| | | } else { |
| | | flushICCard2(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 协议读取智慧卡 |
| | | */ |
| | | function flushICCard2() { |
| | | var param = JSON.stringify(cardDto); |
| | | var index = layer.load(); |
| | | var param = JSON.stringify(cardDto); |
| | | $.ajax({ |
| | | type: "POST", |
| | | url: "../../inout/api/ic-card-num", |
| | | url: "../../inout/api/get-icCard", |
| | | dataType: "json", |
| | | contentType: "application/json;charset=UTF-8", |
| | | data: param, |
| | | success: function (result) { |
| | | if (result.code != "0000") { |
| | | layer.alert(result.msg, { |
| | | offset: ['300px', '300px'] |
| | | }); |
| | | } else { |
| | | if (result.data.errorMsg) { |
| | | layer.alert(result.data.errorMsg, { |
| | | offset: ['300px', '300px'] |
| | | }); |
| | | } else { |
| | | $("#intelCard").val(result.data.icCardNo); |
| | | } |
| | | } |
| | | layer.close(index); |
| | | if (result.code != "0000") { |
| | | alertError(result.msg); |
| | | } else { |
| | | paramIntelCard = data; |
| | | $("#text-param").text("识别卡号:" + paramIntelCard); |
| | | flushData(paramIntelCard, null); |
| | | } |
| | | }, |
| | | error: function () { |
| | | layer.close(index); |
| | | layer.alert("IC卡读取失败!", { |
| | | offset: ['300px', '300px'] |
| | | }); |
| | | alertError("IC卡读取失败"); |
| | | } |
| | | }); |
| | | } |
| | |
| | | * 本地读取智慧卡 |
| | | */ |
| | | function flushICCard1() { |
| | | var index = layer.load(); |
| | | $("#text-param").val(null); |
| | | $("#form-data")[0].reset(); |
| | | form.render(); |
| | |
| | | jsonpCallback: "jsonpCallback", |
| | | success: function (json) { |
| | | var data = json.no; |
| | | layer.close(index); |
| | | if (data === "not found") { |
| | | alertError("请重新读卡!"); |
| | | } else { |
| | | textParam = data; |
| | | $("#text-param").text("识别卡号:" + textParam); |
| | | flushData(); |
| | | paramIntelCard = data; |
| | | $("#text-param").text("识别卡号:" + paramIntelCard); |
| | | flushData(paramIntelCard, null); |
| | | } |
| | | }, |
| | | error: function () { |
| | | layer.close(index); |
| | | alertError("IC卡读取出错!"); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // 使用插件获取省份证 |
| | | // 使用插件获取身份证 |
| | | function flushIdCard() { |
| | | var index = layer.load(); |
| | | $.ajax({ |
| | |
| | | layer.close(index); |
| | | var data = json.content; |
| | | if (data === "not found") { |
| | | layer.alert("没有读取到身份证信息,请手动录入!", { |
| | | offset: ['300px', '300px'] |
| | | }); |
| | | alertError("没有读取到身份证信息!"); |
| | | return; |
| | | } |
| | | $("#userId").val(data.idNum); |
| | | flushData(); |
| | | paramIdCard = data; |
| | | $("#text-param").text("识别身份证:" + paramIdCard); |
| | | flushData(null, paramIdCard); |
| | | }, |
| | | error: function () { |
| | | layer.alert("身份证读取失败,请手动录入!", { |
| | | offset: ['300px', '300px'] |
| | | }); |
| | | alertError("没有读取到身份证信息!"); |
| | | layer.close(index); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | function flushByHand() { |
| | | flushData(null, null); |
| | | } |
| | | |
| | | function flushWeight() { |
| | |
| | | layer.msg("开始渲染打印单……"); |
| | | if (companyId && companyId == "5016") { |
| | | print5016Weight(result.data); |
| | | console.log("5016"); |
| | | } else { |
| | | printWeight(result.data); |
| | | } |
| | | // 刷新按钮 |
| | | flushBtn("btn-printBill"); |
| | | } |
| | | }, |
| | | error: function () { |
| | |
| | | //称重可以复用 |
| | | $("#btn-weight").removeClass("layui-btn-disabled"); |
| | | $("#btn-weight").attr("disabled", false); |
| | | |
| | | //空车和满车被重置 |
| | | updateEditAndProgress(); |
| | | |
| | | //扣重信息框恢复为可编辑 |
| | | delDisabled(); |
| | | } |
| | | |
| | | function flushPage() { |
| | |
| | | } |
| | | |
| | | // --查询方法,获取身份证号、卡号、车牌号,进行查询 |
| | | function flushData() { |
| | | function flushData(intelCard, userIdCard) { |
| | | var index = layer.load(); |
| | | var userId2 = $("#userId").val(); |
| | | var intelCard = $("#intelCard").val(); |
| | | var userIdCard = userIdCard; |
| | | var intelCard = intelCard; |
| | | var plateNum = $("#plateNum").val(); |
| | | var param = { |
| | | type: type, |
| | | progress: progress, |
| | | intelCard: intelCard, |
| | | userId: userId2, |
| | | userId: userIdCard, |
| | | plateNum: plateNum |
| | | }; |
| | | |
| | | $.ajax({ |
| | | type: "POST", |
| | | url: "../../basic/inout/inout-query", |
| | |
| | | contentType: "application/json;charset=UTF-8", |
| | | data: JSON.stringify(param), |
| | | success: function (result) { |
| | | layer.close(index); |
| | | if (result.code != "0000") { |
| | | notify(result.msg, result.data); |
| | | notifyProgress(result.msg, result.data); |
| | | } else { |
| | | recordData = result.data; |
| | | // 返回的数据进行赋值 |
| | | form.val("form-data", recordData); |
| | | form.render(); |
| | | |
| | | updateEditAndProgress(); |
| | | } |
| | | layer.close(index); |
| | | }, |
| | | error: function () { |
| | | layer.close(index); |
| | | layer.alert("查询失败,请重新尝试!!"); |
| | | alertError("查询失败,请重新尝试"); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 跟新流程说明提心信息 |
| | | * 根据业务数据更新页面中的状态 |
| | | */ |
| | | function updateEditAndProgress() { |
| | | if (recordData) { |
| | | if (InoutProgress.WEIGHT_EMPTY == recordData.progress) { |
| | | $("#emptyWeight").removeClass("rkbk-search-input"); |
| | | $("#emptyWeight").attr("disabled", false); |
| | | if (!recordData) return true; |
| | | var curProgress = recordData.progress; |
| | | |
| | | //空车称重 |
| | | if (InoutProgress.WEIGHT_EMPTY == curProgress) { |
| | | $("#progress-hand").addClass("active"); |
| | | $("#progress-emptyWeight").addClass("active"); |
| | | |
| | | $("#fullWeight").addClass("rkbk-search-input"); |
| | | $("#fullWeight").attr("disabled", true); |
| | | $("#depotIdLabel").removeClass("color-red"); |
| | | } |
| | | if (InoutProgress.WEIGHT_FULL == recordData.progress) { |
| | | |
| | | //满车称重 |
| | | if (InoutProgress.WEIGHT_FULL == curProgress) { |
| | | $("#progress-hand").removeClass("active"); |
| | | $("#progress-emptyWeight").removeClass("active"); |
| | | |
| | | //装卸仓库必填 |
| | | $("#depotIdLabel").addClass("color-red"); |
| | | } |
| | | |
| | | //设置可编辑 |
| | | if (weightEditTag == 'Y') { |
| | | $("#fullWeight").removeClass("rkbk-search-input"); |
| | | $("#fullWeight").attr("disabled", false); |
| | | |
| | | $("#progress-hand").removeClass("active"); |
| | | $("#progress-emptyWeight").removeClass("active"); |
| | | |
| | | $("#emptyWeight").addClass("rkbk-search-input"); |
| | | $("#emptyWeight").attr("disabled", true); |
| | | } |
| | | } else { |
| | | $("#fullWeight").addClass("rkbk-search-input"); |
| | | $("#fullWeight").attr("disabled", true); |
| | | |
| | | $("#emptyWeight").addClass("rkbk-search-input"); |
| | | $("#emptyWeight").attr("disabled", true); |
| | | |
| | | $("#progress-hand").removeClass("active"); |
| | | $("#progress-emptyWeight").removeClass("active"); |
| | | } |
| | | //根据配置信息设置地磅是否可编辑 |
| | | if (weightEditTag && weightEditTag == 'N') { |
| | | $("#fullWeight").addClass("rkbk-search-input"); |
| | | $("#fullWeight").attr("disabled", true); |
| | | |
| | | $("#emptyWeight").addClass("rkbk-search-input"); |
| | | $("#emptyWeight").attr("disabled", true); |
| | | $("#emptyWeight").removeClass("rkbk-search-input"); |
| | | $("#emptyWeight").attr("disabled", false); |
| | | } |
| | | } |
| | | |
| | |
| | | notify(result.msg, result.data); |
| | | } else { |
| | | notify("数据提交成功", result.data); |
| | | // 更新按钮显示 |
| | | flushBtn("btn-submit"); |
| | | } |
| | | layer.close(index); |
| | | }, |
| | |
| | | contentType: "application/json;charset=UTF-8", |
| | | data: JSON.stringify(param) |
| | | }); |
| | | } |
| | | |
| | | //显示质检信息 |
| | | function showCheck() { |
| | | alertError("调整"); |
| | | } |
| | | |
| | | |
| | |
| | | layer.msg("没有获取到设备!"); |
| | | } |
| | | } |
| | | |
| | | //-------------------------道闸操作--------------------------// |