Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/修改机床参数bug

# Conflicts:
#	sf_manufacturing/controllers/controllers.py
This commit is contained in:
qihao.gong@jikimo.com
2024-02-22 16:54:15 +08:00
4 changed files with 71 additions and 26 deletions

View File

@@ -110,15 +110,15 @@ class Manufacturing_Connect(http.Controller):
logging.info('RfidCode:%s' % ret['RfidCode'])
if 'RfidCode' in ret:
workorder = request.env['mrp.workorder'].sudo().search(
[('routing_type', '=', '前置三元定位检测'), ('rfid_code', '=', ret['RfidCode'])])
[('routing_type', '=', '装夹预调'), ('rfid_code', '=', ret['RfidCode'])])
if workorder:
for item in workorder:
if item.material_center_point:
offset = item.material_center_point.strip('()').split(',')
offset = item.material_center_point[1:-1].split(",")
res['Datas'].append({
'XOffset': 0 if not item.material_center_point else offset[0],
'YOffset': 0 if not item.material_center_point else offset[1],
'ZOffet': 0 if not item.material_center_point else offset[3],
'ZOffet': 0 if not item.material_center_point else offset[2],
'COffset': 'G54' if not item.X_deviation_angle else item.X_deviation_angle
})
else:
@@ -195,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(
@@ -219,6 +204,44 @@ class Manufacturing_Connect(http.Controller):
logging.info('PartQualityInspect error:%s' % e)
return json.JSONEncoder().encode(res)
@http.route('/AutoDeviceApi/CMMProgDolod', type='json', auth='sf_token', methods=['GET', 'POST'], csrf=False,
cors="*")
def CMMProgDolod(self, **kw):
"""
中控系统传递RFID编号给MES获取测量程序文件。Ftp下载文件
:param kw:
:return:
"""
logging.info('CMMProgDolod:%s' % kw)
try:
res = {'Succeed': True, 'Datas': []}
datas = request.httprequest.data
ret = json.loads(datas)
if 'RfidCode' in ret:
logging.info('RfidCode:%s' % ret['RfidCode'])
workorder = request.env['mrp.workorder'].sudo().search(
[('rfid_code', '=', ret['RfidCode']), ('routing_type', '=', 'CNC加工')])
if workorder:
for item in workorder.cmm_ids:
if item.program_date is not False:
program_date = item.program_date.strftime("%Y-%m-%d %H:%M:%S")
program_date_str = request.env['sf.sync.common'].sudo().get_add_time(program_date)
res['Datas'].append({
'CraftId': workorder.id,
'CraftKey': workorder.name,
'ProgramDate': '' if not item.program_date else program_date_str,
'ProgramPath': item.program_path,
'PostProcessing': item.post_processing_name,
})
else:
res = {'Succeed': False, 'ErrorCode': 203, 'Error': '暂无工单及对应的CNC程序数据'}
else:
res = {'Succeed': False, 'ErrorCode': 201, 'Error': '未传RfidCode字段'}
except Exception as e:
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
logging.info('CMMProgDolod error:%s' % e)
return json.JSONEncoder().encode(res)
@http.route('/AutoDeviceApi/NCProgDolod', type='json', auth='sf_token', methods=['GET', 'POST'], csrf=False,
cors="*")
def NCProgDolod(self, **kw):
@@ -258,9 +281,11 @@ class Manufacturing_Connect(http.Controller):
logging.info('NCProgDolod error:%s' % e)
return json.JSONEncoder().encode(res)
@http.route('/AutoDeviceApi/LocationChange', type='json', auth='none', methods=['GET', 'POST'], csrf=False,
@http.route('/AutoDeviceApi/LocationChange', type='json', auth='sf_token', methods=['GET', 'POST'], csrf=False,
cors="*")
def LocationChange(self, **kw):
def NCProgDolod(self, **kw):
"""
库位变更
:param kw:
@@ -281,6 +306,3 @@ class Manufacturing_Connect(http.Controller):
logging.info('NCProgDolod error:%s' % e)
return json.JSONEncoder().encode(res)