From de8bebc1f90798319675e7249a254e51ec647b8e Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Fri, 26 Jul 2024 10:57:11 +0800 Subject: [PATCH 1/4] =?UTF-8?q?1=E3=80=81=E6=B7=BB=E5=8A=A0=E5=88=B6?= =?UTF-8?q?=E9=80=A0=E8=AE=A2=E5=8D=95=E7=9A=84=E5=88=80=E5=85=B7=E5=A4=87?= =?UTF-8?q?=E6=B3=A8=E5=AD=97=E6=AE=B5=E8=87=AA=E5=8A=A8=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E5=8F=8A=E6=96=B9=E6=B3=95=EF=BC=9B2?= =?UTF-8?q?=E3=80=81=E4=BC=98=E5=8C=96=E5=B7=A5=E5=8D=95=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E8=AE=A1=E7=AE=97=E6=96=B9=E6=B3=95=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_production.py | 37 +++++++++-------------- sf_manufacturing/models/mrp_workorder.py | 25 ++++++++++++--- 2 files changed, 36 insertions(+), 26 deletions(-) diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index 65c3ebec..27baa7be 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -29,41 +29,34 @@ class MrpProduction(models.Model): detection_result_ids = fields.One2many('sf.detection.result', 'production_id', '检测报告') tool_state = fields.Selection([('0', '正常'), ('1', '缺刀'), ('2', '无效刀')], string='功能刀具状态', default='0', store=True, compute='_compute_tool_state') - tool_state_remark = fields.Text(string='功能刀具状态备注(缺刀)', readonly=True) + tool_state_remark = fields.Text(string='功能刀具状态备注(缺刀)', compute='_compute_tool_state_remark', store=True) tool_state_remark2 = fields.Text(string='功能刀具状态备注(无效刀)', readonly=True) + @api.depends('workorder_ids.tool_state_remark') + def _compute_tool_state_remark(self): + for item in self: + if item.workorder_ids: + workorder_ids = item.workorder_ids.filtered(lambda a: a.state not in ('rework', '返工')) + if workorder_ids.filtered(lambda a: a.tool_state_remark): + work_ids = workorder_ids.filtered(lambda a: a.tool_state_remark) + tool_state_remark = '' + for work_id in work_ids: + tool_state_remark = f"{work_id.tool_state_remark}\n" + item.tool_state_remark = tool_state_remark + else: + item.tool_state_remark = False + @api.depends('workorder_ids.tool_state') def _compute_tool_state(self): - # if self.workorder_ids: for item in self: if item.workorder_ids: workorder_ids = item.workorder_ids.filtered(lambda a: a.state not in ('rework', '返工')) if workorder_ids.filtered(lambda a: a.tool_state == '2'): item.tool_state = '2' elif workorder_ids.filtered(lambda a: a.tool_state == '1'): - tool_state_remark = '' - data = {} - # 获取所有缺刀工单加工面对应缺的刀 - for work in workorder_ids.filtered(lambda a: a.tool_state == '1'): - if work.processing_panel not in list(data.keys()): - data.update({work.processing_panel: []}) - for cnc in work.cnc_ids.filtered(lambda a: a.tool_state == '1'): - if cnc.cutting_tool_name not in data[work.processing_panel]: - data[work.processing_panel].append(cnc.cutting_tool_name) - # 按格式生成缺刀提示信息 - for key in data: - if data.get(key) and not data.get(key): - if tool_state_remark != '': - tool_state_remark = f'{tool_state_remark}\n{key}缺刀:{data.get(key)}' - else: - tool_state_remark = f'{key}缺刀:{data.get(key)}' item.tool_state = '1' - item.tool_state_remark = tool_state_remark - item.tool_state_remark2 = '' else: item.tool_state = '0' - item.tool_state_remark = '' - item.tool_state_remark2 = '' # state = fields.Selection(selection_add=[ # ('pending_scheduling', '待排程'), diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index fce19e16..827f77df 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -180,11 +180,27 @@ class ResMrpWorkOrder(models.Model): # 功能刀具状态 tool_state = fields.Selection([('0', '正常'), ('1', '缺刀'), ('2', '无效刀')], string='功能刀具状态', default='0', store=True, compute='_compute_tool_state') + tool_state_remark = fields.Text(string='功能刀具状态备注(缺刀)', compute='_compute_tool_state_remark', store=True) + + @api.depends('cnc_ids.tool_state') + def _compute_tool_state_remark(self): + for item in self: + if item.cnc_ids: + if item.cnc_ids.filtered(lambda a: a.tool_state == '2'): + item.tool_state_remark = None + elif item.cnc_ids.filtered(lambda a: a.tool_state == '1'): + tool_state_remark = f'{item.processing_panel}缺刀:[' + cnc_ids = item.cnc_ids.filtered(lambda a: a.tool_state == '1') + for cnc_id in cnc_ids: + tool_state_remark = f"{tool_state_remark}'{cnc_id.cutting_tool_name}'" + item.tool_state_remark = f"{tool_state_remark}]" + else: + item.tool_state_remark = None @api.depends('cnc_ids.tool_state') def _compute_tool_state(self): for item in self: - if item: + if item.cnc_ids: if item.cnc_ids.filtered(lambda a: a.tool_state == '2'): item.tool_state = '2' elif item.cnc_ids.filtered(lambda a: a.tool_state == '1'): @@ -835,9 +851,10 @@ class ResMrpWorkOrder(models.Model): # if workorder.state not in ['cancel', 'rework']: # workorder.state = 'rework' if workorder.production_id.state == 'pending_cam': - if workorder.routing_type == '装夹预调' and workorder.state in ['ready', 'waiting']: - if workorder.production_id.tool_state in ['1', '2']: - workorder.state = 'waiting' + if workorder.production_id.tool_state in ['1', '2']: + work_ids = workorder.production_id.workorder_ids.filtered( + lambda a: a.routing_type == '装夹预调' and a.state in ['ready', 'waiting']) + work_ids.state = 'waiting' logging.info('工序:%s' % workorder.sequence) logging.info('工单最终状态:%s' % workorder.state) From 98d2aa756a34bccbef994e3679ed5eefc8a664f3 Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Fri, 26 Jul 2024 11:49:33 +0800 Subject: [PATCH 2/4] =?UTF-8?q?1=E3=80=81=E8=A7=A3=E5=86=B3=20=20=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E5=88=80=E5=85=B7=E6=98=AF=E6=97=A0=E6=95=88=E5=88=80?= =?UTF-8?q?=E6=97=B6-=E5=88=B6=E9=80=A0=E8=AE=A2=E5=8D=95=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E8=BF=94=E5=B7=A5=E3=80=90=E7=94=B3=E8=AF=B7=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E7=BC=96=E7=A8=8B=E3=80=91=E8=A6=81=E5=81=9A=E6=88=90?= =?UTF-8?q?=E5=BF=85=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/wizard/rework_wizard.py | 2 ++ sf_manufacturing/wizard/rework_wizard_views.xml | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/sf_manufacturing/wizard/rework_wizard.py b/sf_manufacturing/wizard/rework_wizard.py index f15f85d1..bf1224fb 100644 --- a/sf_manufacturing/wizard/rework_wizard.py +++ b/sf_manufacturing/wizard/rework_wizard.py @@ -31,6 +31,8 @@ class ReworkWizard(models.TransientModel): ('已下发', '已下发')], string='编程状态') + tool_state = fields.Selection(string='功能刀具状态', related='production_id.tool_state') + def confirm(self): if self.routing_type in ['装夹预调', 'CNC加工']: self.workorder_id.is_rework = True diff --git a/sf_manufacturing/wizard/rework_wizard_views.xml b/sf_manufacturing/wizard/rework_wizard_views.xml index 7008e4b9..08e5f8ef 100644 --- a/sf_manufacturing/wizard/rework_wizard_views.xml +++ b/sf_manufacturing/wizard/rework_wizard_views.xml @@ -9,6 +9,7 @@ + -
+
申请重新编程 - +
-
+
申请重新编程 + attrs='{"readonly": ["|",("is_reprogramming_readonly","=",False),("tool_state", "=", "2")]}'/>
From b731ffba331fc57959578190d78fca7096f1cd66 Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Fri, 26 Jul 2024 14:51:23 +0800 Subject: [PATCH 3/4] =?UTF-8?q?1=E3=80=81=E4=BC=98=E5=8C=96=E5=B7=A5?= =?UTF-8?q?=E5=8D=95=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_production.py | 5 +++++ sf_tool_management/models/mrp_workorder.py | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index 27baa7be..0bbda373 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -50,6 +50,7 @@ class MrpProduction(models.Model): def _compute_tool_state(self): for item in self: if item.workorder_ids: + tool_state = item.tool_state workorder_ids = item.workorder_ids.filtered(lambda a: a.state not in ('rework', '返工')) if workorder_ids.filtered(lambda a: a.tool_state == '2'): item.tool_state = '2' @@ -57,6 +58,10 @@ class MrpProduction(models.Model): item.tool_state = '1' else: item.tool_state = '0' + if tool_state == '2' and item.tool_state != '2': + item.detection_result_ids.filtered( + lambda a: a.detailed_reason == '无效功能刀具' and a.handle_result == '待处理').write( + {'handle_result': '已处理'}) # state = fields.Selection(selection_add=[ # ('pending_scheduling', '待排程'), diff --git a/sf_tool_management/models/mrp_workorder.py b/sf_tool_management/models/mrp_workorder.py index 352162b7..f3fc3484 100644 --- a/sf_tool_management/models/mrp_workorder.py +++ b/sf_tool_management/models/mrp_workorder.py @@ -105,6 +105,12 @@ class CNCprocessing(models.Model): 'test_results': '返工', 'handle_result': '待处理' }) + if not production_id.is_rework: + production_id.write({ + 'is_rework': True + }) + production_id.workorder_ids.filtered( + lambda a: a.processing_panel == key and not a.is_rework).write({'is_rework': True}) # 对缺刀信息进行处理 for key in data2: if data2.get(key): From 3e61e31314b303953b277599ed89a8ead0ddfd5c Mon Sep 17 00:00:00 2001 From: hy <1298386937@qq.com> Date: Fri, 26 Jul 2024 15:44:52 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=80=E5=85=B7?= =?UTF-8?q?=E6=8B=86=E8=A7=A3=E6=97=B6=E9=80=89=E6=8B=A9=E7=9B=AE=E6=A0=87?= =?UTF-8?q?=E8=B4=A7=E4=BD=8D=E4=BC=9A=E5=87=BA=E7=8E=B0=E9=87=8D=E5=8F=A0?= =?UTF-8?q?=E7=9A=84=E7=8E=B0=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jikimo_frontend/static/src/scss/custom_style.scss | 6 ------ 1 file changed, 6 deletions(-) diff --git a/jikimo_frontend/static/src/scss/custom_style.scss b/jikimo_frontend/static/src/scss/custom_style.scss index cbd1bb4d..d7e6414c 100644 --- a/jikimo_frontend/static/src/scss/custom_style.scss +++ b/jikimo_frontend/static/src/scss/custom_style.scss @@ -532,9 +532,3 @@ div:has(.o_required_modifier) > label::before { position: unset; } -// 修改表格下拉框会被表格下面数据框覆盖的bug -.tab-pane .o_field_widget { - position: relative; - z-index: 1; -} -