Преглед изворни кода

Merge branch '1.0.0_online' of http://192.168.1.41:3000/SmartCost/ConstructionCost into 1.0.0_online

TonyKang пре 6 година
родитељ
комит
4795948bc3

+ 25 - 0
modules/all_models/evaluate_list.js

@@ -0,0 +1,25 @@
+/**
+ * Created by zhang on 2019/9/6.
+ */
+/**
+ * Created by zhang on 2019/3/18.
+ */
+import mongoose from "mongoose";
+
+let Schema = mongoose.Schema;
+let evaluateSchema = {
+    ID:String,
+    projectID: {type:Number,index: true},
+    projectGLJID:Number,//关联工料机ID
+    seq:String,//序号
+    code:String,
+    name:String,
+    specs:String,
+    unit:String,
+    market_price:String,
+    locked:{type: Number, default: 0},//锁定,1锁,0不锁
+    remark:String,
+    originPlace:String,//产地
+    vender:String //厂家
+};
+mongoose.model("evaluate_list", new Schema(evaluateSchema, {versionKey: false, collection: "evaluate_list"}));

+ 14 - 2
modules/glj/models/glj_list_model.js

@@ -242,15 +242,27 @@ class GLJListModel extends BaseModel {
             if (Object.keys(data).length <= 0) {
                 throw '新增数据为空';
             }
+            //if(data.specs==undefined||data.specs==null||data.specs=="") data.specs = null;
             let condition={
                 code: data.code,
                 project_id: data.project_id,
                 name:data.name,
-                specs:data.specs,
                 type:data.type,
                 unit:data.unit
             };
-            let projectGljData = await this.findDataByCondition(condition);
+            let projectGljData = null;
+            let  projectGLJList = await this.findDataByCondition(condition,null,false);
+            if(projectGLJList.length > 0){//specs有可能为空或"",所以这里做这样处理
+                let p = data.specs;
+                if(p==undefined||p==null||p=="") p = null;
+                for(let g of projectGLJList){
+                    let t = g.specs;
+                    if(t==undefined||t==null||t=="") t = null;
+                    if(p == t) projectGljData = g;
+                }
+            }
+
+          //  let projectGljData = await this.findDataByCondition(condition);
             let isAddProjectGLJ = false;
 
             // 获取标段对应的单价文件id

+ 3 - 0
modules/pm/facade/pm_facade.js

@@ -1547,6 +1547,9 @@ async function setupStdData(tenderData) {
     });
     //更新人材机汇总数据
     tenderData.projectGLJ.forEach(pGLJ => {
+        if (!pGLJ.specs) {
+            pGLJ.specs = null;
+        }
         let stdGLJ = stdGLJCodeMap[pGLJ.original_code];
         if (stdGLJ) {
             pGLJ.glj_id = stdGLJ.ID;

+ 4 - 4
modules/users/models/log_model.js

@@ -62,9 +62,8 @@ class LogModel extends BaseModel {
         let ip = request.connection.remoteAddress;
         ip = ip.split(':');
         ip = ip[3] === undefined ? '' : ip[3];
-
         // let ipInfo = '127.0.0.1';//await this.getIpInfoFromApi(ip);
-       // let ipInfo = await this.getIpInfoFromApi(ip);
+        let ipInfo = await this.getIpInfoFromApi(ip);
 
         let userAgentObject = new UAParser(request.headers['user-agent']);
         let osInfo = userAgentObject.getOS();
@@ -74,7 +73,7 @@ class LogModel extends BaseModel {
             os: osInfo.name + ' ' + osInfo.version + ' ' + cpuInfo.architecture,
             browser: browserInfo.name + ' ' + browserInfo.version,
             ip: ip,
-            ip_info:"" //ipInfo
+            ip_info:ipInfo
         };
 
         return this.addLog(userId, LogType.LOGIN_LOG, message);
@@ -121,7 +120,8 @@ class LogModel extends BaseModel {
         }
         let getData = {
             url: 'http://ip.taobao.com/service/getIpInfo.php?ip=' + ip,
-            encoding: 'utf8'
+            encoding: 'utf8',
+            timeout:2000
         };
         return new Promise(function (resolve, reject) {
             try {

+ 6 - 6
modules/users/models/user_model.js

@@ -67,10 +67,10 @@ class UserModel extends BaseModel {
                 Request.post(postData, function (err, postResponse, body) {
                     if (err) {
                         console.log('111');
-                        throw '请求错误';
+                        reject('请求错误');
                     }
                     if (postResponse.statusCode !== 200) {
-                        throw '通行证验证失败!';
+                        reject('通行证验证失败!');
                     }
                     resolve(body);
                 });
@@ -103,10 +103,10 @@ class UserModel extends BaseModel {
                 Request.post(postData, function (err, postResponse, body) {
                     if (err) {
                         console.log('111');
-                        throw '请求错误';
+                        reject('请求错误');
                     }
                     if (postResponse.statusCode !== 200) {
-                        throw '通行证验证失败!';
+                        reject('通行证验证失败!');
                     }
                     resolve(body);
                 });
@@ -135,10 +135,10 @@ class UserModel extends BaseModel {
                 Request.post(postData, function (err, postResponse, body) {
                     if (err) {
                         console.log('111');
-                        throw '请求错误';
+                        reject('请求错误');
                     }
                     if (postResponse.statusCode !== 200) {
-                        throw '通行证验证失败!';
+                        reject('通行证验证失败!');
                     }
                     resolve(body);
                 });

+ 18 - 4
web/building_saas/main/js/models/calc_base.js

@@ -546,7 +546,13 @@ let baseFigureTemplate = {
         if(cbTools.isUnDef(bill) || cbTools.isUnDef(bill.ID)) return 0;
         let node = cbTools.getNodeByID(bill.ID);
         if(cbTools.isUnDef(node)) return 0;
-        return projectObj.project.calcProgram.getBeforeTaxTotalFee([node], tender);
+        // 排除的节点:调用的节点、材料(工程设备)暂估价
+        let excludeNodes = [node];
+        let materialProvisional = calcTools.getNodeByFlag(fixedFlag.MATERIAL_PROVISIONAL);
+        if (materialProvisional) {
+            excludeNodes.push(materialProvisional);
+        }
+        return projectObj.project.calcProgram.getBeforeTaxTotalFee(excludeNodes, tender);
     },
     'RCJJC': function (tender) {//人材机价差
         return (this['RGJC'](tender) + this['CLJC'](tender) + this['JXJC'](tender)).toDecimal(decimalObj.bills.totalPrice);
@@ -874,12 +880,20 @@ let baseFigureTemplate = {
         return rst;
     },
     'ZGCLFFZM': function (tender) {//暂估材料费(从子目汇总)
-        const totalFeeType = tender ? 'tenderTotalFee' : 'totalFee';
+        /*const totalFeeType = tender ? 'tenderTotalFee' : 'totalFee';
         let bill = calcBase.fixedBills[calcBase.fixedFlag.ENGINEERINGCOST]['bill'];
         projectObj.project.calcProgram.calculate(cbTools.getNodeByID(bill.ID), false, false, true);
         if(cbTools.isUnDef(bill)) return 0;
         if(cbTools.isUnDef(bill.feesIndex) || Object.keys(bill.feesIndex).length === 0) return 0;
-        return cbTools.isDef(bill.feesIndex.estimate) && cbTools.isDef(bill.feesIndex.estimate[totalFeeType]) ? bill.feesIndex.estimate[totalFeeType] : 0;
+        return cbTools.isDef(bill.feesIndex.estimate) && cbTools.isDef(bill.feesIndex.estimate[totalFeeType]) ? bill.feesIndex.estimate[totalFeeType] : 0;*/
+        let feeField = 'estimate',
+            subFeeField = tender ? 'tenderTotalFee' : 'totalFee';
+        // 分部分项暂估合价
+        let subEngineeringFee = cbTools.getBillsFee(fixedFlag.SUB_ENGINERRING, feeField, subFeeField);
+        // 技术措施项目暂估合价
+        let techFee = cbTools.getBillsFee(fixedFlag.CONSTRUCTION_TECH, feeField, subFeeField);
+        return (subEngineeringFee + techFee).toDecimal(decimalObj.bills.totalPrice);
+
     },
     'FBF': function (tender) {//分包费
         const totalFeeType = tender ? 'tenderTotalFee' : 'totalFee';
@@ -1028,7 +1042,7 @@ let baseFigureMap = {
     '安全文明施工专项费': {base: 'AQWMSGZXF', fixedFlag: fixedFlag.SAFETY_CONSTRUCTION, class: 'CSXM'},
     //不于清单直接关联==========
     '建筑面积': {base: 'JZMJ', class: 'FBFX'},
-    '税前工程造价': {base: 'SQGCZJ', class: 'SQGCZJ',//安全文明施工专项费用使用
+    '税前工程造价': {base: 'SQGCZJ', class: 'SQGCZJ', //安全文明施工专项费用使用
         cycleCalcRef: [fixedFlag.SUB_ENGINERRING, fixedFlag.OTHER, fixedFlag.CHARGE], //循环计算相关固定行,由于计算排除了本身,不用判断措施项目
         multiRef: [fixedFlag.SUB_ENGINERRING, fixedFlag.OTHER, fixedFlag.CHARGE]}, //相关固定行,需要关联措施项目,因为需要提取出多处引用的进行排序
     '人材机价差': {base: 'RCJJC', class: 'RCJ'},

+ 4 - 2
web/building_saas/main/js/models/calc_program.js

@@ -579,8 +579,10 @@ let calcTools = {
         }
         else if (me.isLeafBill(treeNode)){
             if (projectObj.project.Bills.isEngineerEst(treeNode)){
-                sumT = treeNode.data.feesIndex['common'].totalFee;
-                sumU = treeNode.data.feesIndex['common'].unitFee;
+                if (treeNode.data.feesIndex['common'] != undefined){
+                    sumT = treeNode.data.feesIndex['common'].totalFee;
+                    sumU = treeNode.data.feesIndex['common'].unitFee;
+                }
             }
             else{
                 if (isGather){

+ 18 - 6
web/building_saas/main/js/models/exportStandardInterface.js

@@ -151,6 +151,9 @@ const XMLStandard = (function () {
     async function entry(userID, exportKind, projectData) {
         let _failList = _cache.getItem('failList');
 
+        // 不导出的人材机类型数据:企业管理费、利润、一般风险费
+        let skipGLJTypes = [6, 7, 8];
+
         //建设项目定义
         //source:来源数据
         function Project(source) {
@@ -320,7 +323,8 @@ const XMLStandard = (function () {
                 otherItemNo: [],               //其他列项序号
                 feeItemNo: [],                 //费用项序号
                 mainBillsCode: [],             //主要清单明细项目编码 (标准文件中constraint中没有定义此唯一性,但是主要清单明细的备注那里说明了,这里处理一下)
-                appraisalDetailCode: [],         //评审材料明细代码唯一(标准文件中constraint中没有定义此唯一性,但是评审材料明细的备注里说明了)
+                appraisalDetailCode: [],       //评审材料明细代码唯一(标准文件中constraint中没有定义此唯一性,但是评审材料明细的备注里说明了)
+                detailCode: []                 //材料明细代码唯一(标材料表 暂估价材料评表中)
             };
             XML_EXPORT_BASE.Element.call(this, '单位工程', attrs);
         }
@@ -883,9 +887,9 @@ const XMLStandard = (function () {
             XML_EXPORT_BASE.Element.call(this, '暂估价材料表', []);
         }
         //材料明细定义
-        function MaterialDetail(source) {
+        function MaterialDetail(parentName, source) {
             let attrs = [
-                {name: '序号', value: source.serialNo, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
+                {name: '序号', value: parentName === 'evalEstimateMaterial' ? source.orgCode : source.serialNo, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
                 {name: '关联材料号', value: source.code, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE},
                 {name: '材料名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
                 {name: '规格型号', value: source.specs, maxLen: 255},
@@ -1383,6 +1387,9 @@ const XMLStandard = (function () {
                 //定额人材机排序
                 rationGljData = gljUtil.sortRationGLJ(rationGljData);
                 for (let rGlj of rationGljData) {
+                    if (skipGLJTypes.includes(rGlj.type)) {
+                        continue;
+                    }
                     let gljSource = {
                         //code: rGlj.code,
                         code: getGljCode(rGlj.projectGLJID),
@@ -1919,6 +1926,9 @@ const XMLStandard = (function () {
                     '6': '400'
                 };
                 for (let glj of allGljs) {
+                    if (skipGLJTypes.includes(glj.type)) {
+                        continue;
+                    }
                     let price = gljUtil.getGLJPrice(glj, detail.projectGLJ.datas,
                         detail.projectInfo.property.calcOptions, detail.labourCoe.datas, detail.projectInfo.property.decimal, false, _, scMathUtil);
                     //调整价
@@ -1976,14 +1986,16 @@ const XMLStandard = (function () {
                     //评标和暂估材料表下的材料明细中的人材机代码,要求单位工程内唯一,由于人材机汇总也有这个限制,所以这里不再处理
                     if (glj.is_eval_material) { //评标
                         gljSource.serialNo = evalBidSeq++;
-                        evalBidMaterial.children.push(new MaterialDetail(gljSource));
+                        evalBidMaterial.children.push(new MaterialDetail('evalBidMaterial', gljSource));
                         //给建设项目下的评审材料汇总设置明细数据,这里需要检测代码(编号)唯一性,因为是汇总所有单位工程的,要求所有单位工程内评审材料代码唯一
                         appraisalSummary.children.push(new AppraisalDetail(gljSource));
-                        _util.checkUnique(curTenderEle.constraints.appraisalDetailCode, gljSource.code, '评审材料明细代码', gljSource.orgCode);
+                        //_util.checkUnique(curTenderEle.constraints.appraisalDetailCode, gljSource.code, '评审材料明细代码', gljSource.orgCode);
+                        _util.checkUnique(curTenderEle.constraints.detailCode, gljSource.code, '材料明细关联材料号', gljSource.orgCode);
                     }
                     if (glj.is_evaluate) {  //暂估
                         gljSource.serialNo = evalEstSeq++;
-                        evalEstimateMaterial.children.push(new MaterialDetail(gljSource));
+                        evalEstimateMaterial.children.push(new MaterialDetail('evalEstimateMaterial', gljSource));
+                        _util.checkUnique(curTenderEle.constraints.detailCode, gljSource.code, '材料明细关联材料号', gljSource.orgCode);
                     }
                 }
                 return {gljSummary, evalBidMaterial, evalEstimateMaterial};

+ 4 - 4
web/building_saas/main/js/models/installation_fee.js

@@ -223,6 +223,10 @@ var installation_fee = {
             }
         };
        installation_fee.prototype.calcInstallationFee=function(callback){
+            if(!projectObj.project.isInstall()){//如果不是安装工程,则不用计算
+                if(callback) callback(false);
+                return;
+            }
             let project = projectObj.project,me = this;
             let engineering = projectObj.project.projectInfo.property.engineering;
             let installSetting = projectObj.project.projectInfo.property.installSetting;
@@ -235,10 +239,6 @@ var installation_fee = {
             let FBMap = {};//保存分部下对应的补项
             let usedBXMap = {};//有使用到的补项
             let startTime =  +new Date();
-            if(!projectObj.project.isInstall()){//如果不是安装工程,则不用计算
-                if(callback) callback(false);
-                return;
-            }
             for(let bx of BXs){//把补项放入映射表中
                 FBMap[bx.ParentID] = bx;
             }