|
|
@@ -1649,6 +1649,7 @@ async def applyFL(client, id, data):
|
|
|
|
|
|
async def tiaojia(client, biao_id, bh, bm, mingcheng, danwei, jiage, glf, lr, bz):
|
|
|
db = client["baojia"]
|
|
|
+ rcjhz = []
|
|
|
collection = db["qdxm"]
|
|
|
async for post in collection.find({'biao_id': biao_id, "Dwgcbh": bh}):
|
|
|
if "__children" not in post:
|
|
|
@@ -1698,14 +1699,7 @@ async def tiaojia(client, biao_id, bh, bm, mingcheng, danwei, jiage, glf, lr, bz
|
|
|
entry['综合单价'] = str(float(entry['人工费']) + float(entry['材料费']) + float(entry['机械费']) + float(entry['管理费']) + float(entry['利润']))
|
|
|
entry['合价'] = str(float(entry['综合单价']) * float(entry['数量']) * float(qdsl))
|
|
|
if hit:
|
|
|
- ##调整清单
|
|
|
- qdrcj = post['rcj']
|
|
|
- for i in range(1, len(qdrcj)):
|
|
|
- entry = qdrcj[i]
|
|
|
- if entry[1] == bm and entry[2] == mingcheng and entry[4] == danwei:
|
|
|
- entry[5] = jiage
|
|
|
- hanliang = entry[10]
|
|
|
- entry[11] = str(float(jiage) * float(hanliang))
|
|
|
+
|
|
|
post['综合单价'] = 0
|
|
|
post['合价'] = 0
|
|
|
post['人工费'] = 0
|
|
|
@@ -1788,7 +1782,23 @@ async def tiaojia(client, biao_id, bh, bm, mingcheng, danwei, jiage, glf, lr, bz
|
|
|
dercj[j][11] = float(post['__children'][i]['综合单价']) * float(dercj[j][10]) / float(100)
|
|
|
|
|
|
|
|
|
-
|
|
|
+ qdrcj = []
|
|
|
+ for i in range(len(post["__children"])):
|
|
|
+ dercj = post["__children"][i]['dercj']
|
|
|
+ sl = post["__children"][i]['数量']
|
|
|
+ for entry in dercj:
|
|
|
+ if '000FE' in entry[1] and entry[4] == '%': ##azfy
|
|
|
+ qdrcj.append(entry)
|
|
|
+ elif '00EXP001' in entry[1] and entry[4] == '%': ##回程费
|
|
|
+ qdrcj.append(entry)
|
|
|
+ elif '99EXP007' in entry[1] and entry[4] == '%': ##回程费
|
|
|
+ qdrcj.append(entry)
|
|
|
+ elif '31130104' in entry[1] and entry[4] == '%': ##回程费
|
|
|
+ qdrcj.append(entry)
|
|
|
+ elif entry[10] != '含量':
|
|
|
+ entry[10] = float(sl) * float(entry[10])
|
|
|
+ qdrcj.append(entry)
|
|
|
+ post["rcj"] = util.huizongrcj_order(qdrcj)
|
|
|
|
|
|
post['综合单价'] = 0
|
|
|
post['合价'] = 0
|
|
|
@@ -1814,6 +1824,12 @@ async def tiaojia(client, biao_id, bh, bm, mingcheng, danwei, jiage, glf, lr, bz
|
|
|
|
|
|
|
|
|
await collection.replace_one({'_id': post['_id']}, post )
|
|
|
+ async for post in collection.find({'biao_id': biao_id, "Dwgcbh": bh}, {'__children': 0}):
|
|
|
+ qdrcj = post['rcj'][1:]
|
|
|
+ for entry in qdrcj:
|
|
|
+ if entry[4] != '%':
|
|
|
+ entry[10] = float(entry[10]) * float(post['数量'])
|
|
|
+ rcjhz = rcjhz + qdrcj
|
|
|
collection = db["Djcs"]
|
|
|
async for post in collection.find({'biao_id': biao_id, "Dwgcbh": bh}):
|
|
|
if "__children" not in post:
|
|
|
@@ -1843,6 +1859,29 @@ async def tiaojia(client, biao_id, bh, bm, mingcheng, danwei, jiage, glf, lr, bz
|
|
|
elif int(rcj[8]) == 3:
|
|
|
dejxf = dejxf + float(rcj[11])
|
|
|
if hitde:
|
|
|
+ for i in range(1, len(dercj)):
|
|
|
+ rcj = dercj[i]
|
|
|
+ if rcj[1] == '00EXP001' and rcj[4] == '%':##//回程费占人工费
|
|
|
+ rcj[11] = float(rcj[10]) * dergf / float(100)
|
|
|
+ if rcj[1] == '99EXP007' and rcj[4] == '%':##//回程费占机械费
|
|
|
+ rcj[11] = float(rcj[10]) * dejxf / float(100)
|
|
|
+ if rcj[1] == '31130104' and rcj[4] == '%':##//回程费占材料费
|
|
|
+ rcj[11] = float(rcj[10]) * declf / float(100)
|
|
|
+ dergf = 0
|
|
|
+ declf = 0
|
|
|
+ dejxf = 0
|
|
|
+ for i in range(1, len(dercj)):
|
|
|
+ rcj = dercj[i]
|
|
|
+
|
|
|
+ if int(rcj[8]) == 1:
|
|
|
+ dergf = dergf + float(rcj[11])
|
|
|
+ elif int(rcj[8]) == 2:
|
|
|
+ declf = declf + float(rcj[11])
|
|
|
+ elif int(rcj[8]) == 3:
|
|
|
+ dejxf = dejxf + float(rcj[11])
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
entry['人工费'] = str(dergf)
|
|
|
entry['辅材费'] = str(declf)
|
|
|
entry['材料费'] = str(declf)
|
|
|
@@ -1859,48 +1898,65 @@ async def tiaojia(client, biao_id, bh, bm, mingcheng, danwei, jiage, glf, lr, bz
|
|
|
entry['综合单价'] = str(float(entry['人工费']) + float(entry['材料费']) + float(entry['机械费']) + float(entry['管理费']) + float(entry['利润']))
|
|
|
entry['合价'] = str(float(entry['综合单价']) * float(entry['数量']) * float(qdsl))
|
|
|
if hit:
|
|
|
- ##调整清单
|
|
|
- qdrcj = post['rcj']
|
|
|
- qdrgf = 0
|
|
|
- qdclf = 0
|
|
|
- qdjxf = 0
|
|
|
- for i in range(1, len(qdrcj)):
|
|
|
- entry = qdrcj[i]
|
|
|
- if entry[1] == bm and entry[2] == mingcheng and entry[4] == danwei:
|
|
|
- entry[5] = jiage
|
|
|
- hanliang = entry[10]
|
|
|
- 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])
|
|
|
- elif int(entry[8]) == 3:
|
|
|
- qdjxf = qdjxf + float(entry[11])
|
|
|
- post['人工费'] = str(qdrgf)
|
|
|
- post['辅材费'] = str(qdclf)
|
|
|
- post['材料费'] = str(qdclf)
|
|
|
- post['机械费'] = str(qdjxf)
|
|
|
+ qdrcj = []
|
|
|
+ for i in range(len(post["__children"])):
|
|
|
+ dercj = post["__children"][i]['dercj']
|
|
|
+ sl = post["__children"][i]['数量']
|
|
|
+ for entry in dercj:
|
|
|
+ if '000FE' in entry[1] and entry[4] == '%': ##azfy
|
|
|
+ qdrcj.append(entry)
|
|
|
+ elif '00EXP001' in entry[1] and entry[4] == '%': ##回程费
|
|
|
+ qdrcj.append(entry)
|
|
|
+ elif '99EXP007' in entry[1] and entry[4] == '%': ##回程费
|
|
|
+ qdrcj.append(entry)
|
|
|
+ elif '31130104' in entry[1] and entry[4] == '%': ##回程费
|
|
|
+ qdrcj.append(entry)
|
|
|
+ elif entry[10] != '含量':
|
|
|
+ entry[10] = float(sl) * float(entry[10])
|
|
|
+ qdrcj.append(entry)
|
|
|
+ post["rcj"] = util.huizongrcj_order(qdrcj)
|
|
|
+ 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))
|
|
|
+ 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 )
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ async for post in collection.find({'biao_id': biao_id, "Dwgcbh": bh}, {'__children': 0}):
|
|
|
+
|
|
|
+ qdrcj = post['rcj'][1:]
|
|
|
+ for entry in qdrcj:
|
|
|
+ if entry[4] != '%':
|
|
|
+ entry[10] = float(entry[10]) * float(post['数量'])
|
|
|
+ rcjhz = rcjhz + qdrcj
|
|
|
+ newHuizong = util.huizongrcj(rcjhz)
|
|
|
collection = db["Dwgc"]
|
|
|
document = await collection.find_one({'biao_id': biao_id, "Dwgcbh": bh})
|
|
|
- hz = document['rcjhz']
|
|
|
- for entry in hz:
|
|
|
- if entry[1] == bm and entry[2] == mingcheng and entry[4] == danwei:
|
|
|
- entry[6] = jiage
|
|
|
- entry[7] = float(jiage) * float(entry[5])
|
|
|
- await collection.update_one({'biao_id': biao_id, "Dwgcbh": bh}, {'$set': {'rcjhz': hz}})
|
|
|
+ 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 newHuizong
|
|
|
|
|
|
|
|
|
|