ソースを参照

评标材料相关

zhangweicheng 5 年 前
コミット
a1ca892a3d

+ 2 - 0
modules/main/models/project.js

@@ -20,6 +20,7 @@ let installation_facade = require('../facade/installation_facade');
 let pmController = require('../../pm/controllers/pm_controller');
 let divide_facade = require('../facade/divide_facade');
 let evaluate_facade = require('../facade/evaluate_facade');
+let bid_facade = require('../facade/bid_facade');
 
 const commonFacade = require('../../main/facade/common_facade');
 const GLJListModel = require("../../glj/models/glj_list_model");
@@ -48,6 +49,7 @@ moduleMap[projectConsts.RATION_TEMPLATE] = ration_template;
 moduleMap[projectConsts.PROJECT_INFO] = pmController;
 moduleMap[projectConsts.DIVIDE_SETTING] = divide_facade;
 moduleMap[projectConsts.EVALUATE_LIST] = evaluate_facade;
+moduleMap[projectConsts.BID_EVALUATION_LIST] = bid_facade;
 
 var Project = function (){};
 

+ 1 - 0
modules/main/models/project_consts.js

@@ -23,6 +23,7 @@ let projectConst = {
     INSTALLATION_FEE:'installation_fee',
     PROJECT_INFO: 'project_info',
     EVALUATE_LIST:'evaluate_list',
+    BID_EVALUATION_LIST:'bid_evaluation_list',
     DIVIDE_SETTING:'divide_setting'
 };
 

+ 11 - 6
modules/pm/facade/pm_facade.js

@@ -92,6 +92,7 @@ const shareListModel = mongoose.model('share_list');
 let welcomeModel = mongoose.model("welcome_setting");
 let divideModel = mongoose.model("divide_setting");
 let evaluateListModel = mongoose.model("evaluate_list");
+let bidListModel = mongoose.model("bid_evaluation_list");
 
 let featureLibModel =  mongoose.model("std_project_feature_lib");
 let scMathUtil = require('../../../public/scMathUtil').getUtil();
