调整记录匹配条件;优化排程单状态变化
This commit is contained in:
@@ -489,11 +489,14 @@ class Sf_Dashboard_Connect(http.Controller):
|
|||||||
|
|
||||||
for time_interval in time_intervals:
|
for time_interval in time_intervals:
|
||||||
start_time, end_time = time_interval
|
start_time, end_time = time_interval
|
||||||
# print(start_time, end_time)
|
|
||||||
orders = plan_obj.search([('production_line_id.name', '=', line), ('state', 'in', ['finished']),
|
orders = plan_obj.search([
|
||||||
(date_field_name, '>=', start_time.strftime('%Y-%m-%d 00:00:00')),
|
('production_line_id.name', '=', line),
|
||||||
(date_field_name, '<', end_time.strftime('%Y-%m-%d 00:00:00'))
|
('state', 'in', ['finished']),
|
||||||
])
|
(date_field_name, '>=', start_time.strftime('%Y-%m-%d %H:%M:%S')),
|
||||||
|
(date_field_name, '<=', end_time.strftime('%Y-%m-%d %H:%M:%S')) # 包括结束时间
|
||||||
|
])
|
||||||
|
|
||||||
# 使用小时和分钟作为键,确保每个小时的数据有独立的键
|
# 使用小时和分钟作为键,确保每个小时的数据有独立的键
|
||||||
key = start_time.strftime('%H:%M:%S') # 只取小时:分钟:秒作为键
|
key = start_time.strftime('%H:%M:%S') # 只取小时:分钟:秒作为键
|
||||||
time_count_dict[key] = len(orders)
|
time_count_dict[key] = len(orders)
|
||||||
|
|||||||
@@ -1082,6 +1082,12 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
|
|
||||||
# 重写工单开始按钮方法
|
# 重写工单开始按钮方法
|
||||||
def button_start(self):
|
def button_start(self):
|
||||||
|
if self.routing_type == 'CNC加工':
|
||||||
|
self.env['sf.production.plan'].sudo().search([('name', '=', self.production_id.name)]).write({
|
||||||
|
'state': 'processing',
|
||||||
|
'actual_start_time': datetime.now()
|
||||||
|
})
|
||||||
|
|
||||||
if self.routing_type == '装夹预调':
|
if self.routing_type == '装夹预调':
|
||||||
# 判断是否有坯料的序列号信息
|
# 判断是否有坯料的序列号信息
|
||||||
boolean = False
|
boolean = False
|
||||||
|
|||||||
Reference in New Issue
Block a user