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

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">
<xpath expr="//group//field[@name='processing_panel']" position="after">
<!-- 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 expr="//page//field[@name='tray_code']" position="replace">
<field name="tray_code" widget="code"/>

View File

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

View File

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

View File

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

View File

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