inm 入库bug
This commit is contained in:
parent
5548776cde
commit
3412937bcb
|
@ -25,10 +25,11 @@ class InmService:
|
||||||
|
|
||||||
iv, _= Inventory.objects.get_or_create(material=material, warehouse=warehouse, \
|
iv, _= Inventory.objects.get_or_create(material=material, warehouse=warehouse, \
|
||||||
defaults={'material':material, 'warehouse':warehouse, 'count':0})
|
defaults={'material':material, 'warehouse':warehouse, 'count':0})
|
||||||
iv.count = MaterialBatch.objects.filter(material=material, warehouse=warehouse).count()
|
iv.count = MaterialBatch.objects.filter(material=material,
|
||||||
|
warehouse=warehouse).aggregate(total=Sum('count')).get('total', 0)
|
||||||
iv.save()
|
iv.save()
|
||||||
|
|
||||||
material.count = MaterialBatch.objects.filter(material=material).count()
|
material.count = MaterialBatch.objects.filter(material=material).aggregate(total=Sum('count')).get('total', 0)
|
||||||
material.save()
|
material.save()
|
||||||
|
|
||||||
# 创建IProduct
|
# 创建IProduct
|
||||||
|
@ -66,10 +67,12 @@ class InmService:
|
||||||
mb.save()
|
mb.save()
|
||||||
|
|
||||||
iv = Inventory.objects.get(material=material, warehouse=warehouse)
|
iv = Inventory.objects.get(material=material, warehouse=warehouse)
|
||||||
iv.count = MaterialBatch.objects.filter(material=material, warehouse=warehouse).count()
|
iv.count = MaterialBatch.objects.filter(material=material,
|
||||||
|
warehouse=warehouse).aggregate(total=Sum('count')).get('total', 0)
|
||||||
iv.save()
|
iv.save()
|
||||||
|
|
||||||
material.count = MaterialBatch.objects.filter(material=material).count()
|
material.count = MaterialBatch.objects.filter(material=
|
||||||
|
material).aggregate(total=Sum('count')).get('total', 0)
|
||||||
material.save()
|
material.save()
|
||||||
|
|
||||||
# 删除IProduct
|
# 删除IProduct
|
||||||
|
|
Loading…
Reference in New Issue