diff --git a/sf_manufacturing/controllers/controllers.py b/sf_manufacturing/controllers/controllers.py
index 632e9e4c..719ac481 100644
--- a/sf_manufacturing/controllers/controllers.py
+++ b/sf_manufacturing/controllers/controllers.py
@@ -477,7 +477,7 @@ class Manufacturing_Connect(http.Controller):
logging.info('LocationChange error:%s' % e)
return json.JSONEncoder().encode(res)
- @http.route('/AutoDeviceApi/AGVToProduct', type='json', auth='sf_token', methods=['GET', 'POST'], csrf=False,
+ @http.route('/AutoDeviceApi/AGVToProduct', type='json', auth='none', methods=['GET', 'POST'], csrf=False,
cors="*")
def AGVToProduct(self, **kw):
"""
@@ -549,7 +549,7 @@ class Manufacturing_Connect(http.Controller):
logging.info('AGVToProduct error:%s' % e)
return json.JSONEncoder().encode(res)
- @http.route('/AutoDeviceApi/AGVDownProduct', type='json', auth='sf_token', methods=['GET', 'POST'], csrf=False,
+ @http.route('/AutoDeviceApi/AGVDownProduct', type='json', auth='none', methods=['GET', 'POST'], csrf=False,
cors="*")
def AGVDownProduct(self, **kw):
"""
diff --git a/sf_manufacturing/wizard/rework_wizard.py b/sf_manufacturing/wizard/rework_wizard.py
index 53fd2965..4698a994 100644
--- a/sf_manufacturing/wizard/rework_wizard.py
+++ b/sf_manufacturing/wizard/rework_wizard.py
@@ -25,6 +25,7 @@ class ReworkWizard(models.TransientModel):
processing_panel_id = fields.Many2many('sf.processing.panel', string="加工面")
is_reprogramming = fields.Boolean(string='申请重新编程', default=False)
is_reprogramming_readonly = fields.Boolean(string='申请重新编程(只读)', default=False)
+ is_clamp_measure = fields.Boolean(string='保留装夹测量数据', default=True)
reprogramming_num = fields.Integer('重新编程次数', default=0)
programming_state = fields.Selection(
[('待编程', '待编程'), ('编程中', '编程中'), ('已编程', '已编程'), ('已编程未下发', '已编程未下发'),
@@ -35,6 +36,7 @@ class ReworkWizard(models.TransientModel):
def confirm(self):
if self.routing_type in ['装夹预调', 'CNC加工']:
+ self.is_clamp_measure = False
self.workorder_id.is_rework = True
self.production_id.write({'detection_result_ids': [(0, 0, {
'rework_reason': self.rework_reason,
@@ -58,19 +60,15 @@ class ReworkWizard(models.TransientModel):
if processing_panels_missing:
processing_panels_str = ','.join(processing_panels_missing)
raise UserError('您还有待处理的检测结果中为%s的加工面未选择' % processing_panels_str)
- # processing_panels = set()
- # for handle_item in handle_result:
- # for dr_panel in self.processing_panel_id:
- # if dr_panel.name == handle_item.processing_panel:
- # processing_panels.add(dr_panel.name)
- # if len(processing_panels) != len(handle_result):
- # processing_panels_str = ','.join(processing_panels)
- # return UserError(f'您还有待处理的检测结果中为{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': '已取消'})
@@ -93,6 +91,43 @@ class ReworkWizard(models.TransientModel):
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 == '已编程':
@@ -149,9 +184,7 @@ class ReworkWizard(models.TransientModel):
'cmm_ids': new_cnc_workorder.cmm_ids.sudo()._json_cmm_program(panel.name,
ret),
'cnc_worksheet': cnc_rework.cnc_worksheet})
- 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:
pre_rework = max(self.production_id.workorder_ids.filtered(
lambda pr: pr.processing_panel == panel.name and pr.state in (
diff --git a/sf_manufacturing/wizard/rework_wizard_views.xml b/sf_manufacturing/wizard/rework_wizard_views.xml
index 8ba3f4dd..d8cf0fb9 100644
--- a/sf_manufacturing/wizard/rework_wizard_views.xml
+++ b/sf_manufacturing/wizard/rework_wizard_views.xml
@@ -14,17 +14,25 @@