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:
jinling.yang
2024-02-22 17:17:02 +08:00
4 changed files with 36 additions and 35 deletions

View File

@@ -143,19 +143,13 @@ class Manufacturing_Connect(http.Controller):
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)
production_id = ret['BillId']
routing_type = ret['CraftId']
workorder = request.env['mrp.workorder'].sudo().search(
[('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()
except Exception as e:
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
@@ -175,19 +169,13 @@ class Manufacturing_Connect(http.Controller):
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)
production_id = ret['BillId']
routing_type = ret['CraftId']
workorder = request.env['mrp.workorder'].sudo().search(
[('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()
except Exception as e:
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
@@ -207,21 +195,6 @@ class Manufacturing_Connect(http.Controller):
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(
@@ -308,6 +281,7 @@ class Manufacturing_Connect(http.Controller):
logging.info('NCProgDolod error:%s' % e)
return json.JSONEncoder().encode(res)
@http.route('/AutoDeviceApi/LocationChange', type='json', auth='sf_token', methods=['GET', 'POST'], csrf=False,
cors="*")
def LocationChange(self, **kw):
@@ -387,3 +361,4 @@ class Manufacturing_Connect(http.Controller):
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
logging.info('AGVDownProduct error:%s' % e)
return json.JSONEncoder().encode(res)