| | |
| | | edit = function(){
 |
| | | var data = view.get("#dataGridMain.currentEntity");
 |
| | | if(!data) return;
 |
| | | 
 |
| | | if ("RECORD" == data.get("progress")) {
 |
| | | view.get("#btnOK").set("visible",true);
 |
| | | }else{
 |
| | |
| | | });
 |
| | | };
 |
| | | </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 = 0;
 |
| | | 
 |
| | | var impurity = 0;
 |
| | | 
 |
| | | 
 |
| | | var deBase = 0, multiple = 0;
 |
| | | var checkItems = curData.get("checkItems");
 |
| | | 
 |
| | | /** 总扣重,不含增重*/
 |
| | | 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("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> |
| | | <DataSet id="dsMain"> |
| | |
| | | var id = self.getDom().id;
 |
| | | var prop = id.substring(2,id.length);
 |
| | | deAutoByWeight(prop);
 |
| | | </ClientEvent> |
| | | </ClientEvent> |
| | | <Property name="name">fullWeight</Property> |
| | | <Property name="property">fullWeight</Property> |
| | | <Editor/> |
| | |
| | | <Editor/> |
| | | </AutoFormElement> |
| | | <AutoFormElement layoutConstraint="colSpan:2"> |
| | | <ClientEvent name="onBlur">//id 规则 d_prop
 |
| | | var id = self.getDom().id;
 |
| | | var prop = id.substring(2,id.length);
 |
| | | deAutoByWeight(prop);</ClientEvent> |
| | | <Property name="name">deCheck</Property> |
| | | <Property name="property">deCheck</Property> |
| | | <Editor/> |
| | | </AutoFormElement> |
| | | <AutoFormElement layoutConstraint="colSpan:2"> |
| | | <ClientEvent name="onBlur">//id 规则 d_prop
 |
| | | var id = self.getDom().id;
 |
| | | var prop = id.substring(2,id.length);
 |
| | | deAutoByWeight(prop);</ClientEvent> |
| | | <Property name="name">addCheck</Property> |
| | | <Property name="property">addCheck</Property> |
| | | <Editor/> |