選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 

478 行
23 KiB

  1. using MaiMuAOI.SysCtrl;
  2. using MaiMuAOI.SysUI;
  3. using Newtonsoft.Json;
  4. using System;
  5. using System.CodeDom.Compiler;
  6. using System.Collections.Generic;
  7. using System.ComponentModel;
  8. using System.Data;
  9. using System.Drawing;
  10. using System.IO;
  11. using System.IO.Ports;
  12. using System.Linq;
  13. using System.Text;
  14. using System.Threading.Tasks;
  15. using System.Windows.Forms;
  16. namespace MaiMuAOI.UI.SysSet
  17. {
  18. public partial class SysSetFrm : Form
  19. {
  20. public SysSetFrm()
  21. {
  22. InitializeComponent();
  23. UIStyle.SetUIStyle(this);
  24. this.uiTitel1.FatherForm = this;
  25. }
  26. private void tsbtnExit_Click(object sender, EventArgs e)
  27. {
  28. this.Close();
  29. }
  30. private void tsbtnSave_Click(object sender, EventArgs e)
  31. {
  32. try
  33. {
  34. GetParamsSave();
  35. SysMgr.Instance.CheckWebLog();
  36. MessageBox.Show("保存成功,修改硬件参数之后需重启生效!", "保存成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
  37. }
  38. catch (Exception ex)
  39. {
  40. MessageBox.Show(ex.Message,"保存出错", MessageBoxButtons.OK, MessageBoxIcon.Error);
  41. }
  42. }
  43. private void SysSetFrm_Load(object sender, EventArgs e)
  44. {
  45. skinTabControl1.SelectedIndex = 0;
  46. var comNameList = SerialPort.GetPortNames().ToList();
  47. comNameList.ForEach(comName =>
  48. {
  49. this.cobLightPortNum.Items.Add(comName);
  50. });
  51. //显示所有打印机
  52. if (SysMgr.Instance.PrintControl != null)
  53. {
  54. List<string> list = SysMgr.Instance.PrintControl.GetPrintersName();
  55. foreach (string printer in list)
  56. {
  57. cboPrinters.Items.Add(printer);
  58. cboPrinters2.Items.Add(printer);
  59. }
  60. }
  61. RefeshParams();
  62. }
  63. #region 界面刷新&保存
  64. private void RefeshParams()
  65. {
  66. ckSkipSizeFailed.Checked = ConfMgr.Instance.SysConfigParams.OpenMarkErrorStop;
  67. chkBuzzer.Checked = ConfMgr.Instance.SysConfigParams.OpenBuzzer;
  68. chkDoorSensor.Checked = ConfMgr.Instance.SysConfigParams.OpenDoor;
  69. chkHttpLog.Checked = ConfMgr.Instance.SysConfigParams.OpenHttpLog;
  70. cbOpenAutoAxisGoHome.Checked = ConfMgr.Instance.SysConfigParams.OpenAutoGoHome;
  71. cbOpenFlawDistribution.Checked = ConfMgr.Instance.SysConfigParams.OpenFlawDistribution;
  72. cbOpenAxisXCal.Checked = ConfMgr.Instance.SysConfigParams.OpenAxisXCalibration;
  73. cbPdtPut.Checked = ConfMgr.Instance.SysConfigParams.OpenPdtIsHave;
  74. cbSnapDefect.Checked = ConfMgr.Instance.SysConfigParams.OpenDefectSanp;
  75. cbAsideDefect.Checked = ConfMgr.Instance.SysConfigParams.OpenAsideDefect;
  76. cbOrdercheck.Checked = ConfMgr.Instance.SysConfigParams.OpenOredrCheck;
  77. cbOrderCntcheck.Checked = ConfMgr.Instance.SysConfigParams.OpenOredrCntCheck;
  78. cbShowDB.Checked = ConfMgr.Instance.SysConfigParams.OpenShowDB;
  79. cbOpenColorB.Checked = ConfMgr.Instance.SysConfigParams.OpenColorB;
  80. cbRemoveDop.Checked = ConfMgr.Instance.SysConfigParams.OpenRemoveDuplicates;
  81. cobLightPortNum.Text = ConfMgr.Instance.SysConfigParams.LightCom;
  82. numCamBaud.Value = ConfMgr.Instance.SysConfigParams.LightComBaud;
  83. tbIODevNum.Text = ConfMgr.Instance.SysConfigParams.IODevName;
  84. tbIOCfgPath.Text = ConfMgr.Instance.SysConfigParams.IOCfgPath;
  85. tbMotionCfgPath.Text = ConfMgr.Instance.SysConfigParams.MotionCfgPath;
  86. tbCamCfgPath2.Text = ConfMgr.Instance.SysConfigParams.BackCamCfgPath;
  87. tbCamSN2.Text = ConfMgr.Instance.SysConfigParams.BackCamName;
  88. chkSaveAllDefectImg.Checked = ConfMgr.Instance.SysConfigParams.SaveAllImg;
  89. tbDefectPath.Text = ConfMgr.Instance.SysConfigParams.DefectBigImag.SavePath;
  90. chkDefect_Path_AutoClear.Checked = ConfMgr.Instance.SysConfigParams.DefectBigImag.AutoDelete;
  91. numDefect_Path_AutoClear.Value = (decimal)ConfMgr.Instance.SysConfigParams.DefectBigImag.AutoDeleteDays;
  92. tbDefectSrcSmallPath.Text = ConfMgr.Instance.SysConfigParams.DefectSrcSmallImag.SavePath;
  93. chkDefect_SrcSmall_Path_AutoClear.Checked = ConfMgr.Instance.SysConfigParams.DefectSrcSmallImag.AutoDelete;
  94. numDefect_SrcSmall_Path_AutoClear.Value = (decimal)ConfMgr.Instance.SysConfigParams.DefectSrcSmallImag.AutoDeleteDays;
  95. numThres.Value = (decimal)ConfMgr.Instance.SysConfigParams.Defect_SrcSmall_Thres;
  96. tbDefectSmallPath.Text = ConfMgr.Instance.SysConfigParams.DefectSmallImag.SavePath;
  97. chkDefect_Small_Path_AutoClear.Checked = ConfMgr.Instance.SysConfigParams.DefectSmallImag.AutoDelete;
  98. numDefect_Small_Path_AutoClear.Value = (decimal)ConfMgr.Instance.SysConfigParams.DefectSmallImag.AutoDeleteDays;
  99. tbDefectCompressSavePath.Text = ConfMgr.Instance.SysConfigParams.DefectRepairImag.SavePath;
  100. chkDefect_Compress_SavePath_AutoClear.Checked = ConfMgr.Instance.SysConfigParams.DefectRepairImag.AutoDelete;
  101. numDefect_Compress_SavePath_AutoClear.Value = (decimal)ConfMgr.Instance.SysConfigParams.DefectRepairImag.AutoDeleteDays;
  102. tbSizeBmpCompareSavePath.Text = ConfMgr.Instance.SysConfigParams.SizeNGImag.SavePath;
  103. chkSizeBmp_Compare_SavePath_AutoClear.Checked = ConfMgr.Instance.SysConfigParams.SizeNGImag.AutoDelete;
  104. numSizeBmp_Compare_SavePath_AutoClear.Value = (decimal)ConfMgr.Instance.SysConfigParams.SizeNGImag.AutoDeleteDays;
  105. tbSizeBmpZoomImageSavePath.Text = ConfMgr.Instance.SysConfigParams.SizeRepairImag.SavePath;
  106. chkSizeBmp_Zoom_Image_SavePath_AutoClear.Checked = ConfMgr.Instance.SysConfigParams.SizeRepairImag.AutoDelete;
  107. numSizeBmp_Zoom_Image_SavePath_AutoClear.Value = (decimal)ConfMgr.Instance.SysConfigParams.SizeRepairImag.AutoDeleteDays;
  108. chkSkipAxis1.Checked = ConfMgr.Instance.SysConfigParams.DisableX2;
  109. chkSkipAxis2.Checked = ConfMgr.Instance.SysConfigParams.DisableY;
  110. chkSkipAxis3.Checked = ConfMgr.Instance.SysConfigParams.DisableZ;
  111. chkSkipLight.Checked = ConfMgr.Instance.SysConfigParams.DisableLight;
  112. chkSkipScannerGL.Checked = ConfMgr.Instance.SysConfigParams.DisableBackCam;
  113. tbSizeEnginePath.Text = ConfMgr.Instance.SysConfigParams.ImageProcessPath;
  114. tbMatDataPath.Text = ConfMgr.Instance.SysConfigParams.ImageProcessDataPath;
  115. tbModelPath.Text = ConfMgr.Instance.SysConfigParams.AIModelPath;
  116. tbPdtPath.Text = ConfMgr.Instance.ProjectDir;
  117. tbLocalIp.Text = ConfMgr.Instance.SysConfigParams.HttpServerIP;
  118. numHttpPort.Value = ConfMgr.Instance.SysConfigParams.HttpServerPort;
  119. tbLogPath.Text = ConfMgr.Instance.SysConfigParams.LogPath;
  120. ckbAutoClear.Checked = ConfMgr.Instance.SysConfigParams.AutoDeleteLog;
  121. numLogDays.Value = (decimal)ConfMgr.Instance.SysConfigParams.AutoDeleteLogData;
  122. cbResetBtn.Checked = ConfMgr.Instance.SysConfigParams.ShowResetBtn;
  123. cbBuzzShow.Checked = ConfMgr.Instance.SysConfigParams.ShowBuzz;
  124. cbDoorAlm.Checked = ConfMgr.Instance.SysConfigParams.ShowDoorAlm;
  125. cbShowBtn.Checked = ConfMgr.Instance.SysConfigParams.ShowDistribution;
  126. cbSizeEnabel.Checked = ConfMgr.Instance.SysConfigParams.ShowSizeBtn;
  127. cbDefectEnable.Checked = ConfMgr.Instance.SysConfigParams.ShowDefectBtn;
  128. numViewX.Value = (decimal)ConfMgr.Instance.SysConfigParams.DefectCamViewX;
  129. numViewY.Value = (decimal)ConfMgr.Instance.SysConfigParams.DefectCamViewY;
  130. cbEnableHttp.Checked = ConfMgr.Instance.SysConfigParams.EnableHttp;
  131. tbHttpUrl.Text = ConfMgr.Instance.SysConfigParams.HttpUrl;
  132. tbTempPath.Text = ConfMgr.Instance.SysConfigParams.HttpTempPath;
  133. tbKey.Text = ConfMgr.Instance.SysConfigParams.HttpReturnKey;
  134. tbValue.Text = ConfMgr.Instance.SysConfigParams.HttpReturnValue;
  135. /////////////Print////////////////
  136. this.cbOpenBarTenderPrint.Checked = ConfMgr.Instance.SysConfigParams.EnableLabelPrint;
  137. this.cboPrinters.SelectedItem = ConfMgr.Instance.SysConfigParams.LabelPrinterName;
  138. this.cbOpenExcelPrint.Checked = ConfMgr.Instance.SysConfigParams.EnableExcelPrint;
  139. this.cboPrinters2.SelectedItem = ConfMgr.Instance.SysConfigParams.ExcelPrinterName;
  140. ////////////////////////////////
  141. ////////////////本地云端////////////////
  142. cbOpenCloud.Checked = ConfMgr.Instance.SysConfigParams.OpenCloud;
  143. tbCloudName.Text = ConfMgr.Instance.SysConfigParams.CloudThisName;
  144. tbCloudIP.Text = ConfMgr.Instance.SysConfigParams.CloudServerIP;
  145. numCloudPort.Value = (decimal)ConfMgr.Instance.SysConfigParams.CloudServerPort;
  146. tbCloudUser.Text = ConfMgr.Instance.SysConfigParams.CloudUser;
  147. tbCloudPassword.Text = ConfMgr.Instance.SysConfigParams.CloudPassword;
  148. cbOpenPdtServer.Checked = ConfMgr.Instance.SysConfigParams.OpenPdtServer;
  149. rbServer.Checked = ConfMgr.Instance.SysConfigParams.IsPdtServer;
  150. rbClient.Checked = !ConfMgr.Instance.SysConfigParams.IsPdtServer;
  151. tbPdtServerIP.Text = ConfMgr.Instance.SysConfigParams.PdtServerIP;
  152. numPdtServerPort.Value = (decimal)ConfMgr.Instance.SysConfigParams.PdtServerPort;
  153. ////////////////////////////////////////
  154. }
  155. private void GetParamsSave()
  156. {
  157. SysConfigParams configParams = new SysConfigParams();
  158. configParams = ConfMgr.Instance.SysConfigParams;
  159. configParams.OpenMarkErrorStop = ckSkipSizeFailed.Checked;
  160. configParams.OpenBuzzer = chkBuzzer.Checked;
  161. configParams.OpenDoor = chkDoorSensor.Checked;
  162. configParams.OpenHttpLog = chkHttpLog.Checked;
  163. configParams.OpenAutoGoHome = cbOpenAutoAxisGoHome.Checked;
  164. configParams.OpenFlawDistribution = cbOpenFlawDistribution.Checked;
  165. configParams.OpenAxisXCalibration = cbOpenAxisXCal.Checked;
  166. configParams.OpenPdtIsHave = cbPdtPut.Checked;
  167. configParams.OpenDefectSanp = cbSnapDefect.Checked;
  168. configParams.OpenAsideDefect = cbAsideDefect.Checked;
  169. configParams.OpenOredrCheck = cbOrdercheck.Checked;
  170. configParams.OpenOredrCntCheck = cbOrderCntcheck.Checked;
  171. configParams.OpenShowDB = cbShowDB.Checked;
  172. configParams.OpenColorB = cbOpenColorB.Checked;
  173. configParams.OpenRemoveDuplicates = cbRemoveDop.Checked;
  174. configParams.LightCom = cobLightPortNum.Text;
  175. configParams.LightComBaud = (int)numCamBaud.Value;
  176. configParams.IODevName = tbIODevNum.Text;
  177. configParams.IOCfgPath = tbIOCfgPath.Text;
  178. configParams.MotionCfgPath = tbMotionCfgPath.Text;
  179. configParams.BackCamName = tbCamSN2.Text;
  180. configParams.BackCamCfgPath = tbCamCfgPath2.Text;
  181. configParams.SaveAllImg = chkSaveAllDefectImg.Checked;
  182. configParams.DefectBigImag.SavePath = tbDefectPath.Text;
  183. configParams.DefectBigImag.AutoDelete = chkDefect_Path_AutoClear.Checked;
  184. configParams.DefectBigImag.AutoDeleteDays = (double)numDefect_Path_AutoClear.Value;
  185. configParams.DefectSrcSmallImag.SavePath = tbDefectSrcSmallPath.Text;
  186. configParams.DefectSrcSmallImag.AutoDelete = chkDefect_SrcSmall_Path_AutoClear.Checked;
  187. configParams.DefectSrcSmallImag.AutoDeleteDays = (double)numDefect_SrcSmall_Path_AutoClear.Value;
  188. configParams.Defect_SrcSmall_Thres = (double)numThres.Value;
  189. configParams.DefectSmallImag.SavePath = tbDefectSmallPath.Text;
  190. configParams.DefectSmallImag.AutoDelete = chkDefect_Small_Path_AutoClear.Checked;
  191. configParams.DefectSmallImag.AutoDeleteDays = (double)numDefect_Small_Path_AutoClear.Value;
  192. configParams.DefectRepairImag.SavePath = tbDefectCompressSavePath.Text;
  193. configParams.DefectRepairImag.AutoDelete = chkDefect_Compress_SavePath_AutoClear.Checked;
  194. configParams.DefectRepairImag.AutoDeleteDays = (double)numDefect_Compress_SavePath_AutoClear.Value;
  195. configParams.SizeNGImag.SavePath = tbSizeBmpCompareSavePath.Text;
  196. configParams.SizeNGImag.AutoDelete = chkSizeBmp_Compare_SavePath_AutoClear.Checked;
  197. configParams.SizeNGImag.AutoDeleteDays = (double)numSizeBmp_Compare_SavePath_AutoClear.Value;
  198. configParams.SizeRepairImag.SavePath = tbSizeBmpZoomImageSavePath.Text;
  199. configParams.SizeRepairImag.AutoDelete = chkSizeBmp_Zoom_Image_SavePath_AutoClear.Checked;
  200. configParams.SizeRepairImag.AutoDeleteDays = (double)numSizeBmp_Zoom_Image_SavePath_AutoClear.Value;
  201. configParams.DisableX2 = chkSkipAxis1.Checked;
  202. configParams.DisableY = chkSkipAxis2.Checked;
  203. configParams.DisableZ = chkSkipAxis3.Checked;
  204. configParams.DisableLight = chkSkipLight.Checked;
  205. configParams.DisableBackCam = chkSkipScannerGL.Checked;
  206. configParams.ImageProcessPath = tbSizeEnginePath.Text;
  207. configParams.ImageProcessDataPath = tbMatDataPath.Text;
  208. configParams.AIModelPath = tbModelPath.Text;
  209. configParams.ProductPath = tbPdtPath.Text;
  210. configParams.HttpServerIP = tbLocalIp.Text;
  211. configParams.HttpServerPort = (int)numHttpPort.Value;
  212. configParams.LogPath = tbLogPath.Text;
  213. configParams.AutoDeleteLog = ckbAutoClear.Checked;
  214. configParams.AutoDeleteLogData = (double)numLogDays.Value;
  215. configParams.ShowResetBtn = cbResetBtn.Checked;
  216. configParams.ShowBuzz = cbBuzzShow.Checked;
  217. configParams.ShowDoorAlm = cbDoorAlm.Checked;
  218. configParams.ShowDistribution = cbShowBtn.Checked;
  219. configParams.ShowSizeBtn = cbSizeEnabel.Checked;
  220. configParams.ShowDefectBtn = cbDefectEnable.Checked;
  221. configParams.DefectCamViewX = (double)numViewX.Value;
  222. configParams.DefectCamViewY = (double)numViewY.Value;
  223. configParams.EnableHttp = cbEnableHttp.Checked;
  224. configParams.HttpUrl = tbHttpUrl.Text;
  225. configParams.HttpTempPath = tbTempPath.Text;
  226. configParams.HttpReturnKey = tbKey.Text;
  227. configParams.HttpReturnValue = tbValue.Text;
  228. ////////////////////Print//////////////////////////
  229. configParams.EnableLabelPrint = this.cbOpenBarTenderPrint.Checked;
  230. if(this.cboPrinters.SelectedItem != null)
  231. configParams.LabelPrinterName = this.cboPrinters.SelectedItem.ToString();
  232. configParams.EnableExcelPrint = this.cbOpenExcelPrint.Checked;
  233. if (this.cboPrinters2.SelectedItem != null)
  234. configParams.ExcelPrinterName = this.cboPrinters2.SelectedItem.ToString();
  235. /////////////////////////////////////////////////
  236. ///////本地云端////////////////////////////
  237. configParams.OpenCloud = this.cbOpenCloud.Checked;
  238. configParams.CloudThisName = this.tbCloudName.Text;
  239. configParams.CloudServerIP = this.tbCloudIP.Text;
  240. configParams.CloudServerPort = (int)this.numCloudPort.Value;
  241. configParams.CloudUser = this.tbCloudUser.Text;
  242. configParams.CloudPassword = this.tbCloudPassword.Text;
  243. configParams.OpenPdtServer = this.cbOpenPdtServer.Checked;
  244. configParams.IsPdtServer = this.rbServer.Checked;
  245. configParams.PdtServerIP = this.tbPdtServerIP.Text;
  246. configParams.PdtServerPort = (int)this.numPdtServerPort.Value;
  247. ///////////////////////////////////////////
  248. ConfMgr.Instance.WriteSysConfParams(configParams);
  249. SysMgr.Instance.WriteSysEditLog("系统设置修改", JsonConvert.SerializeObject(configParams));
  250. }
  251. #endregion
  252. private void tbPath_Click(object sender, EventArgs e)
  253. {
  254. TextBox tb = (TextBox)sender;
  255. string path = ConfMgr.SelectFolder(Application.StartupPath);
  256. if (!string.IsNullOrWhiteSpace(path))
  257. {
  258. if(tb.Name == tbIOCfgPath.Name)
  259. this.tbIOCfgPath.Text = path;
  260. else if (tb.Name == tbMotionCfgPath.Name)
  261. this.tbMotionCfgPath.Text = path;
  262. else if (tb.Name == tbSizeEnginePath.Name)
  263. this.tbSizeEnginePath.Text = path;
  264. else if (tb.Name == tbMatDataPath.Name)
  265. this.tbMatDataPath.Text = path;
  266. else if (tb.Name == tbModelPath.Name)
  267. this.tbModelPath.Text = path;
  268. else if (tb.Name == tbPdtPath.Name)
  269. this.tbPdtPath.Text = path;
  270. else if (tb.Name == tbLogPath.Name)
  271. this.tbLogPath.Text = path;
  272. else if (tb.Name == tbDefectCompressSavePath.Name)
  273. this.tbDefectCompressSavePath.Text = path;
  274. else if (tb.Name == tbDefectPath.Name)
  275. this.tbDefectPath.Text = path;
  276. else if (tb.Name == tbDefectSmallPath.Name)
  277. this.tbDefectSmallPath.Text = path;
  278. else if (tb.Name == tbDefectSrcSmallPath.Name)
  279. this.tbDefectSrcSmallPath.Text = path;
  280. else if (tb.Name == tbSizeBmpCompareSavePath.Name)
  281. this.tbSizeBmpCompareSavePath.Text = path;
  282. else if (tb.Name == tbSizeBmpZoomImageSavePath.Name)
  283. this.tbSizeBmpZoomImageSavePath.Text = path;
  284. }
  285. }
  286. private void btnClearPathClick(object sender, EventArgs e)
  287. {
  288. PictureBox pb = (PictureBox)sender;
  289. string path = "";
  290. if (pb.Name == btnClearDefect_Compress_SavePath.Name)
  291. this.tbDefectCompressSavePath.Text = path;
  292. else if (pb.Name == btnClearDefect_Path.Name)
  293. this.tbDefectPath.Text = path;
  294. else if (pb.Name == btnClearDefect_Small_Path.Name)
  295. this.tbDefectSmallPath.Text = path;
  296. else if (pb.Name == btnClearSizeBmp_Compare_SavePath.Name)
  297. this.tbSizeBmpCompareSavePath.Text = path;
  298. else if (pb.Name == btnSizeBmp_Zoom_Image_SavePath.Name)
  299. this.tbSizeBmpZoomImageSavePath.Text = path;
  300. else if (pb.Name == btnClearDefect_SrcSmall_Path.Name)
  301. this.tbDefectSrcSmallPath.Text = path;
  302. }
  303. private void tsbtnDatSave_Click(object sender, EventArgs e)
  304. {
  305. try
  306. {
  307. string lsPath = ConfMgr.SelectFolder();
  308. if (string.IsNullOrWhiteSpace(lsPath))
  309. return;
  310. //lsPath += "\\DB" + DateTime.Now.ToString("yyyyMMddHHmm") + ".bak";
  311. lsPath += "\\backup_" + DateTime.Now.ToString("yyyyMMddHHmm") + ".sql";
  312. Service.InitDB.BackupDataBase(lsPath);
  313. MessageBox.Show("备份成功!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
  314. }
  315. catch (Exception ex)
  316. {
  317. MessageBox.Show(ex.Message, "失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
  318. }
  319. }
  320. private void tsbtnDatImport_Click(object sender, EventArgs e)
  321. {
  322. try
  323. {
  324. string dbPath = ConfMgr.SelectFile();
  325. if (string.IsNullOrWhiteSpace(dbPath))
  326. return;
  327. if (MessageBox.Show($"是否导入{dbPath}?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
  328. {
  329. bool rel = Service.InitDB.RestoreDB(dbPath);
  330. if (rel)
  331. {
  332. MessageBox.Show("导入成功!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
  333. }
  334. else
  335. MessageBox.Show("导入失败!", "失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
  336. }
  337. }
  338. catch (Exception ex)
  339. {
  340. MessageBox.Show(ex.Message, "失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
  341. }
  342. }
  343. private void tbPathFile_Click(object sender, EventArgs e)
  344. {
  345. TextBox tb = (TextBox)sender;
  346. string path = ConfMgr.SelectFile("所有文件|*.*", Application.StartupPath);
  347. if (!string.IsNullOrWhiteSpace(path))
  348. {
  349. if (tb.Name == tbIOCfgPath.Name)
  350. this.tbIOCfgPath.Text = path;
  351. else if (tb.Name == tbMotionCfgPath.Name)
  352. this.tbMotionCfgPath.Text = path;
  353. else if (tb.Name == tbCamCfgPath2.Name)
  354. this.tbCamCfgPath2.Text = path;
  355. else if (tb.Name == tbMatDataPath.Name)
  356. this.tbMatDataPath.Text = path;
  357. }
  358. }
  359. #region 打印测试
  360. private void btnPrint_Click(object sender, EventArgs e)
  361. {
  362. //Button btn = (Button)sender;
  363. //bool ret = true;
  364. //if (btn.Name == "btnPrint")
  365. //{
  366. // ret = SysMgr.Instance.PrintFileData(PrinterType.Label, cboPrinters.SelectedItem.ToString(), "", null, null);
  367. //}
  368. //else
  369. //{
  370. // ret = SysMgr.Instance.PrintFileData(PrinterType.Excel, cboPrinters2.SelectedItem.ToString(), "", null, null);
  371. //}
  372. //if (ret)
  373. //{
  374. // MessageBox.Show("打印任务发生成功!", "提示");
  375. //}
  376. //else
  377. // MessageBox.Show("打印任务发生失败!", "提示");
  378. }
  379. #endregion
  380. private void tbBarTenderTempPath_DoubleClick(object sender, EventArgs e)
  381. {
  382. TextBox bt = (TextBox)sender;
  383. OpenFileDialog openFileDialog1 = new OpenFileDialog();
  384. DialogResult result = openFileDialog1.ShowDialog();
  385. if (result == DialogResult.OK)
  386. {
  387. bt.Text = openFileDialog1.FileName;
  388. }
  389. }
  390. private void tbTempPath_DoubleClick(object sender, EventArgs e)
  391. {
  392. TextBox bt = (TextBox)sender;
  393. OpenFileDialog openFileDialog1 = new OpenFileDialog();
  394. DialogResult result = openFileDialog1.ShowDialog();
  395. if (result == DialogResult.OK)
  396. {
  397. bt.Text = openFileDialog1.FileName;
  398. }
  399. }
  400. }
  401. }