From 0735b5d2b7a0e01b7c1ae635fd6e14156a38c99b Mon Sep 17 00:00:00 2001 From: caoqianming Date: Thu, 22 May 2025 16:48:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20BatchLog=E5=88=9B=E5=BB=BA=E6=97=B6?= =?UTF-8?q?=E8=8E=B7=E5=8F=96source=E5=86=8D=E5=88=9B=E5=BB=BAtarget?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wpm/services.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/wpm/services.py b/apps/wpm/services.py index aa37deee..dd2befd1 100644 --- a/apps/wpm/services.py +++ b/apps/wpm/services.py @@ -177,12 +177,12 @@ def mlog_submit(mlog: Mlog, user: User, now: Union[datetime.datetime, None]): m_outs = Mlogb.objects.filter(mlog=mlog, material_out__isnull=False) for item in m_outs: if item.mlogb_from and item.batch != item.mlogb_from.batch: - target, _ = BatchSt.g_create(batch=item.batch, mlog=mlog, material_start=item.material_out) source, _ = BatchSt.g_create(batch=item.mlogb_from.batch) + target, _ = BatchSt.g_create(batch=item.batch, mlog=mlog, material_start=item.material_out) BatchLog.g_create(source= source, target=target, mlog=mlog) if item.mlogbw_from and item.batch != item.mlogbw_from.mlogb.batch: - target, _ = BatchSt.g_create(batch=item.batch, mlog=mlog, material_start=item.material_out) source, _ = BatchSt.g_create(batch=item.mlogbw_from.mlogb.batch) + target, _ = BatchSt.g_create(batch=item.batch, mlog=mlog, material_start=item.material_out) BatchLog.g_create(source=source, target=target, mlog=mlog) if material_in or is_fix: # 需要进行车间库存管理 @@ -756,17 +756,17 @@ def handover_submit(handover:Handover, user: User, now: Union[datetime.datetime, # 合并为新批 if mtype == Handover.H_MERGE: + source, _ = BatchSt.g_create(batch=wm_from.batch) batch = new_batch if new_target is None: new_target, _ = BatchSt.g_create(batch=batch, handover=handover, material_start=material) - source, _ = BatchSt.g_create(batch=wm_from.batch) BatchLog.g_create(source=source, target=new_target, handover=handover, relation_type="merge") elif mtype == Handover.H_DIV: - batch = handover_or_b.batch - target, _ = BatchSt.g_create(batch=batch, handover=handover, material_start=material) if handover.wm is None: raise ParseError('拆批请选择车间库存') source, _ = BatchSt.g_create(batch=handover.wm.batch) + batch = handover_or_b.batch + target, _ = BatchSt.g_create(batch=batch, handover=handover, material_start=material) BatchLog.g_create(source=source, target=target, handover=handover, relation_type="split") else: batch = wm_from.batch