瀏覽代碼

Merge branch 'master' of http://smartcost.f3322.net:3000/SmartCost/ConstructionCost

chenshilong 7 年之前
父節點
當前提交
156104875f

+ 4 - 1
modules/main/facade/bill_facade.js

@@ -131,7 +131,10 @@ async function pasteRationsAndRationGLJ (rations,ration_gljs) {
 
     for(let rg of ration_gljs){
         await getProjectGLJ(rg,gljKeyArray,gljMap);
-        new_ration_gljs.push(ration_glj_facade.createNewRecord(rg));
+        let temRecord = ration_glj_facade.createNewRecord(rg);
+        rg.rcode?temRecord.rcode = rg.rcode:'';
+        rg.hasOwnProperty("customQuantity")?temRecord.customQuantity = rg.customQuantity:'';
+        new_ration_gljs.push(temRecord);
     }
 
     rations.length>0?await insertMany(rations,ration_Model):'';

+ 20 - 2
modules/ration_glj/facade/glj_calculate_facade.js

@@ -157,7 +157,8 @@ function generateAdjustState(glj,coeList,adjustState,index,quantity) {
     if(glj._doc.createType=='replace'&&glj.rcode!=glj.code){
         adjustState.push({index:stateSeq.replace,content:glj.rcode+'换'+glj.code});
     }else if(glj._doc.createType=='add'){
-        adjustState.push({index:stateSeq.add,content:'添'+glj.code+'量'+parseFloat(quantity)});
+        let displayQuantity = glj._doc.hasOwnProperty('customQuantity')?parseFloat(glj.customQuantity):parseFloat(quantity);
+        adjustState.push({index:stateSeq.add,content:'添'+glj.code+'量'+ displayQuantity});
     }
     // to do
 
@@ -191,13 +192,30 @@ function generateAdjustState(glj,coeList,adjustState,index,quantity) {
 
 function getContent(coes) {
     let stringList=[];
+    let  temAmount = null;
+    let theSame = true;
+    for(let t of coes){
+        if(temAmount == null){
+            temAmount = t.amount;
+        }else if(temAmount != t.amount){
+            theSame = false;
+            break;
+        }
+    }
     for(let c of coes){
         if( c.amount&&c.amount!=1){
             let operator = c.operator;
             if(c.operator =="*"){
                 operator = "X";
             }
-            stringList.push(c.coeType+operator+c.amount);
+            if(theSame == true && c.coeType == "定额"){
+                stringList.push(c.coeType+operator+c.amount);
+                break;
+            }else
+            if(theSame == false && c.coeType != "定额"){
+                stringList.push(c.coeType+operator+c.amount);
+            }
+
         }
     }
     return stringList.join(",");

+ 2 - 3
web/building_saas/main/js/models/project_glj.js

@@ -186,11 +186,11 @@ ProjectGLJ.prototype.updatePriceFromRG = function (recode, updateField, newval)
     }
 };
 
-ProjectGLJ.prototype.updatePropertyFromMainSpread = function (node, updateField, newval) {
+ProjectGLJ.prototype.updatePropertyFromMainSpread = function (node, updateField, newval,editingText) {
     if (updateField == "contain") {//更新含量和工程量时,要走定额更新的逻辑
         projectObj.project.Ration.updateContain(newval,node);
     }if(updateField == "quantity"){
-        projectObj.project.quantity_detail.editMainTreeNodeQuantity(newval,node,updateField);
+        projectObj.project.quantity_detail.editMainTreeNodeQuantity(newval,node,updateField,editingText);
     } else {
         this.updateGLJProperty(node, updateField, newval);
     }
@@ -702,7 +702,6 @@ ProjectGLJ.prototype.calcQuantity  = function (init=false){
     let quantityMap={},changeArray=[];
     let rationGljGroup = _.groupBy(projectObj.project.ration_glj.datas,'projectGLJID')
     let q_decimal = getDecimal("glj.quantity");
-    console.log(init);
     for(let pglj of project_gljs ){
         let pg_index = gljOprObj.getIndex(pglj,gljKeyArray);
         pglj.subdivisionQuantity = 0;

+ 1 - 0
web/building_saas/main/js/models/quantity_detail.js

@@ -596,6 +596,7 @@ var quantity_detail = {
                         }else {
                             me.updateRationQuantity(value,node,null,editingText);
                         }
+                        gljOprObj.refreshView();
                     }else {
                         projectObj.mainController.refreshTreeNode([node]);
                     }

+ 9 - 0
web/building_saas/main/js/models/ration.js

@@ -653,3 +653,12 @@ var Ration = {
         return new ration(project);
     }
 };
+
+function FilterNumberFromUnit (unit) {
+    let reg = new RegExp('^[0-9]+');
+    if (reg.test(unit)) {
+        return parseInt(unit.match(reg)[0]);
+    } else {
+        return 1;
+    }
+};

+ 11 - 6
web/building_saas/main/js/models/ration_glj.js

@@ -489,22 +489,20 @@ var ration_glj = {
         ration_glj.prototype.insertGLJAsRation = function (GLJSelection, selected, callback) {
             let gljList = [];
             let allGLJ = gljOprObj.AllRecode;
-            let billsItemID = null;
-            let serialNo = 0;
-            let selectedSerialNo = null;
-            let nextNodeID = null;
-            let parentNodeID = null;
+            let billsItemID = null, serialNo = 0,selectedSerialNo = null,nextNodeID = null, parentNodeID = null, billNode = null;
             let children = [];
             if (selected.sourceType === project.Bills.getSourceType()) {
                 billsItemID = selected.data.ID;
                 parentNodeID = selected.getID();
                 nextNodeID = selected.tree.rootID();
+                billNode = selected;
             } else {
                 billsItemID = selected.data.billsItemID;
                 serialNo = selected.data.serialNo;
                 selectedSerialNo = selected.data.serialNo;
                 nextNodeID = selected.getNextSiblingID();
                 parentNodeID = selected.getParentID();
+                billNode = selected.parent;
             }
             children = project.Ration.getBillsSortRation(billsItemID);
             serialNo == 0 ? serialNo = children.length : "";
@@ -535,13 +533,20 @@ var ration_glj = {
                         materialType:glj.materialType,
                         materialCoe:glj.materialCoe,
                         repositoryId: glj.repositoryId
-                    }
+                    };
                     if (glj.hasOwnProperty("compilationId")) {
                         new_glj.from = "cpt";
                         if (glj.code.indexOf('-') != -1) {//这条工料机是用户通过修改名称、规格、型号等保存到补充工料机库的
                             new_glj.original_code = glj.code.split('-')[0];//取-前的编号作为原始编号
                         }
                     }
+                    if(optionsOprObj.getOption(optionsOprObj.optionsTypes.GENERALOPTS, 'rationQuanACToBillsQuan')){//需要根据清单转换工程量
+                        new_glj.quantityEXP="QDL";
+                        if(billNode.data.quantity){
+                            new_glj.quantity = scMathUtil.roundForObj(billNode.data.quantity/FilterNumberFromUnit(glj.unit),getDecimal("glj.quantity"));
+                            new_glj.contain =  scMathUtil.roundForObj(new_glj.quantity/billNode.data.quantity,6);
+                        }
+                    }
                     gljList.push(new_glj);
                 }
             }

+ 2 - 2
web/building_saas/main/js/views/glj_view.js

@@ -1186,7 +1186,7 @@ var gljOprObj = {
             projectObj.project.ration_glj.updateRationGLJByEdit(recode, updateField, newval);
         }
     },
-    updateRationTypeGLJ: function (value, node, fieldName) {
+    updateRationTypeGLJ: function (value, node, fieldName,editingText) {
         let newval;
         let updatePrice = false;
         if (fieldName == "marketUnitFee") {
@@ -1199,7 +1199,7 @@ var gljOprObj = {
             }
         } else {
             if (value != null) {
-                projectObj.project.projectGLJ.updatePropertyFromMainSpread(node, fieldName, value)
+                projectObj.project.projectGLJ.updatePropertyFromMainSpread(node, fieldName, value,editingText);
                 return;
                 //update
             }

+ 0 - 2
web/building_saas/main/js/views/glj_view_contextMenu.js

@@ -330,7 +330,6 @@ var gljContextMenu = {
 function getGLJData(actionType) {
     $('#actionType').val(actionType);
     $.bootstrapLoading.start();
-    console.log(+new Date());
     projectObj.project.ration_glj.getGLJData(function (result) {
         console.log(+new Date());
         zTreeHelper.createTree(result.datas.treeData, gljOprObj.gljTreeSetting, "gljTree", gljOprObj);
@@ -345,7 +344,6 @@ function getGLJData(actionType) {
         $('#modalCon').width($(window).width()*0.5);
         $("input[name='glj']").get(0).checked=true;
         $.bootstrapLoading.end();
-        console.log(+new Date());
         $("#glj_tree_div").modal({show:true});
         setTimeout(function(){
             gljOprObj.gljLibSpresd?gljOprObj.gljLibSpresd.refresh():'';

+ 8 - 1
web/building_saas/main/js/views/project_glj_view.js

@@ -287,6 +287,12 @@ projectGljObject={
                return false;
             }
         }
+        if(dataCode == 'materialCoe'){//三材类别为空时,三材系数应只读,不允许输入。
+            if(data.materialType == undefined || data.materialType == null){
+                return false;
+            }
+        }
+
         return true;
     },
     onSelectionChange:function (){
@@ -684,7 +690,7 @@ projectGljObject={
         if(info.newValue === undefined ){
             return;
         }
-        if (!me.checkData(col,setting,value)) {
+        if (value&&!me.checkData(col,setting,value)) {
             setTimeout(function () {//为了不与click事件冲突
                 alert('输入的数据类型不对,请重新输入!');
             },200);
@@ -710,6 +716,7 @@ projectGljObject={
                     projectObj.mainController.refreshTreeNode(projectObj.project.mainTree.roots);
                 });
             }
+            gljOprObj.refreshView();
         };
         if(dataCode=='basePrice'||dataCode=='marketPrice'){
             value= scMathUtil.roundForObj(value,getDecimal('glj.unitPrice'));//修改市场价和修改定额价时需要重新记算很多受影响的树节点,现在改成与定字额工料机那里调相同的方法。

+ 1 - 1
web/building_saas/main/js/views/project_property_decimal_view.js

@@ -43,7 +43,7 @@ decimalObj.decimal = function (field, node) {
             }
         }
     }
-    return this.process;
+    return  this[field]?this[field]:this.process;
 };
 
 function returnV(v, r){

+ 1 - 1
web/building_saas/main/js/views/project_view.js

@@ -404,7 +404,7 @@ var projectObj = {
         }else if(fieldName === 'remark'){
             projectObj.updateNodeField(node,value,'remark');
         }  else if(calcTools.isGljRation(node)){
-            gljOprObj.updateRationTypeGLJ(value,node,fieldName);
+            gljOprObj.updateRationTypeGLJ(value,node,fieldName,editingText);
         } else if (value !== calcFees.getFee(node.data, fieldName)||fieldName == 'quantity') {//工程量需要进行转换,所以做特殊处理
             if (fieldName === 'code' && !calcTools.isVolumePrice(node)) {
                 projectObj.updateCode(node, value);

+ 8 - 3
web/building_saas/pm/js/pm_newMain.js

@@ -648,12 +648,12 @@ const projTreeObj = {
     },
     showTreeData: function (nodes, headers,sheet) {
         let me = this;
-       // let sheet = me.workBook.getActiveSheet(); 为了共用
+        let tree = sheet.name() == "copyToSheet"?me.copyTree:me.tree;
         let fuc = function(){
             sheet.setRowCount(0);
             sheet.setRowCount(nodes.length);
             for(let i = 0; i < nodes.length; i++){
-                let treeNodeCell = me.getTreeNodeCell(me.tree);
+                let treeNodeCell = me.getTreeNodeCell(tree);
                 sheet.getCell(i, 0).cellType(treeNodeCell);
                 for(let j = 0; j < headers.length; j++){
                     sheet.getRange(-1, j, -1, 1).hAlign(GC.Spread.Sheets.HorizontalAlign[headers[j]['hAlign']]);
@@ -738,7 +738,12 @@ const projTreeObj = {
         let sheet = me.copyToWorkBook.getActiveSheet();
         sheet.options.isProtected = true;
         sheet.name('copyToSheet');
-        me.showTreeData(me.tree.items, me.copyToSetting.header, sheet);
+        let datas = [];
+        for(let i of me.tree.items){
+            datas.push(i.data);
+        }
+        me.copyTree  = pmTree.createNew(projTreeObj.setting, datas);
+        me.showTreeData(me.copyTree.items, me.copyToSetting.header, sheet);
         me.copySelected = null;
         let initSel = sheet.getSelections()[0] ? sheet.getSelections()[0] : {row: 0, rowCount: 1};
         projTreeObj.initSelection(initSel,null,sheet);