优化cnc工单

This commit is contained in:
jinling.yang
2024-07-04 15:38:43 +08:00
parent a7a8e73616
commit 050e82673a
5 changed files with 73 additions and 14 deletions

View File

@@ -716,3 +716,17 @@ class sf_detection_result(models.Model):
test_results = fields.Selection([("合格", "合格"), ("返工", "返工"), ("报废", "报废")], default='合格',
string="检测结果", tracking=True)
test_report = fields.Binary('检测报告', readonly=True)
# 查看检测报告
def button_look_test_report(self):
return {
'res_model': 'sf.detection.result',
'type': 'ir.actions.act_window',
'res_id': self.id,
'views': [(self.env.ref('sf_manufacturing.sf_test_report_form').id, 'form')],
# 'view_mode': 'form',
# 'context': {
# 'default_id': self.id
# },
'target': 'new'
}

View File

@@ -47,6 +47,7 @@ class ResMrpWorkOrder(models.Model):
('切割', '切割'), ('表面工艺', '表面工艺')
], string="工序类型")
results = fields.Char('结果')
state = fields.Selection(selection_add=[('to be detected', "待检测")])
manual_quotation = fields.Boolean('人工编程', default=False, readonly=True)
@@ -196,13 +197,14 @@ class ResMrpWorkOrder(models.Model):
production_line_state = fields.Selection(
[('待上产线', '待上产线'), ('已上产线', '已上产线'), ('已下产线', '已下产线')],
string='上/下产线', default='待上产线', tracking=True)
detection_report = fields.Binary('检测报告', readonly=True)
detection_report = fields.Binary('检测报告', readonly=False)
is_remanufacture = fields.Boolean(string='重新生成制造订单', default=False)
is_fetchcnc = fields.Boolean(string='重新获取NC程序', default=False)
reason = fields.Selection(
[("programming", "编程"), ("cutter", "刀具"), ("operate computer", "操机"),
[("programming", "编程"), ("cutter", "刀具"), ("clamping", "装夹"), ("operate computer", "操机"),
("technology", "工艺"), ("customer redrawing", "客户改图")], string="原因", tracking=True)
detailed_reason = fields.Text('详细原因')
is_rework = fields.Boolean(string='是否返工', default=False)
# is_send_program_again = fields.Boolean(string='是否重新下发NC程序', default=False)
@@ -473,8 +475,6 @@ class ResMrpWorkOrder(models.Model):
'default_production_ids': [(6, 0, [self.production_id.id])],
}}
# 拼接工单对象属性值
def json_workorder_str(self, k, production, route, item):
# 计算预计时长duration_expected
@@ -956,6 +956,15 @@ class ResMrpWorkOrder(models.Model):
record.process_state = '待解除装夹'
# record.write({'process_state': '待加工'})
record.production_id.process_state = '待解除装夹'
if record.test_results in ['返工']:
record.production_id.state = 'rework'
record.production_id.write({'detection_result_ids': [(0, 0, {
'rework_reason': record.reason,
'detailed_reason': record.detailed_reason,
'processing_panel': record.processing_panel,
'routing_type': record.routing_type,
'test_results': record.test_results,
'test_report': record.detection_report})]})
if record.routing_type == '解除装夹':
'''
记录结束时间