Forráskód Böngészése

修改getInfoFromProjectGLJ方法

zhangweicheng 5 éve
szülő
commit
097ffac522

+ 9 - 5
modules/main/facade/project_facade.js

@@ -90,7 +90,8 @@ async function calcInstallationFee(data) {
     if(data.ration.add.length>0){//新增的安装子目要增加对应的工料机
         for(let nr of data.ration.add){
             for(let tkey in nr.glj){
-                newGljList.push(await addInstallationGLJ(nr.glj[tkey]));
+                let [newRecode,projectGLJ] = await createRationGLJData(nr.glj[tkey])
+                newGljList.push(newRecode);
             }
         }
     }
@@ -102,14 +103,17 @@ async function calcInstallationFee(data) {
     return result;
 }
 
-async function addInstallationGLJ(glj) {
+async function createRationGLJData(glj) {
     glj.ID = uuidV1();
-    let info = await ration_glj_facade.getInfoFromProjectGLJ(glj);
+    let [info,projectGLJ ] = await ration_glj_facade.getInfoFromProjectGLJ(glj);
     let newRecode  = ration_glj_facade.createNewRecord(info);
-    return newRecode;
+    return [newRecode,projectGLJ];
 }
 
 
+
+
+
 function generateTasks(data,userID) {
     let tasks=[];
     let deleteInfo={deleted: true, deleteDateTime: new Date(), deleteBy: userID};
@@ -218,7 +222,7 @@ async function calcOverHeightFee(data) {
         let completeRationGLJList = [];
         if (rationGLJ.length) {
             // 定额人材机需要新增项目人材机、单价文件、且返回完整的定额人材机数据
-            const rationGLJTasks = rationGLJ.map(glj => addInstallationGLJ(glj));
+            const rationGLJTasks = rationGLJ.map(glj => createRationGLJData(glj));
             completeRationGLJList = await Promise.all(rationGLJTasks);
             // 新增定额人材机
             tasks.push(ration_glj_model.insertMany(completeRationGLJList));

+ 1 - 1
modules/main/facade/ration_facade.js

@@ -460,7 +460,7 @@ async function addRationGLJ(std,newRation,compilation) {
                 newGLJ.materialIndexUnit = std_glj.materialIndexUnit;
                 newGLJ.materialIndexCoe = std_glj.materialIndexCoe;
                 newGLJ.createType = 'normal';
-                let info =  await ration_glj_facade.getInfoFromProjectGLJ(newGLJ,unitPriceFileId,ext);
+                let [info,projectGLJ] =  await ration_glj_facade.getInfoFromProjectGLJ(newGLJ,unitPriceFileId,ext);
                 newGLJ = ration_glj_facade.createNewRecord(info);
                 newRationGLJList.push(newGLJ);
                 rationGLJShowList.push(info);

+ 3 - 3
modules/ration_glj/facade/ration_glj_facade.js

@@ -142,8 +142,8 @@ function get_lib_glj_info(ration_glj) {
                 getInfoFromProjectGLJ(ration_glj).then(function (info) {
                     if (info) {
                         let tem = {};
-                        tem.newRecode = createNewRecord(info);
-                        tem.showData = info;
+                        tem.newRecode = createNewRecord(info[0]);
+                        tem.showData = info[0];
                         result.datas.push(tem);
                         cb(null, result);
                     } else {
@@ -199,7 +199,7 @@ async function getInfoFromProjectGLJ(ration_glj,unitPriceFileId,ext) {
         if (result.hasOwnProperty('subList') && result.subList.length > 0) {
             ration_glj.subList = getMixRatioShowDatas(result.subList);
         }
-        return ration_glj;
+        return [ration_glj,result];
     } catch (err) {
         logger.err(err);
         return null;