1、优化刀具接口
This commit is contained in:
@@ -734,7 +734,7 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
|
||||
撤回装刀申请
|
||||
:return:
|
||||
"""
|
||||
self.env['sf.functional.tool.assembly'].search(
|
||||
self.env['sf.functional.tool.assembly'].sudo().search(
|
||||
[('assembly_order_code', '=', self.sf_functional_tool_assembly_id.assembly_order_code),
|
||||
('loading_task_source', '=', '0')]).unlink()
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import json
|
||||
import requests
|
||||
from odoo import models, api, fields
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.addons.sf_base.commons.common import Common
|
||||
|
||||
|
||||
class SfMaintenanceEquipmentTool(models.Model):
|
||||
@@ -29,6 +32,30 @@ class SfMaintenanceEquipmentTool(models.Model):
|
||||
return tools
|
||||
|
||||
|
||||
class SfMaintenanceEquipment(models.Model):
|
||||
_inherit = 'maintenance.equipment'
|
||||
_description = '设备机床刀库'
|
||||
|
||||
# ==========机床当前刀库实时信息接口==========
|
||||
def register_equipment_tool(self):
|
||||
sf_sync_config = self.env['res.config.settings'].get_values()
|
||||
token = sf_sync_config['token']
|
||||
sf_secret_key = sf_sync_config['sf_secret_key']
|
||||
headers = Common.get_headers(self, token, sf_secret_key)
|
||||
strurl = "https://x24467i973.zicp.fun/AutoDeviceApi/GetToolInfos"
|
||||
val = {
|
||||
"DeviceId": self.name
|
||||
}
|
||||
kw = json.dumps(val, ensure_ascii=False)
|
||||
r = requests.get(strurl, json={}, data={'kw': kw, 'token': token}, headers=headers)
|
||||
ret = r.json()
|
||||
print(ret)
|
||||
if r == 200:
|
||||
return "机床当前刀库实时信息指令发送成功"
|
||||
else:
|
||||
raise ValidationError("机床当前刀库实时信息指令发送失败")
|
||||
|
||||
|
||||
class StockLot(models.Model):
|
||||
_inherit = 'stock.lot'
|
||||
|
||||
|
||||
@@ -11,12 +11,11 @@ class CNCprocessing(models.Model):
|
||||
|
||||
# ==========MES装刀指令接口==========
|
||||
def register_cnc_processing(self, cnc_processing):
|
||||
create_url = '/AutoDeviceApi/ToolLoadInstruct'
|
||||
sf_sync_config = self.env['res.config.settings'].get_values()
|
||||
token = sf_sync_config['token']
|
||||
sf_secret_key = sf_sync_config['sf_secret_key']
|
||||
headers = Common.get_headers(self, token, sf_secret_key)
|
||||
strurl = sf_sync_config['sf_url'] + create_url
|
||||
strurl = "https://x24467i973.zicp.fun/AutoDeviceApi/ToolLoadInstruct"
|
||||
val = {
|
||||
'DeviceId': cnc_processing.workorder_id.machine_tool_name,
|
||||
'RfidCode': None,
|
||||
|
||||
Reference in New Issue
Block a user