29 lines
1.1 KiB
Python
29 lines
1.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
import json
|
|
import requests
|
|
import logging
|
|
from odoo import http
|
|
from odoo.http import request
|
|
from odoo.addons.sf_manufacturing.controllers.controllers import Manufacturing_Connect
|
|
from odoo.addons.sf_base.commons.common import Common
|
|
|
|
_logger = logging.getLogger(__name__)
|
|
|
|
|
|
class SfQualityConnect(Manufacturing_Connect):
|
|
|
|
@http.route('/AutoDeviceApi/AGVDownProduct', type='json', auth='none', methods=['GET', 'POST'], csrf=False,
|
|
cors="*")
|
|
def AGVDownProduct(self, **kw):
|
|
res = super(SfQualityConnect, self).AGVDownProduct(**kw)
|
|
res = json.loads(res)
|
|
if res.get('workorder_ids'):
|
|
try:
|
|
_logger.info('已下产线的工单:%s' % res.get('workorder_ids'))
|
|
for order_id in res['workorder_ids']:
|
|
request.env['quality.cnc.test'].sudo().create(
|
|
{'workorder_id': order_id, 'write_uid': False, 'write_date': False})
|
|
except Exception as e:
|
|
_logger.info('AGV运送下产线接口:%s' % e)
|
|
return json.JSONEncoder().encode(res)
|