Ver Fonte

finish anzhuang

997842115 há 3 dias atrás
pai
commit
d2c3ef7f1d
13 ficheiros alterados com 564 adições e 39 exclusões
  1. 102 0
      Service.js
  2. 12 0
      anzhuangjsj.py
  3. 0 0
      az_basic_rule
  4. 0 0
      basic_rule
  5. 40 0
      buchong.py
  6. 243 0
      feiyong.py
  7. 1 1
      huansuan.py
  8. 3 0
      postprocess.py
  9. 6 0
      postprocess0307.py
  10. 6 2
      postprocess0308.py
  11. 38 2
      server.js
  12. 36 29
      tasks.py
  13. 77 5
      tihuan_az.py

+ 102 - 0
Service.js

@@ -1846,6 +1846,108 @@ class Service{
 
     }
 
+    azfy_mock(row, dinge, selected) {
+        let res = JSON.parse(dinge);
+        let keys = Object.keys(res['DEBH']);
+        let key = keys[0];
+        let tips = null;
+        if (res['actual_zhuanye'] == 30) {
+            tips = azfy(res['DEBH'][key], res['GCLMC'][key]);
+        }
+        if (res['actual_zhuanye'] == 60) {
+            tips = xsazfy(res['DEBH'][key], res['GCLMC'][key]);
+        }
+        if (res['actual_zhuanye'] == 10) {
+            tips = tjazfy(res['DEBH'][key], res['GCLMC'][key]);
+        }
+
+
+        if (tips != null) {
+            res['rgde'] = tips['rgde'];
+            res['clde'] = tips['clde'];
+            res['jxde'] = tips['jxde'];
+            res['azfytag'] = tips['azfytag'];
+        }
+        let qd = this.cache.filter(x=>x['key'] == row)[0];
+        let dercj = [["ID", "人材机编码", "名称", "规格型号", "单位", "单价", "产地", 
+                "供应厂商", "人材机类别", "甲供标志", "含量", "合价", "暂估价标志", "主要材料标志", "主材标志", "设备标志", 'key', 'bc' ]];
+        for(let i = 0; i < selected.length; i++) {
+            let rgf = selected[i]['人工费'];
+            let clf = selected[i]['材料费'];
+            let jxf = selected[i]['机械费'];
+            let sl = selected[i]['数量'];
+            if (res['azfytag'][0] == '人工费') {
+                let sum = Number(sl) * Number(rgf) * Number(res['azfytag'][1]) / Number(100);
+                dercj.push(['', res['rgde'][0]['CLBH'], res['rgde'][0]['CLMC'], '', '元', 
+                    '1', '', '', '1', '', Number(sum) * Number(res['azfytag'][2]) / Number(100), Number(sum) * Number(res['azfytag'][2]) / Number(100),
+                    '', '', '', '', uuidv4(), '' ]);
+                dercj.push(['', res['clde'][0]['CLBH'], res['clde'][0]['CLMC'], '', '元', 
+                    '1', '', '', '2', '', Number(sum) * Number(res['azfytag'][3]) / Number(100), Number(sum) * Number(res['azfytag'][3]) / Number(100),
+                    '', '', '', '', uuidv4(), '' ]);
+                dercj.push(['', res['jxde'][0]['jxbh'], res['jxde'][0]['jxmc'], '', '元', 
+                    '1', '', '', '3', '', Number(sum) * Number(res['azfytag'][4]) / Number(100), Number(sum) * Number(res['azfytag'][4]) / Number(100),
+                    '', '', '', '', uuidv4(), '' ]);
+            } else if (res['azfytag'][0] == '人工费+机械费') {
+                let sum = Number(sl) * (Number(jxf) + Number(rgf)) * Number(res['azfytag'][1]) / Number(100);
+                dercj.push(['', res['rgde'][0]['CLBH'], res['rgde'][0]['CLMC'], '', '元', 
+                    '1', '', '', '1', '', Number(sum) * Number(res['azfytag'][2]) / Number(100), Number(sum) * Number(res['azfytag'][2]) / Number(100),
+                    '', '', '', '', uuidv4(), '' ]);
+                dercj.push(['', res['clde'][0]['CLBH'], res['clde'][0]['CLMC'], '', '元', 
+                    '1', '', '', '2', '', Number(sum) * Number(res['azfytag'][3]) / Number(100), Number(sum) * Number(res['azfytag'][3]) / Number(100),
+                    '', '', '', '', uuidv4(), '' ]);
+                dercj.push(['', res['jxde'][0]['jxbh'], res['jxde'][0]['jxmc'], '', '元', 
+                    '1', '', '', '3', '', Number(sum) * Number(res['azfytag'][4]) / Number(100), Number(sum) * Number(res['azfytag'][4]) / Number(100),
+                    '', '', '', '', uuidv4(), '' ]);
+
+            }
+        }
+
+        let newKey = uuidv4();
+        if (!qd.hasOwnProperty('_children')) {
+            qd["_children"] = [];
+        }
+        qd["_children"].push({
+                    '操作': '',
+                    '序号': null,
+                    '清单编码': res['DEBH'][key],
+                    '名称': res['GCLMC'][key],
+                    '项目特征': null,
+                    '计算规则': tips != null ? tips['sm'] : '',
+                    '单位': res['DW'][key],
+                    '数量': '1',
+                    '综合单价': '0',
+                    '合价': '0',
+                    '人工费': '0',
+                    '主材费': '0',
+                    '设备费': '0',
+                    '辅材费': '0',
+                    '材料费': '0',
+                    '机械费': '0',
+                    '管理费': '0',
+                    '利润': '0',
+                    '暂估价': null,
+                    '综合人工工日': null,
+                    '备注': null,
+                    "dercj": dercj,
+                    'rcjdg': dercj.map(x=>[x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7], x[8], x[9], x[10], x[11], x[12], x[13], x[14], x[15], x[16], x[17]]),
+                    'key' :   newKey,
+                    "fuzhuEnable": false,
+                    'yuban': [],
+                    'rcjbc': [],
+                    'azfytag': []
+    
+                    
+        });
+
+        this.updateDercj_(newKey, dercj, [], [], [], 1);
+        //this.updateDercj_(newKey, dercj, []);
+        let summarized = this.summarize(this.cache);
+        this.push_op(copy(summarized));
+        this.cache = copy(summarized);
+                
+        return [true, copy(this.cache), newKey];
+
+    }
     azfy_djcs(row, dinge, selected) {
         let res = JSON.parse(dinge);
         let keys = Object.keys(res['DEBH']);

+ 12 - 0
anzhuangjsj.py

@@ -0,0 +1,12 @@
+def anzhuangjsj(name, bh, collection):
+    print("anzhuangjsj")
+    query = {'biao_id': name, 'Dwgcbh': bh}
+    projection={'__children': 0, 'rcj': 0, '计算规则': 0, '管理费': 0, '利润': 0, '暂估价': 0, '备注': 0, '综合人工工日': 0, '操作': 0, '设备费': 0, '序号': 0, '综合单价': 0, '合价': 0, '主材费': 0 ,'辅材费': 0, 'DogNum': 0, 'user': 0}
+    matching = collection.find(query, projection)
+    result = []
+    for entry in matching:
+        del entry['_id']
+        result.append(entry)
+    return result
+        
+

Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
az_basic_rule


Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
basic_rule


+ 40 - 0
buchong.py

@@ -42,8 +42,48 @@ def need_buchong(debm, tz, aiclient):
         return not only(tz, aiclient)
     if debm in ['6-'+str(x) for x in range(64,92)]:
         return not only(tz, aiclient)
+    if debm in ['7-'+str(x) for x in range(298,324)]:
+        return not only(tz, aiclient)
+    if debm in ['7-'+str(x) for x in range(378,420)]:
+        return not only(tz, aiclient)
     return False
 def buchong_cailiao(aiclient, debm, tz):
+    if debm in ['7-'+str(x) for x in range(378,420)]:
+        bh = '710000F'
+        completion = aiclient.chat.completions.create(
+        model="glm-4.5-air",
+        messages=[
+            {"role": "system", "content": "You are a helpful assistant."},
+        {"role": "user", "content": "给定一段文字,请抽取出风口的关键信息并返回。"+'''
+              例如,给定文字如下:
+              1、名称:防雨百叶风口
+              2、规格:400*400
+              你应该返回 "防雨百叶风口400*400"
+
+        ''' + '现在给定文字如下:'+tz+"\n请返回结果"},
+        ],
+        extra_body={"thinking": {"type": "disabled"}},
+        )
+        mc = completion.choices[0].message.content
+        print(mc)
+    if debm in ['7-'+str(x) for x in range(298,324)]:
+        bh = '710000F'
+        completion = aiclient.chat.completions.create(
+        model="glm-4.5-air",
+        messages=[
+            {"role": "system", "content": "You are a helpful assistant."},
+        {"role": "user", "content": "给定一段文字,请抽取出阀门的关键信息并返回。"+'''
+              例如,给定文字如下:
+              1、名称:对开多叶调节阀
+              2、规格:320*320
+              你应该返回    "对开多叶调节阀320*320"
+
+        ''' + '现在给定文字如下:'+tz+"\n请返回结果"},
+        ],
+        extra_body={"thinking": {"type": "disabled"}},
+        )
+        mc = completion.choices[0].message.content
+        print(mc)
     if debm in ['6-'+str(x) for x in range(64,92)]:
         bh = '610000F'
         completion = aiclient.chat.completions.create(

+ 243 - 0
feiyong.py

@@ -0,0 +1,243 @@
+import time
+from fallback import fallback
+from config import simplemodel
+from template import xuanxiang
+from fallback import fallback
+chaogao9=['5m以上到8m以内', '8-12m', '12-16m', '16-20m']
+chaogao10=['3.6m以上到8m以内', '8-12m', '12-16m', '16-20m']
+chaogao11=['6到20m以内', '20-30m', '30-40m', '40-50m', '50-60m', '60-70m', '70-80m','80m以上']
+def select_chaogao_11(
+       B, #data
+       aiclient,
+             qwclient,
+              sfclient
+             ):
+    options=[]
+    letters = "ABCDEFGHIJKLMN"
+    for i in range(len(chaogao11)):
+        options.append("给定选项" + letters[i]+",内容为"+chaogao11[i] )
+
+    completion = aiclient.chat.completions.create(
+        model="glm-4.5-air",
+        #model="THUDM/GLM-Z1-9B-0414",
+        #model="ernie-speed-128k",
+        messages=[
+            {"role": "system", "content": "You are a helpful assistant."},
+            {"role": "user", "content": "超高指的是操作物高度距离楼地面6m以上的工程."},
+            {"role": "user", "content": "问题描述: 给定一段含有超高工作的内容: " + B['label'] + " " +  B['mc'] + " " + B['tz'] +  ",".join(options) + "。请选择最合适的选项,并返回字母代号,例如,返回 A。如果内容中没有明确高度,请返回A"},
+        ],
+        extra_body={"thinking": {"type": "disabled"}},
+        #extra_body={"enable_thinking": True},
+        #stream=True
+    )
+    json_string = completion.choices[0].message.content
+    print(json_string)
+    if len([x for x in json_string if x != ',' and x != '[' and x != ']' and x != ' ' and (x < 'A' or x > 'M')]) < 5:
+        answer=[]
+        if 'A' in json_string and len(chaogao11) > 0:
+            answer.append('A')
+        if 'B' in json_string and len(chaogao11) > 1:
+            answer.append('B')
+        if 'C' in json_string and len(chaogao11) > 2:
+            answer.append('C')
+        if 'D' in json_string and len(chaogao11) > 3:
+            answer.append('D')
+        if 'E' in json_string and len(chaogao11) > 4:
+            answer.append('E')
+        if 'F' in json_string and len(chaogao11) > 5:
+            answer.append('F')
+        if 'G' in json_string and len(chaogao11) > 6:
+            answer.append('G')
+        if 'H' in json_string and len(chaogao11) > 7:
+            answer.append('H')
+        return answer
+    completion = sfclient.chat.completions.create(
+        #model="glm-4.5-flash",
+        model=simplemodel(),
+        messages=xuanxiang(json_string),
+        extra_body={"thinking": {"type": "disabled"}},
+        #extra_body={"enable_thinking": False},
+    )
+    json_string = completion.choices[0].message.content
+    print(json_string)
+    answer=[]
+    if 'A' in json_string and len(chaogao11) > 0:
+        answer.append('A')
+    if 'B' in json_string and len(chaogao11) > 1:
+        answer.append('B')
+    if 'C' in json_string and len(chaogao11) > 2:
+        answer.append('C')
+    if 'D' in json_string and len(chaogao11) > 3:
+        answer.append('D')
+    if 'E' in json_string and len(chaogao11) > 4:
+        answer.append('E')
+    if 'F' in json_string and len(chaogao11) > 5:
+        answer.append('F')
+    if 'G' in json_string and len(chaogao11) > 6:
+        answer.append('G')
+    if 'H' in json_string and len(chaogao11) > 7:
+        answer.append('H')
+    
+    return answer
+def select_chaogao_10(
+       B, #data
+       aiclient,
+             qwclient,
+              sfclient
+             ):
+    options=[]
+    letters = "ABCDEFGHIJKLMN"
+    for i in range(len(chaogao10)):
+        options.append("给定选项" + letters[i]+",内容为"+chaogao10[i] )
+
+    completion = aiclient.chat.completions.create(
+        model="glm-4.5-air",
+        #model="THUDM/GLM-Z1-9B-0414",
+        #model="ernie-speed-128k",
+        messages=[
+            {"role": "system", "content": "You are a helpful assistant."},
+            {"role": "user", "content": "超高指的是操作物高度距离楼地面3.6m以上的工程."},
+            {"role": "user", "content": "问题描述: 给定一段含有超高工作的内容: " + B['label'] + " " +  B['mc'] + " " + B['tz'] +  ",".join(options) + "。请选择最合适的选项,并返回字母代号,例如,返回 A。如果内容中没有明确高度,请返回A"},
+        ],
+        extra_body={"thinking": {"type": "disabled"}},
+        #extra_body={"enable_thinking": True},
+        #stream=True
+    )
+    json_string = completion.choices[0].message.content
+    print(json_string)
+    if len([x for x in json_string if x != ',' and x != '[' and x != ']' and x != ' ' and (x < 'A' or x > 'M')]) < 5:
+        answer=[]
+        if 'A' in json_string and len(chaogao10) > 0:
+            answer.append('A')
+        if 'B' in json_string and len(chaogao10) > 1:
+            answer.append('B')
+        if 'C' in json_string and len(chaogao10) > 2:
+            answer.append('C')
+        if 'D' in json_string and len(chaogao10) > 3:
+            answer.append('D')
+        return answer
+    completion = sfclient.chat.completions.create(
+        #model="glm-4.5-flash",
+        model=simplemodel(),
+        messages=xuanxiang(json_string),
+        extra_body={"thinking": {"type": "disabled"}},
+        #extra_body={"enable_thinking": False},
+    )
+    json_string = completion.choices[0].message.content
+    print(json_string)
+    answer=[]
+    if 'A' in json_string and len(chaogao10) > 0:
+        answer.append('A')
+    if 'B' in json_string and len(chaogao10) > 1:
+        answer.append('B')
+    if 'C' in json_string and len(chaogao10) > 2:
+        answer.append('C')
+    if 'D' in json_string and len(chaogao10) > 3:
+        answer.append('D')
+    
+    return answer
+def select_chaogao_9(
+       B, #data
+       aiclient,
+             qwclient,
+              sfclient
+             ):
+    options=[]
+    letters = "ABCDEFGHIJKLMN"
+    for i in range(len(chaogao9)):
+        options.append("给定选项" + letters[i]+",内容为"+chaogao9[i] )
+
+    completion = aiclient.chat.completions.create(
+        model="glm-4.5-air",
+        #model="THUDM/GLM-Z1-9B-0414",
+        #model="ernie-speed-128k",
+        messages=[
+            {"role": "system", "content": "You are a helpful assistant."},
+            {"role": "user", "content": "超高指的是操作物高度距离楼地面5m以上的工程."},
+            {"role": "user", "content": "问题描述: 给定一段含有超高工作的内容: " + B['label'] + " " +  B['mc'] + " " + B['tz'] +  ",".join(options) + "。请选择最合适的选项,并返回字母代号,例如,返回 A。如果内容中没有明确高度,请返回A"},
+        ],
+        extra_body={"thinking": {"type": "disabled"}},
+        #extra_body={"enable_thinking": True},
+        #stream=True
+    )
+    json_string = completion.choices[0].message.content
+    print(json_string)
+    if len([x for x in json_string if x != ',' and x != '[' and x != ']' and x != ' ' and (x < 'A' or x > 'M')]) < 5:
+        answer=[]
+        if 'A' in json_string and len(chaogao9) > 0:
+            answer.append('A')
+        if 'B' in json_string and len(chaogao9) > 1:
+            answer.append('B')
+        if 'C' in json_string and len(chaogao9) > 2:
+            answer.append('C')
+        if 'D' in json_string and len(chaogao9) > 3:
+            answer.append('D')
+        return answer
+    completion = sfclient.chat.completions.create(
+        #model="glm-4.5-flash",
+        model=simplemodel(),
+        messages=xuanxiang(json_string),
+        extra_body={"thinking": {"type": "disabled"}},
+        #extra_body={"enable_thinking": False},
+    )
+    json_string = completion.choices[0].message.content
+    print(json_string)
+    answer=[]
+    if 'A' in json_string and len(chaogao9) > 0:
+        answer.append('A')
+    if 'B' in json_string and len(chaogao9) > 1:
+        answer.append('B')
+    if 'C' in json_string and len(chaogao9) > 2:
+        answer.append('C')
+    if 'D' in json_string and len(chaogao9) > 3:
+        answer.append('D')
+    
+    return answer
+
+def feiyong_chaogao(data, selected, aiclient, qwclient, sfclient):
+    a = [x for x in selected if x.startswith('4-')]
+    if len(a) > 0:
+        return ['4-F2!第四册']
+    a = [x for x in selected if x.startswith('9-')]
+    if len(a) > 0:
+        t = select_chaogao_9(data, aiclient, qwclient, sfclient)
+        if 'A' in t:
+            return ['9-F2!第九册5m以上到8m以内']
+        elif 'B' in t:
+            return ['9-F2!第九册8-12m']
+        elif 'C' in t:
+            return ['9-F2!第九册12-16m']
+        elif 'D' in t:
+            return ['9-F2!第九册16-20m']
+    a = [x for x in selected if x.startswith('10-')]
+    if len(a) > 0:
+        t = select_chaogao_10(data, aiclient, qwclient, sfclient)
+        if 'A' in t:
+            return ['10-F2!第十册3.6-8m以内']
+        elif 'B' in t:
+            return ['10-F2!第十册8-12m']
+        elif 'C' in t:
+            return ['10-F2!第十册12-16m']
+        elif 'D' in t:
+            return ['10-F2!第十册16-20m']
+    a = [x for x in selected if x.startswith('11-')]
+    if len(a) > 0:
+        t = select_chaogao_11(data, aiclient, qwclient, sfclient)
+        if 'A' in t:
+            return ['11-F2!第十一册6-20m']
+        elif 'B' in t:
+            return ['11-F2!第十一册20-30m']
+        elif 'C' in t:
+            return ['11-F2!第十一册30-40m']
+        elif 'D' in t:
+            return ['11-F2!第十一册40-50m']
+        elif 'E' in t:
+            return ['11-F2!第十一册50-60m']
+        elif 'F' in t:
+            return ['11-F2!第十一册60-70m']
+        elif 'G' in t:
+            return ['11-F2!第十一册70-80m']
+        elif 'H' in t:
+            return ['11-F2!第十一册80m以上']
+    return []
+

+ 1 - 1
huansuan.py

@@ -100,7 +100,7 @@ def callzaihuansuan(bianma, label, A,B,C, aiclient, qwclient, sfclient):
     if bianma.startswith("030801"):##工业管道
         print(A)
         print(B)
-        if '管道刷油' in label or '手工除锈':
+        if '管道刷油' in label or '手工除锈' in label:
             return callzaihuansuan030801(bianma, label, A, B, C, aiclient, qwclient, sfclient)
 
 

+ 3 - 0
postprocess.py

@@ -15,6 +15,7 @@ from postprocess0115 import postprocess0115
 from postprocess0304 import postprocess0304
 from postprocess0310 import postprocess0310
 from postprocess0308 import postprocess0308
+from postprocess0307 import postprocess0307
 from mianji import adjust
 def postprocess(selected, data, aiclient, qwclient, sfclient, label_name, name_dw, candidates,yqspecial):
     l = postprocess_(selected,data,aiclient,qwclient,sfclient,label_name,name_dw,candidates,yqspecial)
@@ -56,5 +57,7 @@ def postprocess_(selected, data, aiclient, qwclient, sfclient, label_name, name_
         return postprocess0310(selected, data, aiclient, qwclient, sfclient, label_name, name_dw, candidates)
     elif data['bianma'].startswith("0308"):
         return postprocess0308(selected, data, aiclient, qwclient, sfclient, label_name, name_dw, candidates)
+    elif data['bianma'].startswith("0307"):
+        return postprocess0307(selected, data, aiclient, qwclient, sfclient, label_name, name_dw, candidates)
     else: 
         return selected

Diff do ficheiro suprimidas por serem muito extensas
+ 6 - 0
postprocess0307.py


+ 6 - 2
postprocess0308.py

@@ -104,11 +104,13 @@ def kongqichuisao(
              qwclient,
               sfclient,
              dw):
+    if B['bianma'].startswith('030804'):
+        return False
     options=[]
     letters = "ABCDEFG"
     for i in range(len(kqcs)):
         options.append("给定选项" + letters[i]+",内容为"+kqcs[i] )
-
+    print('判断空气吹扫')
     completion = aiclient.chat.completions.create(
         model="glm-4.5-air",
         #model="THUDM/GLM-Z1-9B-0414",
@@ -116,7 +118,7 @@ def kongqichuisao(
         messages=[
             {"role": "system", "content": "You are a helpful assistant."},
             {"role": "user", "content": "背景知识:管道规格D273*8表示管径273mm,壁厚8mm"},
-            {"role": "user", "content": "问题描述: 给定一段工作内容: " + B['label'] + " " +  B['mc'] + " " + B['tz'] +  '\n请问,工作内容是否要求空气吹扫?请回答是或者否'},
+            {"role": "user", "content": "问题描述: 给定一段工作内容: " + B['label'] + " " +  B['mc'] + " " + B['tz'] +  '\n请问,工作内容是否明确要求空气吹扫?请回答是或者否'},
         ],
         extra_body={"thinking": {"type": "disabled"}},
         #extra_body={"enable_thinking": True},
@@ -387,6 +389,8 @@ def postprocess0308(selected, data, aiclient, qwclient, sfclient, label_name, na
 
     
     else:
+        print(prime)
+        print('clear chuisao')
         prime = [x for x in prime if '空气吹扫' not in x]
     if youqi(data, aiclient, qwclient, sfclient, name_dw):
         prime = prime + ['第十一册 刷油、防腐蚀、绝热工程 第二章 刷油工程 2.1 管道刷油 管道刷油 防锈漆 第一遍', '第十一册 刷油、防腐蚀、绝热工程 第二章 刷油工程 2.1 管道刷油 管道刷油 防锈漆 第二遍', '第十一册 刷油、防腐蚀、绝热工程 第二章 刷油工程 2.1 管道刷油 管道刷油 调和漆 第一遍', '第十一册 刷油、防腐蚀、绝热工程 第二章 刷油工程 2.1 管道刷油 管道刷油 调和漆 第二遍']

+ 38 - 2
server.js

@@ -45,7 +45,41 @@ app.post('/api/transform', (req, res) => {
    }])
    let result = copy(data['result'])
    delete data.result
-   for (let i = 0; i < result.length; i++) {
+   if (data['bianma'].startsWith('031301017')){
+      console.log('安装脚手架');
+      let de04=result.filter(x=>x['清单编码'].startsWith('0304'));
+      let json_ = "{\"reverse\": \"2076\", \"DEBH\": {\"111\": \"4-F1\"}, \"GCLMC\": {\"111\": \"第四册\"}, \"DW\": {\"111\": \"项\"}, \"rgde\": [], \"jxde\": [], \"clde\": [], \"actual_zhuanye\": 30, \"bz_selected\": {\"BZBH\": {}}, \"bz_selected2\": {\"BZBH\": {}}}"
+      Service.azfy_mock("1", json_, de04)
+      let de05=result.filter(x=>x['清单编码'].startsWith('0305'));
+      json_ = "{\"reverse\": \"2076\", \"DEBH\": {\"111\": \"5-F1\"}, \"GCLMC\": {\"111\": \"第五册\"}, \"DW\": {\"111\": \"项\"}, \"rgde\": [], \"jxde\": [], \"clde\": [], \"actual_zhuanye\": 30, \"bz_selected\": {\"BZBH\": {}}, \"bz_selected2\": {\"BZBH\": {}}}"
+      Service.azfy_mock("1", json_, de05)
+      let de06=result.filter(x=>x['清单编码'].startsWith('0306'));
+      json_ = "{\"reverse\": \"2076\", \"DEBH\": {\"111\": \"6-F1\"}, \"GCLMC\": {\"111\": \"第六册\"}, \"DW\": {\"111\": \"项\"}, \"rgde\": [], \"jxde\": [], \"clde\": [], \"actual_zhuanye\": 30, \"bz_selected\": {\"BZBH\": {}}, \"bz_selected2\": {\"BZBH\": {}}}"
+      Service.azfy_mock("1", json_, de06)
+      let de07=result.filter(x=>x['清单编码'].startsWith('0307'));
+      json_ = "{\"reverse\": \"2076\", \"DEBH\": {\"111\": \"7-F1\"}, \"GCLMC\": {\"111\": \"第七册\"}, \"DW\": {\"111\": \"项\"}, \"rgde\": [], \"jxde\": [], \"clde\": [], \"actual_zhuanye\": 30, \"bz_selected\": {\"BZBH\": {}}, \"bz_selected2\": {\"BZBH\": {}}}"
+      Service.azfy_mock("1", json_, de07)
+      let de08=result.filter(x=>x['清单编码'].startsWith('0308'));
+      json_ = "{\"reverse\": \"2076\", \"DEBH\": {\"111\": \"8-F1\"}, \"GCLMC\": {\"111\": \"第八册\"}, \"DW\": {\"111\": \"项\"}, \"rgde\": [], \"jxde\": [], \"clde\": [], \"actual_zhuanye\": 30, \"bz_selected\": {\"BZBH\": {}}, \"bz_selected2\": {\"BZBH\": {}}}"
+      Service.azfy_mock("1", json_, de08)
+      let de09=result.filter(x=>x['清单编码'].startsWith('0309'));
+      json_ = "{\"reverse\": \"2076\", \"DEBH\": {\"111\": \"9-F1\"}, \"GCLMC\": {\"111\": \"第九册\"}, \"DW\": {\"111\": \"项\"}, \"rgde\": [], \"jxde\": [], \"clde\": [], \"actual_zhuanye\": 30, \"bz_selected\": {\"BZBH\": {}}, \"bz_selected2\": {\"BZBH\": {}}}"
+      Service.azfy_mock("1", json_, de09)
+      let de10=result.filter(x=>x['清单编码'].startsWith('0310'));
+      json_ = "{\"reverse\": \"2076\", \"DEBH\": {\"111\": \"10-F1\"}, \"GCLMC\": {\"111\": \"第十册\"}, \"DW\": {\"111\": \"项\"}, \"rgde\": [], \"jxde\": [], \"clde\": [], \"actual_zhuanye\": 30, \"bz_selected\": {\"BZBH\": {}}, \"bz_selected2\": {\"BZBH\": {}}}"
+      Service.azfy_mock("1", json_, de10)
+      let de111=result.filter(x=>x['清单编码'].startsWith('031201'));
+      json_ = "{\"reverse\": \"2076\", \"DEBH\": {\"111\": \"11-F1\"}, \"GCLMC\": {\"111\": \"第十一册刷油工程(定额11-51~11-329)\"}, \"DW\": {\"111\": \"项\"}, \"rgde\": [], \"jxde\": [], \"clde\": [], \"actual_zhuanye\": 30, \"bz_selected\": {\"BZBH\": {}}, \"bz_selected2\": {\"BZBH\": {}}}"
+      Service.azfy_mock("1", json_, de111)
+      let de112=result.filter(x=>x['清单编码'].startsWith('031202') || x['清单编码'].startsWith('031203') || x['清单编码'].startsWith('031204') || x['清单编码'].startsWith('031205') || x['清单编码'].startsWith('031206') || x['清单编码'].startsWith('031207'));
+      json_ = "{\"reverse\": \"2076\", \"DEBH\": {\"111\": \"11-F1\"}, \"GCLMC\": {\"111\": \"第十一册防腐蚀工程(定额11-330~11-1689)\"}, \"DW\": {\"111\": \"项\"}, \"rgde\": [], \"jxde\": [], \"clde\": [], \"actual_zhuanye\": 30, \"bz_selected\": {\"BZBH\": {}}, \"bz_selected2\": {\"BZBH\": {}}}"
+      Service.azfy_mock("1", json_, de112)
+      let de113=result.filter(x=>x['清单编码'].startsWith('031208'));
+      json_ = "{\"reverse\": \"2076\", \"DEBH\": {\"111\": \"11-F1\"}, \"GCLMC\": {\"111\": \"第十一册绝热工程(定额11-1690~11-2327)\"}, \"DW\": {\"111\": \"项\"}, \"rgde\": [], \"jxde\": [], \"clde\": [], \"actual_zhuanye\": 30, \"bz_selected\": {\"BZBH\": {}}, \"bz_selected2\": {\"BZBH\": {}}}"
+      Service.azfy_mock("1", json_, de113)
+   }
+   else{
+	for (let i = 0; i < result.length; i++) {
        console.log(result[i][0])
        console.log(result[i][1])
        console.log((result[i][2]))
@@ -111,7 +145,9 @@ app.post('/api/transform', (req, res) => {
    if (data['extra'].length >= 4) {
         Service.danxiangdinge("1", data['n'], data['extra'])
    }
-   //console.log(Service.cache)
+   if (data['fy']=='{}'){}
+   else Service.changguidinge(JSON.parse(data['fy']), "1")
+   }
    res.status(200).send(Service.cache);
 });
 app.listen(3000, () => {

+ 36 - 29
tasks.py

@@ -19,6 +19,13 @@ from huansuan import callzaihuansuan
 import json
 import dedata
 import chromadb
+from feiyong import feiyong_chaogao
+from pymongo import MongoClient
+from anzhuangjsj import anzhuangjsj
+uri="mongodb://owner:Pheecian1@47.101.198.30:27017/baojia"
+mongoclient=MongoClient(uri)
+db = mongoclient['baojia']
+dbcollection=db['qdxm']
 print("chroma")
 client = chromadb.HttpClient(host='47.101.198.30',port=8000)
 collection = client.get_or_create_collection(name="tj_de_bge", metadata={'hnsw:search_ef':15})
@@ -29,12 +36,12 @@ qita_collection = client.get_or_create_collection(name="tj_qita_bge")
 from FlagEmbedding import FlagModel
 print("model")
 azmodel = FlagModel('/mnt/d/Develop/az/az_encoder_only_base_bge-large-zh-v1.5')
-model = None # FlagModel('/mnt/d/Develop/az/az_encoder_only_base_bge-large-zh-v1.5')
-cuoshi_model = None  #FlagModel('cuoshi_encoder_only_base_bge-large-zh-v1.5/cuoshi_encoder_only_base_bge-large-zh-v1.5')
+model = FlagModel('/mnt/d/Develop/bge/test2_encoder_only_base_bge-large-zh-v1.5')
+cuoshi_model = FlagModel('cuoshi_encoder_only_base_bge-large-zh-v1.5/cuoshi_encoder_only_base_bge-large-zh-v1.5')
 from sentence_transformers import CrossEncoder
 azce = CrossEncoder('/mnt/d/Develop/az/models/reranker-chinese-macbert-large-gooaq-bce-4/final')
-ce = None #CrossEncoder('/mnt/d/Develop/az/models/reranker-chinese-macbert-large-gooaq-bce/final')
-cuoshi_ce = None #CrossEncoder('cuoshi_reranker/final')
+ce = CrossEncoder('/mnt/d/Develop/celery/final/final')
+cuoshi_ce = CrossEncoder('cuoshi_reranker/cuoshi_reranker/final')
 with open("hunningtu_rule", "r") as f:
     content = f.read()
 obj = json.loads(content)
@@ -297,34 +304,17 @@ def callzaiclarify(data):
     return json_string
 def callzaidw(A,B):
     time.sleep(1)
-    completion = dsclient.chat.completions.create(
-        # 模型列表:https://help.aliyun.com/zh/model-studio/getting-started/models
+    completion = aiclient.chat.completions.create(
         model='glm-4.5-air',
-        #model="modelscope.cn/unsloth/GLM-Z1-32B-0414-GGUF",
-        stream=True,
+        ##stream=True,
         messages=[
             {"role": "system", "content": "You are a helpful assistant."},
         {"role": "user", "content": "  计量单位可以用名称或者符号表示,常用的符号包括表示米的符号m,表示千米的符号km,表示吨的符号t,表示千克的符号kg,表示平方米的符号m2,表示立方米的符号m3。也有计量单位很宽泛,比如“项”、“次”. 给定一个工作量计量单位,内容为" + A + ",记作A,再给定一个工作量计量单位,内容为" + B + ",记作B。若两个单位相等,请返回A=B。例如,“项”跟“次”是等价的,应返回A=B。若两个单位不相等,但是存在比例换算关系,请返回比例换算关系,例如A单位是m,B单位是10m, 则返回A=0.1*B。再例如,A单位是10m2,B单位是m2,则返回A=10*B。再例如,A单位是m3, B单位是1000m3,则返回A=0.001*B。若两个单位不相等,且不存在比例换算关系,请返回A<>B,例如A单位是m,B单位是m2,一个表示长度,一个表示面积,不存在比例关系,则返回A<>B。 "},
         ],
-        # Qwen3模型通过enable_thinking参数控制思考过程(开源版默认True,商业版默认False)
-        # 使用Qwen3开源版模型时,若未启用流式输出,请将下行取消注释,否则会报错
-        extra_body={"enable_thinking": False},
-        #extra_body={"thinking": {"type": "disabled"}},
+        #extra_body={"enable_thinking": False},
+        extra_body={"thinking": {"type": "disabled"}},
     )
-    is_answering = False  # 是否进入回复阶段
-    print("\n" + "=" * 20 + "思考过程" + "=" * 20)
-    json_string = ""
-    for chunk in completion:
-        delta = chunk.choices[0].delta
-        if hasattr(delta, "reasoning_content") and delta.reasoning_content is not None:
-            if not is_answering:
-                print(delta.reasoning_content, end="", flush=True)
-        if hasattr(delta, "content") and delta.content:
-            if not is_answering:
-                print("\n" + "=" * 20 + "完整回复" + "=" * 20)
-                is_answering = True
-            json_string = json_string + delta.content#, end="", flush=True)
-    #json_string = completion.choices[0].message.content
+    json_string = completion.choices[0].message.content
     print(json_string)
     time.sleep(1)
     completion = simpleclient.chat.completions.create(
@@ -508,6 +498,10 @@ def huansuan(input, dw, label):
         return 0.1
     if dw1 == '组' and dw2 == '10组':
         return 0.1
+    if dw1 == '组' and dw2 == '套':
+        return 1
+    if dw1 == '组' and dw2 == '10套':
+        return 0.1
     if dw1 == 'm' and dw2 == '100m单线':
         return 0.01
 
@@ -659,7 +653,7 @@ def process_data(data:dict)-> dict:
     elif data['bianma'].startswith('030412'):
         result = azcollection.query(query_embeddings=embeddings, n_results=10, where_document={"$contains": "照明器具"})      
     elif data['bianma'].startswith('030108'):
-        result = azcollection.query(query_embeddings=embeddings, n_results=10, where_document={"$contains": "第一册"})      
+        result = azcollection.query(query_embeddings=embeddings, n_results=10, where_document={"$contains": "风机"})      
     elif data['bianma'].startswith('030502007') or data['bianma'].startswith('030502008'):
         result = azcollection.query(query_embeddings=embeddings, n_results=10, where_document={"$contains": "布放光缆"})      
     elif data['bianma'].startswith('03'):
@@ -1000,10 +994,23 @@ def process_data(data:dict)-> dict:
         replace['04290303']=extra_info
     else:
         extra_info = "无"
+    fy=[]
+    if data['bianma'].startswith('03') and '超高' in data['tz']:
+        fy=feiyong_chaogao(data, [label_name[x] for x in selected], aiclient, qwclient, simpleclient)
+    if len(fy) > 0:
+        fy = dedata.read_singledexilie2(30, fy[0])
+    else:
+        fy = '{}'
+    if data['bianma'].startswith('031301017'):##安装脚手架搭拆
+        print(data['bh'])
+        print(data['name'])
+        qd=anzhuangjsj(data['name'], data['bh'], dbcollection)
+        response = requests.post("http://localhost:3000/api/transform", json={'bianma': data['bianma'], 'mc': data['mc'], 'tz': data['tz'], 'dw': data['dw'], 'sl': data['sl'], 'n': data['n'], "extra": extra_info, 'result':qd, 'fuzhu': [], 'replace': replace, 'fy': fy})
+        return {"result": response.json()}
     if '高强螺栓' in extra_info:
-        response = requests.post("http://localhost:3000/api/transform", json={'bianma': data['bianma'], 'mc': data['mc'], 'tz': data['tz'], 'dw': data['dw'], 'sl': data['sl'], 'n': data['n'], "extra": extra_info, 'result': [], 'fuzhu': fuzhu_selected, 'replace': replace})
+        response = requests.post("http://localhost:3000/api/transform", json={'bianma': data['bianma'], 'mc': data['mc'], 'tz': data['tz'], 'dw': data['dw'], 'sl': data['sl'], 'n': data['n'], "extra": extra_info, 'result': [], 'fuzhu': fuzhu_selected, 'replace': replace, 'fy': '{}'})
         return {"result": response.json()}
     else:
-        response = requests.post("http://localhost:3000/api/transform", json={'bianma': data['bianma'], 'mc': data['mc'], 'tz': data['tz'], 'dw': data['dw'], 'sl': data['sl'], 'n': data['n'], "extra": extra_info, 'result': result, 'fuzhu': fuzhu_selected, 'replace': replace})
+        response = requests.post("http://localhost:3000/api/transform", json={'bianma': data['bianma'], 'mc': data['mc'], 'tz': data['tz'], 'dw': data['dw'], 'sl': data['sl'], 'n': data['n'], "extra": extra_info, 'result': result, 'fuzhu': fuzhu_selected, 'replace': replace, 'fy': fy})
         return {"result": response.json()}
         

+ 77 - 5
tihuan_az.py

@@ -53,7 +53,7 @@ def tihuan_az(
             print(json_string)
             
             result.append( {'bianma': bh, 'new_bianma': bh, 'mc': json_string, 'jg': 0})
-        if bh.startswith("1401"):
+        if (bh.startswith("1401") or bh.startswith('1403')) and  '卫生器具' not in name_label_:
             ##钢管
             completion = aiclient.chat.completions.create(
             model="glm-4.5-air",
@@ -76,19 +76,46 @@ def tihuan_az(
             print(json_string)
             
             result.append( {'bianma': bh, 'new_bianma': bh, 'mc': json_string, 'jg': 0})
-        if bh.startswith("25430311") or bh.startswith('25430314'):
+        if bh.startswith("25430311") or bh.startswith('25430314') or bh.startswith('254305'):
             ##绝缘导线
             completion = aiclient.chat.completions.create(
             model="glm-4.5-air",
             messages=[
                 {"role": "system", "content": "You are a helpful assistant."},
-                {"role": "user", "content": "给定一段工作内容的描述,请从工作内容中抽取出绝缘导线的具体品种型号等信息。"+'''
+                {"role": "user", "content": "给定一段工作内容的描述,请从工作内容中抽取出绝缘导线、网线的具体品种型号等信息。"+'''
                       例如,给定文字如下:
                       1、名称:配线
                       2、配线形式:管内穿线
                       3、规格:RS485
                       4、材质:铜芯
                       你应该返回 “绝缘导线RS485”
+                      再例如,给定文字如下:
+                      1、名称:六类非屏蔽网线
+                      2、规格:CAT6.UTP
+                      3、敷设方式:管内穿线/桥架配线
+                      你应该返回 “六类非屏蔽网线CAT6.UTP”
+                      现在给定文字如下:
+                    ''' + label +'\n请给出答案'
+                },
+            ],
+            extra_body={"thinking": {"type": "disabled"}},
+        )
+            json_string = completion.choices[0].message.content
+            print(json_string)
+            
+            result.append( {'bianma': bh, 'new_bianma': bh, 'mc': json_string, 'jg': 0})
+        if bh.startswith("5029"):
+            ##通风机、通风器
+            completion = aiclient.chat.completions.create(
+            model="glm-4.5-air",
+            messages=[
+                {"role": "system", "content": "You are a helpful assistant."},
+                {"role": "user", "content": "给定一段工作内容的描述,请从工作内容中抽取出通风机、通风器的具体品种型号等信息。"+'''
+                      例如,给定文字如下:
+                      1、名称:壁式边墙排风机
+                      2、 380V 0.55KW,50KG
+                      3、规格:带防雨消声弯头10*10不锈钢防虫网
+                      你应该返回 “壁式边墙排风机”
                       现在给定文字如下:
                     ''' + label +'\n请给出答案'
                 },
@@ -235,7 +262,7 @@ def tihuan_az(
             print(json_string)
             
             result.append( {'bianma': bh, 'new_bianma': bh, 'mc': json_string, 'jg': 0})
-        if bh.startswith("143103"):
+        if bh.startswith("143103") or bh.startswith('143115'):
             ##塑料管
             completion = aiclient.chat.completions.create(
             model="glm-4.5-air",
@@ -257,6 +284,29 @@ def tihuan_az(
             json_string = completion.choices[0].message.content
             print(json_string)
             
+            result.append( {'bianma': bh, 'new_bianma': bh, 'mc': json_string, 'jg': 0})
+        if bh.startswith("1639"):
+            ##阀门
+            completion = aiclient.chat.completions.create(
+            model="glm-4.5-air",
+            messages=[
+                {"role": "system", "content": "You are a helpful assistant."},
+                {"role": "user", "content": "给定一段工作内容的描述,请从工作内容中抽取出阀门的具体品种型号等信息。"+'''
+                      例如,给定文字如下:
+                      1、类型:截止阀
+                      2、材质:不锈钢
+                      3、规格、压力等级:DN32
+                      4、连接形式:丝接
+                      你应该返回 “不锈钢截止阀DN32”
+                      现在给定文字如下:
+                    ''' + label +'\n请给出答案'
+                },
+            ],
+            extra_body={"thinking": {"type": "disabled"}},
+        )
+            json_string = completion.choices[0].message.content
+            print(json_string)
+            
             result.append( {'bianma': bh, 'new_bianma': bh, 'mc': json_string, 'jg': 0})
         if bh.startswith("1631") and '排气阀' not in label:
             ##阀门
@@ -281,7 +331,7 @@ def tihuan_az(
             print(json_string)
             
             result.append( {'bianma': bh, 'new_bianma': bh, 'mc': json_string, 'jg': 0})
-        if bh.startswith("1841"):
+        if bh.startswith("1841") and '龙头' in name_label_:
             ##水龙头
             completion = aiclient.chat.completions.create(
             model="glm-4.5-air",
@@ -450,6 +500,28 @@ def tihuan_az(
             json_string = completion.choices[0].message.content
             print(json_string)
             
+            result.append( {'bianma': bh, 'new_bianma': bh, 'mc': json_string, 'jg': 0})
+        if bh.startswith("2109030"):
+            ##水表
+            completion = aiclient.chat.completions.create(
+            model="glm-4.5-air",
+            messages=[
+                {"role": "system", "content": "You are a helpful assistant."},
+                {"role": "user", "content": "给定一段工作内容的描述,请从工作内容中抽取出水表的具体品种型号等信息。"+'''
+                      例如,给定文字如下:
+                      1、安装部位(室内外):水表
+                      2、型号、规格:DN65
+                      3、连接形式:丝接
+                      你应该返回 “水表DN65”
+                      现在给定文字如下:
+                    ''' + label +'\n请给出答案'
+                },
+            ],
+            extra_body={"thinking": {"type": "disabled"}},
+        )
+            json_string = completion.choices[0].message.content
+            print(json_string)
+            
             result.append( {'bianma': bh, 'new_bianma': bh, 'mc': json_string, 'jg': 0})
         if bh.startswith("170101"):
             ##法兰

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff