恢复代码
This commit is contained in:
@@ -26,4 +26,3 @@ class ResPartner(models.Model):
|
|||||||
|
|
||||||
sf_token = fields.Char(u'Token', default=get_token)
|
sf_token = fields.Char(u'Token', default=get_token)
|
||||||
sf_secret_key = fields.Char(u'密钥', default=get_secret)
|
sf_secret_key = fields.Char(u'密钥', default=get_secret)
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,6 @@
|
|||||||
<field name="company_id" ref="base.main_company"/>
|
<field name="company_id" ref="base.main_company"/>
|
||||||
<field name="single_manufacturing">true</field>
|
<field name="single_manufacturing">true</field>
|
||||||
<field name="tracking">serial</field>
|
<field name="tracking">serial</field>
|
||||||
<!-- <field name="active" eval="False"/>-->
|
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="product_embryo_sf_outsource" model="product.product">
|
<record id="product_embryo_sf_outsource" model="product.product">
|
||||||
@@ -61,7 +60,6 @@
|
|||||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
||||||
<field name="company_id" ref="base.main_company"/>
|
<field name="company_id" ref="base.main_company"/>
|
||||||
<field name="tracking">serial</field>
|
<field name="tracking">serial</field>
|
||||||
<!-- <field name="active" eval="False"/>-->
|
|
||||||
</record>
|
</record>
|
||||||
<record id="product_embryo_sf_purchase" model="product.product">
|
<record id="product_embryo_sf_purchase" model="product.product">
|
||||||
<field name="name">胚料采购模板</field>
|
<field name="name">胚料采购模板</field>
|
||||||
@@ -76,7 +74,6 @@
|
|||||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
||||||
<field name="company_id" ref="base.main_company"/>
|
<field name="company_id" ref="base.main_company"/>
|
||||||
<field name="tracking">serial</field>
|
<field name="tracking">serial</field>
|
||||||
<!-- <field name="active" eval="False"/>-->
|
|
||||||
</record>
|
</record>
|
||||||
</data>
|
</data>
|
||||||
</odoo>
|
</odoo>
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
from. import product_template
|
from. import product_template
|
||||||
|
from. import product_supplierinfo
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
11
sf_dlm/models/product_supplierinfo.py
Normal file
11
sf_dlm/models/product_supplierinfo.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
from odoo import models, fields, api
|
||||||
|
|
||||||
|
|
||||||
|
class ResSupplierInfo(models.Model):
|
||||||
|
_inherit = 'product.supplierinfo'
|
||||||
|
|
||||||
|
def _compute_is_subcontractor(self):
|
||||||
|
for supplier in self:
|
||||||
|
boms = supplier.product_id.variant_bom_ids
|
||||||
|
boms |= supplier.product_tmpl_id.bom_ids.filtered(lambda b: not b.product_id or b.product_id in (supplier.product_id or supplier.product_tmpl_id.product_variant_ids))
|
||||||
|
supplier.is_subcontractor = supplier.partner_id in boms.subcontractor_id
|
||||||
@@ -82,7 +82,7 @@ class ResProductTemplate(models.Model):
|
|||||||
item['model_height'] + model_type.embryo_tolerance),
|
item['model_height'] + model_type.embryo_tolerance),
|
||||||
'model_type_id': model_type.id,
|
'model_type_id': model_type.id,
|
||||||
'model_processing_panel': 'R',
|
'model_processing_panel': 'R',
|
||||||
'model_machining_precision': item['model_machining_precision'],
|
'model_machining_precision': item['model_machining_precision'],
|
||||||
'model_code': item['barcode'],
|
'model_code': item['barcode'],
|
||||||
'length': item['model_long'],
|
'length': item['model_long'],
|
||||||
'width': item['model_width'],
|
'width': item['model_width'],
|
||||||
@@ -92,7 +92,7 @@ class ResProductTemplate(models.Model):
|
|||||||
'model_name': attachment.name,
|
'model_name': attachment.name,
|
||||||
'upload_model_file': [(6, 0, [attachment.id])],
|
'upload_model_file': [(6, 0, [attachment.id])],
|
||||||
# 'single_manufacturing': True,
|
# 'single_manufacturing': True,
|
||||||
'tracking': 'serial',
|
# 'tracking': 'serial',
|
||||||
'list_price': item['price'],
|
'list_price': item['price'],
|
||||||
# 'categ_id': self.env.ref('sf_dlm.product_category_finished_sf').id,
|
# 'categ_id': self.env.ref('sf_dlm.product_category_finished_sf').id,
|
||||||
'materials_id': self.env['sf.production.materials'].search(
|
'materials_id': self.env['sf.production.materials'].search(
|
||||||
@@ -158,14 +158,13 @@ class ResProductTemplate(models.Model):
|
|||||||
'active': True
|
'active': True
|
||||||
}
|
}
|
||||||
# 外协和采购生成的胚料需要根据材料型号绑定供应商
|
# 外协和采购生成的胚料需要根据材料型号绑定供应商
|
||||||
if route_type == 'subcontract':
|
if route_type == 'subcontract' or route_type == 'purchase':
|
||||||
no_bom_copy_product_id.purchase_ok = True
|
|
||||||
no_bom_copy_product_id.seller_ids = [
|
|
||||||
(0, 0, {'partner_id': supplier.partner_id.id, 'delay': 1.0, 'is_subcontractor': True})]
|
|
||||||
elif route_type == 'purchase':
|
|
||||||
no_bom_copy_product_id.purchase_ok = True
|
no_bom_copy_product_id.purchase_ok = True
|
||||||
no_bom_copy_product_id.seller_ids = [
|
no_bom_copy_product_id.seller_ids = [
|
||||||
(0, 0, {'partner_id': supplier.partner_id.id, 'delay': 1.0})]
|
(0, 0, {'partner_id': supplier.partner_id.id, 'delay': 1.0})]
|
||||||
|
if route_type == 'subcontract':
|
||||||
|
partner = self.env['res.partner'].search([('id', '=', supplier.partner_id.id)])
|
||||||
|
partner.is_subcontractor = True
|
||||||
no_bom_copy_product_id.write(vals)
|
no_bom_copy_product_id.write(vals)
|
||||||
logging.info('no_bom_copy_product_id-vals:%s' % vals)
|
logging.info('no_bom_copy_product_id-vals:%s' % vals)
|
||||||
# product_id.product_tmpl_id.active = False
|
# product_id.product_tmpl_id.active = False
|
||||||
@@ -249,7 +248,6 @@ class ResMrpBom(models.Model):
|
|||||||
[('materials_model_id', '=', materials_type.id)],
|
[('materials_model_id', '=', materials_type.id)],
|
||||||
limit=1,
|
limit=1,
|
||||||
order='sequence asc')
|
order='sequence asc')
|
||||||
logging.info('get_supplier-vals:%s' % seller_id)
|
|
||||||
return seller_id
|
return seller_id
|
||||||
|
|
||||||
# 匹配bom
|
# 匹配bom
|
||||||
|
|||||||
@@ -6,13 +6,13 @@
|
|||||||
<field name="model">product.template</field>
|
<field name="model">product.template</field>
|
||||||
<field name="inherit_id" ref="product.product_template_only_form_view"/>
|
<field name="inherit_id" ref="product.product_template_only_form_view"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<!-- <field name="image_1920" position="replace">-->
|
<!-- <field name="image_1920" position="replace">-->
|
||||||
<!-- <field name="upload_model_file" required="True"-->
|
<!-- <field name="upload_model_file" required="True"-->
|
||||||
<!-- widget='many2many_binary'/>-->
|
<!-- widget='many2many_binary'/>-->
|
||||||
<!-- </field>-->
|
<!-- </field>-->
|
||||||
|
|
||||||
<field name="invoice_policy" position="after">
|
<field name="invoice_policy" position="after">
|
||||||
<field name="model_file" required="True" widget="model_viewer"/>
|
<field name="model_file" widget="model_viewer" />
|
||||||
<field name="materials_id" string="材料"/>
|
<field name="materials_id" string="材料"/>
|
||||||
<field name="materials_type_id" string="型号"
|
<field name="materials_type_id" string="型号"
|
||||||
domain="[('materials_id', '=', materials_id)]"/>
|
domain="[('materials_id', '=', materials_id)]"/>
|
||||||
@@ -36,18 +36,31 @@
|
|||||||
|
|
||||||
<xpath expr="//page[last()]" position="after">
|
<xpath expr="//page[last()]" position="after">
|
||||||
<page string="加工参数">
|
<page string="加工参数">
|
||||||
<group string="模型">
|
<group>
|
||||||
<field name="model_long" string="长[mm]"/>
|
<group string="模型">
|
||||||
<field name="model_width" string="宽[mm]"/>
|
<label for="model_long" string="尺寸[mm]"/>
|
||||||
<field name="model_height" string="高[mm]"/>
|
<div class="o_address_format">
|
||||||
<field name="model_volume" string="体积[m³]"/>
|
<label for="model_long" string="长"/>
|
||||||
<field name="model_type_id" string="模型类型"/>
|
<field name="model_long" class="o_address_zip"/>
|
||||||
<field name="model_processing_panel" placeholder="例如R,U" string="加工面板"/>
|
<!-- <span>&nbsp;</span>-->
|
||||||
<field name="model_machining_precision"/>
|
<label for="model_width" string="宽"/>
|
||||||
<field name="model_surface_process_id" string="表面工艺"/>
|
<field name="model_width" class="o_address_zip"/>
|
||||||
<field name="model_process_parameters_id" string="工艺参数"
|
<!-- <span>&nbsp;</span>-->
|
||||||
domain="[('processing_order_ids', '=', model_surface_process_id)]"/>
|
<label for="model_height" string="高"/>
|
||||||
<field name="model_remark" string="备注说明"/>
|
<field name="model_height" class="o_address_zip"/>
|
||||||
|
</div>
|
||||||
|
<!-- <field name="model_long" string="长[mm]"/>-->
|
||||||
|
<!-- <field name="model_width" string="宽[mm]"/>-->
|
||||||
|
<!-- <field name="model_height" string="高[mm]"/>-->
|
||||||
|
<field name="model_volume" string="体积[mm³]"/>
|
||||||
|
<field name="model_type_id" string="模型类型"/>
|
||||||
|
<field name="model_processing_panel" placeholder="例如R,U" string="加工面板"/>
|
||||||
|
<field name="model_machining_precision"/>
|
||||||
|
<field name="model_surface_process_id" string="表面工艺"/>
|
||||||
|
<field name="model_process_parameters_id" string="工艺参数"
|
||||||
|
domain="[('processing_order_ids', '=', model_surface_process_id)]"/>
|
||||||
|
<field name="model_remark" string="备注说明"/>
|
||||||
|
</group>
|
||||||
</group>
|
</group>
|
||||||
</page>
|
</page>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||||
{
|
{
|
||||||
'name': '机企猫智能工厂 对接机床',
|
'name': 'sf_machine_connect',
|
||||||
'version': '2.0',
|
'version': '1.0',
|
||||||
'summary': 'sf_machine_connect',
|
'summary': '智能工厂机床连接模块',
|
||||||
'sequence': 10,
|
'sequence': 10,
|
||||||
'description': """
|
'description': """
|
||||||
这是一个模块
|
这是一个模块
|
||||||
@@ -20,7 +20,6 @@
|
|||||||
'views/WorkCenterBarcodes.xml',
|
'views/WorkCenterBarcodes.xml',
|
||||||
'views/Stock_picking_Barcodes.xml',
|
'views/Stock_picking_Barcodes.xml',
|
||||||
'views/machine_monitor.xml',
|
'views/machine_monitor.xml',
|
||||||
# 'views/machine_info_present.xml',
|
|
||||||
],
|
],
|
||||||
|
|
||||||
'assets': {
|
'assets': {
|
||||||
|
|||||||
@@ -24,23 +24,6 @@ class FtpButton(models.Model):
|
|||||||
_inherit = 'sf.cnc.processing'
|
_inherit = 'sf.cnc.processing'
|
||||||
|
|
||||||
button_state = fields.Boolean(string='是否已经下发')
|
button_state = fields.Boolean(string='是否已经下发')
|
||||||
user_permissions = fields.Boolean(string='权限', related='workorder_id.user_permissions')
|
|
||||||
state = fields.Selection(string='状态', related='workorder_id.state')
|
|
||||||
|
|
||||||
@api.onchange('users_ids')
|
|
||||||
def get_user_permissions(self):
|
|
||||||
uid = self.env.uid
|
|
||||||
for workorder in self:
|
|
||||||
if workorder.users_ids:
|
|
||||||
list_user_id = []
|
|
||||||
for item in workorder.users_ids:
|
|
||||||
list_user_id.append(item.id)
|
|
||||||
if uid in list_user_id:
|
|
||||||
workorder.user_permissions = True
|
|
||||||
else:
|
|
||||||
workorder.user_permissions = False
|
|
||||||
else:
|
|
||||||
workorder.user_permissions = False
|
|
||||||
|
|
||||||
def pri(self):
|
def pri(self):
|
||||||
"""
|
"""
|
||||||
@@ -70,13 +53,7 @@ class FtpButton(models.Model):
|
|||||||
except Exception:
|
except Exception:
|
||||||
raise UserError("补偿值写入执行超时,请检查机床状态或者写入状态")
|
raise UserError("补偿值写入执行超时,请检查机床状态或者写入状态")
|
||||||
|
|
||||||
# host="192.168.2.158", port=8080, username="MITSUBISHI", password="CNC"
|
ftp = ftp_operate.FtpController()
|
||||||
host = self.workorder_id.workcenter_id.machine_tool_id.ftp_host
|
|
||||||
port = self.workorder_id.workcenter_id.machine_tool_id.ftp_port
|
|
||||||
username = self.workorder_id.workcenter_id.machine_tool_id.ftp_num
|
|
||||||
pwd = self.workorder_id.workcenter_id.machine_tool_id.ftp_pwd
|
|
||||||
|
|
||||||
ftp = ftp_operate.FtpController(host, port, username, pwd)
|
|
||||||
# ftp.delAllfile('C://Users//马广威//Desktop//ftp')
|
# ftp.delAllfile('C://Users//马广威//Desktop//ftp')
|
||||||
a = self.cnc_id
|
a = self.cnc_id
|
||||||
_logger.info(a.public)
|
_logger.info(a.public)
|
||||||
@@ -85,14 +62,12 @@ class FtpButton(models.Model):
|
|||||||
|
|
||||||
# file_path = '{}\{}\{}'.format(a._filestore(), a.store_fname.split('/'[0]), a.display_name)
|
# file_path = '{}\{}\{}'.format(a._filestore(), a.store_fname.split('/'[0]), a.display_name)
|
||||||
file_path_local = '{}/{}'.format('/nc2machine', a.display_name)
|
file_path_local = '{}/{}'.format('/nc2machine', a.display_name)
|
||||||
file_path_remote = '{}\{}'.format('//M80(192,168,2,142)//DS', a.display_name)
|
file_path_remote = '{}\{}'.format('//(192,168,2,141)//DS', a.display_name)
|
||||||
|
|
||||||
with open(file_path_local, mode='wb+') as file:
|
with open(file_path_local, mode='wb+') as file:
|
||||||
file.write(datas)
|
file.write(datas)
|
||||||
# 存在本地的文件下发到机床
|
# 存在本地的文件下发到机床
|
||||||
_logger.info("=====================11================")
|
|
||||||
ftp.upload_file(remotepath=file_path_remote, localpath=file_path_local)
|
ftp.upload_file(remotepath=file_path_remote, localpath=file_path_local)
|
||||||
_logger.info("=====================22================")
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
_logger.info("=====================================", e)
|
_logger.info("=====================================", e)
|
||||||
raise UserError('NC下发执行超时, 请检查下发状态')
|
raise UserError('NC下发执行超时, 请检查下发状态')
|
||||||
@@ -109,41 +84,6 @@ class FtpButton(models.Model):
|
|||||||
# 'type': 'ir.actions.act_window',
|
# 'type': 'ir.actions.act_window',
|
||||||
# 'target': 'new'
|
# 'target': 'new'
|
||||||
# }
|
# }
|
||||||
# def up_all(self):
|
|
||||||
# """
|
|
||||||
# 此函数用于将NC代码全部下发到机床
|
|
||||||
# :return:
|
|
||||||
# """
|
|
||||||
# # host="192.168.2.158", port=8080, username="MITSUBISHI", password="CNC"
|
|
||||||
# host = self.workorder_id.workcenter_id.machine_tool_id.ftp_host
|
|
||||||
# port = self.workorder_id.workcenter_id.machine_tool_id.ftp_port
|
|
||||||
# username = self.workorder_id.workcenter_id.machine_tool_id.ftp_num
|
|
||||||
# pwd = self.workorder_id.workcenter_id.machine_tool_id.ftp_pwd
|
|
||||||
#
|
|
||||||
# ftp = ftp_operate.FtpController(host, port, username, pwd)
|
|
||||||
# # ftp.delAllfile('C://Users//马广威//Desktop//ftp')
|
|
||||||
# for item in self.cnc_ids:
|
|
||||||
# a = item.cnc_id
|
|
||||||
# print(a.display_name)
|
|
||||||
# # _logger.info(a.public)
|
|
||||||
# # _logger.info(a.display_name)
|
|
||||||
# # datas = base64.standard_b64decode(a.datas)
|
|
||||||
# #
|
|
||||||
# # # file_path = '{}\{}\{}'.format(a._filestore(), a.store_fname.split('/'[0]), a.display_name)
|
|
||||||
# # # file_path_local = '{}/{}'.format('/nc2machine', a.display_name)
|
|
||||||
# # file_path_local = '{}/{}'.format('D:\\jikimo', a.display_name)
|
|
||||||
# # # file_path_remote = '{}\{}'.format('//M80(192,168,2,142)//DS', a.display_name)
|
|
||||||
# #
|
|
||||||
# # with open(file_path_local, mode='wb+') as file:
|
|
||||||
# # file.write(datas)
|
|
||||||
# # 存在本地的文件下发到机床
|
|
||||||
# # _logger.info("=====================11================")
|
|
||||||
# # ftp.upload_file(remotepath=file_path_remote, localpath=file_path_local)
|
|
||||||
# # _logger.info("=====================22================")
|
|
||||||
# # except Exception as e:
|
|
||||||
# # _logger.info("=====================================", e)
|
|
||||||
# # raise UserError('NC下发执行超时, 请检查下发状态')
|
|
||||||
|
|
||||||
|
|
||||||
def check_compensation_before_up(self):
|
def check_compensation_before_up(self):
|
||||||
"""
|
"""
|
||||||
@@ -153,9 +93,9 @@ class FtpButton(models.Model):
|
|||||||
try:
|
try:
|
||||||
temp_dict = {}
|
temp_dict = {}
|
||||||
temp_dict[
|
temp_dict[
|
||||||
'ns=1;s=Project_Default.Group1.Mitsubishi_NC.hongbianliang550'] = self.workorder_id.compensation_value_x
|
'ns=1;s=Project_Default.Group1.Mitsubishi_NC2.hongbianliang550'] = self.workorder_id.compensation_value_x
|
||||||
temp_dict[
|
temp_dict[
|
||||||
'ns=1;s=Project_Default.Group1.Mitsubishi_NC.hongbianliang551'] = self.workorder_id.compensation_value_y
|
'ns=1;s=Project_Default.Group1.Mitsubishi_NC2.hongbianliang551'] = self.workorder_id.compensation_value_y
|
||||||
temp = py2opcua.Py2opcua()
|
temp = py2opcua.Py2opcua()
|
||||||
# temp.connect()
|
# temp.connect()
|
||||||
temp.write(temp_dict)
|
temp.write(temp_dict)
|
||||||
@@ -171,21 +111,6 @@ class Machine_ftp(models.Model):
|
|||||||
"""
|
"""
|
||||||
_inherit = 'sf.machine_tool'
|
_inherit = 'sf.machine_tool'
|
||||||
|
|
||||||
workorder_ids = fields.One2many('mrp.workorder', 'machine_tool_id', string='工单')
|
|
||||||
|
|
||||||
# 机床配置项目
|
|
||||||
# ftp相关
|
|
||||||
ftp_num = fields.Char('ftp账号')
|
|
||||||
ftp_pwd = fields.Char('ftp密码')
|
|
||||||
ftp_host = fields.Char('ftp地址')
|
|
||||||
ftp_port = fields.Integer('ftp端口')
|
|
||||||
# 补偿值写入相关
|
|
||||||
x_compensation_node = fields.Char('x补偿值节点')
|
|
||||||
y_compensation_node = fields.Char('y补偿值节点')
|
|
||||||
# 数采配置相关
|
|
||||||
machine_ip = fields.Char('机床IP')
|
|
||||||
|
|
||||||
# 机床采集项目
|
|
||||||
timestamp = fields.Datetime('时间戳', readonly=True)
|
timestamp = fields.Datetime('时间戳', readonly=True)
|
||||||
signed = fields.Integer('刷新间隔', readonly=True)
|
signed = fields.Integer('刷新间隔', readonly=True)
|
||||||
status = fields.Boolean('在线状态', readonly=True)
|
status = fields.Boolean('在线状态', readonly=True)
|
||||||
@@ -235,63 +160,25 @@ class WorkCenterBarcode(models.Model):
|
|||||||
compensation_value_x = fields.Float(string='X轴补偿值')
|
compensation_value_x = fields.Float(string='X轴补偿值')
|
||||||
compensation_value_y = fields.Float(string='Y轴补偿值')
|
compensation_value_y = fields.Float(string='Y轴补偿值')
|
||||||
button_compensation_state = fields.Boolean(string='是否已经补偿')
|
button_compensation_state = fields.Boolean(string='是否已经补偿')
|
||||||
machine_tool_id = fields.Many2one('sf.machine_tool', string='机床')
|
|
||||||
|
|
||||||
def compensation(self):
|
def compensation(self):
|
||||||
|
"""
|
||||||
hongbianliang550 = self.workcenter_id.machine_tool_id.x_compensation_node
|
将节点与其值放入字典,字典作为参数传入
|
||||||
hongbianliang551 = self.workcenter_id.machine_tool_id.y_compensation_node
|
:return:
|
||||||
|
"""
|
||||||
try:
|
try:
|
||||||
temp_dict = {}
|
temp_dict = {}
|
||||||
temp_dict[hongbianliang550] = self.compensation_value_x
|
temp_dict['ns=1;s=Project_Default.Group1.Mitsubishi_NC2.hongbianliang550'] = self.compensation_value_x
|
||||||
temp_dict[hongbianliang551] = self.compensation_value_y
|
temp_dict['ns=1;s=Project_Default.Group1.Mitsubishi_NC2.hongbianliang551'] = self.compensation_value_y
|
||||||
print("=================================")
|
temp = py2opcua.Py2opcua()
|
||||||
print(temp_dict)
|
# temp.connect()
|
||||||
# temp = py2opcua.Py2opcua()
|
temp.write(temp_dict)
|
||||||
# # temp.connect()
|
self.button_compensation_state = True
|
||||||
# temp.write(temp_dict)
|
|
||||||
# self.button_compensation_state = True
|
|
||||||
# temp.disconnect()
|
# temp.disconnect()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
_logger.info("=====================================", e)
|
_logger.info("=====================================", e)
|
||||||
raise UserError('补偿值获取失败,或机床未连接,请检查')
|
raise UserError('补偿值获取失败,或机床未连接,请检查')
|
||||||
|
|
||||||
def up_all(self):
|
|
||||||
"""
|
|
||||||
此函数用于将NC代码全部下发到机床
|
|
||||||
:return:
|
|
||||||
"""
|
|
||||||
# host="192.168.2.158", port=8080, username="MITSUBISHI", password="CNC"
|
|
||||||
host = self.workcenter_id.machine_tool_id.ftp_host
|
|
||||||
port = self.workcenter_id.machine_tool_id.ftp_port
|
|
||||||
username = self.workcenter_id.machine_tool_id.ftp_num
|
|
||||||
pwd = self.workcenter_id.machine_tool_id.ftp_pwd
|
|
||||||
print(host, port, username, pwd)
|
|
||||||
# ftp = ftp_operate.FtpController(host, port, username, pwd)
|
|
||||||
# ftp.delAllfile('C://Users//马广威//Desktop//ftp')
|
|
||||||
for item in self.cnc_ids:
|
|
||||||
a = item.cnc_id
|
|
||||||
print(a.display_name)
|
|
||||||
_logger.info(a.public)
|
|
||||||
_logger.info(a.display_name)
|
|
||||||
datas = base64.standard_b64decode(a.datas)
|
|
||||||
|
|
||||||
# file_path = '{}\{}\{}'.format(a._filestore(), a.store_fname.split('/'[0]), a.display_name)
|
|
||||||
# file_path_local = '{}/{}'.format('/nc2machine', a.display_name)
|
|
||||||
file_path_local = '{}/{}'.format('D:\\jikimo', a.display_name)
|
|
||||||
# file_path_remote = '{}\{}'.format('//M80(192,168,2,142)//DS', a.display_name)
|
|
||||||
|
|
||||||
with open(file_path_local, mode='wb+') as file:
|
|
||||||
file.write(datas)
|
|
||||||
# 存在本地的文件下发到机床
|
|
||||||
# _logger.info("=====================11================")
|
|
||||||
# ftp.upload_file(remotepath=file_path_remote, localpath=file_path_local)
|
|
||||||
# _logger.info("=====================22================")
|
|
||||||
# except Exception as e:
|
|
||||||
# _logger.info("=====================================", e)
|
|
||||||
# raise UserError('NC下发执行超时, 请检查下发状态')
|
|
||||||
|
|
||||||
def get__state(self):
|
def get__state(self):
|
||||||
pay_time = str(datetime.now())
|
pay_time = str(datetime.now())
|
||||||
json = {
|
json = {
|
||||||
|
|||||||
@@ -45,9 +45,6 @@ class FtpController:
|
|||||||
self.port = port
|
self.port = port
|
||||||
self.username = username
|
self.username = username
|
||||||
self.password = password
|
self.password = password
|
||||||
# 测试
|
|
||||||
print("==============================================")
|
|
||||||
print(self.username, self.port, self.host, self.password)
|
|
||||||
ftp = FTP_P()
|
ftp = FTP_P()
|
||||||
# self.ftp.set_debuglevel(2) #打开调试级别2,显示详细信息
|
# self.ftp.set_debuglevel(2) #打开调试级别2,显示详细信息
|
||||||
ftp.set_pasv(0) # 0主动模式 1 #被动模式
|
ftp.set_pasv(0) # 0主动模式 1 #被动模式
|
||||||
@@ -71,7 +68,7 @@ class FtpController:
|
|||||||
:param localpath:
|
:param localpath:
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
bufsize = 8192
|
bufsize = 1024
|
||||||
# fp = open(localpath, 'rb')
|
# fp = open(localpath, 'rb')
|
||||||
# self.ftp.storbinary('STOR ' + remotepath, fp, bufsize)
|
# self.ftp.storbinary('STOR ' + remotepath, fp, bufsize)
|
||||||
# fp.close()
|
# fp.close()
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<record id="sf_install_the_tray_workorder_form_view__scan_barcode" model="ir.ui.view">
|
<record id="sf_install_the_tray_workorder_form_view__scan_barcode" model="ir.ui.view">
|
||||||
<field name="name">sf.install.the.tray.workorder.form.scan.barcode</field>
|
<field name="name">sf.install.the.tray.workorder.form.scan.barcode</field>
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
<xpath expr="//page//field[@name='tray_code']" position="before">
|
<xpath expr="//page//field[@name='tray_code']" position="before">
|
||||||
<!-- invisible="1" -->
|
<!-- invisible="1" -->
|
||||||
<field name="_barcode_scanned" widget="barcode_handler"/>
|
<field name="_barcode_scanned" widget="barcode_handler"/>
|
||||||
|
<field name="tray_code" widget="code"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|
||||||
</field>
|
</field>
|
||||||
|
|||||||
@@ -11,26 +11,12 @@
|
|||||||
<field name="compensation_value_y"/>
|
<field name="compensation_value_y"/>
|
||||||
</group>
|
</group>
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<field name="button_compensation_state"/>
|
||||||
<field name="button_compensation_state"/>
|
<button string="一键补偿" name="compensation" type="object" confirm="是否确认下发补偿" class="btn-primary"/>
|
||||||
<button string="一键补偿" name="compensation" type="object" confirm="是否确认下发补偿"
|
|
||||||
class="btn-primary" attrs='{"invisible": ["|",
|
|
||||||
("state","!=","progress"),("user_permissions","=",False)]}'/>
|
|
||||||
<button string="一键下发" name="up_all" type="object" style="text-align: right;" confirm="是否确认一键下发"
|
|
||||||
class="btn-primary" attrs='{"invisible": ["|",
|
|
||||||
("state","!=","progress"),("user_permissions","=",False)]}'/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- <button string="显示补偿" name="compensation1" type="object" confirm="是否确认下发补偿" class="btn-primary"/>-->
|
<!-- <button string="显示补偿" name="compensation1" type="object" confirm="是否确认下发补偿" class="btn-primary"/>-->
|
||||||
<!-- <button string="修改状态" name="get__state" type="object" class="btn-primary"/>-->
|
<!-- <button string="修改状态" name="get__state" type="object" class="btn-primary"/>-->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- <div>-->
|
|
||||||
<!-- <button string="一键下发" name="up_all" type="object" confirm="是否确认一键下发"-->
|
|
||||||
<!-- class="btn-primary" attrs='{"invisible": ["|",-->
|
|
||||||
<!-- ("state","!=","progress"),("user_permissions","=",False)]}'/>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|
||||||
</field>
|
</field>
|
||||||
|
|||||||
@@ -10,17 +10,8 @@
|
|||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//field[@name='remark']" position="after">
|
<xpath expr="//field[@name='remark']" position="after">
|
||||||
<!-- <button string="测试按钮" name="pri" type="object" class="btn-primary"/>-->
|
<!-- <button string="测试按钮" name="pri" type="object" class="btn-primary"/>-->
|
||||||
<!-- <field name="workorder_id" invisible="1"/>-->
|
|
||||||
<field name="button_state"/>
|
<field name="button_state"/>
|
||||||
<field name="user_permissions" invisible="1"/>
|
<button string="下发按钮" name="up" type="object" class="btn-primary" confirm="是否确认下发此程序"/>
|
||||||
<field name="state" invisible="1"/>
|
|
||||||
<button string="下发" name="up" type="object" class="btn-primary" confirm="是否确认下发此程序"
|
|
||||||
attrs='{"invisible": ["|",("state","!=","progress"),
|
|
||||||
("user_permissions","!=",True)]}'/>
|
|
||||||
<!-- <button string="下发" name="up" type="object" class="btn-primary" confirm="是否确认下发此程序"/>-->
|
|
||||||
<!-- <button string="下发" name="up" type="object" class="btn-primary" confirm="是否确认下发此程序"-->
|
|
||||||
<!-- />-->
|
|
||||||
|
|
||||||
|
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
|
|||||||
@@ -9,10 +9,7 @@
|
|||||||
<!-- <xpath expr="//field[@name='knife_type']" position="before">-->
|
<!-- <xpath expr="//field[@name='knife_type']" position="before">-->
|
||||||
<xpath expr="//form//notebook//page[1]" position="inside">
|
<xpath expr="//form//notebook//page[1]" position="inside">
|
||||||
<!-- <xpath expr="//page[@name='other']" position="before">-->
|
<!-- <xpath expr="//page[@name='other']" position="before">-->
|
||||||
<notebook>
|
<group string="监控">
|
||||||
<page string="机床监控">
|
|
||||||
<!-- <group string="监控">-->
|
|
||||||
<group>
|
|
||||||
<field name="timestamp"/>
|
<field name="timestamp"/>
|
||||||
<field name="signed"/>
|
<field name="signed"/>
|
||||||
<field name="status"/>
|
<field name="status"/>
|
||||||
@@ -98,29 +95,6 @@
|
|||||||
<!-- <field name="tool_num_process_time24" class="o_form_label"/>-->
|
<!-- <field name="tool_num_process_time24" class="o_form_label"/>-->
|
||||||
<!-- </div>-->
|
<!-- </div>-->
|
||||||
</group>
|
</group>
|
||||||
</page>
|
|
||||||
<page string="机床配置">
|
|
||||||
<!-- <group string="机床配置">-->
|
|
||||||
<group>
|
|
||||||
<group string="ftp相关">
|
|
||||||
<field name="ftp_num"/>
|
|
||||||
<field name="ftp_pwd"/>
|
|
||||||
<field name="ftp_host"/>
|
|
||||||
<field name="ftp_port"/>
|
|
||||||
</group>
|
|
||||||
<group string="补偿值相关">
|
|
||||||
<field name="x_compensation_node"/>
|
|
||||||
<field name="y_compensation_node"/>
|
|
||||||
</group>
|
|
||||||
<group string="数采相关">
|
|
||||||
<field name="machine_ip"/>
|
|
||||||
</group>
|
|
||||||
|
|
||||||
</group>
|
|
||||||
</page>
|
|
||||||
</notebook>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
|
|||||||
@@ -13,6 +13,24 @@ class ResWorkcenter(models.Model):
|
|||||||
'maintenance.equipment', 'workcenter_id', string="Maintenance Equipment",
|
'maintenance.equipment', 'workcenter_id', string="Maintenance Equipment",
|
||||||
check_company=True)
|
check_company=True)
|
||||||
|
|
||||||
|
@api.onchange('machine_tool_id')
|
||||||
|
def update_machine_tool_is_binding(self):
|
||||||
|
machine_tool = self.env["sf.machine_tool"].search([('is_binding', '=', True)])
|
||||||
|
if machine_tool:
|
||||||
|
for item in machine_tool:
|
||||||
|
workcenter_machine_tool = self.env["mrp.workcenter"].search([('machine_tool_id', '=', item.id)])
|
||||||
|
if workcenter_machine_tool:
|
||||||
|
if self.machine_tool_id.id:
|
||||||
|
if workcenter_machine_tool.id != self.machine_tool_id.id:
|
||||||
|
self.machine_tool_id.is_binding = True
|
||||||
|
else:
|
||||||
|
self.machine_tool_id.is_binding = True
|
||||||
|
else:
|
||||||
|
self.machine_tool_id.is_binding = True
|
||||||
|
item.is_binding = False
|
||||||
|
else:
|
||||||
|
self.machine_tool_id.is_binding = True
|
||||||
|
|
||||||
def action_work_order(self):
|
def action_work_order(self):
|
||||||
if not self.env.context.get('desktop_list_view', False):
|
if not self.env.context.get('desktop_list_view', False):
|
||||||
action = self.env["ir.actions.actions"]._for_xml_id("sf_manufacturing.mrp_workorder_action_tablet")
|
action = self.env["ir.actions.actions"]._for_xml_id("sf_manufacturing.mrp_workorder_action_tablet")
|
||||||
|
|||||||
@@ -24,19 +24,19 @@
|
|||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<!-- <record id="mrp_workcenter_view_kanban_inherit_workorder" model="ir.ui.view">-->
|
<record id="mrp_workcenter_view_kanban_inherit_workorder" model="ir.ui.view">
|
||||||
<!-- <field name="name">mrp.workcenter.view.kanban.inherit.mrp.workorder</field>-->
|
<field name="name">mrp.workcenter.view.kanban.inherit.mrp.workorder</field>
|
||||||
<!-- <field name="model">mrp.workcenter</field>-->
|
<field name="model">mrp.workcenter</field>
|
||||||
<!-- <field name="inherit_id" ref="mrp.mrp_workcenter_kanban"/>-->
|
<field name="inherit_id" ref="mrp.mrp_workcenter_kanban"/>
|
||||||
<!-- <field name="arch" type="xml">-->
|
<field name="arch" type="xml">
|
||||||
<!-- <!– Desktop view –>-->
|
<!-- Desktop view -->
|
||||||
<!-- <xpath expr="//div[@name='o_wo']" position="inside">-->
|
<xpath expr="//div[@name='o_wo']" position="inside">
|
||||||
<!-- <button class="btn btn-secondary fa fa-desktop" name="action_work_order" type="object"-->
|
<button class="btn btn-secondary fa fa-desktop" name="action_work_order" type="object"
|
||||||
<!-- context="{'search_default_ready': 1, 'search_default_progress': 1, 'search_default_pending': 1, 'desktop_list_view': 1, 'search_default_workcenter_id': active_id}"-->
|
context="{'search_default_ready': 1, 'search_default_progress': 1, 'search_default_pending': 1, 'desktop_list_view': 1, 'search_default_workcenter_id': active_id}"
|
||||||
<!-- title="Work orders" aria-label="Work orders"/>-->
|
title="Work orders" aria-label="Work orders"/>
|
||||||
<!-- </xpath>-->
|
</xpath>
|
||||||
<!-- </field>-->
|
</field>
|
||||||
<!-- </record>-->
|
</record>
|
||||||
|
|
||||||
<!-- override to change the no content image -->
|
<!-- override to change the no content image -->
|
||||||
<record id="mrp.action_work_orders" model="ir.actions.act_window">
|
<record id="mrp.action_work_orders" model="ir.actions.act_window">
|
||||||
@@ -56,10 +56,10 @@
|
|||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
<record id="mrp_workcenter_kanban_action1" model="ir.actions.act_window">
|
<record id="mrp_workcenter_kanban_action1" model="ir.actions.act_window">
|
||||||
<field name="name">工作中心看板</field>
|
<field name="name">Work Centers Overview</field>
|
||||||
<field name="type">ir.actions.act_window</field>
|
<field name="type">ir.actions.act_window</field>
|
||||||
<field name="res_model">mrp.workcenter</field>
|
<field name="res_model">mrp.workcenter</field>
|
||||||
<field name="view_mode">kanban,form,tree</field>
|
<field name="view_mode">kanban,form</field>
|
||||||
<field name="view_id" ref="mrp.mrp_workcenter_kanban"/>
|
<field name="view_id" ref="mrp.mrp_workcenter_kanban"/>
|
||||||
<field name="search_view_id" ref="mrp.view_mrp_workcenter_search"/>
|
<field name="search_view_id" ref="mrp.view_mrp_workcenter_search"/>
|
||||||
<field name="domain">[('users_ids','in',uid)]</field>
|
<field name="domain">[('users_ids','in',uid)]</field>
|
||||||
@@ -107,7 +107,7 @@
|
|||||||
</xpath>
|
</xpath>
|
||||||
|
|
||||||
<xpath expr="//field[@name='alternative_workcenter_ids']" position="after">
|
<xpath expr="//field[@name='alternative_workcenter_ids']" position="after">
|
||||||
<field name="machine_tool_id"/>
|
<field name="machine_tool_id" domain="[('is_binding','=',False)]"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<field name="name" position="after">
|
<field name="name" position="after">
|
||||||
<field name="processing_panel"/>
|
<field name="processing_panel"/>
|
||||||
</field>
|
</field>
|
||||||
<field name="state" position="after">
|
<field name="state" position="after">
|
||||||
<field name="work_state"/>
|
<field name="work_state"/>
|
||||||
</field>
|
</field>
|
||||||
<xpath expr="//button[@name='button_start']" position="attributes">
|
<xpath expr="//button[@name='button_start']" position="attributes">
|
||||||
@@ -91,24 +91,12 @@
|
|||||||
<field name="model">mrp.workorder</field>
|
<field name="model">mrp.workorder</field>
|
||||||
<field name="inherit_id" ref="mrp.mrp_production_workorder_form_view_inherit"/>
|
<field name="inherit_id" ref="mrp.mrp_production_workorder_form_view_inherit"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<sheet position="before">
|
<xpath expr="field[@name='is_user_working']" position="before">
|
||||||
<field name='user_permissions' invisible="1"/>
|
<field name='user_permissions' invisible="1"/>
|
||||||
<button name="button_start" type="object" string="开始" class="btn-success"
|
</xpath>
|
||||||
attrs="{'invisible': ['|', '|', '|','|', ('production_state','in', ('draft', 'done',
|
|
||||||
'cancel')), ('working_state', '=', 'blocked'), ('state', 'in', ('done', 'cancel')),
|
|
||||||
('is_user_working', '!=', False),('user_permissions','=',False)]}"/>
|
|
||||||
<button name="button_pending" type="object" string="暂停" class="btn-warning"
|
|
||||||
attrs="{'invisible': ['|', '|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('is_user_working', '=', False)]}"/>
|
|
||||||
<button name="button_finish" type="object" string="完成" class="btn-success"
|
|
||||||
attrs="{'invisible': ['|', '|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('is_user_working', '=', False)]}"/>
|
|
||||||
<button name="%(mrp.act_mrp_block_workcenter_wo)d" type="action" string="停工" context="{'default_workcenter_id': workcenter_id}" class="btn-danger"
|
|
||||||
attrs="{'invisible': ['|', '|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'),('user_permissions','=',False)]}"/>
|
|
||||||
<button name="button_unblock" type="object" string="Unblock" context="{'default_workcenter_id': workcenter_id}" class="btn-danger"
|
|
||||||
attrs="{'invisible': ['|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '!=', 'blocked')]}"/>
|
|
||||||
</sheet>
|
|
||||||
|
|
||||||
|
|
||||||
<xpath expr="//page[1]" position="before">
|
<xpath expr="//page[last()]" position="after">
|
||||||
<page string="获取CNC加工程序" attrs='{"invisible": [("routing_type","!=","获取CNC加工程序")]}'>
|
<page string="获取CNC加工程序" attrs='{"invisible": [("routing_type","!=","获取CNC加工程序")]}'>
|
||||||
<group>
|
<group>
|
||||||
<field name="programming_no" readonly="1"
|
<field name="programming_no" readonly="1"
|
||||||
@@ -127,8 +115,7 @@
|
|||||||
</page>
|
</page>
|
||||||
|
|
||||||
</xpath>
|
</xpath>
|
||||||
<!-- <page string="Components" name="components">-->
|
<xpath expr="//page[last()]" position="after">
|
||||||
<xpath expr="//page[1]" position="before">
|
|
||||||
<page string="装夹托盘" attrs='{"invisible": [("routing_type","!=","装夹")]}'>
|
<page string="装夹托盘" attrs='{"invisible": [("routing_type","!=","装夹")]}'>
|
||||||
<group>
|
<group>
|
||||||
<field name="routing_type" invisible="1"/>
|
<field name="routing_type" invisible="1"/>
|
||||||
@@ -145,7 +132,7 @@
|
|||||||
</page>
|
</page>
|
||||||
|
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//page[1]" position="before">
|
<xpath expr="//page[last()]" position="after">
|
||||||
<page string="三元前置检测定位参数" attrs='{"invisible": [("routing_type","!=","前置三元定位检测")]}'>
|
<page string="三元前置检测定位参数" attrs='{"invisible": [("routing_type","!=","前置三元定位检测")]}'>
|
||||||
<group>
|
<group>
|
||||||
<group>
|
<group>
|
||||||
@@ -261,7 +248,7 @@
|
|||||||
</page>
|
</page>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|
||||||
<xpath expr="//page[1]" position="before">
|
<xpath expr="//page[last()]" position="after">
|
||||||
<page string="CNC程序" attrs='{"invisible": [("routing_type","!=","CNC加工")]}'>
|
<page string="CNC程序" attrs='{"invisible": [("routing_type","!=","CNC加工")]}'>
|
||||||
<group>
|
<group>
|
||||||
<field name="cnc_ids" widget="one2many" string="工作程序">
|
<field name="cnc_ids" widget="one2many" string="工作程序">
|
||||||
@@ -285,7 +272,7 @@
|
|||||||
</group>
|
</group>
|
||||||
</page>
|
</page>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//page[1]" position="before">
|
<xpath expr="//page[last()]" position="after">
|
||||||
<page string="后置三元检测" attrs='{"invisible": [("routing_type","!=","后置三元质量检测")]}'>
|
<page string="后置三元检测" attrs='{"invisible": [("routing_type","!=","后置三元质量检测")]}'>
|
||||||
<group>
|
<group>
|
||||||
<field name="test_results" widget="selection"/>
|
<field name="test_results" widget="selection"/>
|
||||||
@@ -297,7 +284,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</page>
|
</page>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//page[1]" position="before">
|
<xpath expr="//page[last()]" position="after">
|
||||||
<page string="解除装夹" attrs='{"invisible": [("routing_type","!=","解除装夹")]}'>
|
<page string="解除装夹" attrs='{"invisible": [("routing_type","!=","解除装夹")]}'>
|
||||||
|
|
||||||
<div class="col-12 col-lg-6 o_setting_box">
|
<div class="col-12 col-lg-6 o_setting_box">
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ class Sf_Mrs_Connect(http.Controller):
|
|||||||
# 查询状态为进行中且类型为获取CNC加工程序的工单
|
# 查询状态为进行中且类型为获取CNC加工程序的工单
|
||||||
cnc_workorder = request.env['mrp.workorder'].with_user(
|
cnc_workorder = request.env['mrp.workorder'].with_user(
|
||||||
request.env.ref("base.user_admin")).search([('production_id.name', '=', ret['production_order_no']),
|
request.env.ref("base.user_admin")).search([('production_id.name', '=', ret['production_order_no']),
|
||||||
('routing_type', '=', '获取CNC加工程序')])
|
('routing_type', '=', '获取CNC加工程序'),
|
||||||
|
('state', '=', 'progress')])
|
||||||
if cnc_workorder:
|
if cnc_workorder:
|
||||||
# 拉取所有加工面的程序文件
|
# 拉取所有加工面的程序文件
|
||||||
# i = 1
|
# i = 1
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ class sfMaterialModel(models.Model):
|
|||||||
brand.active = item['active'],
|
brand.active = item['active'],
|
||||||
brand.mf_materia_post = item['mf_materia_post'],
|
brand.mf_materia_post = item['mf_materia_post'],
|
||||||
brand.materials_id = self.env['sf.production.materials'].search(
|
brand.materials_id = self.env['sf.production.materials'].search(
|
||||||
[("materials_no", '=', item['materials_id.materials_no'])]).id,
|
[("materials_no", '=', item['materials_id.materials_no'])]).id,
|
||||||
brand.need_h = item['need_h'],
|
brand.need_h = item['need_h'],
|
||||||
brand.density = item['density']
|
brand.density = item['density']
|
||||||
else:
|
else:
|
||||||
@@ -158,9 +158,9 @@ class sfMaterialModel(models.Model):
|
|||||||
"need_h": item['need_h'],
|
"need_h": item['need_h'],
|
||||||
"mf_materia_post": item['mf_materia_post'],
|
"mf_materia_post": item['mf_materia_post'],
|
||||||
"density": item['density'],
|
"density": item['density'],
|
||||||
# "tag_ids": item['tag_ids']
|
# "tag_ids": item['tag_ids']
|
||||||
|
|
||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
raise ValidationError("认证未通过")
|
raise ValidationError("认证未通过")
|
||||||
|
|
||||||
@@ -392,7 +392,7 @@ class MachineControlSystem(models.Model):
|
|||||||
brand.id = item['id'],
|
brand.id = item['id'],
|
||||||
brand.name = item['name'],
|
brand.name = item['name'],
|
||||||
brand.code = item['code'],
|
brand.code = item['code'],
|
||||||
brand.brand_id=self.env['sf.machine.brand'].search([('code', '=', item['brand_id'])]).id,
|
brand.brand_id = self.env['sf.machine.brand'].search([('code', '=', item['brand_id'])]).id,
|
||||||
brand.active = item['active']
|
brand.active = item['active']
|
||||||
else:
|
else:
|
||||||
self.env['sf.machine.control_system'].create({
|
self.env['sf.machine.control_system'].create({
|
||||||
@@ -500,12 +500,9 @@ class MachineBrand(models.Model):
|
|||||||
"id": item['id'],
|
"id": item['id'],
|
||||||
"name": item['name'],
|
"name": item['name'],
|
||||||
"code": item['code'],
|
"code": item['code'],
|
||||||
# "image_brand": item['image_brand'],
|
"image_brand": '' if not item['image_brand'] else base64.b64encode(item.image_brand),
|
||||||
"active": item['active'],
|
|
||||||
"tag_ids": self.env['sf.machine.brand.tags'].search(
|
"tag_ids": self.env['sf.machine.brand.tags'].search(
|
||||||
[("name", 'in', item['tag_ids'])]).ids
|
[("name", 'in', item['tag_ids'])]).ids
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
raise ValidationError("认证未通过")
|
raise ValidationError("认证未通过")
|
||||||
@@ -517,8 +514,6 @@ class MachineTool(models.Model):
|
|||||||
url = '/api/machine_tool/list'
|
url = '/api/machine_tool/list'
|
||||||
crea_url = '/api/machine_tool/create'
|
crea_url = '/api/machine_tool/create'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# 定时同步机床
|
# 定时同步机床
|
||||||
def sync_machine_tool(self):
|
def sync_machine_tool(self):
|
||||||
sf_sync_config = self.env['res.config.settings'].get_values()
|
sf_sync_config = self.env['res.config.settings'].get_values()
|
||||||
@@ -657,7 +652,8 @@ class MachineToolType(models.Model):
|
|||||||
brand.number_of_knife_library = item['number_of_knife_library'],
|
brand.number_of_knife_library = item['number_of_knife_library'],
|
||||||
brand.rotate_speed = item['rotate_speed'],
|
brand.rotate_speed = item['rotate_speed'],
|
||||||
brand.number_of_axles = item['number_of_axles'],
|
brand.number_of_axles = item['number_of_axles'],
|
||||||
brand.control_system_id = self.env['sf.machine.control_system'].search([('code', '=', item['control_system_id'])]).id,
|
brand.control_system_id = self.env['sf.machine.control_system'].search(
|
||||||
|
[('code', '=', item['control_system_id'])]).id,
|
||||||
|
|
||||||
brand.x_axis = item['x_axis'],
|
brand.x_axis = item['x_axis'],
|
||||||
brand.y_axis = item['y_axis'],
|
brand.y_axis = item['y_axis'],
|
||||||
@@ -666,8 +662,9 @@ class MachineToolType(models.Model):
|
|||||||
brand.c_axis = item['c_axis'],
|
brand.c_axis = item['c_axis'],
|
||||||
brand.active = item['active'],
|
brand.active = item['active'],
|
||||||
brand.remark = item['remark'],
|
brand.remark = item['remark'],
|
||||||
brand.brand_id=self.env['sf.machine.brand'].search([('code', '=', item['brand_id'])]).id,
|
brand.brand_id = self.env['sf.machine.brand'].search([('code', '=', item['brand_id'])]).id,
|
||||||
brand.machine_tool_id = self.env['sf.machine_tool'].search([('code', '=', item['machine_tool_id'])]).id
|
brand.machine_tool_id = self.env['sf.machine_tool'].search(
|
||||||
|
[('code', '=', item['machine_tool_id'])]).id
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.env['sf.machine_tool.type'].create({
|
self.env['sf.machine_tool.type'].create({
|
||||||
@@ -677,7 +674,8 @@ class MachineToolType(models.Model):
|
|||||||
|
|
||||||
"number_of_knife_library": item['number_of_knife_library'],
|
"number_of_knife_library": item['number_of_knife_library'],
|
||||||
"rotate_speed": item['rotate_speed'],
|
"rotate_speed": item['rotate_speed'],
|
||||||
'machine_tool_id' : self.env['sf.machine_tool'].search([('code', '=', item['machine_tool_id'])]).id,
|
'machine_tool_id': self.env['sf.machine_tool'].search(
|
||||||
|
[('code', '=', item['machine_tool_id'])]).id,
|
||||||
"number_of_axles": item['number_of_axles'],
|
"number_of_axles": item['number_of_axles'],
|
||||||
"x_axis": item['x_axis'],
|
"x_axis": item['x_axis'],
|
||||||
"y_axis": item['y_axis'],
|
"y_axis": item['y_axis'],
|
||||||
@@ -686,7 +684,8 @@ class MachineToolType(models.Model):
|
|||||||
"c_axis": item['c_axis'],
|
"c_axis": item['c_axis'],
|
||||||
"remark": item['remark'],
|
"remark": item['remark'],
|
||||||
"precision": item['precision'],
|
"precision": item['precision'],
|
||||||
'control_system_id' : self.env['sf.machine.control_system'].search([('code', '=', item['control_system_id'])]).id,
|
'control_system_id': self.env['sf.machine.control_system'].search(
|
||||||
|
[('code', '=', item['control_system_id'])]).id,
|
||||||
"active": item['active'],
|
"active": item['active'],
|
||||||
'brand_id': self.env['sf.machine.brand'].search([('code', '=', item['brand_id'])]).id,
|
'brand_id': self.env['sf.machine.brand'].search([('code', '=', item['brand_id'])]).id,
|
||||||
|
|
||||||
@@ -716,7 +715,8 @@ class MachineToolType(models.Model):
|
|||||||
"code": item['code'],
|
"code": item['code'],
|
||||||
"number_of_knife_library": item['number_of_knife_library'],
|
"number_of_knife_library": item['number_of_knife_library'],
|
||||||
"rotate_speed": item['rotate_speed'],
|
"rotate_speed": item['rotate_speed'],
|
||||||
'machine_tool_id' : self.env['sf.machine_tool'].search([('code', '=', item['machine_tool_id'])]).id,
|
'machine_tool_id': self.env['sf.machine_tool'].search(
|
||||||
|
[('code', '=', item['machine_tool_id'])]).id,
|
||||||
"number_of_axles": item['number_of_axles'],
|
"number_of_axles": item['number_of_axles'],
|
||||||
"x_axis": item['x_axis'],
|
"x_axis": item['x_axis'],
|
||||||
"y_axis": item['y_axis'],
|
"y_axis": item['y_axis'],
|
||||||
@@ -725,7 +725,8 @@ class MachineToolType(models.Model):
|
|||||||
"c_axis": item['c_axis'],
|
"c_axis": item['c_axis'],
|
||||||
"remark": item['remark'],
|
"remark": item['remark'],
|
||||||
"precision": item['precision'],
|
"precision": item['precision'],
|
||||||
'control_system_id' : self.env['sf.machine.control_system'].search([('code', '=', item['control_system_id'])]).id,
|
'control_system_id': self.env['sf.machine.control_system'].search(
|
||||||
|
[('code', '=', item['control_system_id'])]).id,
|
||||||
"active": item['active'],
|
"active": item['active'],
|
||||||
'brand_id': self.env['sf.machine.brand'].search([('code', '=', item['brand_id'])]).id,
|
'brand_id': self.env['sf.machine.brand'].search([('code', '=', item['brand_id'])]).id,
|
||||||
|
|
||||||
@@ -836,7 +837,8 @@ class CuttingToolType(models.Model):
|
|||||||
brand.tool_length = item['tool_length'],
|
brand.tool_length = item['tool_length'],
|
||||||
brand.blade_number = item['blade_number']
|
brand.blade_number = item['blade_number']
|
||||||
brand.brand_id = self.env['sf.machine.brand'].search([('code', '=', item['brand_id'])]).id,
|
brand.brand_id = self.env['sf.machine.brand'].search([('code', '=', item['brand_id'])]).id,
|
||||||
brand.category_id = self.env['sf.cutting_tool.category'].search([('code', '=', item['category_id'])]).id
|
brand.category_id = self.env['sf.cutting_tool.category'].search(
|
||||||
|
[('code', '=', item['category_id'])]).id
|
||||||
else:
|
else:
|
||||||
self.env['sf.cutting_tool.type'].create({
|
self.env['sf.cutting_tool.type'].create({
|
||||||
"id": item['id'],
|
"id": item['id'],
|
||||||
@@ -852,7 +854,8 @@ class CuttingToolType(models.Model):
|
|||||||
"tool_length": item['tool_length'],
|
"tool_length": item['tool_length'],
|
||||||
"blade_number": item['blade_number'],
|
"blade_number": item['blade_number'],
|
||||||
'brand_id': self.env['sf.machine.brand'].search([('code', '=', item['brand_id'])]).id,
|
'brand_id': self.env['sf.machine.brand'].search([('code', '=', item['brand_id'])]).id,
|
||||||
"category_id": self.env['sf.cutting_tool.category'].search([('code', '=', item['category_id'])]).id,
|
"category_id": self.env['sf.cutting_tool.category'].search(
|
||||||
|
[('code', '=', item['category_id'])]).id,
|
||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
raise ValidationError("认证未通过")
|
raise ValidationError("认证未通过")
|
||||||
@@ -887,13 +890,13 @@ class CuttingToolType(models.Model):
|
|||||||
"tool_length": item['tool_length'],
|
"tool_length": item['tool_length'],
|
||||||
"blade_number": item['blade_number'],
|
"blade_number": item['blade_number'],
|
||||||
'brand_id': self.env['sf.machine.brand'].search([('code', '=', item['brand_id'])]).id,
|
'brand_id': self.env['sf.machine.brand'].search([('code', '=', item['brand_id'])]).id,
|
||||||
"category_id": self.env['sf.cutting_tool.category'].search([('code', '=', item['category_id'])]).id,
|
"category_id": self.env['sf.cutting_tool.category'].search(
|
||||||
|
[('code', '=', item['category_id'])]).id,
|
||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
raise ValidationError("认证未通过")
|
raise ValidationError("认证未通过")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class sfProcessingOrder(models.Model):
|
class sfProcessingOrder(models.Model):
|
||||||
_inherit = 'sf.processing.order'
|
_inherit = 'sf.processing.order'
|
||||||
_description = '工序'
|
_description = '工序'
|
||||||
@@ -948,4 +951,3 @@ class sfProcessingOrder(models.Model):
|
|||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
raise ValidationError("认证未通过")
|
raise ValidationError("认证未通过")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user