feat: mlogbin的编辑与mlogbout的联动
This commit is contained in:
parent
95b10371b9
commit
1366f432ee
|
@ -789,17 +789,19 @@ class MlogbInUpdateSerializer(CustomModelSerializer):
|
||||||
if mlogb_defect_objects:
|
if mlogb_defect_objects:
|
||||||
MlogbDefect.objects.bulk_create(mlogb_defect_objects)
|
MlogbDefect.objects.bulk_create(mlogb_defect_objects)
|
||||||
# 只有普通工序的才可联动
|
# 只有普通工序的才可联动
|
||||||
|
material_out:Material = ins.mlog.material_out
|
||||||
route:Route = mlog.route
|
route:Route = mlog.route
|
||||||
if route and route.process and route.process.mtype == Process.PRO_NORMAL:
|
if material_out.tracking == Material.MA_TRACKING_BATCH:
|
||||||
mlogbout_qs = Mlogb.objects.filter(mlog=ins.mlog, mlogb_from=ins)
|
if route and route.process and route.process.mtype == Process.PRO_NORMAL:
|
||||||
if mlogbout_qs.count() == 1:
|
mlogbout_qs = Mlogb.objects.filter(mlog=ins.mlog, mlogb_from=ins)
|
||||||
mlogbout = mlogbout_qs.first()
|
if mlogbout_qs.count() == 1:
|
||||||
mlogbout.count_real = ins.count_use - ins.count_pn_jgqbl - ins.count_break
|
mlogbout = mlogbout_qs.first()
|
||||||
mlogbout.count_ok = mlogbout.count_real - mlogbout.count_notok
|
mlogbout.count_real = ins.count_use - ins.count_pn_jgqbl - ins.count_break
|
||||||
if mlogbout.count_real < 0 or mlogbout.count_ok < 0:
|
mlogbout.count_ok = mlogbout.count_real - mlogbout.count_notok
|
||||||
raise ParseError("对应的产出数异常")
|
if mlogbout.count_real < 0 or mlogbout.count_ok < 0:
|
||||||
mlogbout.save(update_fields=["count_real", "count_ok"])
|
raise ParseError("对应的产出数异常")
|
||||||
mlogbout.cal_count_notok(cal_mlog=False)
|
mlogbout.save(update_fields=["count_real", "count_ok"])
|
||||||
|
mlogbout.cal_count_notok(cal_mlog=False)
|
||||||
ins.cal_count_notok(cal_mlog=False)
|
ins.cal_count_notok(cal_mlog=False)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue