Jelajahi Sumber

support 安装费用, to be continued

Xiaopeng Zhang 5 bulan lalu
induk
melakukan
1f2d49ebac
4 mengubah file dengan 139 tambahan dan 12 penghapusan
  1. 1 0
      README
  2. 75 12
      main.py
  3. 5 0
      subdir/db.py
  4. 58 0
      subdir/service.py

+ 1 - 0
README

@@ -1,3 +1,4 @@
+套定额不能套重复的定额,因为我们是以定额编码做key的
 JD_PeiBiF 表很有用,它可以用来找一个材料的组成。
 举个例子,810078NT3 是陶粒混凝土CL20,他是由中沙,水泥,陶粒组成,这个关系在JD_PeiBiF立面可以查到·
 TODO

+ 75 - 12
main.py

@@ -459,7 +459,66 @@ async def delete(r: Info):
 @app.post("/des/")
 async def read_des(r: DingeshuRequest):
     result = service.getDes(r.value)
-    #print(result)
+    if r.value == 30:
+        result.append({
+            "id": "2075",
+            "key" : "2075",
+            "value" : "2075",
+            "label" : "安装费用",
+            "title" : "安装费用",
+            "children" : [
+                {
+                "id": "2076",
+                "key" : "2076",
+                "value" : "2076",
+                "label" : "脚手架搭拆费",
+                "title" : "脚手架搭拆费",
+                "children" : []
+                },
+                {
+                "id": "2077",
+                "key" : "2077",
+                "value" : "2077",
+                "label" : "施工超高增加费",
+                "title" : "施工超高增加费",
+                "children" : []
+                },
+                {
+                "id": "2078",
+                "key" : "2078",
+                "value" : "2078",
+                "label" : "安装生产同时增加费",
+                "title" : "安装生产同时增加费",
+                "children" : []
+                },
+                {
+                "id": "2079",
+                "key" : "2079",
+                "value" : "2079",
+                "label" : "有害环境操作增加费",
+                "title" : "有害环境操作增加费",
+                "children" : []
+                },
+                {
+                "id": "2080",
+                "key" : "2080",
+                "value" : "2080",
+                "label" : "高层建筑增加费",
+                "title" : "高层建筑增加费",
+                "children" : []
+                },
+                {
+                "id": "2081",
+                "key" : "2081",
+                "value" : "2081",
+                "label" : "系统调试费",
+                "title" : "系统调试费",
+                "children" : []
+                },
+
+            ]
+
+        })
     return result
 
 @app.post("/pbs/")
@@ -487,6 +546,8 @@ async def read_qufei(r: Info):
 
 @app.post("/dexilie/")
 async def read_dexilie(r: DingeXilieRequest):
+    if r.value == 30 and int(r.id) > 2074:
+        return service.getDeXilie_azfy(r.value, r.id)
     result = service.getDeXilie(r.value, r.id)
     #print(result)
     return result
@@ -503,8 +564,10 @@ async def read_singledexilie(r: SingleDingeXilieRequest):
             "bz_selected": {"BZBH": {}},
             "bz_selected2": {"BZBH": {}}
         }, ensure_ascii=False)
-    
-    result1, result2, rgde, jxde, clde, bz_selected, bz_selected2, actual_zhuanye= service.getSingleDeXilie(r.zhuanye, r.debh)
+    if "-F" in r.debh:
+        return service.read_singledexilie_azfy(r.debh)
+    r_debh = r.debh.split("#")[0]
+    result1, result2, rgde, jxde, clde, bz_selected, bz_selected2, actual_zhuanye= service.getSingleDeXilie(r.zhuanye, r_debh)
     print("get result ***************************************")
     if result1:
         result3 = json.loads(result1)
@@ -523,13 +586,13 @@ async def read_singledexilie(r: SingleDingeXilieRequest):
         result3["bz_selected2"] = json.loads(bz_selected2)
     else:
         result3["bz_selected2"] = {"BZBH": {}}
-    if "[" in r.debh:
-        position3 = r.debh.find("*")
+    if "[" in r_debh:
+        position3 = r_debh.find("*")
         coef = 1
         if position3 == -1:
             pass
         else:
-            coef = r.debh[1 + position3:]
+            coef = r_debh[1 + position3:]
             print(coef)
             tail = 0
             for i in range(0, len(coef) + 1):
@@ -545,21 +608,21 @@ async def read_singledexilie(r: SingleDingeXilieRequest):
                 return json.dumps(result3, ensure_ascii=False)
             coef = int(coef[0:tail])
 
-        position1 = r.debh.find("[")
-        position2 = r.debh.find("]")
+        position1 = r_debh.find("[")
+        position2 = r_debh.find("]")
         if position2 == -1:
             print("1121111")
             result3["reverse"] = 'None'
             return json.dumps(result3, ensure_ascii=False)
-        if r.debh[position1-1] == "+":
+        if r_debh[position1-1] == "+":
             pass
-        elif r.debh[position1-1] == "-":
+        elif r_debh[position1-1] == "-":
             coef = -coef
         else:
             print("111111")
             result3["reverse"] = 'None'
             return json.dumps(result3, ensure_ascii=False)
-        debh = r.debh[position1+1: position2]
+        debh = r_debh[position1+1: position2]
         if result3['GLDE']: ##csv文件里的字段,表示这个定额有没有配套的增减定额
             hit = False
             for key, value in result3['GLDE'].items():
@@ -582,7 +645,7 @@ async def read_singledexilie(r: SingleDingeXilieRequest):
             item_ = None
             for item in result3['DW'].keys():
                 item_ = item
-            result3['DEBH'] = {item_: util.cleanBM(r.debh)}
+            result3['DEBH'] = {item_: util.cleanBM(r_debh)}
         else:
             result3["reverse"] = 'None'
         

+ 5 - 0
subdir/db.py

@@ -556,6 +556,11 @@ async def resolve(data, client):
                         child['fuzhuEnable'] = False
                         child['yuban'] = []
                         child['rcjbc'] = []
+                        if '-F' in child['清单编码']:
+                            #######TODO########
+                            child['azfytag'] = ['人工费', 10, 100, 0, 0]
+                            if '11-F2' in child['清单编码'] or '1-F2' in child['清单编码']:
+                                child['azfytag'] = ['人工费+机械费', 10, 100, 0, 0]
                 await collection.insert_one(qd)
             
 

+ 58 - 0
subdir/service.py

@@ -2,6 +2,7 @@ import xml.etree.ElementTree as ET
 from typing import Union
 from fastapi import FastAPI
 import os
+import json
 import uuid
 import re
 from fastapi.middleware.cors import CORSMiddleware
@@ -1087,6 +1088,63 @@ def getPbs(value):
     length = len(shu)
     return processPbs(shu, 0, length, 1)
 
+
+def read_singledexilie_azfy(debh):
+    id = "None"
+    if "-F1" in debh:
+        id = "2076"
+    elif "-F2" in debh:
+        id = "2077"
+    elif "-F3" in debh:
+        id = "2078"
+    elif "-F4" in debh:
+        id = "2079"
+    elif "-F5" in debh:
+        id = "2080"
+    elif "-F6" in debh:
+        id = "2081"
+    r_debh = debh.split("#")[0]
+    if len(debh.split("#")) == 1:
+        return json.dumps({
+            "reverse": "None", 
+            "rgde": [],
+            "jxde": [],
+            "clde": [],
+            "actual_zhuanye": 30,
+            "bz_selected": {"BZBH": {}},
+            "bz_selected2": {"BZBH": {}}
+        }, ensure_ascii=False)
+    gclmc = debh.split("#")[1]
+        
+    return json.dumps({
+            "reverse": id, 
+            "DEBH": {"111": r_debh},
+            "GCLMC": {"111": gclmc},
+            "DW": {"111": '项'},
+            "rgde": [],
+            "jxde": [],
+            "clde": [],
+            "actual_zhuanye": 30,
+            "bz_selected": {"BZBH": {}},
+            "bz_selected2": {"BZBH": {}}
+        }, ensure_ascii=False)
+
+def getDeXilie_azfy(value, id):
+    if int(id) == 2075:
+        return "{\"Unnamed: 0\":{},\"id\":{},\"DEBH\":{},\"GCLMC\":{},\"GCLGG\":{},\"GCLRGR\":{},\"GCLCLF\":{},\"GCLJXF\":{},\"GCLRGF\":{},\"GCLGLF\":{},\"GLFFL\":{},\"GCLLR\":{},\"LRFL\":{},\"PBSL\":{},\"GCLJJ\":{},\"GCLSJDJ\":{},\"PBBH\":{},\"GCPBHJ\":{},\"DW\":{},\"PBDJ\":{},\"PBBHM\":{},\"GCLCLF1\":{},\"THMC\":{},\"YSDELBH\":{},\"THSL\":{},\"GLDE\":{},\"BZBH\":{},\"rglxh\":{},\"zhxs\":{},\"zmsm\":{},\"is_lock\":{},\"dejb\":{},\"sptfl\":{},\"work\":{},\"zhiyin\":{},\"qfbz\":{},\"ischaogao\":{},\"zmlx\":{},\"BH1\":{},\"BH2\":{},\"mcxz\":{},\"DeId\":{}}"
+    if int(id) == 2076:
+        data = {'DW': ['项', '项', '项', '项', '项', '项', '项', '项', "项", "项", "项", "项", "项", "项", "项", "项"], 
+                'DEBH': ['2-F1', '2-F1', '3-F1', '3-F1', '4-F1',
+                         '5-F1', '6-F1', '7-F1', '8-F1', '9-F1', '10-F1', '11-F1', '11-F1', '11-F1', '11-F1', '11-F1'],
+                 "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)防腐蚀工程"],
+                   "GCLSJDJ": ["0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"]}
+        df = pd.DataFrame(data)
+        return df.to_json(force_ascii=False)
+
 def getDeXilie(value, id):
     print(type(id))
     if value == 10: