Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/制造代码优化
# Conflicts: # sf_sale/models/sale_order.py
This commit is contained in:
@@ -19,3 +19,13 @@ class Common(models.Model):
|
|||||||
'TIMESTAMP': str(timestamp),
|
'TIMESTAMP': str(timestamp),
|
||||||
'checkstr': check_sf_str}
|
'checkstr': check_sf_str}
|
||||||
return headers
|
return headers
|
||||||
|
|
||||||
|
def get_add_time(self, parse_time):
|
||||||
|
"""
|
||||||
|
把时间增加8小时
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
dt = datetime.datetime.strptime(parse_time, "%Y-%m-%d %H:%M:%S")
|
||||||
|
d = dt + datetime.timedelta(hours=8)
|
||||||
|
nTime = d.strftime("%Y-%m-%d %H:%M:%S")
|
||||||
|
return nTime
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
import json
|
||||||
|
import requests
|
||||||
from odoo import fields, models, api
|
from odoo import fields, models, api
|
||||||
|
from odoo.exceptions import ValidationError
|
||||||
|
from odoo.addons.sf_base.commons.common import Common
|
||||||
|
|
||||||
|
|
||||||
class CuttingToolMaterial(models.Model):
|
class CuttingToolMaterial(models.Model):
|
||||||
@@ -249,3 +253,37 @@ class ToolGroups(models.Model):
|
|||||||
name = fields.Char('名称')
|
name = fields.Char('名称')
|
||||||
equipment_ids = fields.Many2many('maintenance.equipment', 'ref_maintenance_equipment', string='机台号')
|
equipment_ids = fields.Many2many('maintenance.equipment', 'ref_maintenance_equipment', string='机台号')
|
||||||
remark = fields.Char('备注', size=50)
|
remark = fields.Char('备注', size=50)
|
||||||
|
|
||||||
|
# ==========机床刀具组接口==========
|
||||||
|
def _register_tool_groups(self, obj):
|
||||||
|
create_url = '/AutoDeviceApi/FeedBackOut'
|
||||||
|
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(obj, token, sf_secret_key)
|
||||||
|
strurl = sf_sync_config['sf_url'] + create_url
|
||||||
|
device_id = ''
|
||||||
|
for equipment_id in obj.equipment_ids:
|
||||||
|
device_id = '%s,%s' % (device_id, equipment_id.name)
|
||||||
|
val = {
|
||||||
|
'DeviceId': device_id,
|
||||||
|
'GroupName': obj.name,
|
||||||
|
}
|
||||||
|
kw = json.dumps(val, ensure_ascii=False)
|
||||||
|
r = requests.post(strurl, json={}, data={'kw': kw, 'token': token}, headers=headers)
|
||||||
|
ret = r.json()
|
||||||
|
if r == 200:
|
||||||
|
return "机床刀具组发送成功"
|
||||||
|
else:
|
||||||
|
raise ValidationError("机床刀具组发送失败")
|
||||||
|
|
||||||
|
# def write(self, vals):
|
||||||
|
# obj = super().write(vals)
|
||||||
|
# self._register_tool_groups(obj)
|
||||||
|
# return obj
|
||||||
|
#
|
||||||
|
# @api.model_create_multi
|
||||||
|
# def create(self, vals_list):
|
||||||
|
# records = super(ToolGroups, self).create(vals_list)
|
||||||
|
# self._register_tool_groups(records)
|
||||||
|
# return records
|
||||||
|
|||||||
@@ -35,6 +35,41 @@ access_sf_feed_per_tooth,sf_feed_per_tooth,model_sf_feed_per_tooth,base.group_us
|
|||||||
access_sf_ramping_angle,sf_ramping_angle,model_sf_ramping_angle,base.group_user,1,1,1,1
|
access_sf_ramping_angle,sf_ramping_angle,model_sf_ramping_angle,base.group_user,1,1,1,1
|
||||||
access_sf_cutting_width_depth,sf_cutting_width_depth,model_sf_cutting_width_depth,base.group_user,1,1,1,1
|
access_sf_cutting_width_depth,sf_cutting_width_depth,model_sf_cutting_width_depth,base.group_user,1,1,1,1
|
||||||
|
|
||||||
|
access_sf_machine_tool,sf_machine_tool,model_sf_machine_tool,sf_base.group_sf_mrp_user,1,0,0,0
|
||||||
|
access_sf_machine_tool_type,sf_machine_tool_type,model_sf_machine_tool_type,sf_base.group_sf_mrp_user,1,0,0,0
|
||||||
|
access_sf_machine_brand,sf_machine_brand,model_sf_machine_brand,sf_base.group_sf_mrp_user,1,0,0,0
|
||||||
|
access_sf_machine_brand_tags,sf_machine_brand_tags,model_sf_machine_brand_tags,base.group_user,1,1,1,1
|
||||||
|
access_sf_machine_control_system,sf_machine_control_system,model_sf_machine_control_system,sf_base.group_sf_mrp_user,1,0,0,0
|
||||||
|
access_sf_processing_order,sf_processing_order,model_sf_processing_order,sf_base.group_sf_mrp_user,1,0,0,0
|
||||||
|
access_sf_production_process,sf_production_process,model_sf_production_process,sf_base.group_sf_mrp_user,1,0,0,0
|
||||||
|
access_sf_production_materials,sf_production_materials,model_sf_production_materials,sf_base.group_sf_mrp_user,1,0,0,0
|
||||||
|
access_sf_materials_model,sf_materials_model,model_sf_materials_model,sf_base.group_sf_mrp_user,1,0,0,0
|
||||||
|
access_sf_processing_technology,sf_processing_technology,model_sf_processing_technology,sf_base.group_sf_mrp_user,1,0,0,0
|
||||||
|
access_sf_supplier_sort,sf_supplier_sort,model_sf_supplier_sort,sf_base.group_sf_mrp_user,1,0,0,0
|
||||||
|
access_sf_production_process_parameter,sf_production_process_parameter,model_sf_production_process_parameter,sf_base.group_sf_mrp_user,1,0,0,0
|
||||||
|
access_sf_production_process_category,sf_production_process_category,model_sf_production_process_category,sf_base.group_sf_mrp_user,1,0,0,0
|
||||||
|
access_sf_machine_tool_category,sf_machine_tool_category,model_sf_machine_tool_category,sf_base.group_sf_mrp_user,1,0,0,0
|
||||||
|
access_sf_cutting_tool_material,sf_cutting_tool_material,model_sf_cutting_tool_material,sf_base.group_sf_mrp_user,1,0,0,0
|
||||||
|
access_sf_cutting_tool_type,sf_cutting_tool_type,model_sf_cutting_tool_type,sf_base.group_sf_mrp_user,1,0,0,0
|
||||||
|
access_sf_functional_cutting_tool,sf_functional_cutting_tool,model_sf_functional_cutting_tool,sf_base.group_sf_mrp_user,1,0,0,0
|
||||||
|
access_sf_functional_cutting_tool_model,sf_functional_cutting_tool_model,model_sf_functional_cutting_tool_model,sf_base.group_sf_mrp_user,1,0,0,0
|
||||||
|
access_sf_fixture_material,sf_fixture_material,model_sf_fixture_material,sf_base.group_sf_mrp_user,1,0,0,0
|
||||||
|
access_sf_fixture_materials_basic_parameters,sf_fixture_materials_basic_parameters,model_sf_fixture_materials_basic_parameters,sf_base.group_sf_mrp_user,1,0,0,0
|
||||||
|
access_sf_multi_mounting_type,sf_multi_mounting_type,model_sf_multi_mounting_type,sf_base.group_sf_mrp_user,1,0,0,0
|
||||||
|
access_sf_fixture_model,sf_fixture_model,model_sf_fixture_model,sf_base.group_sf_mrp_user,1,0,0,0
|
||||||
|
access_sf_functional_fixture_type,sf_functional_fixture_type,model_sf_functional_fixture_type,sf_base.group_sf_mrp_user,1,0,0,0
|
||||||
|
access_sf_functional_fixture,sf_functional_fixture,model_sf_functional_fixture,sf_base.group_sf_mrp_user,1,0,0,0
|
||||||
|
access_sf_sync_common,sf_sync_common,model_sf_sync_common,sf_base.group_sf_mrp_user,1,0,0,0
|
||||||
|
access_sf_international_standards,sf_international_standards,model_sf_international_standards,sf_base.group_sf_mrp_user,1,0,0,0
|
||||||
|
access_material_apply,material_apply,model_material_apply,sf_base.group_sf_mrp_user,1,0,0,0
|
||||||
|
access_sf_cutting_tool_standard_library,sf_cutting_tool_standard_library,model_sf_cutting_tool_standard_library,sf_base.group_sf_mrp_user,1,0,0,0
|
||||||
|
access_sf_tool_groups,sf_tool_groups,model_sf_tool_groups,sf_base.group_sf_mrp_user,1,0,0,0
|
||||||
|
access_sf_tool_materials_basic_parameters,sf_tool_materials_basic_parameters,model_sf_tool_materials_basic_parameters,sf_base.group_sf_mrp_user,1,0,0,0
|
||||||
|
access_sf_cutting_speed,sf_cutting_speed,model_sf_cutting_speed,sf_base.group_sf_mrp_user,1,0,0,0
|
||||||
|
access_sf_feed_per_tooth,sf_feed_per_tooth,model_sf_feed_per_tooth,sf_base.group_sf_mrp_user,1,0,0,0
|
||||||
|
access_sf_ramping_angle,sf_ramping_angle,model_sf_ramping_angle,sf_base.group_sf_mrp_user,1,0,0,0
|
||||||
|
access_sf_cutting_width_depth,sf_cutting_width_depth,model_sf_cutting_width_depth,sf_base.group_sf_mrp_user,1,0,0,0
|
||||||
|
|
||||||
access_maintenance_equipment_image,maintenance_equipment_image,model_maintenance_equipment_image,base.group_user,1,1,1,1
|
access_maintenance_equipment_image,maintenance_equipment_image,model_maintenance_equipment_image,base.group_user,1,1,1,1
|
||||||
access_purchase_order_group_purchase,access_purchase_order_group_purchase,purchase.model_purchase_order,sf_base.group_purchase,1,1,1,0
|
access_purchase_order_group_purchase,access_purchase_order_group_purchase,purchase.model_purchase_order,sf_base.group_purchase,1,1,1,0
|
||||||
access_purchase_order_group_purchase_director,access_purchase_order_group_purchase_director,purchase.model_purchase_order,sf_base.group_purchase_director,1,1,1,0
|
access_purchase_order_group_purchase_director,access_purchase_order_group_purchase_director,purchase.model_purchase_order,sf_base.group_purchase_director,1,1,1,0
|
||||||
|
|||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data>
|
||||||
<record id="product_category_embryo_sf" model="product.category">
|
<record id="product_category_embryo_sf" model="product.category">
|
||||||
<field name="name">坯料</field>
|
<field name="name">坯料</field>
|
||||||
<field name="type">坯料</field>
|
<field name="type">坯料</field>
|
||||||
@@ -35,10 +35,15 @@
|
|||||||
<field name="type">功能刀具</field>
|
<field name="type">功能刀具</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="res_partner_bfm" model="res.partner">
|
<!-- <record id="res_partner_bfm" model="res.partner">-->
|
||||||
<field name="name">业务平台</field>
|
<!-- <field name="name">业务平台</field>-->
|
||||||
<!-- <field name="company_id" ref="base.main_company"/>-->
|
<!-- <!– <field name="company_id" ref="base.main_company"/>–>-->
|
||||||
</record>
|
<!-- </record>-->
|
||||||
|
|
||||||
|
<!-- <record id="res_users_bfm" model="res.users">-->
|
||||||
|
<!-- <field name="name">业务平台</field>-->
|
||||||
|
<!-- <field name="partner_id" ref="res_partner_bfm"/>-->
|
||||||
|
<!-- </record>-->
|
||||||
|
|
||||||
<record id="product_functional_tool_sf" model="product.product">
|
<record id="product_functional_tool_sf" model="product.product">
|
||||||
<field name="name">功能刀具</field>
|
<field name="name">功能刀具</field>
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
<field name="sequence_number"/>
|
<field name="sequence_number"/>
|
||||||
<field name="program_name"/>
|
<field name="program_name"/>
|
||||||
<field name="cnc_id" string="文件"/>
|
<field name="cnc_id" string="文件"/>
|
||||||
|
<field name="functional_tool_type_id"/>
|
||||||
<field name="cutting_tool_name"/>
|
<field name="cutting_tool_name"/>
|
||||||
<field name="cutting_tool_no"/>
|
<field name="cutting_tool_no"/>
|
||||||
<field name="processing_type"/>
|
<field name="processing_type"/>
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
'security/ir.model.access.csv',
|
'security/ir.model.access.csv',
|
||||||
'security/ir_rule_data.xml',
|
'security/ir_rule_data.xml',
|
||||||
'views/maintenance_logs_views.xml',
|
'views/maintenance_logs_views.xml',
|
||||||
|
'views/maintenance_equipment_oee_views.xml',
|
||||||
'views/maintenance_views.xml',
|
'views/maintenance_views.xml',
|
||||||
'views/equipment_maintenance_standards_views.xml',
|
'views/equipment_maintenance_standards_views.xml',
|
||||||
'views/maintenance_request_views.xml',
|
'views/maintenance_request_views.xml',
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
# -*-coding:utf-8-*-
|
# -*-coding:utf-8-*-
|
||||||
from . import sf_maintenance
|
from . import sf_maintenance
|
||||||
|
from . import sf_maintenance_oee
|
||||||
from . import sf_maintenance_logs
|
from . import sf_maintenance_logs
|
||||||
from . import sf_equipment_maintenance_standards
|
from . import sf_equipment_maintenance_standards
|
||||||
from . import sf_maintenance_requests
|
from . import sf_maintenance_requests
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ class SfSaintenanceStandards(models.Model):
|
|||||||
images = fields.One2many('maintenance.standard.image', 'standard_id', string='反馈图片')
|
images = fields.One2many('maintenance.standard.image', 'standard_id', string='反馈图片')
|
||||||
maintenance_request_ids = fields.Many2many('maintenance.request', string='维保计划')
|
maintenance_request_ids = fields.Many2many('maintenance.request', string='维保计划')
|
||||||
Period = fields.Integer('周期/频次(天)')
|
Period = fields.Integer('周期/频次(天)')
|
||||||
remark = fields.Char('备注说明')
|
remark = fields.Char('维保记录')
|
||||||
|
|
||||||
|
|
||||||
class MaintenanceStandardImage(models.Model):
|
class MaintenanceStandardImage(models.Model):
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ class SfMaintenanceLogs(models.Model):
|
|||||||
type = fields.Selection([('type1', '类型1'), ('type2', '类型2')], string='类型')
|
type = fields.Selection([('type1', '类型1'), ('type2', '类型2')], string='类型')
|
||||||
brand = fields.Many2one('sf.machine.brand', related='maintenance_equipment_id.brand_id', string='品牌')
|
brand = fields.Many2one('sf.machine.brand', related='maintenance_equipment_id.brand_id', string='品牌')
|
||||||
maintenance_equipment_id = fields.Many2one('maintenance.equipment', string='设备')
|
maintenance_equipment_id = fields.Many2one('maintenance.equipment', string='设备')
|
||||||
|
maintenance_equipment_oee_id = fields.Many2one('maintenance.equipment.oee', string='设备oee')
|
||||||
code_location = fields.Char(string='编码位置')
|
code_location = fields.Char(string='编码位置')
|
||||||
fault_type = fields.Selection(
|
fault_type = fields.Selection(
|
||||||
[('电气类', '电气类'), ('机械类', '机械类'), ('程序类', '程序类'), ('系统类', '系统类')], string='故障类型')
|
[('电气类', '电气类'), ('机械类', '机械类'), ('程序类', '程序类'), ('系统类', '系统类')], string='故障类型')
|
||||||
|
|||||||
33
sf_maintenance/models/sf_maintenance_oee.py
Normal file
33
sf_maintenance/models/sf_maintenance_oee.py
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from odoo import api, fields, models, _
|
||||||
|
|
||||||
|
|
||||||
|
class SfMaintenanceEquipmentOEE(models.Model):
|
||||||
|
_name = 'maintenance.equipment.oee'
|
||||||
|
_description = '设备OEE'
|
||||||
|
|
||||||
|
name = fields.Char('设备oee')
|
||||||
|
equipment_id = fields.Many2one('maintenance.equipment', '设备',
|
||||||
|
domain="[('category_id.equipment_type', '=', '机床'),('state_zc', '=', '已注册')]")
|
||||||
|
type_id = fields.Many2one('sf.machine_tool.type', '型号', related='equipment_id.type_id')
|
||||||
|
machine_tool_picture = fields.Binary('设备图片', related='equipment_id.machine_tool_picture')
|
||||||
|
state = fields.Selection(
|
||||||
|
[("正常", "正常"), ("故障停机", "故障停机"), ("计划维保", "计划维保"), ("空闲", "空闲"),
|
||||||
|
("封存(报废)", "封存(报废)")],
|
||||||
|
default='正常', string="机床状态", related='equipment_id.state')
|
||||||
|
run_time = fields.Float('正常运行总时长(h)')
|
||||||
|
equipment_time = fields.Float('总时长(h)')
|
||||||
|
done_nums = fields.Integer('累计加工总件数')
|
||||||
|
utilization_rate = fields.Char('开动率')
|
||||||
|
fault_time = fields.Float('故障停机总时长(h)')
|
||||||
|
fault_nums = fields.Integer('故障次数')
|
||||||
|
sf_maintenance_logs_ids = fields.One2many('sf.maintenance.logs', 'maintenance_equipment_oee_id', '设备故障日志',
|
||||||
|
related='equipment_id.sf_maintenance_logs_ids')
|
||||||
|
|
||||||
|
def name_get(self):
|
||||||
|
result = []
|
||||||
|
for parameter in self:
|
||||||
|
if parameter.equipment_id:
|
||||||
|
name = parameter.equipment_id.name
|
||||||
|
result.append((parameter.id, name))
|
||||||
|
return result
|
||||||
@@ -4,6 +4,9 @@ access_sf_maintenance_logs,sf_maintenance_logs,model_sf_maintenance_logs,sf_grou
|
|||||||
access_sf_maintenance_logs,sf_maintenance_logs,model_sf_maintenance_logs,sf_group_equipment_manager,1,1,1,0
|
access_sf_maintenance_logs,sf_maintenance_logs,model_sf_maintenance_logs,sf_group_equipment_manager,1,1,1,0
|
||||||
access_maintenance_equipment,maintenance_equipment,model_maintenance_equipment,sf_group_equipment_user,1,0,0,0
|
access_maintenance_equipment,maintenance_equipment,model_maintenance_equipment,sf_group_equipment_user,1,0,0,0
|
||||||
access_maintenance_equipment,maintenance_equipment,model_maintenance_equipment,sf_group_equipment_manager,1,1,1,0
|
access_maintenance_equipment,maintenance_equipment,model_maintenance_equipment,sf_group_equipment_manager,1,1,1,0
|
||||||
|
access_maintenance_equipment_oee,maintenance_equipment_oee,model_maintenance_equipment_oee,sf_group_equipment_user,1,0,0,0
|
||||||
|
access_maintenance_equipment_oee,maintenance_equipment_oee,model_maintenance_equipment_oee,sf_group_equipment_manager,1,1,1,0
|
||||||
|
access_maintenance_equipment_oee,maintenance_equipment_oee,model_maintenance_equipment_oee,base.group_user,1,1,1,1
|
||||||
access_maintenance_standards,maintenance_standards,model_maintenance_standards,sf_group_equipment_user,1,0,0,0
|
access_maintenance_standards,maintenance_standards,model_maintenance_standards,sf_group_equipment_user,1,0,0,0
|
||||||
access_maintenance_standards,maintenance_standards,model_maintenance_standards,sf_group_equipment_manager,1,1,1,0
|
access_maintenance_standards,maintenance_standards,model_maintenance_standards,sf_group_equipment_manager,1,1,1,0
|
||||||
access_maintenance_standard_image,maintenance_standard_image,model_maintenance_standard_image,sf_group_equipment_user,1,0,0,0
|
access_maintenance_standard_image,maintenance_standard_image,model_maintenance_standard_image,sf_group_equipment_user,1,0,0,0
|
||||||
|
|||||||
|
118
sf_maintenance/views/maintenance_equipment_oee_views.xml
Normal file
118
sf_maintenance/views/maintenance_equipment_oee_views.xml
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<odoo>
|
||||||
|
<data>
|
||||||
|
<!-- Tree View -->
|
||||||
|
<record id="view_maintenance_oee_tree" model="ir.ui.view">
|
||||||
|
<field name="name">maintenance.oee.tree</field>
|
||||||
|
<field name="model">maintenance.equipment.oee</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree>
|
||||||
|
<field name="equipment_id"/>
|
||||||
|
<field name="equipment_time"/>
|
||||||
|
<field name="run_time"/>
|
||||||
|
<field name="done_nums"/>
|
||||||
|
<field name="utilization_rate"/>
|
||||||
|
<field name="fault_time"/>
|
||||||
|
<field name="fault_nums"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!-- Form View -->
|
||||||
|
<record id="view_maintenance_oee_form" model="ir.ui.view">
|
||||||
|
<field name="name">maintenance.oee.form</field>
|
||||||
|
<field name="model">maintenance.equipment.oee</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form>
|
||||||
|
<header>
|
||||||
|
<field name="state" widget="statusbar" readonly="1"/>
|
||||||
|
</header>
|
||||||
|
<sheet>
|
||||||
|
<div class="oe_title">
|
||||||
|
<h1>
|
||||||
|
<field name="equipment_id"/>
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<group>
|
||||||
|
<group>
|
||||||
|
<field name="type_id" readonly="1"/>
|
||||||
|
<field name="equipment_time"/>
|
||||||
|
<field name="run_time"/>
|
||||||
|
<field name="done_nums"/>
|
||||||
|
<field name="utilization_rate"/>
|
||||||
|
<field name="fault_time"/>
|
||||||
|
<field name="fault_nums"/>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<field name="machine_tool_picture" widget="image" readonly="1"/>
|
||||||
|
</group>
|
||||||
|
|
||||||
|
</group>
|
||||||
|
</sheet>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!-- Search View -->
|
||||||
|
<record id="view_maintenance_oee_search" model="ir.ui.view">
|
||||||
|
<field name="name">maintenance.oee.search</field>
|
||||||
|
<field name="model">maintenance.equipment.oee</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<search>
|
||||||
|
<searchpanel>
|
||||||
|
<field name="equipment_id" icon="fa-building" enable_counters="1"/>
|
||||||
|
</searchpanel>
|
||||||
|
</search>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Action -->
|
||||||
|
|
||||||
|
<record id="action_maintenance_oee" model="ir.actions.act_window">
|
||||||
|
<field name="name">设备OEE</field>
|
||||||
|
<field name="type">ir.actions.act_window</field>
|
||||||
|
<field name="res_model">maintenance.equipment.oee</field>
|
||||||
|
<field name="search_view_id" ref="view_maintenance_oee_search"/>
|
||||||
|
<field name="view_mode">tree,form</field>
|
||||||
|
<field name="view_id" ref="view_maintenance_oee_tree"/>
|
||||||
|
<field name="help" type="html">
|
||||||
|
<p class="oe_view_nocontent_create">
|
||||||
|
设备OEE
|
||||||
|
</p>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!-- <record id="action_maintenance_oee_button" model="ir.actions.act_window">-->
|
||||||
|
<!-- <field name="name">设备故障日志</field>-->
|
||||||
|
<!-- <field name="type">ir.actions.act_window</field>-->
|
||||||
|
<!-- <field name="res_model">sf.maintenance.oee</field>-->
|
||||||
|
<!-- <field name="search_view_id" ref="view_maintenance_logs_search"/>-->
|
||||||
|
<!-- <field name="view_mode">tree,form</field>-->
|
||||||
|
<!-- <field name="view_id" ref="view_maintenance_logs_tree"/>-->
|
||||||
|
<!-- <field name="context">{-->
|
||||||
|
<!-- 'default_maintenance_equipment_id': active_id-->
|
||||||
|
<!-- }</field>-->
|
||||||
|
<!-- <field name="help" type="html">-->
|
||||||
|
<!-- <p class="oe_view_nocontent_create">-->
|
||||||
|
<!-- 设备故障日志-->
|
||||||
|
<!-- </p>-->
|
||||||
|
<!-- </field>-->
|
||||||
|
<!-- </record>-->
|
||||||
|
|
||||||
|
<!-- <record id="action_maintenance_logs" model="ir.actions.act_window">-->
|
||||||
|
<!-- <field name="name">设备故障日志</field>-->
|
||||||
|
<!-- <field name="res_model">sf.maintenance.logs</field>-->
|
||||||
|
<!-- <field name="view_type">form</field>-->
|
||||||
|
<!-- <field name="view_mode">tree,form</field>-->
|
||||||
|
<!-- <field name="view_id" ref="view_maintenance_logs_tree"/>-->
|
||||||
|
<!-- </record>-->
|
||||||
|
|
||||||
|
<!-- Menu -->
|
||||||
|
<menuitem name="设备OEE" id="menu_maintenance_oee" parent="maintenance.menu_m_request"
|
||||||
|
sequence="11" action="action_maintenance_oee"/>
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
|
|
||||||
|
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree>
|
<tree>
|
||||||
<field name="code"/>
|
<field name="code"/>
|
||||||
<field name="name"/>
|
|
||||||
<field name="type" optional="hide"/>
|
<field name="type" optional="hide"/>
|
||||||
<field name="brand"/>
|
<field name="brand"/>
|
||||||
<field name="maintenance_equipment_id"/>
|
<field name="maintenance_equipment_id"/>
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import logging
|
import logging
|
||||||
import json
|
import json
|
||||||
import base64
|
|
||||||
from odoo import http
|
from odoo import http
|
||||||
from odoo.http import request
|
from odoo.http import request
|
||||||
|
|
||||||
@@ -21,9 +20,9 @@ class Manufacturing_Connect(http.Controller):
|
|||||||
res = {'Succeed': True, 'Datas': []}
|
res = {'Succeed': True, 'Datas': []}
|
||||||
datas = request.httprequest.data
|
datas = request.httprequest.data
|
||||||
ret = json.loads(datas)
|
ret = json.loads(datas)
|
||||||
ret = json.loads(ret['result'])
|
|
||||||
logging.info('RfidCode:%s' % ret)
|
logging.info('RfidCode:%s' % ret)
|
||||||
workorder = request.env['mrp.workorder'].sudo().search([('name', '=', ret['RfidCode'])])
|
workorder = request.env['mrp.workorder'].sudo().search(
|
||||||
|
[('production_id.name', '=', 'WH/MO/00071'), ('routing_type', '=', '装夹')])
|
||||||
if workorder:
|
if workorder:
|
||||||
for item in workorder:
|
for item in workorder:
|
||||||
res['Datas'].append({
|
res['Datas'].append({
|
||||||
@@ -33,10 +32,186 @@ class Manufacturing_Connect(http.Controller):
|
|||||||
'Quantity': 1,
|
'Quantity': 1,
|
||||||
'MaterialId': item.product_id.default_code,
|
'MaterialId': item.product_id.default_code,
|
||||||
'MaterialName': item.product_id.name,
|
'MaterialName': item.product_id.name,
|
||||||
# 'Spec':item.mat,
|
'Spec': '%s×%s×%s' % (item.move_raw_ids.materiel_length, item.move_raw_ids.materiel_width,
|
||||||
'Material': item.materials_type_id.name
|
item.move_raw_ids.materiel_height),
|
||||||
|
'Material': item.product_id.materials_type_id.name
|
||||||
})
|
})
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
|
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
|
||||||
logging.info('get_Work_Info error:%s' % e)
|
logging.info('get_Work_Info error:%s' % e)
|
||||||
return json.JSONEncoder().encode(res)
|
return json.JSONEncoder().encode(res)
|
||||||
|
|
||||||
|
@http.route('/AutoDeviceApi/GetShiftPlan', type='json', auth='sf_token', methods=['GET', 'POST'], csrf=False,
|
||||||
|
cors="*")
|
||||||
|
def get_ShiftPlan(self, **kw):
|
||||||
|
"""
|
||||||
|
自动化每天获取机台日计划
|
||||||
|
:param kw:
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
logging.info('get_ShiftPlan:%s' % kw)
|
||||||
|
try:
|
||||||
|
res = {'Succeed': True, 'Datas': []}
|
||||||
|
datas = request.httprequest.data
|
||||||
|
ret = json.loads(datas)
|
||||||
|
ret = json.loads(ret['result'])
|
||||||
|
logging.info('RfidCode:%s' % ret)
|
||||||
|
workorder = request.env['mrp.workorder'].sudo().search([('name', '=', ret['ProductionLine'])])
|
||||||
|
if workorder:
|
||||||
|
for item in workorder:
|
||||||
|
date_planned_start = ''
|
||||||
|
date_planned_finished = ''
|
||||||
|
if item.date_planned_start is not False:
|
||||||
|
planned_start = item.date_planned_start.strftime("%Y-%m-%d %H:%M:%S")
|
||||||
|
date_planned_start = request.env['sf.sync.common'].sudo().get_add_time(planned_start)
|
||||||
|
if item.date_planned_finished is not False:
|
||||||
|
planned_finished = item.date_planned_finished.strftime("%Y-%m-%d %H:%M:%S")
|
||||||
|
date_planned_finished = request.env['sf.sync.common'].sudo().get_add_time(planned_finished)
|
||||||
|
res['Datas'].append({
|
||||||
|
'BillId': item.production_id.name,
|
||||||
|
'RfidCode': item.RfidCode,
|
||||||
|
'CraftName': item.name,
|
||||||
|
'Quantity': 1,
|
||||||
|
'WortkStart': date_planned_start,
|
||||||
|
'WorkEnd': date_planned_finished,
|
||||||
|
'MaterialId': item.product_id.default_code,
|
||||||
|
'MaterialName': item.product_id.name,
|
||||||
|
# 'Spec':item.mat,
|
||||||
|
'Material': item.materials_type_id.name
|
||||||
|
})
|
||||||
|
except Exception as e:
|
||||||
|
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
|
||||||
|
logging.info('get_ShiftPlan error:%s' % e)
|
||||||
|
return json.JSONEncoder().encode(res)
|
||||||
|
|
||||||
|
@http.route('/AutoDeviceApi/QcCheck', type='json', auth='sf_token', methods=['GET', 'POST'], csrf=False,
|
||||||
|
cors="*")
|
||||||
|
def get_qcCheck(self, **kw):
|
||||||
|
"""
|
||||||
|
工件预调(前置三元检测)
|
||||||
|
1、前置三元检测在产线外:三元检测设备把测量信息上传给MES,
|
||||||
|
MES生成检测定位数据。中控系统传递RFID编号给MES获取测量偏置结果。(来源为三元检测工单上的字段)
|
||||||
|
:param kw:
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
logging.info('get_qcCheck:%s' % kw)
|
||||||
|
try:
|
||||||
|
res = {'Succeed': True, 'Datas': []}
|
||||||
|
datas = request.httprequest.data
|
||||||
|
ret = json.loads(datas)
|
||||||
|
ret = json.loads(ret['result'])
|
||||||
|
logging.info('RfidCode:%s' % ret)
|
||||||
|
workorder = request.env['mrp.workorder'].sudo().search([('routing_type', '=', '前置三元定位检测')])
|
||||||
|
if workorder:
|
||||||
|
for item in workorder:
|
||||||
|
res['Datas'].append({
|
||||||
|
'XOffset': item.production_id.name,
|
||||||
|
'YOffset': item.RfidCode,
|
||||||
|
'ZOffet': item.name,
|
||||||
|
'COffset': 1
|
||||||
|
})
|
||||||
|
except Exception as e:
|
||||||
|
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
|
||||||
|
logging.info('get_qcCheck error:%s' % e)
|
||||||
|
return json.JSONEncoder().encode(res)
|
||||||
|
|
||||||
|
@http.route('/AutoDeviceApi/FeedBackStart', type='json', auth='none', methods=['GET', 'POST'], csrf=False,
|
||||||
|
cors="*")
|
||||||
|
def button_Work_START(self, **kw):
|
||||||
|
"""
|
||||||
|
工单任务开始
|
||||||
|
:param kw:
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
logging.info('button_Work_START:%s' % kw)
|
||||||
|
try:
|
||||||
|
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)
|
||||||
|
workorder.button_start()
|
||||||
|
except Exception as e:
|
||||||
|
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
|
||||||
|
logging.info('button_Work_START error:%s' % e)
|
||||||
|
return json.JSONEncoder().encode(res)
|
||||||
|
|
||||||
|
@http.route('/AutoDeviceApi/FeedBackEnd', type='json', auth='none', methods=['GET', 'POST'], csrf=False,
|
||||||
|
cors="*")
|
||||||
|
def button_Work_End(self, **kw):
|
||||||
|
"""
|
||||||
|
工单任务结束
|
||||||
|
:param kw:
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
logging.info('button_Work_End:%s' % kw)
|
||||||
|
try:
|
||||||
|
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)
|
||||||
|
workorder.button_finish()
|
||||||
|
except Exception as e:
|
||||||
|
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
|
||||||
|
logging.info('button_Work_End error:%s' % e)
|
||||||
|
return json.JSONEncoder().encode(res)
|
||||||
|
|
||||||
|
@http.route('/AutoDeviceApi/QcCheck', type='json', auth='none', methods=['GET', 'POST'], csrf=False,
|
||||||
|
cors="*")
|
||||||
|
def Workorder_QcCheck(self, **kw):
|
||||||
|
"""
|
||||||
|
零件质检
|
||||||
|
:param kw:
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
logging.info('Workorder_QcCheck:%s' % kw)
|
||||||
|
try:
|
||||||
|
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(
|
||||||
|
[('production_id', '=', production_id), ('routing_type', '=', routing_type)], limit=1)
|
||||||
|
except Exception as e:
|
||||||
|
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
|
||||||
|
logging.info('Workorder_QcCheck error:%s' % e)
|
||||||
|
return json.JSONEncoder().encode(res)
|
||||||
|
|||||||
@@ -1,6 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
|
<record id="sequence_routing_workcenter" model="ir.sequence">
|
||||||
|
<field name="name">工序编码规则</field>
|
||||||
|
<field name="code">mrp.routing.workcenter</field>
|
||||||
|
<field name="padding">4</field>
|
||||||
|
<field name="company_id" eval="False"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
<record id="sequence_stock_picking_out" model="ir.sequence">
|
<record id="sequence_stock_picking_out" model="ir.sequence">
|
||||||
<field name="name">YourCompany Sequence ocout</field>
|
<field name="name">YourCompany Sequence ocout</field>
|
||||||
<field name="prefix">WH/OCOUT/</field>
|
<field name="prefix">WH/OCOUT/</field>
|
||||||
|
|||||||
@@ -450,10 +450,10 @@ class MrpProduction(models.Model):
|
|||||||
|
|
||||||
for route in routingworkcenter:
|
for route in routingworkcenter:
|
||||||
|
|
||||||
if route.routing_type == '后置三元质量检测':
|
# if route.routing_type == '后置三元质量检测':
|
||||||
workorders_values.append(
|
# workorders_values.append(
|
||||||
self.env['mrp.workorder'].json_workorder_str1(k, production, route)
|
# self.env['mrp.workorder'].json_workorder_str1(k, production, route)
|
||||||
)
|
# )
|
||||||
if route.routing_type == 'CNC加工':
|
if route.routing_type == 'CNC加工':
|
||||||
workorders_values.append(
|
workorders_values.append(
|
||||||
self.env['mrp.workorder'].json_workorder_str1(k, production, route))
|
self.env['mrp.workorder'].json_workorder_str1(k, production, route))
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import logging
|
import logging
|
||||||
from odoo import fields, models
|
from odoo import fields, models, api
|
||||||
|
from odoo.exceptions import UserError
|
||||||
|
|
||||||
|
|
||||||
class ResMrpRoutingWorkcenter(models.Model):
|
class ResMrpRoutingWorkcenter(models.Model):
|
||||||
@@ -10,7 +11,7 @@ class ResMrpRoutingWorkcenter(models.Model):
|
|||||||
('装夹预调', '装夹预调'),
|
('装夹预调', '装夹预调'),
|
||||||
# ('前置三元定位检测', '前置三元定位检测'),
|
# ('前置三元定位检测', '前置三元定位检测'),
|
||||||
('CNC加工', 'CNC加工'),
|
('CNC加工', 'CNC加工'),
|
||||||
('后置三元质量检测', '后置三元质量检测'),
|
# ('后置三元质量检测', '后置三元质量检测'),
|
||||||
('解除装夹', '解除装夹'),
|
('解除装夹', '解除装夹'),
|
||||||
('切割', '切割'),
|
('切割', '切割'),
|
||||||
('表面工艺', '表面工艺')
|
('表面工艺', '表面工艺')
|
||||||
@@ -21,13 +22,17 @@ class ResMrpRoutingWorkcenter(models.Model):
|
|||||||
bom_id = fields.Many2one('mrp.bom', required=False)
|
bom_id = fields.Many2one('mrp.bom', required=False)
|
||||||
surface_technics_id = fields.Many2one('sf.production.process', string="表面工艺")
|
surface_technics_id = fields.Many2one('sf.production.process', string="表面工艺")
|
||||||
|
|
||||||
|
def generate_code(self):
|
||||||
|
return self.env['ir.sequence'].next_by_code('mrp.routing.workcenter')
|
||||||
|
|
||||||
|
code = fields.Char('编码', default=generate_code)
|
||||||
|
|
||||||
# 获得当前登陆者公司
|
# 获得当前登陆者公司
|
||||||
def get_company_id(self):
|
def get_company_id(self):
|
||||||
self.company_id = self.env.user.company_id.id
|
self.company_id = self.env.user.company_id.id
|
||||||
|
|
||||||
company_id = fields.Many2one('res.company', compute="get_company_id", related=False)
|
company_id = fields.Many2one('res.company', compute="get_company_id", related=False)
|
||||||
|
|
||||||
|
|
||||||
# 排产的时候, 根据坯料的长宽高比对一下机床的最大加工尺寸.不符合就不要分配给这个加工中心(机床).
|
# 排产的时候, 根据坯料的长宽高比对一下机床的最大加工尺寸.不符合就不要分配给这个加工中心(机床).
|
||||||
# 工单对应的工作中心,根据工序中的工作中心去匹配,
|
# 工单对应的工作中心,根据工序中的工作中心去匹配,
|
||||||
# 如果只配置了一个工作中心,则默认采用该工作中心;
|
# 如果只配置了一个工作中心,则默认采用该工作中心;
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
('装夹预调', '装夹预调'),
|
('装夹预调', '装夹预调'),
|
||||||
# ('前置三元定位检测', '前置三元定位检测'),
|
# ('前置三元定位检测', '前置三元定位检测'),
|
||||||
('CNC加工', 'CNC加工'),
|
('CNC加工', 'CNC加工'),
|
||||||
('后置三元质量检测', '后置三元质量检测'),
|
# ('后置三元质量检测', '后置三元质量检测'),
|
||||||
('解除装夹', '解除装夹'),
|
('解除装夹', '解除装夹'),
|
||||||
('切割', '切割'), ('表面工艺', '表面工艺')
|
('切割', '切割'), ('表面工艺', '表面工艺')
|
||||||
], string="工序类型")
|
], string="工序类型")
|
||||||
@@ -216,9 +216,9 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
elif route.routing_type == 'CNC加工':
|
elif route.routing_type == 'CNC加工':
|
||||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
||||||
[('name', '=', 'CNC加工')]).time_cycle
|
[('name', '=', 'CNC加工')]).time_cycle
|
||||||
elif route.routing_type == '后置三元质量检测':
|
# elif route.routing_type == '后置三元质量检测':
|
||||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
# duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
||||||
[('name', '=', '后置三元质量检测')]).time_cycle
|
# [('name', '=', '后置三元质量检测')]).time_cycle
|
||||||
elif route.routing_type == '解除装夹':
|
elif route.routing_type == '解除装夹':
|
||||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
||||||
[('name', '=', '解除装夹')]).time_cycle
|
[('name', '=', '解除装夹')]).time_cycle
|
||||||
@@ -232,7 +232,7 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
'processing_panel': k,
|
'processing_panel': k,
|
||||||
'quality_point_ids': route.route_workcenter_id.quality_point_ids,
|
'quality_point_ids': route.route_workcenter_id.quality_point_ids,
|
||||||
'routing_type': route.routing_type,
|
'routing_type': route.routing_type,
|
||||||
'work_state': '' if not route.routing_type == '获取CNC加工程序' else '待发起',
|
'work_state': '待发起',
|
||||||
'workcenter_id': self.env['mrp.routing.workcenter'].get_workcenter(route.workcenter_ids.ids,
|
'workcenter_id': self.env['mrp.routing.workcenter'].get_workcenter(route.workcenter_ids.ids,
|
||||||
route.routing_type,
|
route.routing_type,
|
||||||
production.product_id),
|
production.product_id),
|
||||||
@@ -597,6 +597,7 @@ class CNCprocessing(models.Model):
|
|||||||
cnc_id = fields.Many2one('ir.attachment')
|
cnc_id = fields.Many2one('ir.attachment')
|
||||||
sequence_number = fields.Char('序号')
|
sequence_number = fields.Char('序号')
|
||||||
program_name = fields.Char('程序名')
|
program_name = fields.Char('程序名')
|
||||||
|
functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型')
|
||||||
cutting_tool_name = fields.Char('刀具名称')
|
cutting_tool_name = fields.Char('刀具名称')
|
||||||
cutting_tool_no = fields.Char('刀号')
|
cutting_tool_no = fields.Char('刀号')
|
||||||
processing_type = fields.Char('加工类型')
|
processing_type = fields.Char('加工类型')
|
||||||
|
|||||||
@@ -870,6 +870,11 @@ class SfMaintenanceEquipmentTool(models.Model):
|
|||||||
_description = '机床刀位'
|
_description = '机床刀位'
|
||||||
|
|
||||||
equipment_id = fields.Many2one('maintenance.equipment', string='设备')
|
equipment_id = fields.Many2one('maintenance.equipment', string='设备')
|
||||||
|
|
||||||
|
code = fields.Char('机床刀位号')
|
||||||
|
name = fields.Char('刀位号', compute='_compute_name')
|
||||||
|
|
||||||
|
# 待删除字段
|
||||||
product_template_id = fields.Many2one('product.template', string='功能刀具名称',
|
product_template_id = fields.Many2one('product.template', string='功能刀具名称',
|
||||||
domain="[('categ_type', '=', '刀具')]")
|
domain="[('categ_type', '=', '刀具')]")
|
||||||
image_1920 = fields.Binary('图片', related='product_template_id.image_1920')
|
image_1920 = fields.Binary('图片', related='product_template_id.image_1920')
|
||||||
@@ -882,9 +887,6 @@ class SfMaintenanceEquipmentTool(models.Model):
|
|||||||
life_value_max = fields.Char('最大寿命值')
|
life_value_max = fields.Char('最大寿命值')
|
||||||
alarm_value = fields.Char('报警值')
|
alarm_value = fields.Char('报警值')
|
||||||
used_value = fields.Char('已使用值')
|
used_value = fields.Char('已使用值')
|
||||||
code = fields.Char('机床刀位号')
|
|
||||||
|
|
||||||
name = fields.Char('', compute='_compute_name')
|
|
||||||
|
|
||||||
@api.depends('code')
|
@api.depends('code')
|
||||||
def _compute_name(self):
|
def _compute_name(self):
|
||||||
|
|||||||
@@ -6,6 +6,9 @@
|
|||||||
<field name="model">mrp.routing.workcenter</field>
|
<field name="model">mrp.routing.workcenter</field>
|
||||||
<field name="inherit_id" ref="mrp.mrp_routing_workcenter_form_view"/>
|
<field name="inherit_id" ref="mrp.mrp_routing_workcenter_form_view"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
|
<field name="name" position="before">
|
||||||
|
<field name="code" readonly="1"/>
|
||||||
|
</field>
|
||||||
<field name="workcenter_id" position="replace">
|
<field name="workcenter_id" position="replace">
|
||||||
<field name="workcenter_ids" widget="many2many_tags" string="工作中心" required="0"/>
|
<field name="workcenter_ids" widget="many2many_tags" string="工作中心" required="0"/>
|
||||||
<field name="surface_technics_id"
|
<field name="surface_technics_id"
|
||||||
|
|||||||
@@ -398,6 +398,21 @@
|
|||||||
</xpath>
|
</xpath>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<xpath expr="//page[1]" position="before">
|
||||||
|
<field name="results" invisible="1"/>
|
||||||
|
<page string="后置三元检测" attrs='{"invisible": [("routing_type","!=","CNC加工")]}'>
|
||||||
|
<group>
|
||||||
|
<field name="test_results" widget="selection" attrs='{"invisible":[("results","!=",False)]}'/>
|
||||||
|
<field name="results" readonly="1" attrs='{"invisible":[("results","!=","合格")]}'/>
|
||||||
|
</group>
|
||||||
|
<div class="col-12 col-lg-6 o_setting_box">
|
||||||
|
<button type="object" class="oe_highlight" name="recreateManufacturingOrWorkerOrder"
|
||||||
|
string="检测确认"
|
||||||
|
attrs='{"invisible": ["|","|",("state","!=","progress"),("user_permissions","=",False),("results","=","合格")]}'/>
|
||||||
|
</div>
|
||||||
|
</page>
|
||||||
|
</xpath>
|
||||||
<xpath expr="//page[1]" position="before">
|
<xpath expr="//page[1]" position="before">
|
||||||
<page string="CNC程序" attrs='{"invisible": [("routing_type","!=","CNC加工")]}'>
|
<page string="CNC程序" attrs='{"invisible": [("routing_type","!=","CNC加工")]}'>
|
||||||
<field name="cnc_ids" widget="one2many" string="工作程序">
|
<field name="cnc_ids" widget="one2many" string="工作程序">
|
||||||
@@ -423,20 +438,6 @@
|
|||||||
</group>
|
</group>
|
||||||
</page>
|
</page>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//page[1]" position="before">
|
|
||||||
<field name="results" invisible="1"/>
|
|
||||||
<page string="后置三元检测" attrs='{"invisible": [("routing_type","!=","后置三元质量检测")]}'>
|
|
||||||
<group>
|
|
||||||
<field name="test_results" widget="selection" attrs='{"invisible":[("results","!=",False)]}'/>
|
|
||||||
<field name="results" readonly="1" attrs='{"invisible":[("results","!=","合格")]}'/>
|
|
||||||
</group>
|
|
||||||
<div class="col-12 col-lg-6 o_setting_box">
|
|
||||||
<button type="object" class="oe_highlight" name="recreateManufacturingOrWorkerOrder"
|
|
||||||
string="检测确认"
|
|
||||||
attrs='{"invisible": ["|","|",("state","!=","progress"),("user_permissions","=",False),("results","=","合格")]}'/>
|
|
||||||
</div>
|
|
||||||
</page>
|
|
||||||
</xpath>
|
|
||||||
<xpath expr="//page[1]" position="before">
|
<xpath expr="//page[1]" position="before">
|
||||||
<page string="解除装夹" attrs='{"invisible": [("routing_type","!=","解除装夹")]}'>
|
<page string="解除装夹" attrs='{"invisible": [("routing_type","!=","解除装夹")]}'>
|
||||||
<!-- <field name="tray_id" readonly="1"/>-->
|
<!-- <field name="tray_id" readonly="1"/>-->
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<!-- 设备增加刀具库位table-->
|
设备增加刀具库位table
|
||||||
<record id="sf_manufacturing_hr_equipment_view_form" model="ir.ui.view">
|
<record id="sf_manufacturing_hr_equipment_view_form" model="ir.ui.view">
|
||||||
<field name="name">sf_manufacturing_equipment.form</field>
|
<field name="name">sf_manufacturing_equipment.form</field>
|
||||||
<field name="model">maintenance.equipment</field>
|
<field name="model">maintenance.equipment</field>
|
||||||
@@ -13,17 +13,6 @@
|
|||||||
<field name = 'product_template_ids' >
|
<field name = 'product_template_ids' >
|
||||||
<tree editable='bottom'>
|
<tree editable='bottom'>
|
||||||
<field name="code"/>
|
<field name="code"/>
|
||||||
<field name="product_template_id"/>
|
|
||||||
<field name="image_1920" widget="image"/>
|
|
||||||
<field name="categ_type"/>
|
|
||||||
<field name="diameter"/>
|
|
||||||
<field name="precision"/>
|
|
||||||
<field name="tool_code"/>
|
|
||||||
<field name="hilt_name"/>
|
|
||||||
<field name="hilt_code"/>
|
|
||||||
<field name="life_value_max"/>
|
|
||||||
<field name="alarm_value"/>
|
|
||||||
<field name="used_value"/>
|
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</page>
|
</page>
|
||||||
|
|||||||
@@ -2,3 +2,4 @@
|
|||||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||||
|
|
||||||
from . import custom_quality
|
from . import custom_quality
|
||||||
|
from . import quality
|
||||||
|
|||||||
34
sf_quality/models/quality.py
Normal file
34
sf_quality/models/quality.py
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
import json
|
||||||
|
import requests
|
||||||
|
from odoo import fields, models, api
|
||||||
|
from odoo.exceptions import ValidationError
|
||||||
|
from odoo.addons.sf_base.commons.common import Common
|
||||||
|
|
||||||
|
|
||||||
|
class QualityCheck(models.Model):
|
||||||
|
_inherit = "quality.check"
|
||||||
|
_description = '零件特采'
|
||||||
|
|
||||||
|
# ==========零件特采接口==========
|
||||||
|
def _register_tool_groups(self):
|
||||||
|
create_url = '/AutoDeviceApi/FeedBackOut'
|
||||||
|
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
|
||||||
|
val = {
|
||||||
|
'RfidCode': None,
|
||||||
|
}
|
||||||
|
kw = json.dumps(val, ensure_ascii=False)
|
||||||
|
r = requests.post(strurl, json={}, data={'kw': kw, 'token': token}, headers=headers)
|
||||||
|
ret = r.json()
|
||||||
|
if r == 200:
|
||||||
|
return "零件特采发送成功"
|
||||||
|
else:
|
||||||
|
raise ValidationError("零件特采发送失败")
|
||||||
|
|
||||||
|
# @api.onchange('quality_state')
|
||||||
|
# def _onchange_quality_state(self):
|
||||||
|
# if self.quality_state in ['pass', 'fail']:
|
||||||
|
# self._register_tool_groups()
|
||||||
@@ -8,6 +8,18 @@ class ReSaleOrder(models.Model):
|
|||||||
_inherit = 'sale.order'
|
_inherit = 'sale.order'
|
||||||
|
|
||||||
logistics_way = fields.Selection([('自提', '自提'), ('到付', '到付'), ('在线支付', '在线支付')], string='物流方式')
|
logistics_way = fields.Selection([('自提', '自提'), ('到付', '到付'), ('在线支付', '在线支付')], string='物流方式')
|
||||||
|
state = fields.Selection(
|
||||||
|
selection=[
|
||||||
|
('draft', "报价"),
|
||||||
|
('sent', "报价已发送"),
|
||||||
|
('sale', "销售订单"),
|
||||||
|
('done', "已锁定"),
|
||||||
|
('cancel', '已废弃'),
|
||||||
|
],
|
||||||
|
string="状态",
|
||||||
|
readonly=True, copy=False, index=True,
|
||||||
|
tracking=3,
|
||||||
|
default='draft')
|
||||||
deadline_of_delivery = fields.Date('订单交期', tracking=True)
|
deadline_of_delivery = fields.Date('订单交期', tracking=True)
|
||||||
person_of_delivery = fields.Char('交货人')
|
person_of_delivery = fields.Char('交货人')
|
||||||
telephone_of_delivery = fields.Char('交货人电话号码')
|
telephone_of_delivery = fields.Char('交货人电话号码')
|
||||||
@@ -38,7 +50,8 @@ class ReSaleOrder(models.Model):
|
|||||||
'name': self.env['ir.sequence'].next_by_code('sale.order', sequence_date=now_time),
|
'name': self.env['ir.sequence'].next_by_code('sale.order', sequence_date=now_time),
|
||||||
'partner_id': partner.id,
|
'partner_id': partner.id,
|
||||||
'check_status': 'approved',
|
'check_status': 'approved',
|
||||||
'state': 'draft',
|
'state': 'sale',
|
||||||
|
'user_id': partner.user_id.id,
|
||||||
'person_of_delivery': delivery_name,
|
'person_of_delivery': delivery_name,
|
||||||
'telephone_of_delivery': delivery_telephone,
|
'telephone_of_delivery': delivery_telephone,
|
||||||
'address_of_delivery': delivery_address,
|
'address_of_delivery': delivery_address,
|
||||||
@@ -60,11 +73,12 @@ class ReSaleOrder(models.Model):
|
|||||||
self.check_status = 'pending'
|
self.check_status = 'pending'
|
||||||
|
|
||||||
def get_customer(self):
|
def get_customer(self):
|
||||||
customer = self.env['res.partner'].search([('name', '=', '业务平台')])
|
customer = self.env['res.partner'].search([('name', '=', '业务平台')], limit=1, order='id asc')
|
||||||
if customer:
|
if customer:
|
||||||
return customer
|
return customer
|
||||||
else:
|
else:
|
||||||
partner = self.env['res.partner'].create({'name': '业务平台'})
|
partner = self.env['res.partner'].create({'name': '业务平台'})
|
||||||
|
self.env['res.users'].create({'name': '业务平台', 'partner_id': partner.id})
|
||||||
return partner
|
return partner
|
||||||
|
|
||||||
# 业务平台分配工厂时在创建完产品后再创建销售明细信息
|
# 业务平台分配工厂时在创建完产品后再创建销售明细信息
|
||||||
@@ -80,7 +94,7 @@ class ReSaleOrder(models.Model):
|
|||||||
'product_uom_qty': item['number'],
|
'product_uom_qty': item['number'],
|
||||||
'model_glb_file': base64.b64decode(item['model_file']),
|
'model_glb_file': base64.b64decode(item['model_file']),
|
||||||
}
|
}
|
||||||
return self.env['sale.order.line'].create(vals)
|
return self.env['sale.order.line'].with_context(skip_procurement=True).create(vals)
|
||||||
|
|
||||||
@api.constrains('order_line')
|
@api.constrains('order_line')
|
||||||
def check_order_line(self):
|
def check_order_line(self):
|
||||||
@@ -114,10 +128,22 @@ class RePurchaseOrder(models.Model):
|
|||||||
|
|
||||||
check_status = fields.Selection([('pending', '待审核'), ('approved', '已审核'), ('fail', '不通过')], '审核状态')
|
check_status = fields.Selection([('pending', '待审核'), ('approved', '已审核'), ('fail', '不通过')], '审核状态')
|
||||||
remark = fields.Text('备注')
|
remark = fields.Text('备注')
|
||||||
|
user_id = fields.Many2one(
|
||||||
|
'res.users', string='买家', index=True, tracking=True,
|
||||||
|
compute='_compute_user_id',
|
||||||
|
store=True)
|
||||||
|
|
||||||
def button_confirming(self):
|
def button_confirming(self):
|
||||||
self.write({'state': 'purchase', 'check_status': 'pending'})
|
self.write({'state': 'purchase', 'check_status': 'pending'})
|
||||||
|
|
||||||
|
@api.depends('partner_id')
|
||||||
|
def _compute_user_id(self):
|
||||||
|
if not self.user_id:
|
||||||
|
if self.partner_id:
|
||||||
|
self.user_id = self.partner_id.purchase_user_id.id
|
||||||
|
else:
|
||||||
|
self.user_id = self.env.user.id
|
||||||
|
|
||||||
@api.constrains('order_line')
|
@api.constrains('order_line')
|
||||||
def check_order_line(self):
|
def check_order_line(self):
|
||||||
for item in self:
|
for item in self:
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ access_product_product_group_sale_salemanager,product_product_group_sale_saleman
|
|||||||
access_product_product_group_sale_director,product_product_group_sale_director,product.model_product_product,sf_base.group_sale_director,1,1,1,0
|
access_product_product_group_sale_director,product_product_group_sale_director,product.model_product_product,sf_base.group_sale_director,1,1,1,0
|
||||||
access_product_product_group_purchase,product_product_group_purchase,product.model_product_product,sf_base.group_purchase,1,0,0,0
|
access_product_product_group_purchase,product_product_group_purchase,product.model_product_product,sf_base.group_purchase,1,0,0,0
|
||||||
access_product_product_group_purchase_director,product_product_group_purchase_director,product.model_product_product,sf_base.group_purchase_director,1,1,1,0
|
access_product_product_group_purchase_director,product_product_group_purchase_director,product.model_product_product,sf_base.group_purchase_director,1,1,1,0
|
||||||
access_product_template_group_sale_salemanager,product_product_group_sale_salemanager,product.model_product_template,sf_base.group_sale_salemanager,1,0,0,0
|
access_product_template_group_sale_salemanager,product_template_group_sale_salemanager,product.model_product_template,sf_base.group_sale_salemanager,1,0,0,0
|
||||||
access_product_template_group_sale_director,product_template_group_sale_director,product.model_product_template,sf_base.group_sale_director,1,1,1,0
|
access_product_template_group_sale_director,product_template_group_sale_director,product.model_product_template,sf_base.group_sale_director,1,1,1,0
|
||||||
access_product_template_group_purchase,product_template_group_purchase,product.model_product_template,sf_base.group_purchase,1,0,0,0
|
access_product_template_group_purchase,product_template_group_purchase,product.model_product_template,sf_base.group_purchase,1,0,0,0
|
||||||
access_product_template_group_purchase_director,product_template_group_purchase_director,product.model_product_template,sf_base.group_purchase_director,1,1,1,0
|
access_product_template_group_purchase_director,product_template_group_purchase_director,product.model_product_template,sf_base.group_purchase_director,1,1,1,0
|
||||||
@@ -20,8 +20,8 @@ access_product_template_group_plan_dispatch,product_template_group_plan_dispatch
|
|||||||
access_product_template_group_plan_director,product_template_group_plan_director,product.model_product_template,sf_base.group_plan_director,1,1,1,0
|
access_product_template_group_plan_director,product_template_group_plan_director,product.model_product_template,sf_base.group_plan_director,1,1,1,0
|
||||||
access_stock_picking_group_sale_salemanager,stock_picking_group_sale_salemanager,stock.model_stock_picking,sf_base.group_sale_salemanager,1,0,0,0
|
access_stock_picking_group_sale_salemanager,stock_picking_group_sale_salemanager,stock.model_stock_picking,sf_base.group_sale_salemanager,1,0,0,0
|
||||||
access_stock_picking_group_sale_director,stock_picking_group_sale_director,stock.model_stock_picking,sf_base.group_sale_director,1,0,0,0
|
access_stock_picking_group_sale_director,stock_picking_group_sale_director,stock.model_stock_picking,sf_base.group_sale_director,1,0,0,0
|
||||||
access_stock_picking_group_purchase,stock_picking_group_purchase,stock.model_stock_picking,sf_base.group_purchase,1,0,0,0
|
access_stock_picking_group_purchase,stock_picking_group_purchase,stock.model_stock_picking,sf_base.group_purchase,1,1,1,0
|
||||||
access_stock_picking_group_purchase_director,stock_picking_group_purchase_director,stock.model_stock_picking,sf_base.group_purchase_director,1,0,0,0
|
access_stock_picking_group_purchase_director,stock_picking_group_purchase_director,stock.model_stock_picking,sf_base.group_purchase_director,1,1,1,0
|
||||||
access_account_move_group_sale_salemanager,account_move_group_sale_salemanager,account.model_account_move,sf_base.group_sale_salemanager,1,0,0,0
|
access_account_move_group_sale_salemanager,account_move_group_sale_salemanager,account.model_account_move,sf_base.group_sale_salemanager,1,0,0,0
|
||||||
access_account_move_group_sale_director,account_move_group_sale_director,account.model_account_move,sf_base.group_sale_director,1,0,0,0
|
access_account_move_group_sale_director,account_move_group_sale_director,account.model_account_move,sf_base.group_sale_director,1,0,0,0
|
||||||
access_resource_resource_group_sale_director,resource_resource_group_sale_director,resource.model_resource_resource,sf_base.group_sale_director,1,1,1,0
|
access_resource_resource_group_sale_director,resource_resource_group_sale_director,resource.model_resource_resource,sf_base.group_sale_director,1,1,1,0
|
||||||
@@ -33,8 +33,8 @@ access_mrp_bom_group_quality,mrp_bom_group_quality,mrp.model_mrp_bom,sf_base.gro
|
|||||||
access_mrp_bom_group_quality_director,mrp_bom_group_quality_director,mrp.model_mrp_bom,sf_base.group_quality_director,1,0,0,0
|
access_mrp_bom_group_quality_director,mrp_bom_group_quality_director,mrp.model_mrp_bom,sf_base.group_quality_director,1,0,0,0
|
||||||
access_stock_move_group_sale_salemanager,stock_move_group_sale_salemanager,stock.model_stock_move,sf_base.group_sale_salemanager,1,0,0,0
|
access_stock_move_group_sale_salemanager,stock_move_group_sale_salemanager,stock.model_stock_move,sf_base.group_sale_salemanager,1,0,0,0
|
||||||
access_stock_move_group_sale_director,stock_move_group_sale_director,stock.model_stock_move,sf_base.group_sale_director,1,0,0,0
|
access_stock_move_group_sale_director,stock_move_group_sale_director,stock.model_stock_move,sf_base.group_sale_director,1,0,0,0
|
||||||
access_stock_move_group_purchase,stock_move_group_purchase,stock.model_stock_move,sf_base.group_purchase,1,0,0,0
|
access_stock_move_group_purchase,stock_move_group_purchase,stock.model_stock_move,sf_base.group_purchase,1,1,1,0
|
||||||
access_stock_move_group_purchase_director,stock_move_group_purchase_director,stock.model_stock_move,sf_base.group_purchase_director,1,0,0,0
|
access_stock_move_group_purchase_director,stock_move_group_purchase_director,stock.model_stock_move,sf_base.group_purchase_director,1,1,1,0
|
||||||
access_stock_warehouse_orderpoint_group_sale_salemanager,stock_warehouse_orderpoint_group_sale_salemanager,stock.model_stock_warehouse_orderpoint,sf_base.group_sale_salemanager,1,0,0,0
|
access_stock_warehouse_orderpoint_group_sale_salemanager,stock_warehouse_orderpoint_group_sale_salemanager,stock.model_stock_warehouse_orderpoint,sf_base.group_sale_salemanager,1,0,0,0
|
||||||
access_stock_warehouse_orderpoint_group_sale_director,stock_warehouse_orderpoint_group_sale_director,stock.model_stock_warehouse_orderpoint,sf_base.group_sale_director,1,0,0,0
|
access_stock_warehouse_orderpoint_group_sale_director,stock_warehouse_orderpoint_group_sale_director,stock.model_stock_warehouse_orderpoint,sf_base.group_sale_director,1,0,0,0
|
||||||
access_stock_warehouse_orderpoint_group_purchase,stock_warehouse_orderpoint_group_purchase,stock.model_stock_warehouse_orderpoint,sf_base.group_purchase,1,1,0,0
|
access_stock_warehouse_orderpoint_group_purchase,stock_warehouse_orderpoint_group_purchase,stock.model_stock_warehouse_orderpoint,sf_base.group_purchase,1,1,0,0
|
||||||
|
|||||||
|
@@ -11,14 +11,14 @@
|
|||||||
</field>
|
</field>
|
||||||
<field name="currency_id" position="after">
|
<field name="currency_id" position="after">
|
||||||
<field name="check_status" invisible="1"/>
|
<field name="check_status" invisible="1"/>
|
||||||
<!-- <field name="state"/>-->
|
<!-- <field name="state"/>-->
|
||||||
<field name="remark" attrs="{'readonly': ['&',('state', 'in', ['purchase']),('check_status','in',
|
<field name="remark" attrs="{'readonly': ['&',('state', 'in', ['purchase']),('check_status','in',
|
||||||
['pending','approved'])]}"/>
|
['pending','approved'])]}"/>
|
||||||
</field>
|
</field>
|
||||||
<xpath expr="//form/header/button[@name='action_rfq_send'][1]" position="after">
|
<xpath expr="//form/header/button[@name='action_rfq_send'][1]" position="after">
|
||||||
<button name="sf_sale.action_purchase_order_check_wizard" string="审核" type="action"
|
<button name="sf_sale.action_purchase_order_check_wizard" string="审核" type="action"
|
||||||
context="{'default_order_id':active_id}" groups="sf_base.group_purchase_director"
|
context="{'default_order_id':active_id}" groups="sf_base.group_purchase_director"
|
||||||
attrs="{'invisible': ['&',('check_status','in', ['approved',False]),('state', 'in', ['purchase'])]}"
|
attrs="{'invisible': ['&',('check_status','in', ['approved',False,'fail']),('state', 'in', ['purchase'])]}"
|
||||||
class="oe_highlight"/>
|
class="oe_highlight"/>
|
||||||
|
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|||||||
@@ -84,7 +84,7 @@
|
|||||||
<xpath expr="//form/header/button[@name='action_confirm'][2]" position="replace">
|
<xpath expr="//form/header/button[@name='action_confirm'][2]" position="replace">
|
||||||
<button name="action_confirm" data-hotkey="v"
|
<button name="action_confirm" data-hotkey="v"
|
||||||
string="确认" type="object" context="{'validate_analytic': True}"
|
string="确认" type="object" context="{'validate_analytic': True}"
|
||||||
attrs="{'invisible': ['|','&',('check_status', '!=', 'approved'),('state', 'in', ['draft','cancel']),'&',('check_status', '=', 'approved'),('state', 'in', ['sale','cancel'])]}"/>
|
attrs="{'invisible': ['|','&',('check_status', '!=', 'approved'),('state', 'in', ['draft','cancel']),'&','&',('check_status', '=', 'approved'),('state', 'in', ['sale','cancel']),('schedule_status', 'not in', False)]}"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//form/header/button[@name='action_cancel']" position="attributes">
|
<xpath expr="//form/header/button[@name='action_cancel']" position="attributes">
|
||||||
<attribute name="attrs">{'invisible': ['|',('state', 'in', ['cancel']),('check_status', 'in',
|
<attribute name="attrs">{'invisible': ['|',('state', 'in', ['cancel']),('check_status', 'in',
|
||||||
@@ -237,6 +237,9 @@
|
|||||||
<field name="model">product.template</field>
|
<field name="model">product.template</field>
|
||||||
<field name="inherit_id" ref="sale.product_template_form_view"/>
|
<field name="inherit_id" ref="sale.product_template_form_view"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
|
<form position="attributes">
|
||||||
|
<attribute name="delete">False</attribute>
|
||||||
|
</form>
|
||||||
<field name="categ_id" position="replace">
|
<field name="categ_id" position="replace">
|
||||||
<field name='categ_id' invisible="1"/>
|
<field name='categ_id' invisible="1"/>
|
||||||
</field>
|
</field>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
# -*-coding:utf-8-*-
|
# -*-coding:utf-8-*-
|
||||||
from . import models
|
from . import models
|
||||||
from . import wizard
|
from . import wizard
|
||||||
|
from . import controllers
|
||||||
from odoo import api, SUPERUSER_ID
|
from odoo import api, SUPERUSER_ID
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
'security/ir.model.access.csv',
|
'security/ir.model.access.csv',
|
||||||
'wizard/wizard_view.xml',
|
'wizard/wizard_view.xml',
|
||||||
'views/tool_base_views.xml',
|
'views/tool_base_views.xml',
|
||||||
|
'views/sf_maintenance_equipment.xml',
|
||||||
'views/menu_view.xml',
|
'views/menu_view.xml',
|
||||||
'views/tool_material_search.xml',
|
'views/tool_material_search.xml',
|
||||||
],
|
],
|
||||||
|
|||||||
1
sf_tool_management/controllers/__init__.py
Normal file
1
sf_tool_management/controllers/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
from . import controllers
|
||||||
56
sf_tool_management/controllers/controllers.py
Normal file
56
sf_tool_management/controllers/controllers.py
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import logging
|
||||||
|
import json
|
||||||
|
import base64
|
||||||
|
from odoo import http
|
||||||
|
from odoo.http import request
|
||||||
|
|
||||||
|
|
||||||
|
class Manufacturing_Connect(http.Controller):
|
||||||
|
|
||||||
|
@http.route('/AutoDeviceApi/FeedBackOut', type='json', auth='sf_token', methods=['GET', 'POST'], csrf=False,
|
||||||
|
cors="*")
|
||||||
|
def get_equipment_tool_Info(self, **kw):
|
||||||
|
"""
|
||||||
|
机床当前刀库实时信息
|
||||||
|
:param kw:
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
logging.info('get_equipment_tool_Info:%s' % kw)
|
||||||
|
try:
|
||||||
|
datas = request.httprequest.data
|
||||||
|
ret = json.loads(datas)
|
||||||
|
ret = json.loads(ret['result'])
|
||||||
|
logging.info('DeviceId:%s' % ret)
|
||||||
|
equipment = request.env['maintenance.equipment'].sudo().search([('name', '=', ret['DeviceId'])])
|
||||||
|
|
||||||
|
res = {'Succeed': True, 'Datas': []}
|
||||||
|
if equipment:
|
||||||
|
for item in equipment:
|
||||||
|
data = []
|
||||||
|
for equipment_tool_id in item.product_template_ids:
|
||||||
|
functional_tool_id = self.env['sf.functional.cutting.tool.entity'].sudo().search(
|
||||||
|
[('code', '=', equipment_tool_id.tool_code)])
|
||||||
|
alarm_time = None
|
||||||
|
if functional_tool_id.functional_tool_status == '报警':
|
||||||
|
alarm_time = self.env['sf.functional.tool.warning'].sudo().search(
|
||||||
|
[('code', '=', equipment_tool_id.tool_code)]).alarm_time
|
||||||
|
equipment_tool = {
|
||||||
|
'RfidCode': None,
|
||||||
|
'ToolId': equipment_tool_id.code,
|
||||||
|
'ToolName': equipment_tool_id.functional_tool_name_id.name,
|
||||||
|
'MaxLife': equipment_tool_id.life_value_max,
|
||||||
|
'UseLife': equipment_tool_id.used_value,
|
||||||
|
'AddDatetime': equipment_tool_id.tool_install_time,
|
||||||
|
'State': functional_tool_id.functional_tool_status,
|
||||||
|
'WarnDate': alarm_time if alarm_time else False
|
||||||
|
}
|
||||||
|
data.append(equipment_tool)
|
||||||
|
res['Datas'].append({
|
||||||
|
'DeviceId': item.name,
|
||||||
|
'Data': data
|
||||||
|
})
|
||||||
|
except Exception as e:
|
||||||
|
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
|
||||||
|
logging.info('get_equipment_tool_Info error:%s' % e)
|
||||||
|
return json.JSONEncoder().encode(res)
|
||||||
@@ -1,9 +1,12 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import re
|
import re
|
||||||
|
import json
|
||||||
|
import requests
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from odoo import fields, models, api
|
|
||||||
from odoo import SUPERUSER_ID
|
from odoo import SUPERUSER_ID
|
||||||
|
from odoo import fields, models, api
|
||||||
from odoo.exceptions import ValidationError
|
from odoo.exceptions import ValidationError
|
||||||
|
from odoo.addons.sf_base.commons.common import Common
|
||||||
|
|
||||||
|
|
||||||
class FunctionalCuttingToolEntity(models.Model):
|
class FunctionalCuttingToolEntity(models.Model):
|
||||||
@@ -174,6 +177,34 @@ class FunctionalCuttingToolEntity(models.Model):
|
|||||||
('coarse_middle_thin', '=', self.coarse_middle_thin)]
|
('coarse_middle_thin', '=', self.coarse_middle_thin)]
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
# ==========刀具组接口==========
|
||||||
|
def _register_functional_tool_groups(self, obj):
|
||||||
|
create_url = '/AutoDeviceApi/FeedBackOut'
|
||||||
|
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(obj, token, sf_secret_key)
|
||||||
|
strurl = sf_sync_config['sf_url'] + create_url
|
||||||
|
val = {
|
||||||
|
'ToolName': obj.name,
|
||||||
|
'GroupName': obj.tool_groups_id.name,
|
||||||
|
'ToolId': obj.code
|
||||||
|
}
|
||||||
|
kw = json.dumps(val, ensure_ascii=False)
|
||||||
|
r = requests.post(strurl, json={}, data={'kw': kw, 'token': token}, headers=headers)
|
||||||
|
ret = r.json()
|
||||||
|
if r == 200:
|
||||||
|
return "刀具组发送成功"
|
||||||
|
else:
|
||||||
|
raise ValidationError("刀具组发送失败")
|
||||||
|
|
||||||
|
# @api.model_create_multi
|
||||||
|
# def create(self, vals):
|
||||||
|
# obj = super(FunctionalCuttingToolEntity, self).create(vals)
|
||||||
|
# # 调用刀具组接口
|
||||||
|
# self._register_functional_tool_groups(obj)
|
||||||
|
# return obj
|
||||||
|
|
||||||
|
|
||||||
class FunctionalToolWarning(models.Model):
|
class FunctionalToolWarning(models.Model):
|
||||||
_name = 'sf.functional.tool.warning'
|
_name = 'sf.functional.tool.warning'
|
||||||
@@ -240,7 +271,7 @@ class FunctionalToolWarning(models.Model):
|
|||||||
class StockMoveLine(models.Model):
|
class StockMoveLine(models.Model):
|
||||||
_inherit = 'stock.move.line'
|
_inherit = 'stock.move.line'
|
||||||
_description = '功能刀具出入库记录'
|
_description = '功能刀具出入库记录'
|
||||||
_order = 'install_tool_time desc'
|
_order = 'date desc'
|
||||||
|
|
||||||
functional_tool_name_id = fields.Many2one('sf.functional.tool.assembly', string='功能刀具名称')
|
functional_tool_name_id = fields.Many2one('sf.functional.tool.assembly', string='功能刀具名称')
|
||||||
functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', store=True,
|
functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', store=True,
|
||||||
@@ -594,16 +625,16 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
|
|||||||
_name = 'sf.cam.work.order.program.knife.plan'
|
_name = 'sf.cam.work.order.program.knife.plan'
|
||||||
_description = 'CAM工单程序用刀计划'
|
_description = 'CAM工单程序用刀计划'
|
||||||
|
|
||||||
name = fields.Char(string='工单任务编号', readonly=False)
|
name = fields.Char('工单任务编号')
|
||||||
cam_procedure_code = fields.Char(string='CAM程序编号', readonly=False)
|
cam_procedure_code = fields.Char('程序名')
|
||||||
cam_cutter_spacing_code = fields.Char(string='CAM刀位号', readonly=False)
|
filename = fields.Char('文件')
|
||||||
|
cam_cutter_spacing_code = fields.Char('刀号')
|
||||||
tool_position_interface_type = fields.Selection(
|
tool_position_interface_type = fields.Selection(
|
||||||
[('BT刀柄式', 'BT刀柄式'), ('SK刀柄式', 'SK刀柄式'), ('HSK刀柄式', 'HSK刀柄式'),
|
[('BT刀柄式', 'BT刀柄式'), ('SK刀柄式', 'SK刀柄式'), ('HSK刀柄式', 'HSK刀柄式'),
|
||||||
('CAT刀柄式', 'CAT刀柄式'), ('ISO刀盘式', 'ISO刀盘式'), ('DIN刀盘式', 'DIN刀盘式'),
|
('CAT刀柄式', 'CAT刀柄式'), ('ISO刀盘式', 'ISO刀盘式'), ('DIN刀盘式', 'DIN刀盘式'),
|
||||||
('直装固定式', '直装固定式')], string='刀位接口型号')
|
('直装固定式', '直装固定式')], string='刀位接口型号')
|
||||||
production_line_id = fields.Many2one('sf.production.line', string='生产线', readonly=False,
|
production_line_id = fields.Many2one('sf.production.line', string='生产线', group_expand='_read_group_names')
|
||||||
group_expand='_read_group_names')
|
machine_table_name_id = fields.Many2one('maintenance.equipment', string='机床名称',
|
||||||
machine_table_name_id = fields.Many2one('maintenance.equipment', string='机床名称', readonly=False,
|
|
||||||
domain="[('production_line_id', '=', production_line_id)]")
|
domain="[('production_line_id', '=', production_line_id)]")
|
||||||
machine_table_name = fields.Char(string='机台号', readonly=True, related='machine_table_name_id.name')
|
machine_table_name = fields.Char(string='机台号', readonly=True, related='machine_table_name_id.name')
|
||||||
cutter_spacing_code_id = fields.Many2one('maintenance.equipment.tool', string='刀位号', required=True,
|
cutter_spacing_code_id = fields.Many2one('maintenance.equipment.tool', string='刀位号', required=True,
|
||||||
@@ -616,8 +647,9 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
|
|||||||
|
|
||||||
barcode_id = fields.Many2one('stock.lot', string='功能刀具序列号',
|
barcode_id = fields.Many2one('stock.lot', string='功能刀具序列号',
|
||||||
domain=[('product_id.name', '=', '功能刀具')])
|
domain=[('product_id.name', '=', '功能刀具')])
|
||||||
functional_tool_name = fields.Char(string='功能刀具名称', required=True)
|
functional_tool_name = fields.Char(string='功能刀具名称', compute='_compute_functional_tool_name')
|
||||||
functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=False)
|
functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=False)
|
||||||
|
tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组')
|
||||||
diameter = fields.Integer(string='刀具直径(mm)', readonly=False)
|
diameter = fields.Integer(string='刀具直径(mm)', readonly=False)
|
||||||
tool_included_angle = fields.Float(string='刀尖R角(mm)', readonly=False)
|
tool_included_angle = fields.Float(string='刀尖R角(mm)', readonly=False)
|
||||||
tool_loading_length = fields.Float(string='总长度(mm)', readonly=False)
|
tool_loading_length = fields.Float(string='总长度(mm)', readonly=False)
|
||||||
@@ -629,12 +661,28 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
|
|||||||
L_D = fields.Float(string='L/D值', readonly=False)
|
L_D = fields.Float(string='L/D值', readonly=False)
|
||||||
clearance_length = fields.Float(string='避空长(mm)', readonly=False)
|
clearance_length = fields.Float(string='避空长(mm)', readonly=False)
|
||||||
required_cutting_time = fields.Integer(string='需切削时长', readonly=False)
|
required_cutting_time = fields.Integer(string='需切削时长', readonly=False)
|
||||||
|
process_type = fields.Char('加工类型')
|
||||||
|
margin_x_y = fields.Float('余量_X/Y')
|
||||||
|
margin_z = fields.Float('余量_Z')
|
||||||
|
finish_depth = fields.Float('加工深度')
|
||||||
|
shank_model = fields.Char('刀柄型号')
|
||||||
|
estimated_processing_time = fields.Char('预计加工时间')
|
||||||
|
|
||||||
plan_execute_status = fields.Selection([('0', '待下发'), ('1', '执行中'), ('2', '已完成')],
|
plan_execute_status = fields.Selection([('0', '待下发'), ('1', '执行中'), ('2', '已完成')],
|
||||||
string='计划执行状态', default='0', readonly=False)
|
string='计划执行状态', default='0', readonly=False)
|
||||||
|
|
||||||
sf_functional_tool_assembly_id = fields.Many2one('sf.functional.tool.assembly', '功能刀具组装', readonly=True)
|
sf_functional_tool_assembly_id = fields.Many2one('sf.functional.tool.assembly', '功能刀具组装', readonly=True)
|
||||||
|
|
||||||
|
@api.depends('diameter', 'tool_included_angle', 'tool_groups_id')
|
||||||
|
def _compute_functional_tool_name(self):
|
||||||
|
for obj in self:
|
||||||
|
if obj.tool_groups_id:
|
||||||
|
obj.functional_tool_name = '%s-D%sR%s' % (
|
||||||
|
obj.tool_groups_id.name, obj.diameter,
|
||||||
|
obj.tool_included_angle)
|
||||||
|
else:
|
||||||
|
obj.functional_tool_name = None
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _read_group_names(self, categories, domain, order):
|
def _read_group_names(self, categories, domain, order):
|
||||||
names = categories._search([], order=order, access_rights_uid=SUPERUSER_ID)
|
names = categories._search([], order=order, access_rights_uid=SUPERUSER_ID)
|
||||||
@@ -646,27 +694,34 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
|
|||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
record = self.env['sf.functional.tool.assembly'].create({
|
record = self.env['sf.functional.tool.assembly'].create({
|
||||||
'barcode_id': self.barcode_id.id,
|
'functional_tool_name': self.functional_tool_name,
|
||||||
'functional_tool_name_id': self.functional_tool_name_id.id,
|
|
||||||
'functional_tool_type_id': self.functional_tool_type_id.id,
|
'functional_tool_type_id': self.functional_tool_type_id.id,
|
||||||
|
'tool_groups_id': self.tool_groups_id.id,
|
||||||
'functional_tool_diameter': self.diameter,
|
'functional_tool_diameter': self.diameter,
|
||||||
'functional_tool_length': self.tool_loading_length,
|
'knife_tip_r_angle': self.tool_included_angle,
|
||||||
'loading_task_source': '0',
|
'tool_loading_length': self.tool_loading_length,
|
||||||
'coarse_middle_thin': None,
|
'functional_tool_length': self.extension_length,
|
||||||
'tool_loading_length': None,
|
'effective_length': self.effective_length,
|
||||||
'applicant': self.env.user.name,
|
'whether_standard_knife': self.whether_standard_knife,
|
||||||
'reason_for_applying': self.reason_for_applying,
|
'coarse_middle_thin': self.coarse_middle_thin,
|
||||||
'use_tool_time': self.need_knife_time,
|
'new_former': self.new_former,
|
||||||
|
'production_line_name_id': self.production_line_id.id,
|
||||||
'machine_tool_name_id': self.machine_table_name_id.id,
|
'machine_tool_name_id': self.machine_table_name_id.id,
|
||||||
'machine_tool_code': self.cam_procedure_code,
|
'cutter_spacing_code_id': self.env['maintenance.equipment.tool'].sudo().search(
|
||||||
'cutter_spacing_code': self.cam_cutter_spacing_code,
|
[('code', '=', self.cam_cutter_spacing_code), ('equipment_id', '=', self.machine_table_name_id.id)]).id,
|
||||||
|
|
||||||
|
'loading_task_source': '0',
|
||||||
|
'applicant': self.env.user.name,
|
||||||
|
'use_tool_time': self.need_knife_time,
|
||||||
|
'reason_for_applying': '工单用刀',
|
||||||
|
|
||||||
'sf_cam_work_order_program_knife_plan_id': self.id
|
'sf_cam_work_order_program_knife_plan_id': self.id
|
||||||
})
|
})
|
||||||
self.sf_functional_tool_assembly_id = record.id
|
self.sf_functional_tool_assembly_id = record.id
|
||||||
|
|
||||||
# 将计划执行状态改为执行中
|
# 将计划执行状态改为执行中
|
||||||
self.env['sf.cam.work.order.program.knife.plan'].search(
|
self.env['sf.cam.work.order.program.knife.plan'].search(
|
||||||
[('barcode_id', '=', self.barcode_id.id)]).write(
|
[('name', '=', self.name), ('functional_tool_name', '=', self.functional_tool_name)]).write(
|
||||||
{'plan_execute_status': '1',
|
{'plan_execute_status': '1',
|
||||||
'applicant': self.env.user.name})
|
'applicant': self.env.user.name})
|
||||||
|
|
||||||
@@ -676,16 +731,50 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
|
|||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
self.env['sf.functional.tool.assembly'].search(
|
self.env['sf.functional.tool.assembly'].search(
|
||||||
[('barcode_id', '=', self.barcode_id.id),
|
[('assembly_order_code', '=', self.sf_functional_tool_assembly_id.assembly_order_code),
|
||||||
('loading_task_source', '=', '0')]).unlink()
|
('loading_task_source', '=', '0')]).unlink()
|
||||||
|
|
||||||
# 将计划执行状态改为待执行,同时清除申请人、功能刀具组装字段数据
|
# 将计划执行状态改为待执行,同时清除申请人、功能刀具组装字段数据
|
||||||
self.env['sf.cam.work.order.program.knife.plan'].search(
|
self.env['sf.cam.work.order.program.knife.plan'].search(
|
||||||
[('barcode_id', '=', self.barcode_id.id)]).write(
|
[('name', '=', self.name), ('functional_tool_name', '=', self.functional_tool_name)]).write(
|
||||||
{'plan_execute_status': '0',
|
{'plan_execute_status': '0',
|
||||||
'applicant': None,
|
'applicant': None,
|
||||||
'sf_functional_tool_assembly_id': None})
|
'sf_functional_tool_assembly_id': None})
|
||||||
|
|
||||||
|
def create_cam_work_plan(self, cnc_processing):
|
||||||
|
"""
|
||||||
|
根据传入的工单信息,查询是否有需要的功能刀具,如果没有则生成CAM工单程序用刀计划
|
||||||
|
"""
|
||||||
|
status = False
|
||||||
|
if cnc_processing.functional_tool_type_id and cnc_processing.cutting_tool_name:
|
||||||
|
functional_tools = self.env['sf.real.time.distribution.of.functional.tools'].sudo().search(
|
||||||
|
[('sf_cutting_tool_type_id', '=', cnc_processing.functional_tool_type_id.id),
|
||||||
|
('name', '=', cnc_processing.cutting_tool_name)])
|
||||||
|
if functional_tools:
|
||||||
|
for functional_tool in functional_tools:
|
||||||
|
if functional_tool.on_tool_stock_num == 0:
|
||||||
|
# self.env['sf.cnc.processing'].register_cnc_processing(cnc_processing)
|
||||||
|
if functional_tool.tool_stock_num == 0 and functional_tool.side_shelf_num == 0:
|
||||||
|
status = True
|
||||||
|
else:
|
||||||
|
status = True
|
||||||
|
if status:
|
||||||
|
self.env['sf.cam.work.order.program.knife.plan'].sudo().create({
|
||||||
|
'name': cnc_processing.workorder_id.production_id.name,
|
||||||
|
'cam_procedure_code': cnc_processing.program_name,
|
||||||
|
'filename': cnc_processing.cnc_id.name,
|
||||||
|
'functional_tool_type_id': cnc_processing.functional_tool_type_id.id,
|
||||||
|
'functional_tool_name': cnc_processing.cutting_tool_name,
|
||||||
|
'cam_cutter_spacing_code': cnc_processing.cutting_tool_no,
|
||||||
|
'process_type': cnc_processing.processing_type,
|
||||||
|
'margin_x_y': float(cnc_processing.margin_x_y),
|
||||||
|
'margin_z': float(cnc_processing.margin_z),
|
||||||
|
'finish_depth': float(cnc_processing.depth_of_processing_z),
|
||||||
|
'extension_length': float(cnc_processing.cutting_tool_extension_length),
|
||||||
|
'shank_model': cnc_processing.cutting_tool_handle_type,
|
||||||
|
'estimated_processing_time': cnc_processing.estimated_processing_time,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
class FunctionalToolAssembly(models.Model):
|
class FunctionalToolAssembly(models.Model):
|
||||||
_name = 'sf.functional.tool.assembly'
|
_name = 'sf.functional.tool.assembly'
|
||||||
|
|||||||
@@ -1,9 +1,22 @@
|
|||||||
from odoo import models, api
|
from odoo import models, api, fields
|
||||||
|
|
||||||
|
|
||||||
class SfMaintenanceEquipmentTool(models.Model):
|
class SfMaintenanceEquipmentTool(models.Model):
|
||||||
_inherit = 'maintenance.equipment.tool'
|
_inherit = 'maintenance.equipment.tool'
|
||||||
|
|
||||||
|
functional_tool_name_id = fields.Many2one('sf.functional.cutting.tool.entity', '功能刀具名称')
|
||||||
|
|
||||||
|
image = fields.Binary('图片', related='functional_tool_name_id.image')
|
||||||
|
tool_code = fields.Char('功能刀具编码', related='functional_tool_name_id.code')
|
||||||
|
functional_tool_type = fields.Char('功能刀具类型', related='functional_tool_name_id.sf_cutting_tool_type_id.name')
|
||||||
|
tool_groups = fields.Char('刀具组', related='functional_tool_name_id.tool_groups_id.name')
|
||||||
|
diameter = fields.Integer('直径(mm)', related='functional_tool_name_id.functional_tool_diameter')
|
||||||
|
knife_tip_r_angle = fields.Float('刀尖R角(mm)', related='functional_tool_name_id.knife_tip_r_angle')
|
||||||
|
life_value_max = fields.Integer('最大寿命值(min)', related='functional_tool_name_id.max_lifetime_value')
|
||||||
|
alarm_value = fields.Integer('报警值(min)', related='functional_tool_name_id.alarm_value')
|
||||||
|
used_value = fields.Integer('已使用值(min)', related='functional_tool_name_id.used_value')
|
||||||
|
tool_install_time = fields.Datetime('机内装刀时间')
|
||||||
|
|
||||||
@api.model_create_multi
|
@api.model_create_multi
|
||||||
def create(self, vals_list):
|
def create(self, vals_list):
|
||||||
tools = super().create(vals_list)
|
tools = super().create(vals_list)
|
||||||
|
|||||||
38
sf_tool_management/models/mrp_workorder.py
Normal file
38
sf_tool_management/models/mrp_workorder.py
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
import json
|
||||||
|
import requests
|
||||||
|
from odoo import fields, models, api
|
||||||
|
from odoo.exceptions import ValidationError
|
||||||
|
from odoo.addons.sf_base.commons.common import Common
|
||||||
|
|
||||||
|
|
||||||
|
class CNCprocessing(models.Model):
|
||||||
|
_inherit = 'sf.cnc.processing'
|
||||||
|
_description = 'CNC加工用刀检测'
|
||||||
|
|
||||||
|
# ==========MES装刀指令接口==========
|
||||||
|
def register_cnc_processing(self, cnc_processing):
|
||||||
|
create_url = '/AutoDeviceApi/FeedBackOut'
|
||||||
|
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
|
||||||
|
val = {
|
||||||
|
'DeviceId': cnc_processing.workorder_id.machine_tool_name,
|
||||||
|
'RfidCode': None,
|
||||||
|
'ToolId': cnc_processing.cutting_tool_no
|
||||||
|
}
|
||||||
|
kw = json.dumps(val, ensure_ascii=False)
|
||||||
|
r = requests.post(strurl, json={}, data={'kw': kw, 'token': token}, headers=headers)
|
||||||
|
ret = r.json()
|
||||||
|
if r == 200:
|
||||||
|
return "MES装刀指令发送成功"
|
||||||
|
else:
|
||||||
|
raise ValidationError("MES装刀指令发送失败")
|
||||||
|
|
||||||
|
@api.model_create_multi
|
||||||
|
def create(self, vals):
|
||||||
|
obj = super(CNCprocessing, self).create(vals)
|
||||||
|
# 调用CAM工单程序用刀计划创建方法
|
||||||
|
self.env['sf.cam.work.order.program.knife.plan'].create_cam_work_plan(obj)
|
||||||
|
return obj
|
||||||
32
sf_tool_management/views/sf_maintenance_equipment.xml
Normal file
32
sf_tool_management/views/sf_maintenance_equipment.xml
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<odoo>
|
||||||
|
<!-- 设备增加刀具库位table-->
|
||||||
|
<record id="sf_maintenance_equipment_tool_view_form" model="ir.ui.view">
|
||||||
|
<field name="name">sf_manufacturing_equipment.form</field>
|
||||||
|
<field name="model">maintenance.equipment</field>
|
||||||
|
<field name="inherit_id" ref="sf_manufacturing.sf_manufacturing_hr_equipment_view_form"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//page[@name='sf_equipment_product_template']" position="replace">
|
||||||
|
<page string="标准刀库" name="sf_equipment_product_template"
|
||||||
|
attrs="{'invisible': [('equipment_type', '!=', '机床')]}">
|
||||||
|
<field name='product_template_ids'>
|
||||||
|
<tree editable='bottom'>
|
||||||
|
<field name="code"/>
|
||||||
|
<field name="tool_code"/>
|
||||||
|
<field name="functional_tool_type"/>
|
||||||
|
<field name="functional_tool_name_id"/>
|
||||||
|
<field name="image" widget="image"/>
|
||||||
|
<field name="tool_groups"/>
|
||||||
|
<field name="diameter"/>
|
||||||
|
<field name="knife_tip_r_angle"/>
|
||||||
|
<field name="life_value_max"/>
|
||||||
|
<field name="alarm_value"/>
|
||||||
|
<field name="used_value"/>
|
||||||
|
<field name="tool_install_time"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</page>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</odoo>
|
||||||
@@ -756,21 +756,29 @@
|
|||||||
<tree>
|
<tree>
|
||||||
<field name="name" string="工单编码"/>
|
<field name="name" string="工单编码"/>
|
||||||
<field name="cam_procedure_code"/>
|
<field name="cam_procedure_code"/>
|
||||||
|
<field name="filename"/>
|
||||||
|
<field name="functional_tool_name" string="刀具名称"/>
|
||||||
<field name="cam_cutter_spacing_code"/>
|
<field name="cam_cutter_spacing_code"/>
|
||||||
|
<field name="diameter" optional="hide"/>
|
||||||
|
<field name="tool_included_angle" optional="hide"/>
|
||||||
|
<field name="process_type"/>
|
||||||
|
<field name="margin_x_y"/>
|
||||||
|
<field name="margin_z"/>
|
||||||
|
<field name="finish_depth"/>
|
||||||
|
<field name="extension_length" string="刀具伸出长度(mm)"/>
|
||||||
|
<field name="shank_model"/>
|
||||||
|
<field name="estimated_processing_time"/>
|
||||||
|
<field name="need_knife_time"/>
|
||||||
|
<field name="applicant_time"/>
|
||||||
|
<field name="plan_execute_status"/>
|
||||||
|
|
||||||
<field name="production_line_id" invisible="1"/>
|
<field name="production_line_id" invisible="1"/>
|
||||||
<field name="machine_table_name_id" invisible="1"/>
|
<field name="machine_table_name_id" invisible="1"/>
|
||||||
<field name="machine_table_name"/>
|
<field name="machine_table_name" invisible="1"/>
|
||||||
<field name="functional_tool_name"/>
|
<button string="申请装刀" name="apply_for_tooling" type="object" class="btn-primary"
|
||||||
<field name="diameter"/>
|
attrs="{'invisible': [('plan_execute_status', '!=', '0')]}" confirm="是否确认申请装刀"/>
|
||||||
<field name="tool_included_angle"/>
|
<button string="撤回" name="revocation" type="object" class="btn-primary"
|
||||||
<field name="need_knife_time"/>
|
attrs="{'invisible': [('plan_execute_status', '!=', '1')]}" confirm="是否确认撤回装刀"/>
|
||||||
<field name="applicant"/>
|
|
||||||
<field name="applicant_time"/>
|
|
||||||
<field name="plan_execute_status" invisible="0"/>
|
|
||||||
<!-- <button string="申请装刀" name="apply_for_tooling" type="object" class="btn-primary"-->
|
|
||||||
<!-- attrs="{'invisible': [('plan_execute_status', '!=', '0')]}" confirm="是否确认申请装刀"/>-->
|
|
||||||
<!-- <button string="撤回" name="revocation" type="object" class="btn-primary"-->
|
|
||||||
<!-- attrs="{'invisible': [('plan_execute_status', '!=', '1')]}" confirm="是否确认撤回装刀"/>-->
|
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
@@ -780,13 +788,13 @@
|
|||||||
<field name="model">sf.cam.work.order.program.knife.plan</field>
|
<field name="model">sf.cam.work.order.program.knife.plan</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form>
|
<form>
|
||||||
<!-- <header>-->
|
<header>
|
||||||
<!-- <button string="申请装刀" name="apply_for_tooling" type="object" class="btn-primary"-->
|
<button string="申请装刀" name="apply_for_tooling" type="object" class="btn-primary"
|
||||||
<!-- attrs="{'invisible': [('plan_execute_status', '!=', '0')]}" confirm="是否确认申请装刀"/>-->
|
attrs="{'invisible': [('plan_execute_status', '!=', '0')]}" confirm="是否确认申请装刀"/>
|
||||||
<!-- <button string="撤回" name="revocation" type="object" class="btn-primary"-->
|
<button string="撤回" name="revocation" type="object" class="btn-primary"
|
||||||
<!-- attrs="{'invisible': [('plan_execute_status', '!=', '1')]}" confirm="是否确认撤回装刀"/>-->
|
attrs="{'invisible': [('plan_execute_status', '!=', '1')]}" confirm="是否确认撤回装刀"/>
|
||||||
<!-- <field name="plan_execute_status" widget="statusbar" statusbar_visible="0,1,2"/>-->
|
<field name="plan_execute_status" widget="statusbar" statusbar_visible="0,1,2"/>
|
||||||
<!-- </header>-->
|
</header>
|
||||||
|
|
||||||
<sheet>
|
<sheet>
|
||||||
<div class="oe_title">
|
<div class="oe_title">
|
||||||
@@ -797,35 +805,48 @@
|
|||||||
<group>
|
<group>
|
||||||
<group>
|
<group>
|
||||||
<field name="cam_procedure_code"/>
|
<field name="cam_procedure_code"/>
|
||||||
|
<field name="filename"/>
|
||||||
|
<field name="production_line_id"/>
|
||||||
|
<field name="machine_table_name_id" string="机台号"/>
|
||||||
<field name="cam_cutter_spacing_code"/>
|
<field name="cam_cutter_spacing_code"/>
|
||||||
<field name="tool_position_interface_type" placeholder="请选择"/>
|
<field name="tool_position_interface_type"/>
|
||||||
<field name="production_line_id" placeholder="请选择"/>
|
|
||||||
<field name="machine_table_name_id" placeholder="请选择"/>
|
|
||||||
<field name="machine_table_name"/>
|
|
||||||
<field name="cutter_spacing_code_id" placeholder="请选择"/>
|
|
||||||
<field name="whether_standard_knife"/>
|
|
||||||
<field name="need_knife_time"/>
|
|
||||||
<field name="applicant"/>
|
|
||||||
<field name="applicant_time"/>
|
|
||||||
<field name="reason_for_applying"/>
|
|
||||||
<field name="sf_functional_tool_assembly_id" string="组装单"/>
|
<field name="sf_functional_tool_assembly_id" string="组装单"/>
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<field name="barcode_id" invisible="1"/>
|
<field name="process_type"/>
|
||||||
<field name="functional_tool_name"/>
|
<field name="margin_x_y"/>
|
||||||
<field name="functional_tool_type_id" placeholder="请选择"/>
|
<field name="margin_z"/>
|
||||||
<field name="diameter"/>
|
<field name="finish_depth"/>
|
||||||
<field name="tool_included_angle"/>
|
<field name="estimated_processing_time"/>
|
||||||
<field name="tool_loading_length"/>
|
<field name="need_knife_time"/>
|
||||||
<field name="extension_length"/>
|
<field name="applicant_time"/>
|
||||||
<field name="effective_length"/>
|
|
||||||
<field name="new_former"/>
|
|
||||||
<field name="coarse_middle_thin"/>
|
|
||||||
<field name="L_D"/>
|
|
||||||
<field name="clearance_length"/>
|
|
||||||
<field name="required_cutting_time"/>
|
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
|
<notebook>
|
||||||
|
<page string="刀具信息">
|
||||||
|
<group>
|
||||||
|
<group>
|
||||||
|
<field name="functional_tool_name"/>
|
||||||
|
<field name="functional_tool_type_id"/>
|
||||||
|
<field name="tool_groups_id"/>
|
||||||
|
<field name="diameter"/>
|
||||||
|
<field name="tool_included_angle"/>
|
||||||
|
<field name="new_former"/>
|
||||||
|
<field name="coarse_middle_thin"/>
|
||||||
|
<field name="whether_standard_knife"/>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<field name="shank_model"/>
|
||||||
|
<field name="tool_loading_length"/>
|
||||||
|
<field name="extension_length"/>
|
||||||
|
<field name="effective_length"/>
|
||||||
|
<field name="required_cutting_time"/>
|
||||||
|
<field name="L_D"/>
|
||||||
|
<field name="clearance_length"/>
|
||||||
|
</group>
|
||||||
|
</group>
|
||||||
|
</page>
|
||||||
|
</notebook>
|
||||||
</sheet>
|
</sheet>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
@@ -837,20 +858,25 @@
|
|||||||
<search>
|
<search>
|
||||||
<field name="name" string="工单编码"/>
|
<field name="name" string="工单编码"/>
|
||||||
<field name="cam_procedure_code"/>
|
<field name="cam_procedure_code"/>
|
||||||
|
<field name="filename"/>
|
||||||
|
<field name="functional_tool_name" string="刀具名称"/>
|
||||||
<field name="cam_cutter_spacing_code"/>
|
<field name="cam_cutter_spacing_code"/>
|
||||||
<field name="machine_table_name_id" invisible="1"/>
|
<field name="diameter" optional="hide"/>
|
||||||
<field name="production_line_id" invisible="1"/>
|
<field name="tool_included_angle" optional="hide"/>
|
||||||
<field name="machine_table_name"/>
|
<field name="process_type"/>
|
||||||
<field name="functional_tool_name"/>
|
<field name="margin_x_y"/>
|
||||||
<field name="diameter"/>
|
<field name="margin_z"/>
|
||||||
<field name="tool_included_angle"/>
|
<field name="finish_depth"/>
|
||||||
|
<field name="extension_length" string="刀具伸出长度(mm)"/>
|
||||||
|
<field name="shank_model"/>
|
||||||
|
<field name="estimated_processing_time"/>
|
||||||
<field name="need_knife_time"/>
|
<field name="need_knife_time"/>
|
||||||
<field name="applicant"/>
|
|
||||||
<field name="applicant_time"/>
|
<field name="applicant_time"/>
|
||||||
<field name="plan_execute_status" invisible="0"/>
|
<field name="plan_execute_status"/>
|
||||||
<searchpanel>
|
<searchpanel>
|
||||||
<field name="production_line_id" string="生产线" enable_counters="1" icon="fa-filter"/>
|
<field name="production_line_id" string="生产线" enable_counters="1" icon="fa-filter"/>
|
||||||
<field name="machine_table_name_id" string="CNC机床" enable_counters="1" icon="fa-filter"/>
|
<field name="functional_tool_type_id" string="功能刀具类型" enable_counters="1"
|
||||||
|
icon="fa-filter"/>
|
||||||
</searchpanel>
|
</searchpanel>
|
||||||
</search>
|
</search>
|
||||||
</field>
|
</field>
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class ToolChangeRequirementInformation(models.TransientModel):
|
|||||||
replacement_tool_setting_length = fields.Float(string='待换刀具总长度(mm)', required=True)
|
replacement_tool_setting_length = fields.Float(string='待换刀具总长度(mm)', required=True)
|
||||||
replacement_extension_length = fields.Float(string='待换刀具伸出长(mm)')
|
replacement_extension_length = fields.Float(string='待换刀具伸出长(mm)')
|
||||||
replacement_effective_length = fields.Float(string='待换刀具有效长(mm)')
|
replacement_effective_length = fields.Float(string='待换刀具有效长(mm)')
|
||||||
replacement_tool_coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], requirded=True,
|
replacement_tool_coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], required=True,
|
||||||
string='待换刀具粗/中/精', default='3')
|
string='待换刀具粗/中/精', default='3')
|
||||||
|
|
||||||
replacement_max_lifetime_value = fields.Integer(string='待换刀具最大寿命值(min)')
|
replacement_max_lifetime_value = fields.Integer(string='待换刀具最大寿命值(min)')
|
||||||
|
|||||||
@@ -567,30 +567,6 @@ class SfPickingType(models.Model):
|
|||||||
self.check_state = 'enable'
|
self.check_state = 'enable'
|
||||||
|
|
||||||
|
|
||||||
class SfProductCategory(models.Model):
|
|
||||||
_inherit = 'product.category'
|
|
||||||
|
|
||||||
check_state = fields.Selection([
|
|
||||||
('enable', '启用'),
|
|
||||||
('close', '关闭')
|
|
||||||
], string='审核状态', default='close')
|
|
||||||
|
|
||||||
def action_check(self):
|
|
||||||
self.check_state = 'enable'
|
|
||||||
|
|
||||||
|
|
||||||
class SfUomCategory(models.Model):
|
|
||||||
_inherit = 'uom.category'
|
|
||||||
|
|
||||||
check_state = fields.Selection([
|
|
||||||
('enable', '启用'),
|
|
||||||
('close', '关闭')
|
|
||||||
], string='审核状态', default='close')
|
|
||||||
|
|
||||||
def action_check(self):
|
|
||||||
self.check_state = 'enable'
|
|
||||||
|
|
||||||
|
|
||||||
class SfBarcodeNomenclature(models.Model):
|
class SfBarcodeNomenclature(models.Model):
|
||||||
_inherit = 'barcode.nomenclature'
|
_inherit = 'barcode.nomenclature'
|
||||||
|
|
||||||
|
|||||||
@@ -9,12 +9,12 @@
|
|||||||
<field name="name" string="名称"/>
|
<field name="name" string="名称"/>
|
||||||
<field name="barcode" string="编码"/>
|
<field name="barcode" string="编码"/>
|
||||||
<field name="location_type"/>
|
<field name="location_type"/>
|
||||||
<field name="check_state" widget="label_selection"
|
<!-- <field name="check_state" widget="label_selection"-->
|
||||||
options="{'classes': {'unchecked':'warning','checked': 'success'}}"/>
|
<!-- options="{'classes': {'unchecked':'warning','checked': 'success'}}"/>-->
|
||||||
<button name="action_check" string="审核" type="object"
|
<!-- <button name="action_check" string="审核" type="object"-->
|
||||||
attrs="{'invisible': [('check_state','=', 'enable')]}"
|
<!-- attrs="{'invisible': [('check_state','=', 'enable')]}"-->
|
||||||
groups="sf_warehouse.group_sf_stock_manager"
|
<!-- groups="sf_warehouse.group_sf_stock_manager"-->
|
||||||
class="oe_highlight"/>
|
<!-- class="oe_highlight"/>-->
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|||||||
@@ -175,17 +175,17 @@
|
|||||||
<!-- sequence="50" -->
|
<!-- sequence="50" -->
|
||||||
<!-- action="kanban_action_id"/> -->
|
<!-- action="kanban_action_id"/> -->
|
||||||
|
|
||||||
<record id="view_location_tree2_sf_inherit" model="ir.ui.view">
|
<!-- <record id="view_location_tree2_sf_inherit" model="ir.ui.view">-->
|
||||||
<field name="name">stock.location.tree.sf.inherit</field>
|
<!-- <field name="name">stock.location.tree.sf.inherit</field>-->
|
||||||
<field name="model">stock.location</field>
|
<!-- <field name="model">stock.location</field>-->
|
||||||
<field name="inherit_id" ref="stock.view_location_tree2"/>
|
<!-- <field name="inherit_id" ref="stock.view_location_tree2"/>-->
|
||||||
<field name="arch" type="xml">
|
<!-- <field name="arch" type="xml">-->
|
||||||
<xpath expr="//field[last()]" position="after">
|
<!-- <xpath expr="//field[last()]" position="after">-->
|
||||||
<field name="check_state" widget="label_selection"
|
<!-- <field name="check_state" widget="label_selection"-->
|
||||||
options="{'classes': {'unchecked':'warning','checked': 'success'}}"/>
|
<!-- options="{'classes': {'unchecked':'warning','checked': 'success'}}"/>-->
|
||||||
</xpath>
|
<!-- </xpath>-->
|
||||||
</field>
|
<!-- </field>-->
|
||||||
</record>
|
<!-- </record>-->
|
||||||
|
|
||||||
<!--仓库根据权限增加审核按钮-->
|
<!--仓库根据权限增加审核按钮-->
|
||||||
<record id="view_warehouse_form_sf_inherit" model="ir.ui.view">
|
<record id="view_warehouse_form_sf_inherit" model="ir.ui.view">
|
||||||
@@ -206,17 +206,17 @@
|
|||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="view_warehouse_tree_sf_inherit" model="ir.ui.view">
|
<!-- <record id="view_warehouse_tree_sf_inherit" model="ir.ui.view">-->
|
||||||
<field name="name">stock.warehouse.tree.sf.inherit</field>
|
<!-- <field name="name">stock.warehouse.tree.sf.inherit</field>-->
|
||||||
<field name="model">stock.warehouse</field>
|
<!-- <field name="model">stock.warehouse</field>-->
|
||||||
<field name="inherit_id" ref="stock.view_warehouse_tree"/>
|
<!-- <field name="inherit_id" ref="stock.view_warehouse_tree"/>-->
|
||||||
<field name="arch" type="xml">
|
<!-- <field name="arch" type="xml">-->
|
||||||
<xpath expr="//field[last()]" position="after">
|
<!-- <xpath expr="//field[last()]" position="after">-->
|
||||||
<field name="check_state" widget="label_selection"
|
<!-- <field name="check_state" widget="label_selection"-->
|
||||||
options="{'classes': {'unchecked':'warning','checked': 'success'}}"/>
|
<!-- options="{'classes': {'unchecked':'warning','checked': 'success'}}"/>-->
|
||||||
</xpath>
|
<!-- </xpath>-->
|
||||||
</field>
|
<!-- </field>-->
|
||||||
</record>
|
<!-- </record>-->
|
||||||
|
|
||||||
|
|
||||||
<!--路线根据权限增加审核按钮-->
|
<!--路线根据权限增加审核按钮-->
|
||||||
@@ -238,17 +238,17 @@
|
|||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="view_route_tree_sf_inherit" model="ir.ui.view">
|
<!-- <record id="view_route_tree_sf_inherit" model="ir.ui.view">-->
|
||||||
<field name="name">stock.route.tree.sf.inherit</field>
|
<!-- <field name="name">stock.route.tree.sf.inherit</field>-->
|
||||||
<field name="model">stock.route</field>
|
<!-- <field name="model">stock.route</field>-->
|
||||||
<field name="inherit_id" ref="stock.stock_location_route_tree"/>
|
<!-- <field name="inherit_id" ref="stock.stock_location_route_tree"/>-->
|
||||||
<field name="arch" type="xml">
|
<!-- <field name="arch" type="xml">-->
|
||||||
<xpath expr="//field[last()]" position="after">
|
<!-- <xpath expr="//field[last()]" position="after">-->
|
||||||
<field name="check_state" widget="label_selection"
|
<!-- <field name="check_state" widget="label_selection"-->
|
||||||
options="{'classes': {'unchecked':'warning','checked': 'success'}}"/>
|
<!-- options="{'classes': {'unchecked':'warning','checked': 'success'}}"/>-->
|
||||||
</xpath>
|
<!-- </xpath>-->
|
||||||
</field>
|
<!-- </field>-->
|
||||||
</record>
|
<!-- </record>-->
|
||||||
|
|
||||||
<!--规则根据权限增加审核按钮-->
|
<!--规则根据权限增加审核按钮-->
|
||||||
<record id="view_rule_form_sf_inherit" model="ir.ui.view">
|
<record id="view_rule_form_sf_inherit" model="ir.ui.view">
|
||||||
@@ -269,17 +269,17 @@
|
|||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="view_rule_tree_sf_inherit" model="ir.ui.view">
|
<!-- <record id="view_rule_tree_sf_inherit" model="ir.ui.view">-->
|
||||||
<field name="name">stock.rule.tree.sf.inherit</field>
|
<!-- <field name="name">stock.rule.tree.sf.inherit</field>-->
|
||||||
<field name="model">stock.rule</field>
|
<!-- <field name="model">stock.rule</field>-->
|
||||||
<field name="inherit_id" ref="stock.view_stock_rule_tree"/>
|
<!-- <field name="inherit_id" ref="stock.view_stock_rule_tree"/>-->
|
||||||
<field name="arch" type="xml">
|
<!-- <field name="arch" type="xml">-->
|
||||||
<xpath expr="//field[last()]" position="after">
|
<!-- <xpath expr="//field[last()]" position="after">-->
|
||||||
<field name="check_state" widget="label_selection"
|
<!-- <field name="check_state" widget="label_selection"-->
|
||||||
options="{'classes': {'unchecked':'warning','checked': 'success'}}"/>
|
<!-- options="{'classes': {'unchecked':'warning','checked': 'success'}}"/>-->
|
||||||
</xpath>
|
<!-- </xpath>-->
|
||||||
</field>
|
<!-- </field>-->
|
||||||
</record>
|
<!-- </record>-->
|
||||||
|
|
||||||
<!--作业类型根据权限增加审核按钮-->
|
<!--作业类型根据权限增加审核按钮-->
|
||||||
<record id="view_picking_type_form_sf_inherit" model="ir.ui.view">
|
<record id="view_picking_type_form_sf_inherit" model="ir.ui.view">
|
||||||
@@ -300,198 +300,198 @@
|
|||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="view_picking_type_tree_sf_inherit" model="ir.ui.view">
|
<!-- <record id="view_picking_type_tree_sf_inherit" model="ir.ui.view">-->
|
||||||
<field name="name">stock.picking.type.tree.sf.inherit</field>
|
<!-- <field name="name">stock.picking.type.tree.sf.inherit</field>-->
|
||||||
<field name="model">stock.picking.type</field>
|
<!-- <field name="model">stock.picking.type</field>-->
|
||||||
<field name="inherit_id" ref="stock.view_picking_type_tree"/>
|
<!-- <field name="inherit_id" ref="stock.view_picking_type_tree"/>-->
|
||||||
<field name="arch" type="xml">
|
<!-- <field name="arch" type="xml">-->
|
||||||
<xpath expr="//field[last()]" position="after">
|
<!-- <xpath expr="//field[last()]" position="after">-->
|
||||||
<field name="check_state" widget="label_selection"
|
<!-- <field name="check_state" widget="label_selection"-->
|
||||||
options="{'classes': {'unchecked':'warning','checked': 'success'}}"/>
|
<!-- options="{'classes': {'unchecked':'warning','checked': 'success'}}"/>-->
|
||||||
</xpath>
|
<!-- </xpath>-->
|
||||||
</field>
|
<!-- </field>-->
|
||||||
</record>
|
<!-- </record>-->
|
||||||
|
|
||||||
|
|
||||||
<!--产品类别根据权限增加审核按钮-->
|
<!--产品类别根据权限增加审核按钮-->
|
||||||
<record id="view_product_category_form_sf_inherit" model="ir.ui.view">
|
<!-- <record id="view_product_category_form_sf_inherit" model="ir.ui.view">-->
|
||||||
<field name="name">product.category.form.sf.inherit</field>
|
<!-- <field name="name">product.category.form.sf.inherit</field>-->
|
||||||
<field name="model">product.category</field>
|
<!-- <field name="model">product.category</field>-->
|
||||||
<field name="inherit_id" ref="product.product_category_form_view"/>
|
<!-- <field name="inherit_id" ref="product.product_category_form_view"/>-->
|
||||||
<field name="arch" type="xml">
|
<!-- <field name="arch" type="xml">-->
|
||||||
<xpath expr="//sheet" position="before">
|
<!-- <xpath expr="//sheet" position="before">-->
|
||||||
<header>
|
<!-- <header>-->
|
||||||
<field name="check_state" invisible="1"/>
|
<!-- <field name="check_state" invisible="1"/>-->
|
||||||
<button name="action_check" string="审核" type="object"
|
<!-- <button name="action_check" string="审核" type="object"-->
|
||||||
attrs="{'invisible': [('check_state','=', 'enable')]}"
|
<!-- attrs="{'invisible': [('check_state','=', 'enable')]}"-->
|
||||||
groups="sf_warehouse.group_sf_stock_manager"
|
<!-- groups="sf_warehouse.group_sf_stock_manager"-->
|
||||||
class="oe_highlight"/>
|
<!-- class="oe_highlight"/>-->
|
||||||
</header>
|
<!-- </header>-->
|
||||||
|
|
||||||
</xpath>
|
<!-- </xpath>-->
|
||||||
</field>
|
<!-- </field>-->
|
||||||
</record>
|
<!-- </record>-->
|
||||||
|
|
||||||
<record id="view_product_category_tree_sf_inherit" model="ir.ui.view">
|
<!-- <record id="view_product_category_tree_sf_inherit" model="ir.ui.view">-->
|
||||||
<field name="name">product.category.tree.sf.inherit</field>
|
<!-- <field name="name">product.category.tree.sf.inherit</field>-->
|
||||||
<field name="model">product.category</field>
|
<!-- <field name="model">product.category</field>-->
|
||||||
<field name="inherit_id" ref="product.product_category_list_view"/>
|
<!-- <field name="inherit_id" ref="product.product_category_list_view"/>-->
|
||||||
<field name="arch" type="xml">
|
<!-- <field name="arch" type="xml">-->
|
||||||
<xpath expr="//field[last()]" position="after">
|
<!-- <xpath expr="//field[last()]" position="after">-->
|
||||||
<field name="check_state" widget="label_selection"
|
<!-- <field name="check_state" widget="label_selection"-->
|
||||||
options="{'classes': {'unchecked':'warning','checked': 'success'}}"/>
|
<!-- options="{'classes': {'unchecked':'warning','checked': 'success'}}"/>-->
|
||||||
</xpath>
|
<!-- </xpath>-->
|
||||||
</field>
|
<!-- </field>-->
|
||||||
</record>
|
<!-- </record>-->
|
||||||
|
|
||||||
<!--计量单位类别根据权限增加审核按钮-->
|
<!--计量单位类别根据权限增加审核按钮-->
|
||||||
<record id="view_uom_category_form_sf_inherit" model="ir.ui.view">
|
<!-- <record id="view_uom_category_form_sf_inherit" model="ir.ui.view">-->
|
||||||
<field name="name">uom.category.form.sf.inherit</field>
|
<!-- <field name="name">uom.category.form.sf.inherit</field>-->
|
||||||
<field name="model">uom.category</field>
|
<!-- <field name="model">uom.category</field>-->
|
||||||
<field name="inherit_id" ref="uom.product_uom_categ_form_view"/>
|
<!-- <field name="inherit_id" ref="uom.product_uom_categ_form_view"/>-->
|
||||||
<field name="arch" type="xml">
|
<!-- <field name="arch" type="xml">-->
|
||||||
<xpath expr="//sheet" position="before">
|
<!-- <xpath expr="//sheet" position="before">-->
|
||||||
<header>
|
<!-- <header>-->
|
||||||
<field name="check_state" invisible="1"/>
|
<!-- <field name="check_state" invisible="1"/>-->
|
||||||
<button name="action_check" string="审核" type="object"
|
<!-- <button name="action_check" string="审核" type="object"-->
|
||||||
attrs="{'invisible': [('check_state','=', 'enable')]}"
|
<!-- attrs="{'invisible': [('check_state','=', 'enable')]}"-->
|
||||||
groups="sf_warehouse.group_sf_stock_manager"
|
<!-- groups="sf_warehouse.group_sf_stock_manager"-->
|
||||||
class="oe_highlight"/>
|
<!-- class="oe_highlight"/>-->
|
||||||
</header>
|
<!-- </header>-->
|
||||||
|
|
||||||
</xpath>
|
<!-- </xpath>-->
|
||||||
</field>
|
<!-- </field>-->
|
||||||
</record>
|
<!-- </record>-->
|
||||||
|
|
||||||
<record id="view_uom_category_tree_sf_inherit" model="ir.ui.view">
|
<!-- <record id="view_uom_category_tree_sf_inherit" model="ir.ui.view">-->
|
||||||
<field name="name">uom.category.tree.sf.inherit</field>
|
<!-- <field name="name">uom.category.tree.sf.inherit</field>-->
|
||||||
<field name="model">uom.category</field>
|
<!-- <field name="model">uom.category</field>-->
|
||||||
<field name="inherit_id" ref="uom.product_uom_categ_tree_view"/>
|
<!-- <field name="inherit_id" ref="uom.product_uom_categ_tree_view"/>-->
|
||||||
<field name="arch" type="xml">
|
<!-- <field name="arch" type="xml">-->
|
||||||
<xpath expr="//field[last()]" position="after">
|
<!-- <xpath expr="//field[last()]" position="after">-->
|
||||||
<field name="check_state" widget="label_selection"
|
<!-- <field name="check_state" widget="label_selection"-->
|
||||||
options="{'classes': {'unchecked':'warning','checked': 'success'}}"/>
|
<!-- options="{'classes': {'unchecked':'warning','checked': 'success'}}"/>-->
|
||||||
</xpath>
|
<!-- </xpath>-->
|
||||||
</field>
|
<!-- </field>-->
|
||||||
</record>
|
<!-- </record>-->
|
||||||
|
|
||||||
<!--条码命名规则根据权限增加审核按钮-->
|
<!-- <!–条码命名规则根据权限增加审核按钮–>-->
|
||||||
<record id="view_barcode_nomenclature_form_sf_inherit" model="ir.ui.view">
|
<!-- <record id="view_barcode_nomenclature_form_sf_inherit" model="ir.ui.view">-->
|
||||||
<field name="name">barcode.nomenclature.form.sf.inherit</field>
|
<!-- <field name="name">barcode.nomenclature.form.sf.inherit</field>-->
|
||||||
<field name="model">barcode.nomenclature</field>
|
<!-- <field name="model">barcode.nomenclature</field>-->
|
||||||
<field name="inherit_id" ref="barcodes.view_barcode_nomenclature_form"/>
|
<!-- <field name="inherit_id" ref="barcodes.view_barcode_nomenclature_form"/>-->
|
||||||
<field name="arch" type="xml">
|
<!-- <field name="arch" type="xml">-->
|
||||||
<xpath expr="//sheet" position="before">
|
<!-- <xpath expr="//sheet" position="before">-->
|
||||||
<header>
|
<!-- <header>-->
|
||||||
<field name="check_state" invisible="1"/>
|
<!-- <field name="check_state" invisible="1"/>-->
|
||||||
<button name="action_check" string="审核" type="object"
|
<!-- <button name="action_check" string="审核" type="object"-->
|
||||||
attrs="{'invisible': [('check_state','=', 'enable')]}"
|
<!-- attrs="{'invisible': [('check_state','=', 'enable')]}"-->
|
||||||
groups="sf_warehouse.group_sf_stock_manager"
|
<!-- groups="sf_warehouse.group_sf_stock_manager"-->
|
||||||
class="oe_highlight"/>
|
<!-- class="oe_highlight"/>-->
|
||||||
</header>
|
<!-- </header>-->
|
||||||
|
|
||||||
</xpath>
|
<!-- </xpath>-->
|
||||||
</field>
|
<!-- </field>-->
|
||||||
</record>
|
<!-- </record>-->
|
||||||
|
|
||||||
<record id="view_barcode_nomenclature_tree_sf_inherit" model="ir.ui.view">
|
<!-- <record id="view_barcode_nomenclature_tree_sf_inherit" model="ir.ui.view">-->
|
||||||
<field name="name">barcode.nomenclature.tree.sf.inherit</field>
|
<!-- <field name="name">barcode.nomenclature.tree.sf.inherit</field>-->
|
||||||
<field name="model">barcode.nomenclature</field>
|
<!-- <field name="model">barcode.nomenclature</field>-->
|
||||||
<field name="inherit_id" ref="barcodes.view_barcode_nomenclature_tree"/>
|
<!-- <field name="inherit_id" ref="barcodes.view_barcode_nomenclature_tree"/>-->
|
||||||
<field name="arch" type="xml">
|
<!-- <field name="arch" type="xml">-->
|
||||||
<xpath expr="//field[last()]" position="after">
|
<!-- <xpath expr="//field[last()]" position="after">-->
|
||||||
<field name="check_state" widget="label_selection"
|
<!-- <field name="check_state" widget="label_selection"-->
|
||||||
options="{'classes': {'unchecked':'warning','checked': 'success'}}"/>
|
<!-- options="{'classes': {'unchecked':'warning','checked': 'success'}}"/>-->
|
||||||
</xpath>
|
<!-- </xpath>-->
|
||||||
</field>
|
<!-- </field>-->
|
||||||
</record>
|
<!-- </record>-->
|
||||||
|
|
||||||
|
|
||||||
<!--上架规则根据权限增加审核按钮-->
|
<!--上架规则根据权限增加审核按钮-->
|
||||||
<record id="view_putaway_rule_tree_sf_inherit" model="ir.ui.view">
|
<!-- <record id="view_putaway_rule_tree_sf_inherit" model="ir.ui.view">-->
|
||||||
<field name="name">stock.putaway.rule.tree.sf.inherit</field>
|
<!-- <field name="name">stock.putaway.rule.tree.sf.inherit</field>-->
|
||||||
<field name="model">stock.putaway.rule</field>
|
<!-- <field name="model">stock.putaway.rule</field>-->
|
||||||
<field name="inherit_id" ref="stock.stock_putaway_list"/>
|
<!-- <field name="inherit_id" ref="stock.stock_putaway_list"/>-->
|
||||||
<field name="arch" type="xml">
|
<!-- <field name="arch" type="xml">-->
|
||||||
<xpath expr="//field[last()]" position="after">
|
<!-- <xpath expr="//field[last()]" position="after">-->
|
||||||
<field name="check_state" widget="label_selection"
|
<!-- <field name="check_state" widget="label_selection"-->
|
||||||
options="{'classes': {'unchecked':'warning','checked': 'success'}}"/>
|
<!-- options="{'classes': {'unchecked':'warning','checked': 'success'}}"/>-->
|
||||||
<button name="action_check" string="审核" type="object"
|
<!-- <button name="action_check" string="审核" type="object"-->
|
||||||
attrs="{'invisible': [('check_state','=', 'enable')]}"
|
<!-- attrs="{'invisible': [('check_state','=', 'enable')]}"-->
|
||||||
groups="sf_warehouse.group_sf_stock_manager"
|
<!-- groups="sf_warehouse.group_sf_stock_manager"-->
|
||||||
class="oe_highlight"/>
|
<!-- class="oe_highlight"/>-->
|
||||||
</xpath>
|
<!-- </xpath>-->
|
||||||
</field>
|
<!-- </field>-->
|
||||||
</record>
|
<!-- </record>-->
|
||||||
|
|
||||||
|
|
||||||
<!--重订货规则根据权限增加审核按钮-->
|
<!--重订货规则根据权限增加审核按钮-->
|
||||||
<record id="view_warehouse_orderpoint_tree_sf_inherit" model="ir.ui.view">
|
<!-- <record id="view_warehouse_orderpoint_tree_sf_inherit" model="ir.ui.view">-->
|
||||||
<field name="name">stock.warehouse.orderpoint.tree.sf.inherit</field>
|
<!-- <field name="name">stock.warehouse.orderpoint.tree.sf.inherit</field>-->
|
||||||
<field name="model">stock.warehouse.orderpoint</field>
|
<!-- <field name="model">stock.warehouse.orderpoint</field>-->
|
||||||
<field name="inherit_id" ref="stock.view_warehouse_orderpoint_tree_editable"/>
|
<!-- <field name="inherit_id" ref="stock.view_warehouse_orderpoint_tree_editable"/>-->
|
||||||
<field name="arch" type="xml">
|
<!-- <field name="arch" type="xml">-->
|
||||||
<xpath expr="//field[last()]" position="after">
|
<!-- <xpath expr="//field[last()]" position="after">-->
|
||||||
<field name="check_state" widget="label_selection"
|
<!-- <field name="check_state" widget="label_selection"-->
|
||||||
options="{'classes': {'unchecked':'warning','checked': 'success'}}"/>
|
<!-- options="{'classes': {'unchecked':'warning','checked': 'success'}}"/>-->
|
||||||
<button name="action_check" string="审核" type="object"
|
<!-- <button name="action_check" string="审核" type="object"-->
|
||||||
attrs="{'invisible': [('check_state','=', 'enable')]}"
|
<!-- attrs="{'invisible': [('check_state','=', 'enable')]}"-->
|
||||||
groups="sf_warehouse.group_sf_stock_manager"
|
<!-- groups="sf_warehouse.group_sf_stock_manager"-->
|
||||||
class="oe_highlight"/>
|
<!-- class="oe_highlight"/>-->
|
||||||
</xpath>
|
<!-- </xpath>-->
|
||||||
</field>
|
<!-- </field>-->
|
||||||
</record>
|
<!-- </record>-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!--库存调整根据权限增加审核按钮-->
|
<!--库存调整根据权限增加审核按钮-->
|
||||||
<record id="view_quant_tree_sf_inherit" model="ir.ui.view">
|
<!-- <record id="view_quant_tree_sf_inherit" model="ir.ui.view">-->
|
||||||
<field name="name">stock.quant.tree.sf.inherit</field>
|
<!-- <field name="name">stock.quant.tree.sf.inherit</field>-->
|
||||||
<field name="model">stock.quant</field>
|
<!-- <field name="model">stock.quant</field>-->
|
||||||
<field name="inherit_id" ref="stock.view_stock_quant_tree_inventory_editable"/>
|
<!-- <field name="inherit_id" ref="stock.view_stock_quant_tree_inventory_editable"/>-->
|
||||||
<field name="arch" type="xml">
|
<!-- <field name="arch" type="xml">-->
|
||||||
<xpath expr="//field[last()]" position="after">
|
<!-- <xpath expr="//field[last()]" position="after">-->
|
||||||
<field name="check_state" widget="label_selection"
|
<!-- <field name="check_state" widget="label_selection"-->
|
||||||
options="{'classes': {'unchecked':'warning','checked': 'success'}}"/>
|
<!-- options="{'classes': {'unchecked':'warning','checked': 'success'}}"/>-->
|
||||||
<button name="action_check" string="审核" type="object"
|
<!-- <button name="action_check" string="审核" type="object"-->
|
||||||
attrs="{'invisible': [('check_state','=', 'enable')]}"
|
<!-- attrs="{'invisible': [('check_state','=', 'enable')]}"-->
|
||||||
groups="sf_warehouse.group_sf_stock_manager"
|
<!-- groups="sf_warehouse.group_sf_stock_manager"-->
|
||||||
class="oe_highlight"/>
|
<!-- class="oe_highlight"/>-->
|
||||||
</xpath>
|
<!-- </xpath>-->
|
||||||
</field>
|
<!-- </field>-->
|
||||||
</record>
|
<!-- </record>-->
|
||||||
|
|
||||||
|
|
||||||
<!--报废单根据权限增加审核按钮-->
|
<!--报废单根据权限增加审核按钮-->
|
||||||
<record id="view_stock_scrap_form_sf_inherit" model="ir.ui.view">
|
<!-- <record id="view_stock_scrap_form_sf_inherit" model="ir.ui.view">-->
|
||||||
<field name="name">stock.scrap.form.sf.inherit</field>
|
<!-- <field name="name">stock.scrap.form.sf.inherit</field>-->
|
||||||
<field name="model">stock.scrap</field>
|
<!-- <field name="model">stock.scrap</field>-->
|
||||||
<field name="inherit_id" ref="stock.stock_scrap_form_view"/>
|
<!-- <field name="inherit_id" ref="stock.stock_scrap_form_view"/>-->
|
||||||
<field name="arch" type="xml">
|
<!-- <field name="arch" type="xml">-->
|
||||||
<xpath expr="//sheet" position="before">
|
<!-- <xpath expr="//sheet" position="before">-->
|
||||||
<header>
|
<!-- <header>-->
|
||||||
<field name="check_state" invisible="1"/>
|
<!-- <field name="check_state" invisible="1"/>-->
|
||||||
<button name="action_check" string="审核" type="object"
|
<!-- <button name="action_check" string="审核" type="object"-->
|
||||||
attrs="{'invisible': [('check_state','=', 'enable')]}"
|
<!-- attrs="{'invisible': [('check_state','=', 'enable')]}"-->
|
||||||
groups="sf_warehouse.group_sf_stock_manager"
|
<!-- groups="sf_warehouse.group_sf_stock_manager"-->
|
||||||
class="oe_highlight"/>
|
<!-- class="oe_highlight"/>-->
|
||||||
</header>
|
<!-- </header>-->
|
||||||
|
|
||||||
</xpath>
|
<!-- </xpath>-->
|
||||||
</field>
|
<!-- </field>-->
|
||||||
</record>
|
<!-- </record>-->
|
||||||
|
|
||||||
<record id="view_stock_scrap_tree_sf_inherit" model="ir.ui.view">
|
<!-- <record id="view_stock_scrap_tree_sf_inherit" model="ir.ui.view">-->
|
||||||
<field name="name">stock.scrap.tree.sf.inherit</field>
|
<!-- <field name="name">stock.scrap.tree.sf.inherit</field>-->
|
||||||
<field name="model">stock.scrap</field>
|
<!-- <field name="model">stock.scrap</field>-->
|
||||||
<field name="inherit_id" ref="stock.stock_scrap_tree_view"/>
|
<!-- <field name="inherit_id" ref="stock.stock_scrap_tree_view"/>-->
|
||||||
<field name="arch" type="xml">
|
<!-- <field name="arch" type="xml">-->
|
||||||
<xpath expr="//field[last()]" position="after">
|
<!-- <xpath expr="//field[last()]" position="after">-->
|
||||||
<field name="check_state" widget="label_selection"
|
<!-- <field name="check_state" widget="label_selection"-->
|
||||||
options="{'classes': {'unchecked':'warning','checked': 'success'}}"/>
|
<!-- options="{'classes': {'unchecked':'warning','checked': 'success'}}"/>-->
|
||||||
</xpath>
|
<!-- </xpath>-->
|
||||||
</field>
|
<!-- </field>-->
|
||||||
</record>
|
<!-- </record>-->
|
||||||
|
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
Reference in New Issue
Block a user