零件质检接口 修改coding缺陷

This commit is contained in:
qihao.gong@jikimo.com
2024-01-18 17:26:31 +08:00
parent 2b7243f69c
commit aa810bbda2
3 changed files with 192 additions and 118 deletions

View File

@@ -109,3 +109,42 @@ class Manufacturing_Connect(http.Controller):
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
logging.info('get_Work_Info error:%s' % e)
return json.JSONEncoder().encode(res)
@http.route('/AutoDeviceApi/QcCheck', type='json', auth='none', methods=['GET', 'POST'], csrf=False,
cors="*")
def Workorder_QcCheck(self, **kw):
"""
零件质检
:param kw:
:return:
"""
logging.info('get_Work_Info:%s' % kw)
try:
res = {'Succeed': True, 'Datas': []}
datas = request.httprequest.data
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']
routing_type = ret['CraftId']
request.env['mrp.workorder'].sudo().search(
[('production_id', '=', production_id), ('routing_type', '=', routing_type)], limit=1)
except Exception as e:
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
logging.info('get_Work_Info error:%s' % e)
return json.JSONEncoder().encode(res)