修改工单完成后,自动完成制造订单,完工产品就绪状态

This commit is contained in:
qihao.gong@jikimo.com
2024-01-09 10:31:43 +08:00
parent 3742a3b163
commit 86366cc6cb
5 changed files with 28 additions and 29 deletions

View File

@@ -13,7 +13,7 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//group//field[@name='processing_panel']" position="after"> <xpath expr="//group//field[@name='processing_panel']" position="after">
<!-- invisible="1" --> <!-- invisible="1" -->
<field name="_barcode_scanned" widget="barcode_handler" string="扫码" attrs='{"invisible": [("routing_type","!=","装夹")]}'/> <field name="_barcode_scanned" widget="barcode_handler" string="扫码" attrs='{"invisible": [("routing_type","!=","装夹预制")]}'/>
</xpath> </xpath>
<xpath expr="//page//field[@name='tray_code']" position="replace"> <xpath expr="//page//field[@name='tray_code']" position="replace">
<field name="tray_code" widget="code"/> <field name="tray_code" widget="code"/>

View File

@@ -196,7 +196,7 @@ class MrpProduction(models.Model):
) )
i += 1 i += 1
for route in product_routing_workcenter: for route in product_routing_workcenter:
if i == 1 and route.routing_type == '获取CNC加工程序': if i == 1 and route.routing_type == '装夹预制':
workorders_values.append( workorders_values.append(
self.env['mrp.workorder'].json_workorder_str('', production, route)) self.env['mrp.workorder'].json_workorder_str('', production, route))
if route.is_repeat is True: if route.is_repeat is True:
@@ -416,10 +416,10 @@ class MrpProduction(models.Model):
for work in rec.workorder_ids: for work in rec.workorder_ids:
work.sequence = current_sequence work.sequence = current_sequence
current_sequence += 1 current_sequence += 1
if work.name == '获取CNC加工程序': # if work.name == '获取CNC加工程序':
work.button_start() # work.button_start()
#work.fetchCNC() # #work.fetchCNC()
work.button_finish() # work.button_finish()
# 创建工单并进行排序 # 创建工单并进行排序
def _create_workorder(self): def _create_workorder(self):

View File

