feat: 优化ana batchwork
This commit is contained in:
parent
5e81a3d3dc
commit
01d93d7814
|
|
@ -7,6 +7,7 @@ from apps.wpm.serializers import BatchMgroupSerializer
|
||||||
from apps.wpm.models import WMaterial, Mlogb
|
from apps.wpm.models import WMaterial, Mlogb
|
||||||
from django.db.models import Q, Sum, F, ExpressionWrapper
|
from django.db.models import Q, Sum, F, ExpressionWrapper
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
from apps.mtm.models import Material
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -26,12 +27,12 @@ class BatchWorkView(APIView):
|
||||||
mgroup:Mgroup = Mgroup.objects.get(name=vdata['mgroup_name'])
|
mgroup:Mgroup = Mgroup.objects.get(name=vdata['mgroup_name'])
|
||||||
except Exception:
|
except Exception:
|
||||||
raise ParseError(f"获取工段信息失败-{vdata['mgroup_name']}")
|
raise ParseError(f"获取工段信息失败-{vdata['mgroup_name']}")
|
||||||
matoutIds = mgroup.process.get_canout_mat_ids()
|
matinIds = mgroup.process.get_canin_mat_ids()
|
||||||
|
|
||||||
|
|
||||||
# 待加工的批次
|
# 待加工的批次
|
||||||
wm_qs = WMaterial.objects.filter(mgroup=mgroup, count__gt=0)
|
wm_qs = WMaterial.objects.filter(mgroup=mgroup, count__gt=0)
|
||||||
wm_todo_qs = wm_qs.filter(state=WMaterial.WM_OK).exclude(material__id__in=matoutIds)|wm_qs.filter(state=WMaterial.WM_REPAIR)
|
wm_todo_qs = wm_qs.filter(material__id__in=matinIds).exclude(state=WMaterial.WM_REPAIRED)|wm_qs.filter(state=WMaterial.WM_REPAIR, mgroup=mgroup)
|
||||||
wm_v = wm_todo_qs.order_by("batch").values("count", "batch", wmid=F("id"))
|
wm_v = wm_todo_qs.order_by("batch").values("count", "batch", wmid=F("id"))
|
||||||
|
|
||||||
# 对应的操作子日志投入
|
# 对应的操作子日志投入
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue