Browse Source

prepare for refactor of editor

Xiaopeng Zhang 4 months ago
parent
commit
f22d785321
5 changed files with 71 additions and 60 deletions
  1. 16 10
      README
  2. 20 3
      loadmongo.py
  3. 26 28
      main.py
  4. 5 15
      subdir/service.py
  5. 4 4
      subdir/util.py

+ 16 - 10
README

@@ -26,19 +26,18 @@ JD_PeiBiF 表很有用,它可以用来找一个材料的组成。
 
 回程费 按照百分比算的(djcs 支持) 00EXP001/31130104/99EXP007
 公式 比如 [1-274]*2 没必要支持,完全可以改数量(fixed)
-附注 小众情况还不支持Debm="17-177附注2*-1附注3*-1"
+附注 小众情况还不支持Debm="17-177附注2*-1附注3*-1"(fixed)
 材料甲供标志是有用的,这个还没处理,招标工程量清单里面会有发包人供应材料,会有编号和价格,但是数量是零,套完定额才能知道
 需要人材机汇总后一并处理下甲供材,把量拿到,把总价算好(fixed)
 
 
-钢筋工程,铁件制作,铁件安装的定额有意思5-28,额外加了型钢0.0105
-安装工程有蛮大的不同
+
 
 一个清单可以有普通定额跟单项定额,单项定额的特点是不算管理费跟利润
 
 
 有套定额直接在清单下面加材料,这个目前不支持
-然后材料替换,这个不光砂浆混凝土会换,好像有人换其他的,比如换涂料啊什么的,感觉这个换算很通用?换汽车式起重机吨位, 镀锌铁皮换压型钢板 33110701 园林要加主材 600*300*50厚五莲花花岗岩火烧面路平石
+然后材料替换,这个不光砂浆混凝土会换,好像有人换其他的,
 土建 淮补4-1 这个定额没有,土建定额的定额书应该是有问题(2003土建)
 3-9-S4 2021 市政
 安装补充,神奇的编号 110000F,  侧墙轴流风机  910000F 可燃气体探测器 燃气声光报警器 410000F 编号跟册子有关
@@ -46,13 +45,11 @@ JD_PeiBiF 表很有用,它可以用来找一个材料的组成。
 
 
 
-园林跟市政重合很多,定额识别是个问题
-前段跟后端拿定额信息需要变
-土建里头会用市政
 
-配合比表各个专业不同,我们现在是统一用的土建的,这个要改
 
-市政2-389 31130104 清单里面也会出现
+配合比表各个专业不同,我们现在是统一用的土建的,这个要改(fixed)
+
+市政2-389 31130104 清单里面也会出现 (市政的31130104需要特殊处理) 现在处理的是措施里面的回程费
 
 安装生产同时 F4
 有害环境F5
@@ -62,4 +59,13 @@ JD_PeiBiF 表很有用,它可以用来找一个材料的组成。
 关于主要材料标志,安装,修缮安装跟市政是有的,其他没有
 
 
-db.collection.createIndex({'DEBH': 'text'})
+db.collection.createIndex({'DEBH': 'text'})
+
+
+人材机表格的计算逻辑:
+1. 首先使用附注底稿,根据附注选择,完善信息
+2. 跟补充结合
+3. 根据预拌砂浆配置,计算最终数据
+人材机表格改变附注或者改变预拌砂浆配置,将使得先前的所有人为改动失效
+所以一般的编辑顺序应该是,先选择好附注跟预拌砂浆配置,之后再在view层面修改
+view层面的修改不经过底稿,完全在view层面改动,由用户负责

+ 20 - 3
loadmongo.py

@@ -35,17 +35,34 @@ def handle_jx(jx):
     result["hj"] = jx["hj"]
     return result
 
-for post in collection.find({"zhuanye": "修缮工程土建"}):
+for post in collection.find({"zhuanye": "安装"}):
     
+    if post['DEBH'].startswith('1-'):
+        continue
+    if post['DEBH'].startswith('2-'):
+        continue
+    if post['DEBH'].startswith('3-'):
+        continue
+    if post['DEBH'].startswith('4-'):
+        continue
+    if post['DEBH'].startswith('5-'):
+        continue
+    if post['DEBH'].startswith('6-'):
+        continue
+    if post['DEBH'].startswith('7-'):
+        continue
+    if post['DEBH'].startswith('8-1'):
+        continue
     
+
     
 
     print(post['DEBH'])
     
-    myquery = { "zhuanye": "修缮工程土建",
+    myquery = { "zhuanye": "安装",
                 "DEBH": post["DEBH"]
                 }
-    A1, A2, rg, jx, cl, bz_, A3 = service.getSingleDeXilie_xstj(post["DEBH"])
+    A1, A2, rg, jx, cl, bz_, A3 = service.getSingleDeXilie_az(post["DEBH"])
     if bz_:
         bz = json.loads(bz_)
         mongo_bz = []

+ 26 - 28
main.py

@@ -122,7 +122,25 @@ class UpdateZjcs(BaseModel):
     bh: str
     mc: str
     fl: str
-    
+
+class Item(BaseModel):
+    bh: str
+    bt: str
+    name: str
+class Rcj(BaseModel):
+    bh: str
+    bt: str
+    bm: str
+    name: str
+class Dercj(BaseModel):
+    bh: str
+    bt: str
+    qdbm: str
+    debm: str
+    name: str
+class Zjcs(BaseModel):
+    bh: str
+    name: str
 
 
 
@@ -227,24 +245,7 @@ async def read_qdxm2(info: InfoWithID):
     
     return await db.getQdxm(client, info.name, info.id)
 
-class Item(BaseModel):
-    bh: str
-    bt: str
-    name: str
-class Rcj(BaseModel):
-    bh: str
-    bt: str
-    bm: str
-    name: str
-class Dercj(BaseModel):
-    bh: str
-    bt: str
-    qdbm: str
-    debm: str
-    name: str
-class Zjcs(BaseModel):
-    bh: str
-    name: str
+
 
 
 @app.post("/qingdanmingxi/")
@@ -499,7 +500,7 @@ async def read_dexilie(value: int, id: str):
     #print(result)
     return result
 
-@app.get("/singledexilie2/{zhuanye}/{debh}")
+@app.get("/singledexilie2/{zhuanye}/{debh}")##debh = debh!description
 @cache(expire=86400)
 async def read_singledexilie2(zhuanye: int, debh: str):
     if debh.startswith("D") :
@@ -853,29 +854,26 @@ async def upload(file: UploadFile):
         
 @app.get("/download/{item_id}")
 async def download_file(item_id):
+    tmp = str(uuid.uuid4())
     file_path = "export/contacts.xml.b"
     # Create the root element
     root = ET.Element("JingJiBiao")
-
     # Create a sub-element
     ##TouBiaoXx = ET.SubElement(root, "TouBiaoXx")
     await db.build(client, root, item_id)
-
-    
-
     # Create the tree and write to a file
     tree = ET.ElementTree(root)
-    tree.write("export/contacts.xml", encoding="utf-8")
-    dom = MD.parse("export/contacts.xml")
+    tree.write("export/contacts.xml"+tmp, encoding="utf-8")
+    dom = MD.parse("export/contacts.xml"+tmp)
    
-    with open("export/contacts.xml.b", 'w') as f:
+    with open("export/contacts.xml.b" + tmp, 'w') as f:
         f.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n")
         content = (dom.toprettyxml(indent="  "))
         content_ = content.split("\n")
         f.write("\n".join(content_[1:]))
     
 
-    return FileResponse(file_path, media_type='application/octet-stream', filename="contacts.xml")
+    return FileResponse(file_path+tmp, media_type='application/octet-stream', filename="contacts.xml")
         
 
 

+ 5 - 15
subdir/service.py

@@ -1340,21 +1340,7 @@ def getDeXilie(value, id):
     return filtered.to_json(force_ascii=False)
 
 
-def getQufei(name):
-    if name == "0":
-        gj = pd.read_csv("de/tj/JD_PeiBi.csv")
-        return gj.to_json(force_ascii=False)
-    shu = pd.read_csv("de/tj/JD_PeiBiFLB.csv")
-    hit = shu[shu["ID"]==int(name)]
-    ##print(hit)
-    if len(hit) == 0:
-        return []
-    hit0 = hit.iloc[0]
-    index = str(hit0['pblbh'])
-    index_list = index.split(";")
-    gj = pd.read_csv("de/tj/JD_PeiBi.csv")
-    filtered = gj[gj["PBBH"].str.startswith(tuple(index_list))]
-    return filtered.to_json(force_ascii=False)
+
 
 def getPbxl(name, zhuanye):
     if name == "0":
@@ -1917,6 +1903,7 @@ def getSingleDeXilie_xstj(debh):
     detail = pd.read_csv("de/xstj/JD_CaiLiaoK.csv")
     detail = detail[detail['RcjLb'].isin([2, '2'])]
     added = detail[detail['CLBH'].isin(additional)]
+    added = added.drop_duplicates(subset=['CLBH'])
     for _, entry in added.iterrows():
         clde_ = {}
         CLBH = entry["CLBH"]
@@ -2316,6 +2303,7 @@ def getSingleDeXilie_az(debh):
     detail = pd.read_csv("de/az/JD_CaiLiaoK.csv")
     detail = detail[detail['RcjLb'].isin([2, '2'])]
     added = detail[detail['CLBH'].isin(additional)]
+    added = added.drop_duplicates(subset=['CLBH'])
     for _, entry in added.iterrows():
         clde_ = {}
         CLBH = entry["CLBH"]
@@ -2828,6 +2816,7 @@ def getSingleDeXilie_tj(debh):
     detail = pd.read_csv("de/tj/JD_CaiLiaoK.csv")
     detail = detail[detail['RcjLb'].isin([2, '2'])]
     added = detail[detail['CLBH'].isin(additional)]
+    added = added.drop_duplicates(subset=['CLBH'])
     for _, entry in added.iterrows():
         clde_ = {}
         CLBH = entry["CLBH"]
@@ -2840,6 +2829,7 @@ def getSingleDeXilie_tj(debh):
         clde_["YSJG"] = YSJG.item() if type(YSJG) == float64 else YSJG
         clde_["SL"] = 0
         clde_["HJ"] = 0
+        
         clde.append(clde_)
     detail = pd.read_csv("de/tj/JD_PeiBi.csv")
     added = detail[detail['PBBH'].isin(additional)]

+ 4 - 4
subdir/util.py

@@ -41,13 +41,13 @@ def huizongrcj_order(data):
         if '000FE' in bm and danwei == '%': ##azfy
             left.append(entry)
             continue
-        if '00EXP001' in bm and danwei == '%': ##azfy
+        if '00EXP001' in bm and danwei == '%': ##回程费
             left.append(entry)
             continue
-        if '99EXP007' in bm and danwei == '%': ##azfy
+        if '99EXP007' in bm and danwei == '%': ##回程费
             left.append(entry)
             continue
-        if '31130104' in bm and danwei == '%': ##azfy
+        if '31130104' in bm and danwei == '%': ##回程费
             left.append(entry)
             continue
         key = bm + name + danwei
@@ -178,7 +178,7 @@ def cleanBM(raw):
             tail = i
             break
         
-        if (raw[i] > '9' or raw[i] < '0') and raw[i] != '-':
+        if (raw[i] > '9' or raw[i] < '0') and raw[i] != '-' and raw[i] != '.':
             tail = i
             break
     return raw[0:tail]