From 32b773c48607034a96486611a45c68801efbf4b2 Mon Sep 17 00:00:00 2001 From: "qihao.gong@jikimo.com" Date: Fri, 1 Sep 2023 16:57:04 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=9B=BE=E6=96=87=E5=B1=95=E7=A4=BAtable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_maintenance/models/sf_maintenance.py | 9 ++ sf_maintenance/security/ir.model.access.csv | 1 + .../views/maintenance_logs_views.xml | 96 +++++++++++-------- sf_maintenance/views/maintenance_views.xml | 10 +- 4 files changed, 74 insertions(+), 42 deletions(-) diff --git a/sf_maintenance/models/sf_maintenance.py b/sf_maintenance/models/sf_maintenance.py index 98a508eb..9273cc12 100644 --- a/sf_maintenance/models/sf_maintenance.py +++ b/sf_maintenance/models/sf_maintenance.py @@ -474,3 +474,12 @@ class SfMaintenanceEquipment(models.Model): ('sf_maintenance_type', '=', '检修')]) if not next_requests: equipment._create_new_request1(equipment.overhaul_date) + + image_id = fields.Many2many('maintenance.equipment.image', 'equipment_id', string='设备图文') + +class MaintenanceStandardImage(models.Model): + _name = 'maintenance.equipment.image' + _description = '设备图文展示' + + image = fields.Binary(string='设备图文') + equipment_id = fields.Many2many('maintenance.equipment', 'image_id', string='设备') \ No newline at end of file diff --git a/sf_maintenance/security/ir.model.access.csv b/sf_maintenance/security/ir.model.access.csv index 039583ce..f5517576 100644 --- a/sf_maintenance/security/ir.model.access.csv +++ b/sf_maintenance/security/ir.model.access.csv @@ -4,6 +4,7 @@ access_sf_maintenance_logs,sf_maintenance_logs,model_sf_maintenance_logs,base.gr access_maintenance_equipment,maintenance_equipment,model_maintenance_equipment,base.group_user,1,1,1,1 access_maintenance_standards,maintenance_standards,model_maintenance_standards,base.group_user,1,1,1,1 access_maintenance_standard_image,maintenance_standard_image,model_maintenance_standard_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 diff --git a/sf_maintenance/views/maintenance_logs_views.xml b/sf_maintenance/views/maintenance_logs_views.xml index 33e22bf2..f226349f 100644 --- a/sf_maintenance/views/maintenance_logs_views.xml +++ b/sf_maintenance/views/maintenance_logs_views.xml @@ -34,25 +34,39 @@ sf.maintenance.logs
- - - - - - - - - - - - - - - - - - - +
+ +
+ +
+

+ +

+
+ + + + + + + + + + + + + + + + + + + + + + + +
@@ -64,8 +78,8 @@ - - + + @@ -90,28 +104,28 @@ - - 设备故障日志 - ir.actions.act_window - sf.maintenance.logs - tree,form - - -

- 设备故障日志 -

-
-
+ + 设备故障日志 + ir.actions.act_window + sf.maintenance.logs + tree,form + + +

+ 设备故障日志 +

+
+
- - - - - - - + + + + + + + - + diff --git a/sf_maintenance/views/maintenance_views.xml b/sf_maintenance/views/maintenance_views.xml index b3d0a207..2aa0b980 100644 --- a/sf_maintenance/views/maintenance_views.xml +++ b/sf_maintenance/views/maintenance_views.xml @@ -172,6 +172,14 @@ + + + + + + + @@ -210,7 +218,7 @@ - + From f554c2073f8d4f918ae55a5f440a84f29026aeb8 Mon Sep 17 00:00:00 2001 From: yuxianghui <1608204036@qq.com> Date: Tue, 12 Sep 2023 15:06:21 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E6=94=BE=E5=BC=80=E9=85=8D=E5=A4=87?= =?UTF-8?q?=E8=9E=BA=E4=B8=9D=E5=8F=82=E6=95=B0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/product_template.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py index 6f50425f..2127aa99 100644 --- a/sf_manufacturing/models/product_template.py +++ b/sf_manufacturing/models/product_template.py @@ -229,7 +229,7 @@ class ResProductMo(models.Model): string='适用刀片型号' # 使用空列表作为默认值 ) cutting_tool_wrench = fields.Float('配对扳手(mm)') - # cutting_tool_screw = fields.Float('配备螺丝(mm)') + cutting_tool_screw = fields.Float('配备螺丝(mm)') cutting_tool_accuracy_level = fields.Char('精度等级') # 刀柄参数 cutting_tool_head_diameter = fields.Float('头部直径') From 165f961fb421052ba052cb45f1014664a2354b37 Mon Sep 17 00:00:00 2001 From: yuxianghui <1608204036@qq.com> Date: Tue, 12 Sep 2023 17:36:45 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E5=88=80=E5=85=B7?= =?UTF-8?q?=E7=AE=A1=E7=90=86-=E5=88=80=E5=85=B7=E7=89=A9=E6=96=99?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2-=E6=95=B4=E4=BD=93=E5=BC=8F=E5=88=80?= =?UTF-8?q?=E5=85=B7=E5=8F=82=E6=95=B0=E9=99=90=E5=88=B6=EF=BC=8C=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E6=95=B4=E4=BD=93=E5=BC=8F=E5=88=80=E5=85=B7=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E4=BD=8D=E7=BD=AE=EF=BC=8C=E6=B7=BB=E5=8A=A0=E8=83=BD?= =?UTF-8?q?=E5=8A=9B=E5=8F=82=E6=95=B0=E5=9B=BE=E6=96=87=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=8C=E7=9B=B4=E5=BE=84=E7=B1=BB=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E5=A2=9E=E5=8A=A0=CF=86=E7=9A=84=E5=89=8D=E7=BC=80?= =?UTF-8?q?=E5=8D=95=E4=BD=8D=EF=BC=9B=E6=B3=A8=E9=87=8A=E4=BA=A7=E5=93=81?= =?UTF-8?q?-=E5=88=80=E5=85=B7=E5=8F=82=E6=95=B0-cutting=5Ftool=5Fscrew?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/product_template.py | 2 +- .../models/tool_material_search.py | 146 +++++++++--------- .../views/tool_material_search.xml | 74 +++++---- 3 files changed, 114 insertions(+), 108 deletions(-) diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py index 2127aa99..6f50425f 100644 --- a/sf_manufacturing/models/product_template.py +++ b/sf_manufacturing/models/product_template.py @@ -229,7 +229,7 @@ class ResProductMo(models.Model): string='适用刀片型号' # 使用空列表作为默认值 ) cutting_tool_wrench = fields.Float('配对扳手(mm)') - cutting_tool_screw = fields.Float('配备螺丝(mm)') + # cutting_tool_screw = fields.Float('配备螺丝(mm)') cutting_tool_accuracy_level = fields.Char('精度等级') # 刀柄参数 cutting_tool_head_diameter = fields.Float('头部直径') diff --git a/sf_tool_management/models/tool_material_search.py b/sf_tool_management/models/tool_material_search.py index ab9c24f7..5917a097 100644 --- a/sf_tool_management/models/tool_material_search.py +++ b/sf_tool_management/models/tool_material_search.py @@ -105,79 +105,79 @@ class SfToolMaterialSearch(models.Model): cutting_speed_ids = fields.Many2many('sf.cutting.speed', string='切削速度Vc') feed_per_tooth_ids = fields.Many2many('sf.feed.per.tooth', 'rel_feed_per_tooth_ids', '每齿走刀量fz') - @api.constrains('suitable_machining_method_ids') - def _check_suitable_machining_method_ids(self): - for record in self: - if len(record.suitable_machining_method_ids) == 0 and self.cutting_tool_type == '整体式刀具': - raise ValidationError("适合加工方式不能为空!") - - @api.constrains('blade_tip_characteristics_ids') - def _check_blade_tip_characteristics_ids(self): - for record in self: - if len(record.blade_tip_characteristics_ids) == 0 and self.cutting_tool_type == '整体式刀具': - raise ValidationError("刀尖特征不能为空!") - if len(record.blade_tip_characteristics_ids) > 1 and self.cutting_tool_type == '整体式刀具': - raise ValidationError("刀尖特征只能单选!") - - @api.constrains('handle_type_ids') - def _check_handle_type_ids(self): - for record in self: - if len(record.handle_type_ids) == 0 and self.cutting_tool_type == '整体式刀具': - raise ValidationError("柄部类型不能为空!") - if len(record.handle_type_ids) > 1 and self.cutting_tool_type == '整体式刀具': - raise ValidationError("柄部类型只能单选!") - - @api.constrains('cutting_direction_ids') - def _check_cutting_direction_ids(self): - for record in self: - if len(record.cutting_direction_ids) == 0 and self.cutting_tool_type == '整体式刀具': - raise ValidationError("走刀方向不能为空!") - - @api.constrains('suitable_coolant_ids') - def _check_suitable_coolant_ids(self): - for record in self: - if not record.suitable_coolant_ids and self.cutting_tool_type == '整体式刀具': - raise ValidationError("适合冷却液不能为空!") - - @api.constrains('integral_total_length') - def _check_integral_total_length(self): - if self.integral_total_length <= 0 and self.cutting_tool_type == '整体式刀具': - raise ValidationError("总长度不能为0") - - @api.constrains('integral_shank_length') - def _check_integral_shank_length(self): - if self.integral_shank_length <= 0 and self.cutting_tool_type == '整体式刀具': - raise ValidationError("柄部长度不能为0") - - @api.constrains('integral_blade_length') - def _check_integral_blade_length(self): - if self.integral_blade_length <= 0 and self.cutting_tool_type == '整体式刀具': - raise ValidationError("刃部长度不能为0") - - @api.constrains('integral_blade_number') - def _check_integral_blade_number(self): - if self.integral_blade_number <= 0 and self.cutting_tool_type == '整体式刀具': - raise ValidationError("刃数不能为0") - - @api.constrains('integral_shank_diameter') - def _check_integral_shank_diameter(self): - if self.integral_shank_diameter <= 0 and self.cutting_tool_type == '整体式刀具': - raise ValidationError("柄部直径不能为0") - - @api.constrains('integral_blade_diameter') - def _check_integral_blade_diameter(self): - if self.integral_blade_diameter <= 0 and self.cutting_tool_type == '整体式刀具': - raise ValidationError("刃部直径不能为0") - - @api.constrains('integral_run_out_accuracy_min') - def _check_integral_blade_diameter(self): - if self.integral_run_out_accuracy_min <= 0 and self.cutting_tool_type == '整体式刀具': - raise ValidationError("端跳精度最小(min)不能为0") - - @api.constrains('integral_run_out_accuracy_max') - def _check_integral_run_out_accuracy_max(self): - if self.integral_run_out_accuracy_max <= 0 and self.cutting_tool_type == '整体式刀具': - raise ValidationError("端跳精度最大(max)不能为0") + # @api.constrains('suitable_machining_method_ids') + # def _check_suitable_machining_method_ids(self): + # for record in self: + # if len(record.suitable_machining_method_ids) == 0 and self.cutting_tool_type == '整体式刀具': + # raise ValidationError("适合加工方式不能为空!") + # + # @api.constrains('blade_tip_characteristics_ids') + # def _check_blade_tip_characteristics_ids(self): + # for record in self: + # if len(record.blade_tip_characteristics_ids) == 0 and self.cutting_tool_type == '整体式刀具': + # raise ValidationError("刀尖特征不能为空!") + # if len(record.blade_tip_characteristics_ids) > 1 and self.cutting_tool_type == '整体式刀具': + # raise ValidationError("刀尖特征只能单选!") + # + # @api.constrains('handle_type_ids') + # def _check_handle_type_ids(self): + # for record in self: + # if len(record.handle_type_ids) == 0 and self.cutting_tool_type == '整体式刀具': + # raise ValidationError("柄部类型不能为空!") + # if len(record.handle_type_ids) > 1 and self.cutting_tool_type == '整体式刀具': + # raise ValidationError("柄部类型只能单选!") + # + # @api.constrains('cutting_direction_ids') + # def _check_cutting_direction_ids(self): + # for record in self: + # if len(record.cutting_direction_ids) == 0 and self.cutting_tool_type == '整体式刀具': + # raise ValidationError("走刀方向不能为空!") + # + # @api.constrains('suitable_coolant_ids') + # def _check_suitable_coolant_ids(self): + # for record in self: + # if not record.suitable_coolant_ids and self.cutting_tool_type == '整体式刀具': + # raise ValidationError("适合冷却液不能为空!") + # + # @api.constrains('integral_total_length') + # def _check_integral_total_length(self): + # if self.integral_total_length <= 0 and self.cutting_tool_type == '整体式刀具': + # raise ValidationError("总长度不能为0") + # + # @api.constrains('integral_shank_length') + # def _check_integral_shank_length(self): + # if self.integral_shank_length <= 0 and self.cutting_tool_type == '整体式刀具': + # raise ValidationError("柄部长度不能为0") + # + # @api.constrains('integral_blade_length') + # def _check_integral_blade_length(self): + # if self.integral_blade_length <= 0 and self.cutting_tool_type == '整体式刀具': + # raise ValidationError("刃部长度不能为0") + # + # @api.constrains('integral_blade_number') + # def _check_integral_blade_number(self): + # if self.integral_blade_number <= 0 and self.cutting_tool_type == '整体式刀具': + # raise ValidationError("刃数不能为0") + # + # @api.constrains('integral_shank_diameter') + # def _check_integral_shank_diameter(self): + # if self.integral_shank_diameter <= 0 and self.cutting_tool_type == '整体式刀具': + # raise ValidationError("柄部直径不能为0") + # + # @api.constrains('integral_blade_diameter') + # def _check_integral_blade_diameter(self): + # if self.integral_blade_diameter <= 0 and self.cutting_tool_type == '整体式刀具': + # raise ValidationError("刃部直径不能为0") + # + # @api.constrains('integral_run_out_accuracy_min') + # def _check_integral_blade_diameter(self): + # if self.integral_run_out_accuracy_min <= 0 and self.cutting_tool_type == '整体式刀具': + # raise ValidationError("端跳精度最小(min)不能为0") + # + # @api.constrains('integral_run_out_accuracy_max') + # def _check_integral_run_out_accuracy_max(self): + # if self.integral_run_out_accuracy_max <= 0 and self.cutting_tool_type == '整体式刀具': + # raise ValidationError("端跳精度最大(max)不能为0") # integral_front_angle = fields.Float('整体式刀具前角(°)') # integral_rear_angle = fields.Float('整体式刀具后角(°)') diff --git a/sf_tool_management/views/tool_material_search.xml b/sf_tool_management/views/tool_material_search.xml index 594073ff..d461efce 100644 --- a/sf_tool_management/views/tool_material_search.xml +++ b/sf_tool_management/views/tool_material_search.xml @@ -194,50 +194,56 @@ - + + - - - + - - - - - - - - - + + + + + + + - + - - + + + + + + + - - - - - - - - + + + + + + + From 9e424600bc94632929bdf439485558ce13a72ea3 Mon Sep 17 00:00:00 2001 From: "qihao.gong@jikimo.com" Date: Wed, 13 Sep 2023 14:32:32 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E5=A4=84=E7=90=86=E6=9C=BA=E5=BA=8A?= =?UTF-8?q?=E8=83=BD=E5=8A=9B=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sf_equipment_maintenance_standards.py | 23 ++++++++++++------- sf_maintenance/models/sf_maintenance.py | 6 ++++- sf_maintenance/models/sf_maintenance_logs.py | 2 ++ .../equipment_maintenance_standards_views.xml | 17 ++++++++++++-- .../views/maintenance_request_views.xml | 14 +++++++++-- sf_maintenance/views/maintenance_views.xml | 11 +++++++-- sf_manufacturing/models/mrp_workcenter.py | 11 ++++++--- 7 files changed, 66 insertions(+), 18 deletions(-) diff --git a/sf_maintenance/models/sf_equipment_maintenance_standards.py b/sf_maintenance/models/sf_equipment_maintenance_standards.py index 5bdc7956..47e7ddaf 100644 --- a/sf_maintenance/models/sf_equipment_maintenance_standards.py +++ b/sf_maintenance/models/sf_equipment_maintenance_standards.py @@ -19,6 +19,7 @@ class SfEquipmentSaintenanceStandards(models.Model): num = "%04d" % m return num code = fields.Char(string='编码', default=get_no) + remark = fields.Char('备注') maintenance_type = fields.Selection([('保养', '保养'), ("检修", "检修")], string='类型', default='保养') name = fields.Char(string='名称') created_user_id = fields.Many2one('res.users', string='创建人', default=lambda self: self.env.user) @@ -26,7 +27,7 @@ class SfEquipmentSaintenanceStandards(models.Model): maintenance_equipment_ids = fields.Many2many( 'maintenance.equipment', 'sf_maintenance_equipment_ids', - string='设备', + string='适用设备', domain="[('category_id', '=', maintenance_equipment_category_id)]" ) @@ -42,23 +43,29 @@ class SfEquipmentSaintenanceStandards(models.Model): if record.maintenance_type == '检修': record.write({'overhaul_ids': [(6, 0, record.maintenance_equipment_ids.ids)]}) - @api.onchange("maintenance_standards_ids") - def _reset_work_order_sequence(self): - for rec in self: - current_sequence = 1 - for work in rec.maintenance_standards_ids: - work.sequence = current_sequence - current_sequence += 1 + # @api.onchange("maintenance_standards_ids") + # def _reset_work_order_sequence(self): + # for rec in self: + # current_sequence = 1 + # for work in rec.maintenance_standards_ids: + # work.sequence = current_sequence + # current_sequence += 1 class SfSaintenanceStandards(models.Model): _name = 'maintenance.standards' _description = '维保项目' + _order = 'sequence' + sequence = fields.Integer('序号') name = fields.Char('维保项目') maintenance_standards = fields.Char('维保标准') + fault_type = fields.Selection( + [('电气类', '电气类'), ('机械类', '机械类'), ('程序类', '程序类'), ('系统类', '系统类')], string='类别') equipment_maintenance_standards_id = fields.Many2one('equipment.maintenance.standards', string='设备维保标准') maintenance_request_id = fields.Many2one('maintenance.request', string='设备维保计划') images = fields.One2many('maintenance.standard.image', 'standard_id', string='反馈图片') + Period = fields.Integer('周期/频次(天)') + remark = fields.Char('备注说明') class MaintenanceStandardImage(models.Model): diff --git a/sf_maintenance/models/sf_maintenance.py b/sf_maintenance/models/sf_maintenance.py index 9273cc12..ef7ffc4c 100644 --- a/sf_maintenance/models/sf_maintenance.py +++ b/sf_maintenance/models/sf_maintenance.py @@ -44,6 +44,7 @@ class SfMaintenanceEquipment(models.Model): overhaul_period = fields.Integer(string='预防检修频次') overhaul_duration = fields.Float(string='检修时长') + overhaul_id = fields.Many2one('equipment.maintenance.standards', string='设备检修标准', domain="[('maintenance_type','=','检修')]") @@ -142,7 +143,7 @@ class SfMaintenanceEquipment(models.Model): active = fields.Boolean('有效', default=True) # 多个型号对应一个机床 machine_tool_id = fields.Many2one('sf.machine_tool', '机床') - sf_maintenance_logs_ids = fields.One2many('sf.maintenance.logs','maintenance_equipment_id', '设备故障日志') + sf_maintenance_logs_ids = fields.One2many('sf.maintenance.logs', 'maintenance_equipment_id', '设备故障日志') def name_get(self): @@ -481,5 +482,8 @@ class MaintenanceStandardImage(models.Model): _name = 'maintenance.equipment.image' _description = '设备图文展示' + + active = fields.Boolean('有效', default=True) + name = fields.Char('加工能力') image = fields.Binary(string='设备图文') equipment_id = fields.Many2many('maintenance.equipment', 'image_id', string='设备') \ No newline at end of file diff --git a/sf_maintenance/models/sf_maintenance_logs.py b/sf_maintenance/models/sf_maintenance_logs.py index 0204e676..9adf5be7 100644 --- a/sf_maintenance/models/sf_maintenance_logs.py +++ b/sf_maintenance/models/sf_maintenance_logs.py @@ -22,3 +22,5 @@ class SfMaintenanceLogs(models.Model): recovery_time = fields.Datetime(string='复原时间') fault_duration = fields.Float(string='故障时长') note = fields.Text(string='备注') + + diff --git a/sf_maintenance/views/equipment_maintenance_standards_views.xml b/sf_maintenance/views/equipment_maintenance_standards_views.xml index 82fbf15b..1b30b68f 100644 --- a/sf_maintenance/views/equipment_maintenance_standards_views.xml +++ b/sf_maintenance/views/equipment_maintenance_standards_views.xml @@ -21,14 +21,26 @@ - - + + + + + + + + + + + + + +
@@ -46,6 +58,7 @@ + diff --git a/sf_maintenance/views/maintenance_request_views.xml b/sf_maintenance/views/maintenance_request_views.xml index 9c5ae694..83bd6e44 100644 --- a/sf_maintenance/views/maintenance_request_views.xml +++ b/sf_maintenance/views/maintenance_request_views.xml @@ -24,9 +24,11 @@ + + @@ -78,8 +80,16 @@
- - + + + + + + + + + + diff --git a/sf_maintenance/views/maintenance_views.xml b/sf_maintenance/views/maintenance_views.xml index 2aa0b980..1ab6f0bf 100644 --- a/sf_maintenance/views/maintenance_views.xml +++ b/sf_maintenance/views/maintenance_views.xml @@ -34,6 +34,7 @@ +