feat: batch_gzerp添加库存等字段
This commit is contained in:
parent
4921383de1
commit
58024cc33d
|
@ -1,14 +1,15 @@
|
|||
from apps.wpm.models import BatchSt
|
||||
import logging
|
||||
from apps.wpm.models import Mlog, Handover
|
||||
from apps.wpm.models import Mlog, Handover, WMaterial
|
||||
from apps.mtm.models import Mgroup
|
||||
import decimal
|
||||
from apps.system.models import Dept
|
||||
from apps.inm.models import MIOItem, MIOItemA, MaterialBatchA
|
||||
from apps.inm.models import MIOItem, MIOItemA, MaterialBatchA, MaterialBatch
|
||||
from apps.qm.models import FtestWork
|
||||
from apps.wpm.services_2 import get_f_l_date
|
||||
import json
|
||||
from apps.utils.tools import MyJSONEncoder
|
||||
from django.db.models import Sum
|
||||
myLogger = logging.getLogger("log")
|
||||
|
||||
def main(batch: str, mgroup_obj=None):
|
||||
|
@ -228,12 +229,12 @@ def main(batch: str, mgroup_obj=None):
|
|||
data["管料退火_操作人"] = ";".join([item.name for item in data["管料退火_操作人"]])
|
||||
data["产品规格"] = list(set(data["产品规格"]))
|
||||
data["产品规格"] = ";".join([item.specification for item in data["产品规格"]])
|
||||
data["管料退火_合格率"] = round(data["管料退火_count_ok"] * 100/ data["管料退火_count_real"], 1)
|
||||
|
||||
|
||||
# 六车间领料数据
|
||||
mioitem6_qs = MIOItem.objects.filter(mio__belong_dept=dept6, mio__type="do_out",
|
||||
batch=batch,
|
||||
mio__submit_time__isnull=False)
|
||||
batch=batch, mio__submit_time__isnull=False)
|
||||
if mioitem6_qs.exists():
|
||||
data["六车间领料_日期"] = []
|
||||
data["六车间领料_车间执行人"] = []
|
||||
|
@ -363,6 +364,10 @@ def main(batch: str, mgroup_obj=None):
|
|||
data["六车间中检_日期"] = ";".join([item.strftime("%Y-%m-%d") for item in data["六车间中检_日期"]])
|
||||
data['六车间中检_检验人'] = list(set(data['六车间中检_检验人']))
|
||||
data['六车间中检_检验人'] = ";".join([item.name for item in data['六车间中检_检验人']])
|
||||
data['六车间中检_合格率'] = round(data['六车间中检_count_ok'] * 100/ data['六车间中检_count'], 1)
|
||||
|
||||
# 六车间当前库存总数
|
||||
data["六车间库存_count"] = WMaterial.objects.filter(batch=batch, belong_dept=dept6).aggregate(Sum('count'))['count__sum'] or 0
|
||||
|
||||
# 六车间入库/检验数据
|
||||
mioitem6_qs2 = MIOItem.objects.filter(mio__belong_dept=dept6, mio__type="do_in",
|
||||
|
@ -451,7 +456,9 @@ def main(batch: str, mgroup_obj=None):
|
|||
# data['成品检验_检验人'] = list(set(data['成品检验_检验人']))
|
||||
# data['成品检验_检验人'] = ";".join([item.name for item in data['成品检验_检验人']])
|
||||
# data['成品检验_合格率'] = round(data['成品检验_count_ok'] * 100/ data['成品检验_count'], 1)
|
||||
|
||||
|
||||
# 仓库数据
|
||||
data["仓库_count"] = MaterialBatch.objects.filter(batch=batch).aggregate(Sum("count"))["count__sum"] or 0
|
||||
|
||||
# 销售发货数据
|
||||
mioitem_qs = MIOItem.objects.filter(batch=batch, mio__type="sale_out", mio__submit_time__isnull=False)
|
||||
|
|
Loading…
Reference in New Issue