@@ -85,7 +85,7 @@
-
+
-->
+ options="{'horizontal': true}"/>
-
-
+
+
@@ -237,7 +237,7 @@
-
+
@@ -252,21 +252,21 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -979,31 +979,58 @@
-
-
+
+
+
+
+
+
+
+
+
+
+ days
+
+
+
+
+ hours
+
+
+
+
+
+
+
+
+
+
+
+
+ days
+
+
+
+
+ hours
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
- days
-
-
-
-
-
- hours
-
-
-
-
1
@@ -1189,7 +1216,7 @@
-
+
diff --git a/sf_maintenance/wizard/__init__.py b/sf_maintenance/wizard/__init__.py
new file mode 100644
index 00000000..d8d470dc
--- /dev/null
+++ b/sf_maintenance/wizard/__init__.py
@@ -0,0 +1 @@
+from . import maintenance_request_wizard
\ No newline at end of file
diff --git a/sf_maintenance/wizard/maintenance_request_wizard.py b/sf_maintenance/wizard/maintenance_request_wizard.py
new file mode 100644
index 00000000..e0f8d8fa
--- /dev/null
+++ b/sf_maintenance/wizard/maintenance_request_wizard.py
@@ -0,0 +1,26 @@
+from odoo import fields, models
+
+
+class MaintenanceRequestWizard(models.TransientModel):
+ _name = 'maintenance.request.wizard'
+ _description = '维保二次确认弹窗'
+
+ name = fields.Char('')
+
+ def submit(self):
+ context = self.env.context
+ equipment_id = self.env['maintenance.equipment'].sudo().search([('id', '=', context['equipment_id'])])
+ request_ids = self.env['maintenance.request'].search([('stage_id.done', '=', False),
+ ('equipment_id', '=', equipment_id.id),
+ ('maintenance_type', '=', 'preventive'),
+ ('sf_maintenance_type', '=', context['type'])])
+ request_ids.write({'active': False})
+ return equipment_id.create_maintenance_request(context['type'])
+
+ def cancel(self):
+ context = self.env.context
+ equipment_id = self.env['maintenance.equipment'].sudo().search([('id', '=', context['equipment_id'])])
+ if context['type'] == '保养':
+ equipment_id.initial_action_date = equipment_id.initial_action_date_old
+ elif context['type'] == '检修':
+ equipment_id.initial_overhaul_date = equipment_id.initial_overhaul_date_old
diff --git a/sf_maintenance/wizard/maintenance_request_wizard.xml b/sf_maintenance/wizard/maintenance_request_wizard.xml
new file mode 100644
index 00000000..632c21d9
--- /dev/null
+++ b/sf_maintenance/wizard/maintenance_request_wizard.xml
@@ -0,0 +1,29 @@
+
+
+
+ 维保计划
+ maintenance.request.wizard
+ form
+ new
+
+
+
+ maintenance.request.wizard.form.view
+ maintenance.request.wizard
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sf_tool_management/models/functional_tool.py b/sf_tool_management/models/functional_tool.py
index e8523cd3..78a652f4 100644
--- a/sf_tool_management/models/functional_tool.py
+++ b/sf_tool_management/models/functional_tool.py
@@ -51,6 +51,8 @@ class FunctionalCuttingToolEntity(models.Model):
string='位置', compute='_compute_current_location_id', store=True)
image = fields.Binary('图片', readonly=True)
+ stock_num = fields.Integer('库存变更次数', default=0)
+
safe_inventory_id = fields.Many2one('sf.real.time.distribution.of.functional.tools',
string='功能刀具安全库存', readonly=True)
@@ -71,7 +73,7 @@ class FunctionalCuttingToolEntity(models.Model):
})
@api.depends('barcode_id.quant_ids', 'barcode_id.quant_ids.location_id', 'functional_tool_status',
- 'current_shelf_location_id')
+ 'current_shelf_location_id', 'stock_num')
def _compute_current_location_id(self):
for record in self:
if record.functional_tool_status == '已拆除':
diff --git a/sf_tool_management/models/stock.py b/sf_tool_management/models/stock.py
index 9f0d9f82..92198239 100644
--- a/sf_tool_management/models/stock.py
+++ b/sf_tool_management/models/stock.py
@@ -53,6 +53,13 @@ class StockMoveLine(models.Model):
[('barcode_id', '=', line_id.lot_id.id),
('functional_tool_status', '=', '正常')]).cnc_function_tool_use_verify()
+ for move_line in move_lines:
+ if move_line.lot_id:
+ tool_id = self.env['sf.functional.cutting.tool.entity'].sudo().search(
+ [('barcode_id', '=', move_line.lot_id.id),
+ ('functional_tool_status', '=', '正常')])
+ tool_id.stock_num += tool_id.stock_num
+
class StockPicking(models.Model):
_inherit = 'stock.picking'