//复制图片到以条码命名的文件夹里 public void CopyPictToSNDirectory(string DirectoryName, string sourceFile, string sourcePict, string destPict) { try { if (!Directory.Exists(DirectoryName)) { Directory.CreateDirectory(DirectoryName); } GFileOperate.CopyFile(sourceFile + "\\" + sourcePict, DirectoryName + "\\" + destPict); } catch (Exception e) { MessageBox.Show(e.ToString()); } }
public static void UpLoadPicture(string strPictSN) { if (CAMiClsVariable.strVision == "COGNEX")//Cognex { //upLoadPath = upLoadPath + "\\" + DateTime.Now.ToString("yyyyMMdd") + "\\" + strPictSN + ".zip"; string sourceUpLoadPathT21 = upLoadPath + "\\" + DateTime.Now.ToString("yyyyMMdd") + "\\" + strPictSN + "_T21" + ".zip"; string sourceUpLoadPathT22 = upLoadPath + "\\" + DateTime.Now.ToString("yyyyMMdd") + "\\" + strPictSN + "_T22" + ".zip"; //destLoadPath=destLoadPath+"\\" + strPictSN + ".zip"; //string destUpLoadPath = destLoadPath + "\\" + strPictSN + ".zip"; try { if (!Directory.Exists(destLoadPath + "\\" + strPictSN.Substring(0, 17))) { Directory.CreateDirectory(destLoadPath + "\\" + strPictSN.Substring(0, 17)); GFileOperate.CopyFile(sourceUpLoadPathT21, destLoadPath + "\\" + strPictSN.Substring(0, 17) + "\\" + strPictSN + "_T21" + ".zip"); GFileOperate.CopyFile(sourceUpLoadPathT22, destLoadPath + "\\" + strPictSN.Substring(0, 17) + "\\" + strPictSN + "_T22" + ".zip"); } //GFileOperate.MoveFile(sourceUpLoadPath, destUpLoadPath); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } else if (CAMiClsVariable.strVision == "KEYENCE") { //upLoadPath = upLoadPath + "\\" + DateTime.Now.ToString("yyyyMMdd") + "\\" + strPictSN + ".zip"; string sourceUpLoadPath = "D:\\ImageUpLoadPDCA" + "\\" + strPictSN + ".zip"; //destLoadPath=destLoadPath+"\\" + strPictSN + ".zip"; string destUpLoadPath = destLoadPath + "\\" + strPictSN + ".zip"; try { if (!Directory.Exists(destLoadPath + "\\" + strPictSN)) { Directory.CreateDirectory(destLoadPath + "\\" + strPictSN); GFileOperate.CopyFile(sourceUpLoadPath, destLoadPath + "\\" + strPictSN + "\\" + strPictSN + ".zip"); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }