ソースを参照

suport 安装费用 to be continue

Xiaopeng Zhang 5 ヶ月 前
コミット
dae08f35fb
4 ファイル変更154 行追加49 行削除
  1. 15 15
      package.json
  2. 2 2
      src/App2.js
  3. 104 32
      src/Service.js
  4. 33 0
      src/utils.js

+ 15 - 15
package.json

@@ -3,25 +3,25 @@
   "version": "0.1.0",
   "private": true,
   "dependencies": {
-    "@emotion/react": "^11.14.0",
-    "@emotion/styled": "^11.14.1",
-    "@mui/icons-material": "^5.18.0",
-    "@mui/lab": "^5.0.0-alpha.75",
-    "@mui/material": "^5.5.3",
-    "@mui/x-data-grid": "^6.20.4",
-    "@testing-library/dom": "^10.4.0",
-    "@testing-library/jest-dom": "^6.6.3",
-    "@testing-library/react": "^12.0.0",
-    "@testing-library/user-event": "^13.5.0",
-    "react": "^17.0.2",
-    "react-dom": "^17.0.2",
-    "react-router": "^6.30.1",
-    "react-router-dom": "^6.30.1",
+    "@emotion/react": "11.14.0",
+    "@emotion/styled": "11.14.1",
+    "@mui/icons-material": "5.18.0",
+    "@mui/lab": "5.0.0-alpha.75",
+    "@mui/material": "5.5.3",
+    "@mui/x-data-grid": "6.20.4",
+    "@testing-library/dom": "10.4.0",
+    "@testing-library/jest-dom": "6.6.3",
+    "@testing-library/react": "12.0.0",
+    "@testing-library/user-event": "13.5.0",
+    "react": "17.0.2",
+    "react-dom": "17.0.2",
+    "react-router": "6.30.1",
+    "react-router-dom": "6.30.1",
     "react-scripts": "5.0.1",
     "rsuite": "^5.83.2",
     "serve": "^14.2.4",
     "source-map-explorer": "^2.5.3",
-    "tabulator-tables": "^6.3.1",
+    "tabulator-tables": "6.3.1",
     "web-vitals": "^2.1.4"
   },
   "scripts": {

+ 2 - 2
src/App2.js

@@ -317,7 +317,7 @@ import Tooltip from '@mui/material/Tooltip';
                                 for(let i = 0; i < keys.length; i++) {
                                     let key = keys[i];
                                     let entry = {
-                                      "id": y["DEBH"][key],
+                                      "id": y["DEBH"][key].concat("#").concat(y["GCLMC"][key]),
                                       "定额编号":  y["DEBH"][key], 
                                       "名称":  y["GCLMC"][key],
                                       "单位":  y["DW"][key],
@@ -456,7 +456,7 @@ import Tooltip from '@mui/material/Tooltip';
                 for(let i = 0; i < keys.length; i++) {
                     let key = keys[i];
                     let entry = {
-                      "id": y["DEBH"][key],
+                      "id": y["DEBH"][key].concat("#").concat(y["GCLMC"][key]),
                       "定额编号":  y["DEBH"][key], 
                       "名称":  y["GCLMC"][key],
                       "单位":  y["DW"][key],

+ 104 - 32
src/Service.js

@@ -1,4 +1,4 @@
-import {copy, danxiangdinge_index, danxiangdinge_index_djcs, renameDingE, extractFuzhu, match_target} from './utils';
+import {copy, danxiangdinge_index, danxiangdinge_index_djcs, renameDingE, extractFuzhu, match_target, azfy} from './utils';
 import { v4 as uuidv4 } from 'uuid';
 class Service{
     
@@ -15,8 +15,8 @@ class Service{
     }
     
     ip() {
-        return "/api"//return "http://127.0.0.1:8000"
-        //return "http://192.168.43.87:1313/api"
+        //return "/api"//return "http://127.0.0.1:8000"
+        return "http://192.168.31.48:1313/api"
     }
 
     clearCache() {//set qufei will clear cache
@@ -1201,13 +1201,97 @@ async generateQingdanTuijian(name, bh, bt, bm) {
 
 
     summarize_one(qd) {///根据定额汇总清单
+        qd['综合单价'] = 0;
+        qd['合价'] = 0;
+        qd['人工费'] = 0;
+        qd['主材费'] = 0;
+        qd['设备费'] = 0;
+        qd['辅材费'] = 0;
+        qd['材料费'] = 0;
+        qd['机械费'] = 0;
+        qd['管理费'] = 0;
+        qd['利润'] = 0;
+        for(let i = 0; i < qd["_children"].length; i++) {
+            if (qd["_children"][i]['清单编码'].includes("-F"))continue;
+            qd['综合单价'] += Number(qd['_children'][i]['数量']) * Number(qd['_children'][i]['综合单价']);
+            qd['合价'] += Number(qd['_children'][i]['合价']);
+            qd['人工费'] += Number(qd['_children'][i]['数量']) * Number(qd['_children'][i]['人工费']);
+            qd['主材费'] += Number(qd['_children'][i]['数量']) * Number(qd['_children'][i]['主材费']);
+            qd['设备费'] += Number(qd['_children'][i]['数量']) * Number(qd['_children'][i]['设备费']);
+            qd['辅材费'] += Number(qd['_children'][i]['数量']) * Number(qd['_children'][i]['辅材费']);
+            qd['材料费'] += Number(qd['_children'][i]['数量']) * Number(qd['_children'][i]['材料费']);
+            qd['机械费'] += Number(qd['_children'][i]['数量']) * Number(qd['_children'][i]['机械费']);
+            qd['管理费'] += Number(qd['_children'][i]['数量']) * Number(qd['_children'][i]['管理费']);
+            qd['利润'] += Number(qd['_children'][i]['数量']) * Number(qd['_children'][i]['利润']);   
+        }
+        //处理安装费用
+        console.log(qd["_children"].length);
+        for(let i = 0; i < qd["_children"].length; i++) {
+            console.log(i);
+            if (qd["_children"][i]['清单编码'].includes("-F")){
+                let tag = qd["_children"][i]['azfytag'];
+                if (tag[0] == '人工费') {
+                   let current_rgf = qd['人工费'];
+                   let added = Number(current_rgf) * Number(tag[1]) / Number(100);
+                   let added_rgf = added * Number(tag[2]) / Number(100);
+                   let added_clf = added * Number(tag[3]) / Number(100);
+                   let added_jxf = added * Number(tag[4]) / Number(100);
+                   qd["_children"][i]['人工费'] = added_rgf;
+                   qd["_children"][i]['辅材费'] = added_clf;
+                   qd["_children"][i]['材料费'] = added_clf;
+                   qd["_children"][i]['机械费'] = added_jxf;
+                   if (this.qufeiEntry['备注'].length == 0) {
+                       //changuiqufei
+                       qd["_children"][i]['管理费'] = (added_rgf + added_jxf) * Number(this.qufeiEntry['管理费(%)']) / Number(100);
+                       qd["_children"][i]['利润'] = (added_rgf + added_jxf) * Number(this.qufeiEntry['利润(%)']) / Number(100);
+                   } else {
+                       qd["_children"][i]['管理费'] = (added_rgf) * Number(this.qufeiEntry['管理费(%)']) / Number(100);
+                       qd["_children"][i]['利润'] = (added_rgf) * Number(this.qufeiEntry['利润(%)']) / Number(100);
+                   }
+                   
+                   qd["_children"][i]['综合单价'] = qd["_children"][i]['人工费'] + qd["_children"][i]['材料费'] + qd["_children"][i]['机械费'] + qd["_children"][i]['管理费'] +  qd["_children"][i]['利润'];
+                   qd["_children"][i]['合价'] = qd["_children"][i]['综合单价'] * Number(qd["_children"][i]['数量']);
+                   let dercj = qd["_children"][i]['dercj'];
+                   for (let j = 1; j < dercj.length; j++) {
+                       dercj[j][11] = Number(qd['_children'][i]['综合单价']) * Number(dercj[j][10]) / Number(100);
+                   }
+                }
+            }
+        }
+        qd['综合单价'] = 0;
+        qd['合价'] = 0;
+        qd['人工费'] = 0;
+        qd['主材费'] = 0;
+        qd['设备费'] = 0;
+        qd['辅材费'] = 0;
+        qd['材料费'] = 0;
+        qd['机械费'] = 0;
+        qd['管理费'] = 0;
+        qd['利润'] = 0;
+        for(let i = 0; i < qd["_children"].length; i++) {
+            qd['综合单价'] += Number(qd['_children'][i]['数量']) * Number(qd['_children'][i]['综合单价']);
+            qd['合价'] += Number(qd['_children'][i]['合价']);
+            qd['人工费'] += Number(qd['_children'][i]['数量']) * Number(qd['_children'][i]['人工费']);
+            qd['主材费'] += Number(qd['_children'][i]['数量']) * Number(qd['_children'][i]['主材费']);
+            qd['设备费'] += Number(qd['_children'][i]['数量']) * Number(qd['_children'][i]['设备费']);
+            qd['辅材费'] += Number(qd['_children'][i]['数量']) * Number(qd['_children'][i]['辅材费']);
+            qd['材料费'] += Number(qd['_children'][i]['数量']) * Number(qd['_children'][i]['材料费']);
+            qd['机械费'] += Number(qd['_children'][i]['数量']) * Number(qd['_children'][i]['机械费']);
+            qd['管理费'] += Number(qd['_children'][i]['数量']) * Number(qd['_children'][i]['管理费']);
+            qd['利润'] += Number(qd['_children'][i]['数量']) * Number(qd['_children'][i]['利润']);   
+        }
         let dict = {};
+        let left = [];
         for(let i = 0; i < qd["_children"].length; i++) {
             let de = qd["_children"][i];
             let desl = Number(de['数量']);
             let dercj = de['dercj'];
             for (let j = 1; j < dercj.length; j++) {
                 let hl = copy(dercj[j]);
+                if (hl[1].includes('000FE')) {
+                    left.push(hl);
+                    continue;
+                }
                 hl[10] = desl * Number(hl[10]);
                 hl[11] = desl * Number(hl[11]);
                 let a = hl[1];//"人材机编码", 
@@ -1236,6 +1320,9 @@ async generateQingdanTuijian(name, bh, bt, bm) {
              result.push(entry);
 
         }
+        for (let i = 0; i < left.length; i++) {
+            result.push(left[i]);
+        }
         let gongri = 0;
         for(let i = 0; i < result.length; i++) {
             if (result[i][4] == '工日') {
@@ -1246,29 +1333,6 @@ async generateQingdanTuijian(name, bh, bt, bm) {
         qd['rcj'] = [["ID", "人材机编码", "名称", "规格型号", "单位", "单价", "产地", 
         "供应厂商", "人材机类别", "甲供标志", "含量", "合价", "暂估价标志", "主要材料标志", "主材标志", "设备标志" ]].concat(result);
         qd["综合人工工日"] = gongri;
-        qd['综合单价'] = 0;
-        qd['合价'] = 0;
-        qd['人工费'] = 0;
-        qd['主材费'] = 0;
-        qd['设备费'] = 0;
-        qd['辅材费'] = 0;
-        qd['材料费'] = 0;
-        qd['机械费'] = 0;
-        qd['管理费'] = 0;
-        qd['利润'] = 0;
-        for(let i = 0; i < qd["_children"].length; i++) {
-            qd['综合单价'] += Number(qd['_children'][i]['数量']) * Number(qd['_children'][i]['综合单价']);
-            qd['合价'] += Number(qd['_children'][i]['合价']);
-            qd['人工费'] += Number(qd['_children'][i]['数量']) * Number(qd['_children'][i]['人工费']);
-            qd['主材费'] += Number(qd['_children'][i]['数量']) * Number(qd['_children'][i]['主材费']);
-            qd['设备费'] += Number(qd['_children'][i]['数量']) * Number(qd['_children'][i]['设备费']);
-            qd['辅材费'] += Number(qd['_children'][i]['数量']) * Number(qd['_children'][i]['辅材费']);
-            qd['材料费'] += Number(qd['_children'][i]['数量']) * Number(qd['_children'][i]['材料费']);
-            qd['机械费'] += Number(qd['_children'][i]['数量']) * Number(qd['_children'][i]['机械费']);
-            qd['管理费'] += Number(qd['_children'][i]['数量']) * Number(qd['_children'][i]['管理费']);
-            qd['利润'] += Number(qd['_children'][i]['数量']) * Number(qd['_children'][i]['利润']);   
-        }
-
         return qd;
     }
     summarize(data) {
@@ -1730,7 +1794,7 @@ async generateQingdanTuijian(name, bh, bt, bm) {
             }
             de['dercj'] = copy(data);
         }
-        de['dercj'] = de['dercj'].filter(x=>x[1] != '410000F')
+        de['dercj'] = de['dercj'].filter(x=>x[1] != '410000F')//补充
         for(let i = 0; i < rcjbc.length; i++) {
             de['dercj'].push(['', rcjbc[i]['人材机编码'], rcjbc[i]['名称'], rcjbc[i]['规格型号'], rcjbc[i]['单位'], rcjbc[i]['单价'], rcjbc[i]['产地'], rcjbc[i]['供应厂商'], rcjbc[i]['人材机类别'], rcjbc[i]['甲供标志'], rcjbc[i]['含量'], '', rcjbc[i]['暂估价标志'],rcjbc[i]['主要材料标志'],rcjbc[i]['主材标志'],rcjbc[i]['设备标志']]);
         }
@@ -1746,6 +1810,7 @@ async generateQingdanTuijian(name, bh, bt, bm) {
         let clf_sum = 0;
         let zcf_sum = 0;
         for(let i = 1; i < data.length; i++) {
+            if (data[i][1].includes('000FE'))continue;
             sum += Number(data[i][11]);//11-> hejia
             if (Number(data[i][8]) == 1) {
                 rgf_sum += Number(data[i][11]);
@@ -2129,10 +2194,15 @@ async generateQingdanTuijian(name, bh, bt, bm) {
         if (this.cache.filter(x=>x['key'] == row).length > 0) {
             this.updateFootprint(row);
             
-                let res =dingeclick;
+                let res = copy(dingeclick);
                 let keys = Object.keys(res['DEBH']);
                 let key = keys[0];
-                //console.log(res);
+                let tips = azfy(res['DEBH'][key], res['GCLMC'][key]);
+                if (tips != null) {
+                      res['rgde'] = tips['rgde'];
+                      res['clde'] = tips['clde'];
+                      res['jxde'] = tips['jxde'];
+                }
                 let qd = this.cache.filter(x=>x['key'] == row)[0];
                 let dercj = [["ID", "人材机编码", "名称", "规格型号", "单位", "单价", "产地", 
                 "供应厂商", "人材机类别", "甲供标志", "含量", "合价", "暂估价标志", "主要材料标志", "主材标志", "设备标志" ]];
@@ -2158,7 +2228,7 @@ async generateQingdanTuijian(name, bh, bt, bm) {
                     '清单编码': res['DEBH'][key],
                     '名称': res['GCLMC'][key],
                     '项目特征': null,
-                    '计算规则': null,
+                    '计算规则': tips != null ? tips['sm'] : '',
                     '单位': res['DW'][key],
                     '数量': '1',
                     '综合单价': '0',
@@ -2179,7 +2249,8 @@ async generateQingdanTuijian(name, bh, bt, bm) {
                     'key' :   newKey,
                     "fuzhuEnable": true,
                     'yuban': [],
-                    'rcjbc': []
+                    'rcjbc': [],
+                    'azfytag': tips != null ? tips['azfytag'] : []
     
                     
                 });
@@ -2235,7 +2306,8 @@ async generateQingdanTuijian(name, bh, bt, bm) {
                 'key' :   uuidv4(),
                 "fuzhuEnable": false,
                 'yuban': [],
-                'rcjbc' : []
+                'rcjbc' : [],
+                'azfytag': []
 
                 
             });

+ 33 - 0
src/utils.js

@@ -123,4 +123,37 @@ export const match_target = (input ,target) => {
     return input == target;
 };
 
+const predef = {
+    "rate": [
+    [['人工费',10,25,75,0],['人工费',5,25,75,0],['人工费',5,25,75,0],['人工费',10,25,75,0],['人工费',4,25,75,0],['人工费',4,25,75,0],['人工费',4,25,75,0],['人工费',3,25,75,0],['人工费',7,25,75,0],['人工费',5,25,75,0],['人工费',5,25,75,0],['人工费',8,25,75,0],['人工费',12,25,75,0],['人工费',20,25,75,0],['人工费',8,25,75,0], ['人工费',12,25,75,0]]
+    ],
+    "GCLMC": [
+     ["第二册第1-5章(定额2-1~2-390)", "第二册第6章(定额2-391~2-9999)", "第三册静置设备制作(定额3-1~3-615)",
+                            "第三册除静置设备制作以外(定额3-616~3-9999)", "第四册", 
+                            "第五册", "第六册", "第七册", "第八册", "第九册", "第十册",
+                              "第十一册刷油工程(定额11-51~11-329)", 
+                              "第十一册防腐蚀工程(定额11-330~11-1689)", "第十一册绝热工程(定额11-1690~11-2327)", "第十一册除锈工程(定额11-1~11-50)刷油工程", "第十一册除锈工程(定额11-1~11-50)防腐蚀工程"]
+    ],
+    "sm": [
+     ["第1-5章取人工费*10%,其中工资占25%,材料占75%", "第6章取人工费*5%,其中工资占25%,材料占75%", "静置设备制作取人工费*5%,其中工资占25%,材料占75%", "除静置设备制作以外的取人工费*10%,其中工资占25%,材料占75%", "取人工费*4%,其中工资占25%,材料占75%.10kv以下架空线路除外", "按单位工程人工费*4%计算,其中工资占25%", "取人工费*4%,其中工资占25%", "取人工费*3%,其中工资占25%,材料占75%", "取人工费*7%,其中工资占25%,注意单独承担的麦迪管道工程,不计取脚手架费用", "取人工费*5%,其中工资占25%", "取人工费*5%,其中工资占25%,材料占75%", "刷油工程取人工费*8%,其中工资占25%,材料占75%", "防腐蚀工程取人工费*12%,其中工资占25%,材料占75%", "绝热工程取人工费*20%,其中工资占25%,材料占75%", "刷油工程取人工费的8%,其中人工工资占25%", "防腐蚀工程取人工费的12%,其中人工工资占25%"]
+    ]
+};
+export const azfy = (debh, gclmc) => {
+    if (debh.includes("-F")) {
+       if (debh.includes("-F1")) {
+            let index = predef['GCLMC'][0].indexOf(gclmc);
+            let rate = predef['rate'][0][index];
+            let result = {};
+            result['rgde'] = [{'CLBH': '0000FE', 'CLMC': '人工费', 'JLDW': '%', 'YSJG': '0', 'gr': rate[2],'gf': '0' }];
+            result['clde'] = [{'CLBH': '1000FE', 'CLMC': '材料费', 'JLDW': '%', 'YSJG': '0', 'SL': rate[3],'HJ': '0' }];
+            result['jxde'] = [{'jxbh': 'J000FE', 'jxmc': '机械费', 'DW': '%', 'tbdj': '0', 'sl': rate[4], 'hj': '0' }];
+            result['sm'] = predef['sm'][0][index];
+            result['azfytag'] = rate;
+            return result;
+       }
+    } else {
+        return null;
+    }
 
+
+};