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