| | |
| | | |
| | | netWeight = netWeight.toFixed(0); |
| | | recordWeight = recordWeight.toFixed(0); |
| | | settleWeight = recordWeight.toFixed(0); |
| | | settleWeight = settleWeight.toFixed(0); |
| | | |
| | | form.val("form-data", { |
| | | netWeight: netWeight, |
| | |
| | | |
| | | /** |
| | | * 出库-称重自动计算 |
| | | * 1、净重 = 毛重 - 皮重 ; 总扣重 = 扣水杂 + 现场扣重 + 其他扣重 |
| | | * 2、水分增重,整数 = 增重,负数= 扣重 |
| | | * 3、结算重量 = 净重 - 总扣重 (含水杂增重); 入库重量 = 净重 - 总扣重 (不含水杂增重) |
| | | * 1、净重 = 毛重 - 皮重 ; 总扣重 = 质检扣重 + 其他扣重 |
| | | * 2、结算重量 = 净重 - 总扣重 + 质检扣重; 入库重量 = 净重 - 总扣重 |
| | | * 注意:如果是手动修改了水分和杂质的扣重,则不按照配置规则进行增扣重计算 |
| | | * @param name 触发事件的属性名称 |
| | | */ |
| | | 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,当前称重存在逻辑问题"); |
| | | alertError("净重<=0,当前环节存在逻辑错误,请核对"); |
| | | return; |
| | | } |
| | | //其他信息 |
| | | var dePackage = curData.dePackage, deOther = curData.deOther, settleWeight = 0, |
| | | recordWeight = 0, deSum = 0, deCheck = curData.deCheck, addCheck = curData.addCheck; |
| | | |
| | | 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); |
| | | } |
| | | } |
| | | recordWeight = Number(netWeight) - Number(dePackage) - Number(deOther) - Number(deCheck); |
| | | settleWeight = Number(recordWeight) + Number(addCheck); |
| | | |
| | | /** 总扣重,不含增重*/ |
| | | deSum = Number(curData.deOther) + Number(curData.deHandle); |
| | | deSum = Number(deOther) + Number(deCheck) |
| | | |
| | | |
| | | 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); |
| | | } |
| | | |
| | | netWeight = netWeight.toFixed(0); |
| | | recordWeight = recordWeight.toFixed(0); |
| | | settleWeight = settleWeight.toFixed(0); |
| | | 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 |
| | | recordWeight: recordWeight, |
| | | deSum: deSum |
| | | }); |
| | | 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 msg 提醒信息 |
| | | * @param data 数据信息,可能为空 |
| | | */ |
| | | function notify(msg, data) { |
| | | if (data) { |
| | | //赋值 |
| | | $("#resultMsg").text(msg); |
| | | $("#resultUserName").text(data.userName); |
| | | $("#resultPlateNum").text(data.plateNum); |
| | | if ("IN" == data.type) { |
| | | $("#resultType").text("入库-" + INOUT_PROGRESS_MSG(data.progress)); |
| | | } else { |
| | | $("#resultType").text("出库-" + INOUT_PROGRESS_MSG(data.progress)); |
| | | } |
| | | $("#resultIntelCard").text(data.intelCard); |
| | | |
| | | layer.open({ |
| | | type: 1, |
| | | offset: ['150px', '200px'], |
| | | area: '450px;', |
| | | shade: 0.8, |
| | | id: 'dialog_notify_info', |
| | | btn: ['确定'], |
| | | content: $('#dialog-from-notify'), |
| | | yes: function (index) { |
| | | layer.closeAll(); |
| | | } |
| | | }); |
| | | } else { |
| | | layer.alert(msg, {offset: ['300px', '300px']}); |
| | | // ---------------------------通知单-开始 -------------------// |
| | | // 弹出往来单位下拉框 |
| | | 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; |
| | | form.val("form-data", { |
| | | customerName: data.customerName, |
| | | noticeId: data.id |
| | | }); |
| | | 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/common/page-food-location', |
| | | url: '../../basic/common/page-dicArea', |
| | | page: false, |
| | | // limit : limit, |
| | | // skin : "nob", |
| | | // size : 'sm', |
| | | toolbar: '#toolbarFoodLocaton', |
| | | even: true, |
| | | method: 'POST', |
| | |
| | | // 赋值 |
| | | form.val("form-data", { |
| | | foodLocation: data.name, |
| | | foodLocationId: data.code |
| | | }); |
| | | // 关闭 |
| | | layer.closeAll(); |
| | |
| | | function flushFoodLocation() { |
| | | var key = $("#key2").val(); |
| | | table.reload('tableFoodLoaction', { |
| | | url: "../../basic/common/page-food-location", |
| | | url: "../../basic/common/page-dicArea", |
| | | where: { |
| | | key: key |
| | | }, |