diff --git a/apps/inm/services.py b/apps/inm/services.py index 49f6f965..b22d3577 100644 --- a/apps/inm/services.py +++ b/apps/inm/services.py @@ -132,9 +132,10 @@ def do_in(item: MIOItem): else: raise ParseError(f'{str(xmaterial)}-{xbatch}车间物料不足') + wm_production_dept = wm.mgroup.belong_dept if wm.mgroup else None if production_dept is None: - production_dept = wm.mgroup.belong_dept - elif production_dept != wm.mgroup.belong_dept: + 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: