|
|
@@ -332,7 +332,8 @@ async def resolve(manager, websocket, data, client):
|
|
|
Dxgcxx["Dwgc"].append(Dwgcxx)
|
|
|
jingjibiao["Dxgcxx"].append(Dxgcxx)
|
|
|
|
|
|
-
|
|
|
+ if not 'TouBiaoXx' in jingjibiao:
|
|
|
+ jingjibiao['TouBiaoXx'] = {'Tbzj' : '', 'Zgj' : '', 'Aqwmf' : '', 'Gf' : '' }
|
|
|
db = client["baojia"]
|
|
|
collection = db["jingjibiao"]
|
|
|
biao_id = (await collection.insert_one(jingjibiao)).inserted_id
|
|
|
@@ -508,17 +509,25 @@ async def getDetail(client, id):
|
|
|
collection = db["jingjibiao"]
|
|
|
document = await collection.find_one({'_id': ObjectId(id)})
|
|
|
result = []
|
|
|
- result.append(["名称", "金额", "暂估价", "安全文明施工费", "规费"])
|
|
|
+ ##result.append(["名称", "金额", "暂估价", "安全文明施工费", "规费"])
|
|
|
if 'TouBiaoXx' in document:
|
|
|
toubiaoxx = document["TouBiaoXx"]
|
|
|
- result.append([toubiaoxx["Zbr"], toubiaoxx["Tbzj"], toubiaoxx["Zgj"], toubiaoxx["Aqwmf"], toubiaoxx["Gf"]])
|
|
|
+ result.append({'名称': '投标总价', '金额' : toubiaoxx["Tbzj"], '暂估价': toubiaoxx["Zgj"], '安全文明施工费': toubiaoxx["Aqwmf"], '规费' : toubiaoxx["Gf"], '_children': []})
|
|
|
|
|
|
- if 'Dxgcxx' in document:
|
|
|
- Dxgcxx = document["Dxgcxx"]
|
|
|
- for dxgc in Dxgcxx:
|
|
|
+ if 'Dxgcxx' in document:
|
|
|
+ Dxgcxx = document["Dxgcxx"]
|
|
|
+ for dxgc in Dxgcxx:
|
|
|
|
|
|
- result.append([dxgc["Dxgcmc"], dxgc["Je"], dxgc["Zgj"], dxgc["Aqwmf"], dxgc["Gf"]])
|
|
|
- return result
|
|
|
+ result[0]['_children'].append({'名称' :dxgc["Dxgcmc"], '金额' : dxgc["Je"], '暂估价' : dxgc["Zgj"],'安全文明施工费' : dxgc["Aqwmf"], '规费' : dxgc["Gf"]})
|
|
|
+ return result
|
|
|
+ else:
|
|
|
+ if 'Dxgcxx' in document:
|
|
|
+ Dxgcxx = document["Dxgcxx"]
|
|
|
+ for dxgc in Dxgcxx:
|
|
|
+
|
|
|
+ result.append({'名称' :dxgc["Dxgcmc"], '金额' : dxgc["Je"], '暂估价' : dxgc["Zgj"],'安全文明施工费' : dxgc["Aqwmf"], '规费' : dxgc["Gf"]})
|
|
|
+ return result
|
|
|
+
|
|
|
|
|
|
async def getBjhz(client, objectid, id):
|
|
|
db = client["baojia"]
|
|
|
@@ -782,6 +791,7 @@ async def save(client, data):
|
|
|
collection = db["Dwgc"]
|
|
|
await collection.update_one({'biao_id': biao_id, 'Dwgcbh': bh}, {'$set': {'rcjhz' : newHuizong}})
|
|
|
await zongjiaDwgc(client, biao_id, bh)
|
|
|
+ await tbxx(client, biao_id)
|
|
|
return {"result": "ok"}
|
|
|
|
|
|
async def savedjcs(client, data):
|
|
|
@@ -815,6 +825,7 @@ async def savedjcs(client, data):
|
|
|
collection = db["Dwgc"]
|
|
|
await collection.update_one({'biao_id': biao_id, 'Dwgcbh': bh}, {'$set': {'rcjhz' : newHuizong}})
|
|
|
await zongjiaDwgc(client, biao_id, bh)
|
|
|
+ await tbxx(client, biao_id)
|
|
|
return {"result": "ok"}
|
|
|
|
|
|
async def applyFL(client, id, data):
|
|
|
@@ -935,7 +946,7 @@ async def applyFL(client, id, data):
|
|
|
for dwgc in dxgc["children"]:
|
|
|
bh = dwgc['key']
|
|
|
await zongjiaDwgc(client, id, bh)
|
|
|
-
|
|
|
+ await tbxx(client, id)
|
|
|
return {"result": "ok"}
|
|
|
|
|
|
|
|
|
@@ -1103,6 +1114,7 @@ async def tiaojia(client, biao_id, bh, bm, mingcheng, danwei, jiage, glf, lr, bz
|
|
|
entry[7] = float(jiage) * float(entry[5])
|
|
|
await collection.update_one({'biao_id': biao_id, "Dwgcbh": bh}, {'$set': {'rcjhz': hz}})
|
|
|
await zongjiaDwgc(client, biao_id, bh)
|
|
|
+ await tbxx(client, biao_id)
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1137,9 +1149,61 @@ def bjhz_template():
|
|
|
|
|
|
|
|
|
|
|
|
+async def tbxx(client, biao_id):
|
|
|
+ db = client["baojia"]
|
|
|
+ collection = db["jingjibiao"]
|
|
|
+ document = await collection.find_one({'_id': ObjectId(biao_id)})
|
|
|
+ dxgcxx = document['Dxgcxx']
|
|
|
+ tbxx = document['TouBiaoXx']
|
|
|
+ tbxx['Tbzj'] = '0'
|
|
|
+ tbxx['Zgj'] = '0'
|
|
|
+ tbxx['Aqwmf'] = '0'
|
|
|
+ tbxx['Gf'] = '0'
|
|
|
+
|
|
|
+ dwdx = {}##单位工程映射单项工程
|
|
|
+ for dxgc in dxgcxx:
|
|
|
+ dxgc['Aqwmf'] = '0'
|
|
|
+ dxgc['Gf'] = '0'
|
|
|
+ dxgc['Je'] = '0'
|
|
|
+ dxgc['Zgj'] = '0'
|
|
|
+ mc = dxgc['Dxgcmc']
|
|
|
+ Dwgc = dxgc['Dwgc']
|
|
|
+ for dwgc in Dwgc:
|
|
|
+ Dwgcbh = dwgc['Dwgcbh']
|
|
|
+ dwdx[Dwgcbh] = dxgc
|
|
|
+ collection = db['Dwgc']
|
|
|
+ async for post in collection.find({'biao_id': biao_id}):
|
|
|
+ bh = post['Dwgcbh']
|
|
|
+ dx = dwdx[bh]
|
|
|
+ bjhz = post['bjhz']
|
|
|
+ qtxm = post['qtxm']
|
|
|
+ dx['Aqwmf'] = str(float(dx['Aqwmf']) + float(bjhz[1]['__children'][1]['__children'][0]['金额']))
|
|
|
+ dx['Gf'] = str(float(dx['Gf']) + float(bjhz[3]['金额']))
|
|
|
+ dx['Je'] = str(float(dx['Je']) + float(bjhz[5]['金额']))
|
|
|
+ dx['Zgj']= str(float(dx['Zgj']) + float(qtxm[1]['金额']))
|
|
|
+ for dxgc in dxgcxx:
|
|
|
+ tbxx['Tbzj'] = str(float(tbxx['Tbzj']) + float(dxgc['Je']))
|
|
|
+ tbxx['Zgj'] = str(float(tbxx['Zgj']) + float(dxgc['Zgj']))
|
|
|
+ tbxx['Aqwmf'] = str(float(tbxx['Aqwmf']) + float(dxgc['Aqwmf']))
|
|
|
+ tbxx['Gf'] = str(float(tbxx['Gf']) + float(dxgc['Gf']))
|
|
|
+ collection = db["jingjibiao"]
|
|
|
+
|
|
|
+
|
|
|
+ await collection.update_one({'_id': ObjectId(biao_id)}, {'$set': {'Dxgcxx': dxgcxx, 'TouBiaoXx' : tbxx}})
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
async def zongjiaDwgc(client, biao_id, bh):
|
|
|
db = client["baojia"]
|
|
|
collection = db["qdxm"]
|
|
|
@@ -1185,7 +1249,7 @@ async def zongjiaDwgc(client, biao_id, bh):
|
|
|
zjcs_sum = 0
|
|
|
for entry in result:
|
|
|
zjcs_sum = zjcs_sum + float(entry['金额'])
|
|
|
- qtxm = document['qtxm']
|
|
|
+ qtxm = document['qtxm']##dwgc qtxm
|
|
|
qtxm_sum = 0
|
|
|
for entry in qtxm:
|
|
|
qtxm_sum = qtxm_sum + float(entry['金额'])
|
|
|
@@ -1232,7 +1296,7 @@ async def zongjiaDwgc(client, biao_id, bh):
|
|
|
zygczgj = child['金额']
|
|
|
if child['序号'] == '2.1':
|
|
|
clzgj = child['金额']
|
|
|
- qtxm_sum = zlje + zygczgj + jrg + zcbfwf + clzgj
|
|
|
+ qtxm_sum = float(zlje) + float(zygczgj) + float(jrg) + float(zcbfwf) + float(clzgj)
|
|
|
|
|
|
|
|
|
|