Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/制造代码优化

This commit is contained in:
mgw
2024-01-26 15:08:29 +08:00
12 changed files with 273 additions and 91 deletions

View File

@@ -79,9 +79,9 @@ td.o_required_modifier {
}
.oe_kanban_card.kanban_color_1 {
background-color: #27FEA9 !important;
background-color: #fff !important;
opacity: 0.7;
color: #fff;
color: #777;
}
.oe_kanban_card.kanban_color_3 {

View File

@@ -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 = []

View File

@@ -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 = []
@@ -31,3 +32,18 @@ class SfMaintenanceEquipmentOEE(models.Model):
name = parameter.equipment_id.name
result.append((parameter.id, name))
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')

View File

@@ -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_system_user,equipment.request system user,maintenance.model_maintenance_request,base.group_user,1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
7 access_maintenance_equipment_oee maintenance_equipment_oee model_maintenance_equipment_oee sf_group_equipment_user 1 0 0 0
8 access_maintenance_equipment_oee maintenance_equipment_oee model_maintenance_equipment_oee sf_group_equipment_manager 1 1 1 0
9 access_maintenance_equipment_oee maintenance_equipment_oee model_maintenance_equipment_oee base.group_user 1 1 1 1
10 access_maintenance_equipment_oee_logs maintenance_equipment_oee_logs model_maintenance_equipment_oee_logs sf_group_equipment_user 1 0 0 0
11 access_maintenance_equipment_oee_logs maintenance_equipment_oee_logs model_maintenance_equipment_oee_logs sf_group_equipment_manager 1 1 1 0
12 access_maintenance_equipment_oee_logs maintenance_equipment_oee_logs model_maintenance_equipment_oee_logs base.group_user 1 1 1 1
13 access_maintenance_standards maintenance_standards model_maintenance_standards sf_group_equipment_user 1 0 0 0
14 access_maintenance_standards maintenance_standards model_maintenance_standards sf_group_equipment_manager 1 1 1 0
15 access_maintenance_standard_image maintenance_standard_image model_maintenance_standard_image sf_group_equipment_user 1 0 0 0
16 access_maintenance_standard_image maintenance_standard_image model_maintenance_standard_image sf_group_equipment_manager 1 1 1 0
17 access_sf_robot_axis_num sf_robot_axis_num model_sf_robot_axis_num sf_group_equipment_user 1 0 0 0
18 access_sf_robot_axis_num sf_robot_axis_num model_sf_robot_axis_num sf_group_equipment_manager 1 1 1 0
19 access_maintenance_equipment_agv_log maintenance_equipment_agv_log model_maintenance_equipment_agv_log sf_group_equipment_user 1 0 0 0
20 access_maintenance_equipment_agv_log maintenance_equipment_agv_log model_maintenance_equipment_agv_log sf_group_equipment_manager 1 1 1 0
21 access_maintenance_equipment_agv_log maintenance_equipment_agv_log model_maintenance_equipment_agv_log base.group_user 1 1 1 1
22 access_maintenance_system_user equipment.request system user maintenance.model_maintenance_request base.group_user 1 0 0 0
23 access_maintenance_equipment_group_plan_dispatch maintenance.equipment maintenance.model_maintenance_equipment sf_base.group_plan_dispatch 1 0 0 0
24 access_sf_maintenance_logs_group_plan_dispatch sf_maintenance_logs model_sf_maintenance_logs sf_base.group_plan_dispatch 1 0 0 0

View File

@@ -49,6 +49,19 @@
</group>
</group>
<notebook>
<page string="运行日志">
<field name="oee_logs">
<tree create="1" edit="1" delete="1" editable="bottom">
<field name = 'run_time'/>
<field name = 'state'/>
<field name = 'workorder_id'/>
<field name = 'time'/>
<field name = 'color' widget="color"/>
</tree>
</field>
</page>
</notebook>
</sheet>
</form>
</field>
@@ -63,6 +76,7 @@
<searchpanel>
<field name="equipment_id" icon="fa-building" enable_counters="1"/>
</searchpanel>
<field name="equipment_id"/>
</search>
</field>
</record>

View File

@@ -32,6 +32,14 @@
<field string="设备故障日志" name="sf_maintenance_logs_ids" widget="statinfo"/>
</button>
<button name="%(action_maintenance_oee)d"
type="action"
class="oe_stat_button"
context="{'search_default_equipment_id': [active_id]}"
icon="fa-exchange"
attrs="{'invisible': [('state_zc', '!=', '已注册')]}">
<field string="设备oee" name="equipment_oee_ids" widget="statinfo"/>
</button>
</xpath>
<xpath expr="//field[@name='maintenance_team_id']" position="before">
@@ -63,15 +71,18 @@
attrs="{'invisible': [('equipment_type', '!=', '机床')]}">
<group>
<group string="基础参数">
<field name="control_system_id" attrs="{'required': [('equipment_type', '=', '机床')]}" options="{'no_create': True}"/>
<field name="control_system_id" attrs="{'required': [('equipment_type', '=', '机床')]}"
options="{'no_create': True}"/>
<label for="workbench_L" string="工作台尺寸(mm)"/>
<div class="test_model">
<label for="workbench_L" string="长"/>
<field name="workbench_L" class="o_address_zip" attrs="{'required': [('equipment_type', '=', '机床')]}"
<field name="workbench_L" class="o_address_zip"
attrs="{'required': [('equipment_type', '=', '机床')]}"
options="{'format': false}"/>
<span>&amp;nbsp;</span>
<label for="workbench_W" string="宽"/>
<field name="workbench_W" class="o_address_zip" attrs="{'required': [('equipment_type', '=', '机床')]}"
<field name="workbench_W" class="o_address_zip"
attrs="{'required': [('equipment_type', '=', '机床')]}"
options="{'format': false}"/>
</div>
<field name="workpiece_load"/>
@@ -115,22 +126,26 @@
<!-- <field name="lead_screw" required="1"/>-->
<!-- <field name="guide_rail" required="1"/>-->
<field name="number_of_axles" attrs="{'required': [('equipment_type', '=', '机床')]}" widget="radio"
<field name="number_of_axles" attrs="{'required': [('equipment_type', '=', '机床')]}"
widget="radio"
options="{'horizontal': true}"/>
<label for="x_axis" string="加工行程(mm)"
attrs="{'invisible': [('number_of_axles', '=', False)]}"/>
<div class="test_model"
attrs="{'invisible': [('number_of_axles', '=', False)]}">
<label for="x_axis" string="x"/>
<field name="x_axis" class="o_address_zip" attrs="{'required': [('equipment_type', '=', '机床')]}"
<field name="x_axis" class="o_address_zip"
attrs="{'required': [('equipment_type', '=', '机床')]}"
options="{'format': false}"/>
<span>&amp;nbsp;</span>
<label for="y_axis" string="y"/>
<field name="y_axis" class="o_address_zip" attrs="{'required': [('equipment_type', '=', '机床')]}"
<field name="y_axis" class="o_address_zip"
attrs="{'required': [('equipment_type', '=', '机床')]}"
options="{'format': false}"/>
<span>&amp;nbsp;</span>
<label for="z_axis" string="z"/>
<field name="z_axis" class="o_address_zip" attrs="{'required': [('equipment_type', '=', '机床')]}"
<field name="z_axis" class="o_address_zip"
attrs="{'required': [('equipment_type', '=', '机床')]}"
options="{'format': false}"/>
<span>&amp;nbsp;</span>
<label for="a_axis" string="a"
@@ -179,7 +194,9 @@
</group>
<group string="刀具">
<!-- <field name="knife_type" required="1"/>-->
<field name="number_of_knife_library" attrs="{'required': [('equipment_type', '=', '机床')]}" options="{'format': false}"/>
<field name="number_of_knife_library"
attrs="{'required': [('equipment_type', '=', '机床')]}"
options="{'format': false}"/>
<!-- <field name="tool_speed" required="1"/>-->
<field name="tool_full_diameter_max"/>
<field name="tool_perimeter_diameter_max"/>
@@ -227,7 +244,21 @@
</group>
</page>
<page string="AGV运行日志" name="sf_equipment"
attrs="{'invisible': [('equipment_type', '!=', 'AGV小车')]}">
<field name="agv_logs">
<tree create="1" edit="1" delete="1" editable="bottom">
<field name = 'run_type'/>
<field name = 'run_code'/>
<field name = 'run_first'/>
<field name = 'run_last'/>
<field name = 'production_line'/>
<field name = 'workorder'/>
<field name = 'time'/>
<field name = 'state'/>
</tree>
</field>
</page>
<page string="设备参数" name="sf_equipment"
@@ -913,7 +944,8 @@
</xpath>
<xpath expr="//notebook" position="before">
<group string="加工能力" attrs="{'invisible': [('equipment_type', '!=', '机床')]}" class="processingMethod">
<group string="加工能力" attrs="{'invisible': [('equipment_type', '!=', '机床')]}"
class="processingMethod">
<div>
<field name='image_id' widget="custom_many2many_checkboxes" string="">
@@ -925,7 +957,8 @@
</field>
</div>
</group>
<group string="冷却方式" attrs="{'invisible': [('equipment_type', '!=', '机床')]}" class="processingMethod">
<group string="冷却方式" attrs="{'invisible': [('equipment_type', '!=', '机床')]}"
class="processingMethod">
<div>
<field name='image_lq_id' widget="custom_many2many_checkboxes" string="">

View File

@@ -10,22 +10,20 @@
<field name="partner_id" widget="res_partner_many2one" context="{'is_supplier': True }"/>
</field>
<field name="currency_id" position="after">
<field name="check_status" invisible="1"/>
<!-- <field name="state"/>-->
<field name="remark" attrs="{'readonly': ['&amp;',('state', 'in', ['purchase']),('check_status','in',
['pending','approved'])]}"/>
</field>
<xpath expr="//form/header/button[@name='action_rfq_send'][1]" position="after">
<button name="sf_sale.action_purchase_order_check_wizard" string="审核" type="action"
context="{'default_order_id':active_id}" groups="sf_base.group_purchase_director"
attrs="{'invisible': ['&amp;',('check_status','in', ['approved',False,'fail']),('state', 'in', ['purchase'])]}"
attrs="{'invisible': ['&amp;',('check_status','in', ['approved',False,'fail']),('state', 'in', ['purchase','draft'])]}"
class="oe_highlight"/>
</xpath>
<xpath expr="//form/header/button[@name='button_confirm'][2]" position="replace">
<button name="button_confirm" type="object" context="{'validate_analytic': True}"
string="确认订单" id="draft_confirm"
attrs="{'invisible': ['|','&amp;','&amp;', ('state', 'in', ['purchase']), ('check_status', 'in', ['approved']), ('date_approve', '!=', False),'&amp;', '&amp;',('state', 'in', ['purchase', 'draft']),('check_status', 'in', [False, 'pending', 'fail']),('date_approve', '=', False)]}"
attrs="{'invisible': ['|','&amp;','&amp;', ('state', 'in', ['purchase','draft']), ('check_status', 'in', ['approved']), ('date_approve', '!=', False),'&amp;', '&amp;',('state', 'in', ['purchase', 'draft']),('check_status', 'in', [False, 'pending', 'fail']),('date_approve', '=', False)]}"
/>
<button name="button_confirming" type="object"
string="确认订单"

View File

@@ -87,8 +87,11 @@
attrs="{'invisible': ['|','&amp;',('check_status', '!=', 'approved'),('state', 'in', ['draft','cancel']),'&amp;','&amp;',('check_status', '=', 'approved'),('state', 'in', ['sale','cancel']),('schedule_status', 'not in', False)]}"/>
</xpath>
<xpath expr="//form/header/button[@name='action_cancel']" position="attributes">
<attribute name="attrs">{'invisible': ['|',('state', 'in', ['cancel']),('check_status', 'in',
[False,'approved'])]}
<attribute name="attrs">{'invisible': ['|','&amp;',('state', 'in',
['cancel','draft']),('check_status',
'in',
[False,'approved']),'&amp;','&amp;',('check_status', '=', 'approved'),('state', 'in',
['sale','cancel','draft']),('schedule_status', 'not in', False)]}
</attribute>
</xpath>
<xpath expr="//form/header/button[@name='action_draft']" position="attributes">

View File

@@ -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
if record.location_status == '禁用':
record.storage_time = False
name = fields.Char('名称', required=True, size=20)
barcode = fields.Char('编码', copy=False, size=15)
@@ -290,8 +308,8 @@ class ShelfLocation(models.Model):
record.sudo().product_id = record.product_sn_id.product_id
record.sudo().location_status = '占用'
else:
record.sudo().product_id = False
record.sudo().location_status = '空闲'
record.product_id = False
# record.location_status = '空闲'
@api.depends('location_type')
def _compute_hide_what(self):
@@ -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

View File

@@ -52,7 +52,7 @@
}
.green {
background-color: #fff !important;
background-color: #27FEA9 !important;
border: 1px solid #ccc;
}

View File

@@ -7,7 +7,7 @@
<field name="inherit_id" ref="stock.view_stock_move_line_detailed_operation_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='location_id'][2]" position="after">
<field name="current_location_id"/>
<field name="current_location_id" force_save="1"/>
</xpath>
<xpath expr="//field[@name='location_dest_id'][2]" position="after">
<field name="destination_location_id" domain="[
@@ -23,13 +23,31 @@
</field>
</record>
<record id="sf_view_move_line_tree" model="ir.ui.view">
<field name="name">sf.stock.move.line.tree</field>
<field name="model">stock.move.line</field>
<field name="inherit_id" ref="stock.view_move_line_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='location_id']" position="after">
<field name="current_location_id" force_save="1"/>
</xpath>
<xpath expr="//field[@name='location_dest_id']" position="after">
<field name="destination_location_id" />
<!-- <field name="location_dest_id_product_type"/> -->
<!-- <field name="location_dest_id"/> -->
<field name="location_dest_id_value" invisible="1"/>
<!-- <button name="button_test" string="测试" type="object" class="oe_highlight"/> -->
</xpath>
</field>
</record>
<record id="sf_stock_move_line_form" model="ir.ui.view">
<field name="name">sf.stock.move.line.form</field>
<field name="model">stock.move.line</field>
<field name="inherit_id" ref="stock.view_move_line_form"/>
<field name="arch" type="xml">
<xpath expr="//form//sheet//group//group//field[@name='location_id']" position="after">
<field name="current_location_id" options="{'no_create': False}"/>
<field name="current_location_id" options="{'no_create': False}" force_save="1"/>
</xpath>
<xpath expr="//form//sheet//group//group//field[@name='location_dest_id']" position="after">
<field name="destination_location_id" options="{'no_create': False}"/>

View File

@@ -9,26 +9,82 @@
<field name="name" string="名称"/>
<field name="barcode" string="编码"/>
<field name="location_type"/>
<!-- <field name="check_state" widget="label_selection"-->
<!-- options="{'classes': {'unchecked':'warning','checked': 'success'}}"/>-->
<!-- <button name="action_check" string="审核" type="object"-->
<!-- attrs="{'invisible': [('check_state','=', 'enable')]}"-->
<!-- groups="sf_warehouse.group_sf_stock_manager"-->
<!-- class="oe_highlight"/>-->
<!-- <field name="check_state" widget="label_selection"-->
<!-- options="{'classes': {'unchecked':'warning','checked': 'success'}}"/>-->
<!-- <button name="action_check" string="审核" type="object"-->
<!-- attrs="{'invisible': [('check_state','=', 'enable')]}"-->
<!-- groups="sf_warehouse.group_sf_stock_manager"-->
<!-- class="oe_highlight"/>-->
</tree>
</field>
</record>
<!-- 货架货位移动历史按钮-->
<record id="sf_stock_move_line_view_search" model="ir.ui.view">
<field name="name">sf.view.picking.form</field>
<field name="model">stock.move.line</field>
<field name="inherit_id" ref="stock.stock_move_line_view_search"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='product_id']" position="after">
<field name='current_location_id'/>
<field name='destination_location_id'/>
</xpath>
</field>
</record>
<record id="stock_move_line_action1" model="ir.actions.act_window">
<field name="name">移动历史</field>
<field name="res_model">stock.move.line</field>
<field name="type">ir.actions.act_window</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="sf_stock_move_line_view_search"/>
<field name="view_id" ref="stock.view_move_line_tree"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
产品移动历史
</p>
</field>
</record>
<record id="view_shelf_location_form" model="ir.ui.view">
<field name="name">Shelf Location form</field>
<field name="model">sf.shelf.location</field>
<field name="arch" type="xml">
<form string="Shelf Location">
<header>
<button string="生成货位" name="create_location" type="object" class="oe_highlight"
attrs="{'invisible': [('hide_shelf', '=', False)]}"/>
<!-- <button name="%(shelf_location_kanban_action_id)d"-->
<!-- type="action"-->
<!-- class="oe_stat_button"-->
<!-- context="{'search_default_maintenance_equipment_id': [active_id]}"-->
<!-- icon="fa-wrench">-->
<!-- <field string="目标位置调拨" name="destination_move_ids" widget="statinfo"/>-->
<!-- </button>-->
</header>
<sheet>
<div class="oe_button_box" name="button_box">
<button name="%(stock_move_line_action1)d"
type="action"
class="oe_stat_button"
context="{'search_default_current_location_id': [active_id]}"
icon="fa-exchange">
<field string="当前位置历史" name="current_move_ids" widget="statinfo"/>
</button>
<button name="%(stock_move_line_action1)d"
type="action"
class="oe_stat_button"
context="{'search_default_destination_location_id': [active_id]}"
icon="fa-exchange">
<field string="目标位置历史" name="destination_move_ids" widget="statinfo"/>
</button>
</div>
<group>
<field name="hide_shelf" invisible="1"/>
<field name="hide_location" invisible="1"/>
@@ -55,6 +111,7 @@
<!-- <field name="product_type" attrs="{'invisible': [('hide_location', '=', False)], 'required': [('hide_location', '!=', False), ('location_status', '=', '占用')]}" widget="many2many_tags"/> -->
<field name="location_status"
attrs="{'invisible': [('hide_location', '=', False)], 'required': [('hide_location', '!=', False)]}"/>
<field name="storage_time" widget="datetime"/>
</group>
</sheet>
</form>