制造订单合并一张编程单下发时,工件配送记录的未下发nc程序为未下发及cnc程序没有对应ftp文件路径问题
This commit is contained in:
@@ -766,6 +766,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
|
||||
sale_order = self.env['sale.order'].sudo().search([('name', '=', productions.origin)])
|
||||
if sale_order:
|
||||
sale_order.mrp_production_ids |= productions
|
||||
# sale_order.write({'schedule_status': 'to schedule'})
|
||||
self.env['sf.production.plan'].sudo().with_company(self.production_id.company_id).create({
|
||||
'name': productions.name,
|
||||
@@ -995,7 +996,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
'date_planned_finished': tem_date_planned_finished # 保持原值
|
||||
})
|
||||
if record.routing_type == 'CNC加工' and record.test_results in ['返工', '报废']:
|
||||
record.production_id.write({'state': 'cancel'})
|
||||
record.production_id.action_cancel()
|
||||
record.production_id.workorder_ids.write({'rfid_code': False, 'rfid_code_old': record.rfid_code})
|
||||
if record.is_remanufacture is True:
|
||||
record.recreateManufacturingOrWorkerOrder()
|
||||
@@ -1130,6 +1131,8 @@ class CNCprocessing(models.Model):
|
||||
'cutting_tool_extension_length': obj['cutting_tool_extension_length'],
|
||||
'cutting_tool_handle_type': obj['cutting_tool_handle_type'],
|
||||
'estimated_processing_time': obj['estimated_processing_time'],
|
||||
'program_path': obj['program_path'],
|
||||
'cnc_id': obj['cnc_id'].id,
|
||||
'remark': obj['remark']
|
||||
})
|
||||
return cnc_processing_str
|
||||
@@ -1137,19 +1140,27 @@ class CNCprocessing(models.Model):
|
||||
# 根据程序名和加工面匹配到ftp里对应的Nc程序名,可优化为根据cnc_processing.program_path进行匹配
|
||||
def get_cnc_processing_file(self, serverdir, cnc_processing, program_path):
|
||||
logging.info('serverdir:%s' % serverdir)
|
||||
logging.info('cnc_processing:%s' % cnc_processing)
|
||||
for root, dirs, files in os.walk(serverdir):
|
||||
for f in files:
|
||||
logging.info('splitext(f):%s' % os.path.splitext(f)[1])
|
||||
if os.path.splitext(f)[1] == ".pdf":
|
||||
full_path = os.path.join(serverdir, root, f)
|
||||
if full_path is not False:
|
||||
if not cnc_processing.workorder_id.cnc_worksheet:
|
||||
cnc_processing.workorder_id.cnc_worksheet = base64.b64encode(
|
||||
open(full_path, 'rb').read())
|
||||
else:
|
||||
if f in program_path:
|
||||
# if cnc_processing.program_name == f.split('.')[0]:
|
||||
cnc_file_path = os.path.join(serverdir, root, f)
|
||||
self.write_file(cnc_file_path, cnc_processing)
|
||||
logging.info('full_path:%s' % full_path)
|
||||
logging.info('routing_type:%s' % cnc_processing.workorder_id.routing_type)
|
||||
logging.info('cnc_worksheet:%s' % cnc_processing.workorder_id.cnc_worksheet)
|
||||
# with open(full_path, 'rb') as pdf_file:
|
||||
# file_content = pdf_file.read()
|
||||
# cnc_processing.workorder_id.cnc_worksheet = base64.b64encode(file_content)
|
||||
if not cnc_processing.workorder_id.cnc_worksheet:
|
||||
logging.info('full_path111555:%s' % full_path)
|
||||
cnc_processing.workorder_id.cnc_worksheet = base64.b64encode(
|
||||
open(full_path, 'rb').read())
|
||||
else:
|
||||
if f in program_path:
|
||||
# if cnc_processing.program_name == f.split('.')[0]:
|
||||
cnc_file_path = os.path.join(serverdir, root, f)
|
||||
self.write_file(cnc_file_path, cnc_processing)
|
||||
|
||||
# 创建附件(nc文件)
|
||||
def attachment_create(self, name, data):
|
||||
|
||||
Reference in New Issue
Block a user