public static void CreateStatecFile(LotEntity lotEntity, string localdir, string infofile, string station) { UtilLog.Info("starting Create statec file:"); string date = System.DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"); string filename = localdir + "\\" + infofile; string cmd = "shellnt program " + lotEntity.RecipeName + " -at -b"; try { DeleteFile(localdir, infofile.Substring(infofile.Length - 4, 4)); StreamWriter sw = File.CreateText(filename); sw.WriteLine("STATION:" + station); sw.WriteLine("DEVICE_NAME:" + lotEntity.DeviceId); sw.WriteLine("PROGRAM_NAME:" + lotEntity.RecipeName); sw.WriteLine("LOT_NUMBER:" + lotEntity.LotNo); sw.WriteLine("LOT_QUANTITY:" + lotEntity.LotQty); sw.WriteLine("GDCAL:" + lotEntity.SpmGdcal); sw.Flush(); sw.Close(); } catch (Exception ex) { UtilLog.Error(ex); } }
public static void MoveFile(string fullpath, string fileName, string destdir) { try { if (!Directory.Exists(destdir)) { Directory.CreateDirectory(destdir); } string destpath = destdir + fileName; //目标路径 if (File.Exists(destpath)) { File.Delete(destpath); //目标目录中有此文件,则先删除,再移过来。 } File.Move(fullpath, destpath); UtilLog.Info("Move file: " + fullpath + " to path: " + destdir); } catch (Exception ex) { UtilLog.Error("Handle Move File Err:", ex); } }