Accept Merge Request #999: (feature/优化agv调用中控接驳站接口 -> develop)
Merge Request: 优化agv调用中控接驳站接口 Created By: @杨金灵 Reviewed By: @马广威 Approved By: @马广威 Accepted By: @杨金灵 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/999?initial=true
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import requests
|
||||
import logging
|
||||
import time
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
@@ -21,10 +22,15 @@ class AgvSetting(models.Model):
|
||||
config = self.env['res.config.settings'].get_values()
|
||||
# token = sf_sync_config['token'Ba F2CF5DCC-1A00-4234-9E95-65603F70CC8A]
|
||||
headers = {'Authorization': config['center_control_Authorization']}
|
||||
center_control_url = config['center_control_url'] + "/AutoDeviceApi/GetAgvStationState"
|
||||
center_control_url = config['center_control_url'] + "/AutoDeviceApi/GetAgvStationState?date="
|
||||
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:
|
||||
|
||||
@@ -643,10 +643,13 @@ class ResMrpWorkOrder(models.Model):
|
||||
def _compute_state(self):
|
||||
for workorder in self:
|
||||
if workorder.routing_type == '装夹预调':
|
||||
if not workorder.cnc_ids:
|
||||
cnc_workorder = self.search(
|
||||
[('production_id', '=', workorder.production_id.id), ('routing_type', '=', 'CNC加工')],
|
||||
limit=1, order='id asc')
|
||||
if not cnc_workorder:
|
||||
workorder.state = 'waiting'
|
||||
else:
|
||||
for item in workorder.cnc_ids:
|
||||
for item in cnc_workorder.cnc_ids:
|
||||
functional_cutting_tool = self.env['sf.functional.cutting.tool.entity'].search(
|
||||
[('tool_name_id.name', '=', item.cutting_tool_name)])
|
||||
if not functional_cutting_tool:
|
||||
|
||||
Reference in New Issue
Block a user