diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml
index 86cc7bd6..8171951b 100644
--- a/sf_manufacturing/views/mrp_workorder_view.xml
+++ b/sf_manufacturing/views/mrp_workorder_view.xml
@@ -251,7 +251,7 @@
decoration-danger="tag_type == '重新加工'"/>
+ attrs="{'invisible': [('rfid_code_old', '!=', False)]}" widget='qrcode_widget' />
diff --git a/sf_manufacturing/wizard/production_technology_re_adjust_wizard.py b/sf_manufacturing/wizard/production_technology_re_adjust_wizard.py
index 93cd9db1..ff174d0e 100644
--- a/sf_manufacturing/wizard/production_technology_re_adjust_wizard.py
+++ b/sf_manufacturing/wizard/production_technology_re_adjust_wizard.py
@@ -14,7 +14,7 @@ class ProductionTechnologyReAdjustWizard(models.TransientModel):
def confirm(self):
if self.is_technology_re_adjust is True:
- domain = [('origin', '=', self.origin), ('state', '=', 'confirmed')]
+ domain = [('origin', '=', self.origin), ('state', '=', 'technology_to_confirmed')]
else:
domain = [('id', '=', self.production_id.id)]
technology_designs = self.env['sf.technology.design'].sudo().search(
@@ -42,7 +42,8 @@ class ProductionTechnologyReAdjustWizard(models.TransientModel):
'is_auto': td_main.is_auto})]})
else:
for ro in route_other:
- domain = [('production_id', '=', self.production_id.id), ('active', 'in', [True, False]),
+ 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)]
@@ -103,8 +104,17 @@ class ProductionTechnologyReAdjustWizard(models.TransientModel):
else:
workorder.blocked_by_workorder_ids = blocked_by_workorder_ids[0]
productions._reset_work_order_sequence()
- productions.get_subcontract_pick_purchase()
+ if self.production_id.product_id.categ_id.type == '成品':
+ productions._reset_subcontract_pick_purchase()
+ productions.get_subcontract_pick_purchase()
+ productions.is_adjust = True
for item in productions:
workorders = item.workorder_ids.filtered(lambda wo: wo.state not in ('cancel')).sorted(
key=lambda a: a.sequence)
- workorders[0].state = 'waiting'
+ if workorders[0].state in ['pending']:
+ if workorder[0].production_id.product_id.categ_id.type == '成品':
+ cnc_workorder = self.search(
+ [('production_id', '=', item.id), ('routing_type', '=', 'CNC加工')],
+ limit=1, order='id asc')
+ if cnc_workorder.cnc_ids:
+ workorders[0].state = 'waiting'
diff --git a/sf_manufacturing/wizard/production_technology_wizard.py b/sf_manufacturing/wizard/production_technology_wizard.py
index 2293dc73..7c7ca766 100644
--- a/sf_manufacturing/wizard/production_technology_wizard.py
+++ b/sf_manufacturing/wizard/production_technology_wizard.py
@@ -14,8 +14,8 @@ class ProductionTechnologyWizard(models.TransientModel):
is_technology_confirm = fields.Boolean(default=False)
def confirm(self):
- if self.is_technology_confirm is True:
- domain = [('origin', '=', self.origin)]
+ if self.is_technology_confirm is True and self.production_id.product_id.categ_id.type == '成品':
+ domain = [('origin', '=', self.origin), ('state', '=', 'technology_to_confirmed')]
else:
domain = [('id', '=', self.production_id.id)]
technology_designs = self.production_id.technology_design_ids
@@ -56,9 +56,16 @@ class ProductionTechnologyWizard(models.TransientModel):
# lambda td: td.is_auto is False and td.process_parameters_id is not False)
# # if special:
productions._create_workorder(False)
- productions.get_subcontract_pick_purchase()
+ if self.production_id.product_id.categ_id.type == '成品':
+ productions.get_subcontract_pick_purchase()
+ productions.is_adjust = False
for item in productions:
workorder = item.workorder_ids.filtered(lambda wo: wo.state not in ('cancel')).sorted(
key=lambda a: a.sequence)
if workorder[0].state in ['pending']:
- workorder[0].state = 'waiting'
+ if workorder[0].production_id.product_id.categ_id.type == '成品':
+ cnc_workorder = self.search(
+ [('production_id', '=', item.id), ('routing_type', '=', 'CNC加工')],
+ limit=1, order='id asc')
+ if cnc_workorder.cnc_ids:
+ workorder[0].state = 'waiting'
diff --git a/sf_manufacturing/wizard/production_wizard.py b/sf_manufacturing/wizard/production_wizard.py
index 3e1ff941..9b7a0e58 100644
--- a/sf_manufacturing/wizard/production_wizard.py
+++ b/sf_manufacturing/wizard/production_wizard.py
@@ -46,58 +46,5 @@ class ProductionWizard(models.TransientModel):
ret = {'programming_list': [], 'is_reprogramming': self.is_reprogramming}
if self.is_reprogramming is True:
self.production_id.update_programming_state()
- else:
- scrap_cnc = self.production_id.workorder_ids.filtered(lambda crw: crw.routing_type == 'CNC加工').cnc_ids
- scrap_cmm = self.production_id.workorder_ids.filtered(lambda cm: cm.routing_type == 'CNC加工').cmm_ids
- for item_line in scrap_cnc:
- vals = {
- 'sequence_number': item_line.sequence_number,
- 'program_name': item_line.program_name,
- 'cutting_tool_name': item_line.cutting_tool_name,
- 'cutting_tool_no': item_line.cutting_tool_no,
- 'processing_type': item_line.processing_type,
- 'margin_x_y': item_line.margin_x_y,
- 'margin_z': item_line.margin_z,
- 'depth_of_processing_z': item_line.depth_of_processing_z,
- 'cutting_tool_extension_length': item_line.cutting_tool_extension_length,
- 'estimated_processing_time': item_line.estimated_processing_time,
- 'cutting_tool_handle_type': item_line.cutting_tool_handle_type,
- 'ftp_path': item_line.program_path,
- 'processing_panel': item_line.workorder_id.processing_panel,
- 'program_create_date': datetime.strftime(item_line.program_create_date,
- '%Y-%m-%d %H:%M:%S'),
- 'remark': item_line.remark
- }
- ret['programming_list'].append(vals)
- for cmm_line in scrap_cmm:
- vals = {
- 'sequence_number': cmm_line.sequence_number,
- 'program_name': cmm_line.program_name,
- 'ftp_path': cmm_line.program_path,
- 'processing_panel': item_line.workorder_id.processing_panel,
- 'program_create_date': datetime.strftime(
- cmm_line.program_create_date,
- '%Y-%m-%d %H:%M:%S')
- }
- ret['programming_list'].append(vals)
-
new_production = self.production_id.recreateManufacturing(ret)
self.production_id.write({'remanufacture_production_id': new_production.id})
- if self.is_reprogramming is False:
- for panel in new_production.product_id.model_processing_panel.split(','):
- scrap_cnc_workorder = max(
- self.production_id.workorder_ids.filtered(
- lambda
- scn: scn.processing_panel == panel and scn.routing_type == 'CNC加工'),
- key=lambda w: w.create_date)
- scrap_pre_workorder = max(self.production_id.workorder_ids.filtered(
- lambda
- pr: pr.processing_panel == panel and pr.routing_type == '装夹预调'),
- key=lambda w1: w1.create_date)
- new_cnc_workorder = new_production.workorder_ids.filtered(
- lambda
- nc: nc.processing_panel == panel and nc.routing_type == 'CNC加工')
- new_cnc_workorder.write({'cnc_worksheet': scrap_cnc_workorder.cnc_worksheet})
- new_pre_workorder = new_production.workorder_ids.filtered(lambda
- p: p.routing_type == '装夹预调' and p.processing_panel == panel)
- new_pre_workorder.write({'processing_drawing': scrap_pre_workorder.processing_drawing})
diff --git a/sf_manufacturing/wizard/rework_wizard.py b/sf_manufacturing/wizard/rework_wizard.py
index 4698a994..b2c251f7 100644
--- a/sf_manufacturing/wizard/rework_wizard.py
+++ b/sf_manufacturing/wizard/rework_wizard.py
@@ -13,6 +13,8 @@ class ReworkWizard(models.TransientModel):
workorder_id = fields.Many2one('mrp.workorder', string='工单')
product_id = fields.Many2one('product.product')
production_id = fields.Many2one('mrp.production', string='制造订单号')
+ workorder_ids = fields.Many2many('mrp.workorder', 'rework_wizard_to_work_order', string='所有工单',
+ domain="[('production_id', '=', production_id),('state','=','done')]")
rework_reason = fields.Selection(
[("programming", "编程"), ("cutter", "刀具"), ("clamping", "装夹"),
("operate computer", "操机"),
@@ -48,100 +50,116 @@ class ReworkWizard(models.TransientModel):
'test_report': self.workorder_id.detection_report})]})
self.workorder_id.button_finish()
else:
- if self.production_id.workorder_ids:
- handle_result = self.production_id.detection_result_ids.filtered(
- lambda dr: dr.handle_result == '待处理')
- if handle_result:
- processing_panels_to_handle = set(handle_item.processing_panel for handle_item in handle_result)
- processing_panels_choice = set(dr_panel.name for dr_panel in self.processing_panel_id)
- # 使用集合的差集操作找出那些待处理结果中有但实际可用加工面中没有的加工面
- processing_panels_missing = processing_panels_to_handle - processing_panels_choice
- # 存在不一致的加工面
- if processing_panels_missing:
- processing_panels_str = ','.join(processing_panels_missing)
- raise UserError('您还有待处理的检测结果中为%s的加工面未选择' % processing_panels_str)
- for panel in self.processing_panel_id:
- panel_workorder = self.production_id.workorder_ids.filtered(
- lambda ap: ap.processing_panel == panel.name and ap.state != 'rework')
- if panel_workorder:
- panel_workorder.write({'state': 'rework'})
- rework_clamp_workorder = max(panel_workorder.filtered(
- lambda
- rp: rp.processing_panel == panel.name and rp.routing_type == '装夹预调' and rp.state in [
- 'done', 'rework']))
- # panel_workorder.filtered(
- # lambda wo: wo.routing_type == '装夹预调').workpiece_delivery_ids.filtered(
- # lambda wd: wd.status == '待下发').write({'status': '已取消'})
- # workpiece = self.env['sf.workpiece.delivery'].search([('status', '=', '待下发'), (
- # 'workorder_id', '=',
- # panel_workorder.filtered(lambda wd: wd.routing_type == '装夹预调').id)])
- product_routing_workcenter = self.env['sf.product.model.type.routing.sort'].search(
- [('product_model_type_id', '=', self.production_id.product_id.product_model_type_id.id)],
- order='sequence asc'
- )
- workorders_values = []
- for route in product_routing_workcenter:
- if route.is_repeat is True:
- workorders_values.append(
- self.env['mrp.workorder'].json_workorder_str(panel.name,
- self.production_id, route, False))
- if workorders_values:
- self.production_id.write({'workorder_ids': workorders_values, 'is_rework': True})
- self.production_id._reset_work_order_sequence()
- self.production_id.detection_result_ids.filtered(
- lambda ap1: ap1.processing_panel == panel.name and ap1.handle_result == '待处理').write(
- {'handle_result': '已处理'})
- new_pre_workorder = self.production_id.workorder_ids.filtered(lambda
- p: p.routing_type == '装夹预调' and p.processing_panel == panel.name and p.state not in (
- 'rework', 'done'))
- if new_pre_workorder and rework_clamp_workorder and self.is_clamp_measure is True:
- new_pre_workorder.write(
- {'X1_axis': rework_clamp_workorder.X1_axis, 'Y1_axis': rework_clamp_workorder.Y1_axis
- , 'Z1_axis': rework_clamp_workorder.Z1_axis,
- 'X2_axis': rework_clamp_workorder.X2_axis
- , 'Y2_axis': rework_clamp_workorder.Y2_axis,
- 'Z2_axis': rework_clamp_workorder.Z2_axis
- , 'X3_axis': rework_clamp_workorder.X3_axis,
- 'Y3_axis': rework_clamp_workorder.Y3_axis
- , 'Z3_axis': rework_clamp_workorder.Z3_axis,
- 'X4_axis': rework_clamp_workorder.X4_axis
- , 'Y4_axis': rework_clamp_workorder.Y4_axis,
- 'Z4_axis': rework_clamp_workorder.Z4_axis
- , 'X5_axis': rework_clamp_workorder.X5_axis,
- 'Y5_axis': rework_clamp_workorder.Y5_axis
- , 'Z5_axis': rework_clamp_workorder.Z5_axis,
- 'X6_axis': rework_clamp_workorder.X6_axis
- , 'Y6_axis': rework_clamp_workorder.Y6_axis,
- 'Z6_axis': rework_clamp_workorder.Z6_axis
- , 'X7_axis': rework_clamp_workorder.X7_axis,
- 'Y7_axis': rework_clamp_workorder.Y7_axis
- , 'Z7_axis': rework_clamp_workorder.Z7_axis,
- 'X8_axis': rework_clamp_workorder.X8_axis
- , 'Y8_axis': rework_clamp_workorder.Y8_axis,
- 'Z8_axis': rework_clamp_workorder.Z8_axis
- , 'X9_axis': rework_clamp_workorder.X9_axis,
- 'Y9_axis': rework_clamp_workorder.Y9_axis
- , 'Z9_axis': rework_clamp_workorder.Z9_axis,
- 'X10_axis': rework_clamp_workorder.X10_axis
- , 'Y10_axis': rework_clamp_workorder.Y10_axis,
- 'Z10_axis': rework_clamp_workorder.Z10_axis
- , 'X_deviation_angle': rework_clamp_workorder.X_deviation_angle,
- 'material_center_point': rework_clamp_workorder.material_center_point
- })
- if self.is_reprogramming is False:
- if self.programming_state in ['已编程', '已下发']:
- if self.reprogramming_num >= 1 and self.programming_state == '已编程':
- self.production_id.get_new_program(panel.name)
- if self.reprogramming_num >= 0 and self.programming_state == '已下发':
+ if self.workorder_ids:
+ # handle_result = self.production_id.detection_result_ids.filtered(
+ # lambda dr: dr.handle_result == '待处理')
+ # if handle_result:
+ # processing_panels_to_handle = set(handle_item.processing_panel for handle_item in handle_result)
+ # processing_panels_choice = set(dr_panel.name for dr_panel in self.processing_panel_id)
+ # # 使用集合的差集操作找出那些待处理结果中有但实际可用加工面中没有的加工面
+ # processing_panels_missing = processing_panels_to_handle - processing_panels_choice
+ # # 存在不一致的加工面
+ # if processing_panels_missing:
+ # processing_panels_str = ','.join(processing_panels_missing)
+ # raise UserError('您还有待处理的检测结果中为%s的加工面未选择' % processing_panels_str)
+
+ rework_workorder_ids = self.production_id.workorder_ids.filtered(
+ lambda ap: ap.id in self.workorder_ids.ids)
+ clamp_workorder_ids = None
+ if rework_workorder_ids:
+ # 限制
+ # 1、单独返工CNC工单则不解绑托盘RFID,如单独返工装夹预调工单,则自动解绑托盘RFID;
+ # 2、返工CNC工单和装夹预调工单则自动解绑RFID
+ clamp_workorder_ids = rework_workorder_ids.filtered(lambda rp: rp.routing_type == '装夹预调')
+ if clamp_workorder_ids:
+ for clamp_workorder_id in clamp_workorder_ids:
+ self.production_id.workorder_ids.filtered(
+ lambda wk: wk.processing_panel == clamp_workorder_id.processing_panel).write(
+ {'rfid_code': False})
+ # 返工工单状态设置为【返工】
+ rework_workorder_ids.write({'state': 'rework'})
+ # 查询返工工单对应的工艺设计记录,并调用方法拼接数据,用于创建新的工单
+ workorders_values = []
+ for work in rework_workorder_ids:
+ route = self.production_id.technology_design_ids.filtered(
+ lambda item: (item.route_id.name in work.name and item.process_parameters_id
+ 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 route:
+ workorders_values.append(
+ self.env['mrp.workorder'].json_workorder_str(self.production_id, route[0]))
+ # 创建新工单,并进行返工配置的相关操作
+ if workorders_values:
+ # 创建新工单、工序排序、完成检测结果单据
+ self.production_id.write({'workorder_ids': workorders_values, 'is_rework': True})
+ new_work_ids = self.production_id.workorder_ids.filtered(lambda kw: kw.sequence == 0)
+ new_pre_workorder_ids = self.production_id.workorder_ids.filtered(
+ lambda kw: kw.routing_type == '装夹预调' and kw.sequence == 0)
+ self.production_id._reset_work_order_sequence()
+ self.production_id.detection_result_ids.filtered(
+ lambda ap1: ap1.handle_result == '待处理').write({'handle_result': '已处理'})
+ panels = [] # 返工的加工面
+ # ===================保留装夹测量数据=====================
+ if self.is_clamp_measure and clamp_workorder_ids and new_pre_workorder_ids:
+ for new_pre_workorder in new_pre_workorder_ids:
+ if new_pre_workorder.processing_panel and new_pre_workorder.processing_panel not in panels:
+ panels.append(new_pre_workorder.processing_panel)
+ for rework_clamp_workorder in clamp_workorder_ids:
+ if new_pre_workorder.sequence == rework_clamp_workorder.sequence + 1:
+ new_pre_workorder.write(
+ {'X1_axis': rework_clamp_workorder.X1_axis,
+ 'Y1_axis': rework_clamp_workorder.Y1_axis
+ , 'Z1_axis': rework_clamp_workorder.Z1_axis,
+ 'X2_axis': rework_clamp_workorder.X2_axis
+ , 'Y2_axis': rework_clamp_workorder.Y2_axis,
+ 'Z2_axis': rework_clamp_workorder.Z2_axis
+ , 'X3_axis': rework_clamp_workorder.X3_axis,
+ 'Y3_axis': rework_clamp_workorder.Y3_axis
+ , 'Z3_axis': rework_clamp_workorder.Z3_axis,
+ 'X4_axis': rework_clamp_workorder.X4_axis
+ , 'Y4_axis': rework_clamp_workorder.Y4_axis,
+ 'Z4_axis': rework_clamp_workorder.Z4_axis
+ , 'X5_axis': rework_clamp_workorder.X5_axis,
+ 'Y5_axis': rework_clamp_workorder.Y5_axis
+ , 'Z5_axis': rework_clamp_workorder.Z5_axis,
+ 'X6_axis': rework_clamp_workorder.X6_axis
+ , 'Y6_axis': rework_clamp_workorder.Y6_axis,
+ 'Z6_axis': rework_clamp_workorder.Z6_axis
+ , 'X7_axis': rework_clamp_workorder.X7_axis,
+ 'Y7_axis': rework_clamp_workorder.Y7_axis
+ , 'Z7_axis': rework_clamp_workorder.Z7_axis,
+ 'X8_axis': rework_clamp_workorder.X8_axis
+ , 'Y8_axis': rework_clamp_workorder.Y8_axis,
+ 'Z8_axis': rework_clamp_workorder.Z8_axis
+ , 'X9_axis': rework_clamp_workorder.X9_axis,
+ 'Y9_axis': rework_clamp_workorder.Y9_axis
+ , 'Z9_axis': rework_clamp_workorder.Z9_axis,
+ 'X10_axis': rework_clamp_workorder.X10_axis
+ , 'Y10_axis': rework_clamp_workorder.Y10_axis,
+ 'Z10_axis': rework_clamp_workorder.Z10_axis
+ , 'X_deviation_angle': rework_clamp_workorder.X_deviation_angle,
+ 'material_center_point': rework_clamp_workorder.material_center_point
+ })
+ break
+ # =====================不申请重新编程====================
+ if self.is_reprogramming is False:
+ if self.programming_state in ['已编程', '已下发']:
+ if self.reprogramming_num >= 1 and self.programming_state == '已编程':
+ for panel_name in panels:
+ self.production_id.get_new_program(panel_name)
+ if self.reprogramming_num >= 0 and self.programming_state == '已下发':
+ # ============= 处理CNC加工加工工单的 CNC程序和cmm程序 信息=============
+ for cnc_work in new_work_ids.filtered(lambda wk: wk.name == 'CNC加工'):
ret = {'programming_list': []}
- cnc_rework = max(
- self.production_id.workorder_ids.filtered(
- lambda
- crw: crw.processing_panel == panel.name and crw.state == 'rework' and crw.routing_type == 'CNC加工'),
+ old_cnc_rework = max(self.production_id.workorder_ids.filtered(
+ lambda crw: crw.processing_panel == cnc_work.processing_panel
+ and crw.state == 'rework' and crw.routing_type == 'CNC加工'),
key=lambda w: w.create_date
)
- if cnc_rework.cnc_ids:
- for item_line in cnc_rework.cnc_ids:
+ # 获取当前工单的CNC程序和cmm程序
+ if old_cnc_rework.cnc_ids:
+ for item_line in old_cnc_rework.cnc_ids:
vals = {
'sequence_number': item_line.sequence_number,
'program_name': item_line.program_name,
@@ -156,46 +174,50 @@ class ReworkWizard(models.TransientModel):
'cutting_tool_handle_type': item_line.cutting_tool_handle_type,
'program_path': item_line.program_path,
'ftp_path': item_line.program_path,
- 'processing_panel': panel.name,
+ 'processing_panel': cnc_work.processing_panel,
'program_create_date': datetime.strftime(item_line.program_create_date,
'%Y-%m-%d %H:%M:%S'),
'remark': item_line.remark
}
ret['programming_list'].append(vals)
- for cmm_line in cnc_rework.cmm_ids:
+ for cmm_line in old_cnc_rework.cmm_ids:
vals = {
'sequence_number': cmm_line.sequence_number,
'program_name': cmm_line.program_name,
'program_path': cmm_line.program_path,
'ftp_path': cmm_line.program_path,
- 'processing_panel': panel.name,
+ 'processing_panel': cnc_work.processing_panel,
'program_create_date': datetime.strftime(
cmm_line.program_create_date,
'%Y-%m-%d %H:%M:%S')
}
ret['programming_list'].append(vals)
+ # 获取新的
new_cnc_workorder = self.production_id.workorder_ids.filtered(
- lambda ap1: ap1.processing_panel == panel.name and ap1.state not in (
- 'rework', 'done') and ap1.routing_type == 'CNC加工')
+ lambda ap1: ap1.processing_panel == cnc_work.processing_panel
+ and ap1.state not in (
+ 'rework', 'done') and ap1.routing_type == 'CNC加工'
+ )
if not new_cnc_workorder.cnc_ids:
new_cnc_workorder.write({
- 'cnc_ids': new_cnc_workorder.cnc_ids.sudo()._json_cnc_processing(panel.name,
- ret),
- 'cmm_ids': new_cnc_workorder.cmm_ids.sudo()._json_cmm_program(panel.name,
- ret),
- 'cnc_worksheet': cnc_rework.cnc_worksheet})
-
- if new_pre_workorder:
- pre_rework = max(self.production_id.workorder_ids.filtered(
- lambda pr: pr.processing_panel == panel.name and pr.state in (
- 'rework') and pr.routing_type == '装夹预调'),
- key=lambda w1: w1.create_date)
- new_pre_workorder.write(
- {'processing_drawing': pre_rework.processing_drawing})
- self.production_id.write({'state': 'progress', 'is_rework': False})
- elif self.programming_state in ['待编程', '编程中']:
- self.production_id.write(
- {'programming_state': '编程中', 'work_state': '编程中', 'is_rework': True})
+ 'cnc_ids': new_cnc_workorder.cnc_ids.sudo()._json_cnc_processing(
+ cnc_work.processing_panel, ret),
+ 'cmm_ids': new_cnc_workorder.cmm_ids.sudo()._json_cmm_program(
+ cnc_work.processing_panel, ret),
+ 'cnc_worksheet': old_cnc_rework.cnc_worksheet})
+ # ========== 处理装夹预调 【装夹图纸】 数据 ================
+ for new_pre_work in new_pre_workorder_ids:
+ pre_rework = max(self.production_id.workorder_ids.filtered(
+ lambda pr: (pr.processing_panel == new_pre_work.processing_panel
+ and pr.state in ['rework'] and pr.routing_type == '装夹预调')),
+ key=lambda w1: w1.create_date)
+ new_pre_work.write(
+ {'processing_drawing': pre_rework.processing_drawing})
+ self.production_id.write({'state': 'progress', 'is_rework': False})
+ elif self.programming_state in ['待编程', '编程中']:
+ self.production_id.write(
+ {'programming_state': '编程中', 'work_state': '编程中', 'is_rework': True})
+ # ==================申请重新编程=======================
if self.is_reprogramming is True:
self.production_id.update_programming_state()
self.production_id.write(
diff --git a/sf_manufacturing/wizard/rework_wizard_views.xml b/sf_manufacturing/wizard/rework_wizard_views.xml
index d8cf0fb9..a6d9f7ab 100644
--- a/sf_manufacturing/wizard/rework_wizard_views.xml
+++ b/sf_manufacturing/wizard/rework_wizard_views.xml
@@ -11,10 +11,14 @@
+
-
-
+
+
+
+
+
+
保留装夹测量数据
diff --git a/sf_mrs_connect/controllers/controllers.py b/sf_mrs_connect/controllers/controllers.py
index 5f5aee06..c91057a7 100644
--- a/sf_mrs_connect/controllers/controllers.py
+++ b/sf_mrs_connect/controllers/controllers.py
@@ -29,7 +29,7 @@ class Sf_Mrs_Connect(http.Controller, MultiInheritController):
if ret['manufacturing_type'] in ('scrap', 'invalid_tool_rework'):
domain += [('state', 'not in', ['done', 'scrap', 'cancel'])]
else:
- domain += [('state', '=', 'confirmed')]
+ domain += [('state', 'in', ['confirmed', 'pending_cam'])]
productions = request.env['mrp.production'].with_user(
request.env.ref("base.user_admin")).search(domain)
if productions:
diff --git a/sf_sale/models/sale_order.py b/sf_sale/models/sale_order.py
index e2389ee2..70482f23 100644
--- a/sf_sale/models/sale_order.py
+++ b/sf_sale/models/sale_order.py
@@ -264,17 +264,16 @@ class RePurchaseOrder(models.Model):
'product_uom': server_template.uom_id.id
}))
else:
- for item in purchase_order_line:
- if production.name in production_process:
- purchase_order = self.env['purchase.order'].search(
- [('state', '=', 'draft'), ('origin', '=', ','.join(production_process)),
- ('id', '=', item.order_id.id)])
- if not purchase_order:
- server_product_process.append((0, 0, {
- 'product_id': server_template.product_variant_id.id,
- 'product_qty': len(production_process),
- 'product_uom': server_template.uom_id.id
- }))
+ if production.name in production_process:
+ purchase_order = self.env['purchase.order'].search(
+ [('state', '=', 'draft'), ('origin', '=', ','.join(production_process)),
+ ('purchase_type', '=', 'consignment')])
+ if not purchase_order:
+ server_product_process.append((0, 0, {
+ 'product_id': server_template.product_variant_id.id,
+ 'product_qty': len(production_process),
+ 'product_uom': server_template.uom_id.id
+ }))
if server_product_process:
self.env['purchase.order'].sudo().create({