17 lines
		
	
	
		
			514 B
		
	
	
	
		
			Python
		
	
	
	
			
		
		
	
	
			17 lines
		
	
	
		
			514 B
		
	
	
	
		
			Python
		
	
	
	
from __future__ import absolute_import, unicode_literals
 | 
						|
from apps.utils.tasks import CustomTask
 | 
						|
from celery import shared_task
 | 
						|
from apps.mtm.models import Material
 | 
						|
 | 
						|
@shared_task(base=CustomTask)
 | 
						|
def correct_material_count(materialId: str = ''):
 | 
						|
    """
 | 
						|
    矫正现有物料总数量
 | 
						|
    """
 | 
						|
    from apps.inm.services import InmService
 | 
						|
    if materialId:
 | 
						|
        objs = Material.objects.filter(id=materialId)
 | 
						|
    else:
 | 
						|
        objs = Material.objects.all()
 | 
						|
    for m in objs:
 | 
						|
        InmService.cal_mat_count(m) |