1、接口优化

This commit is contained in:
yuxianghui
2024-04-23 15:33:59 +08:00
parent 1fa5ebd80a
commit c56886aebe
3 changed files with 349 additions and 364 deletions

View File

@@ -470,7 +470,6 @@ class ResMrpWorkOrder(models.Model):
[0, '', {'production_id': production.id, 'type': '运送空料架'}], [0, '', {'production_id': production.id, 'type': '运送空料架'}],
] ]
# 拼接工单对象属性值(表面工艺) # 拼接工单对象属性值(表面工艺)
def _json_workorder_surface_process_str(self, production, route, process_parameter, supplier_id): def _json_workorder_surface_process_str(self, production, route, process_parameter, supplier_id):
workorders_values_str = [0, '', { workorders_values_str = [0, '', {
@@ -496,7 +495,6 @@ def _json_workorder_surface_process_str(self, production, route, process_paramet
}] }]
return workorders_values_str return workorders_values_str
# 维修模块按钮 # 维修模块按钮
def button_maintenance_req(self): def button_maintenance_req(self):
self.ensure_one() self.ensure_one()
@@ -516,7 +514,6 @@ def button_maintenance_req(self):
'domain': [('workorder_id', '=', self.id)] 'domain': [('workorder_id', '=', self.id)]
} }
# tray_id = fields.Many2one('sf.tray', string="托盘信息", tracking=True) # tray_id = fields.Many2one('sf.tray', string="托盘信息", tracking=True)
# 扫码绑定托盘方法 # 扫码绑定托盘方法
@@ -553,12 +550,10 @@ def pro_code_is_ok(self, barcode):
else: else:
return True return True
pro_code = fields.Char(string='坯料序列号') pro_code = fields.Char(string='坯料序列号')
pro_code_ok = fields.Boolean(default=False) pro_code_ok = fields.Boolean(default=False)
# 托盘扫码绑定 # 托盘扫码绑定
# def gettray_auto(self, barcode): # def gettray_auto(self, barcode):
# if barcode != False: # if barcode != False:
@@ -663,7 +658,6 @@ def recreateManufacturingOrWorkerOrder(self):
else: else:
self.results = '合格' self.results = '合格'
def json_workorder_str1(self, k, production, route): def json_workorder_str1(self, k, production, route):
workorders_values_str = [0, '', { workorders_values_str = [0, '', {
'product_uom_id': production.product_uom_id.id, 'product_uom_id': production.product_uom_id.id,
@@ -684,7 +678,6 @@ def json_workorder_str1(self, k, production, route):
}] }]
return workorders_values_str return workorders_values_str
# 重写工单开始按钮方法 # 重写工单开始按钮方法
def button_start(self): def button_start(self):
if self.routing_type == '装夹预调' and self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name: if self.routing_type == '装夹预调' and self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name:
@@ -748,7 +741,6 @@ def button_start(self):
else: else:
raise UserError(_('请先完成上一步工单')) raise UserError(_('请先完成上一步工单'))
def button_finish(self): def button_finish(self):
if self.routing_type == '装夹预调': if self.routing_type == '装夹预调':
if not self.material_center_point and self.X_deviation_angle > 0: if not self.material_center_point and self.X_deviation_angle > 0:
@@ -791,7 +783,6 @@ def button_finish(self):
self.production_id.button_mark_done1() self.production_id.button_mark_done1()
# self.production_id.state = 'done' # self.production_id.state = 'done'
# 将FTP的检测报告文件下载到临时目录 # 将FTP的检测报告文件下载到临时目录
def download_reportfile_tmp(self, workorder, reportpath): def download_reportfile_tmp(self, workorder, reportpath):
logging.info('reportpath:%s' % reportpath) logging.info('reportpath:%s' % reportpath)
@@ -813,7 +804,6 @@ def download_reportfile_tmp(self, workorder, reportpath):
download_state = 2 download_state = 2
return download_state return download_state
# 根据中控系统提供的检测文件地址去ftp里对应的制造订单里获取 # 根据中控系统提供的检测文件地址去ftp里对应的制造订单里获取
def get_detection_file(self, workorder, reportPath): def get_detection_file(self, workorder, reportPath):
if reportPath.startswith('/'): if reportPath.startswith('/'):

View File

@@ -12,13 +12,10 @@ class QualityCheck(models.Model):
# ==========零件特采接口========== # ==========零件特采接口==========
def _register_quality_check(self): def _register_quality_check(self):
# create_url = '/AutoDeviceApi/PartSpecProc' config = self.env['res.config.settings'].get_values()
# sf_sync_config = self.env['res.config.settings'].get_values() # token = sf_sync_config['token'Ba F2CF5DCC-1A00-4234-9E95-65603F70CC8A]
# token = sf_sync_config['token'] headers = {'Authorization': config['center_control_Authorization']}
# sf_secret_key = sf_sync_config['sf_secret_key'] crea_url = config['center_control_url'] + "/AutoDeviceApi/GetToolInfos"
# headers = Common.get_headers(self, token, sf_secret_key)
headers = {'Authorization': 'Ba F2CF5DCC-1A00-4234-9E95-65603F70CC8A'}
crea_url = "https://x24467i973.zicp.fun/AutoDeviceApi/PartSpecProc"
origin = self.picking_id.origin origin = self.picking_id.origin
production_id = self.env['mrp.production'].sudo().search([('name', '=', origin)]) production_id = self.env['mrp.production'].sudo().search([('name', '=', origin)])
rfid = '' if not production_id.workorder_ids else production_id.workorder_ids[-1].rfid_code or '' rfid = '' if not production_id.workorder_ids else production_id.workorder_ids[-1].rfid_code or ''

View File

@@ -12,18 +12,16 @@ class CNCprocessing(models.Model):
# ==========MES装刀指令接口========== # ==========MES装刀指令接口==========
def register_cnc_processing(self, knife_plan): def register_cnc_processing(self, knife_plan):
# sf_sync_config = self.env['res.config.settings'].get_values() config = self.env['res.config.settings'].get_values()
# token = sf_sync_config['token'] # token = sf_sync_config['token'Ba F2CF5DCC-1A00-4234-9E95-65603F70CC8A]
# sf_secret_key = sf_sync_config['sf_secret_key'] headers = {'Authorization': config['center_control_Authorization']}
# headers = Common.get_headers(self, token, sf_secret_key) crea_url = config['center_control_url'] + "/AutoDeviceApi/GetToolInfos"
headers = {'Authorization': 'Ba F2CF5DCC-1A00-4234-9E95-65603F70CC8A'}
strurl = "https://x24467i973.zicp.fun/AutoDeviceApi/ToolLoadInstruct"
val = { val = {
'DeviceId': knife_plan.machine_table_name, 'DeviceId': knife_plan.machine_table_name,
'RfidCode': knife_plan.sf_functional_tool_assembly_id.rfid, 'RfidCode': knife_plan.sf_functional_tool_assembly_id.rfid,
'ToolId': int(knife_plan.cutter_spacing_code_id.code[1:]) 'ToolId': int(knife_plan.cutter_spacing_code_id.code[1:])
} }
r = requests.post(strurl, json=val, headers=headers) r = requests.post(crea_url, json=val, headers=headers)
ret = r.json() ret = r.json()
logging.info('register_cnc_processing:%s' % ret) logging.info('register_cnc_processing:%s' % ret)
if ret['Succeed']: if ret['Succeed']: