还原代码
This commit is contained in:
@@ -33,7 +33,7 @@ class SfMaintenanceEquipmentAGVLog(models.Model):
|
|||||||
|
|
||||||
|
|
||||||
class SfMaintenanceEquipment(models.Model):
|
class SfMaintenanceEquipment(models.Model):
|
||||||
_inherit = ['maintenance.equipment']
|
_inherit = 'maintenance.equipment'
|
||||||
_description = '设备'
|
_description = '设备'
|
||||||
|
|
||||||
crea_url = "/api/machine_tool/create"
|
crea_url = "/api/machine_tool/create"
|
||||||
|
|||||||
@@ -89,8 +89,8 @@ class AgvScheduling(models.Model):
|
|||||||
workorders: 工单
|
workorders: 工单
|
||||||
"""
|
"""
|
||||||
_logger.info('创建AGV调度任务\r\n起点为【%s】,任务类型为【%s】,工单为【%s】' % (agv_start_site_name, agv_route_type, workorders))
|
_logger.info('创建AGV调度任务\r\n起点为【%s】,任务类型为【%s】,工单为【%s】' % (agv_start_site_name, agv_route_type, workorders))
|
||||||
# if not workorders:
|
if not workorders:
|
||||||
# raise UserError(_('工单不能为空'))
|
raise UserError(_('工单不能为空'))
|
||||||
agv_start_site = self.env['sf.agv.site'].sudo().search([('name', '=', agv_start_site_name)], limit=1)
|
agv_start_site = self.env['sf.agv.site'].sudo().search([('name', '=', agv_start_site_name)], limit=1)
|
||||||
if not agv_start_site:
|
if not agv_start_site:
|
||||||
raise UserError(_('不存在名称为【%s】的接驳站,请先创建!' % agv_start_site_name))
|
raise UserError(_('不存在名称为【%s】的接驳站,请先创建!' % agv_start_site_name))
|
||||||
|
|||||||
@@ -806,10 +806,10 @@ class MrpProduction(models.Model):
|
|||||||
backorders = backorders - productions_to_backorder
|
backorders = backorders - productions_to_backorder
|
||||||
|
|
||||||
productions_not_to_backorder._post_inventory(cancel_backorder=True)
|
productions_not_to_backorder._post_inventory(cancel_backorder=True)
|
||||||
if self.workorder_ids.filtered(lambda w: w.routing_type in ['表面工艺']):
|
# if self.workorder_ids.filtered(lambda w: w.routing_type in ['表面工艺']):
|
||||||
move_finish = self.env['stock.move'].search([('created_production_id', '=', self.id)])
|
# move_finish = self.env['stock.move'].search([('created_production_id', '=', self.id)])
|
||||||
if move_finish:
|
# if move_finish:
|
||||||
move_finish._action_assign()
|
# move_finish._action_assign()
|
||||||
productions_to_backorder._post_inventory(cancel_backorder=True)
|
productions_to_backorder._post_inventory(cancel_backorder=True)
|
||||||
|
|
||||||
# if completed products make other confirmed/partially_available moves available, assign them
|
# if completed products make other confirmed/partially_available moves available, assign them
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ from odoo.addons.sf_mrs_connect.models.ftp_operate import FtpController
|
|||||||
|
|
||||||
|
|
||||||
class ResMrpWorkOrder(models.Model):
|
class ResMrpWorkOrder(models.Model):
|
||||||
_inherit = ['mrp.workorder']
|
_inherit = 'mrp.workorder'
|
||||||
_order = 'sequence asc'
|
_order = 'sequence asc'
|
||||||
|
|
||||||
product_tmpl_name = fields.Char('坯料产品名称', related='production_bom_id.bom_line_ids.product_id.name')
|
product_tmpl_name = fields.Char('坯料产品名称', related='production_bom_id.bom_line_ids.product_id.name')
|
||||||
|
|||||||
@@ -31,67 +31,67 @@ class Sf_Mrs_Connect(http.Controller):
|
|||||||
request.env.ref("base.user_admin")).search(domain)
|
request.env.ref("base.user_admin")).search(domain)
|
||||||
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:
|
||||||
if not production.workorder_ids:
|
if not production.workorder_ids:
|
||||||
production.product_id.model_processing_panel = ret['processing_panel']
|
production.product_id.model_processing_panel = ret['processing_panel']
|
||||||
production._create_workorder(ret)
|
production._create_workorder(ret)
|
||||||
productions.process_range_time()
|
productions.process_range_time()
|
||||||
# else:
|
else:
|
||||||
# for panel in ret['processing_panel'].split(','):
|
for panel in ret['processing_panel'].split(','):
|
||||||
# # 查询状态为进行中且工序类型为CNC加工的工单
|
# 查询状态为进行中且工序类型为CNC加工的工单
|
||||||
# cnc_workorder_has = production.workorder_ids.filtered(
|
cnc_workorder_has = production.workorder_ids.filtered(
|
||||||
# lambda ach: ach.routing_type == 'CNC加工' and ach.state not in ['progress', 'done',
|
lambda ach: ach.routing_type == 'CNC加工' and ach.state not in ['progress', 'done',
|
||||||
# 'rework',
|
'rework',
|
||||||
# 'cancel'] and ach.processing_panel == panel)
|
'cancel'] and ach.processing_panel == panel)
|
||||||
# if cnc_workorder_has:
|
if cnc_workorder_has:
|
||||||
# if cnc_workorder_has.cnc_ids:
|
if cnc_workorder_has.cnc_ids:
|
||||||
# cnc_workorder_has.cmm_ids.sudo().unlink()
|
cnc_workorder_has.cmm_ids.sudo().unlink()
|
||||||
# cnc_workorder_has.cnc_ids.sudo().unlink()
|
cnc_workorder_has.cnc_ids.sudo().unlink()
|
||||||
# request.env['sf.cam.work.order.program.knife.plan'].sudo().unlink_cam_plan(
|
request.env['sf.cam.work.order.program.knife.plan'].sudo().unlink_cam_plan(
|
||||||
# production)
|
production)
|
||||||
# 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)
|
||||||
# logging.info('program_path_tmp_panel:%s' % program_path_tmp_panel)
|
logging.info('program_path_tmp_panel:%s' % program_path_tmp_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]
|
||||||
# logging.info('file_extension:%s' % file_extension)
|
logging.info('file_extension:%s' % file_extension)
|
||||||
# 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': '已编程'})
|
||||||
return json.JSONEncoder().encode(res)
|
return json.JSONEncoder().encode(res)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user