From 3236d477c0560c42cdfa93c0bcee313dec392a37 Mon Sep 17 00:00:00 2001 From: yuxianghui <1608204036@qq.com> Date: Tue, 13 Jun 2023 17:13:15 +0800 Subject: [PATCH] =?UTF-8?q?sf=E7=9A=84=E5=8A=9F=E8=83=BD=E5=88=80=E5=85=B7?= =?UTF-8?q?=E5=AE=9E=E6=97=B6=E5=88=86=E5=B8=83=E5=92=8C=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=88=80=E5=85=B7=E5=87=BA=E5=85=A5=E5=BA=93=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E8=A7=86=E5=9B=BE=E7=95=8C=E9=9D=A2=E5=B7=B2=E5=BB=BA=E7=AB=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_tool_management/__init__.py | 2 + sf_tool_management/__manifest__.py | 35 +++++ sf_tool_management/models/__init__.py | 4 + sf_tool_management/models/base.py | 3 + .../function_tool_entry_exit_records.py | 47 +++++++ .../functional_tool_real_time_distribution.py | 38 ++++++ .../security/ir.model.access.csv | 3 + .../function_tool_entry_exit_records_view.xml | 125 ++++++++++++++++++ ...ional_tool_real_time_distribution_view.xml | 109 +++++++++++++++ sf_tool_management/views/menu_view.xml | 34 +++++ 10 files changed, 400 insertions(+) create mode 100644 sf_tool_management/__init__.py create mode 100644 sf_tool_management/__manifest__.py create mode 100644 sf_tool_management/models/__init__.py create mode 100644 sf_tool_management/models/base.py create mode 100644 sf_tool_management/models/function_tool_entry_exit_records.py create mode 100644 sf_tool_management/models/functional_tool_real_time_distribution.py create mode 100644 sf_tool_management/security/ir.model.access.csv create mode 100644 sf_tool_management/views/function_tool_entry_exit_records_view.xml create mode 100644 sf_tool_management/views/functional_tool_real_time_distribution_view.xml create mode 100644 sf_tool_management/views/menu_view.xml diff --git a/sf_tool_management/__init__.py b/sf_tool_management/__init__.py new file mode 100644 index 00000000..041ffad6 --- /dev/null +++ b/sf_tool_management/__init__.py @@ -0,0 +1,2 @@ +# -*-coding:utf-8-*- +from . import models \ No newline at end of file diff --git a/sf_tool_management/__manifest__.py b/sf_tool_management/__manifest__.py new file mode 100644 index 00000000..29eb4eb3 --- /dev/null +++ b/sf_tool_management/__manifest__.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. +{ + 'name': '机企猫智能工厂 刀具管理', + 'version': '1.0', + 'summary': '智能工厂刀具管理', + 'sequence': 1, + 'description': """ +在本模块,定义了主要的角色、菜单、基础业务对象 + """, + 'category': 'sf', + 'website': 'https://www.sf.jikimo.com', + 'depends': ['account', 'sf_base', 'mrp'], + 'data': [ + 'security/ir.model.access.csv', + + 'views/functional_tool_real_time_distribution_view.xml', + 'views/function_tool_entry_exit_records_view.xml', + 'views/menu_view.xml', + + ], + 'demo': [ + ], + 'assets': { + + 'web.assets_qweb': [ + ], + + + }, + 'license': 'LGPL-3', + 'installable': True, + 'application': False, + 'auto_install': False, +} diff --git a/sf_tool_management/models/__init__.py b/sf_tool_management/models/__init__.py new file mode 100644 index 00000000..6ba6e9ad --- /dev/null +++ b/sf_tool_management/models/__init__.py @@ -0,0 +1,4 @@ +from . import base +from . import functional_tool_real_time_distribution +from . import function_tool_entry_exit_records + diff --git a/sf_tool_management/models/base.py b/sf_tool_management/models/base.py new file mode 100644 index 00000000..faaaf799 --- /dev/null +++ b/sf_tool_management/models/base.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + + diff --git a/sf_tool_management/models/function_tool_entry_exit_records.py b/sf_tool_management/models/function_tool_entry_exit_records.py new file mode 100644 index 00000000..d40c7478 --- /dev/null +++ b/sf_tool_management/models/function_tool_entry_exit_records.py @@ -0,0 +1,47 @@ +from odoo import models,fields,api + + +class FunctionToolEntryExitRecords(models.Model): + _name = 'sf.function.tool.entry.exit.records' + _description = '功能刀具出入库记录' + _inherit = 'sf.functional.cutting.tool' + + order = fields.Char(string='序') + + thickness = fields.Selection([('1', '粗'), ('2', '中'), ('3', '细')], string='粗/中/细') + max_life_span = fields.Char(string='最大寿命值') + alarm_value = fields.Char(string='报警值') + used_value = fields.Char(string='已使用值') + current_state = fields.Char(string='当前状态') + current_store_area = fields.Char(string='当前库区') + current_store_place = fields.Char(string='当前库位') + number = fields.Integer(string='数量') + reason_application = fields.Char(string='申请原因') + applicant = fields.Char(string='申请人') + return_staff = fields.Char(string='归还人') + return_time = fields.Date(string='归还入库时间') + tool_state = fields.Char(string="刀具状态") + tool_install_staff = fields.Char(string='装刀人') + tool_install_time = fields.Datetime(string='装刀时间') + receive_equipment = fields.Char(string='领用机台') + receive_staff = fields.Char(string='领用人') + receive_time = fields.Char(string='领用出库时间') + + remark = fields.Text(string='备注/说明') + + @api.model + def create(self, vals): + + if not vals.get('order'): + vals['order'] = self._generate_code() + return super(FunctionToolEntryExitRecords, self).create(vals) + + @api.model + def _generate_code(self): + last_tool = self.search([], order='id desc', limit=1) + if last_tool: + last_code = int(last_tool.code.split('-')[-1]) + new_code = '{:03d}'.format(last_code + 1) + else: + new_code = '001' + return new_code \ No newline at end of file diff --git a/sf_tool_management/models/functional_tool_real_time_distribution.py b/sf_tool_management/models/functional_tool_real_time_distribution.py new file mode 100644 index 00000000..7e7fbca8 --- /dev/null +++ b/sf_tool_management/models/functional_tool_real_time_distribution.py @@ -0,0 +1,38 @@ +from odoo import fields, models,api + + +class FunctionalToolRealTimeDistribution(models.Model): + _name = 'sf.functional.tool.real.time.distribution' + _description = "功能刀具实时分布" + _inherit = 'sf.functional.cutting.tool' + + order = fields.Char(string='序') + + tool_stock_num = fields.Text(string='刀具房库存数量') + side_shelf_num = fields.Text(string='线边货架货架数量') + on_tool_stock_num = fields.Text(string='机内刀库库存数量') + tool_stock_total = fields.Text(string='合计') + + return_reuse_num_re = fields.Text(string='归还再用数量(精)') + return_reuse_num_co = fields.Text(string='归还再用数量(粗)') + return_processing_num = fields.Text(string='归还需磨削数量') + return_total = fields.Text(string='合计') + total = fields.Text(string='总计') + remark = fields.Text(string='备注/说明') + + @api.model + def create(self, vals): + + if not vals.get('order'): + vals['order'] = self._generate_code() + return super(FunctionalToolRealTimeDistribution, self).create(vals) + + @api.model + def _generate_code(self): + last_tool = self.search([], order='id desc', limit=1) + if last_tool: + last_code = int(last_tool.code.split('-')[-1]) + new_code = '{:03d}'.format(last_code + 1) + else: + new_code = '001' + return new_code \ No newline at end of file diff --git a/sf_tool_management/security/ir.model.access.csv b/sf_tool_management/security/ir.model.access.csv new file mode 100644 index 00000000..b902d4e5 --- /dev/null +++ b/sf_tool_management/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_sf_functional_tool_real_time_distribution,sf.functional.tool.real.time.distribution,model_sf_functional_tool_real_time_distribution,base.group_user,1,1,1,1 +access_sf_function_tool_entry_exit_records,sf.function.tool.entry.exit.records,model_sf_function_tool_entry_exit_records,base.group_user,1,1,1,1 diff --git a/sf_tool_management/views/function_tool_entry_exit_records_view.xml b/sf_tool_management/views/function_tool_entry_exit_records_view.xml new file mode 100644 index 00000000..b82dce71 --- /dev/null +++ b/sf_tool_management/views/function_tool_entry_exit_records_view.xml @@ -0,0 +1,125 @@ + + + + 功能刀具出入库记录 + sf.function.tool.entry.exit.records + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 功能刀具出入库记录 + sf.function.tool.entry.exit.records + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + 功能刀具出入库记录 + ir.actions.act_window + sf.function.tool.entry.exit.records + tree,form + +
\ No newline at end of file diff --git a/sf_tool_management/views/functional_tool_real_time_distribution_view.xml b/sf_tool_management/views/functional_tool_real_time_distribution_view.xml new file mode 100644 index 00000000..4133bf1f --- /dev/null +++ b/sf_tool_management/views/functional_tool_real_time_distribution_view.xml @@ -0,0 +1,109 @@ + + + + 功能刀具实时分布 + sf.functional.tool.real.time.distribution + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 功能刀具实时分布 + sf.functional.tool.real.time.distribution + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + 功能刀具实时分布 + ir.actions.act_window + sf.functional.tool.real.time.distribution + tree,form + +
\ No newline at end of file diff --git a/sf_tool_management/views/menu_view.xml b/sf_tool_management/views/menu_view.xml new file mode 100644 index 00000000..841f368c --- /dev/null +++ b/sf_tool_management/views/menu_view.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + \ No newline at end of file