feat: get_alldata_with_batch_and_store
This commit is contained in:
parent
ee3dc6a5a2
commit
18f39bff9c
|
@ -11,8 +11,15 @@ def get_alldata_with_batch_and_store(batch: str):
|
|||
"""
|
||||
获取某个批次的整体生产数据并保存
|
||||
"""
|
||||
need_update = False
|
||||
if BASE_PROJECT_CODE == "gzerp":
|
||||
need_update = True
|
||||
last_time, data = get_alldata_with_batch(batch)
|
||||
elif BASE_PROJECT_CODE == "gxerp":
|
||||
need_update = True
|
||||
last_time, data = get_alldata_with_batch_gx(batch)
|
||||
|
||||
if need_update and last_time and data:
|
||||
bobj, _ = BatchSt.objects.get_or_create(batch=batch, defaults={
|
||||
"last_time": last_time
|
||||
})
|
||||
|
@ -20,6 +27,12 @@ def get_alldata_with_batch_and_store(batch: str):
|
|||
bobj.data = data
|
||||
bobj.save()
|
||||
|
||||
def get_alldata_with_batch_gx(batch: str):
|
||||
"""
|
||||
光芯获取batch的统计数据
|
||||
"""
|
||||
pass
|
||||
|
||||
def get_alldata_with_batch(batch: str):
|
||||
"""
|
||||
获取某个批次的整体生产数据
|
||||
|
@ -56,7 +69,7 @@ def get_alldata_with_batch(batch: str):
|
|||
data[f'棒料成型_{field}'] += getattr(item, field)
|
||||
# 整理棒料成型数据
|
||||
data["产品规格"] = list(set(data["产品规格"]))
|
||||
data["产品规格"] = ";".join([item.specification for item in data["产品规格"]])
|
||||
data["产品规格"] = ";".join([item.specification if item.specification else "" for item in data["产品规格"]])
|
||||
data["棒料成型_出料人"] = list(set(data["棒料成型_出料人"]))
|
||||
data["棒料成型_出料人"] = ";".join([item.name for item in data["棒料成型_出料人"]])
|
||||
data["棒料成型_切料人"] = list(set(data["棒料成型_切料人"]))
|
||||
|
|
Loading…
Reference in New Issue