From 5438ff6df196a4521d1ba71ca62fb93cd7a3d038 Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Wed, 23 Apr 2025 11:06:03 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=8E=92=E7=A8=8B=E4=BA=A7=E8=83=BD?= =?UTF-8?q?=E9=99=90=E5=88=B6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_workcenter.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/sf_manufacturing/models/mrp_workcenter.py b/sf_manufacturing/models/mrp_workcenter.py index 9434651c..e18472d7 100644 --- a/sf_manufacturing/models/mrp_workcenter.py +++ b/sf_manufacturing/models/mrp_workcenter.py @@ -256,14 +256,12 @@ class ResWorkcenter(models.Model): date_planned_end), ('state', 'not in', ['draft', 'cancel'])]) - if plan_ids: - sum_qty = sum([p.product_qty for p in plan_ids]) - production_line_hour_capacity = self.production_line_hour_capacity - if sum_qty >= production_line_hour_capacity: - message = '当前计划开始时间不能预约排程,超过生产线小时产能(%d件)%d件' % ( - production_line_hour_capacity, count) - raise UserError(message) - return False + sum_qty = sum([p.product_qty for p in plan_ids]) if plan_ids else count + production_line_hour_capacity = self.production_line_hour_capacity + if sum_qty > production_line_hour_capacity: + message = '当前计划开始时间不能预约排程,超过生产线小时产能(%d件)%d件' % ( + production_line_hour_capacity, count) + raise UserError(message) return True From ef5c2649c907f8f65e183b3d8905c44d6b7ede76 Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Wed, 23 Apr 2025 11:24:38 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E3=80=90sf.t-=E8=AE=A1=E5=88=92=E3=80=91?= =?UTF-8?q?=E5=9C=A8=E6=8E=92=E7=A8=8B=E5=8D=95=E8=AF=A6=E6=83=85=E9=A1=B5?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E6=97=B6=E9=97=B4=E6=AE=B5=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E6=8E=92=E7=A8=8B=E6=97=B6=E6=9C=AA=E6=A0=A1=E9=AA=8C=E6=97=A5?= =?UTF-8?q?=E5=8E=86=E6=9C=89=E6=95=88=E5=B7=A5=E4=BD=9C=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_plan/models/custom_plan.py | 1 + sf_plan/wizard/action_plan_some.py | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/sf_plan/models/custom_plan.py b/sf_plan/models/custom_plan.py index 5f4003da..af5b387f 100644 --- a/sf_plan/models/custom_plan.py +++ b/sf_plan/models/custom_plan.py @@ -228,6 +228,7 @@ class sf_production_plan(models.Model): """ 排程方法 """ + self.deal_processing_schedule(self.date_planned_start) for record in self: if not record.production_line_id: raise ValidationError("未选择生产线") diff --git a/sf_plan/wizard/action_plan_some.py b/sf_plan/wizard/action_plan_some.py index f27f4dad..78726c4d 100644 --- a/sf_plan/wizard/action_plan_some.py +++ b/sf_plan/wizard/action_plan_some.py @@ -40,6 +40,5 @@ class Action_Plan_All_Wizard(models.TransientModel): self.plan_ids.date_planned_start = self.date_planned_start # 在这里添加您的逻辑来处理这些ID # 判断能否排成 - self.plan_ids.deal_processing_schedule(self.date_planned_start) self.plan_ids.do_production_schedule() _logger.info('处理计划: %s 完成', self.plan_ids.ids)