Accept Merge Request #2038: (feature/tool_standard_library_process -> develop)

Merge Request: 排程产能限制问题

Created By: @廖丹龙
Reviewed By: @马广威
Approved By: @马广威 
Accepted By: @廖丹龙
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2038
This commit is contained in:
廖丹龙
2025-04-23 11:25:04 +08:00
committed by Coding
3 changed files with 7 additions and 9 deletions

View File

@@ -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

View File

@@ -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("未选择生产线")

View File

@@ -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)