处理CNC文件下发失败的bug
This commit is contained in:
@@ -608,7 +608,7 @@ class CNCprocessing(models.Model):
|
||||
estimated_processing_time = fields.Char('预计加工时间')
|
||||
remark = fields.Text('备注')
|
||||
workorder_id = fields.Many2one('mrp.workorder', string="工单")
|
||||
workorder_id = fields.Many2one('mrp.production', string="制造定单")
|
||||
production_id = fields.Many2one('mrp.production', string="制造定单")
|
||||
button_state = fields.Boolean(string='是否已经下发')
|
||||
|
||||
# mrs下发编程单创建CNC加工
|
||||
@@ -618,6 +618,8 @@ class CNCprocessing(models.Model):
|
||||
workorder = self.env['mrp.workorder'].search([('production_id.name', '=', ret['production_order_no']),
|
||||
('processing_panel', '=', obj['processing_panel']),
|
||||
('routing_type', '=', 'CNC加工')])
|
||||
logging.info('workorder:%s' % workorder)
|
||||
logging.info('obj:%s' % obj)
|
||||
cnc_processing = self.env['sf.cnc.processing'].create({
|
||||
'workorder_id': workorder.id,
|
||||
'sequence_number': obj['sequence_number'],
|
||||
@@ -633,7 +635,7 @@ class CNCprocessing(models.Model):
|
||||
'estimated_processing_time': obj['estimated_processing_time'],
|
||||
'remark': obj['remark']
|
||||
})
|
||||
self.get_cnc_processing_file(ret['folder_name'], cnc_processing, workorder.processing_panel)
|
||||
cnc_processing.get_cnc_processing_file(ret['folder_name'], cnc_processing, workorder.processing_panel)
|
||||
# cnc_workorder.state = 'done'
|
||||
cnc_workorder.work_state = '已编程'
|
||||
cnc_workorder.programming_state = '已编程'
|
||||
@@ -645,7 +647,7 @@ class CNCprocessing(models.Model):
|
||||
logging.info('folder_name:%s' % folder_name)
|
||||
serverdir = os.path.join('/tmp', folder_name, 'return', processing_panel)
|
||||
logging.info('serverdir:%s' % serverdir)
|
||||
for root, files in os.walk(serverdir):
|
||||
for root, dirs, files in os.walk(serverdir):
|
||||
for f in files:
|
||||
logging.info('f:%s' % f)
|
||||
if os.path.splitext(f)[1] == ".pdf":
|
||||
@@ -680,6 +682,7 @@ class CNCprocessing(models.Model):
|
||||
ftp = FtpController(str(ftp_resconfig['ftp_host']), int(ftp_resconfig['ftp_port']), ftp_resconfig['ftp_user'],
|
||||
ftp_resconfig['ftp_password'])
|
||||
download_state = ftp.download_file_tree(remotepath, serverdir)
|
||||
logging.info('download_state:%s' % download_state)
|
||||
return download_state
|
||||
|
||||
# 将nc文件存到attach的datas里
|
||||
|
||||
Reference in New Issue
Block a user