优化自动化传递工单号获取工单信息接口

This commit is contained in:
jinling.yang
2024-01-17 17:33:13 +08:00
parent 4f0c7ad274
commit bba2c1d839
5 changed files with 27 additions and 27 deletions

View File

@@ -20,9 +20,9 @@ class Manufacturing_Connect(http.Controller):
res = {'Succeed': True, 'Datas': []}
datas = request.httprequest.data
ret = json.loads(datas)
ret = json.loads(ret['result'])
logging.info('RfidCode:%s' % ret)
workorder = request.env['mrp.workorder'].sudo().search([('name', '=', ret['RfidCode'])])
workorder = request.env['mrp.workorder'].sudo().search(
[('production_id.name', '=', 'WH/MO/00071'), ('routing_type', '=', '装夹')])
if workorder:
for item in workorder:
res['Datas'].append({
@@ -32,8 +32,9 @@ class Manufacturing_Connect(http.Controller):
'Quantity': 1,
'MaterialId': item.product_id.default_code,
'MaterialName': item.product_id.name,
# 'Spec':item.mat,
'Material': item.materials_type_id.name
'Spec': '%s×%s×%s' % (item.move_raw_ids.materiel_length, item.move_raw_ids.materiel_width,
item.move_raw_ids.materiel_height),
'Material': item.product_id.materials_type_id.name
})
except Exception as e:
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
@@ -144,4 +145,3 @@ class Manufacturing_Connect(http.Controller):
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
logging.info('get_qcCheck error:%s' % e)
return json.JSONEncoder().encode(res)