添加工单开始校验
This commit is contained in:
@@ -84,15 +84,15 @@ class CNCprocessing(models.Model):
|
||||
if production_id:
|
||||
data1 = datas['无效刀'].get(production_id.name) # data1: {'加工面1': [], ...}
|
||||
data2 = datas['缺刀'].get(production_id.name) # data2: {'加工面1': [], ...}
|
||||
tool_state_remark1 = ''
|
||||
# tool_state_remark1 = ''
|
||||
tool_state_remark2 = ''
|
||||
# 对无效刀信息进行处理
|
||||
for key in data1:
|
||||
if data1.get(key):
|
||||
if tool_state_remark1 != '':
|
||||
tool_state_remark1 = f'{tool_state_remark1}\n{key}无效刀:{data1.get(key)}'
|
||||
else:
|
||||
tool_state_remark1 = f'{key}无效刀:{data1.get(key)}'
|
||||
# if tool_state_remark1 != '':
|
||||
# tool_state_remark1 = f'{tool_state_remark1}\n{key}无效刀:{data1.get(key)}'
|
||||
# else:
|
||||
# tool_state_remark1 = f'{key}无效刀:{data1.get(key)}'
|
||||
# 无效刀处理逻辑
|
||||
# 1、创建制造订单无效刀检测结果记录
|
||||
logging.info('创建制造订单无效刀检测结果记录!')
|
||||
@@ -105,30 +105,19 @@ class CNCprocessing(models.Model):
|
||||
'test_results': '返工',
|
||||
'handle_result': '待处理'
|
||||
})
|
||||
# 2、将制造订单状态改为返工
|
||||
# production_id.write({
|
||||
# 'state': 'rework'
|
||||
# })
|
||||
# 对缺刀信息进行处理
|
||||
if tool_state_remark1 == '':
|
||||
for key in data2:
|
||||
if data2.get(key) and not data1.get(key):
|
||||
if tool_state_remark2 != '':
|
||||
tool_state_remark2 = f'{tool_state_remark2}\n{key}缺刀:{data2.get(key)}'
|
||||
else:
|
||||
tool_state_remark2 = f'{key}缺刀:{data2.get(key)}'
|
||||
for key in data2:
|
||||
if data2.get(key):
|
||||
if tool_state_remark2 != '':
|
||||
tool_state_remark2 = f'{tool_state_remark2}\n{key}缺刀:{data2.get(key)}'
|
||||
else:
|
||||
tool_state_remark2 = f'{key}缺刀:{data2.get(key)}'
|
||||
# 将备注信息存入制造订单功能刀具状态的备注字段
|
||||
logging.info('修改制造订单功能刀具状态的备注字段')
|
||||
if production_id.tool_state_remark2 == '':
|
||||
production_id.write({
|
||||
'tool_state_remark': tool_state_remark2,
|
||||
'tool_state_remark2': tool_state_remark1
|
||||
})
|
||||
else:
|
||||
production_id.write({
|
||||
'tool_state_remark': tool_state_remark2,
|
||||
'tool_state_remark2': f'{production_id.tool_state_remark1}\n{tool_state_remark1}'
|
||||
})
|
||||
production_id.write({
|
||||
'tool_state_remark': tool_state_remark2,
|
||||
# 'tool_state_remark2': tool_state_remark1
|
||||
})
|
||||
logging.info('工单cnc程序用刀校验已完成!')
|
||||
|
||||
@api.model_create_multi
|
||||
|
||||
Reference in New Issue
Block a user