Explorar o código

feat: 安装增加费取默认定额ID

zhangweicheng %!s(int64=4) %!d(string=hai) anos
pai
achega
f1d4b87d1c
Modificáronse 1 ficheiros con 10 adicións e 8 borrados
  1. 10 8
      modules/main/facade/installation_facade.js

+ 10 - 8
modules/main/facade/installation_facade.js

@@ -90,14 +90,16 @@ async function copyInstallationFeeFromLib(projectID,engineering_id) {
     let ration_lib = engineering.ration_lib;
     let ration_lib = engineering.ration_lib;
     let installationFeeList = [];
     let installationFeeList = [];
     for(let rl of ration_lib){
     for(let rl of ration_lib){
-        let newInstallationFee = await getInstallationFeeFromLib(rl.id);
-        if(newInstallationFee){
-            newInstallationFee.libID = rl.id;
-            newInstallationFee.libName = rl.name;
-            newInstallationFee.projectID = projectID;
-            newInstallationFee.ID = uuidV1();
-            installationFeeList.push(newInstallationFee);
-        }
+        if(rl.isDefault === true){//取默认的定额库ID;
+            let newInstallationFee = await getInstallationFeeFromLib(rl.id);
+            if(newInstallationFee){  
+                newInstallationFee.libID = rl.id;
+                newInstallationFee.libName = rl.name;
+                newInstallationFee.projectID = projectID;
+                newInstallationFee.ID = uuidV1();
+                installationFeeList.push(newInstallationFee);
+            }
+        } 
     }
     }
     if(installationFeeList.length > 0){
     if(installationFeeList.length > 0){
         await installationFeeModel.insertMany(installationFeeList);
         await installationFeeModel.insertMany(installationFeeList);