@@ -583,7 +584,8 @@ async function copyProject(userID, compilationID, data, newProjectID = null, del
         copyRationSubList(originalID,newProjectID,billMap.uuidMaping,rationMap.uuidMaping,projectGLJMap.IDMap,quantityDetailModel),
         copyRationSubList(originalID,newProjectID,billMap.uuidMaping,rationMap.uuidMaping,projectGLJMap.IDMap,rationInstallationModel),
         copyRationSubList(originalID,newProjectID,billMap.uuidMaping,rationMap.uuidMaping,projectGLJMap.IDMap,rationTemplateModel),
-        copyMaterialList(originalID,newProjectID,projectGLJMap.IDMap,evaluateListModel)
+        copyMaterialList(originalID,newProjectID,projectGLJMap.IDMap,evaluateListModel),
+        copyMaterialList(originalID,newProjectID,projectGLJMap.IDMap,bidListModel),
     ];
     if(originalProperty.calcProgramFile){
         copyTasks.push(commonCopy(newProjectID,originalProperty.calcProgramFile.ID,calcProgramFileID,calcProgramsModel));
@@ -1637,7 +1639,7 @@ async function exportTenderData(data){
     result.labourCoes = await labourCoesModel.findOne({projectID:data.projectID}).lean();
     result.divide_setting = await divideModel.findOne({projectID:data.projectID}, '-_id').lean();
     result.evaluateList = await evaluateListModel.find({projectID:data.projectID}, '-_id').lean();
-
+    result.bidList = await bidListModel.find({projectID:data.projectID}, '-_id').lean();
     return cipher.aesEncrypt(JSON.stringify(result));
 }
 
@@ -1791,9 +1793,9 @@ async function importProject(data,req,updateData) {
             let [constructionProjectID,projectIDMap,labourCoeFileIDMap,calcProgramFileIDMap] = await handleMainProjectDatas(mainData,updateData,req.session.sessionUser.id);
             result.constructionProjectID = constructionProjectID;
             if(datas.length > 1 ){//生成后统一次插入 2020-05-29
-              let newProjectSettings=[],bills=[],rations=[],projectGLJs=[],rationGLJs=[],rationCoes=[],quantityDetails=[],rationInstallations=[],rationTemplates=[],newCalcProgramsFiles=[],newLabourCoes=[],newDivides=[],evaluateList;
+              let newProjectSettings=[],bills=[],rations=[],projectGLJs=[],rationGLJs=[],rationCoes=[],quantityDetails=[],rationInstallations=[],rationTemplates=[],newCalcProgramsFiles=[],newLabourCoes=[],newDivides=[],evaluateList=[],bidList=[];
                 for(let i = 1;i<datas.length;i++){
-                  let [newProjectSetting,tbills,trations,tprojectGLJs,trationGLJs,trationCoes,tquantityDetails,trationInstallations,trationTemplates,newCalcProgramsFile,newLabourCoe,newDivide,tevaluateList] =  await handleEachProject(datas[i],projectIDMap,labourCoeFileIDMap,calcProgramFileIDMap)
+                  let [newProjectSetting,tbills,trations,tprojectGLJs,trationGLJs,trationCoes,tquantityDetails,trationInstallations,trationTemplates,newCalcProgramsFile,newLabourCoe,newDivide,tevaluateList,tbidList] =  await handleEachProject(datas[i],projectIDMap,labourCoeFileIDMap,calcProgramFileIDMap)
                   if(newProjectSetting) newProjectSettings.push(newProjectSetting);
                   if(tbills.length > 0) bills = bills.concat(tbills);
                   if(trations.length > 0) rations = rations.concat(trations);
@@ -1807,6 +1809,7 @@ async function importProject(data,req,updateData) {
                   if(newLabourCoe) newLabourCoes.push(newLabourCoe);
                   if(newDivide) newDivides.push(newDivide);
                   if(tevaluateList.length > 0) evaluateList = evaluateList.concat(tevaluateList);
+                  if(tbidList.length > 0) bidList = bidList.concat(tbidList);
                 }
 
                 if(newProjectSettings.length > 0) await insertMany(newProjectSettings,projectSettingModel);
@@ -1822,6 +1825,7 @@ async function importProject(data,req,updateData) {
                 if(newLabourCoes.length>0) await insertMany(newLabourCoes,labourCoesModel);
                 if(newDivides.length>0) await divideModel.insertMany(newDivides);
                 if(evaluateList.length > 0) await insertMany(evaluateList,evaluateListModel);
+                if(bidList.length > 0) await insertMany(bidList,bidListModel);
             }
 
          }
@@ -1830,7 +1834,7 @@ async function importProject(data,req,updateData) {
 }
 
 async function handleEachProject(data,projectIDMap,labourCoeFileIDMap,calcProgramFileIDMap){
-    let bills = [],rations = [],projectGLJs = [],rationGLJs=[],rationCoes=[],quantityDetails=[],rationInstallations=[],rationTemplates=[],evaluateList=[];
+    let bills = [],rations = [],projectGLJs = [],rationGLJs=[],rationCoes=[],quantityDetails=[],rationInstallations=[],rationTemplates=[],evaluateList=[],bidList=[];
     let newProjectSetting =null,newCalcProgramsFile = null,newLabourCoe = null,newDivide=null;
     let billsIDMap = {},projectGLJIDMap={},rationIDMap = {};
     let newProjectID = projectIDMap[data.projSetting.projectID];
@@ -1879,6 +1883,7 @@ async function handleEachProject(data,projectIDMap,labourCoeFileIDMap,calcProgra
     if(data.rationInstallations && data.rationInstallations.length > 0) rationInstallations = setRationSubList(data.rationInstallations,newProjectID,billsIDMap,rationIDMap,projectGLJIDMap);
     if(data.rationTemplates && data.rationTemplates.length > 0) rationTemplates = setRationSubList(data.rationTemplates,newProjectID,billsIDMap,rationIDMap,projectGLJIDMap);
     if(data.evaluateList && data.evaluateList.length > 0) evaluateList = setMaterialList(data.evaluateList,newProjectID,projectGLJIDMap);
+    if(data.bidList && data.bidList.length > 0) bidList = setMaterialList(data.bidList,newProjectID,projectGLJIDMap);
 
     //生成projectSetting 文件
     if(data.projSetting){
@@ -1912,7 +1917,7 @@ async function handleEachProject(data,projectIDMap,labourCoeFileIDMap,calcProgra
       delete newDivide._id;
     } 
 
-    return [newProjectSetting,bills,rations,projectGLJs,rationGLJs,rationCoes,quantityDetails,rationInstallations,rationTemplates,newCalcProgramsFile,newLabourCoe,newDivide,evaluateList]
+    return [newProjectSetting,bills,rations,projectGLJs,rationGLJs,rationCoes,quantityDetails,rationInstallations,rationTemplates,newCalcProgramsFile,newLabourCoe,newDivide,evaluateList,bidList]
 
 }
 

+ 1 - 1
public/web/scMathUtil.js

@@ -173,7 +173,7 @@ let scMathUtil = {
     roundForObj:function(obj,decimal){
         let me = this;
         let value;
-        if(obj === undefined || obj === null) return 0;
+        if(obj === undefined || obj === null || isNaN(obj)) return 0;
         let n = Math.pow(10,decimal);
         if(me.isNumber(obj)){
           value = Math.round(obj * n) / n;