From 0ef13504e7cfb57f748da51a9f98383de38ddc08 Mon Sep 17 00:00:00 2001 From: "qihao.gong@jikimo.com" Date: Mon, 22 Jan 2024 17:33:40 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B4=A7=E6=9E=B6?= =?UTF-8?q?=E8=B4=A7=E4=BD=8D=E5=85=B3=E8=81=94=E7=A7=BB=E5=8A=A8=E5=8E=86?= =?UTF-8?q?=E5=8F=B2=E8=B0=83=E6=8B=A8=E5=8D=95=E5=85=B3=E8=81=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/product_template.py | 4 +- sf_sale/models/auto_quatotion_common.py | 2 +- sf_sale/models/quick_easy_order.py | 4 +- sf_warehouse/models/model.py | 20 +++++- .../views/change_stock_move_views.xml | 22 +++++- sf_warehouse/views/shelf_location.xml | 69 +++++++++++++++++-- 6 files changed, 107 insertions(+), 14 deletions(-) diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py index 42a392e2..cac61045 100644 --- a/sf_manufacturing/models/product_template.py +++ b/sf_manufacturing/models/product_template.py @@ -6,8 +6,8 @@ import os from odoo import models, fields, api, _ from odoo.exceptions import ValidationError from odoo.modules import get_resource_path -from OCC.Extend.DataExchange import read_step_file -from OCC.Extend.DataExchange import write_stl_file +#from OCC.Extend.DataExchange import read_step_file +#from OCC.Extend.DataExchange import write_stl_file class ResProductMo(models.Model): diff --git a/sf_sale/models/auto_quatotion_common.py b/sf_sale/models/auto_quatotion_common.py index 09ea3f0f..1b29c6d2 100644 --- a/sf_sale/models/auto_quatotion_common.py +++ b/sf_sale/models/auto_quatotion_common.py @@ -2,7 +2,7 @@ import logging from odoo.modules import get_resource_path from odoo import fields, models, api -from quatotion import readSql, feature_recognize, auto_quatotion +#from quatotion import readSql, feature_recognize, auto_quatotion __author__ = 'jinling.yang' _logger = logging.getLogger(__name__) diff --git a/sf_sale/models/quick_easy_order.py b/sf_sale/models/quick_easy_order.py index 1e5f274c..5ec1fd52 100644 --- a/sf_sale/models/quick_easy_order.py +++ b/sf_sale/models/quick_easy_order.py @@ -5,8 +5,8 @@ import os import json from datetime import datetime import requests -from OCC.Extend.DataExchange import read_step_file -from OCC.Extend.DataExchange import write_stl_file +#from OCC.Extend.DataExchange import read_step_file +#from OCC.Extend.DataExchange import write_stl_file from odoo import models, fields, api from odoo.modules import get_resource_path from odoo.exceptions import ValidationError, UserError diff --git a/sf_warehouse/models/model.py b/sf_warehouse/models/model.py index d03789cd..a53dae86 100644 --- a/sf_warehouse/models/model.py +++ b/sf_warehouse/models/model.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +import datetime import logging from odoo import api, fields, models from odoo.osv import expression @@ -223,6 +224,23 @@ class ShelfLocation(models.Model): _description = '货架货位' _order = 'name' + # current_location_id = fields.Many2one('sf.shelf.location', string='当前位置') + # # 目的位置 + # destination_location_id = fields.Many2one('sf.shelf.location', string='目的位置') + current_move_ids = fields.One2many('stock.move.line', 'current_location_id', '当前位置调拨单') + destination_move_ids = fields.One2many('stock.move.line', 'destination_location_id', '目标位置调拨单') + storage_time = fields.Datetime('入库时间', compute='_compute_location_status') + + @api.depends('location_status') + def _compute_location_status(self): + for record in self: + if record.location_status == '占用': + record.storage_time = datetime.datetime.now() + if record.location_status == '空闲': + record.storage_time = False + else: + pass + name = fields.Char('名称', required=True, size=20) barcode = fields.Char('编码', copy=False, size=15) @@ -452,7 +470,7 @@ class SfStockPicking(models.Model): if line: if line.current_location_id: line.current_location_id.product_sn_id = False - line.current_location_id = False + line.current_location_id.location_status = '空闲' return res diff --git a/sf_warehouse/views/change_stock_move_views.xml b/sf_warehouse/views/change_stock_move_views.xml index c53fc1bb..5b8c8c06 100644 --- a/sf_warehouse/views/change_stock_move_views.xml +++ b/sf_warehouse/views/change_stock_move_views.xml @@ -7,7 +7,7 @@ - + + sf.stock.move.line.tree + stock.move.line + + + + + + + + + + + + + + + sf.stock.move.line.form stock.move.line - + diff --git a/sf_warehouse/views/shelf_location.xml b/sf_warehouse/views/shelf_location.xml index 7ac4dcbc..f19a6421 100644 --- a/sf_warehouse/views/shelf_location.xml +++ b/sf_warehouse/views/shelf_location.xml @@ -9,26 +9,82 @@ - - - - - - + + + + + + + + + + + sf.view.picking.form + stock.move.line + + + + + + + + + + + 移动历史 + stock.move.line + ir.actions.act_window + tree,form + + + +

+ 产品移动历史 +

+
+
+ Shelf Location form sf.shelf.location
+
+
+ + +
@@ -55,6 +111,7 @@ +
From fc7c66c61533d2349f844cdda94089f092d8db78 Mon Sep 17 00:00:00 2001 From: "qihao.gong@jikimo.com" Date: Wed, 24 Jan 2024 17:29:42 +0800 Subject: [PATCH 2/4] =?UTF-8?q?AGV=E5=A2=9E=E5=8A=A0=E8=BF=90=E8=A1=8C?= =?UTF-8?q?=E6=97=A5=E5=BF=97=20=E8=AE=BE=E5=A4=87oee=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_maintenance/models/sf_maintenance.py | 19 ++ sf_maintenance/models/sf_maintenance_oee.py | 18 +- sf_maintenance/security/ir.model.access.csv | 6 + .../views/maintenance_equipment_oee_views.xml | 14 ++ sf_maintenance/views/maintenance_views.xml | 173 +++++++++++------- 5 files changed, 159 insertions(+), 71 deletions(-) diff --git a/sf_maintenance/models/sf_maintenance.py b/sf_maintenance/models/sf_maintenance.py index acb87eb6..73826ed9 100644 --- a/sf_maintenance/models/sf_maintenance.py +++ b/sf_maintenance/models/sf_maintenance.py @@ -17,12 +17,30 @@ class SfMaintenanceEquipmentCategory(models.Model): equipment_type_code = fields.Char('简写') +class SfMaintenanceEquipmentAGVLog(models.Model): + _name = 'maintenance.equipment.agv.log' + _description = 'AGV运行日志' + + run_type = fields.Char('任务类型') + run_code = fields.Char('任务指令代码') + run_first = fields.Char('任务起点') + production_line = fields.Char('目的生产线') + run_last = fields.Char('任务终点') + workorder = fields.Char('工件编码/任务单号') + time = fields.Datetime('日期/事件') + state = fields.Char('事件/状体') + equipment_id = fields.Many2one('maintenance.equipment', '设备') + + class SfMaintenanceEquipment(models.Model): _inherit = 'maintenance.equipment' _description = '设备' crea_url = "/api/machine_tool/create" + + #AGV运行日志 + agv_logs = fields.One2many('maintenance.equipment.agv.log', 'equipment_id', string='AGV运行日志') # 1212修改后的字段 number_of_axles = fields.Selection( [("三轴", "三轴"), ("四轴", "四轴"), ("五轴", "五轴"), ("六轴", "六轴")], @@ -194,6 +212,7 @@ class SfMaintenanceEquipment(models.Model): # 多个型号对应一个机床 machine_tool_id = fields.Many2one('sf.machine_tool', '机床') sf_maintenance_logs_ids = fields.One2many('sf.maintenance.logs', 'maintenance_equipment_id', '设备故障日志') + equipment_oee_ids = fields.One2many('maintenance.equipment.oee', 'equipment_id', '设备OEE') # def name_get(self): # result = [] diff --git a/sf_maintenance/models/sf_maintenance_oee.py b/sf_maintenance/models/sf_maintenance_oee.py index 71802fda..6d76ffbe 100644 --- a/sf_maintenance/models/sf_maintenance_oee.py +++ b/sf_maintenance/models/sf_maintenance_oee.py @@ -23,6 +23,7 @@ class SfMaintenanceEquipmentOEE(models.Model): fault_nums = fields.Integer('故障次数') sf_maintenance_logs_ids = fields.One2many('sf.maintenance.logs', 'maintenance_equipment_oee_id', '设备故障日志', related='equipment_id.sf_maintenance_logs_ids') + oee_logs = fields.One2many('maintenance.equipment.oee.logs', 'equipment_oee_id', string='运行日志') def name_get(self): result = [] @@ -30,4 +31,19 @@ class SfMaintenanceEquipmentOEE(models.Model): if parameter.equipment_id: name = parameter.equipment_id.name result.append((parameter.id, name)) - return result \ No newline at end of file + return result + + +class SfMaintenanceEquipmentOEELog(models.Model): + _name = 'maintenance.equipment.oee.logs' + _description = '设备运行日志' + + name = fields.Char('运行日志') + run_time = fields.Datetime('时间') + state = fields.Selection([("开机", "开机"), ("关机", "关机"), ("等待", "等待"), ("开始加工", "开始加工"), + ("结束加工", "结束加工"), ("故障", "故障"), + ("检修", "检修"), ("保养", "保养")], default="", string="事件/状态") + workorder_id = fields.Char('加工订单') + time = fields.Char('持续时长') + color = fields.Char('颜色', default=1) + equipment_oee_id = fields.Many2one('maintenance.equipment.oee', '设备OEE') diff --git a/sf_maintenance/security/ir.model.access.csv b/sf_maintenance/security/ir.model.access.csv index 575afec5..602177e9 100644 --- a/sf_maintenance/security/ir.model.access.csv +++ b/sf_maintenance/security/ir.model.access.csv @@ -7,12 +7,18 @@ access_maintenance_equipment,maintenance_equipment,model_maintenance_equipment,s 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_equipment_oee_logs,maintenance_equipment_oee_logs,model_maintenance_equipment_oee_logs,sf_group_equipment_user,1,0,0,0 +access_maintenance_equipment_oee_logs,maintenance_equipment_oee_logs,model_maintenance_equipment_oee_logs,sf_group_equipment_manager,1,1,1,0 +access_maintenance_equipment_oee_logs,maintenance_equipment_oee_logs,model_maintenance_equipment_oee_logs,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_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_manager,1,1,1,0 access_sf_robot_axis_num,sf_robot_axis_num,model_sf_robot_axis_num,sf_group_equipment_user,1,0,0,0 access_sf_robot_axis_num,sf_robot_axis_num,model_sf_robot_axis_num,sf_group_equipment_manager,1,1,1,0 +access_maintenance_equipment_agv_log,maintenance_equipment_agv_log,model_maintenance_equipment_agv_log,sf_group_equipment_user,1,0,0,0 +access_maintenance_equipment_agv_log,maintenance_equipment_agv_log,model_maintenance_equipment_agv_log,sf_group_equipment_manager,1,1,1,0 +access_maintenance_equipment_agv_log,maintenance_equipment_agv_log,model_maintenance_equipment_agv_log,base.group_user,1,1,1,1 access_maintenance_request_group_plan_dispatch,maintenance.request,maintenance.model_maintenance_request,sf_base.group_plan_dispatch,1,0,0,0 diff --git a/sf_maintenance/views/maintenance_equipment_oee_views.xml b/sf_maintenance/views/maintenance_equipment_oee_views.xml index 60055631..091e3c47 100644 --- a/sf_maintenance/views/maintenance_equipment_oee_views.xml +++ b/sf_maintenance/views/maintenance_equipment_oee_views.xml @@ -49,6 +49,19 @@ + + + + + + + + + + + + +
@@ -63,6 +76,7 @@ +
diff --git a/sf_maintenance/views/maintenance_views.xml b/sf_maintenance/views/maintenance_views.xml index 0dc18355..125a86c0 100644 --- a/sf_maintenance/views/maintenance_views.xml +++ b/sf_maintenance/views/maintenance_views.xml @@ -32,6 +32,14 @@ +
@@ -63,15 +71,18 @@ attrs="{'invisible': [('equipment_type', '!=', '机床')]}"> - +