排程产能限制问题
This commit is contained in:
@@ -256,14 +256,12 @@ class ResWorkcenter(models.Model):
|
|||||||
date_planned_end),
|
date_planned_end),
|
||||||
('state', 'not in', ['draft', 'cancel'])])
|
('state', 'not in', ['draft', 'cancel'])])
|
||||||
|
|
||||||
if plan_ids:
|
sum_qty = sum([p.product_qty for p in plan_ids]) if plan_ids else count
|
||||||
sum_qty = sum([p.product_qty for p in plan_ids])
|
|
||||||
production_line_hour_capacity = self.production_line_hour_capacity
|
production_line_hour_capacity = self.production_line_hour_capacity
|
||||||
if sum_qty >= production_line_hour_capacity:
|
if sum_qty > production_line_hour_capacity:
|
||||||
message = '当前计划开始时间不能预约排程,超过生产线小时产能(%d件)%d件' % (
|
message = '当前计划开始时间不能预约排程,超过生产线小时产能(%d件)%d件' % (
|
||||||
production_line_hour_capacity, count)
|
production_line_hour_capacity, count)
|
||||||
raise UserError(message)
|
raise UserError(message)
|
||||||
return False
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user