| 
					
				 | 
			
			
				@@ -59,7 +59,8 @@ module.exports = app => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         insertArray.push(one_month); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if (monthList.length !== 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             const mb_msg_tp_sum = this._.sumBy(this._.filter(monthList, { mb_id: mb.id }), 'msg_tp'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            const new_msg_tp = this.ctx.helper.round(this.ctx.helper.div(this.ctx.helper.add(mb_msg_tp_sum, one_month.msg_tp), material_month.length), 3); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            const month_num = material_month.length - this.ctx.helper.arrayCount(this._.concat(this._.map(this._.filter(monthList, { mb_id: mb.id }), 'msg_tp'), one_month.msg_tp), null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            const new_msg_tp = this.ctx.helper.round(this.ctx.helper.div(this.ctx.helper.add(mb_msg_tp_sum, one_month.msg_tp), month_num), 3); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             const [newmsg_spread, newm_spread] = await this.ctx.service.materialBills.getSpread(mb, new_msg_tp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             updateArray.push({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 id: mb.id, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -107,7 +108,8 @@ module.exports = app => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 return data.indexOf(m.yearmonth) !== -1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             const mb_msg_tp_sum = this._.sumBy(this._.filter(monthList, { mb_id: mb.id }), 'msg_tp'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            const new_msg_tp = material_month.length !== 0 ? this.ctx.helper.round(this.ctx.helper.div(mb_msg_tp_sum, material_month.length), 3) : null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            const month_num = material_month.length - this.ctx.helper.arrayCount(this._.map(this._.filter(monthList, { mb_id: mb.id }), 'msg_tp'), null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            const new_msg_tp = month_num !== 0 ? this.ctx.helper.round(this.ctx.helper.div(mb_msg_tp_sum, month_num), 3) : null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             const [newmsg_spread, newm_spread] = await this.ctx.service.materialBills.getSpread(mb, new_msg_tp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             updateArray.push({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 id: mb.id, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -147,7 +149,8 @@ module.exports = app => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 const mbInfo = await transaction.get(this.ctx.service.materialBills.tableName, { id: data.mb_id }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (monthList.length !== 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     const mb_msg_tp_sum = this._.sumBy(monthList, 'msg_tp'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    const new_msg_tp = this.ctx.helper.round(this.ctx.helper.div(mb_msg_tp_sum, material_month.length), 3); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    const month_num = material_month.length - this.ctx.helper.arrayCount(this._.map(monthList, 'msg_tp'), null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    const new_msg_tp = month_num !== 0 ? this.ctx.helper.round(this.ctx.helper.div(mb_msg_tp_sum, month_num), 3) : null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     const [newmsg_spread, newm_spread] = await this.ctx.service.materialBills.getSpread(mbInfo, new_msg_tp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     await transaction.update(this.ctx.service.materialBills.tableName, { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         id: mbInfo.id, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -198,7 +201,8 @@ module.exports = app => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     const mbUpdateArray = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     for (const mb of mbList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         const mb_msg_tp_sum = this._.sumBy(this._.filter(monthList, { mb_id: mb.id }), 'msg_tp'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        const new_msg_tp = material_month.length !== 0 ? this.ctx.helper.round(this.ctx.helper.div(mb_msg_tp_sum, material_month.length), 3) : null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        const month_num = material_month.length - this.ctx.helper.arrayCount(this._.map(this._.filter(monthList, { mb_id: mb.id }), 'msg_tp'), null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        const new_msg_tp = month_num !== 0 ? this.ctx.helper.round(this.ctx.helper.div(mb_msg_tp_sum, month_num), 3) : null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         const [newmsg_spread, newm_spread] = await this.ctx.service.materialBills.getSpread(mb, new_msg_tp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         mbUpdateArray.push({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             id: mb.id, 
			 |