Merge branch 'feature/修复返工-cmm' into develop

This commit is contained in:
jinling.yang
2024-07-29 17:16:36 +08:00
2 changed files with 8 additions and 19 deletions

View File

@@ -36,17 +36,12 @@ class MrpProduction(models.Model):
def _compute_tool_state_remark(self): def _compute_tool_state_remark(self):
for item in self: for item in self:
if item.workorder_ids: if item.workorder_ids:
work_ids = [] workorder_ids = item.workorder_ids.filtered(lambda a: a.state not in ('rework', '返工'))
for workorder_id in item.workorder_ids: if workorder_ids.filtered(lambda a: a.tool_state_remark):
if workorder_id.tool_state == '1': work_ids = workorder_ids.filtered(lambda a: a.tool_state_remark)
work_ids.append(workorder_id)
if work_ids:
tool_state_remark = '' tool_state_remark = ''
for work_id in work_ids: for work_id in work_ids:
if tool_state_remark == '': tool_state_remark = f"{work_id.tool_state_remark}\n"
tool_state_remark = f"{work_id.tool_state_remark}"
else:
tool_state_remark = f"{tool_state_remark}\n{work_id.tool_state_remark}"
item.tool_state_remark = tool_state_remark item.tool_state_remark = tool_state_remark
else: else:
item.tool_state_remark = False item.tool_state_remark = False
@@ -56,16 +51,10 @@ class MrpProduction(models.Model):
for item in self: for item in self:
if item.workorder_ids: if item.workorder_ids:
tool_state = item.tool_state tool_state = item.tool_state
work_ids_1 = [] workorder_ids = item.workorder_ids.filtered(lambda a: a.state not in ('rework', '返工'))
work_ids_2 = [] if workorder_ids.filtered(lambda a: a.tool_state == '2'):
for workorder_id in item.workorder_ids:
if workorder_id.tool_state == '2':
work_ids_2.append(workorder_id)
elif workorder_id.tool_state == '1':
work_ids_1.append(workorder_id)
if work_ids_2:
item.tool_state = '2' item.tool_state = '2'
elif work_ids_1: elif workorder_ids.filtered(lambda a: a.tool_state == '1'):
item.tool_state = '1' item.tool_state = '1'
else: else:
item.tool_state = '0' item.tool_state = '0'

View File

@@ -132,7 +132,7 @@ class ReworkWizard(models.TransientModel):
'sequence_number': cmm_line.sequence_number, 'sequence_number': cmm_line.sequence_number,
'program_name': cmm_line.program_name, 'program_name': cmm_line.program_name,
'program_path': cmm_line.program_path, 'program_path': cmm_line.program_path,
'ftp_path': item_line.program_path, 'ftp_path': cmm_line.program_path,
'processing_panel': panel.name, 'processing_panel': panel.name,
'program_create_date': datetime.strftime( 'program_create_date': datetime.strftime(
cmm_line.program_create_date, cmm_line.program_create_date,