| | |
| | | form.render(); |
| | | } |
| | | |
| | | // function deAutoByOut(name) { |
| | | // var curData = form.val("form-data"); |
| | | // |
| | | // if (curData.fullWeight == 0 || curData.emptyWeight == 0) { |
| | | // return; |
| | | // } |
| | | // //汇总结果 |
| | | // var deSum = 0, addSum = 0, settleWeight = 0, recordWeight = 0; |
| | | // // 净重 |
| | | // var netWeight = curData.fullWeight - curData.emptyWeight; |
| | | // //扣水杂 |
| | | // var deWet = curData.deWet, deImpurity = curData.deImpurity; |
| | | // |
| | | // if (netWeight <= 0) { |
| | | // layer.alert("净重小于0,当前称重存在逻辑问题"); |
| | | // return; |
| | | // } |
| | | // |
| | | // var deBase = 0, multiple = 0; |
| | | // //水分杂质,更改比例并且水分扣重还没计算情况下 |
| | | // if ("fullWeight" == name || null == deWet) { |
| | | // var checkItem = this.getCheckItem(recordData.checkItems, CHECK_ST.C01, CHECK_ST.C020101); |
| | | // if (checkItem) { |
| | | // deBase = Number(curData.wet) - Number(checkItem.upperLimit); |
| | | // if (deBase == 0) return; |
| | | // multiple = parseInt(deBase / checkItem.ruleNum);//倍数 |
| | | // deWet = (netWeight * multiple * checkItem.ruleReduce / 100.00).toFixed(0); |
| | | // } |
| | | // } |
| | | // //杂质 |
| | | // if ("fullWeight" == name || null == deImpurity) { |
| | | // checkItem = this.getCheckItem(recordData.checkItems, CHECK_ST.C02, CHECK_ST.C01010301); |
| | | // if (checkItem) { |
| | | // deBase = Number(curData.impurity) - Number(checkItem.upperLimit); |
| | | // if (deBase == 0) return; |
| | | // multiple = parseInt(deBase / checkItem.ruleNum); |
| | | // deImpurity = (netWeight * multiple * checkItem.ruleReduce / 100.00).toFixed(0); |
| | | // } |
| | | // } |
| | | // |
| | | // /** 总扣重,不含增重*/ |
| | | // deSum = Number(curData.deOther) + Number(curData.deHandle); |
| | | // |
| | | // |
| | | // if (Number(deWet) > 0) {//增重 |
| | | // addSum = addSum + Number(deWet); |
| | | // } else { |
| | | // deSum = deSum + Number(deWet); |
| | | // } |
| | | // |
| | | // if (Number(deImpurity) > 0) {//扣重 |
| | | // deSum = deSum + Number(deImpurity); |
| | | // } else { |
| | | // addSum = addSum + Number(deImpurity); |
| | | // } |
| | | // |
| | | // deSum = deSum.toFixed(0); |
| | | // /** 增重转正数,便于计算 */ |
| | | // addSum = Math.abs(addSum).toFixed(0); |
| | | // /** 入库重量 = 净重 - 总扣重 */ |
| | | // recordWeight = Number(netWeight) - Number(deSum); |
| | | // /** 结算重量 = 净重 - 总扣重 + 增重 */ |
| | | // settleWeight = Number(netWeight) - Number(deSum) + Number(addSum); |
| | | // |
| | | // form.val("form-data", { |
| | | // netWeight: netWeight, |
| | | // deImpurity: deImpurity, |
| | | // deWet: deWet, |
| | | // deSum: deSum, |
| | | // settleWeight: settleWeight, |
| | | // recordWeight: recordWeight |
| | | // }); |
| | | // form.render(); |
| | | // } |
| | | |
| | | /** |
| | | * 根据化验项和传递过来的参数获取当前参数的配置信息 |
| | | * @param checkItems |
| | | * @param code1 系统参数ID |
| | | * @param code2 国标参数ID |
| | | * @returns {undefined} |
| | | */ |
| | | function getCheckItem(checkItems, code1, code2) { |
| | | var checkData = null; |
| | | if (!checkItems) return checkData; |
| | | $.each(checkItems, function (index, checkItem) { |
| | | if (checkItem.standardId == code1 || checkItem.standardId == code2) { |
| | | if (checkItem.ruleNum && checkItem.upperLimit > 0.0) { |
| | | checkData = checkItem; |
| | | return true; |
| | | } |
| | | } |
| | | }); |
| | | return checkData; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 更新用户选择地磅 |
| | | */ |
| | |
| | | }, |
| | | error: function () { |
| | | notify("提交失败,请重新尝试", null); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // ---------------------------通知单-开始 -------------------// |
| | | // 弹出往来单位下拉框 |
| | | function showNotice() { |
| | | var titleCustomer = "送货单位"; |
| | | var url = "../../basic/inout/list-notice-in"; |
| | | if ("OUT" == type) { |
| | | titleCustomer = "收货单位"; |
| | | url = "../../basic/inout/list-notice-out" |
| | | } |
| | | var index = layer.load(); |
| | | var param = { |
| | | type: type |
| | | }; |
| | | |
| | | console.log(url); |
| | | |
| | | table.render({ |
| | | elem: '#tableNotice', |
| | | url: url, |
| | | page: false, |
| | | even: true, |
| | | method: 'POST', |
| | | contentType: "application/json;charset=UTF-8", |
| | | cols: [[{ |
| | | field: 'name', |
| | | title: '通知单名称', |
| | | width: '15%' |
| | | }, { |
| | | field: 'customerName', |
| | | title: titleCustomer |
| | | }, { |
| | | field: 'foodVarietyName', |
| | | title: '粮食品种', |
| | | width: '10%' |
| | | }, { |
| | | field: 'year', |
| | | title: '年份', |
| | | width: '8%' |
| | | }, { |
| | | field: 'depotName', |
| | | title: "所涉仓库" |
| | | }, { |
| | | field: 'contractName', |
| | | title: '所属合同' |
| | | }]], |
| | | where: param, |
| | | parseData: function (res) { |
| | | if ("0000" == res.code) { |
| | | return { |
| | | "code": "0", |
| | | "msg": res.msg, |
| | | "data": res.data |
| | | } |
| | | } else { |
| | | return { |
| | | "code": "1", |
| | | "msg": res.msg |
| | | } |
| | | } |
| | | }, |
| | | done: function (res) { |
| | | layer.close(index); |
| | | } |
| | | }); |
| | | //双击显示选中数据 |
| | | table.on('rowDouble(tableNotice)', function (obj) { |
| | | var data = obj.data; |
| | | console.log(data) |
| | | form.val("form-data", { |
| | | customerName: data.customerName, |
| | | noticeId: data.id, |
| | | foodYear: data.year, |
| | | depotId: data.depotId, |
| | | foodVariety: data.foodVariety |
| | | }); |
| | | layer.closeAll(); |
| | | }); |
| | | // 弹出对话框 |
| | | layer.open({ |
| | | type: 1, |
| | | offset: ['100px', '250px'], |
| | | title: "通知单列表(双击选中)", |
| | | area: ['900px', '600px'], |
| | | shade: 0, |
| | | content: $('#listNotice'), |
| | | btn: 0, |
| | | btn: ['取消'], |
| | | yes: function () { |
| | | layer.closeAll(); |
| | | }, |
| | | closeBtn: 0 |
| | | }); |
| | | } |
| | | |
| | | // ---------------------------粮食产地-开始 -------------------// |
| | | function showFoodLocation() { |
| | | var index = layer.load(); |
| | | table.render({ |
| | | elem: '#tableFoodLoaction', |
| | | url: '../../basic/inout/page-dicArea', |
| | | page: false, |
| | | toolbar: '#toolbarFoodLocaton', |
| | | even: true, |
| | | method: 'POST', |
| | | contentType: "application/json;charset=UTF-8", |
| | | cols: [[{ |
| | | field: 'code', |
| | | title: '编码', |
| | | }, { |
| | | field: 'simple', |
| | | title: '简拼', |
| | | }, { |
| | | field: 'name', |
| | | title: '名称', |
| | | width: '60%' |
| | | }]], |
| | | where: { |
| | | "page": 1, |
| | | "limit": 100 |
| | | }, |
| | | parseData: function (res) { |
| | | if ("0000" == res.code) { |
| | | return { |
| | | "code": "0", |
| | | "msg": res.msg, |
| | | "count": res.data.total, |
| | | "data": res.data.records |
| | | } |
| | | } else { |
| | | return { |
| | | "code": "1", |
| | | "msg": res.msg |
| | | } |
| | | } |
| | | }, |
| | | done: function (res) { |
| | | layer.close(index); |
| | | } |
| | | }); |
| | | |
| | | //双击显示选中数据 |
| | | table.on('rowDouble(tableFoodLoaction)', function (obj) { |
| | | var data = obj.data; |
| | | // 赋值 |
| | | form.val("form-data", { |
| | | foodLocation: data.name, |
| | | foodLocationId: data.code |
| | | }); |
| | | // 关闭 |
| | | layer.closeAll(); |
| | | }); |
| | | |
| | | // 弹出对话框 |
| | | layer.open({ |
| | | type: 1, |
| | | title: "选择粮产地", |
| | | area: ['600px', '600px'], |
| | | shade: 0, |
| | | content: $('#listFoodLocation'), |
| | | btn: 0, |
| | | btn: ['取消'], |
| | | yes: function () { |
| | | layer.closeAll(); |
| | | }, |
| | | closeBtn: 0 |
| | | }); |
| | | } |
| | | |
| | | // 刷新 |
| | | function flushFoodLocation() { |
| | | var key = $("#key2").val(); |
| | | table.reload('tableFoodLoaction', { |
| | | url: "../../basic/inout/page-dicArea", |
| | | where: { |
| | | key: key |
| | | }, |
| | | done: function (res) { |
| | | if (key) { |
| | | $("#key2").val(key); |
| | | } |
| | | } |
| | | }); |
| | | } |