还原代码
This commit is contained in:
@@ -1203,21 +1203,21 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
|
|
||||||
if self.sequence == 1:
|
if self.sequence == 1:
|
||||||
# 判断工单状态是否为等待组件
|
# 判断工单状态是否为等待组件
|
||||||
# if self.state == 'waiting':
|
if self.state == 'waiting':
|
||||||
# raise UserError('制造订单【%s】缺少组件信息!' % self.production_id.name)
|
raise UserError('制造订单【%s】缺少组件信息!' % self.production_id.name)
|
||||||
# # 判断是否有坯料的序列号信息
|
# 判断是否有坯料的序列号信息
|
||||||
# boolean = False
|
boolean = False
|
||||||
# if self.production_id.move_raw_ids:
|
if self.production_id.move_raw_ids:
|
||||||
# if self.production_id.move_raw_ids[0].product_id.categ_type == '坯料':
|
if self.production_id.move_raw_ids[0].product_id.categ_type == '坯料':
|
||||||
# if self.production_id.move_raw_ids[0].move_line_ids:
|
if self.production_id.move_raw_ids[0].move_line_ids:
|
||||||
# if self.production_id.move_raw_ids[0].move_line_ids:
|
if self.production_id.move_raw_ids[0].move_line_ids:
|
||||||
# if self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name:
|
if self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name:
|
||||||
# boolean = True
|
boolean = True
|
||||||
# else:
|
else:
|
||||||
# boolean = True
|
boolean = True
|
||||||
# if not boolean:
|
if not boolean:
|
||||||
# raise UserError('制造订单【%s】缺少组件的序列号信息!' % self.production_id.name)
|
raise UserError('制造订单【%s】缺少组件的序列号信息!' % self.production_id.name)
|
||||||
# self.pro_code = self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name
|
self.pro_code = self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name
|
||||||
# cnc校验
|
# cnc校验
|
||||||
if self.production_id.production_type == '自动化产线加工':
|
if self.production_id.production_type == '自动化产线加工':
|
||||||
cnc_workorder = self.search(
|
cnc_workorder = self.search(
|
||||||
@@ -1318,11 +1318,11 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
def button_finish(self):
|
def button_finish(self):
|
||||||
for record in self:
|
for record in self:
|
||||||
if record.routing_type == '装夹预调':
|
if record.routing_type == '装夹预调':
|
||||||
# if not record.rfid_code and record.is_rework is False:
|
if not record.rfid_code and record.is_rework is False:
|
||||||
# raise UserError("请扫RFID码进行绑定")
|
raise UserError("请扫RFID码进行绑定")
|
||||||
# if record.is_rework is False:
|
if record.is_rework is False:
|
||||||
# if not record.material_center_point:
|
if not record.material_center_point:
|
||||||
# raise UserError("坯料中心点为空,请检查")
|
raise UserError("坯料中心点为空,请检查")
|
||||||
# if record.X_deviation_angle <= 0:
|
# if record.X_deviation_angle <= 0:
|
||||||
# raise UserError("X偏差角度小于等于0,请检查!本次计算的X偏差角度为:%s" % record.X_deviation_angle)
|
# raise UserError("X偏差角度小于等于0,请检查!本次计算的X偏差角度为:%s" % record.X_deviation_angle)
|
||||||
record.process_state = '待加工'
|
record.process_state = '待加工'
|
||||||
|
|||||||
@@ -40,21 +40,21 @@ class Sf_Mrs_Connect(http.Controller, MultiInheritController):
|
|||||||
return json.JSONEncoder().encode(res)
|
return json.JSONEncoder().encode(res)
|
||||||
if productions:
|
if productions:
|
||||||
# 拉取所有加工面的程序文件
|
# 拉取所有加工面的程序文件
|
||||||
# for r in ret['processing_panel'].split(','):
|
for r in ret['processing_panel'].split(','):
|
||||||
# program_path_tmp_r = os.path.join('/tmp', ret['folder_name'], 'return', r)
|
program_path_tmp_r = os.path.join('/tmp', ret['folder_name'], 'return', r)
|
||||||
# if os.path.exists(program_path_tmp_r):
|
if os.path.exists(program_path_tmp_r):
|
||||||
# files_r = os.listdir(program_path_tmp_r)
|
files_r = os.listdir(program_path_tmp_r)
|
||||||
# if files_r:
|
if files_r:
|
||||||
# for file_name in files_r:
|
for file_name in files_r:
|
||||||
# file_path = os.path.join(program_path_tmp_r, file_name)
|
file_path = os.path.join(program_path_tmp_r, file_name)
|
||||||
# os.remove(file_path)
|
os.remove(file_path)
|
||||||
# download_state = request.env['sf.cnc.processing'].with_user(
|
download_state = request.env['sf.cnc.processing'].with_user(
|
||||||
# request.env.ref("base.user_admin")).download_file_tmp(
|
request.env.ref("base.user_admin")).download_file_tmp(
|
||||||
# ret['folder_name'], r)
|
ret['folder_name'], r)
|
||||||
# if download_state is False:
|
if download_state is False:
|
||||||
# res['status'] = -2
|
res['status'] = -2
|
||||||
# res['message'] = '编程单号为%s的CNC程序文件从FTP拉取失败' % (ret['programming_no'])
|
res['message'] = '编程单号为%s的CNC程序文件从FTP拉取失败' % (ret['programming_no'])
|
||||||
# return json.JSONEncoder().encode(res)
|
return json.JSONEncoder().encode(res)
|
||||||
for production in productions:
|
for production in productions:
|
||||||
production.write({'programming_state': '已编程', 'work_state': '已编程'})
|
production.write({'programming_state': '已编程', 'work_state': '已编程'})
|
||||||
for panel in ret['processing_panel'].split(','):
|
for panel in ret['processing_panel'].split(','):
|
||||||
@@ -72,29 +72,29 @@ class Sf_Mrs_Connect(http.Controller, MultiInheritController):
|
|||||||
cnc_workorder_has.write(
|
cnc_workorder_has.write(
|
||||||
{'cnc_ids': cnc_workorder_has.cnc_ids.sudo()._json_cnc_processing(panel, ret),
|
{'cnc_ids': cnc_workorder_has.cnc_ids.sudo()._json_cnc_processing(panel, ret),
|
||||||
'cmm_ids': cnc_workorder_has.cmm_ids.sudo()._json_cmm_program(panel, ret)})
|
'cmm_ids': cnc_workorder_has.cmm_ids.sudo()._json_cmm_program(panel, ret)})
|
||||||
# for panel in ret['processing_panel'].split(','):
|
for panel in ret['processing_panel'].split(','):
|
||||||
# # 查询状态为进行中且工序类型为CNC加工的工单
|
# 查询状态为进行中且工序类型为CNC加工的工单
|
||||||
# cnc_workorder = productions.workorder_ids.filtered(
|
cnc_workorder = productions.workorder_ids.filtered(
|
||||||
# lambda ac: ac.routing_type == 'CNC加工' and ac.state not in ['progress', 'done', 'rework'
|
lambda ac: ac.routing_type == 'CNC加工' and ac.state not in ['progress', 'done', 'rework'
|
||||||
# 'cancel'] and ac.processing_panel == panel)
|
'cancel'] and ac.processing_panel == panel)
|
||||||
# if cnc_workorder:
|
if cnc_workorder:
|
||||||
# # program_path_tmp_panel = os.path.join('C://Users//43484//Desktop//fsdownload//test',
|
# program_path_tmp_panel = os.path.join('C://Users//43484//Desktop//fsdownload//test',
|
||||||
# # panel)
|
# panel)
|
||||||
# program_path_tmp_panel = os.path.join('/tmp', ret['folder_name'], 'return', panel)
|
program_path_tmp_panel = os.path.join('/tmp', ret['folder_name'], 'return', panel)
|
||||||
# files_panel = os.listdir(program_path_tmp_panel)
|
files_panel = os.listdir(program_path_tmp_panel)
|
||||||
# if files_panel:
|
if files_panel:
|
||||||
# for file in files_panel:
|
for file in files_panel:
|
||||||
# file_extension = os.path.splitext(file)[1]
|
file_extension = os.path.splitext(file)[1]
|
||||||
# if file_extension.lower() == '.pdf':
|
if file_extension.lower() == '.pdf':
|
||||||
# panel_file_path = os.path.join(program_path_tmp_panel, file)
|
panel_file_path = os.path.join(program_path_tmp_panel, file)
|
||||||
# logging.info('panel_file_path:%s' % panel_file_path)
|
logging.info('panel_file_path:%s' % panel_file_path)
|
||||||
# cnc_workorder.write({'cnc_worksheet': base64.b64encode(open(panel_file_path, 'rb').read())})
|
cnc_workorder.write({'cnc_worksheet': base64.b64encode(open(panel_file_path, 'rb').read())})
|
||||||
# pre_workorder = productions.workorder_ids.filtered(
|
pre_workorder = productions.workorder_ids.filtered(
|
||||||
# lambda ap: ap.routing_type == '装夹预调' and ap.state not in ['done', 'rework'
|
lambda ap: ap.routing_type == '装夹预调' and ap.state not in ['done', 'rework'
|
||||||
# 'cancel'] and ap.processing_panel == panel)
|
'cancel'] and ap.processing_panel == panel)
|
||||||
# if pre_workorder:
|
if pre_workorder:
|
||||||
# pre_workorder.write(
|
pre_workorder.write(
|
||||||
# {'processing_drawing': base64.b64encode(open(panel_file_path, 'rb').read())})
|
{'processing_drawing': base64.b64encode(open(panel_file_path, 'rb').read())})
|
||||||
productions.write({'programming_state': '已编程', 'work_state': '已编程'})
|
productions.write({'programming_state': '已编程', 'work_state': '已编程'})
|
||||||
logging.info('已更新制造订单编程状态:%s' % productions.ids)
|
logging.info('已更新制造订单编程状态:%s' % productions.ids)
|
||||||
res.update({
|
res.update({
|
||||||
|
|||||||
Reference in New Issue
Block a user