新增退回调整

This commit is contained in:
jinling.yang
2024-11-12 11:43:40 +08:00
parent 026bf17a68
commit 8bbc65ef88
5 changed files with 102 additions and 79 deletions

View File

@@ -218,17 +218,17 @@ class MrpProduction(models.Model):
precision_rounding=move.product_uom.rounding or move.product_id.uom_id.rounding)
for move in production.move_raw_ids if move.product_id):
production.state = 'progress'
elif not production.technology_design_ids:
production.state = 'technology_to_confirmed'
# 新添加的状态逻辑
if (
production.state == 'to_close' or production.state == 'progress') and production.schedule_state == '未排':
production.state = 'confirmed'
if not production.workorder_ids:
production.state = 'technology_to_confirmed'
else:
production.state = 'confirmed'
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 production.state == 'progress':
if all(wo_state not in ('progress', 'done', 'rework', 'scrap') for wo_state in
production.workorder_ids.mapped('state')):
@@ -259,11 +259,11 @@ class MrpProduction(models.Model):
def technology_back_adjust(self):
special_design = self.technology_design_ids.filtered(
lambda a: a.routing_tag == 'special' and a.is_auto is False and a.active in [True,False])
lambda a: a.routing_tag == 'special' and a.is_auto is False and a.active in [True, False])
workorders_values = []
for item in special_design:
if item.active is False:
domain = [('production_id','=',self.id)]
domain = [('production_id', '=', self.id)]
if item.surface_technics_parameters_id:
domain += [('surface_technics_parameters_id', '=', item.process_parameters_id)]
else:
@@ -274,15 +274,21 @@ class MrpProduction(models.Model):
else:
workorder = self.env['mrp.workorder'].search([('name', '=', item.route_id.name)])
if not workorder:
workorders_values.append(
self.env[
'mrp.workorder']._json_workorder_surface_process_str(
production, route, product_production_process.seller_ids[0].partner_id.id))
if workorders_values:
self.workorders.write({})
if item.route_id.routing_type == '表面工艺':
product_production_process = self.env['product.template'].search(
[('server_product_process_parameters_id', '=', item.process_parameters_id.id)])
workorders_values.append(
self.env[
'mrp.workorder']._json_workorder_surface_process_str(self, item,
product_production_process.seller_ids[
0].partner_id.id))
else:
workorders_values.append(
self.env['mrp.workorder'].json_workorder_str(self, item))
if workorders_values:
self.write({'workorder_ids': workorders_values})
self._reset_work_order_sequence()
# 工艺确认
def technology_confirm(self):
@@ -1267,7 +1273,7 @@ class MrpProduction(models.Model):
'move_dest_ids': production.move_dest_ids.ids,
'user_id': production.user_id.id}
return production_values_str
# 增加制造订单类型
production_type = fields.Selection(
[('自动化产线加工', '自动化产线加工'), ('人工线下加工', '人工线下加工')],