Accept Merge Request #1186: (feature/优化工单_3 -> 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/1186?initial=true
This commit is contained in:
禹翔辉
2024-07-26 16:27:58 +08:00
committed by Coding
2 changed files with 19 additions and 13 deletions

View File

@@ -806,8 +806,6 @@ class ResMrpWorkOrder(models.Model):
if workorder.production_id.is_rework is True:
if re_work or cnc_workorder:
workorder.state = 'waiting'
if workorder.production_id.tool_state in ['1', '2'] and workorder.state != 'pending':
workorder.state = 'waiting'
elif workorder.routing_type == 'CNC加工' and workorder.state not in ['done', 'rework', 'cancel']:
pre_workorder = self.env['mrp.workorder'].search(
@@ -850,11 +848,19 @@ class ResMrpWorkOrder(models.Model):
# else:
# if workorder.state not in ['cancel', 'rework']:
# workorder.state = 'rework'
if workorder.production_id.state == 'pending_cam':
if workorder.production_id.tool_state in ['1', '2']:
work_ids = workorder.production_id.workorder_ids.filtered(
lambda a: a.routing_type == '装夹预调' and a.state in ['ready', 'waiting'])
work_ids.state = 'waiting'
# 当工单对应制造订单的功能刀具状态为 【无效刀】时,先对的第一个装夹预调工单状态设置为 【等待组件】
if workorder.production_id.tool_state in ['1', '2']:
if workorder.routing_type == '装夹预调':
if workorder.state in ['ready']:
workorder.state = 'waiting'
continue
elif workorder.state == 'pending' and self.search(
[('production_id', '=', workorder.production_id.id),
('sequence', '=', workorder.sequence - 1),
('state', 'in', ['done', 'rework'])]):
workorder.state = 'waiting'
continue
logging.info('工序:%s' % workorder.sequence)
logging.info('工单最终状态:%s' % workorder.state)

View File

@@ -105,12 +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})
# 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):