Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/修改机床参数bug

This commit is contained in:
qihao.gong@jikimo.com
2023-08-23 14:37:20 +08:00
12 changed files with 171 additions and 156 deletions

View File

@@ -308,6 +308,13 @@ class MachineToolType(models.Model):
active = fields.Boolean('有效', default=True)
code = fields.Char('编码')
def _get_ids(self, machine_tool_type_code):
machine_tool_type_ids = []
for item in machine_tool_type_code:
machine_tool_type = self.search([('code', '=', item)])
machine_tool_type_ids.append(machine_tool_type.id)
return [(6, 0, machine_tool_type_ids)]
class MachineToolCategory(models.Model):
_name = 'sf.machine_tool.category'

View File

@@ -53,5 +53,10 @@ class FixtureModel(models.Model):
screw_size = fields.Integer(string="螺牙大小[mm]", size=6)
active = fields.Boolean('有效', default=True)
# @api.model
# def create(self, vals):
# obj = super(FixtureModel, self).create(vals)
# return obj

View File

@@ -42,16 +42,16 @@
<form string="品牌" create="0" edit="0" delete="1">
<sheet>
<!-- <widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>-->
<field name="image_brand" widget='image' class="oe_avatar"
options="{'preview_image': 'image_128'}" string="log"/>
<div class="oe_title">
<h1>
<field name="code" readonly="1"/>
<field name="name" readonly="1"/>
</h1>
<field name="image_brand" widget='image' class="oe_avatar"
options="{'preview_image': 'image_128'}" string="log"/>
</div>
<group>
<group>
<field name="name" string="名称"/>
<field name="code"/>
<field name="tag_ids"
widget="many2many_tags"
options="{'color_field': 'color', 'no_create_edit': True}"
@@ -109,15 +109,15 @@
<sheet>
<div class="oe_title">
<h1>
<field name="code"/>
<field name="name" placeholder="e.g. LED Monitor"/>
</h1>
</div>
<group>
<group>
<label for="name"/>
<h1>
<field name="name" string="设备名称" placeholder="e.g. LED Monitor"/>
</h1>
<!-- <label for="name"/>-->
<!-- <h1>-->
<!-- <field name="name" string="设备名称" placeholder="e.g. LED Monitor"/>-->
<!-- </h1>-->
<field name="code" force_save="1" readonly="1"/>
<field name="brand_id" required="1"
domain="[('tag_ids', '=', '机床')]"
@@ -364,7 +364,7 @@
<sheet>
<div class="oe_title">
<h1>
<field name="MTcode"/>
<field name="name" placeholder="e.g. LED Monitor"/>
</h1>
</div>
<group string="基本信息">
@@ -375,7 +375,7 @@
<!-- options="{'no_create': True}"/>-->
<!-- </group>-->
<group>
<field name="name" required="1" string="设备名称" placeholder="e.g. LED Monitor"/>
<field name="MTcode" required="1"/>
<field name="type_id" required="1" options="{'no_create': True}"
domain="[('brand_id', '=', brand_id)]"
attrs="{'invisible': [('brand_id','=',False)]}"/>

View File

@@ -49,7 +49,7 @@
<sheet>
<div class="oe_title">
<h1>
<field name="code"/>
<field name="name" required="1"/>
</h1>
</div>
<group>
@@ -57,7 +57,7 @@
<field name="sequence"/>
</group>
<group>
<field name="name" required="1"/>
<field name="code" force_save="1" readonly="1"/>
</group>
</group>
<notebook>
@@ -119,12 +119,12 @@
<sheet>
<div class="oe_title">
<h1>
<field name="process_encode"/>
<field name="name" required="1"/>
</h1>
</div>
<group>
<group>
<field name="name" required="1" string="名称"/>
<field name="process_encode"/>
</group>
<notebook>
<page string="可选参数">
@@ -199,12 +199,12 @@
<sheet>
<div class="oe_title">
<h1>
<field name="materials_no" readonly="1" force_save="1"/>
<field name="name" readonly="1"/>
</h1>
</div>
<group>
<group>
<field name="name" readonly="1"/>
<field name="materials_no" readonly="1" force_save="1"/>
<field name="gain_way" required="1"/>
<field name="tensile_strength" required="1"/>
<field name="hardness" required="1"/>
@@ -278,12 +278,12 @@
<sheet>
<div class="oe_title">
<h1>
<field name="materials_no"/>
<field name="name" required="1"/>
</h1>
</div>
<group>
<group>
<field name="name" required="1" string="名称"/>
<field name="materials_no"/>
</group>
<notebook>
<page string="型号">

View File

@@ -163,7 +163,7 @@
<field name="name">夹具型号</field>
<field name="model">sf.fixture.model</field>
<field name="arch" type="xml">
<tree string="夹具型号">
<tree string="夹具型号" create="0" edit="0" delete="1">
<field name="code"/>
<field name="name" string="名称"/>
<field name="brand_id"/>
@@ -177,16 +177,16 @@
<field name="name">夹具型号</field>
<field name="model">sf.fixture.model</field>
<field name="arch" type="xml">
<form string="夹具型号">
<form string="夹具型号" create="0" edit="0" delete="1" >
<sheet>
<div class="oe_title">
<h1>
<field name="code" force_save="1" readonly="1"/>
<field name="name" />
</h1>
</div>
<group>
<group>
<field name="name" string="名称"/>
<field name="code" force_save="1" readonly="1"/>
<field name="fixture_material_id" options="{'no_create': True}"/>
<field name="fixture_material_type" invisible="1"/>
<field name="multi_mounting_type_id" options="{'no_create': True}"/>

View File

@@ -103,12 +103,12 @@
<sheet>
<div class="oe_title">
<h1>
<field name="code"/>
<field name="name"/>
</h1>
</div>
<group string="基本信息">
<group>
<field name="name" string="名称"/>
<field name="code" />
<field name="type_id"/>
<field name="type" invisible="1"/>
<field name="zero_chuck_model_ids" widget="many2many_tags" options="{'no_create': True}"/>

View File

@@ -214,12 +214,12 @@
<sheet>
<div class="oe_title">
<h1>
<field name="code"/>
<field name="name" placeholder="e.g. LED Monitor"/>
</h1>
</div>
<group>
<group>
<field name="name" string="名称"/>
<field name="code" />
<field name="cutting_tool_material_id"
options="{'no_create': True, 'no_quick_create': True}"/>
<field name="cutting_tool_type" invisible="1"/>

View File

