1、新增货位批次数量模型,用来存储货位产品的批次及其数量;完成该模型根据货位产品的出入库记录自动新增或减少货位产品批次的数量。
This commit is contained in:
@@ -36,3 +36,63 @@ class Manufacturing_Connect(http.Controller):
|
||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
|
||||
logging.info('get_functional_tool_groups_Info error:%s' % e)
|
||||
return json.JSONEncoder().encode(res)
|
||||
|
||||
@http.route('/AutoDeviceApi/ToolInventory', type='json', auth='none', methods=['GET', 'POST'], csrf=False,
|
||||
cors="*")
|
||||
def get_functional_tool_inventory_Info(self, **kw):
|
||||
"""
|
||||
功能刀具清单接口
|
||||
:param kw:
|
||||
:return:
|
||||
"""
|
||||
logging.info('get_functional_tool_inventory_Info:%s' % kw)
|
||||
try:
|
||||
datas = request.httprequest.data
|
||||
ret = json.loads(datas)
|
||||
# ret = json.loads(ret['result'])
|
||||
logging.info('DeviceId:%s' % ret)
|
||||
tool_inventory = request.env['sf.tool.inventory'].sudo().search([])
|
||||
|
||||
res = {'Succeed': True, 'Datas': []}
|
||||
if tool_inventory:
|
||||
for item in tool_inventory:
|
||||
res['Datas'].append({
|
||||
'ToolName': item.name,
|
||||
'GroupName': item.tool_groups_id.name,
|
||||
'Lifetime': item.life_span
|
||||
})
|
||||
except Exception as e:
|
||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
|
||||
logging.info('get_functional_tool_inventory_Info error:%s' % e)
|
||||
return json.JSONEncoder().encode(res)
|
||||
|
||||
@http.route('/AutoDeviceApi/ToolEntity', type='json', auth='none', methods=['GET', 'POST'], csrf=False,
|
||||
cors="*")
|
||||
def get_functional_tool_entity_Info(self, **kw):
|
||||
"""
|
||||
功能刀具列表接口
|
||||
:param kw:
|
||||
:return:
|
||||
"""
|
||||
logging.info('get_functional_tool_entity_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({
|
||||
'Rfid': item.rfid,
|
||||
'ToolName': item.tool_name_id.name,
|
||||
'GroupName': item.tool_groups_id.name,
|
||||
'MaxLifetime': item.max_lifetime_value,
|
||||
'KnifeHandle': item.cutting_tool_cutterhandle_model_id.name
|
||||
})
|
||||
except Exception as e:
|
||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
|
||||
logging.info('get_functional_tool_entity_Info error:%s' % e)
|
||||
return json.JSONEncoder().encode(res)
|
||||
|
||||
Reference in New Issue
Block a user