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})
|
# self.workpiece_delivery_ids[0].write({'rfid_code': self.rfid_code})
|
||||||
|
|
||||||
def get_plan_workorder(self, production_line):
|
def get_plan_workorder(self, production_line):
|
||||||
tomorrow = (date.today() + timedelta(days=+1)).strftime("%Y-%m-%d")
|
tomorrow = (date.today() + timedelta(days=1)).strftime("%Y-%m-%d")
|
||||||
tomorrow_start = tomorrow + ' 00:00:00'
|
tomorrow_start = f"{tomorrow} 00:00:00"
|
||||||
tomorrow_end = tomorrow + ' 23:59:59'
|
tomorrow_end = f"{tomorrow} 23:59:59"
|
||||||
logging.info('tomorrow:%s' % tomorrow)
|
logging.info('tomorrow:%s' % tomorrow)
|
||||||
sql = """
|
sql = """
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM mrp_workorder
|
FROM mrp_workorder
|
||||||
WHERE state!='rework'
|
WHERE state!='rework'
|
||||||
to_char(date_planned_start::timestamp + '8 hour','YYYY-MM-DD HH:mm:SS')>= %s
|
AND (date_planned_start + interval '8 hours') >= %s::timestamp
|
||||||
AND to_char(date_planned_finished::timestamp + '8 hour','YYYY-MM-DD HH:mm:SS')<= %s
|
AND (date_planned_finished + interval '8 hours') <= %s::timestamp
|
||||||
"""
|
"""
|
||||||
params = [tomorrow_start, tomorrow_end]
|
params = [tomorrow_start, tomorrow_end]
|
||||||
if production_line:
|
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"
|
sql += "AND production_line_id = %s"
|
||||||
params.append(production_line)
|
params.append(line.id)
|
||||||
self.env.cr.execute(sql, params)
|
self.env.cr.execute(sql, params)
|
||||||
ids = [t[0] for t in self.env.cr.fetchall()]
|
ids = [t[0] for t in self.env.cr.fetchall()]
|
||||||
return [('id', 'in', ids)]
|
return [('id', 'in', ids)]
|
||||||
|
|||||||
@@ -121,10 +121,16 @@ class MrsShelfLocationDataSync(models.Model):
|
|||||||
tool.tool_in_out_stock_location(location_id)
|
tool.tool_in_out_stock_location(location_id)
|
||||||
if tool:
|
if tool:
|
||||||
location_id.product_sn_id = tool.barcode_id.id
|
location_id.product_sn_id = tool.barcode_id.id
|
||||||
|
# 修改功能刀具标准状态值和已使用寿命值
|
||||||
|
if 'LifeStd' in item and 'LifeUse' in item:
|
||||||
|
tool.sudo().write({
|
||||||
|
'max_lifetime_value': item['LifeStd'],
|
||||||
|
'used_value': item['LifeUse']
|
||||||
|
})
|
||||||
# 修改功能刀具状态
|
# 修改功能刀具状态
|
||||||
if item.get('State') == '报警':
|
if item.get('State') == '报警':
|
||||||
if tool.functional_tool_status != item.get('State'):
|
if tool.functional_tool_status != item.get('State'):
|
||||||
tool.write({
|
tool.sudo().write({
|
||||||
'functional_tool_status': item['State']
|
'functional_tool_status': item['State']
|
||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user