创建胚料的bug修复

This commit is contained in:
jinling.yang
2022-12-26 10:25:16 +08:00
parent dd5c387585
commit a4be58098e
8 changed files with 268 additions and 185 deletions

View File

@@ -390,26 +390,12 @@ class CNCprocessing(models.Model):
if os.path.exists(nc_file_path):
with open(nc_file_path, 'rb') as file:
data_bytes = file.read()
attachment = self.attachment_create(cnc.program_name + '.NC', data_bytes)
cnc.write({'cnc_id': attachment.id})
file.close()
attachment = self.attachment_create(cnc.program_name, data_bytes)
cnc.write({'cnc_id': attachment.id})
file.close()
else:
return False
# 将nc文件对应的excel清单转为pdf
# def to_pdf(self, excel_path, pdf_path):
# """
# 需要在linux中下载好libreoffice
# """
# logging.info('pdf_path:%s' % pdf_path)
# logging.info('pdf_path:%s' % excel_path)
# # 注意cmd中的libreoffice要和linux中安装的一致
# cmd = 'soffice --headless --convert-to pdf'.split() + [excel_path] + ['--outdir'] + [pdf_path]
# p = subprocess.Popen(cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE, bufsize=1)
# # p.wait(timeout=30) # 停顿30秒等待转化
# # stdout, stderr = p.communicate()
# p.communicate()
class SfWorkOrderBarcodes(models.Model):
"""