@@ -1524,10 +1524,11 @@ class SyncFixtureModel(models.Model):
"materials_model_id": self.env['sf.materials.model'].search(
[('materials_no', '=', item['materials_model_code'])]).id,
"driving_way": item['driving_way'],
"apply_machine_tool_type_id": self.env['sf.machine_tool.type'].search(
[('code', '=', item['apply_machine_tool_type_code'])]).id,
"apply_machine_tool_type_ids": self.env['sf.machine_tool.type'].sudo()._get_ids(
item['apply_machine_tool_type_code']).id,
"through_hole_size": item['through_hole_size'],
"screw_size": item['screw_size'],
"active": item['active'],
})
else:
fixture_model.write({
@@ -1553,10 +1554,11 @@ class SyncFixtureModel(models.Model):
"materials_model_id": self.env['sf.materials.model'].search(
[('materials_no', '=', item['materials_model_code'])]).id,
"driving_way": item['driving_way'],
"apply_machine_tool_type_id": self.env['sf.machine_tool.type'].search(
[('code', '=', item['apply_machine_tool_type_code'])]).id,
"apply_machine_tool_type_ids": self.env['sf.machine_tool.type'].sudo()._get_ids(
item['apply_machine_tool_type_code']).id,
"through_hole_size": item['through_hole_size'],
"screw_size": item['screw_size'],
"active": item['active'],
})
else:
raise ValidationError("认证未通过")
@@ -1604,10 +1606,11 @@ class SyncFixtureModel(models.Model):
"materials_model_id": self.env['sf.materials.model'].search(
[('materials_no', '=', item['materials_model_code'])]).id,
"driving_way": item['driving_way'],
"apply_machine_tool_type_id": self.env['sf.machine_tool.type'].search(
[('code', '=', item['apply_machine_tool_type_code'])]).id,
"apply_machine_tool_type_ids": self.env['sf.machine_tool.type'].sudo()._get_ids(
item['apply_machine_tool_type_code']).id,
"through_hole_size": item['through_hole_size'],
"screw_size": item['screw_size'],
"active": item['active'],
})
else:
fixture_model.write({
@@ -1633,8 +1636,8 @@ class SyncFixtureModel(models.Model):
"materials_model_id": self.env['sf.materials.model'].search(
[('materials_no', '=', item['materials_model_code'])]).id,
"driving_way": item['driving_way'],
"apply_machine_tool_type_id": self.env['sf.machine_tool.type'].search(
[('code', '=', item['apply_machine_tool_type_code'])]).id,
"apply_machine_tool_type_ids": self.env['sf.machine_tool.type'].sudo()._get_ids(
item['apply_machine_tool_type_code']).id,
"through_hole_size": item['through_hole_size'],
"screw_size": item['screw_size'],
"active": item['active'],

View File

@@ -8,7 +8,7 @@ class ProcedureEquipmentResourceSetting(models.Model):
name = fields.Many2one('sf.production.line', string='生产线', required=True)
work_center_name_id = fields.Many2one('mrp.workcenter', string='工作中心名称')
equipment_code = fields.Char(string='机台号(原设备编码)', readonly=True, compute='_onchange_equipment_name_id')
equipment_code = fields.Char(string='机台号', readonly=True, compute='_onchange_equipment_name_id')
equipment_name_id = fields.Many2one('maintenance.equipment',
string='设备名称',
readonly=True,
@@ -41,9 +41,9 @@ class ProcedureEquipmentResourceSetting(models.Model):
@api.onchange('equipment_name_id')
def _onchange_equipment_name_id(self):
for record in self:
record.equipment_code = record.equipment_name_id.code,
record.brand = record.equipment_name_id.brand_id.name,
record.model = record.equipment_name_id.type_id.name,
record.equipment_code = record.equipment_name_id.code
record.brand = record.equipment_name_id.brand_id.name
record.model = record.equipment_name_id.type_id.name
record.status = record.equipment_name_id.state
@api.depends('working_calendar_id')

View File

@@ -26,14 +26,14 @@ class WorkLogSetting(models.Model):
code = fields.Char(string='序号', default=_get_code)
name = fields.Char(string='工作日历名称', required=True, size=15, length=30)
working_shift_ids = fields.Many2many('sf.working.shift', string='班次')
working_shift_ids = fields.Many2many('sf.working.shift', string='班次', required=True)
start_time = fields.Datetime(string='日开始时间', readonly=True, compute='_compute_working_shift_ids')
end_time = fields.Datetime(string='日结束时间', readonly=True, compute='_compute_working_shift_ids')
duration = fields.Char(string='时长', readonly=True, compute='_compute_working_shift_ids')
day_off_ids = fields.Many2many('sf.day.off', string='休息日', required=True)
status = fields.Boolean(string='状态', default=True)
status = fields.Selection([('正常', '正常'), ('禁用', '禁用')], string='状态', default='正常')
update_person = fields.Char(string='更新人', default=lambda self: self.env.user.name)
update_time = fields.Datetime(string='更新时间', default=lambda self: fields.Datetime.now())

View File

@@ -7,20 +7,20 @@
sequence="599"
/>
<menuitem id="menu_sf_work_log_setting"
name="工作日历设置"
parent="menu_sf_basic_setting"
action="sf_work_log_setting_act"
sequence="0"
/>
<menuitem id="menu_sf_procedure_equipment_resource_setting"
name="产线设备资源设置"
parent="menu_sf_basic_setting"
action="sf_procedure_equipment_resource_setting_act"
sequence="0"
/>
<menuitem id="menu_sf_work_log_setting"
name="工作日历设置"
parent="menu_sf_basic_setting"
action="sf_work_log_setting_act"
sequence="10"
/>
<menuitem id="menu_sf_working_shift"
name="班次"
parent="menu_sf_basic_setting"

View File

@@ -5,14 +5,14 @@
<field name="name">工作日历设置</field>
<field name="model">sf.work.log.setting</field>
<field name="arch" type="xml">
<tree>
<tree string="工作日历设置">
<field name="code"/>
<field name="name"/>
<field name="start_time"/>
<field name="end_time"/>
<field name="duration"/>
<field name="day_off_ids" widget="many2many_tags"/>
<field name="working_shift_ids" widget="many2many_tags"/>
<field name="start_time" optional="hide"/>
<field name="end_time" optional="hide"/>
<field name="duration" optional="hide"/>
<field name="status"/>
<field name="update_person"/>
<field name="update_time"/>
@@ -30,38 +30,39 @@
<field name="model">sf.work.log.setting</field>
<field name="arch" type="xml">
<form>
<header>
<button string="查看日历"
type="object"
name="open_work_schedule_calendar"
class="oe_highlight"
/>
<field name="status" widget="statusbar" statusbar_visible="正常,禁用"/>
</header>
<sheet string-="工作日历设置">
<group string="基础信息">
<group>
<div class="oe_title">
<h1>
<field name="name"/>
</group>
</h1>
</div>
<group>
<group>
<field name="code"/>
</group>
</group>
<group string="选择班次">
<field name="working_shift_ids"/>
<field name="day_off_ids" widget="many2many_tags"
options="{'no_create': True, 'no_quick_create': True}"/>
<field name="status"/>
</group>
<group string="工作时间">
<group>
<field name="start_time"/>
</group>
<group>
<field name="end_time"/>
</group>
</group>
<group>
<group>
<field name="duration"/>
<field name="day_off_ids"
widget="many2many_tags"
options="{'no_create': True, 'no_quick_create': True}"/>
</group>
</group>
<group string="日历状态">
<field name="status"/>
<notebook>
<page string="选择班次">
<field name="working_shift_ids"/>
</page>
</notebook>
<field name="setting_to_calendar_ids" invisible="True"/>
</group>
</sheet>
</form>
</field>
@@ -79,7 +80,7 @@
<field name="name">休息日</field>
<field name="model">sf.day.off</field>
<field name="arch" type="xml">
<tree>
<tree string="休息日" editable="bottom" delete="0">
<field name="name"/>
</tree>
</field>
@@ -88,7 +89,7 @@
<record id="sf_day_off_act" model="ir.actions.act_window">
<field name="name">休息日</field>
<field name="res_model">sf.day.off</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">tree</field>
</record>
@@ -97,7 +98,7 @@
<field name="name">班次</field>
<field name="model">sf.working.shift</field>
<field name="arch" type="xml">
<tree>
<tree string="班次" editable="bottom" >
<field name="code"/>
<field name="name"/>
<field name="start_time"/>
@@ -107,32 +108,32 @@
</field>
</record>
<record id="sf_working_shift_form" model="ir.ui.view">
<field name="name">班次</field>
<field name="model">sf.working.shift</field>
<field name="arch" type="xml">
<form>
<sheet>
<group>
<group>
<field name="name"/>
<field name="start_time"/>
<field name="end_time"/>
<field name="remark"/>
</group>
<group>
<field name="code"/>
</group>
</group>
</sheet>
</form>
</field>
</record>
<!-- <record id="sf_working_shift_form" model="ir.ui.view">-->
<!-- <field name="name">班次</field>-->
<!-- <field name="model">sf.working.shift</field>-->
<!-- <field name="arch" type="xml">-->
<!-- <form>-->
<!-- <sheet>-->
<!-- <group>-->
<!-- <group>-->
<!-- <field name="name"/>-->
<!-- <field name="start_time"/>-->
<!-- <field name="end_time"/>-->
<!-- <field name="remark"/>-->
<!-- </group>-->
<!-- <group>-->
<!-- <field name="code"/>-->
<!-- </group>-->
<!-- </group>-->
<!-- </sheet>-->
<!-- </form>-->
<!-- </field>-->
<!-- </record>-->
<record id="sf_working_shift_act" model="ir.actions.act_window">
<field name="name">班次</field>
<field name="res_model">sf.working.shift</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">tree</field>
</record>
@@ -141,34 +142,35 @@
<field name="name">工作日历</field>
<field name="model">sf.work.schedule.calendar</field>
<field name="arch" type="xml">
<tree>
<field name="name_id" invisible="True"/>
<tree string="工作日历" editable="bottom">
<field name="calendar_code"/>
<field name="name"/>
<field name="name_id"/>
<field name="date_time"/>
</tree>
</field>
</record>
<record id="sf_work_schedule_calendar_form" model="ir.ui.view">
<field name="name">工作日历</field>
<field name="model">sf.work.schedule.calendar</field>
<field name="arch" type="xml">
<form>
<sheet>
<group string="日历基本信息">
<group>
<field name="name"/>
<field name="date_time"/>
</group>
<group>
<field name="name_id"/>
<field name="calendar_code"/>
</group>
</group>
</sheet>
</form>
</field>
</record>
<!-- <record id="sf_work_schedule_calendar_form" model="ir.ui.view">-->
<!-- <field name="name">工作日历</field>-->
<!-- <field name="model">sf.work.schedule.calendar</field>-->
<!-- <field name="arch" type="xml">-->
<!-- <form>-->
<!-- <sheet>-->
<!-- <group string="日历基本信息">-->
<!-- <group>-->
<!-- <field name="name"/>-->
<!-- <field name="date_time"/>-->
<!-- </group>-->
<!-- <group>-->
<!-- <field name="name_id"/>-->
<!-- <field name="calendar_code"/>-->
<!-- </group>-->
<!-- </group>-->
<!-- </sheet>-->
<!-- </form>-->
<!-- </field>-->
<!-- </record>-->
<record id="sf_work_schedule_calendar_search" model="ir.ui.view">
<field name="name">工作日历</field>
@@ -196,7 +198,7 @@
<record id="sf_work_schedule_calendar_act" model="ir.actions.act_window">
<field name="name">工作日历</field>
<field name="res_model">sf.work.schedule.calendar</field>
<field name="view_mode">calendar,search,tree,form</field>
<field name="view_mode">calendar,search,tree</field>
</record>
@@ -207,15 +209,15 @@
<field name="arch" type="xml">
<tree string="产线设备资源设置">
<field name="work_center_name_id"/>
<field name="equipment_code"/>
<field name="equipment_name_id"/>
<field name="brand"/>
<field name="model"/>
<field name="equipment_code"/>
<field name="brand" optional="hide"/>
<field name="model" optional="hide"/>
<field name="working_procedure"/>
<field name="production_capacity"/>
<field name="working_calendar_id"/>
<field name="working_shift_id" widget="many2many_tags"/>
<field name="create_time"/>
<field name="production_capacity" optional="hide"/>
<field name="working_calendar_id" optional="hide"/>
<field name="working_shift_id" widget="many2many_tags" optional="hide"/>
<field name="create_time" optional="hide"/>
<field name="status"/>
<field name="participate_in_scheduling"/>
<field name="name" invisible="True"/>
@@ -229,22 +231,27 @@
<field name="arch" type="xml">
<form string="产线设备资源设置">
<sheet>
<group string="生产线">
<group>
<div>
<h1>
<field name="name"/>
</group>
</group>
<group string="工作中心信息">
</h1>
</div>
<group>
<group>
<field name="work_center_name_id"/>
<field name="production_capacity"/>
<field name="working_calendar_id"/>
<field name="create_time"/>
</group>
<group>
<field name="working_procedure"/>
<field name="participate_in_scheduling"/>
<field name="working_shift_id" widget="many2many_tags"/>
</group>
</group>
<group string="设备信息">`
<notebook>
<page string="设备信息">
<group>`
<group>
<field name="equipment_name_id"/>
<field name="brand"/>
@@ -255,15 +262,8 @@
<field name="model"/>
</group>
</group>
<group string="工作日历信息">
<group>
<field name="working_calendar_id"/>
<field name="create_time"/>
</group>
<group>
<field name="working_shift_id" widget="many2many_tags"/>
</group>
</group>
</page>
</notebook>
</sheet>
</form>
</field>