fix: ftestwork_submit bug

This commit is contained in:
caoqianming 2024-08-12 17:31:19 +08:00
parent 096ad540d4
commit e6e4a61289
1 changed files with 2 additions and 2 deletions

View File

@ -8,13 +8,13 @@ from django.utils import timezone
def ftestwork_submit(ins:FtestWork, user: User): def ftestwork_submit(ins:FtestWork, user: User):
wm:WMaterial = ins.wm wm:WMaterial = ins.wm
# 更新对应的车间库存 # 更新对应的车间库存
wm.count = wm.count - ins.count_notok wm.count = wm.count - ins.count
if wm.count >= 0: if wm.count >= 0:
# 已检测的数量 # 已检测的数量
wm.count_xtest = wm.count_xtest + ins.count wm.count_xtest = wm.count_xtest + ins.count
wm.save() wm.save()
else: else:
raise ParseError("车间库存不足") raise ParseError("超过待检数量")
# 生成合格的 # 生成合格的
count_ok = ins.count_ok count_ok = ins.count_ok
if count_ok > 0: if count_ok > 0: