添加人工线下加工工单排序

This commit is contained in:
liaodanlong
2025-01-02 12:49:46 +08:00
parent a1bf997d51
commit 0ce51a4a66
3 changed files with 2 additions and 79 deletions

View File

@@ -941,6 +941,8 @@ class MrpProduction(models.Model):
and item.process_parameters_id == work.surface_technics_parameters_id) or
(item.route_id.name == work.name and item.panel
and item.panel == work.processing_panel))
if work.name == '人工线下加工':
td_ids = technology_design_ids.filtered(lambda item: (item.route_id.name in work.name))
if td_ids:
work.sequence = td_ids[0].sequence
cancel_work_ids = workorder_ids.filtered(lambda item: item.state in ('已取消', 'cancel'))

View File

@@ -25,38 +25,6 @@ class ProductionTechnologyReAdjustWizard(models.TransientModel):
# 该制造订单的其他同一销售订单的制造订单的工艺设计处理
if production_item != self.production_id:
self.env['sf.technology.design'].sudo().unified_procedure_multiple_work_orders(technology_designs, production_item)
# for td_other in production_item.technology_design_ids:
# # if td_other.is_auto is False:
# # td_del = technology_designs.filtered(lambda tdo: tdo.route_id.id == td_other.route_id.id)
# # if not td_del or td_del.active is False:
# # td_other.write({'active': False})
# for td_main in technology_designs:
# route_other = production_item.technology_design_ids.filtered(
# lambda td: td.route_id.id == td_main.route_id.id)
# if not route_other and td_main.active is True:
# production_item.write({'technology_design_ids': [(0, 0, {
# 'route_id': td_main.route_id.id,
# 'process_parameters_id': False if td_main.process_parameters_id is False else
# self.env[
# 'sf.production.process.parameter'].search(
# [('id', '=', td_main.process_parameters_id.id)]).id,
# 'sequence': td_main.sequence,
# 'is_auto': td_main.is_auto})]})
# else:
# for ro in route_other:
# domain = [('production_id', '=', self.production_id.id),
# ('active', 'in', [True, False]),
# ('route_id', '=', ro.route_id.id)]
# if ro.route_id.routing_type == '表面工艺':
# domain += [('process_parameters_id', '=', ro.process_parameters_id.id)]
# elif ro.route_id.routing_tag == 'special' and ro.is_auto is False:
# # display_name = ro.route_id.display_name
# domain += [('id', '=', ro.id)]
# elif ro.panel is not False:
# domain += [('panel', '=', ro.panel)]
# td_upd = self.env['sf.technology.design'].sudo().search(domain)
# if td_upd:
# ro.write({'sequence': td_upd.sequence, 'active': td_upd.active})
special_design = self.env['sf.technology.design'].sudo().search(
[('routing_tag', '=', 'special'), ('production_id', '=', production_item.id),
('is_auto', '=', False), ('active', 'in', [True, False])])
@@ -71,23 +39,6 @@ class ProductionTechnologyReAdjustWizard(models.TransientModel):
else:
domain += [('technology_design_id', '=', special.id), ('state', '!=', 'cancel')]
workorder = self.env['mrp.workorder'].search(domain)
# previous_workorder = self.env['mrp.workorder'].search(
# [('sequence', '=', workorder.sequence - 1), ('routing_type', '=', '表面工艺'),
# ('production_id', '=', workorder.production_id.id)])
# if previous_workorder:
# if previous_workorder.supplier_id != workorder.supplier_id:
# is_cancel = True
# else:
# is_cancel = True
# if workorder.state != 'cancel' and is_cancel is True:
# workorder.write({'state': 'cancel'})
# workorder.picking_ids.write({'state': 'cancel'})
# workorder.picking_ids.move_ids.write({'state': 'cancel'})
# purchase_order = self.env['purchase.order'].search(
# [('origin', '=', workorder.production_id.name)])
# for line in purchase_order.order_line:
# if line.product_id.server_product_process_parameters_id == workorder.surface_technics_parameters_id:
# purchase_order.write({'state': 'cancel'})
else:
workorder = self.env['mrp.workorder'].search(
[('technology_design_id', '=', special.id), ('production_id', '=', special.production_id.id), ('state', '!=', 'cancel')])

View File

@@ -27,36 +27,6 @@ class ProductionTechnologyWizard(models.TransientModel):
if production != self.production_id:
self.env['sf.technology.design'].sudo().unified_procedure_multiple_work_orders(technology_designs,
production)
# for td_other in production.technology_design_ids:
# if td_other.is_auto is False:
# td_del = technology_designs.filtered(lambda tdo: tdo.route_id.id == td_other.route_id.id)
# if not td_del or td_del.active is False:
# td_other.write({'active': False})
# for td_main in technology_designs:
# route_other = production.technology_design_ids.filtered(
# lambda td: td.route_id.id == td_main.route_id.id)
# if not route_other and td_main.active is True:
# production.write({'technology_design_ids': [(0, 0, {
# 'route_id': td_main.route_id.id,
# 'process_parameters_id': False if td_main.process_parameters_id is False else self.env[
# 'sf.production.process.parameter'].search(
# [('id', '=', td_main.process_parameters_id.id)]).id,
# 'sequence': td_main.sequence})]})
# else:
# for ro in route_other:
# domain = [('production_id', '=', self.production_id.id),
# ('active', 'in', [True, False]),
# ('route_id', '=', ro.route_id.id)]
# if ro.route_id.routing_type == '表面工艺':
# domain += [('process_parameters_id', '=', ro.process_parameters_id.id)]
# elif ro.route_id.routing_tag == 'special' and ro.is_auto is False:
# # display_name = ro.route_id.display_name
# domain += [('id', '=', ro.id)]
# elif ro.panel is not False:
# domain += [('panel', '=', ro.panel)]
# td_upd = self.env['sf.technology.design'].sudo().search(domain)
# if td_upd:
# ro.write({'sequence': td_upd.sequence, 'active': td_upd.active})
# 特殊表面工艺
special_design = self.env['sf.technology.design'].sudo().search(
[('routing_tag', '=', 'special'), ('production_id', '=', production.id),