private void FtpUp(string filetmp, string archpos, int maxpage, int arid, int regpage, bool bl) { try { Common.WriteArchlog(arid, "退出案卷"); if (File.Exists(filetmp)) { Common.WiteUpTask(arid, archpos, T_ConFigure.ScanTempFile, (int)T_ConFigure.ArchStat.扫描完, maxpage, filetmp, "0"); if (bl) { List <string> lsfile = new List <string>(); Himg._SplitImgScan(filetmp, out lsfile); ClsImg.CleHole(lsfile); string f = Himg.MergeImg(lsfile).Trim(); if (f.Length > 0) { File.Delete(filetmp); filetmp = f; } } if (T_ConFigure.FtpStyle == 1) { string sourcefile = Path.Combine(T_ConFigure.FtpTmp, T_ConFigure.TmpScan, archpos, T_ConFigure.ScanTempFile); string goalfile = Path.Combine(T_ConFigure.gArchScanPath, archpos, T_ConFigure.ScanTempFile); string path = Path.Combine(T_ConFigure.gArchScanPath, archpos); if (ftp.FtpMoveFile(sourcefile, goalfile, path)) { Thread.Sleep(5000); if (maxpage >= regpage) { Common.SetScanFinish(arid, maxpage, 1, (int)T_ConFigure.ArchStat.扫描完); } else { Common.SetScanFinish(arid, maxpage, 1, (int)T_ConFigure.ArchStat.无); } Common.DelTask(arid); try { Directory.Delete(Path.Combine(T_ConFigure.FtpTmpPath, T_ConFigure.TmpScan, archpos)); } catch { } return; } } else { if (ftp.SaveRemoteFileUp(T_ConFigure.gArchScanPath, archpos, filetmp, T_ConFigure.ScanTempFile)) { if (maxpage >= regpage) { Common.SetScanFinish(arid, maxpage, 1, (int)T_ConFigure.ArchStat.扫描完); } else { Common.SetScanFinish(arid, maxpage, 1, (int)T_ConFigure.ArchStat.无); } Common.DelTask(Convert.ToInt32(arid)); try { File.Delete(filetmp); Directory.Delete(Path.Combine(T_ConFigure.LocalTempPath, archpos)); } catch { } return; } // 新传输模式发现图像有错位现象 // string newfile = Path.Combine(T_ConFigure.gArchScanPath, archpos, T_ConFigure.ScanTempFile); //string newpath = Path.Combine(T_ConFigure.gArchScanPath, archpos); //bool x = await ftp.FtpUpFile(filetmp, newfile, newpath); //if (x) { // Common.SetScanFinish(arid, maxpage, 1, (int)T_ConFigure.ArchStat.扫描完); // Common.DelTask(arid); // try { // File.Delete(filetmp); // Directory.Delete(Path.Combine(T_ConFigure.LocalTempPath, archpos)); // } catch { } // return; //} } } else { Common.WriteArchlog(ClsTwain.Archid, "退出时未找到图像文件"); } Common.SetScanFinish(arid, maxpage, 0, (int)T_ConFigure.ArchStat.无); } catch { Common.SetScanFinish(arid, maxpage, 0, (int)T_ConFigure.ArchStat.无); } finally { GC.Collect(); } }