Преглед на файлове

Merge branch '1.0.0_online' of http://smartcost.f3322.net:3000/SmartCost/ConstructionCost into 1.0.0_online

zhongzewei преди 7 години
родител
ревизия
bc7418e281

+ 2 - 2
Dockerfile

@@ -1,8 +1,8 @@
-FROM costbase:latest
+FROM costbase:2.0
 
 WORKDIR /home/ConstructionCost
 
-RUN git pull http://192.168.1.12:3000/SmartCost/ConstructionCost 1.0.0_online
+COPY . /home/ConstructionCost
 
 RUN cnpm install
 

+ 2 - 2
Dockerfile_qa

@@ -1,8 +1,8 @@
-FROM costbase:latest
+FROM costbase:2.0
 
 WORKDIR /home/ConstructionCost
 
-RUN git pull http://192.168.1.12:3000/SmartCost/ConstructionCost 1.0.0_online
+COPY . /home/ConstructionCost
 
 RUN cnpm install
 

+ 1 - 1
config/config.js

@@ -31,7 +31,7 @@ module.exports = {
     pp:{server: "172.18.111.228", port: "27017"},
     prod:{
         dbURL:"mongodb://smartcost:SmartCost3850888@dds-wz9da4d5ca0fdd341.mongodb.rds.aliyuncs.com:3717,dds-wz9da4d5ca0fdd342.mongodb.rds.aliyuncs.com:3717/scConstruct?authSource=admin;replicaSet=mgset-7518601",
-        LicenseKey:"civil.smartcost.com.cn,834986144349993#A0XNdYDO9QzM8IiOiQWSiwSflNHbhZmOiI7ckJye0ICbuFkI1pjIEJCLi4TPnNnMEVXS4RGejhFZkNVMZZHTvVTWBZlcsNTaiZFbKJ HSklmM8cENUJTTnJUN9NGZTVTdrU4LmVHeudDcwtySsNWW5s4UPdVZVRDe7ETNnNHduZnWwsmI0IyUiwSO4MTNwYDO5gTM0IicfJye35XX3JyMiZzZiojIDJCLiETMuYHIT pEIkFWZyB7UiojIOJyebpjIkJHUiwiIzUTNxkDMgQjM7ADOxAjMiojI4J7QiwiIuNmLt36YuQ7cvNGdyFWbz9CbpZXajJiOiMXbEJCLig1jlzahlDZmpnInmb1uk/avoDrlmvJilrKqmXrunfb tmD0jnLiOiEmTDJCLiMTO9kZNdQ"
+        LicenseKey:"civil.smartcost.com.cn,834986144349993#A0XNdYDO9QzM8IiOiQWSiwSflNHbhZmOiI7ckJye0ICbuFkI1pjIEJCLi4TPnNnMEVXS4RGejhFZkNVMZZHTvVTWBZlcsNTaiZFbKJHSklmM8cENUJTTnJUN9NGZTVTdrU4LmVHeudDcwtySsNWW5s4UPdVZVRDe7ETNnNHduZnWwsmI0IyUiwSO4MTNwYDO5gTM0IicfJye35XX3JyMiZzZiojIDJCLiETMuYHITpEIkFWZyB7UiojIOJyebpjIkJHUiwiIzUTNxkDMgQjM7ADOxAjMiojI4J7QiwiIuNmLt36YuQ7cvNGdyFWbz9CbpZXajJiOiMXbEJCLig1jlzahlDZmpnInmb1uk/avoDrlmvJilrKqmXrunfbtmD0jnLiOiEmTDJCLiMTO9kZNdQ"
     },
     redis_local:{server:'127.0.0.1',port:'6379',pwd:'smartCost'},
     redis_qa:{server:'192.168.1.184',port:'6379',pwd:'smartCost'},

+ 6 - 1
public/web/sheet/sheet_common.js

@@ -178,6 +178,9 @@ var sheetCommonObj = {
             if(setting.header[col].cellType === "selectButton"){
                 this.setSelectButton(row,col,sheet,setting.header[col]);
             }
+            if(setting.header[col].cellType === "tipsCell"){
+                this.setTipsCell(row,col,sheet,setting.header[col]);
+            }
             if(setting.owner==='gljTree'){
                 if(setting.header[col].cellType === "checkBox"){
                     val==1?val:0;
@@ -355,7 +358,9 @@ var sheetCommonObj = {
             return new selectButton();
         };
         sheet.setCellType(row, col,getSelectButton(header.headerWidth),GC.Spread.Sheets.SheetArea.viewport);
-
+    },
+    setTipsCell(row,col,sheet,header){
+        
     },
     chkIfEmpty: function(rObj, setting) {
         var rst = true;

+ 29 - 2
server.js

@@ -13,7 +13,7 @@ let DBStore = require('connect-mongo')(session);
 let fs = require('fs');
 
 let URL = require('url');
-
+let cron = require('node-schedule');
 
 dbm.connect(process.env.NODE_ENV);
 //这里现在只引入了定额工料机里的models,当其它模块的models修改后使用:./modules/**/models/*.js引入所有的模块
@@ -116,4 +116,31 @@ app.listen(6060, function(){
     console.log('server started!');
 });
 
-
+//设置schedule job
+let rule = new cron.RecurrenceRule();
+//1. 每天凌晨3点一刻,删除临时文件
+rule.dayOfWeek = [1,2,3,4,5,6,0];
+rule.hour = 3;
+rule.minute = 15;
+cron.scheduleJob(rule, function(){
+    let path = __dirname + "/tmp";
+    fs.exists(path, function (exists) {
+        if (exists) {
+            fs.readdir(path, function (err, files) {
+                let currentTime = (new Date()).valueOf();
+                let timeGap = currentTime - (1000 * 60 * 60 * 24 * 0.5);
+                files.forEach(function(file,index){
+                    if (file.indexOf(".xlsx") === (file.length - 5) ||
+                        file.indexOf(".pdf") === (file.length - 4)) {
+                        let curPath = path + "/" + file;
+                        fs.stat(curPath,function(err,data){
+                            if (timeGap > data.mtime) {
+                                fs.unlink(curPath);
+                            }
+                        });
+                    }
+                });
+            })
+        }
+    })
+});

+ 29 - 0
test/unit/reports/chk_file_time.js

@@ -0,0 +1,29 @@
+/**
+ * Created by Tony on 2018/7/25.
+ */
+
+let fs = require('fs');
+
+// let files = [];
+let path = "D:/GitHome/ConstructionCost/tmp";
+fs.exists(path, function (exists) {
+    if (exists) {
+        fs.readdir(path, function (err, files) {
+            let currentTime = (new Date()).valueOf();
+            let timeGap = currentTime - (1000 * 60 * 60 * 24 * 0.5);
+            files.forEach(function(file,index){
+                if (file.indexOf(".xlsx") === (file.length - 5) ||
+                    file.indexOf(".pdf") === (file.length - 4)) {
+                    let curPath = path + "/" + file;
+                    fs.stat(curPath,function(err,data){
+                        //修改时间
+                        if (timeGap > data.mtime) {
+                            console.log(curPath + " will be deleted!");
+                            // fs.unlink(curPath);
+                        }
+                    });
+                }
+            });
+        })
+    }
+})

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

@@ -295,8 +295,8 @@ let calcTools = {
         };
 
         if (priceType == priceTypes.ptDiffPrice){
-            // result = (temp.toDecimal(decimalObj.ration.unitPrice) - temp2.toDecimal(decimalObj.ration.unitPrice)).toDecimal(decimalObj.ration.unitPrice);
-            result = (temp - temp2).toDecimal(decimalObj.ration.unitPrice);
+            result = (temp.toDecimal(decimalObj.ration.unitPrice) - temp2.toDecimal(decimalObj.ration.unitPrice)).toDecimal(decimalObj.ration.unitPrice);
+            // result = (temp - temp2).toDecimal(decimalObj.ration.unitPrice);
         }
         else{
             result = result.toDecimal(decimalObj.ration.unitPrice);

+ 10 - 12
web/building_saas/main/js/views/glj_col.js

@@ -8,19 +8,17 @@ let gljCol = {
             {headerName: "名称", headerWidth: 160, dataCode: "name", dataType: "String"},
             {headerName: "规格型号", headerWidth: 90, dataCode: "specs", dataType: "String", hAlign: "left"},
             {headerName: "单位", headerWidth: 45, dataCode: "unit", dataType: "String", hAlign: "center"},
-            {headerName: "类型", headerWidth: 45, dataCode: "shortName", dataType: "String", hAlign: "center"},
-            {headerName: "定额消耗", headerWidth: 80, dataCode: "rationItemQuantity", dataType: "Number", hAlign: "right", decimalField: "glj.quantity"},    // dataType: "Number", formatter: "0.00"
+            {headerName: "市场价", headerWidth: 80, dataCode: "marketPrice", dataType: "Number", hAlign: "right"},//, decimalField: "glj.unitPrice"
+            {headerName: "调整价", headerWidth: 80, dataCode: "adjustPrice", dataType: "Number", hAlign: "right"},//, decimalField: "glj.unitPrice"1
+            {headerName: "定额价", headerWidth: 80, dataCode: "basePrice", dataType: "Number", hAlign: "right"},//, decimalField: "glj.unitPrice"
+            {headerName: "定额消耗", headerWidth: 80, dataCode: "rationItemQuantity", dataType: "Number", hAlign: "right", decimalField: "glj.quantity"},   // dataType: "Number", formatter: "0.00"
             {headerName: "自定消耗", headerWidth: 80, dataCode: "customQuantity", dataType: "Number", hAlign: "right", decimalField: "glj.quantity"},
             {headerName: "消耗量", headerWidth: 80, dataCode: "quantity", dataType: "Number", hAlign: "right", decimalField: "glj.quantity"},
             {headerName: "总消耗量", headerWidth: 80, dataCode: "totalQuantity", dataType: "Number", hAlign: "right", decimalField: "glj.quantity"},
-            {headerName: "定额价", headerWidth: 80, dataCode: "basePrice", dataType: "Number", hAlign: "right"},//, decimalField: "glj.unitPrice"
-            {headerName: "调整价", headerWidth: 80, dataCode: "adjustPrice", dataType: "Number", hAlign: "right"},//, decimalField: "glj.unitPrice"
-            {headerName: "市场价", headerWidth: 80, dataCode: "marketPrice", dataType: "Number", hAlign: "right"},//, decimalField: "glj.unitPrice"
-            {headerName: "暂估", headerWidth: 45, dataCode: "isEstimate", dataType: "String", hAlign: "center", vAlign: "center", cellType: "checkBox"
-            }
+            {headerName: "暂估", headerWidth: 45, dataCode: "isEstimate", dataType: "String", hAlign: "center", vAlign: "center", cellType: "checkBox"}
         ],
         view: {
-            lockColumns: [0, 4, 5, 7, 8, 10, 12]
+            lockColumns: [0, 5, 7, 9, 10, 11]
         },
         // 工料机类型是混凝土、砂浆、配合比、机械台班时,价格不可编辑。
         editedTyep:[GLJTypeConst.MAIN_MATERIAL,GLJTypeConst.EQUIPMENT]//主材设备
@@ -32,10 +30,10 @@ let gljCol = {
             {headerName: "规格型号", headerWidth: 120, dataCode: "specs", hAlign: "left", dataType: "String"},
             {headerName: "单位", headerWidth: 45, dataCode: "unit", hAlign: "center", dataType: "String"},
             {headerName: "类型", headerWidth: 45, dataCode: "short_name", hAlign: "center", dataType: "String"},
-            {headerName: "总消耗量", headerWidth: 90, dataCode: "quantity", hAlign: "right", dataType: "Number",decimalField:'glj.quantity'},
-            {headerName: "定额价", headerWidth: 70, dataCode: "basePrice", hAlign: "right", dataType: "Number",validator:"number"},//decimalField:'glj.unitPrice',
-            {headerName: "调整价", headerWidth: 70, dataCode: "adjustPrice", hAlign: "right", dataType: "Number"},//,decimalField:"glj.unitPrice"
             {headerName: "市场价", headerWidth: 70, dataCode: "marketPrice", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:"glj.unitPrice"
+            {headerName: "调整价", headerWidth: 70, dataCode: "adjustPrice", hAlign: "right", dataType: "Number"},//,decimalField:"glj.unitPrice"
+            {headerName: "定额价", headerWidth: 70, dataCode: "basePrice", hAlign: "right", dataType: "Number",validator:"number"},//decimalField:'glj.unitPrice',
+            {headerName: "总消耗量", headerWidth: 90, dataCode: "quantity", hAlign: "right", dataType: "Number",decimalField:'glj.quantity'},
             {headerName: "暂估", headerWidth: 45, dataCode: "is_evaluate", hAlign: "center", dataType: "String",cellType:'checkBox'},
             {headerName: "主要\n材料", headerWidth: 45, dataCode: "is_main_material", hAlign: "center", dataType: "String",cellType:'checkBox'},
             {headerName: "供货方式", headerWidth: 80, dataCode: "supply", hAlign: "center", dataType: "String",cellType:'comboBox',editorValueType:true,options:supplyComboMap},
@@ -48,7 +46,7 @@ let gljCol = {
             {headerName: "备注", headerWidth: 100, dataCode: "remark", hAlign: "left", dataType: "String"}
         ],
             view: {
-            lockColumns: [0,1,2,3,4,5,7]
+            lockColumns: [0,1,2,3,4,6,8]
         }
     },
     mixRatio_Setting:{

+ 10 - 2
web/building_saas/main/js/views/project_view.js

@@ -551,8 +551,16 @@ var projectObj = {
             let items = projectObj.project.mainTree.items;
             let sheet = projectObj.mainSpread.getActiveSheet();
             for (let i = 0; i < items.length; i++) {
-                if ((info.colList.includes(4) && items[i].data.itemCharacterText) || (info.colList.includes(5) && items[i].data.jobContentText))
-                    sheet.autoFitRow(i);
+                let need = false;
+                if (items[i].data.itemCharacterText){
+                    sheet.getCell(i, 4).wordWrap(true);
+                    need = true;
+                }
+                if (items[i].data.jobContentText){
+                    sheet.getCell(i, 5).wordWrap(true);
+                    need = true;
+                }
+                if (need) sheet.autoFitRow(i);
             }
         }
     },