Merge branch 'feature/返工优化_5' into feature/工序排序优化
This commit is contained in:
@@ -891,6 +891,14 @@ class MrpProduction(models.Model):
|
|||||||
and item.panel == work.processing_panel))
|
and item.panel == work.processing_panel))
|
||||||
if td_ids:
|
if td_ids:
|
||||||
work.sequence = td_ids[0].sequence
|
work.sequence = td_ids[0].sequence
|
||||||
|
cancel_work_ids = workorder_ids.filtered(lambda item: item.state in ('已取消', 'cancel'))
|
||||||
|
if cancel_work_ids:
|
||||||
|
sequence = max(workorder_ids.filtered(lambda item: item.state not in ('已取消', 'cancel')),
|
||||||
|
key=lambda w: w.sequence).sequence
|
||||||
|
for cw in cancel_work_ids:
|
||||||
|
cw.sequence = sequence + 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def _reset_work_order_sequence_1(self):
|
def _reset_work_order_sequence_1(self):
|
||||||
"""
|
"""
|
||||||
@@ -1142,13 +1150,13 @@ class MrpProduction(models.Model):
|
|||||||
if self.programming_state in ['已编程']:
|
if self.programming_state in ['已编程']:
|
||||||
cloud_programming = self._cron_get_programming_state()
|
cloud_programming = self._cron_get_programming_state()
|
||||||
result_ids = self.detection_result_ids.filtered(lambda dr: dr.handle_result == '待处理')
|
result_ids = self.detection_result_ids.filtered(lambda dr: dr.handle_result == '待处理')
|
||||||
work_ids = []
|
work_id_list = []
|
||||||
if result_ids:
|
if result_ids:
|
||||||
for result_id in result_ids:
|
work_id_list = [self.workorder_ids.filtered(
|
||||||
work_ids.append(self.workorder_ids.filtered(
|
lambda wk: (wk.name == result_id.routing_type and wk.processing_panel == result_id.processing_panel
|
||||||
lambda wk: (wk.name == result_id.routing_type
|
and wk.state == 'done')).id
|
||||||
and wk.processing_panel == result_id.processing_panel
|
for result_id in result_ids]
|
||||||
and wk.state == 'done')).id)
|
|
||||||
return {
|
return {
|
||||||
'name': _('返工'),
|
'name': _('返工'),
|
||||||
'type': 'ir.actions.act_window',
|
'type': 'ir.actions.act_window',
|
||||||
@@ -1157,7 +1165,8 @@ class MrpProduction(models.Model):
|
|||||||
'target': 'new',
|
'target': 'new',
|
||||||
'context': {
|
'context': {
|
||||||
'default_production_id': self.id,
|
'default_production_id': self.id,
|
||||||
'default_workorder_ids': work_ids,
|
'default_workorder_ids': self.workorder_ids.ids,
|
||||||
|
'default_hidden_workorder_ids': ','.join(map(str, work_id_list)) if work_id_list != [] else '',
|
||||||
'default_reprogramming_num': cloud_programming['reprogramming_num'],
|
'default_reprogramming_num': cloud_programming['reprogramming_num'],
|
||||||
'default_programming_state': cloud_programming['programming_state'],
|
'default_programming_state': cloud_programming['programming_state'],
|
||||||
'default_is_reprogramming': True if cloud_programming['programming_state'] in ['已下发'] else False
|
'default_is_reprogramming': True if cloud_programming['programming_state'] in ['已下发'] else False
|
||||||
|
|||||||
@@ -51,9 +51,17 @@ class ReworkWizard(models.TransientModel):
|
|||||||
'test_report': self.workorder_id.detection_report})]})
|
'test_report': self.workorder_id.detection_report})]})
|
||||||
self.workorder_id.button_finish()
|
self.workorder_id.button_finish()
|
||||||
else:
|
else:
|
||||||
if self.workorder_ids:
|
if self.hidden_workorder_ids:
|
||||||
rework_workorder_ids = self.production_id.workorder_ids.filtered(
|
hidden_workorder_list = self.hidden_workorder_ids.split(',')
|
||||||
lambda ap: ap.id in self.workorder_ids.ids)
|
rework_workorder_ids = self.workorder_ids.filtered(lambda w: str(w.id) in hidden_workorder_list)
|
||||||
|
# 限制判断
|
||||||
|
# 1、当制造订单内ZM面的工单都已完成时,返工勾选工序时只能勾选上ZM面的所有工序进行返工
|
||||||
|
# 2、当FM工单在CNC工单进行选择返工,并将已全部完成的ZM面工序全部勾选上时,FM工单上所有的已完成的工单(装夹预调工单)也必须进行勾选
|
||||||
|
done_panel_workorder_ids = self.workorder_ids.filtered(
|
||||||
|
lambda w: w.state == 'done' and w.processing_panel is not False)
|
||||||
|
else:
|
||||||
|
raise ValidationError('请选择返工工单!!!')
|
||||||
|
if rework_workorder_ids:
|
||||||
clamp_workorder_ids = None
|
clamp_workorder_ids = None
|
||||||
if rework_workorder_ids:
|
if rework_workorder_ids:
|
||||||
# 限制
|
# 限制
|
||||||
|
|||||||
@@ -14,8 +14,13 @@
|
|||||||
<field name="processing_panel_id" invisible="1"/>
|
<field name="processing_panel_id" invisible="1"/>
|
||||||
<field name="hidden_workorder_ids" class="css_not_available_msg"/>
|
<field name="hidden_workorder_ids" class="css_not_available_msg"/>
|
||||||
<group>
|
<group>
|
||||||
<field readonly="1" name="workorder_ids" widget="jikimo_subtree_selector_field" jikimo_selector="True" replace_context="hidden_workorder_ids" string="工序" attrs='{"invisible": [("routing_type","=","装夹预调")]}'>
|
<field name="hidden_workorder_ids"/>
|
||||||
|
<field options="{'no_create': True,'no_open': True}" readonly="1" name="workorder_ids"
|
||||||
|
widget="jikimo_subtree_selector_field"
|
||||||
|
jikimo_selector="True" replace_context="hidden_workorder_ids" string="工序"
|
||||||
|
attrs='{"invisible": [("routing_type","=","装夹预调")]}'>
|
||||||
<tree create="0" editable='bottom' delete="0">
|
<tree create="0" editable='bottom' delete="0">
|
||||||
|
<field name="sequence" readonly="1" string="工序"/>
|
||||||
<field name="processing_panel" readonly="1"/>
|
<field name="processing_panel" readonly="1"/>
|
||||||
<field name="name" readonly="1"/>
|
<field name="name" readonly="1"/>
|
||||||
</tree>
|
</tree>
|
||||||
|
|||||||
Reference in New Issue
Block a user