Selaa lähdekoodia

补充人材机、定额库多单价兼容

zhongzewei 7 vuotta sitten
vanhempi
commit
88221f4e36

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

@@ -17,7 +17,7 @@ const uuidV1 = require('uuid/v1');
 let std_glj_lib_gljList_model = mongoose.model('std_glj_lib_gljList');
 let complementary_glj_model =  mongoose.model('complementary_glj_lib');
 let rationItemModel = mongoose.model("std_ration_lib_ration_items");
-let complementaryGljModel = mongoose.model('complementary_glj_lib');
+let complementaryRationModel = mongoose.model('complementary_ration_items');
 
 let coeMolde = mongoose.model('std_ration_lib_coe_list');
 let _= require('lodash');
@@ -75,13 +75,13 @@ async function getSameSectionRations(data,userId){
         let ration = await rationItemModel.findOne({rationRepId:libID,code:code},['sectionId']);
         sectionId = ration.sectionId
     }else {
-        let ration = await complementaryGljModel.findOne({userId:userId,code:code},['sectionId']);
+        let ration = await complementaryRationModel.findOne({userId:userId,code:code},['sectionId']);
         sectionId = ration.sectionId
     }
     if(sectionId){
         //{
         let stdRations = await rationItemModel.find({sectionId: sectionId});
-        let comRations = await complementaryGljModel.find({userId: userId, sectionId: sectionId});
+        let comRations = await complementaryRationModel.find({userId: userId, sectionId: sectionId});
         rations = stdRations.concat(comRations);
         rations = _.sortBy(rations,'code');
     }

+ 6 - 0
web/building_saas/complementary_glj_lib/js/glj.js

@@ -139,6 +139,12 @@ let repositoryGljObj = {
         let me = this;
         CommonAjax.post('complementartGlj/api/getGljItems', {stdGljLibId: stdGljLibId}, function (rstData) {
             me.stdGljList = rstData.stdGljs;
+            //兼容多单价情况
+            for(let sGlj of me.stdGljList){
+                if(sGlj.priceProperty && typeof sGlj.priceProperty.price1 !== 'undefined') {
+                    sGlj.basePrice = sGlj.priceProperty.price1;
+                }
+            }
             me.complementaryGljList = rstData.complementaryGljs;
             me.workBook.getSheet(0).setRowCount(me.stdGljList.length);
             me.sortGlj(me.stdGljList);

+ 6 - 0
web/building_saas/complementary_ration_lib/js/gljSelect.js

@@ -43,6 +43,12 @@ let gljSelOprObj = {
         let me = this;
         CommonAjax.post('/complementartGlj/api/getGljItems', {stdGljLibId: stdGljLibId}, function (rstData) {
             me.stdGljList = rstData.stdGljs;
+            //兼容多单价,计算补充定额价格时,套多单价人材机的时候,默认取第一个价格
+            for(let sGlj of me.stdGljList){
+                if(sGlj.priceProperty && typeof sGlj.priceProperty.price1 !== 'undefined'){
+                    sGlj.basePrice = sGlj.priceProperty.price1;
+                }
+            }
             me.complementaryGljList = rstData.complementaryGljs;
             me.switchToGljId(me.stdGljList);
             me.switchToGljId(me.complementaryGljList);