using Model;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using Tool;
namespace BLL
{
public class CheckBLL
{
private SqlHelper sql = new SqlHelper();
private ConfigHelper configHelper = new ConfigHelper();
private FileHelper file = new FileHelper();
public void SetConfig(SettingModel set)
{
configHelper.Write("Index", set.index.ToString());
}
///
/// 读取配置文件内容
///
///
public SettingModel LoadConfig()
{
//地址
string setPath1 = System.Environment.CurrentDirectory + "\\Setting1.config";
//夹具号
string setPath2 = System.Environment.CurrentDirectory + "\\Setting2.config";
//机型
string setPath3 = System.Environment.CurrentDirectory + "\\Setting3.config";
try
{
SettingModel set = new SettingModel();
Dictionary dic = configHelper.ReadAll();
//地址
Dictionary dic1 = configHelper.ReadAll(setPath1);
//夹具号
Dictionary dic2 = configHelper.ReadAll(setPath2);
//机型
Dictionary dic3 = configHelper.ReadAll(setPath3);
if (dic1.ContainsKey("pathini"))
{
set.pathini = dic1["pathini"];
}
if (dic1.ContainsKey("pathLoad"))
{
set.pathLoad = dic1["pathLoad"];
}
if (dic1.ContainsKey("pathch1"))
{
set.pathch1 = dic1["pathch1"];
}
if (dic1.ContainsKey("pathch2"))
{
set.pathch2 = dic1["pathch2"];
}
if (dic2.ContainsKey("devcode1"))
{
set.devcode1 = dic2["devcode1"];
}
if (dic2.ContainsKey("devcode2"))
{
set.devcode2 = dic2["devcode2"];
}
if (dic3.ContainsKey("type"))
{
set.Types = dic3["type"].Split(';');
}
if (dic.ContainsKey("Index"))
{
set.index = int.Parse(dic["Index"]);
}
return set;
}
catch (Exception ee)
{
LogHelper.WriteLog(ee.ToString());
return null;
}
}
public List getReplacetest1(string path,string imei)
{
string pathen = "";
string textna = "";
List topexcl = new List();
DirectoryInfo theFolder1 = new DirectoryInfo(path);
DirectoryInfo[] dir12 = theFolder1.GetDirectories();
if (dir12.Length!=1)
{
return topexcl;
}
foreach (DirectoryInfo NextFolder2 in dir12)
{
textna = NextFolder2.Name;
if (NextFolder2.Name.Contains(imei) && NextFolder2.Name.Contains("PASS"))
{
pathen = NextFolder2.FullName+ "\\LTE_FT.csv";
}else
{
return topexcl;
}
}
using (var reader = new StreamReader(pathen))
{
string line;
// 循环读取文件中的每一行
while ((line = reader.ReadLine()) != null)
{
// 使用Split函数按逗号分隔行内容
string[] fields = line.Split(',');
// 这里可以对分隔后的字段数据进行处理或存储
// 示例:打印每一行的字段
//for (int i = 0; i < fields.Length; i++)
//{
// Console.WriteLine($"Field {i + 1}: {fields[i]}");
//}
ExclModel itme = new ExclModel();
itme.textname = textna;
itme.Band = fields[1];
itme.Channel = fields[2];
itme.Result = fields[7];
topexcl.Add(itme);
// 实际应用中,您可以在此处替换为实际的数据处理逻辑
}
}
return topexcl;
}
///
/// 从log文件读取功率
///
///
///
///
public Tuple, string> getReplacetest(string path, string imei,int num)
{
string pathen = "";
string textna = "";
string retul = "OK";
List topexcl = new List();
DirectoryInfo theFolder1 = new DirectoryInfo(path);
DirectoryInfo[] dir12 = theFolder1.GetDirectories();
List dir13 = theFolder1.GetDirectories().ToList();
if (dir12.Length != num + 1)
{
retul = "log文件数量不为" + (num + 1);
return new Tuple, string>(topexcl, retul);
}
//List onetextna1 = dir13.OrderByDescending(it => it.CreationTime).ToList();
DirectoryInfo onetextna = dir13.OrderByDescending(it => it.CreationTime).First();
textna = onetextna.Name;
pathen = onetextna.FullName + "\\LTE_FT.csv";
DateTime s = onetextna.CreationTime;
DateTime s1 = DateTime.Today;
if (s, string>(topexcl, retul);
}
//if (dir12.Length != num+1)
//{
// retul="log文件数量不为"+ (num+1);
// return new Tuple, string>(topexcl, retul);
//}
foreach (DirectoryInfo NextFolder2 in dir12)
{
//textna = NextFolder2.Name;
//if (NextFolder2.Name.Contains(imei) && NextFolder2.Name.Contains("PASS"))
//{
// pathen = NextFolder2.FullName + "\\LTE_FT.csv";
//}
//else
//{
// retul = "log文件名称没有PASS或与金机号不符";
// return new Tuple, string>(topexcl, retul);
//}
if (!NextFolder2.Name.Contains(imei) || !NextFolder2.Name.Contains("PASS"))
{
retul = "log文件名称没有PASS或与金机号不符";
return new Tuple, string>(topexcl, retul);
}
}
using (var reader = new StreamReader(pathen))
{
string line;
// 循环读取文件中的每一行
while ((line = reader.ReadLine()) != null)
{
// 使用Split函数按逗号分隔行内容
string[] fields = line.Split(',');
// 这里可以对分隔后的字段数据进行处理或存储
// 示例:打印每一行的字段
//for (int i = 0; i < fields.Length; i++)
//{
// Console.WriteLine($"Field {i + 1}: {fields[i]}");
//}
if (fields[2].Contains("Channel"))
{
continue;
}
ExclModel itme = new ExclModel();
itme.textname = textna;
itme.Band = fields[1];
itme.Channel = fields[2];
itme.Result = fields[7];
topexcl.Add(itme);
// 实际应用中,您可以在此处替换为实际的数据处理逻辑
}
}
return new Tuple, string>(topexcl, retul);
}
///
/// 从软件的配置文件里读取线损
///
///
///
///
public List getinitest(string path,int numb)
{
string DateStr = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss");
string pathen = AppDomain.CurrentDomain.BaseDirectory + "ini备份";
//this.file.Transport(path, "D:\\xiansun", DateStr+"line.ini");
this.file.Transport(path, pathen, DateStr + "line.ini");
List < IniModel > lsit = new List();
for (int i = 0; i < 48; i++)
{
IniModel one = new IniModel();
one.several_line_loss = (lsit.Count + 1).ToString();
one.textname = DateStr + "Line.ini";
lsit.Add(one);
}
using (StreamReader sr = new StreamReader(pathen+"\\" + DateStr + "Line.ini", Encoding.UTF8))
//using (StreamReader sr = new StreamReader("D:\\xiansun\\" + DateStr + "Line.ini", Encoding.UTF8))
{
string line;
bool isRead = false;
List lines = new List();
//IniModel one = new IniModel();
int number = 0;
while ((line = sr.ReadLine()) != null)
{
lines.Add(line);
if (line.Contains("[Instrument Setting TS"+ (numb).ToString() +"]"))
{
isRead = true;
}
if (line.Contains("[Instrument Setting TS" + (numb+1).ToString() + "]"))
{
isRead = false;
}
if (line == ""|| !isRead||line.Contains("DIV")|| line.Contains("66_"))
{
continue;
}
if (!line.Contains("LTE_BAND"))
{
continue;
}
if (line.Contains("LTE_BAND") && line.Contains("TX_LOW_LOSS"))
{
number = int.Parse(line.Split(new char[2] { 'D', '_' })[2])-1;
lsit[number].LTE_BAND_TX_LOW_LOSS= line.Split('=')[1].Trim();
//one.LTE_BAND_TX_LOW_LOSS = line.Split('=')[1].Trim();
//number = number + 1;
}
else if (line.Contains("LTE_BAND") && line.Contains("TX_MID_LOSS"))
{
number = int.Parse(line.Split(new char[2] { 'D', '_' })[2]) - 1;
lsit[number].LTE_BAND_TX_MID_LOSS = line.Split('=')[1].Trim();
//one.LTE_BAND_TX_MID_LOSS = line.Split('=')[1].Trim();
//number = number + 1;
}
else if (line.Contains("LTE_BAND") && line.Contains("TX_HIGH_LOSS"))
{
number = int.Parse(line.Split(new char[2] { 'D', '_' })[2]) - 1;
lsit[number].LTE_BAND_TX_HIGH_LOSS = line.Split('=')[1].Trim();
//one.LTE_BAND_TX_HIGH_LOSS = line.Split('=')[1].Trim();
//number = number + 1;
}
else if (line.Contains("LTE_BAND") && line.Contains("RX_LOW_LOSS"))
{
number = int.Parse(line.Split(new char[2] { 'D', '_' })[2]) - 1;
lsit[number].LTE_BAND_RX_LOW_LOSS = line.Split('=')[1].Trim();
//one.LTE_BAND_RX_LOW_LOSS = line.Split('=')[1].Trim();
//number = number + 1;
}
else if (line.Contains("LTE_BAND") && line.Contains("RX_MID_LOSS"))
{
number = int.Parse(line.Split(new char[2] { 'D', '_' })[2]) - 1;
lsit[number].LTE_BAND_RX_MID_LOSS = line.Split('=')[1].Trim();
//one.LTE_BAND_RX_MID_LOSS = line.Split('=')[1].Trim();
//number = number + 1;
}
else if (line.Contains("LTE_BAND") && line.Contains("RX_HIGH_LOSS"))
{
number = int.Parse(line.Split(new char[2] { 'D', '_' })[2]) - 1;
lsit[number].LTE_BAND_RX_HIGH_LOSS = line.Split('=')[1].Trim();
//one.LTE_BAND_RX_HIGH_LOSS = line.Split('=')[1].Trim();
//number = number + 1;
}
//if (number==6)
//{
// lsit.Add(one);
// one = new IniModel();
// number = 0;
//}
}
return lsit;
}
}
///
/// 从软件的配置文件里读取线损
///
///
///
///
public string getloadtest(string path)
{
//string DateStr = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss");
//this.file.Transport(path, "D:\\xiansun", DateStr + "Load.ini");
//List lsit = new List();
//using (StreamReader sr = new StreamReader("D:\\xiansun\\" + DateStr + "Load.ini", Encoding.UTF8))
//{
// string line;
// List lines = new List();
// //IniModel one = new IniModel();
// while ((line = sr.ReadLine()) != null)
// {
// lines.Add(line);
// if (line.Contains("EnableScript1="))
// {
// string setingd = line.Split('=')[1].Trim();
// lsit.Add(setingd);
// }
// }
// if (lsit.Count!=2)
// {
// return "Load.ini读取的EnableScript1数量为"+ lsit.Count+"条";
// }
//if (lsit[1]!="0")
//{
// return "Load.ini未取消校准";
//}
return "OK";
//} //}
}
///
/// 将log文件的位置清理,准备点检或抓取
///
///
public void Clearfile(SettingModel set)
{
DirectoryInfo theFolder1 = new DirectoryInfo(set.pathch1);
DirectoryInfo theFolder2 = new DirectoryInfo(set.pathch2);
DirectoryInfo parsent = theFolder1.Parent;
string path1 = parsent.FullName + "\\errch1";
string path2 = parsent.FullName + "\\errch2";
if (!Directory.Exists(path1))
{
Directory.CreateDirectory(path1);
}
if (!Directory.Exists(path2))
{
Directory.CreateDirectory(path2);
}
DirectoryInfo[] dir11 = theFolder1.GetDirectories();
foreach (DirectoryInfo NextFolder1 in dir11)
{
NextFolder1.MoveTo(path1 + "\\" + NextFolder1.Name);
}
DirectoryInfo[] dir12 = theFolder2.GetDirectories();
foreach (DirectoryInfo NextFolder2 in dir12)
{
NextFolder2.MoveTo(path2 + "\\" + NextFolder2.Name);
}
//theFolder1.MoveTo(path1+ "\\" + “xxx_xx_xxx”);
//theFolder2.MoveTo(path2+"\\" + “xxx_xx_xxx”);
}
///
/// 将log文件上传共享文件夹,并在本地备份
///
///
///
///
public string coply(string path,int num,string devcode)
{
try
{
DateTime dt = sql.db3.GetDate();
string DateStr = dt.ToString("yyyy-MM-dd");
string pathup = "\\\\192.168.2.149\\生产数据-2\\制造二课\\制造二课(模组车间)\\中移上传点检\\日常点检\\" + DateStr + "\\" + devcode;
string pathcp = "";
DirectoryInfo theFolder1 = new DirectoryInfo(path);
pathcp = theFolder1.Parent.FullName+"\\备份\\"+ DateStr;
if (!Directory.Exists(pathcp))
{
Directory.CreateDirectory(pathcp);
}
DirectoryInfo[] dir12 = theFolder1.GetDirectories();
if (dir12.Length != num)
{
return "文件数量错误";
}
foreach (DirectoryInfo NextFolder2 in dir12)
{
if (!Directory.Exists(pathup+"\\"+ NextFolder2.Name))
{
Directory.CreateDirectory(pathup + "\\" + NextFolder2.Name);
}
FileInfo[] dir11 = NextFolder2.GetFiles();
foreach (FileInfo NextFolder3 in dir11)
{
if (Copy_directory(NextFolder3.FullName, pathup + "\\" + NextFolder2.Name))
{
if (File.Exists(pathcp + "\\" + NextFolder2.Name + "\\" + NextFolder3.Name))
{
File.Delete(pathcp + "\\" + NextFolder2.Name + "\\" + NextFolder3.Name);
}
}
else
{
return "文件上传失败"+ NextFolder2.Name;
}
}
NextFolder2.MoveTo(pathcp + "\\" + NextFolder2.Name);
}
return "OK";
}
catch (Exception ee)
{
return ee.ToString();
}
}
///
/// 复制文件
///
///
///
///
public static bool Copy_directory(string sourcePath, string destinationPath)
{
Boolean fpss = true;
string dPath = destinationPath + sourcePath.Substring(sourcePath.LastIndexOf("\\"));
FileInfo old = new FileInfo(sourcePath);
File.Copy(sourcePath, dPath, true);
if (File.Exists(dPath))
{
FileInfo romote = new FileInfo(dPath);
if (old.Length != romote.Length)
{
fpss = false;
}
}
return fpss;
}
///
/// 判断从文件读取的log功率是否读取完整。线损是否小于4
///
///
///
///
public string Checktest(List exclModel, List initestModel)
{
foreach (var item1 in exclModel)
{
if (item1.Band==""|| item1.Result == "" || item1.Channel == "" )
{
return "log数据未采集完整!";
}
}
foreach (var item2 in initestModel)
{
if (item2.LTE_BAND_TX_LOW_LOSS == "" || item2.LTE_BAND_TX_MID_LOSS == ""
|| item2.LTE_BAND_TX_HIGH_LOSS == "" || item2.LTE_BAND_RX_LOW_LOSS == ""
|| item2.LTE_BAND_RX_MID_LOSS == "" || item2.LTE_BAND_RX_HIGH_LOSS == "")
{
return "ini数据未采集完整!";
}
if(double.Parse(item2.LTE_BAND_TX_LOW_LOSS) >100)
{
return "ini的index" + item2.several_line_loss + "的LTE_BAND_TX_LOW_LOSS的为" + item2.LTE_BAND_TX_LOW_LOSS + "大于100";
}
if (double.Parse(item2.LTE_BAND_TX_MID_LOSS) > 100)
{
return "ini的index" + item2.several_line_loss + "的LTE_BAND_TX_MID_LOSS的为" + item2.LTE_BAND_TX_MID_LOSS + "大于100";
}
if (double.Parse(item2.LTE_BAND_TX_HIGH_LOSS) > 100)
{
return "ini的index" + item2.several_line_loss + "的LTE_BAND_TX_HIGH_LOSS的为" + item2.LTE_BAND_TX_HIGH_LOSS + "大于100";
}
if (double.Parse(item2.LTE_BAND_RX_LOW_LOSS) > 100)
{
return "ini的index" + item2.several_line_loss + "的LTE_BAND_RX_LOW_LOSS的为" + item2.LTE_BAND_RX_LOW_LOSS + "大于100";
}
if (double.Parse(item2.LTE_BAND_RX_MID_LOSS) > 100)
{
return "ini的index" + item2.several_line_loss + "的LTE_BAND_RX_MID_LOSS的为" + item2.LTE_BAND_RX_MID_LOSS + "大于100";
}
if (double.Parse(item2.LTE_BAND_RX_HIGH_LOSS) > 100)
{
return "ini的index" + item2.several_line_loss + "的LTE_BAND_RX_HIGH_LOSS的为" + item2.LTE_BAND_RX_HIGH_LOSS + "大于100";
}
}
return "OK";
}
///
/// 对比两个log功率的差距是否大于0.3
///
///
///
///
public string Checklog(List exclModel, List standardExclModelModel,string exc1name,string exc2name,string type)
{
try
{
if (exclModel.Count != standardExclModelModel.Count)
{
return exc1name+"的数据条数" + exclModel.Count + "与"+ exc2name+"的条数" + standardExclModelModel.Count + "不同";
}
foreach (var item in exclModel)
{
//bool chck = false;
//foreach (var item1 in standardExclModelModel)
//{
// if (item.Channel == item1.Channel)
// {
// chck = true;
// double value1 = double.Parse(item.Result.Replace("dBm", ""));
// double value2 = double.Parse(item1.Result.Replace("dBm", ""));
// double difference = Math.Abs(value1 - value2);
// if (difference >= 0.5)
// {
// return (item.Channel + "的" + item.Result + "与数据库的" + item1.Result + "差超过0.5");
// }
// if (difference >= 0.3)
// {
// return (item.Channel + "的" + item.Result + "与数据库的" + item1.Result + "差超过0.3");
// }
// }
//}
var item2 = standardExclModelModel.Find(m=>m.Band== item.Band&&m.Channel==item.Channel);
if (item2==null)
{
return exc1name + "的数据Channel:" + item.Channel + "在"+ exc2name + "未找到对应的记录";
}
double value1 = double.Parse(item.Result.Replace("dBm", ""));
double value2 = double.Parse(item2.Result.Replace("dBm", ""));
double difference = Math.Abs(value1 - value2);
if (difference >= 0.5)
{
return (exc1name + "的数据Channel:"+item.Channel + "的" + item.Result + "与"+ exc2name+"的" + item2.Result + "差超过0.5");
}
//if (type == "ML307R芯朴" && item.Band == "8")
//{
// if (difference >= 0.4)
// {
// return ("ML307R芯朴"+exc1name + "的数据Channel:" + item.Channel + "的" + item.Result + "与" + exc2name + "的" + item2.Result + "差超过0.4");
// }
//}
//else
//{
// if (difference >= 0.3)
// {
// return (exc1name + "的数据Channel:" + item.Channel + "的" + item.Result + "与" + exc2name + "的" + item2.Result + "差超过0.3");
// }
//}
}
return "OK";
}
catch (Exception ee) {
LogHelper.WriteLog(ee.ToString());
return ee.ToString();
}
}
///
/// 对比两个线损的差距是否小于.03
///
///
///
///
public string Checkini(List initestModel, List standardInitestModel, string exc1name, string exc2name)
{
try
{
if (initestModel.Count != standardInitestModel.Count)
{
return exc1name+"线损的数据条数" + initestModel.Count + "与"+ exc2name + "线损的条数" + standardInitestModel.Count + "不同";
}
foreach (var item in initestModel)
{
////bool chck = false;
//foreach (var item1 in standardInitestModel)
//{
// if (item.index == item1.index)
// {
// chck = true;
// string difff ="";
// difff=matchekc(item.LTE_BAND_TX_LOW_LOSS, item1.LTE_BAND_TX_LOW_LOSS);
// if (difff!="OK")
// {
// return "线损的数据index:" + item.index + "LTE_BAND_TX_LOW_LOSS"+ difff;
// }
// difff = matchekc(item.LTE_BAND_TX_MID_LOSS, item1.LTE_BAND_TX_MID_LOSS);
// if (difff != "OK")
// {
// return "线损的数据index:" + item.index + "LTE_BAND_TX_MID_LOSS" + difff;
// }
// difff = matchekc(item.LTE_BAND_TX_HIGH_LOSS, item1.LTE_BAND_TX_HIGH_LOSS);
// if (difff != "OK")
// {
// return "线损的数据index:" + item.index + "LTE_BAND_TX_HIGH_LOSS" + difff;
// }
// difff = matchekc(item.LTE_BAND_RX_LOW_LOSS, item1.LTE_BAND_RX_LOW_LOSS);
// if (difff != "OK")
// {
// return "线损的数据index:" + item.index + "LTE_BAND_RX_LOW_LOSS" + difff;
// }
// difff = matchekc(item.LTE_BAND_RX_MID_LOSS, item1.LTE_BAND_RX_MID_LOSS);
// if (difff != "OK")
// {
// return "线损的数据index:" + item.index + "LTE_BAND_RX_MID_LOSS" + difff;
// }
// difff = matchekc(item.LTE_BAND_RX_HIGH_LOSS, item1.LTE_BAND_RX_HIGH_LOSS);
// if (difff != "OK")
// {
// return "线损的数据index:" + item.index + "LTE_BAND_RX_HIGH_LOSS" + difff;
// }
// }
//}
//if (!chck)
//{
// return "线损的数据index:" + item.index + "未找到对应的记录";
//}
var item2 = standardInitestModel.Find(m=>m.several_line_loss == item.several_line_loss);
if (item2 == null)
{
return exc1name+"线损的数据index:" + item.several_line_loss + "在" +exc2name + "未找到对应的记录";
}
string difff = "";
difff = matchekc(item.LTE_BAND_TX_LOW_LOSS, item2.LTE_BAND_TX_LOW_LOSS);
if (difff != "OK")
{
return exc1name + "线损的数据index:" + item.several_line_loss + "对比"+ exc2name + "LTE_BAND_TX_LOW_LOSS" + difff;
}
difff = matchekc(item.LTE_BAND_TX_MID_LOSS, item2.LTE_BAND_TX_MID_LOSS);
if (difff != "OK")
{
return exc1name + "线损的数据index:" + item.several_line_loss + "对比" + exc2name + "LTE_BAND_TX_MID_LOSS" + difff;
}
difff = matchekc(item.LTE_BAND_TX_HIGH_LOSS, item2.LTE_BAND_TX_HIGH_LOSS);
if (difff != "OK")
{
return exc1name + "线损的数据index:" + item.several_line_loss + "对比" + exc2name + "LTE_BAND_TX_HIGH_LOSS" + difff;
}
difff = matchekc(item.LTE_BAND_RX_LOW_LOSS, item2.LTE_BAND_RX_LOW_LOSS);
if (difff != "OK")
{
return exc1name + "线损的数据index:" + item.several_line_loss + "对比" + exc2name + "LTE_BAND_RX_LOW_LOSS" + difff;
}
difff = matchekc(item.LTE_BAND_RX_MID_LOSS, item2.LTE_BAND_RX_MID_LOSS);
if (difff != "OK")
{
return exc1name + "线损的数据index:" + item.several_line_loss + "对比" + exc2name + "LTE_BAND_RX_MID_LOSS" + difff;
}
difff = matchekc(item.LTE_BAND_RX_HIGH_LOSS, item2.LTE_BAND_RX_HIGH_LOSS);
if (difff != "OK")
{
return "线损的数据index:" + item.several_line_loss + "对比" + exc2name + "LTE_BAND_RX_HIGH_LOSS" + difff;
}
}
return "OK";
}
catch (Exception ee)
{
return ee.ToString();
}
}
///
/// 判断两个数是否相差大于0.3
///
///
///
///
public string matchekc(string tvalue1,string tvalue2)
{
try
{
double value1 = double.Parse(tvalue1);
double value2 = double.Parse(tvalue2);
double difference = Math.Abs(value1 - value2);
if (difference >= 0.5)
{
return ("差超过0.5");
}
//if (difference >= 0.3)
//{
// return ("差超过0.3");
//}
return "OK";
}
catch (Exception ee) {
return ee.ToString();
}
}
///
/// 将共享文件内的文件移动到其他地方
///
///
///
///
///
///
public string moveto(string devcode1, string type, string snimei)
{
DateTime dt = sql.db3.GetDate();
string DateStr = dt.ToString("yyyy-MM-dd");
string path = "\\\\192.168.2.149\\生产数据-2\\制造二课\\制造二课(模组车间)\\中移上传点检\\日常点检\\" + DateStr+"\\"+ devcode1;
string pathto = "\\\\192.168.2.149\\生产数据-2\\制造二课\\制造二课(模组车间)\\中移上传点检\\日常点检备份\\" + DateStr + "\\" + devcode1;
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
DirectoryInfo theFolder1 = new DirectoryInfo(path);
DirectoryInfo[] dir12 = theFolder1.GetDirectories();
if (dir12.Length == 0)
{
return "OK";
}
if (!Directory.Exists(pathto))
{
Directory.CreateDirectory(pathto);
}
foreach (DirectoryInfo NextFolder2 in dir12)
{
//if (!Directory.Exists(pathto + "\\" + NextFolder2.Name))
//{
// Directory.CreateDirectory(pathto + "\\" + NextFolder2.Name);
//}
//FileInfo[] dir11 = NextFolder2.GetFiles();
//foreach (FileInfo NextFolder3 in dir11)
//{
// if (Copy_directory(NextFolder3.FullName, pathto + "\\" + NextFolder2.Name))
// {
// if (File.Exists(pathto + "\\" + NextFolder2.Name + "\\" + NextFolder3.Name))
// {
// File.Delete(pathto + "\\" + NextFolder2.Name + "\\" + NextFolder3.Name);
// }
// }
// else
// {
// return "文件上传失败" + NextFolder2.Name;
// }
//}
NextFolder2.MoveTo(pathto + "\\" + NextFolder2.Name);
}
return "OK";
}
}
}