From ef453dbc1e23acd62e2a1a865b46c65fc740d1df Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Wed, 18 Sep 2024 11:53:46 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=B7=A5=E5=8D=95=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_workorder.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 38b75c28..1c3ade80 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1025,20 +1025,20 @@ class ResMrpWorkOrder(models.Model): # 查询工序最小的非完工、非返工的装夹预调工单 work_id = self.search( [('production_id', '=', workorder.production_id.id), - ('routing_type', '=', '装夹预调'), ('state', 'not in', ['rework', 'done', 'cancel'])], limit=1, order="sequence") - if workorder == work_id: - if workorder.production_id.reservation_state == 'assigned': - workorder.state = 'ready' - elif workorder.production_id.reservation_state != 'assigned': - workorder.state = 'waiting' - continue - elif (workorder.name == '装夹预调' and - workorder.state not in ['rework', 'done', 'cancel']): - if workorder.state != 'pending': - workorder.state = 'pending' + if work_id.routing_type == '装夹预调': + if workorder == work_id: + if workorder.production_id.reservation_state == 'assigned': + workorder.state = 'ready' + elif workorder.production_id.reservation_state != 'assigned': + workorder.state = 'waiting' + continue + elif (workorder.name == '装夹预调' and + workorder.state not in ['rework', 'done', 'cancel']): + if workorder.state != 'pending': + workorder.state = 'pending' if workorder.production_id.tool_state in ['1', '2'] and workorder.state == 'ready': workorder.state = 'waiting' continue From 8aca6ce0843615f419d3834f1a05b334dea415e6 Mon Sep 17 00:00:00 2001 From: hujiaying Date: Wed, 18 Sep 2024 14:03:04 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E6=8E=92=E7=A8=8B=E7=94=98=E7=89=B9=E5=9B=BE=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA=E5=B7=B2=E7=BB=8F=E6=8E=92=E7=A8=8B?= =?UTF-8?q?=E7=9A=84=E5=88=B6=E9=80=A0=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_plan/models/custom_plan.py | 23 +++++++++++++++++++++++ sf_plan/views/view.xml | 4 ++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/sf_plan/models/custom_plan.py b/sf_plan/models/custom_plan.py index 05ebf034..6fef2a31 100644 --- a/sf_plan/models/custom_plan.py +++ b/sf_plan/models/custom_plan.py @@ -69,6 +69,27 @@ class sf_production_plan(models.Model): sequence = fields.Integer(string='序号', copy=False, readonly=True, index=True) current_operation_name = fields.Char(string='当前工序名称', size=64, default='生产计划') + @api.onchange('date_planned_start') + def date_planned_start_onchange(self): + if self.date_planned_start: + self.date_planned_finished = self.date_planned_start + timedelta(hours=1) + + #处理计划状态非代排程,计划结束时间为空的数据处理 + def deal_no_date_planned_finished(self): + plans = self.env['sf.production.plan'].search( + [('date_planned_finished', '=', False), ('state', 'in', ['processing', 'done', 'finished'])]) + for item in plans: + if item.date_planned_start: + item.date_planned_finished = item.date_planned_start + timedelta(hours=1) + if not item.order_deadline and item.date_planned_start: + item.order_deadline = item.date_planned_start + timedelta(days=7) + + @api.model + def search_read(self, domain=None, fields=None, offset=0, limit=None, order=None): + + info = super(sf_production_plan, self).search_read(domain, fields, offset, limit, order) + return info + # 计算实际加工时长 @api.depends('actual_start_time', 'actual_end_time') def _compute_actual_process_time(self): @@ -220,6 +241,8 @@ class sf_production_plan(models.Model): record.date_planned_start, record.date_planned_finished = \ item.date_planned_start, item.date_planned_finished record.state = 'done' + record.date_planned_finished = record.date_planned_start + timedelta( + minutes=60) if not record.date_planned_finished else record.date_planned_finished # record.production_id.schedule_state = '已排' record.sudo().production_id.schedule_state = '已排' record.sudo().production_id.process_state = '待装夹' diff --git a/sf_plan/views/view.xml b/sf_plan/views/view.xml index 10992f4a..82382ef3 100644 --- a/sf_plan/views/view.xml +++ b/sf_plan/views/view.xml @@ -88,8 +88,8 @@ - - + + From c675e1d67c89e787b98de1e96856cc047df4b812 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=B0=A7?= Date: Wed, 18 Sep 2024 15:13:20 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=A7=A3=E9=99=A4=E8=A3=85=E5=A4=B9?= =?UTF-8?q?=E5=B7=A5=E5=8D=95=E9=A1=B5=E9=9D=A2=E8=BF=9B=E5=85=A5=E6=97=B6?= =?UTF-8?q?=E5=A4=B1=E5=8E=BB=E7=84=A6=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_workorder.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 2a492932..4b2a117e 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1328,6 +1328,7 @@ class ResMrpWorkOrder(models.Model): arch = etree.fromstring(tree_view['arch']) # 查找 tree 标签 tree_element = arch.xpath("//tree")[0] + tree_element.set('js_class', 'remove_focus_list_view') # 查找或创建 header 标签 header_element = tree_element.find('header')