修复隐藏项目

This commit is contained in:
mgw
2024-06-28 09:51:31 +08:00
parent 5378d62551
commit c8de75ceae
11 changed files with 57 additions and 68 deletions

View File

@@ -207,7 +207,7 @@ class ResMrpWorkOrder(models.Model):
[("programming", "编程"), ("clamping", "返工"), ("cutter", "刀具"), ("operate computer", "操机"),
("technology", "工艺"), ("customer redrawing", "客户改图"), ("other", "其他"), ], string="原因", tracking=True)
detailed_reason = fields.Text('详细原因')
is_send_program_again = fields.Boolean(string='是否重新下发NC程序', default=False)
# is_send_program_again = fields.Boolean(string='是否重新下发NC程序', default=False)
@api.onchange('rfid_code')
def _onchange(self):
@@ -1036,7 +1036,7 @@ class ResMrpWorkOrder(models.Model):
if raw_move:
raw_move.write({'state': 'done'})
record.production_id.button_mark_done1()
# self.production_id.state = 'done'
record.production_id.state = 'done'
# 将FTP的检测报告文件下载到临时目录
def download_reportfile_tmp(self, workorder, reportpath):
@@ -1079,31 +1079,30 @@ class ResMrpWorkOrder(models.Model):
return True
# 重新下发nc程序
def button_send_program_again(self):
try:
res = {'programming_no': self.production_id.programming_no}
configsettings = self.env['res.config.settings'].get_values()
config_header = Common.get_headers(self, configsettings['token'], configsettings['sf_secret_key'])
url = '/api/intelligent_programming/reset_state_again'
config_url = configsettings['sf_url'] + url
r = requests.post(config_url, json=res, data=None, headers=config_header)
r = r.json()
result = json.loads(r['result'])
if result['status'] == 1:
productions = self.env['mrp.production'].search(
[('programming_no', '=', self.production_id.programming_no), ('programming_state', '=', '已编程')])
if productions:
workorder = productions.workorder_ids.filtered(
lambda ap: ap.routing_type in ['装夹预调', 'CNC加工'] and ap.state not in ['done', 'cancel',
'progress'])
if workorder:
workorder.write({'is_send_program_again': True})
productions.write({'work_state': '编程中', 'programming_state': '编程中'})
else:
raise UserError(result['message'])
except Exception as e:
logging.info('button_send_program_again error:%s' % e)
raise UserError("重新下发nc程序失败,请联系管理员")
# def button_send_program_again(self):
# try:
# res = {'programming_no': self.production_id.programming_no}
# configsettings = self.env['res.config.settings'].get_values()
# config_header = Common.get_headers(self, configsettings['token'], configsettings['sf_secret_key'])
# url = '/api/intelligent_programming/reset_state_again'
# config_url = configsettings['sf_url'] + url
# r = requests.post(config_url, json=res, data=None, headers=config_header)
# r = r.json()
# result = json.loads(r['result'])
# if result['status'] == 1:
# productions = self.env['mrp.production'].search(
# [('programming_no', '=', self.production_id.programming_no), ('programming_state', '=', '已编程')])
# if productions:
# workorder = productions.workorder_ids.filtered(
# lambda ap: ap.routing_type in ['装夹预调', 'CNC加工'] and ap.state not in ['done', 'cancel',
# 'progress'])
# if workorder:
# productions.write({'work_state': '编程中', 'programming_state': '编程中'})
# else:
# raise UserError(result['message'])
# except Exception as e:
# logging.info('button_send_program_again error:%s' % e)
# raise UserError("重新下发nc程序失败,请联系管理员")
class CNCprocessing(models.Model):