优化agv需求

This commit is contained in:
jinling.yang
2024-04-28 11:34:17 +08:00
parent b7f7f0cdff
commit 5eb946d936
8 changed files with 66 additions and 60 deletions

View File

@@ -451,13 +451,6 @@ class Manufacturing_Connect(http.Controller):
logging.info(
'wd.production_line_state:%s' % wd.production_id.production_line_state)
wd.production_id.write({'production_line_state': '已上产线'})
next_workpiece = request.env['sf.workpiece.delivery'].sudo().search(
[('workorder_id.rfid_code', '=', rfid_code), ('type', '=', '下产线'),
('production_id', '=', wd.production_id.id)])
if next_workpiece:
logging.info('next_workpiece:%s' % next_workpiece.delivery_num)
next_workpiece.write(
{'status': '待下发', 'task_delivery_time': datetime.now()})
else:
res = {'Succeed': False, 'ErrorCode': 204,
'Error': 'DeviceId为%s没有对应的已配送工件数据' % ret['DeviceId']}
@@ -470,7 +463,7 @@ class Manufacturing_Connect(http.Controller):
logging.info('AGVToProduct error:%s' % e)
return json.JSONEncoder().encode(res)
@http.route('/AutoDeviceApi/AGVDownProduct', type='json', auth='none', methods=['GET', 'POST'], csrf=False,
@http.route('/AutoDeviceApi/AGVDownProduct', type='json', auth='sf_token', methods=['GET', 'POST'], csrf=False,
cors="*")
def AGVDownProduct(self, **kw):
"""
@@ -510,15 +503,7 @@ class Manufacturing_Connect(http.Controller):
logging.info(
'wd.production_line_state:%s' % wd.production_id.production_line_state)
wd.production_id.write({'production_line_state': '已下产线'})
delivery_Arr.append({wd.id})
next_workpiece = request.env['sf.workpiece.delivery'].sudo().search(
[('workorder_id.rfid_code', '=', rfid_code),
('type', '=', '运送空料架'),
('production_id', '=', wd.production_id.id)])
if next_workpiece:
logging.info('next_workpiece:%s' % next_workpiece.delivery_num)
next_workpiece.write(
{'status': '待下发', 'task_delivery_time': datetime.now()})
delivery_Arr.append(wd.id)
else:
res = {'Succeed': False, 'ErrorCode': 204,
'Error': 'DeviceId为%s没有对应的已配送工件数据' % ret['DeviceId']}
@@ -528,8 +513,10 @@ class Manufacturing_Connect(http.Controller):
[('id', 'in', delivery_Arr)])
if delivery_workpiece:
logging.info('开始向agv下发下产线任务')
delivery_workpiece._delivery_avg()
logging.info('agv下发下产线任务下发完成')
is_free = delivery_workpiece._check_avgsite_state()
if is_free is True:
delivery_workpiece._delivery_avg()
logging.info('agv下发下产线任务下发完成')
else:
res = {'Succeed': False, 'ErrorCode': 203, 'Error': '未传IsComplete字段'}
except Exception as e: