Merge pull request 'feat: inm 生产领料/入库支持带 defect 物料并按 okcate 推导 state' (#3) from fix/inm-defect-do-out into master
Reviewed-on: http://gitea.xxhhcty.xyz:8080/zcdsj/factory/pulls/3
This commit is contained in:
commit
08d9b7c7a7
|
|
@ -13,9 +13,6 @@ 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
|
||||
|
|
@ -75,6 +72,10 @@ 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("存在非正数!")
|
||||
|
|
@ -85,7 +86,7 @@ def do_out(item: MIOItem, is_reverse: bool = False):
|
|||
material=xmaterial,
|
||||
warehouse=item.warehouse,
|
||||
batch=xbatch,
|
||||
state=WMaterial.WM_OK,
|
||||
state=state,
|
||||
defect=defect
|
||||
)
|
||||
except (MaterialBatch.DoesNotExist, MaterialBatch.MultipleObjectsReturned) as e:
|
||||
|
|
@ -101,7 +102,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=WMaterial.WM_OK, defect=defect)
|
||||
state=state, defect=defect)
|
||||
if new_create:
|
||||
wm.create_by = do_user
|
||||
wm.batch_ofrom = mb.batch if mb else None
|
||||
|
|
@ -176,6 +177,10 @@ 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:
|
||||
|
|
@ -187,7 +192,7 @@ def do_in(item: MIOItem):
|
|||
belong_dept=belong_dept,
|
||||
mgroup=mgroup,
|
||||
defect=defect,
|
||||
state=WMaterial.WM_OK)
|
||||
state=state)
|
||||
count_x = wm_qs.count()
|
||||
if count_x == 1:
|
||||
wm = wm_qs.first()
|
||||
|
|
@ -219,7 +224,7 @@ def do_in(item: MIOItem):
|
|||
material=xmaterial,
|
||||
warehouse=item.warehouse,
|
||||
batch=xbatch,
|
||||
state=WMaterial.WM_OK,
|
||||
state=state,
|
||||
defect=defect,
|
||||
defaults={
|
||||
"count": 0,
|
||||
|
|
|
|||
Loading…
Reference in New Issue