1、获取日计划接口优化;2、货位信息接口优化;
This commit is contained in:
@@ -738,21 +738,25 @@ class ResMrpWorkOrder(models.Model):
|
||||
# self.workpiece_delivery_ids[0].write({'rfid_code': self.rfid_code})
|
||||
|
||||
def get_plan_workorder(self, production_line):
|
||||
tomorrow = (date.today() + timedelta(days=+1)).strftime("%Y-%m-%d")
|
||||
tomorrow_start = tomorrow + ' 00:00:00'
|
||||
tomorrow_end = tomorrow + ' 23:59:59'
|
||||
tomorrow = (date.today() + timedelta(days=1)).strftime("%Y-%m-%d")
|
||||
tomorrow_start = f"{tomorrow} 00:00:00"
|
||||
tomorrow_end = f"{tomorrow} 23:59:59"
|
||||
logging.info('tomorrow:%s' % tomorrow)
|
||||
sql = """
|
||||
SELECT *
|
||||
FROM mrp_workorder
|
||||
WHERE state!='rework'
|
||||
to_char(date_planned_start::timestamp + '8 hour','YYYY-MM-DD HH:mm:SS')>= %s
|
||||
AND to_char(date_planned_finished::timestamp + '8 hour','YYYY-MM-DD HH:mm:SS')<= %s
|
||||
AND (date_planned_start + interval '8 hours') >= %s::timestamp
|
||||
AND (date_planned_finished + interval '8 hours') <= %s::timestamp
|
||||
"""
|
||||
params = [tomorrow_start, tomorrow_end]
|
||||
if production_line:
|
||||
line = self.env['sf.production.line'].search(
|
||||
[('name', '=', production_line)], limit=1)
|
||||
if not line:
|
||||
raise ValueError(f"生产线'{production_line}'不存在")
|
||||
sql += "AND production_line_id = %s"
|
||||
params.append(production_line)
|
||||
params.append(line.id)
|
||||
self.env.cr.execute(sql, params)
|
||||
ids = [t[0] for t in self.env.cr.fetchall()]
|
||||
return [('id', 'in', ids)]
|
||||
|
||||
Reference in New Issue
Block a user