/// <summary> /// 获取Upan测试结果,不测填null /// </summary> /// <param name="res">直流电阻ini文件地址</param> /// <param name="dci">绝缘电阻ini文件地址</param> /// <param name="cap">介质损耗ini文件地址</param> /// <param name="oltc">有载分接ini文件地址</param> /// <returns> upan测试下单的数据</returns> public static TestStruct RetuenTestForUpanData(string res, string dci, string cap, string oltc) { TestStruct testStruct = new TestStruct(); if (!File.Exists(res)) { WriteDataToFile.DeelDirectoryInfo(res, Mode.Create); } if (!File.Exists(dci)) { WriteDataToFile.DeelDirectoryInfo(dci, Mode.Create); } if (!File.Exists(cap)) { WriteDataToFile.DeelDirectoryInfo(cap, Mode.Create); } if (!File.Exists(oltc)) { WriteDataToFile.DeelDirectoryInfo(oltc, Mode.Create); } if (res != null) { testStruct.res = ReadDcresisitance(res); } if (dci != null) { testStruct.dci = ReadDcinlution(dci); } if (cap != null) { testStruct.cap = ReadCaptance(cap); } if (oltc != null) { testStruct.Oltc = ReadOltc(oltc); } return(testStruct); }
/// <summary> /// 创建所有的文件和任务单 /// </summary> /// <param name="basepath"></param> /// <param name="ListlisName"></param> /// <param name="job"></param> public static void writefile(string basepath, string ListlisName, JobList job, List <MeasurementItemStruct> miList) { if (!File.Exists(basepath))//根文件 { WriteDataToFile.DeelDirectoryInfo(basepath, Mode.Create); } string testlispath = basepath + "\\" + ListlisName; if (!File.Exists(testlispath))//testlist文件 { WriteDataToFile.FileBaseDeel(testlispath, MyFileMode.Create); WriteDataToFile.WriteFile(testlispath, "00"); } string TaskPath = basepath + "Ta" + DateTime.Now.DayOfYear.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString(); if (!File.Exists(TaskPath)) { WriteDataToFile.DeelDirectoryInfo(TaskPath, Mode.Create); } string transpath = TaskPath + "\\TRANS.lis"; string DcresistancePath = TaskPath + "\\ZLDZ.lis"; string DciPath = TaskPath + "\\JYDZ.lis"; string caopath = TaskPath + "\\JZSH.lis"; string Oltcpayh = TaskPath + "\\YZFJ.lis"; string TestLispath = TaskPath + "\\" + "TEST.lis"; if (File.Exists(transpath)) { WriteDataToFile.FileBaseDeel(transpath, MyFileMode.Clear); } if (File.Exists(DcresistancePath)) { WriteDataToFile.FileBaseDeel(DcresistancePath, MyFileMode.Clear); } if (File.Exists(DciPath)) { WriteDataToFile.FileBaseDeel(DciPath, MyFileMode.Clear); } if (File.Exists(caopath)) { WriteDataToFile.FileBaseDeel(caopath, MyFileMode.Clear); } if (File.Exists(Oltcpayh)) { WriteDataToFile.FileBaseDeel(Oltcpayh, MyFileMode.Clear); } if (File.Exists(TestLispath)) { WriteDataToFile.FileBaseDeel(TestLispath, MyFileMode.Clear); } CreateListlis(testlispath, "Ta" + DateTime.Now.DayOfYear.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString()); CreateTransList(transpath, job); CreateWorkList(DcresistancePath, DciPath, caopath, Oltcpayh); CreateTestList(TestLispath); CreateBaseMessageIni(TaskPath + "\\Information.ini"); //保存用户信息 UseUpanDoWork.LocalUsb.saveJob(job, TaskPath + "\\Jobtask.dat"); //保存job单 UseUpanDoWork.LocalUsb.savListmi(miList, TaskPath + "\\Listmitask.dat"); Insertdatabyupan Ins = new Insertdatabyupan(TaskPath); job = Ins.UpdataJob(TaskPath); UseUpanDoWork.LocalUsb.saveJob(job, TaskPath + "\\Jobtask.dat");//保存job单 }