解决工单开始结束的问题
This commit is contained in:
@@ -320,7 +320,11 @@ class MrpProduction(models.Model):
|
||||
elif production.state == 'pending_cam' and production.schedule_state == '未排':
|
||||
production.state = 'confirmed'
|
||||
elif production.state == 'to_close' and production.schedule_state == '已排':
|
||||
production.state = 'pending_cam'
|
||||
if all(
|
||||
wo_state in ('done', 'cancel') for wo_state in production.workorder_ids.mapped('state')):
|
||||
production.state = 'done'
|
||||
else:
|
||||
production.state = 'pending_cam'
|
||||
elif production.state == 'confirmed' and production.is_adjust is True:
|
||||
production.state = 'technology_to_confirmed'
|
||||
if production.state == 'confirmed' and production.schedule_state == '已排':
|
||||
|
||||
@@ -1191,20 +1191,22 @@ class ResMrpWorkOrder(models.Model):
|
||||
})
|
||||
|
||||
if self.sequence == 1:
|
||||
# 判断工单状态是否为等待组件
|
||||
if self.state == 'waiting':
|
||||
raise UserError('制造订单【%s】缺少组件信息!' % self.production_id.name)
|
||||
# 判断是否有坯料的序列号信息
|
||||
boolean = False
|
||||
if self.production_id.move_raw_ids:
|
||||
# 如果是原材料,不判断序列号
|
||||
if self.production_id.move_raw_ids[0].product_id.categ_type == '原材料':
|
||||
boolean = True
|
||||
elif self.production_id.move_raw_ids[0].move_line_ids:
|
||||
if self.production_id.move_raw_ids[0].product_id.categ_type == '坯料':
|
||||
if self.production_id.move_raw_ids[0].move_line_ids:
|
||||
if self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name:
|
||||
boolean = True
|
||||
if self.production_id.move_raw_ids[0].move_line_ids:
|
||||
if self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name:
|
||||
boolean = True
|
||||
else:
|
||||
boolean = True
|
||||
if not boolean:
|
||||
raise UserError('制造订单【%s】缺少组件的序列号信息!' % self.production_id.name)
|
||||
if self.production_id.move_raw_ids[0].product_id.categ_type == '坯料':
|
||||
self.pro_code = self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name
|
||||
self.pro_code = self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name
|
||||
# cnc校验
|
||||
if self.production_id.production_type == '自动化产线加工':
|
||||
cnc_workorder = self.search(
|
||||
|
||||
Reference in New Issue
Block a user