From d6f749fff5c3575b9301828b05750fe0d7d6bab3 Mon Sep 17 00:00:00 2001
From: yuxianghui <1608204036@qq.com>
Date: Tue, 27 Jun 2023 17:31:49 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8A=9F=E8=83=BD=E5=88=80?=
=?UTF-8?q?=E5=85=B7=E7=BB=84=E8=A3=85=E7=9A=84=E7=BB=84=E8=A3=85=E5=BC=B9?=
=?UTF-8?q?=E7=AA=97=E6=8C=89=E9=94=AE=E5=8A=9F=E8=83=BD=EF=BC=88=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD=E5=B7=B2=E5=AE=8C=E6=88=90=EF=BC=89=E3=80=81=E5=8F=96?=
=?UTF-8?q?=E6=B6=88=E7=BB=84=E8=A3=85=E5=8A=9F=E8=83=BD=E6=8C=89=E9=94=AE?=
=?UTF-8?q?=EF=BC=88=E5=8A=9F=E8=83=BD=E5=B7=B2=E5=AE=8C=E6=88=90=EF=BC=89?=
=?UTF-8?q?=E3=80=81=E5=87=BA=E5=BA=93=E5=BC=B9=E7=AA=97=E6=8C=89=E9=94=AE?=
=?UTF-8?q?=EF=BC=88=E5=B7=B2=E5=AE=8C=E6=88=90=E8=A7=86=E5=9B=BE=EF=BC=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_tool_management/models/base.py | 49 +++++++-
.../security/ir.model.access.csv | 2 +
sf_tool_management/views/tool_base_views.xml | 46 ++++++-
sf_tool_management/wizard/wizard.py | 81 +++++++++++-
sf_tool_management/wizard/wizard_view.xml | 115 ++++++++++++++++++
5 files changed, 283 insertions(+), 10 deletions(-)
diff --git a/sf_tool_management/models/base.py b/sf_tool_management/models/base.py
index 85cb2c9a..8563fed3 100644
--- a/sf_tool_management/models/base.py
+++ b/sf_tool_management/models/base.py
@@ -157,9 +157,9 @@ class MachineTableToolChangingApply(models.Model):
'replacement_tool_type': self.functional_tool_type,
'replacement_tool_coarse_middle_thin': self.coarse_middle_thin,
'new_former': '0',
- 'applicant': '自动申请',
+ 'applicant': None,
'used_tool_time': fields.Datetime.now(),
- 'reason_for_applying': '功能刀具状态异常',
+ 'reason_for_applying': None,
'remark': None,
'status': '1'
})
@@ -263,6 +263,26 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
todo 自动申请装刀
:return:
"""
+ self.env['sf.functional.tool.assembly'].create({
+ 'functional_tool_code': self.functional_tool_code,
+ 'functional_tool_name': self.functional_tool_name,
+ 'functional_tool_type': self.functional_tool_type,
+ 'functional_tool_diameter': self.diameter,
+ 'functional_tool_length': self.tool_loading_length,
+ 'loading_task_source': '0',
+ 'coarse_middle_thin': None,
+ 'tool_loading_length': None,
+ 'applicant': self.applicant,
+ 'reason_for_applying': self.reason_for_applying,
+ 'use_tool_time': self.need_knife_time,
+ 'machine_tool_name': self.machine_table_name,
+ 'machine_tool_code': self.cam_procedure_code,
+ 'cutter_spacing_code': self.cam_cutter_spacing_code
+ })
+
+ # 将计划执行状态改为执行中
+ self.env['sf.cam.work.order.program.knife.plan'].search(
+ [('functional_tool_code', '=', self.functional_tool_code)]).write({'plan_execute_status': '1'})
def revocation(self):
"""
@@ -322,3 +342,28 @@ class FunctionalToolAssembly(models.Model):
receive_person = fields.Char(string='领用人')
receive_time = fields.Datetime(string='领用出库时间')
remark = fields.Char(string='备注说明')
+
+ def cancel_functional_tool_assembly(self):
+ """
+ 取消功能刀具组装
+ :return:
+ """
+ self.env['sf.functional.tool.assembly'].search([
+ ('machine_tool_name', '=', self.machine_tool_name),
+ ('cutter_spacing_code', '=', self.cutter_spacing_code)
+ ]).write({
+ 'tool_name': None,
+ 'tool_brand': None,
+ 'tool_type': None,
+ 'knife_handle_name': None,
+ 'knife_handle_brand': None,
+ 'knife_handle_type': None,
+ 'coarse_middle_thin': None,
+ 'tool_loading_length': None,
+ 'new_former': None,
+ 'reference_length': None,
+ 'cut_time': None,
+ 'cut_length': None,
+ 'cut_number': None,
+ 'assemble_status': '0'
+ })
diff --git a/sf_tool_management/security/ir.model.access.csv b/sf_tool_management/security/ir.model.access.csv
index e481edaa..1792b613 100644
--- a/sf_tool_management/security/ir.model.access.csv
+++ b/sf_tool_management/security/ir.model.access.csv
@@ -9,6 +9,8 @@ access_sf_tool_transfer_request_information,sf.tool.transfer.request.information
access_sf_apply_for_tooling,sf.apply.for.tooling,model_sf_apply_for_tooling,base.group_user,1,1,1,1
access_sf_functional_tool_assembly,sf.functional.tool.assembly,model_sf_functional_tool_assembly,base.group_user,1,1,1,1
+access_sf_functional_tool_assembly_order,sf.functional.tool.assembly.order,model_sf_functional_tool_assembly_order,base.group_user,1,1,1,1
+access_sf_delivery_of_cargo_from_storage,sf.delivery.of.cargo.from.storage,model_sf_delivery_of_cargo_from_storage,base.group_user,1,1,1,1
diff --git a/sf_tool_management/views/tool_base_views.xml b/sf_tool_management/views/tool_base_views.xml
index fbc25af9..d653668a 100644
--- a/sf_tool_management/views/tool_base_views.xml
+++ b/sf_tool_management/views/tool_base_views.xml
@@ -378,11 +378,47 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sf_tool_management/wizard/wizard.py b/sf_tool_management/wizard/wizard.py
index f70994b3..22a5a0d7 100644
--- a/sf_tool_management/wizard/wizard.py
+++ b/sf_tool_management/wizard/wizard.py
@@ -155,10 +155,85 @@ class ApplyForTooling(models.TransientModel):
return {'type': 'ir.actions.act_window_close'}
+class FunctionalToolAssemblyOrder(models.TransientModel):
+ _name = 'sf.functional.tool.assembly.order'
+ _description = '功能刀具组装单'
+
+ # 功能刀具申请信息
+ machine_tool_name = fields.Char(string='机床名称', readonly=True)
+ cutter_spacing_code = fields.Char(string='刀位号', readonly=True)
+ functional_tool_name = fields.Char(string='功能刀具名称', readonly=True)
+ functional_tool_type = fields.Char(string='功能刀具类型', readonly=True)
+ functional_tool_length = fields.Char(string='功能刀具伸出长', readonly=True)
+ effective_length = fields.Char(string='有效长', readonly=True)
+ functional_tool_diameter = fields.Char(string='功能刀具直径', readonly=True)
+ tool_included_angle = fields.Char(string='刀尖角(R角)', readonly=True)
+ functional_tool_cutting_type = fields.Char(string='功能刀具切削类型', readonly=True)
+ required_cutting_time = fields.Char(string='需要切割时间', readonly=True)
+ whether_standard_tool = fields.Boolean(string='是否标准刀', readonly=True)
+
+ # 功能刀具组装信息
+ tool_name = fields.Char(string='刀具名称')
+ tool_code = fields.Char(string='刀具编码')
+ tool_brand = fields.Char(string='品牌')
+ tool_type = fields.Char(string='型号')
+ knife_handle_name = fields.Char(string='刀柄名称')
+ knife_handle_code = fields.Char(string='刀柄编码')
+ knife_handle_brand = fields.Char(string='品牌')
+ knife_handle_type = fields.Char(string='型号')
+ coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], string='粗/中/精')
+ tool_loading_length = fields.Char(string='装刀长')
+ new_former = fields.Selection([('0', '新'), ('1', '旧')], string='新/旧')
+ reference_length = fields.Char(string='参考伸出长')
+ cut_time = fields.Char(string='已切削时间')
+ cut_length = fields.Char(string='已切削长度')
+ cut_number = fields.Char(string='已切削次数')
+
+ def functional_tool_assembly(self):
+ """
+ 功能刀具组装
+ :return:
+ """
+ self.env['sf.functional.tool.assembly'].search([
+ ('machine_tool_name', '=', self.machine_tool_name),
+ ('cutter_spacing_code', '=', self.cutter_spacing_code)
+ ]).write({
+ 'tool_name': self.tool_name,
+ 'tool_brand': self.tool_brand,
+ 'tool_type': self.tool_type,
+ 'knife_handle_name': self.knife_handle_name,
+ 'knife_handle_brand': self.knife_handle_brand,
+ 'knife_handle_type': self.knife_handle_type,
+ 'coarse_middle_thin': self.coarse_middle_thin,
+ 'tool_loading_length': self.tool_loading_length,
+ 'new_former': self.new_former,
+ 'reference_length': self.reference_length,
+ 'cut_time': self.cut_time,
+ 'cut_length': self.cut_length,
+ 'cut_number': self.cut_number,
+ 'assemble_status': '1',
+ 'tool_loading_person': self.env.user.name,
+ 'tool_loading_time': fields.Datetime.now()
+ })
+
+ # 关闭弹出窗口
+ return {'type': 'ir.actions.act_window_close'}
+class DeliveryOfCargoFromStorage(models.TransientModel):
+ _name = 'sf.delivery.of.cargo.from.storage'
+ _description = '出库'
+ functional_tool_code = fields.Char(string='功能刀具编码')
+ functional_tool_name = fields.Char(string='功能刀具名称')
+ functional_tool_type = fields.Char(string='功能刀具类型')
+ production_line_name = fields.Char(string='产线名称')
+ machine_tool_code = fields.Char(string='机台号')
+ receive_person = fields.Char(string='领用人')
+ receive_time = fields.Datetime(string='领用出库时间')
-
-
-
+ def stock_removal(self):
+ """
+ 出库
+ :return:
+ """
\ No newline at end of file
diff --git a/sf_tool_management/wizard/wizard_view.xml b/sf_tool_management/wizard/wizard_view.xml
index 4706f86e..14303edb 100644
--- a/sf_tool_management/wizard/wizard_view.xml
+++ b/sf_tool_management/wizard/wizard_view.xml
@@ -177,4 +177,119 @@
new
+
+
+
+
+ 功能刀具组装单
+ sf.functional.tool.assembly.order
+
+
+
+
+
+
+ 功能刀具组装单
+ ir.actions.act_window
+ sf.functional.tool.assembly.order
+ form
+
+ new
+
+
+
+
+
+
+ 出库
+ sf.delivery.of.cargo.from.storage
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 出库
+ ir.actions.act_window
+ sf.delivery.of.cargo.from.storage
+ tree
+
+ new
+
\ No newline at end of file