Ver código fonte

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

chenshilong 4 anos atrás
pai
commit
7341d00645

+ 26 - 0
modules/all_models/equipment_purchase.js

@@ -0,0 +1,26 @@
+
+let mongoose = require('mongoose'),
+    Schema = mongoose.Schema;
+
+
+let equipment = {
+    ID:String,
+    code:String,
+    name:String,
+    unit:String,
+    quantity:Number,
+    unitPrice:Number,//单价
+    totalPrice:Number,//金额
+    remark:String
+}
+
+
+let equipment_purchase = new Schema({
+    projectID:{
+        type: Number,
+        index: true
+    },
+    total:Number,//合计
+    equipments :[equipment]
+    },{versionKey:false})
+mongoose.model('equipment_purchase', equipment_purchase,'equipment_purchase');

+ 0 - 0
modules/equipment_purchase/controllers/equipment_purchase_controller.js


+ 20 - 0
modules/equipment_purchase/facade/equipment_purchase_facade.js

@@ -0,0 +1,20 @@
+
+module.exports={
+    getData:getData
+};
+
+let mongoose = require('mongoose');
+let equipmentPurchaseModel = mongoose.model("equipment_purchase");
+let consts = require('../../main/models/project_consts');
+
+
+
+function getData(projectID, callback) {
+    equipmentPurchaseModel.find({'projectID': projectID}).lean().exec((err, data) => {
+        if (err) {
+            callback(1, '', null);
+        } else {
+            callback(0, consts.projectConst.EQUIPMENT_PURCHASE, data);
+        }
+    })
+}

+ 6 - 0
modules/equipment_purchase/routes/equipment_purchase_route.js

@@ -0,0 +1,6 @@
+let express = require('express');
+
+module.exports = function (app) {
+    var eqRouter = express.Router();
+    app.use('/equipmentPurchase',eqRouter);
+}

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

@@ -26,6 +26,9 @@ let pmController = require('../../pm/controllers/pm_controller');
 const commonFacade = require('../../main/facade/common_facade');
 const GLJListModel = require("../../glj/models/glj_list_model");
 
+
+var equipment_purchase_facade = require('../../equipment_purchase/facade/equipment_purchase_facade');
+
 var consts = require('./project_consts');
 var projectConsts = consts.projectConst;
 var asyncTool = require("async");
@@ -51,6 +54,7 @@ moduleMap[projectConsts.PROJECT_INFO] = pmController;
 moduleMap[projectConsts.EVALUATE_LIST] = evaluate_facade;
 moduleMap[projectConsts.BID_EVALUATION_LIST] = bid_facade;
 moduleMap[projectConsts.CONTRACTOR_LIST] = contractor_facade;
+moduleMap[projectConsts.EQUIPMENT_PURCHASE] = equipment_purchase_facade;
 
 var Project = function (){};
 

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

@@ -1,3 +1,5 @@
+const { EQUIPMENT } = require("../../common/const/glj_type_const");
+
 /**
  * Created by jimiz on 2017/4/18.
  */
@@ -24,7 +26,8 @@ let projectConst = {
     PROJECT_INFO: 'project_info',
     EVALUATE_LIST:'evaluate_list',
     CONTRACTOR_LIST:'contractor_list',
-    BID_EVALUATION_LIST:'bid_evaluation_list'
+    BID_EVALUATION_LIST:'bid_evaluation_list',
+    EQUIPMENT_PURCHASE:'equipment_purchase'
 };
 
 let projectConstList = [

+ 3 - 0
modules/pm/models/project_model.js

@@ -51,6 +51,7 @@ let mainColLibModel = mongoose.model('std_main_col_lib');
 let projSettingModel = mongoose.model('proj_setting');
 let optionModel = mongoose.model('options');
 
+let equipmentPurchaseModel = mongoose.model('equipment_purchase');
 function ProjectsDAO() {
 }
 
@@ -268,6 +269,8 @@ ProjectsDAO.prototype.updateUserProjects = async function (userId, compilationId
                     // 新建计算程序文件 CSL, 2017.10.23
                     let cpFile = await calcProgramFacade.newProjectCalcProgramFile(data.updateData);
                     newProject.property.calcProgramFile = cpFile ? cpFile : null;
+                    //新建设备购置计录行
+                    await equipmentPurchaseModel.create({projectID:newProject.ID,total:0,equipments:[]});    
                 }
                 newProject.save(async function (err, result) {
                     if (!err && result._doc.projType === projectType.tender) {

+ 1 - 1
public/web/gljUtil.js

@@ -368,7 +368,7 @@ let gljUtil = {
             let pglj = calcTools.getProjectGLJ(glj);
             glj.tenderQuantity = this.getRationGLJTenderQuantity(glj, ration, gd, scMathUtil,pglj);
 
-            return scMathUtil.roundToString(quantity * glj.quantity, gd);
+            return scMathUtil.roundForObj(quantity * glj.quantity, gd)+'';
         }
     },
     getEngineerCostData:function(property,bills,fixedFlag,scMathUtil){

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

@@ -754,7 +754,7 @@ var gljOprObj = {
     calcMixRationTotalQuantity(mList,pTotal){ //计算组成物的总消耗量
         for (let subG of mList) {
             subG.rationItemQuantity = scMathUtil.roundForObj(subG.rationItemQuantity, getDecimal("glj.quantity"));
-            subG.totalQuantity = scMathUtil.roundToString(subG.rationItemQuantity * pTotal, getDecimal("glj.quantity"));
+            subG.totalQuantity = scMathUtil.roundForObj(subG.rationItemQuantity * pTotal, getDecimal("glj.quantity"))+'';
         }
     },
     addMixRatioToShow: function () {