Compare commits
2 Commits
6dfab46b4d
...
6125139fbf
Author | SHA1 | Date |
---|---|---|
|
6125139fbf | |
|
2169bbea68 |
|
@ -10,7 +10,7 @@ from apps.wpmw.models import Wpr
|
|||
from apps.qm.models import Ftest, Defect
|
||||
from django.db.models import Count, Q
|
||||
|
||||
def do_out(item: MIOItem):
|
||||
def do_out(item: MIOItem, is_reverse: bool = False):
|
||||
"""
|
||||
生产领料到车间
|
||||
"""
|
||||
|
@ -23,8 +23,6 @@ def do_out(item: MIOItem):
|
|||
mgroup = mio.mgroup
|
||||
do_user = mio.do_user
|
||||
material:Material = item.material
|
||||
if material.into_wm is False: # 用于混料的原料不与车间库存交互, 这个是配置项目
|
||||
return
|
||||
|
||||
# 获取defect
|
||||
defect:Defect = None
|
||||
|
@ -98,7 +96,7 @@ def do_out(item: MIOItem):
|
|||
else:
|
||||
mb.save()
|
||||
|
||||
|
||||
if material.into_wm:
|
||||
# 领到车间库存(或工段)
|
||||
wm, new_create = WMaterial.objects.get_or_create(
|
||||
batch=xbatch, material=xmaterial,
|
||||
|
@ -114,6 +112,8 @@ def do_out(item: MIOItem):
|
|||
|
||||
# 开始变动wpr
|
||||
if xmaterial.tracking == Material.MA_TRACKING_SINGLE:
|
||||
if material.into_wm is False:
|
||||
raise ParseError("追踪单个物料不支持不进行车间库存的操作")
|
||||
mioitemws = MIOItemw.objects.filter(mioitem=item)
|
||||
if mioitemws.count() != item.count:
|
||||
raise ParseError("出入库与明细数量不一致,操作失败")
|
||||
|
@ -141,8 +141,7 @@ def do_in(item: MIOItem):
|
|||
mgroup = mio.mgroup
|
||||
do_user = mio.do_user
|
||||
material = item.material
|
||||
if material.into_wm is False: # 根据配置不进行入车间库存的处理
|
||||
return
|
||||
|
||||
action_list = []
|
||||
mias = MIOItemA.objects.filter(mioitem=item)
|
||||
is_zhj = False # 是否组合件入仓库
|
||||
|
@ -177,7 +176,7 @@ def do_in(item: MIOItem):
|
|||
raise ParseError("存在非正数!")
|
||||
|
||||
xbatchs.append(xbatch)
|
||||
|
||||
if material.into_wm:
|
||||
wm_qs = WMaterial.objects.filter(
|
||||
batch=xbatch,
|
||||
material=xmaterial,
|
||||
|
@ -209,6 +208,7 @@ def do_in(item: MIOItem):
|
|||
production_dept = wm_production_dept
|
||||
elif wm_production_dept and production_dept != wm_production_dept:
|
||||
raise ParseError(f'{str(xmaterial)}-{xbatch}车间物料不属于同一车间')
|
||||
|
||||
# 增加mb
|
||||
if not is_zhj:
|
||||
mb, _ = MaterialBatch.objects.get_or_create(
|
||||
|
@ -231,6 +231,8 @@ def do_in(item: MIOItem):
|
|||
|
||||
# 开始变动wpr
|
||||
if xmaterial.tracking == Material.MA_TRACKING_SINGLE:
|
||||
if material.into_wm is False:
|
||||
raise ParseError("追踪单个物料不支持不进行车间库存的操作")
|
||||
mioitemws = MIOItemw.objects.filter(mioitem=item)
|
||||
if mioitemws.count() != item.count:
|
||||
raise ParseError("出入库与明细数量不一致,操作失败")
|
||||
|
|
Loading…
Reference in New Issue