Kaynağa Gözat

组成物匹配相关

zeweizhong 6 yıl önce
ebeveyn
işleme
b3a947872d

+ 11 - 3
modules/glj/models/glj_list_model.js

@@ -783,12 +783,14 @@ class GLJListModel extends BaseModel {
             mixRatioData[m_index]=tmp;
             mixRatioData[m_index]=tmp;
         }
         }
         // 查找对应的项目工料机数据
         // 查找对应的项目工料机数据
-        let gcondition = {project_id: glj.project_id,code: {"$in": codeList}, name: {"$in": nameList},specs:{"$in": specsList},type:{"$in": typeList},unit:{"$in": unitList} };
+        //let gcondition = {project_id: glj.project_id,code: {"$in": codeList}, name: {"$in": nameList},specs:{"$in": specsList},type:{"$in": typeList},unit:{"$in": unitList} };
+        let gcondition = {project_id: glj.project_id,code: {"$in": codeList}, name: {"$in": nameList},type:{"$in": typeList},unit:{"$in": unitList} };
         let gljData = await this.findDataByCondition(gcondition, {_id: 0}, false);
         let gljData = await this.findDataByCondition(gcondition, {_id: 0}, false);
 
 
         // 查找对应的单价数据
         // 查找对应的单价数据
         let unitPriceModel = new UnitPriceModel();
         let unitPriceModel = new UnitPriceModel();
-        let ucondition = { unit_price_file_id: unitPriceFileId,code: {"$in": codeList}, name: {"$in": nameList},specs:{"$in": specsList},type:{"$in": typeList},unit:{"$in": unitList}};
+        //let ucondition = { unit_price_file_id: unitPriceFileId,code: {"$in": codeList}, name: {"$in": nameList},specs:{"$in": specsList},type:{"$in": typeList},unit:{"$in": unitList}};
+        let ucondition = { unit_price_file_id: unitPriceFileId,code: {"$in": codeList}, name: {"$in": nameList},type:{"$in": typeList},unit:{"$in": unitList}};
         let unitPriceList = await unitPriceModel.findDataByCondition(ucondition, {_id: 0}, false);
         let unitPriceList = await unitPriceModel.findDataByCondition(ucondition, {_id: 0}, false);
 
 
 
 
@@ -796,7 +798,9 @@ class GLJListModel extends BaseModel {
         let unitPriceData = {};
         let unitPriceData = {};
         for(let tmp of unitPriceList) {
         for(let tmp of unitPriceList) {
             let u_index = this.getIndex(tmp,['code','name','specs','unit','type']);
             let u_index = this.getIndex(tmp,['code','name','specs','unit','type']);
-            unitPriceData[u_index] = tmp;
+            if (mixRatioData[u_index]) {
+                unitPriceData[u_index] = tmp;
+            }
         }
         }
         return [gljData,mixRatioData,unitPriceData];
         return [gljData,mixRatioData,unitPriceData];
 
 
@@ -825,6 +829,10 @@ class GLJListModel extends BaseModel {
             specs:projectGLJData.specs,
             specs:projectGLJData.specs,
             type:projectGLJData.type,
             type:projectGLJData.type,
             unit:projectGLJData.unit
             unit:projectGLJData.unit
+        };
+        if (!condition.specs) {
+            delete condition.specs;
+            condition.$or = [{specs: null}, {specs: ''}];
         }
         }
         let unitPrice = await unitPriceModel.findDataByCondition(condition);
         let unitPrice = await unitPriceModel.findDataByCondition(condition);
 
 

+ 4 - 0
web/building_saas/pm/js/pm_import.js

@@ -443,6 +443,10 @@ const importView = (() => {
                     xmlObj.name += `(${moment(Date.now()).format('YYYY-MM-DD HH:mm:ss')})`;
                     xmlObj.name += `(${moment(Date.now()).format('YYYY-MM-DD HH:mm:ss')})`;
                 }
                 }
                 $('#importInterface').modal('hide');
                 $('#importInterface').modal('hide');
+                //TEST======================
+                /*let importData = await importXML.transformData(xmlObj);
+                console.log(importData);*/
+                //TEST======================
                 pr.start('导入文件', '正在生成文件,请稍候……');
                 pr.start('导入文件', '正在生成文件,请稍候……');
                 let importData = await importXML.transformData(xmlObj);
                 let importData = await importXML.transformData(xmlObj);
                 let blob = new Blob([JSON.stringify(importData)], {type: 'text/plain;charset=utf-8'});
                 let blob = new Blob([JSON.stringify(importData)], {type: 'text/plain;charset=utf-8'});