|
@@ -1656,7 +1656,7 @@ async def tiaojia(client, biao_id, bh, bm, mingcheng, danwei, jiage, glf, lr, bz
|
|
|
continue
|
|
continue
|
|
|
children = post["__children"]
|
|
children = post["__children"]
|
|
|
qdsl = post['数量']
|
|
qdsl = post['数量']
|
|
|
- hit = False
|
|
|
|
|
|
|
+ hit = False##清单级别
|
|
|
for entry in children:###对一条定额,调价
|
|
for entry in children:###对一条定额,调价
|
|
|
hitde = False
|
|
hitde = False
|
|
|
dercj = entry["dercj"]
|
|
dercj = entry["dercj"]
|
|
@@ -1672,7 +1672,7 @@ async def tiaojia(client, biao_id, bh, bm, mingcheng, danwei, jiage, glf, lr, bz
|
|
|
rcj[5] = jiage
|
|
rcj[5] = jiage
|
|
|
hanliang = rcj[10]
|
|
hanliang = rcj[10]
|
|
|
rcj[11] = str(float(jiage) * float(hanliang))
|
|
rcj[11] = str(float(jiage) * float(hanliang))
|
|
|
- if int(rcj[8]) == 1:
|
|
|
|
|
|
|
+ if int(rcj[8]) == 1:##rcjlb
|
|
|
dergf = dergf + float(rcj[11])
|
|
dergf = dergf + float(rcj[11])
|
|
|
elif int(rcj[8]) == 2:
|
|
elif int(rcj[8]) == 2:
|
|
|
declf = declf + float(rcj[11])
|
|
declf = declf + float(rcj[11])
|
|
@@ -1680,63 +1680,145 @@ async def tiaojia(client, biao_id, bh, bm, mingcheng, danwei, jiage, glf, lr, bz
|
|
|
dezcf = dezcf + float(rcj[11])
|
|
dezcf = dezcf + float(rcj[11])
|
|
|
elif int(rcj[8]) == 3:
|
|
elif int(rcj[8]) == 3:
|
|
|
dejxf = dejxf + float(rcj[11])
|
|
dejxf = dejxf + float(rcj[11])
|
|
|
- if hitde:
|
|
|
|
|
- entry['人工费'] = str(dergf)
|
|
|
|
|
- entry['辅材费'] = str(declf - dezcf)
|
|
|
|
|
- entry['主材费'] = str(dezcf)
|
|
|
|
|
- entry['材料费'] = str(declf)
|
|
|
|
|
- entry['机械费'] = str(dejxf)
|
|
|
|
|
- if bm.startswith("D"):
|
|
|
|
|
- entry['管理费'] = '0'
|
|
|
|
|
- entry['利润'] = '0'
|
|
|
|
|
- elif bz == 0:
|
|
|
|
|
- entry['管理费'] = str((dergf + dejxf) * float(glf) / float(100))
|
|
|
|
|
- entry['利润'] = str((dergf + dejxf) * float(lr) / float(100))
|
|
|
|
|
- else:
|
|
|
|
|
- entry['管理费'] = str((dergf) * float(glf) / float(100))
|
|
|
|
|
- entry['利润'] = str((dergf) * float(lr) / float(100))
|
|
|
|
|
- entry['综合单价'] = str(float(entry['人工费']) + float(entry['材料费']) + float(entry['机械费']) + float(entry['管理费']) + float(entry['利润']))
|
|
|
|
|
- entry['合价'] = str(float(entry['综合单价']) * float(entry['数量']) * float(qdsl))
|
|
|
|
|
|
|
+ if hitde:
|
|
|
|
|
+ entry['人工费'] = str(dergf)
|
|
|
|
|
+ entry['辅材费'] = str(declf - dezcf)
|
|
|
|
|
+ entry['主材费'] = str(dezcf)
|
|
|
|
|
+ entry['材料费'] = str(declf)
|
|
|
|
|
+ entry['机械费'] = str(dejxf)
|
|
|
|
|
+ if bm.startswith("D"):
|
|
|
|
|
+ entry['管理费'] = '0'
|
|
|
|
|
+ entry['利润'] = '0'
|
|
|
|
|
+ elif bz == 0:
|
|
|
|
|
+ entry['管理费'] = str((dergf + dejxf) * float(glf) / float(100))
|
|
|
|
|
+ entry['利润'] = str((dergf + dejxf) * float(lr) / float(100))
|
|
|
|
|
+ else:
|
|
|
|
|
+ entry['管理费'] = str((dergf) * float(glf) / float(100))
|
|
|
|
|
+ entry['利润'] = str((dergf) * float(lr) / float(100))
|
|
|
|
|
+ entry['综合单价'] = str(float(entry['人工费']) + float(entry['材料费']) + float(entry['机械费']) + float(entry['管理费']) + float(entry['利润']))
|
|
|
|
|
+ entry['合价'] = str(float(entry['综合单价']) * float(entry['数量']) * float(qdsl))
|
|
|
if hit:
|
|
if hit:
|
|
|
##调整清单
|
|
##调整清单
|
|
|
qdrcj = post['rcj']
|
|
qdrcj = post['rcj']
|
|
|
- qdrgf = 0
|
|
|
|
|
- qdclf = 0
|
|
|
|
|
- qdzcf = 0
|
|
|
|
|
- qdjxf = 0
|
|
|
|
|
for i in range(1, len(qdrcj)):
|
|
for i in range(1, len(qdrcj)):
|
|
|
entry = qdrcj[i]
|
|
entry = qdrcj[i]
|
|
|
if entry[1] == bm and entry[2] == mingcheng and entry[4] == danwei:
|
|
if entry[1] == bm and entry[2] == mingcheng and entry[4] == danwei:
|
|
|
entry[5] = jiage
|
|
entry[5] = jiage
|
|
|
hanliang = entry[10]
|
|
hanliang = entry[10]
|
|
|
entry[11] = str(float(jiage) * float(hanliang))
|
|
entry[11] = str(float(jiage) * float(hanliang))
|
|
|
- if int(entry[8]) == 1:
|
|
|
|
|
- qdrgf = qdrgf + float(entry[11])
|
|
|
|
|
- elif int(entry[8]) == 2:
|
|
|
|
|
- qdclf = qdclf + float(entry[11])
|
|
|
|
|
- if entry[14] == 'true':
|
|
|
|
|
- qdzcf = qdzcf + float(entry[11])
|
|
|
|
|
- elif int(entry[8]) == 3:
|
|
|
|
|
- qdjxf = qdjxf + float(entry[11])
|
|
|
|
|
- post['人工费'] = str(qdrgf)
|
|
|
|
|
- post['辅材费'] = str(qdclf - qdzcf)
|
|
|
|
|
- post['主材费'] = str(qdzcf)
|
|
|
|
|
- post['材料费'] = str(qdclf)
|
|
|
|
|
- post['机械费'] = str(qdjxf)
|
|
|
|
|
|
|
+ post['综合单价'] = 0
|
|
|
|
|
+ post['合价'] = 0
|
|
|
|
|
+ post['人工费'] = 0
|
|
|
|
|
+ post['主材费'] = 0
|
|
|
|
|
+ post['设备费'] = 0
|
|
|
|
|
+ post['辅材费'] = 0
|
|
|
|
|
+ post['材料费'] = 0
|
|
|
|
|
+ post['机械费'] = 0
|
|
|
post['管理费'] = 0
|
|
post['管理费'] = 0
|
|
|
post['利润'] = 0
|
|
post['利润'] = 0
|
|
|
- for entry in children:
|
|
|
|
|
- post['管理费'] = post['管理费'] + float(entry['管理费']) * float(entry['数量'])
|
|
|
|
|
- post['利润'] = post['利润'] + float(entry['利润']) * float(entry['数量'])
|
|
|
|
|
- post['管理费'] = str(post['管理费'])
|
|
|
|
|
- post['利润'] = str(post['利润'])
|
|
|
|
|
-
|
|
|
|
|
- post['综合单价'] = str(float(post['人工费']) + float(post['材料费']) + float(post['机械费']) + float(post['管理费']) + float(post['利润']))
|
|
|
|
|
- post['合价'] = str(float(post['综合单价']) * float(qdsl))
|
|
|
|
|
- ##print(post)
|
|
|
|
|
|
|
+ for i in range(len(post["__children"])):
|
|
|
|
|
+ if len(post["__children"][i]['azfytag']) > 0:
|
|
|
|
|
+ continue
|
|
|
|
|
+ post['综合单价'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['综合单价'])
|
|
|
|
|
+ post['合价'] += float(post['__children'][i]['合价'])
|
|
|
|
|
+ post['人工费'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['人工费'])
|
|
|
|
|
+ post['主材费'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['主材费'])
|
|
|
|
|
+ post['设备费'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['设备费'])
|
|
|
|
|
+ post['辅材费'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['辅材费'])
|
|
|
|
|
+ post['材料费'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['材料费'])
|
|
|
|
|
+ post['机械费'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['机械费'])
|
|
|
|
|
+ post['管理费'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['管理费'])
|
|
|
|
|
+ post['利润'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['利润'])
|
|
|
|
|
+
|
|
|
|
|
+ ##处理安装费用
|
|
|
|
|
+ ##console.log(qd["_children"].length);
|
|
|
|
|
+ for i in range(len(post["__children"])):
|
|
|
|
|
+ ##console.log(i);
|
|
|
|
|
+ if len(post["__children"][i]['azfytag']) > 0:
|
|
|
|
|
+ tag = post["__children"][i]['azfytag']
|
|
|
|
|
+ if tag[0] == '人工费':
|
|
|
|
|
+ current_rgf = post['人工费']
|
|
|
|
|
+ added = float(current_rgf) * float(tag[1]) / float(100)
|
|
|
|
|
+ added_rgf = added * float(tag[2]) / float(100)
|
|
|
|
|
+ added_clf = added * float(tag[3]) / float(100)
|
|
|
|
|
+ added_jxf = added * float(tag[4]) / float(100)
|
|
|
|
|
+ post["__children"][i]['人工费'] = added_rgf
|
|
|
|
|
+ post["__children"][i]['辅材费'] = added_clf
|
|
|
|
|
+ post["__children"][i]['材料费'] = added_clf
|
|
|
|
|
+ post["__children"][i]['机械费'] = added_jxf
|
|
|
|
|
+ if bz == 0:
|
|
|
|
|
+ ##changuiqufei
|
|
|
|
|
+ post["__children"][i]['管理费'] = (added_rgf + added_jxf) * float(glf) / float(100)
|
|
|
|
|
+ post["__children"][i]['利润'] = (added_rgf + added_jxf) * float(lr) / float(100)
|
|
|
|
|
+ else:
|
|
|
|
|
+ post["__children"][i]['管理费'] = (added_rgf) * float(glf) / float(100)
|
|
|
|
|
+ post["__children"][i]['利润'] = (added_rgf) * float(lr) / float(100)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ post["__children"][i]['综合单价'] = post["__children"][i]['人工费'] + post["__children"][i]['材料费'] + post["__children"][i]['机械费'] + post["__children"][i]['管理费'] + post["__children"][i]['利润']
|
|
|
|
|
+ post["__children"][i]['合价'] = post["__children"][i]['综合单价'] * float(post["__children"][i]['数量']) * float(post['数量'])
|
|
|
|
|
+ dercj = post["__children"][i]['dercj']
|
|
|
|
|
+ for j in range(1, len(dercj)):
|
|
|
|
|
+ dercj[j][11] = float(post['__children'][i]['综合单价']) * float(dercj[j][10]) / float(100)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ if tag[0] == '人工费+机械费':
|
|
|
|
|
+ current_rgf = post['人工费'] + post['机械费']
|
|
|
|
|
+ added = float(current_rgf) * float(tag[1]) / float(100)
|
|
|
|
|
+ added_rgf = added * float(tag[2]) / float(100)
|
|
|
|
|
+ added_clf = added * float(tag[3]) / float(100)
|
|
|
|
|
+ added_jxf = added * float(tag[4]) / float(100)
|
|
|
|
|
+ post["__children"][i]['人工费'] = added_rgf
|
|
|
|
|
+ post["__children"][i]['辅材费'] = added_clf
|
|
|
|
|
+ post["__children"][i]['材料费'] = added_clf
|
|
|
|
|
+ post["__children"][i]['机械费'] = added_jxf
|
|
|
|
|
+ if bz == 0:
|
|
|
|
|
+ ###changuiqufei
|
|
|
|
|
+ post["__children"][i]['管理费'] = (added_rgf + added_jxf) * float(glf) / float(100)
|
|
|
|
|
+ post["__children"][i]['利润'] = (added_rgf + added_jxf) * float(lr) / float(100)
|
|
|
|
|
+ else:
|
|
|
|
|
+ post["__children"][i]['管理费'] = (added_rgf) * float(glf) / float(100)
|
|
|
|
|
+ post["__children"][i]['利润'] = (added_rgf) * float(lr) / float(100)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ post["__children"][i]['综合单价'] = post["__children"][i]['人工费'] + post["__children"][i]['材料费'] + post["__children"][i]['机械费'] + post["__children"][i]['管理费'] + post["__children"][i]['利润']
|
|
|
|
|
+ post["__children"][i]['合价'] = post["__children"][i]['综合单价'] * float(post["__children"][i]['数量']) * float(post["数量"])
|
|
|
|
|
+ dercj = post["__children"][i]['dercj']
|
|
|
|
|
+ for j in range(1, len(dercj)):
|
|
|
|
|
+ dercj[j][11] = float(post['__children'][i]['综合单价']) * float(dercj[j][10]) / float(100)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ post['综合单价'] = 0
|
|
|
|
|
+ post['合价'] = 0
|
|
|
|
|
+ post['人工费'] = 0
|
|
|
|
|
+ post['主材费'] = 0
|
|
|
|
|
+ post['设备费'] = 0
|
|
|
|
|
+ post['辅材费'] = 0
|
|
|
|
|
+ post['材料费'] = 0
|
|
|
|
|
+ post['机械费'] = 0
|
|
|
|
|
+ post['管理费'] = 0
|
|
|
|
|
+ post['利润'] = 0
|
|
|
|
|
+ for i in range(len(post["__children"])):
|
|
|
|
|
+ post['综合单价'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['综合单价'])
|
|
|
|
|
+ post['合价'] += float(post['__children'][i]['合价'])
|
|
|
|
|
+ post['人工费'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['人工费'])
|
|
|
|
|
+ post['主材费'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['主材费'])
|
|
|
|
|
+ post['设备费'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['设备费'])
|
|
|
|
|
+ post['辅材费'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['辅材费'])
|
|
|
|
|
+ post['材料费'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['材料费'])
|
|
|
|
|
+ post['机械费'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['机械费'])
|
|
|
|
|
+ post['管理费'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['管理费'])
|
|
|
|
|
+ post['利润'] += float(post['__children'][i]['数量']) * float(post['__children'][i]['利润'])
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
await collection.replace_one({'_id': post['_id']}, post )
|
|
await collection.replace_one({'_id': post['_id']}, post )
|
|
|
collection = db["Djcs"]
|
|
collection = db["Djcs"]
|
|
|
async for post in collection.find({'biao_id': biao_id, "Dwgcbh": bh}):
|
|
async for post in collection.find({'biao_id': biao_id, "Dwgcbh": bh}):
|
|
|
|
|
+ if "__children" not in post:
|
|
|
|
|
+ ##print(post)
|
|
|
|
|
+ continue
|
|
|
children = post["__children"]
|
|
children = post["__children"]
|
|
|
qdsl = post['数量']
|
|
qdsl = post['数量']
|
|
|
hit = False
|
|
hit = False
|
|
@@ -1760,22 +1842,22 @@ async def tiaojia(client, biao_id, bh, bm, mingcheng, danwei, jiage, glf, lr, bz
|
|
|
declf = declf + float(rcj[11])
|
|
declf = declf + float(rcj[11])
|
|
|
elif int(rcj[8]) == 3:
|
|
elif int(rcj[8]) == 3:
|
|
|
dejxf = dejxf + float(rcj[11])
|
|
dejxf = dejxf + float(rcj[11])
|
|
|
- if hitde:
|
|
|
|
|
- entry['人工费'] = str(dergf)
|
|
|
|
|
- entry['辅材费'] = str(declf)
|
|
|
|
|
- entry['材料费'] = str(declf)
|
|
|
|
|
- entry['机械费'] = str(dejxf)
|
|
|
|
|
- if bm.startswith("D"):
|
|
|
|
|
- entry['管理费'] = '0'
|
|
|
|
|
- entry['利润'] = '0'
|
|
|
|
|
- elif bz == 0:
|
|
|
|
|
- entry['管理费'] = str((dergf + dejxf) * float(glf) / float(100))
|
|
|
|
|
- entry['利润'] = str((dergf + dejxf) * float(lr) / float(100))
|
|
|
|
|
- else:
|
|
|
|
|
- entry['管理费'] = str((dergf) * float(glf) / float(100))
|
|
|
|
|
- entry['利润'] = str((dergf) * float(lr) / float(100))
|
|
|
|
|
- entry['综合单价'] = str(float(entry['人工费']) + float(entry['材料费']) + float(entry['机械费']) + float(entry['管理费']) + float(entry['利润']))
|
|
|
|
|
- entry['合价'] = str(float(entry['综合单价']) * float(entry['数量']) * float(qdsl))
|
|
|
|
|
|
|
+ if hitde:
|
|
|
|
|
+ entry['人工费'] = str(dergf)
|
|
|
|
|
+ entry['辅材费'] = str(declf)
|
|
|
|
|
+ entry['材料费'] = str(declf)
|
|
|
|
|
+ entry['机械费'] = str(dejxf)
|
|
|
|
|
+ if bm.startswith("D"):
|
|
|
|
|
+ entry['管理费'] = '0'
|
|
|
|
|
+ entry['利润'] = '0'
|
|
|
|
|
+ elif bz == 0:
|
|
|
|
|
+ entry['管理费'] = str((dergf + dejxf) * float(glf) / float(100))
|
|
|
|
|
+ entry['利润'] = str((dergf + dejxf) * float(lr) / float(100))
|
|
|
|
|
+ else:
|
|
|
|
|
+ entry['管理费'] = str((dergf) * float(glf) / float(100))
|
|
|
|
|
+ entry['利润'] = str((dergf) * float(lr) / float(100))
|
|
|
|
|
+ entry['综合单价'] = str(float(entry['人工费']) + float(entry['材料费']) + float(entry['机械费']) + float(entry['管理费']) + float(entry['利润']))
|
|
|
|
|
+ entry['合价'] = str(float(entry['综合单价']) * float(entry['数量']) * float(qdsl))
|
|
|
if hit:
|
|
if hit:
|
|
|
##调整清单
|
|
##调整清单
|
|
|
qdrcj = post['rcj']
|
|
qdrcj = post['rcj']
|