1.1修复排程工件配送没有目的生产线2.注释获取cnc程序最新代码(第二期)3.优化部分页面

This commit is contained in:
jinling.yang
2024-05-11 00:17:43 +08:00
parent b5c9387d8c
commit 2bffc5964a
7 changed files with 77 additions and 60 deletions

View File

@@ -24,6 +24,7 @@ class FtpController():
def file_exists(self, path):
# 检查文件是否存在于FTP服务器上
try:
logging.info("dirname:%s" % os.path.dirname(path))
self.ftp.cwd(os.path.dirname(path))
files = self.ftp.nlst()
return os.path.basename(path) in files
@@ -31,6 +32,11 @@ class FtpController():
logging.error(f"Error checking file: {e}")
return False
# # 检测字符串的编码
# def detect_encoding(self, s):
# result = chardet.detect(s)
# return result['encoding']
# 下载目录下的文件
def download_file_tree(self, target_dir, serverdir):
if not os.path.exists(serverdir):
@@ -40,17 +46,13 @@ class FtpController():
logging.info('目录:%s' % target_dir)
target_dir1 = target_dir.split('/')
logging.info('目录1:%s' % target_dir1[1])
self.ftp.cwd('NC')
self.ftp.cwd('XT_WH_MO_00164')
self.ftp.cwd('return')
self.ftp.cwd('R')
# self.ftp.cwd(target_dir1[1]) # 切换工作路径
# logging.info('目录2:%s' % target_dir1[2])
# self.ftp.cwd(target_dir1[2]) # 切换工作路径
# logging.info('目录3:%s' % target_dir1[3])
# self.ftp.cwd(target_dir1[3]) # 切换工作路径
# logging.info('目录4:%s' % target_dir1[4])
# self.ftp.cwd(target_dir1[4]) # 切换工作路径
self.ftp.cwd(target_dir1[1]) # 切换工作路径
logging.info('目录2:%s' % target_dir1[2])
self.ftp.cwd(target_dir1[2]) # 切换工作路径
logging.info('目录3:%s' % target_dir1[3])
self.ftp.cwd(target_dir1[3]) # 切换工作路径
logging.info('目录4:%s' % target_dir1[4])
self.ftp.cwd(target_dir1[4]) # 切换工作路径
remotenames = self.ftp.nlst()
logging.info('FTP目录文件:%s' % remotenames)
for file in remotenames:
@@ -88,6 +90,9 @@ class FtpController():
return 1
except Exception:
return 0
finally:
self.ftp.quit()
logging.info("ftp已关闭")
# 下载指定目录下的指定文件
def download_file(self, serverfile, remotefile):