@@ -6,9 +6,9 @@ class ResMrpRoutingWorkcenter(models.Model):
_inherit = 'mrp.routing.workcenter' _inherit = 'mrp.routing.workcenter'
routing_type = fields.Selection([ routing_type = fields.Selection([
('获取CNC加工程序', '获取CNC加工程序'), # ('获取CNC加工程序', '获取CNC加工程序'),
('装夹', '装夹'), ('装夹预调', '装夹预调'),
('前置三元定位检测', '前置三元定位检测'), # ('前置三元定位检测', '前置三元定位检测'),
('CNC加工', 'CNC加工'), ('CNC加工', 'CNC加工'),
('后置三元质量检测', '后置三元质量检测'), ('后置三元质量检测', '后置三元质量检测'),
('解除装夹', '解除装夹'), ('解除装夹', '解除装夹'),

View File

@@ -31,9 +31,9 @@ class ResMrpWorkOrder(models.Model):
processing_panel = fields.Char('加工面') processing_panel = fields.Char('加工面')
sequence = fields.Integer(string='工序') sequence = fields.Integer(string='工序')
routing_type = fields.Selection([ routing_type = fields.Selection([
('获取CNC加工程序', '获取CNC加工程序'), # ('获取CNC加工程序', '获取CNC加工程序'),
('装夹', '装夹'), ('装夹预调', '装夹预调'),
('前置三元定位检测', '前置三元定位检测'), # ('前置三元定位检测', '前置三元定位检测'),
('CNC加工', 'CNC加工'), ('CNC加工', 'CNC加工'),
('后置三元质量检测', '后置三元质量检测'), ('后置三元质量检测', '后置三元质量检测'),
('解除装夹', '解除装夹'), ('解除装夹', '解除装夹'),
@@ -204,15 +204,15 @@ class ResMrpWorkOrder(models.Model):
if route.routing_type == '切割': if route.routing_type == '切割':
duration_expected = self.env['mrp.routing.workcenter'].sudo().search( duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
[('name', '=', '切割')]).time_cycle [('name', '=', '切割')]).time_cycle
elif route.routing_type == '获取CNC加工程序': # elif route.routing_type == '获取CNC加工程序':
# duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
# [('name', '=', '获取CNC加工程序')]).time_cycle
elif route.routing_type == '装夹预制':
duration_expected = self.env['mrp.routing.workcenter'].sudo().search( duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
[('name', '=', '获取CNC加工程序')]).time_cycle [('name', '=', '装夹预制')]).time_cycle
elif route.routing_type == '工件装夹': # elif route.routing_type == '前置三元定位检测':
duration_expected = self.env['mrp.routing.workcenter'].sudo().search( # duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
[('name', '=', '工件装夹')]).time_cycle # [('name', '=', '前置三元定位检测')]).time_cycle
elif route.routing_type == '前置三元定位检测':
duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
[('name', '=', '前置三元定位检测')]).time_cycle
elif route.routing_type == 'CNC加工': elif route.routing_type == 'CNC加工':
duration_expected = self.env['mrp.routing.workcenter'].sudo().search( duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
[('name', '=', 'CNC加工')]).time_cycle [('name', '=', 'CNC加工')]).time_cycle
@@ -495,7 +495,7 @@ class ResMrpWorkOrder(models.Model):
# 重写工单开始按钮方法 # 重写工单开始按钮方法
def button_start(self): def button_start(self):
if self.routing_type == '装夹' and self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name: if self.routing_type == '装夹预制' and self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name:
self.pro_code = self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name self.pro_code = self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name
# 外协出库单,从“正在等待”变为“就绪”状态 # 外协出库单,从“正在等待”变为“就绪”状态
if self.is_subcontract is True: if self.is_subcontract is True:

View File

@@ -162,11 +162,11 @@
<field name="equipment_id" <field name="equipment_id"
attrs='{"invisible": [("routing_type","in",("获取CNC加工程序","切割"))]}'/> attrs='{"invisible": [("routing_type","in",("获取CNC加工程序","切割"))]}'/>
<field name="functional_fixture_id" <field name="functional_fixture_id"
attrs='{"invisible": [("routing_type","!=","装夹")]}'/> attrs='{"invisible": [("routing_type","!=","装夹预制")]}'/>
<field name="functional_fixture_code" force_save="1" <field name="functional_fixture_code" force_save="1"
attrs='{"invisible": [("routing_type","!=","装夹")]}'/> attrs='{"invisible": [("routing_type","!=","装夹预制")]}'/>
<field name="functional_fixture_type_id" force_save="1" <field name="functional_fixture_type_id" force_save="1"
attrs='{"invisible": [("routing_type","!=","装夹")]}'/> attrs='{"invisible": [("routing_type","!=","装夹预制")]}'/>
</group> </group>
<group attrs='{"invisible": [("routing_type","=","获取CNC加工程序")]}'> <group attrs='{"invisible": [("routing_type","=","获取CNC加工程序")]}'>
<div> <div>
@@ -219,7 +219,7 @@
<!-- </div>--> <!-- </div>-->
<!-- </page>--> <!-- </page>-->
<page string="工件装夹" attrs='{"invisible": [("routing_type","!=","装夹")]}'> <page string="工件装夹" attrs='{"invisible": [("routing_type","!=","装夹预制")]}'>
<group> <group>
<group string="卡盘"> <group string="卡盘">
<field name="chuck_serial_number"/> <field name="chuck_serial_number"/>
@@ -241,10 +241,7 @@
placeholder="如有预调程序信息请在此处输入....."/> placeholder="如有预调程序信息请在此处输入....."/>
</group> </group>
</page> </page>
<page string="前置三元检测定位参数" attrs='{"invisible": [("routing_type","!=","装夹预制")]}'>
</xpath>
<xpath expr="//page[1]" position="before">
<page string="前置三元检测定位参数" attrs='{"invisible": [("routing_type","!=","前置三元定位检测")]}'>
<div>左面:</div> <div>左面:</div>
<div class="o_address_format"> <div class="o_address_format">
@@ -397,8 +394,10 @@
<field name='X_deviation_angle'/> <field name='X_deviation_angle'/>
</group> </group>
</page> </page>
</xpath> </xpath>
<xpath expr="//page[1]" position="before"> <xpath expr="//page[1]" position="before">
<page string="CNC程序" attrs='{"invisible": [("routing_type","!=","CNC加工")]}'> <page string="CNC程序" attrs='{"invisible": [("routing_type","!=","CNC加工")]}'>
<field name="cnc_ids" widget="one2many" string="工作程序"> <field name="cnc_ids" widget="one2many" string="工作程序">