Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/新增agv反馈接口
# Conflicts: # sf_manufacturing/controllers/controllers.py
This commit is contained in:
@@ -143,19 +143,13 @@ class Manufacturing_Connect(http.Controller):
|
|||||||
res = {'Succeed': True, 'Datas': []}
|
res = {'Succeed': True, 'Datas': []}
|
||||||
datas = request.httprequest.data
|
datas = request.httprequest.data
|
||||||
ret = json.loads(datas)
|
ret = json.loads(datas)
|
||||||
if not ret['BillId']:
|
|
||||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': '未传制造订单号'}
|
|
||||||
return json.JSONEncoder().encode(res)
|
|
||||||
if not ret['CraftId']:
|
|
||||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': '未传工序名称'}
|
|
||||||
return json.JSONEncoder().encode(res)
|
|
||||||
if not ret['DeviceId']:
|
|
||||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': '未传设备号'}
|
|
||||||
return json.JSONEncoder().encode(res)
|
|
||||||
production_id = ret['BillId']
|
production_id = ret['BillId']
|
||||||
routing_type = ret['CraftId']
|
routing_type = ret['CraftId']
|
||||||
workorder = request.env['mrp.workorder'].sudo().search(
|
workorder = request.env['mrp.workorder'].sudo().search(
|
||||||
[('production_id', '=', production_id), ('routing_type', '=', routing_type)], limit=1)
|
[('production_id', '=', production_id), ('routing_type', '=', routing_type)], limit=1)
|
||||||
|
if not workorder:
|
||||||
|
res = {'Succeed': False, 'ErrorCode': 202, 'Error': '该工单不存在'}
|
||||||
|
return json.JSONEncoder().encode(res)
|
||||||
workorder.button_start()
|
workorder.button_start()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
|
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
|
||||||
@@ -175,19 +169,13 @@ class Manufacturing_Connect(http.Controller):
|
|||||||
res = {'Succeed': True, 'Datas': []}
|
res = {'Succeed': True, 'Datas': []}
|
||||||
datas = request.httprequest.data
|
datas = request.httprequest.data
|
||||||
ret = json.loads(datas)
|
ret = json.loads(datas)
|
||||||
if not ret['BillId']:
|
|
||||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': '未传制造订单号'}
|
|
||||||
return json.JSONEncoder().encode(res)
|
|
||||||
if not ret['CraftId']:
|
|
||||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': '未传工序名称'}
|
|
||||||
return json.JSONEncoder().encode(res)
|
|
||||||
if not ret['DeviceId']:
|
|
||||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': '未传设备号'}
|
|
||||||
return json.JSONEncoder().encode(res)
|
|
||||||
production_id = ret['BillId']
|
production_id = ret['BillId']
|
||||||
routing_type = ret['CraftId']
|
routing_type = ret['CraftId']
|
||||||
workorder = request.env['mrp.workorder'].sudo().search(
|
workorder = request.env['mrp.workorder'].sudo().search(
|
||||||
[('production_id', '=', production_id), ('routing_type', '=', routing_type)], limit=1)
|
[('production_id', '=', production_id), ('routing_type', '=', routing_type)], limit=1)
|
||||||
|
if not workorder:
|
||||||
|
res = {'Succeed': False, 'ErrorCode': 202, 'Error': '该工单不存在'}
|
||||||
|
return json.JSONEncoder().encode(res)
|
||||||
workorder.button_finish()
|
workorder.button_finish()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
|
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
|
||||||
@@ -207,21 +195,6 @@ class Manufacturing_Connect(http.Controller):
|
|||||||
res = {'Succeed': True, 'Datas': []}
|
res = {'Succeed': True, 'Datas': []}
|
||||||
datas = request.httprequest.data
|
datas = request.httprequest.data
|
||||||
ret = json.loads(datas)
|
ret = json.loads(datas)
|
||||||
if not ret['BillId']:
|
|
||||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': '未传制造订单号'}
|
|
||||||
return json.JSONEncoder().encode(res)
|
|
||||||
if not ret['CraftId']:
|
|
||||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': '未传工序名称'}
|
|
||||||
return json.JSONEncoder().encode(res)
|
|
||||||
if not ret['DeviceId']:
|
|
||||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': '未传设备号'}
|
|
||||||
return json.JSONEncoder().encode(res)
|
|
||||||
if not ret['Quality']:
|
|
||||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': '未传检测结果'}
|
|
||||||
return json.JSONEncoder().encode(res)
|
|
||||||
if not ret['ReportPaht']:
|
|
||||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': '未传检查报告文件(地址)'}
|
|
||||||
return json.JSONEncoder().encode(res)
|
|
||||||
production_id = ret['BillId']
|
production_id = ret['BillId']
|
||||||
routing_type = ret['CraftId']
|
routing_type = ret['CraftId']
|
||||||
request.env['mrp.workorder'].sudo().search(
|
request.env['mrp.workorder'].sudo().search(
|
||||||
@@ -308,6 +281,7 @@ class Manufacturing_Connect(http.Controller):
|
|||||||
logging.info('NCProgDolod error:%s' % e)
|
logging.info('NCProgDolod error:%s' % e)
|
||||||
return json.JSONEncoder().encode(res)
|
return json.JSONEncoder().encode(res)
|
||||||
|
|
||||||
|
|
||||||
@http.route('/AutoDeviceApi/LocationChange', type='json', auth='sf_token', methods=['GET', 'POST'], csrf=False,
|
@http.route('/AutoDeviceApi/LocationChange', type='json', auth='sf_token', methods=['GET', 'POST'], csrf=False,
|
||||||
cors="*")
|
cors="*")
|
||||||
def LocationChange(self, **kw):
|
def LocationChange(self, **kw):
|
||||||
@@ -387,3 +361,4 @@ class Manufacturing_Connect(http.Controller):
|
|||||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
|
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
|
||||||
logging.info('AGVDownProduct error:%s' % e)
|
logging.info('AGVDownProduct error:%s' % e)
|
||||||
return json.JSONEncoder().encode(res)
|
return json.JSONEncoder().encode(res)
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ from datetime import datetime
|
|||||||
import requests
|
import requests
|
||||||
from odoo import http
|
from odoo import http
|
||||||
from odoo.http import request
|
from odoo.http import request
|
||||||
# from OCC.Extend.DataExchange import read_step_file
|
from OCC.Extend.DataExchange import read_step_file
|
||||||
# from OCC.Extend.DataExchange import write_stl_file
|
from OCC.Extend.DataExchange import write_stl_file
|
||||||
from odoo import models, fields, api
|
from odoo import models, fields, api
|
||||||
from odoo.modules import get_resource_path
|
from odoo.modules import get_resource_path
|
||||||
from odoo.exceptions import ValidationError, UserError
|
from odoo.exceptions import ValidationError, UserError
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ import logging
|
|||||||
import base64
|
import base64
|
||||||
import qrcode
|
import qrcode
|
||||||
import io
|
import io
|
||||||
|
|
||||||
|
import requests
|
||||||
|
|
||||||
from odoo import api, fields, models, _
|
from odoo import api, fields, models, _
|
||||||
from odoo.osv import expression
|
from odoo.osv import expression
|
||||||
from odoo.exceptions import UserError
|
from odoo.exceptions import UserError
|
||||||
@@ -383,6 +386,26 @@ class ShelfLocation(models.Model):
|
|||||||
record.product_id = False
|
record.product_id = False
|
||||||
record.location_status = '空闲'
|
record.location_status = '空闲'
|
||||||
|
|
||||||
|
#调取获取货位信息接口
|
||||||
|
def get_sf_shelf_location_info(self):
|
||||||
|
# sf_sync_config = self.env['res.config.settings'].get_values()
|
||||||
|
# token = sf_sync_config['token']
|
||||||
|
# sf_secret_key = sf_sync_config['sf_secret_key']
|
||||||
|
# headers = Common.get_headers(self, token, sf_secret_key)
|
||||||
|
# strurl = sf_sync_config['sf_url'] + self.crea_url
|
||||||
|
headers = {'Authorization': 'Ba F2CF5DCC-1A00-4234-9E95-65603F70CC8A'}
|
||||||
|
crea_url = 'https://x24467i973.zicp.fun/AutoDeviceApi/GetLocationInfos'
|
||||||
|
# objs_all = self.env['maintenance.equipment'].search([('id', '=', self.id)])
|
||||||
|
# machine_tool_list = []
|
||||||
|
params = {'DeviceId': 'Cabinet-AL'}
|
||||||
|
r = requests.get(crea_url, params=params,headers=headers)
|
||||||
|
ret = r.json()
|
||||||
|
print(ret)
|
||||||
|
if ret['Succeed'] == True:
|
||||||
|
return '获取库位信息成功'
|
||||||
|
else:
|
||||||
|
raise UserError("该库位无产品")
|
||||||
|
|
||||||
|
|
||||||
class Sf_stock_move_line(models.Model):
|
class Sf_stock_move_line(models.Model):
|
||||||
_inherit = 'stock.move.line'
|
_inherit = 'stock.move.line'
|
||||||
|
|||||||
@@ -118,6 +118,9 @@
|
|||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="Shelf Location">
|
<form string="Shelf Location">
|
||||||
<header>
|
<header>
|
||||||
|
|
||||||
|
<button type="object" class="oe_highlight" name='get_sf_shelf_location_info' string="获取货位信息"/>
|
||||||
|
|
||||||
<field name="location_status" invisible="1"/>
|
<field name="location_status" invisible="1"/>
|
||||||
<button string="禁用货位" name="action_location_status_disable" type="object" class="oe_highlight"
|
<button string="禁用货位" name="action_location_status_disable" type="object" class="oe_highlight"
|
||||||
attrs="{'invisible': [('location_status', '!=', '空闲')]}"/>
|
attrs="{'invisible': [('location_status', '!=', '空闲')]}"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user