Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into develop
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
from . import models
|
||||
from . import commons
|
||||
from . import controllers
|
||||
|
||||
1
sf_base/controllers/__init__.py
Normal file
1
sf_base/controllers/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import controllers
|
||||
40
sf_base/controllers/controllers.py
Normal file
40
sf_base/controllers/controllers.py
Normal file
@@ -0,0 +1,40 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import logging
|
||||
import json
|
||||
import base64
|
||||
from odoo import http
|
||||
from odoo.http import request
|
||||
|
||||
|
||||
class Manufacturing_Connect(http.Controller):
|
||||
|
||||
@http.route('/AutoDeviceApi/MaintenanceToolGroups', type='json', auth='none', methods=['GET', 'POST'], csrf=False,
|
||||
cors="*")
|
||||
def get_maintenance_tool_groups_Info(self, **kw):
|
||||
"""
|
||||
机床刀具组接口
|
||||
:param kw:
|
||||
:return:
|
||||
"""
|
||||
logging.info('get_maintenance_tool_groups_Info:%s' % kw)
|
||||
try:
|
||||
datas = request.httprequest.data
|
||||
ret = json.loads(datas)
|
||||
ret = json.loads(ret['result'])
|
||||
logging.info('DeviceId:%s' % ret)
|
||||
tool_groups = request.env['sf.tool.groups'].sudo().search([])
|
||||
|
||||
res = {'Succeed': True, 'Datas': []}
|
||||
if tool_groups:
|
||||
for item in tool_groups:
|
||||
device_id = ''
|
||||
for equipment_id in item.equipment_ids:
|
||||
device_id = '%s,%s' % (device_id, equipment_id.name)
|
||||
res['Datas'].append({
|
||||
'GroupName': item.name,
|
||||
'DeviceId': device_id
|
||||
})
|
||||
except Exception as e:
|
||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
|
||||
logging.info('get_maintenance_tool_groups_Info error:%s' % e)
|
||||
return json.JSONEncoder().encode(res)
|
||||
@@ -256,7 +256,7 @@ class ToolGroups(models.Model):
|
||||
|
||||
# ==========机床刀具组接口==========
|
||||
def _register_tool_groups(self, obj):
|
||||
create_url = '/AutoDeviceApi/FeedBackOut'
|
||||
create_url = '/AutoDeviceApi/MaintenanceToolGroups'
|
||||
sf_sync_config = self.env['res.config.settings'].get_values()
|
||||
token = sf_sync_config['token']
|
||||
sf_secret_key = sf_sync_config['sf_secret_key']
|
||||
|
||||
@@ -11,7 +11,7 @@ class QualityCheck(models.Model):
|
||||
|
||||
# ==========零件特采接口==========
|
||||
def _register_tool_groups(self):
|
||||
create_url = '/AutoDeviceApi/FeedBackOut'
|
||||
create_url = '/AutoDeviceApi/ModSpecial'
|
||||
sf_sync_config = self.env['res.config.settings'].get_values()
|
||||
token = sf_sync_config['token']
|
||||
sf_secret_key = sf_sync_config['sf_secret_key']
|
||||
|
||||
@@ -8,7 +8,7 @@ from odoo.http import request
|
||||
|
||||
class Manufacturing_Connect(http.Controller):
|
||||
|
||||
@http.route('/AutoDeviceApi/FeedBackOut', type='json', auth='sf_token', methods=['GET', 'POST'], csrf=False,
|
||||
@http.route('/AutoDeviceApi/MachineToolLibrary', type='json', auth='sf_token', methods=['GET', 'POST'], csrf=False,
|
||||
cors="*")
|
||||
def get_equipment_tool_Info(self, **kw):
|
||||
"""
|
||||
@@ -55,3 +55,32 @@ class Manufacturing_Connect(http.Controller):
|
||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
|
||||
logging.info('get_equipment_tool_Info error:%s' % e)
|
||||
return json.JSONEncoder().encode(res)
|
||||
|
||||
@http.route('/AutoDeviceApi/ToolGroups', type='json', auth='none', methods=['GET', 'POST'], csrf=False,
|
||||
cors="*")
|
||||
def get_functional_tool_groups_Info(self, **kw):
|
||||
"""
|
||||
刀具组接口
|
||||
:param kw:
|
||||
:return:
|
||||
"""
|
||||
logging.info('get_functional_tool_groups_Info:%s' % kw)
|
||||
try:
|
||||
datas = request.httprequest.data
|
||||
ret = json.loads(datas)
|
||||
ret = json.loads(ret['result'])
|
||||
logging.info('DeviceId:%s' % ret)
|
||||
functional_tools = request.env['sf.functional.cutting.tool.entity'].sudo().search([])
|
||||
|
||||
res = {'Succeed': True, 'Datas': []}
|
||||
if functional_tools:
|
||||
for item in functional_tools:
|
||||
res['Datas'].append({
|
||||
'GroupName': item.tool_groups_id.name,
|
||||
'ToolId': item.code,
|
||||
'ToolName': item.name
|
||||
})
|
||||
except Exception as e:
|
||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
|
||||
logging.info('get_functional_tool_groups_Info error:%s' % e)
|
||||
return json.JSONEncoder().encode(res)
|
||||
@@ -180,7 +180,7 @@ class FunctionalCuttingToolEntity(models.Model):
|
||||
|
||||
# ==========刀具组接口==========
|
||||
def _register_functional_tool_groups(self, obj):
|
||||
create_url = '/AutoDeviceApi/FeedBackOut'
|
||||
create_url = '/AutoDeviceApi/ToolGroups'
|
||||
sf_sync_config = self.env['res.config.settings'].get_values()
|
||||
token = sf_sync_config['token']
|
||||
sf_secret_key = sf_sync_config['sf_secret_key']
|
||||
|
||||
@@ -11,7 +11,7 @@ class CNCprocessing(models.Model):
|
||||
|
||||
# ==========MES装刀指令接口==========
|
||||
def register_cnc_processing(self, cnc_processing):
|
||||
create_url = '/AutoDeviceApi/FeedBackOut'
|
||||
create_url = '/AutoDeviceApi/MESToolLoadingInstruction'
|
||||
sf_sync_config = self.env['res.config.settings'].get_values()
|
||||
token = sf_sync_config['token']
|
||||
sf_secret_key = sf_sync_config['sf_secret_key']
|
||||
|
||||
@@ -409,7 +409,7 @@ class Sf_stock_move_line(models.Model):
|
||||
)
|
||||
|
||||
# 添加数据
|
||||
qr.add_data(self.lot_id.name)
|
||||
qr.add_data(record.lot_id.name)
|
||||
qr.make(fit=True)
|
||||
|
||||
# 创建二维码图像
|
||||
|
||||
Reference in New Issue
Block a user