版博士V2.0程序
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

1583 行
65 KiB

  1. using CCWin.SkinClass;
  2. using MaiMuControl.SysStatusMgr.UserMgr;
  3. using Models;
  4. using Newtonsoft.Json;
  5. using Newtonsoft.Json.Linq;
  6. using System;
  7. using System.Collections;
  8. using System.Collections.Generic;
  9. using System.Drawing;
  10. using System.IO;
  11. using System.Linq;
  12. using System.Text;
  13. using System.Threading.Tasks;
  14. using System.Windows.Forms;
  15. using ToolKits.Ini;
  16. using ToolKits.mAPI;
  17. using ToolKits.PLC;
  18. namespace MaiMuAOI.SysCtrl
  19. {
  20. #region 参数类型
  21. /// <summary>
  22. /// 图片保存参数
  23. /// </summary>
  24. [Serializable]
  25. public class ImageSaveParam
  26. {
  27. /// <summary>
  28. /// 保存路径
  29. /// </summary>
  30. public string SavePath { get; set; }
  31. /// <summary>
  32. /// 自动保存
  33. /// </summary>
  34. public bool AutoSave { get; set; }
  35. /// <summary>
  36. /// 自动删除
  37. /// </summary>
  38. public bool AutoDelete { get; set; }
  39. /// <summary>
  40. /// 自动删除日期
  41. /// </summary>
  42. public double AutoDeleteDays { get; set; }
  43. public ImageSaveParam() {
  44. SavePath = "D:\\AllImageSave";
  45. AutoSave = true;
  46. AutoDelete = true;
  47. AutoDeleteDays = 3;
  48. }
  49. public ImageSaveParam(string path)
  50. {
  51. SavePath = path;
  52. AutoSave = true;
  53. AutoDelete = true;
  54. AutoDeleteDays = 3;
  55. }
  56. }
  57. /// <summary>
  58. /// 镜头对应Z轴高度
  59. /// </summary>
  60. [Serializable]
  61. public class LensAxisZ
  62. {
  63. public double Z_0_58X { get; set; }
  64. //public double Z_0_6X { get; set; }
  65. public double Z_1_0X { get; set; }
  66. public double Z_1_5X { get; set; }
  67. public double Z_2_0X { get; set; }
  68. public double Z_2_5X { get; set; }
  69. public double Z_3_0X { get; set; }
  70. public double Z_3_5X { get; set; }
  71. public double Z_4_0X { get; set; }
  72. public double Z_4_5X { get; set; }
  73. public double Z_5_0X { get; set; }
  74. public double Z_5_5X { get; set; }
  75. public double Z_6_0X { get; set; }
  76. public double Z_6_5X { get; set; }
  77. public double Z_7_0X { get; set; }
  78. public double Z_7_5X { get; set; }
  79. public LensAxisZ()
  80. {
  81. Z_0_58X = 0;
  82. //Z_0_6X = 0;
  83. Z_1_0X = 0;
  84. Z_1_5X = 0;
  85. Z_2_0X = 0;
  86. Z_2_5X = 0;
  87. Z_3_0X = 0;
  88. Z_3_5X = 0;
  89. Z_4_0X = 0;
  90. Z_4_5X = 0;
  91. Z_5_0X = 0;
  92. Z_5_5X = 0;
  93. Z_6_0X = 0;
  94. Z_6_5X = 0;
  95. Z_7_0X = 0;
  96. Z_7_5X = 0;
  97. }
  98. }
  99. [Serializable]
  100. public class SysConfigParams
  101. {
  102. #region 缺陷图
  103. public string Defect_SrcSmall_SavePath { get; set; }
  104. public double Defect_SrcSmall_Thres { get; set; }
  105. /// <summary>
  106. /// 保存所有图片
  107. /// </summary>
  108. public bool SaveAllImg { get; set; }
  109. /// <summary>
  110. /// 缺陷大图
  111. /// </summary>
  112. public ImageSaveParam DefectBigImag { get; set; }
  113. /// <summary>
  114. /// 缺陷原始小图
  115. /// </summary>
  116. public ImageSaveParam DefectSrcSmallImag { get; set; }
  117. /// <summary>
  118. /// 缺陷小图
  119. /// </summary>
  120. public ImageSaveParam DefectSmallImag { get; set; }
  121. /// <summary>
  122. /// 修复台 缺陷图
  123. /// </summary>
  124. public ImageSaveParam DefectRepairImag { get; set; }
  125. /// <summary>
  126. /// 对比大图
  127. /// </summary>
  128. public ImageSaveParam SizeBigImag { get; set; }
  129. /// <summary>
  130. /// 对比未通过
  131. /// </summary>
  132. public ImageSaveParam SizeNGImag { get; set; }
  133. /// <summary>
  134. /// 修复台 对比图
  135. /// </summary>
  136. public ImageSaveParam SizeRepairImag { get; set; }
  137. #endregion
  138. #region 功能
  139. /// <summary>
  140. /// mark报警暂停
  141. /// </summary>
  142. public bool OpenMarkErrorStop { get; set; }
  143. /// <summary>
  144. /// 开启蜂鸣器
  145. /// </summary>
  146. public bool OpenBuzzer { get; set; }
  147. /// <summary>
  148. /// 开启门磁
  149. /// </summary>
  150. public bool OpenDoor { get; set; }
  151. /// <summary>
  152. /// 开启http日志
  153. /// </summary>
  154. public bool OpenHttpLog { get; set; }
  155. /// <summary>
  156. /// 开启软件开启自动回原
  157. /// </summary>
  158. public bool OpenAutoGoHome { get; set; }
  159. /// <summary>
  160. /// 启用缺陷分布功能
  161. /// </summary>
  162. public bool OpenFlawDistribution { get; set; }
  163. /// <summary>
  164. /// 启用X轴校准 2023-12-20
  165. /// </summary>
  166. public bool OpenAxisXCalibration { get; set; }
  167. /// <summary>
  168. /// 产品有无信号关闭
  169. /// </summary>
  170. public bool OpenPdtIsHave { get; set; }
  171. /// <summary>
  172. /// 开启查看功能
  173. /// </summary>
  174. public bool OpenDefectSanp { get; set; }
  175. /// <summary>
  176. /// 开启单边目数计算
  177. /// </summary>
  178. public bool OpenAsideDefect{ get; set; }
  179. /// <summary>
  180. /// 开启工单确认
  181. /// </summary>
  182. public bool OpenOredrCheck { get; set; }
  183. /// <summary>
  184. /// 开启工单数量确认
  185. /// </summary>
  186. public bool OpenOredrCntCheck { get; set; }
  187. #endregion
  188. #region 硬件传感器通信
  189. /// <summary>
  190. /// 光源串口
  191. /// </summary>
  192. //public LightParams LightCfg { get; set; }
  193. public string LightCom { get; set; }
  194. /// <summary>
  195. /// 光源波特率
  196. /// </summary>
  197. public int LightComBaud { get; set; }
  198. /// <summary>
  199. /// 张力传感器串口
  200. /// </summary>
  201. public string TensionCom { get; set; }
  202. /// <summary>
  203. /// 张力传感器波特率
  204. /// </summary>
  205. public int TensionComBaud { get; set; }
  206. /// <summary>
  207. /// 张力偏移值
  208. /// </summary>
  209. public double Tension_Offset = 0;
  210. /// <summary>
  211. /// 镜头电机串口
  212. /// </summary>
  213. public string LensMotorCom { get; set; }
  214. /// <summary>
  215. /// 镜头电机波特率
  216. /// </summary>
  217. public int LensMotorComBaud { get; set; }
  218. /// <summary>
  219. /// 厚度传感器IP
  220. /// </summary>
  221. public string ThicknessIP { get; set; }
  222. /// <summary>
  223. /// 厚度传感器port
  224. /// </summary>
  225. public int ThicknessPort { get; set; }
  226. /// <summary>
  227. /// 测厚安全值
  228. /// </summary>
  229. public double ThicknessSafeValue { get; set; }
  230. /// <summary>
  231. /// 测厚调试偏移值
  232. /// </summary>
  233. public double Thickness_Offset = 0;
  234. #endregion
  235. #region IO/电机/相机
  236. /// <summary>
  237. /// IO驱动名称
  238. /// </summary>
  239. //public IOParams IOCfg { get; set; }
  240. public string IODevName { get; set; }
  241. /// <summary>
  242. /// IO配置文件路径
  243. /// </summary>
  244. public string IOCfgPath { get; set; }
  245. /// <summary>
  246. /// 电机配置文件路径
  247. /// </summary>
  248. public string MotionCfgPath { get; set; }
  249. /// <summary>
  250. /// 前部相机名称
  251. /// </summary>
  252. public string FrontCamName { get; set; }
  253. /// <summary>
  254. /// 前部相机配置文件路径
  255. /// </summary>
  256. public string FrontCamCfgPath { get; set; }
  257. /// <summary>
  258. /// 后部相机名称
  259. /// </summary>
  260. public string BackCamName { get; set; }
  261. /// <summary>
  262. /// 后部相机配置文件路径
  263. /// </summary>
  264. public string BackCamCfgPath { get; set; }
  265. #endregion
  266. #region 禁用
  267. public bool DisableX1 { get; set; }
  268. public bool DisableX2 { get; set; }
  269. public bool DisableY { get; set; }
  270. public bool DisableZ { get; set; }
  271. public bool DisableFrontCam { get; set; }
  272. public bool DisableBackCam { get; set; }
  273. public bool DisableLight { get; set; }
  274. public bool DisableTensor { get; set; }
  275. public bool DisableThickness { get; set; }
  276. public bool DisableLensMotor { get; set; }
  277. #endregion
  278. #region 系统
  279. public string ImageProcessPath { get; set; }
  280. public string ImageProcessDataPath { get; set; }
  281. public string AIModelPath { get; set; }
  282. public string ProductPath { get; set; }
  283. public string HttpServerIP { get; set; }
  284. public int HttpServerPort { get; set; }
  285. public string LogPath { get; set; }
  286. public bool AutoDeleteLog { get; set; }
  287. public double AutoDeleteLogData { get; set; }
  288. /// <summary>
  289. /// 调试:主界面显示复位按钮
  290. /// </summary>
  291. public bool ShowResetBtn { get; set; }
  292. /// <summary>
  293. /// 调试:主界面显示蜂鸣器控制
  294. /// </summary>
  295. public bool ShowBuzz { get; set; }
  296. /// <summary>
  297. /// 调试:主界面显示门磁报警控制
  298. /// </summary>
  299. public bool ShowDoorAlm { get; set; }
  300. /// <summary>
  301. /// 调试:显示分布
  302. /// </summary>
  303. public bool ShowDistribution { get; set; }
  304. /// <summary>
  305. /// 调试:显示尺寸检测禁用和启用
  306. /// </summary>
  307. public bool ShowSizeBtn { get; set; }
  308. /// <summary>
  309. /// 调试:显示缺陷检测禁用和启用
  310. /// </summary>
  311. public bool ShowDefectBtn { get; set; }
  312. /// <summary>
  313. /// 后部相机视野X
  314. /// </summary>
  315. public double DefectCamViewX { get; set; }
  316. /// <summary>
  317. /// 后部相机视野Y
  318. /// </summary>
  319. public double DefectCamViewY { get; set; }
  320. #endregion
  321. #region Http/MES
  322. /// <summary>
  323. /// 开启http上传
  324. /// </summary>
  325. public bool EnableHttp { get; set; }
  326. /// <summary>
  327. /// 上传Http地址
  328. /// </summary>
  329. public string HttpUrl { get; set; }
  330. /// <summary>
  331. /// 上传Json模板路径
  332. /// </summary>
  333. public string HttpTempPath { get; set; }
  334. /// <summary>
  335. /// 返回值Key
  336. /// </summary>
  337. public string HttpReturnKey{ get; set; }
  338. /// <summary>
  339. /// 返回成功value
  340. /// </summary>
  341. public string HttpReturnValue { get; set; }
  342. #endregion
  343. #region MQTT本地云/产品服务器
  344. /// <summary>
  345. /// 开启局域网云端
  346. /// </summary>
  347. public bool OpenCloud { get; set; }
  348. public string CloudThisName { get; set; }
  349. public string CloudServerIP { get; set; }
  350. public int CloudServerPort { get; set; }
  351. public string CloudUser { get; set; }
  352. public string CloudPassword { get; set; }
  353. /// <summary>
  354. /// 开启产品转发
  355. /// </summary>
  356. public bool OpenPdtServer { get; set; }
  357. public string PdtServerIP { get; set; }
  358. public int PdtServerPort { get; set; }
  359. /// <summary>
  360. /// 是否作为服务器还是客户端
  361. /// </summary>
  362. public bool IsPdtServer { get; set; }
  363. #endregion
  364. #region 聚焦
  365. /// <summary>
  366. /// 聚焦对应Z轴位置
  367. /// </summary>
  368. public LensAxisZ LensAxisZPos { get; set; }
  369. #endregion
  370. #region 缺陷分割
  371. //缺陷配置
  372. public Size Defect_CutSize { get; set; }
  373. public Size Defect_ReSize { get; set; }
  374. public float Defect_Thresholds { get; set; }
  375. #endregion
  376. #region BarTender
  377. /// <summary>
  378. /// 开启标签打印
  379. /// </summary>
  380. public bool EnableLabelPrint { get; set; }
  381. /// <summary>
  382. /// 打印机名称
  383. /// </summary>
  384. public string LabelPrinterName { get; set; }
  385. /// <summary>
  386. /// 打印模板路径
  387. /// </summary>
  388. public string LabelTempPath { get; set; }
  389. /// <summary>
  390. /// 打印信息
  391. /// </summary>
  392. public Dictionary<string, string> LabelData { get; set; }
  393. #endregion
  394. #region Excel
  395. /// <summary>
  396. /// 开启Excel打印
  397. /// </summary>
  398. public bool EnableExcelPrint { get; set; }
  399. /// <summary>
  400. /// 打印机名称
  401. /// </summary>
  402. public string ExcelPrinterName { get; set; }
  403. /// <summary>
  404. /// 打印模板路径
  405. /// </summary>
  406. public string ExcelTempPath { get; set; }
  407. /// <summary>
  408. /// 打印信息
  409. /// </summary>
  410. public Dictionary<string, string> ExcelData { get; set; }
  411. #endregion
  412. #region 老流程PT线宽补偿
  413. public double Pt_offset { get; set; }
  414. public double Line_offset { get; set; }
  415. #endregion
  416. #region 左上角比例调整
  417. public double X_per{ get; set; }
  418. public double Y_per { get; set; }
  419. #endregion
  420. #region 缺陷查看
  421. public int LightCH { get; set; }
  422. public int LightLut { get; set; }
  423. public int CamExposureTime { get; set; }
  424. #endregion
  425. #region 其他
  426. /// <summary>
  427. /// 光源通道
  428. /// </summary>
  429. public int LightChannelCnt { get; set; }
  430. /// <summary>
  431. /// 客户名称,不同客户可能存在差异
  432. /// </summary>
  433. public string CustomerName { get; set; }
  434. #endregion
  435. public SysConfigParams()
  436. {
  437. DefectBigImag = new ImageSaveParam("D:\\AllImageSave\\DefectBigImag");
  438. DefectSrcSmallImag = new ImageSaveParam("D:\\AllImageSave\\DefectSrcSmallImag");
  439. DefectSmallImag = new ImageSaveParam("D:\\AllImageSave\\DefectSmallImag");
  440. DefectRepairImag = new ImageSaveParam("D:\\AllImageSave\\DefectRepairImag");
  441. SizeBigImag = new ImageSaveParam("D:\\AllImageSave\\SizeBigImag");
  442. SizeNGImag = new ImageSaveParam("D:\\AllImageSave\\SizeNGImag");
  443. SizeRepairImag = new ImageSaveParam("D:\\AllImageSave\\SizeRepairImag");
  444. OpenMarkErrorStop = true;
  445. OpenBuzzer = true;
  446. OpenDoor = true;
  447. OpenHttpLog = false;
  448. OpenPdtIsHave = true;
  449. OpenDefectSanp = false;
  450. OpenAsideDefect = true;
  451. OpenOredrCheck = false;
  452. OpenOredrCntCheck = false;
  453. //LightCfg = new LightParams();
  454. //IOCfg = new IOParams();
  455. IODevName = "";
  456. IOCfgPath = Path.Combine(Directory.GetCurrentDirectory(), "ConfigFiles\\IOCard_default.xml"); ;
  457. LightCom = "";
  458. LightComBaud = 9600;
  459. LensMotorCom = "";
  460. LensMotorComBaud = 9600;
  461. TensionCom = "";
  462. TensionComBaud = 2400;
  463. ThicknessIP = "192.168.3.35";
  464. ThicknessPort = 8888;
  465. ThicknessSafeValue = 10;
  466. FrontCamCfgPath = "";
  467. BackCamCfgPath = "";
  468. MotionCfgPath = Path.Combine(Directory.GetCurrentDirectory(), "ConfigFiles\\Axis_default.cfg"); ;
  469. SaveAllImg = false;
  470. DisableX1 = false;
  471. DisableX2 = false;
  472. DisableY = false;
  473. DisableZ = false;
  474. DisableFrontCam = false;
  475. DisableBackCam = false;
  476. DisableLight = false;
  477. DisableLensMotor = false;
  478. DisableTensor = false;
  479. DisableThickness = false;
  480. ImageProcessPath = "C:\\Users\\user\\AppData\\Local\\Programs\\MVTec\\HALCON-21.05-Progress\\procedures\\general";
  481. ImageProcessDataPath = "C:\\Users\\PC\\AppData\\Local\\Programs\\MVTec\\HALCON-21.05-Progress\\procedures\\User_Data\\HomMat2D1M2CCDpose";
  482. AIModelPath = Path.Combine(Directory.GetCurrentDirectory(), "ConfigFiles\\onnxFiles");
  483. ProductPath = Path.Combine(Directory.GetCurrentDirectory(), "ConfigFiles\\Project");
  484. HttpServerIP = "127.0.0.1";
  485. HttpServerPort = 18082;
  486. LogPath = Path.Combine(Directory.GetCurrentDirectory(), "LogFiles");
  487. AutoDeleteLog = false;
  488. AutoDeleteLogData = 0;
  489. ShowResetBtn = true;
  490. ShowBuzz = false;
  491. ShowDoorAlm = false;
  492. ShowDistribution = false;
  493. ShowSizeBtn = false;
  494. ShowDefectBtn = false;
  495. DefectCamViewX = 35.5;
  496. DefectCamViewY = 26.5;
  497. EnableHttp = false;
  498. HttpUrl = "";
  499. HttpTempPath = "";
  500. HttpReturnKey = "";
  501. HttpReturnValue = "";
  502. LensAxisZPos = new LensAxisZ();
  503. //缺陷配置
  504. Defect_CutSize = new Size(592, 532);
  505. Defect_ReSize = new Size(224, 224);
  506. Defect_Thresholds = 0.4f;
  507. EnableLabelPrint = false;
  508. LabelPrinterName = "";
  509. LabelTempPath = "";
  510. LabelData = new Dictionary<string, string>();
  511. EnableExcelPrint = false;
  512. ExcelPrinterName = "";
  513. ExcelTempPath = "";
  514. ExcelData = new Dictionary<string, string>();
  515. OpenCloud = false;
  516. CloudThisName = "Test";
  517. CloudServerIP = "127.0.0.1";
  518. CloudServerPort = 1883;
  519. CloudUser = "";
  520. CloudPassword = "";
  521. OpenPdtServer = false;
  522. PdtServerIP = "127.0.0.1";
  523. PdtServerPort = 10573;
  524. IsPdtServer = true;
  525. Pt_offset = 0;
  526. Line_offset = 0;
  527. X_per = 0.1;
  528. Y_per = 0.1;
  529. LightCH = 2;
  530. LightLut = 255;
  531. CamExposureTime = 8000;
  532. LightChannelCnt = 4;
  533. CustomerName = "";
  534. }
  535. }
  536. #endregion
  537. #region 尺寸检测参数
  538. public class SizeItemParam
  539. {
  540. /// <summary>
  541. /// 名称
  542. /// </summary>
  543. public string Name { get; set; }
  544. /// <summary>
  545. /// 代码
  546. /// </summary>
  547. public string Code { get; set; }
  548. /// <summary>
  549. /// 测试点数
  550. /// </summary>
  551. public int PointCnt { get; set; }
  552. /// <summary>
  553. /// 处理代码
  554. /// </summary>
  555. public int[] DefectIndex { get; set; }
  556. /// <summary>
  557. /// RGB颜色代码
  558. /// </summary>
  559. public int[] RGBcolor { get; set; }
  560. }
  561. #endregion
  562. #region 缺陷检测参数
  563. public class DefectItemParam
  564. {
  565. /// <summary>
  566. /// 名称
  567. /// </summary>
  568. public string Name { get; set; }
  569. /// <summary>
  570. /// 代码
  571. /// </summary>
  572. public string Code { get; set; }
  573. /// <summary>
  574. /// 序号
  575. /// </summary>
  576. public int Index { get; set; }
  577. /// <summary>
  578. /// 默认分值
  579. /// </summary>
  580. public double Threshold { get; set; }
  581. /// <summary>
  582. /// RGB颜色代码
  583. /// </summary>
  584. public int[] RGBcolor { get; set; }
  585. /// <summary>
  586. /// 对应类型
  587. /// </summary>
  588. public string Type { get; set; }
  589. /// <summary>
  590. /// 尺寸
  591. /// </summary>
  592. public float Size { get; set; }
  593. /// <summary>
  594. /// 最大允许缺陷数量
  595. /// </summary>
  596. public int MaxDefectCount { get; set; }
  597. /// <summary>
  598. /// 显示
  599. /// </summary>
  600. public int Show { get; set; }
  601. }
  602. #endregion
  603. /// <summary>
  604. /// 设备参数
  605. /// </summary>
  606. public class ConfMgr
  607. {
  608. #region 实例化
  609. /// <summary>
  610. /// 实例
  611. /// </summary>
  612. private static ConfMgr _instance;
  613. private static readonly object _lock = new object();
  614. public static ConfMgr Instance
  615. {
  616. get
  617. {
  618. if (_instance == null)
  619. {
  620. lock (_lock)
  621. {
  622. if (_instance == null)
  623. {
  624. _instance = new ConfMgr();
  625. }
  626. }
  627. }
  628. return _instance;
  629. }
  630. }
  631. #endregion
  632. #region 私有字段
  633. private readonly string _rootPath;
  634. private readonly string _configFile;
  635. private readonly string _projectDir;
  636. private readonly string _pointsPath;
  637. private readonly string _markPicPath;
  638. private readonly string _sizeItemsPath;
  639. private readonly string _defectItemsPath;
  640. #endregion
  641. private ConfMgr()
  642. {
  643. _rootPath = Path.Combine(Directory.GetCurrentDirectory(), "ConfigFiles");
  644. _configFile = Path.Combine(_rootPath, "SysParamsConfig.ini");
  645. _devConfigPath = Path.Combine(_rootPath, "DevParamsConfig.ini");
  646. _projectDir = Path.Combine(_rootPath, "Project");
  647. _pointsPath = Path.Combine(_rootPath, "PointsConfig.ini");
  648. _markPicPath = Path.Combine(_rootPath, "MarkPic");
  649. _specificationPath = Path.Combine(_rootPath, "版博士软件操作说明.docx");
  650. _sizeItemsPath = Path.Combine(_rootPath, "尺寸测试项.json");
  651. _defectItemsPath = Path.Combine(_rootPath, "缺陷测试项.json");
  652. DBConStr = "server = localhost; Database = ProductionDB; Uid = root; Pwd = " + ConteolUserDB.GetSqlDBCode() + "; AllowLoadLocalInfile = true;";
  653. }
  654. #region 公开字段
  655. //DB
  656. //有些服务器防火墙有问题需要加上 min pool size=1 避免认为是恶意请求
  657. //如果用到bulkCopy需要加: AllowLoadLocalInfile=true
  658. //public static string dbMysqlCon = "server=localhost;Database=ProductionDB;Uid=root;Pwd=123456;";
  659. public string DBConStr = "server=localhost;Database=ProductionDB;Uid=root;Pwd=123456; AllowLoadLocalInfile=true";
  660. /// <summary>
  661. /// 系统配置参数
  662. /// </summary>
  663. public SysConfigParams SysConfigParams { get; set; }
  664. private string _devConfigPath;
  665. /// <summary>
  666. /// 获取驱动配制文件路径
  667. /// </summary>
  668. public string DevConfigPath { get { return _devConfigPath; } }
  669. //public string ProjectDir { get { return _projectDir; } }
  670. public string ProjectDir { get { return SysConfigParams.ProductPath; } }
  671. public string MarkPicPath { get { return _markPicPath; } }
  672. /// <summary>
  673. /// 说明书路径
  674. /// </summary>
  675. public string SpecificationPath { get { return _specificationPath; } }
  676. private string _specificationPath;
  677. /// <summary>
  678. /// 上料位X1
  679. /// </summary>
  680. public double LoadPoint_X1 { get; set; }
  681. /// <summary>
  682. /// 上料位X2
  683. /// </summary>
  684. public double LoadPoint_X2 { get; set; }
  685. /// <summary>
  686. /// 上料位Y
  687. /// </summary>
  688. public double LoadPoint_Y { get; set; }
  689. /// <summary>
  690. /// 上料位Z
  691. /// </summary>
  692. public double LoadPoint_Z { get; set; }
  693. /// <summary>
  694. /// 测厚气缸到位等待时间
  695. /// </summary>
  696. public int HeightDoWait { get; set; }
  697. /// <summary>
  698. /// 加紧气缸到位等待时间
  699. /// </summary>
  700. public int ProductDoWait { get; set; }
  701. #endregion
  702. #region 公开文件操作
  703. #region 点位配置
  704. public void WritePointsAndTime(double x1, double x2, double y, double z, int ht, int pt)
  705. {
  706. //XmlHelper.Serialize<SysConfParams>(_configFile, sysConfParams);
  707. IniHelper iniHelper = new IniHelper(_pointsPath);
  708. iniHelper.WriteDouble("LoadPoint", "X1", x1);
  709. iniHelper.WriteDouble("LoadPoint", "X2", x2);
  710. iniHelper.WriteDouble("LoadPoint", "Y", y);
  711. iniHelper.WriteDouble("LoadPoint", "Z", z);
  712. iniHelper.WriteInteger("WaitTime", "HeightDoWait", ht);
  713. iniHelper.WriteInteger("WaitTime", "ProductDoWait", pt);
  714. LoadPoint_X1 = x1;
  715. LoadPoint_X2 = x2;
  716. LoadPoint_Y = y;
  717. LoadPoint_Z = z;
  718. HeightDoWait = ht;
  719. ProductDoWait = pt;
  720. }
  721. public void ReadPointsAndTime()
  722. {
  723. IniHelper iniHelper = new IniHelper(_pointsPath);
  724. double dValue = 0;
  725. int iValue = 0;
  726. iniHelper.ReadDouble("LoadPoint", "X1", out dValue);
  727. LoadPoint_X1 = dValue;
  728. iniHelper.ReadDouble("LoadPoint", "X2", out dValue);
  729. LoadPoint_X2 = dValue;
  730. iniHelper.ReadDouble("LoadPoint", "Y", out dValue);
  731. LoadPoint_Y = dValue;
  732. iniHelper.ReadDouble("LoadPoint", "Z", out dValue);
  733. LoadPoint_Z = dValue;
  734. iniHelper.ReadInteger("WaitTime", "HeightDoWait", out iValue);
  735. HeightDoWait = iValue;
  736. iniHelper.ReadInteger("WaitTime", "ProductDoWait", out iValue);
  737. ProductDoWait = iValue;
  738. }
  739. #endregion
  740. #region 系统配置参数
  741. /// <summary>
  742. /// 写入ini
  743. /// </summary>
  744. /// <param name="SocketParams"></param>
  745. public void WriteSysConfParams(SysConfigParams SysParams)
  746. {
  747. //XmlHelper.Serialize<SysConfParams>(_configFile, sysConfParams);
  748. IniHelper iniHelper = new IniHelper(_configFile);
  749. iniHelper.WriteString("DefectSrcSmallImag", "Defect_SrcSmall_SavePath", SysParams.Defect_SrcSmall_SavePath);
  750. iniHelper.WriteDouble("DefectSrcSmallImag", "Defect_SrcSmall_Thres", SysParams.Defect_SrcSmall_Thres);
  751. iniHelper.WriteBool("SaveAllImg", "SaveAllImg", SysParams.SaveAllImg);
  752. iniHelper.WriteString("DefectBigImag", "SavePath", SysParams.DefectBigImag.SavePath);
  753. iniHelper.WriteBool("DefectBigImag", "AutoSave", SysParams.DefectBigImag.AutoSave);
  754. iniHelper.WriteBool("DefectBigImag", "AutoDelete", SysParams.DefectBigImag.AutoDelete);
  755. iniHelper.WriteDouble("DefectBigImag", "AutoDeleteDays", SysParams.DefectBigImag.AutoDeleteDays);
  756. iniHelper.WriteString("DefectSrcSmallImag", "SavePath", SysParams.DefectSrcSmallImag.SavePath);
  757. iniHelper.WriteBool("DefectSrcSmallImag", "AutoSave", SysParams.DefectSrcSmallImag.AutoSave);
  758. iniHelper.WriteBool("DefectSrcSmallImag", "AutoDelete", SysParams.DefectSrcSmallImag.AutoDelete);
  759. iniHelper.WriteDouble("DefectSrcSmallImag", "AutoDeleteDays", SysParams.DefectSrcSmallImag.AutoDeleteDays);
  760. iniHelper.WriteString("DefectSmallImag", "SavePath", SysParams.DefectSmallImag.SavePath);
  761. iniHelper.WriteBool("DefectSmallImag", "AutoSave", SysParams.DefectSmallImag.AutoSave);
  762. iniHelper.WriteBool("DefectSmallImag", "AutoDelete", SysParams.DefectSmallImag.AutoDelete);
  763. iniHelper.WriteDouble("DefectSmallImag", "AutoDeleteDays", SysParams.DefectSmallImag.AutoDeleteDays);
  764. iniHelper.WriteString("DefectRepairImag", "SavePath", SysParams.DefectRepairImag.SavePath);
  765. iniHelper.WriteBool("DefectRepairImag", "AutoSave", SysParams.DefectRepairImag.AutoSave);
  766. iniHelper.WriteBool("DefectRepairImag", "AutoDelete", SysParams.DefectRepairImag.AutoDelete);
  767. iniHelper.WriteDouble("DefectRepairImag", "AutoDeleteDays", SysParams.DefectRepairImag.AutoDeleteDays);
  768. iniHelper.WriteString("SizeBigImag", "SavePath", SysParams.SizeBigImag.SavePath);
  769. iniHelper.WriteBool("SizeBigImag", "AutoSave", SysParams.SizeBigImag.AutoSave);
  770. iniHelper.WriteBool("SizeBigImag", "AutoDelete", SysParams.SizeBigImag.AutoDelete);
  771. iniHelper.WriteDouble("SizeBigImag", "AutoDeleteDays", SysParams.SizeBigImag.AutoDeleteDays);
  772. iniHelper.WriteString("SizeNGImag", "SavePath", SysParams.SizeNGImag.SavePath);
  773. iniHelper.WriteBool("SizeNGImag", "AutoSave", SysParams.SizeNGImag.AutoSave);
  774. iniHelper.WriteBool("SizeNGImag", "AutoDelete", SysParams.SizeNGImag.AutoDelete);
  775. iniHelper.WriteDouble("SizeNGImag", "AutoDeleteDays", SysParams.SizeNGImag.AutoDeleteDays);
  776. iniHelper.WriteString("SizeRepairImag", "SavePath", SysParams.SizeRepairImag.SavePath);
  777. iniHelper.WriteBool("SizeRepairImag", "AutoSave", SysParams.SizeRepairImag.AutoSave);
  778. iniHelper.WriteBool("SizeRepairImag", "AutoDelete", SysParams.SizeRepairImag.AutoDelete);
  779. iniHelper.WriteDouble("SizeRepairImag", "AutoDeleteDays", SysParams.SizeRepairImag.AutoDeleteDays);
  780. iniHelper.WriteString("Log", "SavePath", SysParams.LogPath);
  781. iniHelper.WriteBool("Log", "AutoDelete", SysParams.AutoDeleteLog);
  782. iniHelper.WriteDouble("Log", "AutoDeleteDays", SysParams.AutoDeleteLogData);
  783. iniHelper.WriteBool("SysFunction", "OpenMarkErrorStop", SysParams.OpenMarkErrorStop);
  784. iniHelper.WriteBool("SysFunction", "OpenBuzzer", SysParams.OpenBuzzer);
  785. iniHelper.WriteBool("SysFunction", "OpenDoor", SysParams.OpenDoor);
  786. iniHelper.WriteBool("SysFunction", "OpenHttpLog", SysParams.OpenHttpLog);
  787. iniHelper.WriteBool("SysFunction", "OpenAutoGoHome", SysParams.OpenAutoGoHome);
  788. iniHelper.WriteBool("SysFunction", "OpenFlawDistribution", SysParams.OpenFlawDistribution);
  789. iniHelper.WriteBool("SysFunction", "OpenAxisXCalibration", SysParams.OpenAxisXCalibration);
  790. iniHelper.WriteBool("SysFunction", "OpenPdtIsHave", SysParams.OpenPdtIsHave);
  791. iniHelper.WriteBool("SysFunction", "OpenDefectSanp", SysParams.OpenDefectSanp);
  792. iniHelper.WriteBool("SysFunction", "OpenAsideDefect", SysParams.OpenAsideDefect);
  793. iniHelper.WriteBool("SysFunction", "OpenOredrCheck", SysParams.OpenOredrCheck);
  794. iniHelper.WriteBool("SysFunction", "OpenOredrCntCheck", SysParams.OpenOredrCntCheck);
  795. iniHelper.WriteString("Dev", "LightCom", SysParams.LightCom);
  796. iniHelper.WriteInteger("Dev", "LightComBaud", SysParams.LightComBaud);
  797. iniHelper.WriteString("Dev", "TensionCom", SysParams.TensionCom);
  798. iniHelper.WriteInteger("Dev", "TensionComBaud", SysParams.TensionComBaud);
  799. iniHelper.WriteDouble("Dev", "Tension_Offset", SysParams.Tension_Offset);
  800. iniHelper.WriteString("Dev", "LensMotorCom", SysParams.LensMotorCom);
  801. iniHelper.WriteInteger("Dev", "LensMotorComBaud", SysParams.LensMotorComBaud);
  802. iniHelper.WriteString("Dev", "ThicknessIP", SysParams.ThicknessIP);
  803. iniHelper.WriteInteger("Dev", "ThicknessPort", SysParams.ThicknessPort);
  804. iniHelper.WriteDouble("Dev", "ThicknessSafeValue", SysParams.ThicknessSafeValue);
  805. iniHelper.WriteDouble("Dev", "Thickness_Offset", SysParams.Thickness_Offset);
  806. iniHelper.WriteString("Dev", "IODevName", SysParams.IODevName);
  807. iniHelper.WriteString("Dev", "IOCfgPath", SysParams.IOCfgPath);
  808. iniHelper.WriteString("Dev", "MotionCfgPath", SysParams.MotionCfgPath);
  809. iniHelper.WriteString("Dev", "FrontCamName", SysParams.FrontCamName);
  810. iniHelper.WriteString("Dev", "FrontCamCfgPath", SysParams.FrontCamCfgPath);
  811. iniHelper.WriteString("Dev", "BackCamName", SysParams.BackCamName);
  812. iniHelper.WriteString("Dev", "BackCamCfgPath", SysParams.BackCamCfgPath);
  813. iniHelper.WriteBool("Disable", "DisableX1", SysParams.DisableX1);
  814. iniHelper.WriteBool("Disable", "DisableX2", SysParams.DisableX2);
  815. iniHelper.WriteBool("Disable", "DisableY", SysParams.DisableY);
  816. iniHelper.WriteBool("Disable", "DisableZ", SysParams.DisableZ);
  817. iniHelper.WriteBool("Disable", "DisableFrontCam", SysParams.DisableFrontCam);
  818. iniHelper.WriteBool("Disable", "DisableBackCam", SysParams.DisableBackCam);
  819. iniHelper.WriteBool("Disable", "DisableLight", SysParams.DisableLight);
  820. iniHelper.WriteBool("Disable", "DisableThickness", SysParams.DisableThickness);
  821. iniHelper.WriteBool("Disable", "DisableTensor", SysParams.DisableTensor);
  822. iniHelper.WriteBool("Disable", "DisableLensMotor", SysParams.DisableLensMotor);
  823. iniHelper.WriteString("Sys", "ImageProcessPath", SysParams.ImageProcessPath);
  824. iniHelper.WriteString("Sys", "ImageProcessDataPath", SysParams.ImageProcessDataPath);
  825. iniHelper.WriteString("Sys", "AIModelPath", SysParams.AIModelPath);
  826. iniHelper.WriteString("Sys", "ProductPath", SysParams.ProductPath);
  827. iniHelper.WriteString("Sys", "HttpServerIP", SysParams.HttpServerIP);
  828. iniHelper.WriteInteger("Sys", "HttpServerPort", SysParams.HttpServerPort);
  829. iniHelper.WriteBool("ShowMainWin", "ShowResetBtn", SysParams.ShowResetBtn);
  830. iniHelper.WriteBool("ShowMainWin", "ShowBuzz", SysParams.ShowBuzz);
  831. iniHelper.WriteBool("ShowMainWin", "ShowDoorAlm", SysParams.ShowDoorAlm);
  832. iniHelper.WriteBool("ShowMainWin", "ShowDistribution", SysParams.ShowDistribution);
  833. iniHelper.WriteBool("ShowMainWin", "ShowSizeBtn", SysParams.ShowSizeBtn);
  834. iniHelper.WriteBool("ShowMainWin", "ShowDefectBtn", SysParams.ShowDefectBtn);
  835. iniHelper.WriteDouble("CamView", "DefectCamViewX", SysParams.DefectCamViewX);
  836. iniHelper.WriteDouble("CamView", "DefectCamViewY", SysParams.DefectCamViewY);
  837. iniHelper.WriteBool("CloudAndMES", "EnableHttp", SysParams.EnableHttp);
  838. iniHelper.WriteString("CloudAndMES", "HttpUrl", SysParams.HttpUrl);
  839. iniHelper.WriteString("CloudAndMES", "HttpTempPath", SysParams.HttpTempPath);
  840. iniHelper.WriteString("CloudAndMES", "HttpReturnKey", SysParams.HttpReturnKey);
  841. iniHelper.WriteString("CloudAndMES", "HttpReturnValue", SysParams.HttpReturnValue);
  842. iniHelper.WriteBool("CloudAndMES", "OpenCloud", SysParams.OpenCloud);
  843. iniHelper.WriteString("CloudAndMES", "CloudThisName", SysParams.CloudThisName);
  844. iniHelper.WriteString("CloudAndMES", "CloudServerIP", SysParams.CloudServerIP);
  845. iniHelper.WriteInteger("CloudAndMES", "CloudServerPort", SysParams.CloudServerPort);
  846. iniHelper.WriteString("CloudAndMES", "CloudUser", SysParams.CloudUser);
  847. iniHelper.WriteString("CloudAndMES", "CloudPassword", SysParams.CloudPassword);
  848. iniHelper.WriteBool("CloudAndMES", "OpenPdtServer", SysParams.OpenPdtServer);
  849. iniHelper.WriteString("CloudAndMES", "PdtServerIP", SysParams.PdtServerIP);
  850. iniHelper.WriteInteger("CloudAndMES", "PdtServerPort", SysParams.PdtServerPort);
  851. iniHelper.WriteBool("CloudAndMES", "IsPdtServer", SysParams.IsPdtServer);
  852. iniHelper.WriteDouble("LensZ", "Z_0_58X", SysParams.LensAxisZPos.Z_0_58X);
  853. //iniHelper.WriteDouble("LensZ", "Z_0_6X", SysParams.LensAxisZPos.Z_0_6X);
  854. iniHelper.WriteDouble("LensZ", "Z_1_0X", SysParams.LensAxisZPos.Z_1_0X);
  855. iniHelper.WriteDouble("LensZ", "Z_1_5X", SysParams.LensAxisZPos.Z_1_5X);
  856. iniHelper.WriteDouble("LensZ", "Z_2_0X", SysParams.LensAxisZPos.Z_2_0X);
  857. iniHelper.WriteDouble("LensZ", "Z_2_5X", SysParams.LensAxisZPos.Z_2_5X);
  858. iniHelper.WriteDouble("LensZ", "Z_3_0X", SysParams.LensAxisZPos.Z_3_0X);
  859. iniHelper.WriteDouble("LensZ", "Z_3_5X", SysParams.LensAxisZPos.Z_3_5X);
  860. iniHelper.WriteDouble("LensZ", "Z_4_0X", SysParams.LensAxisZPos.Z_4_0X);
  861. iniHelper.WriteDouble("LensZ", "Z_4_5X", SysParams.LensAxisZPos.Z_4_5X);
  862. iniHelper.WriteDouble("LensZ", "Z_5_0X", SysParams.LensAxisZPos.Z_5_0X);
  863. iniHelper.WriteDouble("LensZ", "Z_5_5X", SysParams.LensAxisZPos.Z_5_5X);
  864. iniHelper.WriteDouble("LensZ", "Z_6_0X", SysParams.LensAxisZPos.Z_6_0X);
  865. iniHelper.WriteDouble("LensZ", "Z_6_5X", SysParams.LensAxisZPos.Z_6_5X);
  866. iniHelper.WriteDouble("LensZ", "Z_7_0X", SysParams.LensAxisZPos.Z_7_0X);
  867. iniHelper.WriteDouble("LensZ", "Z_7_5X", SysParams.LensAxisZPos.Z_7_5X);
  868. iniHelper.WriteBool("LabelPrint", "EnableLabelPrint", SysParams.EnableLabelPrint);
  869. iniHelper.WriteString("LabelPrint", "LabelPrinterName", SysParams.LabelPrinterName);
  870. iniHelper.WriteString("LabelPrint", "LabelTempPath", SysParams.LabelTempPath);
  871. iniHelper.WriteString("LabelPrint", "LabelData", JsonConvert.SerializeObject(SysParams.LabelData));
  872. iniHelper.WriteBool("ExcelPrint", "EnableExcelPrint", SysParams.EnableExcelPrint);
  873. iniHelper.WriteString("ExcelPrint", "ExcelPrinterName", SysParams.ExcelPrinterName);
  874. iniHelper.WriteString("ExcelPrint", "ExcelTempPath", SysParams.ExcelTempPath);
  875. iniHelper.WriteString("ExcelPrint", "ExcelData", JsonConvert.SerializeObject(SysParams.ExcelData));
  876. iniHelper.WriteDouble("Offset", "Pt_offset", SysParams.Pt_offset);
  877. iniHelper.WriteDouble("Offset", "Line_offset", SysParams.Line_offset);
  878. iniHelper.WriteDouble("Offset", "X_per", SysParams.X_per);
  879. iniHelper.WriteDouble("Offset", "Y_per", SysParams.Y_per);
  880. iniHelper.WriteInteger("DefectSnap", "LightCH", SysParams.LightCH);
  881. iniHelper.WriteInteger("DefectSnap", "LightLut", SysParams.LightLut);
  882. iniHelper.WriteInteger("DefectSnap", "CamExposureTime", SysParams.CamExposureTime);
  883. iniHelper.WriteInteger("SysOther", "LightChannelCnt", SysParams.LightChannelCnt);
  884. iniHelper.WriteString("SysOther", "CustomerName", SysParams.CustomerName);
  885. SysConfigParams = SysParams;
  886. }
  887. /// <summary>
  888. /// 读取ini
  889. /// </summary>
  890. /// <returns></returns>
  891. public SysConfigParams ReadSysConfParams()
  892. {
  893. //return XmlHelper.Deserialize<SysConfParams>(_configFile);
  894. SysConfigParams sysParams = new SysConfigParams();
  895. IniHelper iniHelper = new IniHelper(_configFile);
  896. string sValue = "";
  897. int iValue = 0;
  898. double dValue = 0;
  899. bool bValue = false;
  900. iniHelper.ReadString("DefectSrcSmallImag", "Defect_SrcSmall_SavePath", out sValue);
  901. sysParams.Defect_SrcSmall_SavePath = sValue;
  902. iniHelper.ReadDouble("DefectSrcSmallImag", "Defect_SrcSmall_Thres", out dValue);
  903. sysParams.Defect_SrcSmall_Thres = dValue;
  904. iniHelper.ReadBool("SaveAllImg", "SaveAllImg", out bValue);
  905. sysParams.SaveAllImg = bValue;
  906. iniHelper.ReadString("DefectBigImag", "SavePath", out sValue);
  907. sysParams.DefectBigImag.SavePath = sValue.Replace("\0", "");
  908. iniHelper.ReadBool("DefectBigImag", "AutoSave", out bValue);
  909. sysParams.DefectBigImag.AutoSave = bValue;
  910. iniHelper.ReadBool("DefectBigImag", "AutoDelete", out bValue);
  911. sysParams.DefectBigImag.AutoDelete = bValue;
  912. iniHelper.ReadDouble("DefectBigImag", "AutoDeleteDays", out dValue);
  913. sysParams.DefectBigImag.AutoDeleteDays = dValue;
  914. iniHelper.ReadString("DefectSrcSmallImag", "SavePath", out sValue);
  915. sysParams.DefectSrcSmallImag.SavePath = sValue.Replace("\0", "");
  916. iniHelper.ReadBool("DefectSrcSmallImag", "AutoSave", out bValue);
  917. sysParams.DefectSrcSmallImag.AutoSave = bValue;
  918. iniHelper.ReadBool("DefectSrcSmallImag", "AutoDelete", out bValue);
  919. sysParams.DefectSrcSmallImag.AutoDelete = bValue;
  920. iniHelper.ReadDouble("DefectSrcSmallImag", "AutoDeleteDays", out dValue);
  921. sysParams.DefectSrcSmallImag.AutoDeleteDays = dValue;
  922. iniHelper.ReadString("DefectSmallImag", "SavePath", out sValue);
  923. sysParams.DefectSmallImag.SavePath = sValue.Replace("\0", "");
  924. iniHelper.ReadBool("DefectSmallImag", "AutoSave", out bValue);
  925. sysParams.DefectSmallImag.AutoSave = bValue;
  926. iniHelper.ReadBool("DefectSmallImag", "AutoDelete", out bValue);
  927. sysParams.DefectSmallImag.AutoDelete = bValue;
  928. iniHelper.ReadDouble("DefectSmallImag", "AutoDeleteDays", out dValue);
  929. sysParams.DefectSmallImag.AutoDeleteDays = dValue;
  930. iniHelper.ReadString("DefectRepairImag", "SavePath", out sValue);
  931. sysParams.DefectRepairImag.SavePath = sValue.Replace("\0", "");
  932. iniHelper.ReadBool("DefectRepairImag", "AutoSave", out bValue);
  933. sysParams.DefectRepairImag.AutoSave = bValue;
  934. iniHelper.ReadBool("DefectRepairImag", "AutoDelete", out bValue);
  935. sysParams.DefectRepairImag.AutoDelete = bValue;
  936. iniHelper.ReadDouble("DefectRepairImag", "AutoDeleteDays", out dValue);
  937. sysParams.DefectRepairImag.AutoDeleteDays = dValue;
  938. iniHelper.ReadString("SizeBigImag", "SavePath", out sValue);
  939. sysParams.SizeBigImag.SavePath = sValue.Replace("\0", "");
  940. iniHelper.ReadBool("SizeBigImag", "AutoSave", out bValue);
  941. sysParams.SizeBigImag.AutoSave = bValue;
  942. iniHelper.ReadBool("SizeBigImag", "AutoDelete", out bValue);
  943. sysParams.SizeBigImag.AutoDelete = bValue;
  944. iniHelper.ReadDouble("SizeBigImag", "AutoDeleteDays", out dValue);
  945. sysParams.SizeBigImag.AutoDeleteDays = dValue;
  946. iniHelper.ReadString("SizeNGImag", "SavePath", out sValue);
  947. sysParams.SizeNGImag.SavePath = sValue.Replace("\0", "");
  948. iniHelper.ReadBool("SizeNGImag", "AutoSave", out bValue);
  949. sysParams.SizeNGImag.AutoSave = bValue;
  950. iniHelper.ReadBool("SizeNGImag", "AutoDelete", out bValue);
  951. sysParams.SizeNGImag.AutoDelete = bValue;
  952. iniHelper.ReadDouble("SizeNGImag", "AutoDeleteDays", out dValue);
  953. sysParams.SizeNGImag.AutoDeleteDays = dValue;
  954. iniHelper.ReadString("SizeRepairImag", "SavePath", out sValue);
  955. sysParams.SizeRepairImag.SavePath = sValue.Replace("\0", "");
  956. iniHelper.ReadBool("SizeRepairImag", "AutoSave", out bValue);
  957. sysParams.SizeRepairImag.AutoSave = bValue;
  958. iniHelper.ReadBool("SizeRepairImag", "AutoDelete", out bValue);
  959. sysParams.SizeRepairImag.AutoDelete = bValue;
  960. iniHelper.ReadDouble("SizeRepairImag", "AutoDeleteDays", out dValue);
  961. sysParams.SizeRepairImag.AutoDeleteDays = dValue;
  962. iniHelper.ReadString("Log", "SavePath", out sValue);
  963. sysParams.LogPath = sValue.Replace("\0", "");
  964. iniHelper.ReadBool("Log", "AutoDelete", out bValue);
  965. sysParams.AutoDeleteLog = bValue;
  966. iniHelper.ReadDouble("Log", "AutoDeleteDays", out dValue);
  967. sysParams.AutoDeleteLogData = dValue;
  968. iniHelper.ReadBool("SysFunction", "OpenMarkErrorStop", out bValue);
  969. sysParams.OpenMarkErrorStop = bValue;
  970. iniHelper.ReadBool("SysFunction", "OpenBuzzer", out bValue);
  971. sysParams.OpenBuzzer = bValue;
  972. iniHelper.ReadBool("SysFunction", "OpenDoor", out bValue);
  973. sysParams.OpenDoor = bValue;
  974. iniHelper.ReadBool("SysFunction", "OpenHttpLog", out bValue);
  975. sysParams.OpenHttpLog = bValue;
  976. iniHelper.ReadBool("SysFunction", "OpenAutoGoHome", out bValue);
  977. sysParams.OpenAutoGoHome = bValue;
  978. iniHelper.ReadBool("SysFunction", "OpenFlawDistribution", out bValue);
  979. sysParams.OpenFlawDistribution = bValue;
  980. iniHelper.ReadBool("SysFunction", "OpenAxisXCalibration", out bValue);
  981. sysParams.OpenAxisXCalibration = bValue;
  982. iniHelper.ReadBool("SysFunction", "OpenPdtIsHave", out bValue);
  983. sysParams.OpenPdtIsHave = bValue;
  984. iniHelper.ReadBool("SysFunction", "OpenDefectSanp", out bValue);
  985. sysParams.OpenDefectSanp = bValue;
  986. iniHelper.ReadBool("SysFunction", "OpenAsideDefect", out bValue);
  987. sysParams.OpenAsideDefect = bValue;
  988. iniHelper.ReadBool("SysFunction", "OpenOredrCheck", out bValue);
  989. sysParams.OpenOredrCheck = bValue;
  990. iniHelper.ReadBool("SysFunction", "OpenOredrCntCheck", out bValue);
  991. sysParams.OpenOredrCntCheck = bValue;
  992. iniHelper.ReadString("Dev", "LightCom", out sValue);
  993. sysParams.LightCom = sValue.Replace("\0", "");
  994. iniHelper.ReadInteger("Dev", "LightComBaud", out iValue);
  995. sysParams.LightComBaud = iValue;
  996. iniHelper.ReadString("Dev", "TensionCom", out sValue);
  997. sysParams.TensionCom = sValue.Replace("\0", "");
  998. iniHelper.ReadInteger("Dev", "TensionComBaud", out iValue);
  999. sysParams.TensionComBaud = iValue;
  1000. iniHelper.ReadDouble("Dev", "Tension_Offset", out dValue);
  1001. sysParams.Tension_Offset = dValue;
  1002. iniHelper.ReadString("Dev", "LensMotorCom", out sValue);
  1003. sysParams.LensMotorCom = sValue.Replace("\0", "");
  1004. iniHelper.ReadInteger("Dev", "LensMotorComBaud", out iValue);
  1005. sysParams.LensMotorComBaud = iValue;
  1006. iniHelper.ReadString("Dev", "ThicknessIP", out sValue);
  1007. sysParams.ThicknessIP = sValue.Replace("\0", "");
  1008. iniHelper.ReadInteger("Dev", "ThicknessPort", out iValue);
  1009. sysParams.ThicknessPort = iValue;
  1010. iniHelper.ReadDouble("Dev", "ThicknessSafeValue", out dValue);
  1011. sysParams.ThicknessSafeValue = dValue;
  1012. iniHelper.ReadDouble("Dev", "Thickness_Offset", out dValue);
  1013. sysParams.Thickness_Offset = dValue;
  1014. iniHelper.ReadString("Dev", "IODevName", out sValue);
  1015. sysParams.IODevName = sValue.Replace("\0", "");
  1016. iniHelper.ReadString("Dev", "IOCfgPath", out sValue);
  1017. sysParams.IOCfgPath = sValue.Replace("\0", "");
  1018. iniHelper.ReadString("Dev", "FrontCamName", out sValue);
  1019. sysParams.FrontCamName = sValue.Replace("\0", "");
  1020. iniHelper.ReadString("Dev", "FrontCamCfgPath", out sValue);
  1021. sysParams.FrontCamCfgPath = sValue.Replace("\0", "");
  1022. iniHelper.ReadString("Dev", "BackCamName", out sValue);
  1023. sysParams.BackCamName = sValue.Replace("\0", "");
  1024. iniHelper.ReadString("Dev", "BackCamCfgPath", out sValue);
  1025. sysParams.BackCamCfgPath = sValue.Replace("\0", "");
  1026. iniHelper.ReadString("Dev", "MotionCfgPath", out sValue);
  1027. sysParams.MotionCfgPath = sValue.Replace("\0", "");
  1028. iniHelper.ReadBool("Disable", "DisableX1", out bValue);
  1029. sysParams.DisableX1 = bValue;
  1030. iniHelper.ReadBool("Disable", "DisableX2", out bValue);
  1031. sysParams.DisableX2 = bValue;
  1032. iniHelper.ReadBool("Disable", "DisableY", out bValue);
  1033. sysParams.DisableY = bValue;
  1034. iniHelper.ReadBool("Disable", "DisableZ", out bValue);
  1035. sysParams.DisableZ = bValue;
  1036. iniHelper.ReadBool("Disable", "DisableFrontCam", out bValue);
  1037. sysParams.DisableFrontCam = bValue;
  1038. iniHelper.ReadBool("Disable", "DisableBackCam", out bValue);
  1039. sysParams.DisableBackCam = bValue;
  1040. iniHelper.ReadBool("Disable", "DisableLight", out bValue);
  1041. sysParams.DisableLight = bValue;
  1042. iniHelper.ReadBool("Disable", "DisableTensor", out bValue);
  1043. sysParams.DisableTensor = bValue;
  1044. iniHelper.ReadBool("Disable", "DisableThickness", out bValue);
  1045. sysParams.DisableThickness = bValue;
  1046. iniHelper.ReadBool("Disable", "DisableLensMotor", out bValue);
  1047. sysParams.DisableLensMotor = bValue;
  1048. iniHelper.ReadString("Sys", "ImageProcessPath", out sValue);
  1049. sysParams.ImageProcessPath = sValue.Replace("\0", "");
  1050. iniHelper.ReadString("Sys", "ImageProcessDataPath", out sValue);
  1051. sysParams.ImageProcessDataPath = sValue.Replace("\0", "");
  1052. iniHelper.ReadString("Sys", "AIModelPath", out sValue);
  1053. sysParams.AIModelPath = sValue.Replace("\0", "");
  1054. iniHelper.ReadString("Sys", "ProductPath", out sValue);
  1055. sysParams.ProductPath = sValue.Replace("\0", "");
  1056. iniHelper.ReadString("Sys", "HttpServerIP", out sValue);
  1057. sysParams.HttpServerIP = sValue.Replace("\0", "");
  1058. iniHelper.ReadInteger("Sys", "HttpServerPort", out iValue);
  1059. sysParams.HttpServerPort = iValue;
  1060. iniHelper.ReadBool("ShowMainWin", "ShowResetBtn", out bValue);
  1061. sysParams.ShowResetBtn = bValue;
  1062. iniHelper.ReadBool("ShowMainWin", "ShowBuzz", out bValue);
  1063. sysParams.ShowBuzz = bValue;
  1064. iniHelper.ReadBool("ShowMainWin", "ShowDoorAlm", out bValue);
  1065. sysParams.ShowDoorAlm = bValue;
  1066. iniHelper.ReadBool("ShowMainWin", "ShowDistribution", out bValue);
  1067. sysParams.ShowDistribution = bValue;
  1068. iniHelper.ReadBool("ShowMainWin", "ShowSizeBtn", out bValue);
  1069. sysParams.ShowSizeBtn = bValue;
  1070. iniHelper.ReadBool("ShowMainWin", "ShowDefectBtn", out bValue);
  1071. sysParams.ShowDefectBtn = bValue;
  1072. iniHelper.ReadDouble("CamView", "DefectCamViewX", out dValue);
  1073. sysParams.DefectCamViewX = dValue;
  1074. iniHelper.ReadDouble("CamView", "DefectCamViewY", out dValue);
  1075. sysParams.DefectCamViewY = dValue;
  1076. iniHelper.ReadBool("CloudAndMES", "EnableHttp", out bValue);
  1077. sysParams.EnableHttp = bValue;
  1078. iniHelper.ReadString("CloudAndMES", "HttpUrl", out sValue);
  1079. sysParams.HttpUrl = sValue;
  1080. iniHelper.ReadString("CloudAndMES", "HttpTempPath", out sValue);
  1081. sysParams.HttpTempPath = sValue;
  1082. iniHelper.ReadString("CloudAndMES", "HttpReturnKey", out sValue);
  1083. sysParams.HttpReturnKey = sValue;
  1084. iniHelper.ReadString("CloudAndMES", "HttpReturnValue", out sValue);
  1085. sysParams.HttpReturnValue = sValue;
  1086. iniHelper.ReadBool("CloudAndMES", "OpenCloud", out bValue);
  1087. sysParams.OpenCloud = bValue;
  1088. iniHelper.ReadString("CloudAndMES", "CloudThisName", out sValue);
  1089. sysParams.CloudThisName = sValue.Replace("\0", string.Empty);
  1090. iniHelper.ReadString("CloudAndMES", "CloudServerIP", out sValue);
  1091. sysParams.CloudServerIP = sValue;
  1092. iniHelper.ReadInteger("CloudAndMES", "CloudServerPort", out iValue);
  1093. sysParams.CloudServerPort = iValue;
  1094. iniHelper.ReadString("CloudAndMES", "CloudUser", out sValue);
  1095. sysParams.CloudUser = sValue;
  1096. iniHelper.ReadString("CloudAndMES", "CloudPassword", out sValue);
  1097. sysParams.CloudPassword = sValue;
  1098. iniHelper.ReadBool("CloudAndMES", "OpenPdtServer", out bValue);
  1099. sysParams.OpenPdtServer = bValue;
  1100. iniHelper.ReadString("CloudAndMES", "PdtServerIP", out sValue);
  1101. sysParams.PdtServerIP = sValue;
  1102. iniHelper.ReadInteger("CloudAndMES", "PdtServerPort", out iValue);
  1103. sysParams.PdtServerPort = iValue;
  1104. iniHelper.ReadBool("CloudAndMES", "IsPdtServer", out bValue);
  1105. sysParams.IsPdtServer = bValue;
  1106. iniHelper.ReadDouble("LensZ", "Z_0_58X", out dValue);
  1107. sysParams.LensAxisZPos.Z_0_58X = dValue;
  1108. //iniHelper.ReadDouble("LensZ", "Z_0_6X", out dValue);
  1109. //sysParams.LensAxisZPos.Z_0_6X = dValue;
  1110. iniHelper.ReadDouble("LensZ", "Z_1_0X", out dValue);
  1111. sysParams.LensAxisZPos.Z_1_0X = dValue;
  1112. iniHelper.ReadDouble("LensZ", "Z_1_5X", out dValue);
  1113. sysParams.LensAxisZPos.Z_1_5X = dValue;
  1114. iniHelper.ReadDouble("LensZ", "Z_2_0X", out dValue);
  1115. sysParams.LensAxisZPos.Z_2_0X = dValue;
  1116. iniHelper.ReadDouble("LensZ", "Z_2_5X", out dValue);
  1117. sysParams.LensAxisZPos.Z_2_5X = dValue;
  1118. iniHelper.ReadDouble("LensZ", "Z_3_0X", out dValue);
  1119. sysParams.LensAxisZPos.Z_3_0X = dValue;
  1120. iniHelper.ReadDouble("LensZ", "Z_3_5X", out dValue);
  1121. sysParams.LensAxisZPos.Z_3_5X = dValue;
  1122. iniHelper.ReadDouble("LensZ", "Z_4_0X", out dValue);
  1123. sysParams.LensAxisZPos.Z_4_0X = dValue;
  1124. iniHelper.ReadDouble("LensZ", "Z_4_5X", out dValue);
  1125. sysParams.LensAxisZPos.Z_4_5X = dValue;
  1126. iniHelper.ReadDouble("LensZ", "Z_5_0X", out dValue);
  1127. sysParams.LensAxisZPos.Z_5_0X = dValue;
  1128. iniHelper.ReadDouble("LensZ", "Z_5_5X", out dValue);
  1129. sysParams.LensAxisZPos.Z_5_5X = dValue;
  1130. iniHelper.ReadDouble("LensZ", "Z_6_0X", out dValue);
  1131. sysParams.LensAxisZPos.Z_6_0X = dValue;
  1132. iniHelper.ReadDouble("LensZ", "Z_6_5X", out dValue);
  1133. sysParams.LensAxisZPos.Z_6_5X = dValue;
  1134. iniHelper.ReadDouble("LensZ", "Z_7_0X", out dValue);
  1135. sysParams.LensAxisZPos.Z_7_0X = dValue;
  1136. iniHelper.ReadDouble("LensZ", "Z_7_5X", out dValue);
  1137. sysParams.LensAxisZPos.Z_7_5X = dValue;
  1138. iniHelper.ReadBool("LabelPrint", "EnableLabelPrint", out bValue);
  1139. sysParams.EnableLabelPrint = bValue;
  1140. iniHelper.ReadString("LabelPrint", "LabelPrinterName", out sValue);
  1141. sysParams.LabelPrinterName = sValue;
  1142. iniHelper.ReadString("LabelPrint", "LabelTempPath", out sValue);
  1143. sysParams.LabelTempPath = sValue;
  1144. iniHelper.ReadString("LabelPrint", "LabelData", out sValue);
  1145. if (string.IsNullOrEmpty(sValue))
  1146. sysParams.LabelData = new Dictionary<string, string>();
  1147. else
  1148. sysParams.LabelData = JsonConvert.DeserializeObject<Dictionary<string, string>>(sValue);
  1149. iniHelper.ReadBool("ExcelPrint", "EnableExcelPrint", out bValue);
  1150. sysParams.EnableExcelPrint = bValue;
  1151. iniHelper.ReadString("ExcelPrint", "ExcelPrinterName", out sValue);
  1152. sysParams.ExcelPrinterName = sValue;
  1153. iniHelper.ReadString("ExcelPrint", "ExcelTempPath", out sValue);
  1154. sysParams.ExcelTempPath = sValue;
  1155. iniHelper.ReadString("ExcelPrint", "ExcelData", out sValue);
  1156. if (string.IsNullOrEmpty(sValue))
  1157. sysParams.ExcelData = new Dictionary<string, string>();
  1158. else
  1159. sysParams.ExcelData = JsonConvert.DeserializeObject<Dictionary<string, string>>(sValue);
  1160. iniHelper.ReadDouble("Offset", "Pt_offset", out dValue);
  1161. sysParams.Pt_offset = dValue;
  1162. iniHelper.ReadDouble("Offset", "Line_offset", out dValue);
  1163. sysParams.Line_offset = dValue;
  1164. iniHelper.ReadDouble("Offset", "X_per", out dValue);
  1165. if (dValue > 1)
  1166. sysParams.X_per = 0.9;
  1167. else if (dValue <= 0)
  1168. sysParams.X_per = 0.1;
  1169. else
  1170. sysParams.X_per = dValue;
  1171. iniHelper.ReadDouble("Offset", "Y_per", out dValue);
  1172. if (dValue > 1)
  1173. sysParams.Y_per = 0.9;
  1174. else if (dValue <= 0)
  1175. sysParams.Y_per = 0.1;
  1176. else
  1177. sysParams.Y_per = dValue;
  1178. iniHelper.ReadInteger("DefectSnap", "LightCH", out iValue);
  1179. sysParams.LightCH = iValue;
  1180. iniHelper.ReadInteger("DefectSnap", "LightLut", out iValue);
  1181. sysParams.LightLut = iValue;
  1182. iniHelper.ReadInteger("DefectSnap", "CamExposureTime", out iValue);
  1183. sysParams.CamExposureTime = iValue;
  1184. iniHelper.ReadInteger("SysOther", "LightChannelCnt", out iValue);
  1185. sysParams.LightChannelCnt = iValue;
  1186. iniHelper.ReadString("SysOther", "CustomerName", out sValue);
  1187. sysParams.CustomerName = sValue;
  1188. SysConfigParams = sysParams;
  1189. return sysParams;
  1190. }
  1191. /// <summary>
  1192. /// 写入系统默认配置
  1193. /// </summary>
  1194. public void WriteDefaultSystemConfig()
  1195. {
  1196. SysConfigParams = new SysConfigParams();
  1197. WriteSysConfParams(SysConfigParams);
  1198. }
  1199. /// <summary>
  1200. /// 加载系统配置
  1201. /// </summary>
  1202. /// <returns></returns>
  1203. public bool LoadSystemConfig()
  1204. {
  1205. bool ret = false;
  1206. if (!Directory.Exists(_rootPath))
  1207. {
  1208. Directory.CreateDirectory(_rootPath);
  1209. }
  1210. if (!Directory.Exists(_projectDir))
  1211. {
  1212. Directory.CreateDirectory(_projectDir);
  1213. }
  1214. if (File.Exists(_pointsPath))
  1215. {
  1216. ReadPointsAndTime();
  1217. }
  1218. else
  1219. {
  1220. // write default value
  1221. WritePointsAndTime(0, 0, 0, 0, 1000, 1000);
  1222. ret = true;
  1223. }
  1224. if (File.Exists(_configFile))
  1225. {
  1226. SysConfigParams = ReadSysConfParams();
  1227. if (null != SysConfigParams)
  1228. {
  1229. ret = true;
  1230. }
  1231. }
  1232. else
  1233. {
  1234. // write default value
  1235. WriteDefaultSystemConfig();
  1236. ret = true;
  1237. }
  1238. return ret;
  1239. }
  1240. #endregion
  1241. #region 文件选择
  1242. /// <summary>
  1243. /// 选择目录
  1244. /// </summary>
  1245. /// <returns></returns>
  1246. public static string SelectFolder(string defaultPath = "")
  1247. {
  1248. FolderBrowserDialog dlg = new FolderBrowserDialog();
  1249. dlg.SelectedPath = (defaultPath != "" ? defaultPath : Path.GetFullPath("."));
  1250. if (dlg.ShowDialog() == DialogResult.OK)
  1251. return dlg.SelectedPath;
  1252. return "";
  1253. }
  1254. /// <summary>
  1255. /// 选择文件
  1256. /// </summary>
  1257. /// <param name="filter">如 图像文件|*.jpg|图像文件|*.png|所有文件|*.*</param>
  1258. /// <returns></returns>
  1259. public static string SelectFile(string filter = "所有文件|*.*", string defaultPath = "")
  1260. {
  1261. OpenFileDialog fie = new OpenFileDialog();
  1262. fie.Title = "选择文件";
  1263. //fie.InitialDirectory = (defaultPath != "" ? defaultPath : Path.GetFullPath("."));
  1264. fie.Filter = filter; //设置文件类型
  1265. if (fie.ShowDialog() == DialogResult.OK)
  1266. return fie.FileName;
  1267. return "";
  1268. }
  1269. /// <summary>
  1270. /// 删除指定目录下文件
  1271. /// </summary>
  1272. /// <param name="defaultPath"></param>
  1273. /// <param name="fileExtend"></param>
  1274. /// <returns></returns>
  1275. public static bool DelFilesInFolder(string FolderPath, string fileExtend = "*")
  1276. {
  1277. if (!Directory.Exists(FolderPath))
  1278. return false;
  1279. string[] files = Directory.GetFiles(FolderPath, fileExtend, SearchOption.TopDirectoryOnly);
  1280. foreach (string file in files)
  1281. API.DeleteFile(file);
  1282. return true;
  1283. }
  1284. /// <summary>
  1285. /// 另存为
  1286. /// </summary>
  1287. /// <param name="defaultFileName">默认文件名</param>
  1288. /// <param name="filter">如 图像文件|*.jpg|图像文件|*.png|所有文件|*.*</param>
  1289. /// <returns></returns>
  1290. public static string SaveAsFile(string defaultFileName, string filter = "所有文件|*.*")
  1291. {
  1292. SaveFileDialog s = new SaveFileDialog();
  1293. s.Title = "保存文件";
  1294. s.Filter = filter; //"图像文件|*.jpg|图像文件|*.png|所有文件|*.*";
  1295. //s.DefaultExt = "图像文件|*.jpg"; //默认扩展名
  1296. //s.InitialDirectory = @"C:\Users\Administrator\Desktop"; //保存的初始目录
  1297. s.FileName = defaultFileName;//默认文件名
  1298. if (s.ShowDialog() == DialogResult.OK)
  1299. return s.FileName;
  1300. return "";
  1301. }
  1302. #endregion
  1303. #region json操作
  1304. public static void addKey(JObject obj, string key, JToken value)
  1305. {
  1306. if (obj.ContainsKey(key))
  1307. obj[key] = value;
  1308. else
  1309. obj.Add(key, value);
  1310. }
  1311. #endregion
  1312. #region enum名称
  1313. public static ArrayList GetArrayList<T>()
  1314. {
  1315. ArrayList list = new ArrayList();
  1316. Type type = typeof(T);
  1317. //list.Add(new DictionaryEntry("start", "启动按钮"));
  1318. foreach (int value in Enum.GetValues(type))
  1319. {
  1320. string strName = Enum.GetName(type, value);//获取名称
  1321. list.Add(new DictionaryEntry(value, strName));
  1322. }
  1323. return list;
  1324. }
  1325. #endregion
  1326. #region 生产数据记录
  1327. public bool SetDailyOutputAdd(out int tDailyOutput)
  1328. {
  1329. bool ret = true;
  1330. try
  1331. {
  1332. //读取数据
  1333. string tempFile = Path.Combine(_rootPath, "DailyOutput.ini");
  1334. IniHelper iniHelper = new IniHelper(tempFile);
  1335. int iValue = 0;
  1336. iniHelper.ReadInteger("TempData", "DailyOutput", out iValue);
  1337. tDailyOutput = iValue;
  1338. iniHelper.ReadInteger("TempData", "Date", out iValue);
  1339. int dateNum = iValue;
  1340. int nowDateNum = int.Parse(DateTime.Now.ToString("yyyyMMdd"));
  1341. if (dateNum == nowDateNum)
  1342. {
  1343. //同一天,生产数量+1
  1344. tDailyOutput++;
  1345. }
  1346. else if(dateNum < nowDateNum)
  1347. {
  1348. //昨天数据,为1
  1349. tDailyOutput = 1;
  1350. }
  1351. //重新记录
  1352. iniHelper.WriteInteger("TempData", "DailyOutput", tDailyOutput);
  1353. iniHelper.WriteInteger("TempData", "Date", nowDateNum);
  1354. }
  1355. catch (Exception ex)
  1356. {
  1357. tDailyOutput = 0;
  1358. ret = false;
  1359. string tempFile = Path.Combine(_rootPath, "DailyOutput.ini");
  1360. IniHelper iniHelper = new IniHelper(tempFile);
  1361. int nowDateNum = int.Parse(DateTime.Now.ToString("yyyyMMdd"));
  1362. //重新记录
  1363. iniHelper.WriteInteger("TempData", "DailyOutput", tDailyOutput);
  1364. iniHelper.WriteInteger("TempData", "Date", nowDateNum);
  1365. }
  1366. return ret;
  1367. }
  1368. public bool GetDailyOutput(out int tDailyOutput)
  1369. {
  1370. bool ret = true;
  1371. try
  1372. {
  1373. //读取数据
  1374. string tempFile = Path.Combine(_rootPath, "DailyOutput.ini");
  1375. IniHelper iniHelper = new IniHelper(tempFile);
  1376. int iValue = 0;
  1377. iniHelper.ReadInteger("TempData", "DailyOutput", out iValue);
  1378. tDailyOutput = iValue;
  1379. iniHelper.ReadInteger("TempData", "Date", out iValue);
  1380. int dateNum = iValue;
  1381. int nowDateNum = int.Parse(DateTime.Now.ToString("yyyyMMdd"));
  1382. if (dateNum == nowDateNum)
  1383. {
  1384. //同一天,生产数量+1
  1385. //tDailyOutput++;
  1386. }
  1387. else if (dateNum < nowDateNum)
  1388. {
  1389. //昨天数据,为1
  1390. tDailyOutput = 0;
  1391. }
  1392. }
  1393. catch (Exception ex)
  1394. {
  1395. tDailyOutput = 0;
  1396. ret = false;
  1397. }
  1398. return ret;
  1399. }
  1400. #endregion
  1401. #region 尺寸检测项
  1402. public List<SizeItemParam> SizeItemParamsList = new List<SizeItemParam>();
  1403. public void ReadSizeDefectItems()
  1404. {
  1405. string str = File.ReadAllText(_sizeItemsPath);
  1406. SizeItemParamsList = JsonConvert.DeserializeObject<List<SizeItemParam>>(str);
  1407. }
  1408. #endregion
  1409. #region 缺陷检测项
  1410. public List<DefectItemParam> DefectItemParamsList = new List<DefectItemParam>();
  1411. public void ReadDefectItems()
  1412. {
  1413. string str = File.ReadAllText(_defectItemsPath);
  1414. DefectItemParamsList = JsonConvert.DeserializeObject<List<DefectItemParam>>(str);
  1415. }
  1416. #endregion
  1417. #endregion
  1418. }
  1419. }