| | |
| | | <Entity> |
| | | <Property name="checkId">$${this.checkId}</Property> |
| | | <Property name="foodVariety">$${this.foodVariety}</Property> |
| | | <Property name="type">$${this.type}</Property> |
| | | </Entity> |
| | | </Property> |
| | | <Property name="dataProvider">checkStandardPR#listCheckItemsByParam</Property> |
| | |
| | | $alert("保存成功,可以进行打印和重新提新表单!");
 |
| | | }
 |
| | | });
 |
| | | }</ClientEvent> |
| | | <ClientEvent name="onCreate">
 |
| | | /**
 |
| | | * 自动计算,当前页面不自动关联扦样记录,全部由手动为准
 |
| | | * 
 |
| | | * 1.净重 = 毛重 - 皮重
 |
| | | * 2.总扣重 = 现场扣重 + 其他扣重 + 扣水杂质
 |
| | | * 3.结算重量 = 净重 - 总扣重 (含水杂增重)
 |
| | | * 4.出/入库重量 = 净重 - 总扣重 (不含水杂增重)
 |
| | | * 
 |
| | | * 5.入库时:扣水杂 正数 = 扣重,负数 = 增重
 |
| | | * 6.出库时:水分增重,正数=增重,负数=扣重
 |
| | | */
 |
| | | deAutoByWeight = function(name){
 |
| | | 
 |
| | | if(null == name) name = "1";
 |
| | | 
 |
| | | var curData = view.get("#dsMain.data:#");
 |
| | | var fullWeight = curData.get("fullWeight");
 |
| | | var emptyWeight = curData.get("emptyWeight");
 |
| | | 
 |
| | | if(fullWeight == 0 || emptyWeight == 0){
 |
| | | return;
 |
| | | }
 |
| | | // 净重
 |
| | | var netWeight = Number(fullWeight) - Number(emptyWeight);
 |
| | | 
 |
| | | if (netWeight <= 0){
 |
| | | $notify("净重小于0,当前称重存在逻辑问题");
 |
| | | return;
 |
| | | }
 |
| | | 
 |
| | | //汇总结果
 |
| | | var deSum = 0, addSum = 0, settleWeight = 0, recordWeight = 0;
 |
| | | //扣水杂
 |
| | | var deWet = curData.get("deWet"), deImpurity = curData.get("deImpurity");
 |
| | | 
 |
| | | var impurity = curData.get("impurity"), wet = curData.get("wet");
 |
| | | 
 |
| | | 
 |
| | | var deBase = 0, multiple = 0;
 |
| | | var checkItems = curData.get("checkItems");
 |
| | | //水分杂质,更改比例并且水分扣重还没计算情况下
 |
| | | if ("wet" == name) {
 |
| | | var checkItem = this.getCheckItem(checkItems,"C01", "C020101");
 |
| | | if (checkItem) {
 |
| | | deBase = Number(wet) - Number(checkItem.get("upperLimit"));
 |
| | | if (deBase == 0) return;
 |
| | | multiple = parseInt(deBase / checkItem.get("ruleNum"));//倍数
 |
| | | deWet = (netWeight * multiple * checkItem.get("ruleReduce") / 100.00).toFixed(0);
 |
| | | }
 |
| | | }
 |
| | | 
 |
| | | //杂质
 |
| | | if ("impurity" == name) {
 |
| | | checkItem = this.getCheckItem(recordData.checkItems, "C02","C01010301");
 |
| | | if (checkItem) {
 |
| | | deBase = Number(impurity) - Number(checkItem.get("upperLimit"));
 |
| | | if (deBase == 0) return;
 |
| | | multiple = parseInt(deBase / checkItem.get("ruleNum"));
 |
| | | deImpurity = (netWeight * multiple * checkItem.get("ruleReduce") / 100.00).toFixed(0);
 |
| | | }
 |
| | | }
 |
| | | 
 |
| | | /** 总扣重,不含增重*/
 |
| | | deSum = Number(curData.get("deOther")) + Number(curData.get("deHandle"));
 |
| | | 
 |
| | | //出库
 |
| | | if ("OUT" == curData.get("type")) {
 |
| | | 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);
 |
| | | }
 |
| | | }else{
 |
| | | if (Number(deWet) > 0) {//扣重
 |
| | | deSum = deSum + Number(deWet);
 |
| | | } else {
 |
| | | addSum = addSum + 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);
 |
| | | 
 |
| | | curData.set("impurity",impurity);
 |
| | | curData.set("wet",wet);
 |
| | | curData.set("deImpurity",deImpurity);
 |
| | | curData.set("deWet",deWet);
 |
| | | curData.set("deSum",deSum);
 |
| | | curData.set("netWeight",netWeight);
 |
| | | curData.set("settleWeight",settleWeight);
 |
| | | curData.set("recordWeight",recordWeight);
 |
| | | };
 |
| | | 
 |
| | | 
 |
| | | /**
 |
| | | * 根据化验项和传递过来的参数获取当前参数的配置信息
 |
| | | * @param checkItems
 |
| | | * @param code1 系统参数ID
 |
| | | * @param code2 国标参数ID
 |
| | | * @returns {undefined}
 |
| | | */
 |
| | | function getCheckItem(checkItems, code1, code2) {
 |
| | | if (!checkItems) return null;
 |
| | | $.each(checkItems, function (index, checkItem) {
 |
| | | if (checkItem.get("standardId") == code1 || checkItem.get("standardId") == code2) {
 |
| | | if (checkItem.get("ruleNum") && checkItem.get("upperLimit") > 0.0) {
 |
| | | return checkItem;
 |
| | | }
 |
| | | }
 |
| | | });
 |
| | | return null;
 |
| | | }</ClientEvent> |
| | | <Property name="packages">font-awesome,css-common</Property> |
| | | <Property name="javaScriptFile">./static/plugins/lodop/LodopFuncs.js</Property> |
| | |
| | | </Container> |
| | | </ControlTab> |
| | | <ControlTab id="tabCheck"> |
| | | <Property name="caption">扦样化验</Property> |
| | | <Property name="caption">质检信息</Property> |
| | | <Property name="iconClass">fa fa-gavel</Property> |
| | | <Property name="width">150</Property> |
| | | <Property name="name">tabCheck</Property> |