Accept Merge Request #1184: (feature/优化工单_2 -> develop)

Merge Request: 优化工单状态

Created By: @禹翔辉
Reviewed By: @马广威
Approved By: @马广威 
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1184?initial=true
This commit is contained in:
禹翔辉
2024-07-26 14:53:37 +08:00
committed by Coding
2 changed files with 11 additions and 0 deletions

View File

@@ -50,6 +50,7 @@ class MrpProduction(models.Model):
def _compute_tool_state(self):
for item in self:
if item.workorder_ids:
tool_state = item.tool_state
workorder_ids = item.workorder_ids.filtered(lambda a: a.state not in ('rework', '返工'))
if workorder_ids.filtered(lambda a: a.tool_state == '2'):
item.tool_state = '2'
@@ -57,6 +58,10 @@ class MrpProduction(models.Model):
item.tool_state = '1'
else:
item.tool_state = '0'
if tool_state == '2' and item.tool_state != '2':
item.detection_result_ids.filtered(
lambda a: a.detailed_reason == '无效功能刀具' and a.handle_result == '待处理').write(
{'handle_result': '已处理'})
# state = fields.Selection(selection_add=[
# ('pending_scheduling', '待排程'),

View File

@@ -105,6 +105,12 @@ class CNCprocessing(models.Model):
'test_results': '返工',
'handle_result': '待处理'
})
if not production_id.is_rework:
production_id.write({
'is_rework': True
})
production_id.workorder_ids.filtered(
lambda a: a.processing_panel == key and not a.is_rework).write({'is_rework': True})
# 对缺刀信息进行处理
for key in data2:
if data2.get(key):