1.修复工件配送2.优化运送空料架.3.cloud下发编程单至sf时,将程序单pdf同步至制造订单的装夹预调工单的加工图纸上4.修复工件上下产线接口

This commit is contained in:
jinling.yang
2024-06-03 16:59:14 +08:00
parent d527bc6899
commit 2ab9f37062
4 changed files with 68 additions and 36 deletions

View File

@@ -26,20 +26,28 @@ class AgvSetting(models.Model):
timestamp = int(time.time())
center_control_url += str(timestamp)
logging.info('工件配送-请求中控地址:%s' % center_control_url)
center_control_r = requests.get(center_control_url, params={}, headers=headers)
ret = center_control_r.json()
logging.info('工件配送-请求中控站点信息:%s' % ret)
self.env['center_control.interface.log'].sudo().create(
{'content': ret, 'name': 'AutoDeviceApi/GetAgvStationState?date=%s' % str(timestamp)})
if ret['Succeed'] is True:
datas = ret['Datas']
for item in self:
for da in datas:
if da['DeviceId'] == item.name:
if da['AtHome'] is True:
item.state = '占用'
else:
item.state = '空闲'
try:
center_control_r = requests.get(center_control_url, headers=headers, timeout=60) # 设置超时为60秒
ret = center_control_r.json()
logging.info('工件配送-请求中控站点信息:%s' % ret)
self.env['center_control.interface.log'].sudo().create(
{'content': ret, 'name': 'AutoDeviceApi/GetAgvStationState?date=%s' % str(timestamp)})
if ret['Succeed'] is True:
datas = ret['Datas']
for item in self:
for da in datas:
if da['DeviceId'] == item.name:
if da['AtHome'] is True:
item.state = '占用'
else:
item.state = '空闲'
return True
except requests.exceptions.Timeout:
logging.error('工件配送-请求中控接口超时')
return False
except requests.exceptions.RequestException as e:
logging.error('工件配送-请求中控接口错误: %s', e)
return False
class AgvTaskRoute(models.Model):