Compare commits

..

No commits in common. "08d9b7c7a7f607d17d1b177faadc8eedeca2a6f6" and "5354557f4ac8a5b7ea03be506b80cdde2cda9cc8" have entirely different histories.

1 changed files with 18 additions and 23 deletions

View File

@ -13,6 +13,9 @@ def do_out(item: MIOItem, is_reverse: bool = False):
"""
生产领料到车间
"""
if item.mb and item.mb.defect is not None:
raise ParseError("生产领料不支持不合格品")
from apps.inm.models import MaterialBatch
mio:MIO = item.mio
belong_dept = mio.belong_dept
@ -72,10 +75,6 @@ def do_out(item: MIOItem, is_reverse: bool = False):
xcount:str = al[2]
defect:Defect = al[3]
state = WMaterial.WM_OK
if defect and defect.okcate in [Defect.DEFECT_NOTOK]:
state = WMaterial.WM_NOTOK
xbatches.append(xbatch)
if xcount <= 0:
raise ParseError("存在非正数!")
@ -86,7 +85,7 @@ def do_out(item: MIOItem, is_reverse: bool = False):
material=xmaterial,
warehouse=item.warehouse,
batch=xbatch,
state=state,
state=WMaterial.WM_OK,
defect=defect
)
except (MaterialBatch.DoesNotExist, MaterialBatch.MultipleObjectsReturned) as e:
@ -102,7 +101,7 @@ def do_out(item: MIOItem, is_reverse: bool = False):
wm, new_create = WMaterial.objects.get_or_create(
batch=xbatch, material=xmaterial,
belong_dept=belong_dept, mgroup=mgroup,
state=state, defect=defect)
state=WMaterial.WM_OK, defect=defect)
if new_create:
wm.create_by = do_user
wm.batch_ofrom = mb.batch if mb else None
@ -177,10 +176,6 @@ def do_in(item: MIOItem):
if xcount <= 0:
raise ParseError("存在非正数!")
state = WMaterial.WM_OK
if defect and defect.okcate in [Defect.DEFECT_NOTOK]:
state = WMaterial.WM_NOTOK
xbatchs.append(xbatch)
if xmaterial.into_wm:
if xwm:
@ -192,7 +187,7 @@ def do_in(item: MIOItem):
belong_dept=belong_dept,
mgroup=mgroup,
defect=defect,
state=state)
state=WMaterial.WM_OK)
count_x = wm_qs.count()
if count_x == 1:
wm = wm_qs.first()
@ -224,7 +219,7 @@ def do_in(item: MIOItem):
material=xmaterial,
warehouse=item.warehouse,
batch=xbatch,
state=state,
state=WMaterial.WM_OK,
defect=defect,
defaults={
"count": 0,