制造订单,产品,工单上进行3d模型展示

This commit is contained in:
jinling.yang
2023-03-09 17:34:44 +08:00
parent 2df811d4ce
commit dfeeed7b59
5 changed files with 42 additions and 25 deletions

View File

@@ -10,7 +10,7 @@
""",
'category': 'sf',
'website': 'https://www.sf.jikimo.com',
'depends': ['mrp', 'sf_base', 'maintenance'],
'depends': ['mrp', 'sf_base', 'maintenance', 'web_widget_model_viewer'],
'data': [
'security/group_security.xml',
'security/ir.model.access.csv',

View File

@@ -90,6 +90,7 @@ class ResMrpWorkOrder(models.Model):
string="检测结果")
cnc_ids = fields.One2many("sf.cnc.processing", 'workorder_id', string="CNC加工")
tray_code = fields.Char(string="托盘")
glb_file = fields.Binary("glb模型文件")
# 计算配料中心点和与x轴倾斜度方法
def getcenter(self):

View File

@@ -24,19 +24,19 @@
</field>
</record>
<!-- <record id="mrp_workcenter_view_kanban_inherit_workorder" model="ir.ui.view">-->
<!-- <field name="name">mrp.workcenter.view.kanban.inherit.mrp.workorder</field>-->
<!-- <field name="model">mrp.workcenter</field>-->
<!-- <field name="inherit_id" ref="mrp.mrp_workcenter_kanban"/>-->
<!-- <field name="arch" type="xml">-->
<!-- &lt;!&ndash; Desktop view &ndash;&gt;-->
<!-- <xpath expr="//div[@name='o_wo']" position="inside">-->
<!-- <button class="btn btn-secondary fa fa-desktop" name="action_work_order" type="object"-->
<!-- context="{'search_default_ready': 1, 'search_default_progress': 1, 'search_default_pending': 1, 'desktop_list_view': 1, 'search_default_workcenter_id': active_id}"-->
<!-- title="Work orders" aria-label="Work orders"/>-->
<!-- </xpath>-->
<!-- </field>-->
<!-- </record>-->
<!-- <record id="mrp_workcenter_view_kanban_inherit_workorder" model="ir.ui.view">-->
<!-- <field name="name">mrp.workcenter.view.kanban.inherit.mrp.workorder</field>-->
<!-- <field name="model">mrp.workcenter</field>-->
<!-- <field name="inherit_id" ref="mrp.mrp_workcenter_kanban"/>-->
<!-- <field name="arch" type="xml">-->
<!-- &lt;!&ndash; Desktop view &ndash;&gt;-->
<!-- <xpath expr="//div[@name='o_wo']" position="inside">-->
<!-- <button class="btn btn-secondary fa fa-desktop" name="action_work_order" type="object"-->
<!-- context="{'search_default_ready': 1, 'search_default_progress': 1, 'search_default_pending': 1, 'desktop_list_view': 1, 'search_default_workcenter_id': active_id}"-->
<!-- title="Work orders" aria-label="Work orders"/>-->
<!-- </xpath>-->
<!-- </field>-->
<!-- </record>-->
<!-- override to change the no content image -->
<record id="mrp.action_work_orders" model="ir.actions.act_window">
@@ -146,6 +146,9 @@
</div>
</button>
</div>
<field name="product_id" position="after">
<field name="model_file" string="产品模型" readonly="1" widget="Viewer3D"/>
</field>
</field>
</record>

View File

@@ -22,13 +22,16 @@
<field name="date_planned_finished" string="计划结束日期" optional="show"/>
</xpath>
<xpath expr="//button[@name='button_start']" position="attributes">
<attribute name="attrs">{'invisible': ['|', '|', '|','|','|', ('production_state','in', ('draft', 'done',
<attribute name="attrs">{'invisible': ['|', '|', '|','|','|', ('production_state','in', ('draft',
'done',
'cancel')), ('working_state', '=', 'blocked'), ('state', 'in', ('done', 'cancel')),
('is_user_working', '!=', False),("user_permissions","=",False),("name","=","获取CNC加工程序")]}
</attribute>
</xpath>
<xpath expr="//button[@name='%(mrp.act_mrp_block_workcenter_wo)d']" position="attributes">
<attribute name="attrs">{'invisible': ['|',("user_permissions","=",False),("name","=","获取CNC加工程序")]}</attribute>
<attribute name="attrs">{'invisible':
['|',("user_permissions","=",False),("name","=","获取CNC加工程序")]}
</attribute>
<attribute name="string">停工</attribute>
</xpath>
<xpath expr="//button[@name='action_open_wizard']" position="attributes">
@@ -47,7 +50,7 @@
<!-- attrs="{'invisible': ['|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '!=', 'blocked')]}"/>-->
<!-- <button name="action_open_wizard" type="object" icon="fa-external-link" class="oe_edit_only"-->
<!-- title="Open Work Order"/>-->
<!-- edit='false' create = 'false'-->
<!-- edit='false' create = 'false'-->
<tree position="attributes">
<attribute name="multi_edit"></attribute>
<attribute name="editable"></attribute>
@@ -129,15 +132,23 @@
<group>
<field name="date_planned_start" invisible="1"/>
<field name="date_planned_finished" invisible="1"/>
<!-- <field name="production_id" readonly="1"/>-->
<!-- <field name="production_id" readonly="1"/>-->
<field name="duration" widget="mrp_timer"
attrs="{'invisible': [('production_state','=', 'draft')], 'readonly': [('is_user_working', '=', True)]}"
sum="real duration"/>
<field name="processing_panel" readonly="1" attrs='{"invisible": [("routing_type","in",("获取CNC加工程序","切割"))]}'/>
<field name="processing_panel" readonly="1"
attrs='{"invisible": [("routing_type","in",("获取CNC加工程序","切割"))]}'/>
</group>
<group attrs='{"invisible": [("routing_type","=","获取CNC加工程序")]}'>
<div>
<label for="glb_file" string="加工模型"/>
<field name="glb_file" readonly="1" widget="Viewer3D"/>
</div>
<!-- <field name="glb_file" string="模型" readonly="1" widget="Viewer3D"/>-->
</group>
<!-- <field name="processing_panel" readonly="1" attrs="{'invisible': [('routing_type', 'in', ('获取CNC加工程序','装夹','解除装夹',-->
<!-- '前置三元定位检测','后置三元质量检测','解除装夹'))]}"/>-->
<!-- <field name="processing_panel" readonly="1" attrs="{'invisible': [('routing_type', 'in', ('获取CNC加工程序','装夹','解除装夹',-->
<!-- '前置三元定位检测','后置三元质量检测','解除装夹'))]}"/>-->
</field>
<xpath expr="//page[1]" position="before">
@@ -168,13 +179,14 @@
<field name="tray_id" readonly="1"/>
</group>
<group>
<field name="pro_code" readonly="1" attrs='{"invisible": [("pro_code_ok","=",False)]}' style="color:green"/>
<field name="pro_code" readonly="1" attrs='{"invisible": [("pro_code_ok","=",False)]}'
style="color:green"/>
<field name="pro_code" readonly="1" attrs='{"invisible": [("pro_code_ok","!=",False)]}'/>
<div>
<field name="pro_code_ok" invisible="1"/>
</div>
</group>
</group>
<div class="col-12 col-lg-6 o_setting_box">
<button type="object" class="oe_highlight" name="gettray" string="绑定托盘"
attrs='{"invisible": ["|","|",("tray_id","!=",False),("state","!=","progress"),("production_id","=",False)]}'/>
@@ -346,7 +358,7 @@
<field name="sequence_number"/>
<field name="program_name"/>
<field name="cnc_id" string="文件"/>
<field name="cutting_tool_name"/>
<field name="cutting_tool_name"/>
<field name="cutting_tool_no"/>
<field name="processing_type"/>
<field name="margin_x_y"/>
@@ -369,7 +381,7 @@
<page string="后置三元检测" attrs='{"invisible": [("routing_type","!=","后置三元质量检测")]}'>
<group>
<field name="test_results" widget="selection" attrs='{"invisible":[("results","!=",False)]}'/>
<field name="results" readonly="1" attrs='{"invisible":[("results","!=","合格")]}'/>
<field name="results" readonly="1" attrs='{"invisible":[("results","!=","合格")]}'/>
</group>
<div class="col-12 col-lg-6 o_setting_box">
<button type="object" class="oe_highlight" name="recreateManufacturingOrWorkerOrder"

View File

@@ -30,6 +30,7 @@ class Sf_Mrs_Connect(http.Controller):
('routing_type', '=', '获取CNC加工程序'),
('state', '=', 'progress')])
if cnc_workorder:
cnc_workorder.glb_file = base64.b64encode(ret['glb_file'])
# 拉取所有加工面的程序文件
# i = 1
for r in ret['processing_panel']: