SystemConfiguration.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  1. using Prism.Mvvm;
  2. using System;
  3. using System.Reflection;
  4. using TeamAAS_VP.Enums;
  5. namespace TeamAAS_VP.Models
  6. {
  7. /// <summary>
  8. /// 系统配置:保存软件版本、标题、语言、字体大小等全局设置。
  9. /// </summary>
  10. public class SystemConfiguration : BindableBase
  11. {
  12. public SystemConfiguration()
  13. {
  14. // 尝试从程序集信息读取版本号作为默认值
  15. try
  16. {
  17. var version = Assembly.GetEntryAssembly()?.GetName()?.Version?.ToString();
  18. if (string.IsNullOrEmpty(version))
  19. {
  20. version = Assembly.GetExecutingAssembly()?.GetName()?.Version?.ToString();
  21. }
  22. SoftwareVersion = version ?? "1.0.0.0";
  23. }
  24. catch
  25. {
  26. SoftwareVersion = "1.0.0.0";
  27. }
  28. Title = "Team Vision";
  29. CompanyTitle = "江苏新惕姆智能装备有限公司";
  30. CurrentLanguage = Language.ChineseSimplified;
  31. Font = new FontSizeSettings();
  32. }
  33. private string _softwareVersion;
  34. /// <summary>
  35. /// 软件版本号
  36. /// </summary>
  37. public string SoftwareVersion
  38. {
  39. get => _softwareVersion;
  40. set => SetProperty(ref _softwareVersion, value);
  41. }
  42. private string _title;
  43. /// <summary>
  44. /// 软件标题
  45. /// </summary>
  46. public string Title
  47. {
  48. get => _title;
  49. set => SetProperty(ref _title, value);
  50. }
  51. private string _companyTitle;
  52. /// <summary>
  53. /// 公司名称/标题
  54. /// </summary>
  55. public string CompanyTitle
  56. {
  57. get => _companyTitle;
  58. set => SetProperty(ref _companyTitle, value);
  59. }
  60. private Language _currentLanguage;
  61. /// <summary>
  62. /// 当前语言
  63. /// </summary>
  64. public Language CurrentLanguage
  65. {
  66. get => _currentLanguage;
  67. set => SetProperty(ref _currentLanguage, value);
  68. }
  69. private FontSizeSettings _font;
  70. /// <summary>
  71. /// 字体大小配置
  72. /// </summary>
  73. public FontSizeSettings Font
  74. {
  75. get => _font;
  76. set => SetProperty(ref _font, value);
  77. }
  78. private Guid _lastOpenedProductId = Guid.Empty;
  79. /// <summary>
  80. /// 最近打开的产品 ID(可用于自动加载)
  81. /// </summary>
  82. public Guid LastOpenedProductId
  83. {
  84. get => _lastOpenedProductId;
  85. set => SetProperty(ref _lastOpenedProductId, value);
  86. }
  87. // 新增相机/拍照/检测计数属性
  88. private Int16 _WorkMode = 0;
  89. /// <summary>
  90. /// 工作模式 =1 拍1打1 =2 拍1打所有
  91. /// </summary>
  92. public Int16 WorkMode
  93. {
  94. get { return _WorkMode; }
  95. set { SetProperty(ref _WorkMode, value); }
  96. }
  97. private Int16 _PickPointNum = 0;
  98. /// <summary>
  99. /// 取料位置 =0 不需要取料 =1 需要取料
  100. /// </summary>
  101. public Int16 PickPointNum
  102. {
  103. get { return _PickPointNum; }
  104. set { SetProperty(ref _PickPointNum, value); }
  105. }
  106. private Int16 _DowmCameraNum = 0;
  107. /// <summary>
  108. /// 相机拍照次数
  109. /// </summary>
  110. public Int16 DowmCameraNum
  111. {
  112. get => _DowmCameraNum;
  113. set => SetProperty(ref _DowmCameraNum, value);
  114. }
  115. private Int16 _UpCameraPickNum = 0;
  116. /// <summary>
  117. /// 上相机取料拍照次数
  118. /// </summary>
  119. public Int16 UpCameraPickNum
  120. {
  121. get => _UpCameraPickNum;
  122. set => SetProperty(ref _UpCameraPickNum, value);
  123. }
  124. private Int16 _UpCameraPutNum = 0;
  125. /// <summary>
  126. /// 上相机放料拍照次数
  127. /// </summary>
  128. public Int16 UpCameraPutNum
  129. {
  130. get => _UpCameraPutNum;
  131. set => SetProperty(ref _UpCameraPutNum, value);
  132. }
  133. private Int16 _UPCameracheckNum = 0;
  134. /// <summary>
  135. /// 上相机锁附/组装次数
  136. /// </summary>
  137. public Int16 UPCameracheckNum
  138. {
  139. get => _UPCameracheckNum;
  140. set => SetProperty(ref _UPCameracheckNum, value);
  141. }
  142. private Int16 _FixedCameraPickNum = 0;
  143. /// <summary>
  144. /// 取料固定位置拍产品相机数量
  145. /// </summary>
  146. public Int16 FixedCameraPickNum
  147. {
  148. get => _FixedCameraPickNum;
  149. set => SetProperty(ref _FixedCameraPickNum, value);
  150. }
  151. private Int16 _FixedCameraPutNum = 0;
  152. /// <summary>
  153. /// 锁附/组装固定位置拍产品相机数量
  154. /// </summary>
  155. public Int16 FixedCameraPutNum
  156. {
  157. get => _FixedCameraPutNum;
  158. set => SetProperty(ref _FixedCameraPutNum, value);
  159. }
  160. private Int16 _FixedCameracheckNum = 0;
  161. /// <summary>
  162. /// 固定相机检测锁附/组装次数
  163. /// </summary>
  164. public Int16 FixedCameracheckNum
  165. {
  166. get => _FixedCameracheckNum;
  167. set => SetProperty(ref _FixedCameracheckNum, value);
  168. }
  169. private bool _IsSaveScrewCurve = false;
  170. /// <summary>
  171. /// 是否保存锁付曲线图
  172. /// </summary>
  173. public bool IsSaveScrewCurve
  174. {
  175. get => _IsSaveScrewCurve;
  176. set => SetProperty(ref _IsSaveScrewCurve, value);
  177. }
  178. private string _ScrewCurvePath = "";
  179. /// <summary>
  180. /// 锁付曲线图保存的文件夹路径
  181. /// </summary>
  182. public string ScrewCurvePath
  183. {
  184. get => _ScrewCurvePath;
  185. set => SetProperty(ref _ScrewCurvePath, value);
  186. }
  187. /// <summary>
  188. /// 字体大小子设置
  189. /// </summary>
  190. public class FontSizeSettings : BindableBase
  191. {
  192. private double _title1 = 20;
  193. public double Title1 { get => _title1; set => SetProperty(ref _title1, value); }
  194. private double _title2 = 18;
  195. public double Title2 { get => _title2; set => SetProperty(ref _title2, value); }
  196. private double _title3 = 16;
  197. public double Title3 { get => _title3; set => SetProperty(ref _title3, value); }
  198. private double _title4 = 14;
  199. public double Title4 { get => _title4; set => SetProperty(ref _title4, value); }
  200. private double _body1 = 15;
  201. public double Body1 { get => _body1; set => SetProperty(ref _body1, value); }
  202. private double _body2 = 14;
  203. public double Body2 { get => _body2; set => SetProperty(ref _body2, value); }
  204. private double _body3 = 13;
  205. public double Body3 { get => _body3; set => SetProperty(ref _body3, value); }
  206. private double _body4 = 12;
  207. public double Body4 { get => _body4; set => SetProperty(ref _body4, value); }
  208. private double _captions1 = 11;
  209. public double Captions1 { get => _captions1; set => SetProperty(ref _captions1, value); }
  210. private double _captions2 = 10;
  211. public double Captions2 { get => _captions2; set => SetProperty(ref _captions2, value); }
  212. private double _captions3 = 9;
  213. public double Captions3 { get => _captions3; set => SetProperty(ref _captions3, value); }
  214. private double _captions4 = 8;
  215. public double Captions4 { get => _captions4; set => SetProperty(ref _captions4, value); }
  216. }
  217. private bool _LabelUse;
  218. /// <summary>
  219. /// MES,结果标签是否显示
  220. /// </summary>
  221. public bool LabelUse
  222. {
  223. get => _LabelUse;
  224. set => SetProperty(ref _LabelUse, value);
  225. }
  226. private bool _TurnOnAllLightUse;
  227. /// <summary>
  228. /// 打开所有光源
  229. /// </summary>
  230. public bool TurnOnAllLightUse
  231. {
  232. get => _TurnOnAllLightUse;
  233. set => SetProperty(ref _TurnOnAllLightUse, value);
  234. }
  235. private bool _TurnOffAllLightUse;
  236. /// <summary>
  237. /// 关闭所有光源
  238. /// </summary>
  239. public bool TurnOffAllLightUse
  240. {
  241. get => _TurnOffAllLightUse;
  242. set => SetProperty(ref _TurnOffAllLightUse, value);
  243. }
  244. private bool _CodeUse ;
  245. /// <summary>
  246. /// 第一个点位是否使用为扫码点位,Mes询问两次
  247. /// </summary>
  248. public bool CodeUse
  249. {
  250. get => _CodeUse;
  251. set => SetProperty(ref _CodeUse, value);
  252. }
  253. private bool _CodeUse2;
  254. /// <summary>
  255. /// 第一个点位是否使用为扫码点位,Mes询问一次
  256. /// </summary>
  257. public bool CodeUse2
  258. {
  259. get => _CodeUse2;
  260. set => SetProperty(ref _CodeUse2, value);
  261. }
  262. private bool _ScannerUse;
  263. /// <summary>
  264. /// 扫码器是否使用
  265. /// </summary>
  266. public bool ScannerUse
  267. {
  268. get => _ScannerUse;
  269. set => SetProperty(ref _ScannerUse, value);
  270. }
  271. private bool _Camera1Use;
  272. /// <summary>
  273. /// 相机1是否使用
  274. /// </summary>
  275. public bool Camera1Use
  276. {
  277. get => _Camera1Use;
  278. set => SetProperty(ref _Camera1Use, value);
  279. }
  280. private bool _Camera2Use;
  281. /// <summary>
  282. /// 相机2是否使用
  283. /// </summary>
  284. public bool Camera2Use
  285. {
  286. get => _Camera2Use;
  287. set => SetProperty(ref _Camera2Use, value);
  288. }
  289. private bool _Camera3Use;
  290. /// <summary>
  291. /// 相机3是否使用
  292. /// </summary>
  293. public bool Camera3Use
  294. {
  295. get => _Camera3Use;
  296. set => SetProperty(ref _Camera3Use, value);
  297. }
  298. private bool _Camera4Use;
  299. /// <summary>
  300. /// 相机4是否使用
  301. /// </summary>
  302. public bool Camera4Use
  303. {
  304. get => _Camera4Use;
  305. set => SetProperty(ref _Camera4Use, value);
  306. }
  307. private bool _Camera5Use;
  308. /// <summary>
  309. /// 相机5是否使用
  310. /// </summary>
  311. public bool Camera5Use
  312. {
  313. get => _Camera5Use;
  314. set => SetProperty(ref _Camera5Use, value);
  315. }
  316. private bool _Camera6Use;
  317. /// <summary>
  318. /// 相机6是否使用
  319. /// </summary>
  320. public bool Camera6Use
  321. {
  322. get => _Camera6Use;
  323. set => SetProperty(ref _Camera6Use, value);
  324. }
  325. private bool _Camera7Use;
  326. /// <summary>
  327. /// 相机7是否使用
  328. /// </summary>
  329. public bool Camera7Use
  330. {
  331. get => _Camera7Use;
  332. set => SetProperty(ref _Camera7Use, value);
  333. }
  334. private bool _Camera8Use;
  335. /// <summary>
  336. /// 相机8是否使用
  337. /// </summary>
  338. public bool Camera8Use
  339. {
  340. get => _Camera8Use;
  341. set => SetProperty(ref _Camera8Use, value);
  342. }
  343. private bool _CameraData1Use;
  344. /// <summary>
  345. /// 相机长度1是否使用
  346. /// </summary>
  347. public bool CameraData1Use
  348. {
  349. get => _CameraData1Use;
  350. set => SetProperty(ref _CameraData1Use, value);
  351. }
  352. private bool _CameraData2Use;
  353. /// <summary>
  354. /// 相机长度2是否使用
  355. /// </summary>
  356. public bool CameraData2Use
  357. {
  358. get => _CameraData2Use;
  359. set => SetProperty(ref _CameraData2Use, value);
  360. }
  361. private bool _CameraData3Use;
  362. /// <summary>
  363. /// 相机长度3是否使用
  364. /// </summary>
  365. public bool CameraData3Use
  366. {
  367. get => _CameraData3Use;
  368. set => SetProperty(ref _CameraData3Use, value);
  369. }
  370. private bool _CameraData4Use;
  371. /// <summary>
  372. /// 相机长度4是否使用
  373. /// </summary>
  374. public bool CameraData4Use
  375. {
  376. get => _CameraData4Use;
  377. set => SetProperty(ref _CameraData4Use, value);
  378. }
  379. private bool _PhotoAI;
  380. /// <summary>
  381. /// 深度学习是否使用
  382. /// </summary>
  383. public bool PhotoAI
  384. {
  385. get => _PhotoAI;
  386. set => SetProperty(ref _PhotoAI, value);
  387. }
  388. private bool _AxisPassUse;
  389. /// <summary>
  390. /// 轴过度点是否使用
  391. /// </summary>
  392. public bool AxisPassUse
  393. {
  394. get => _AxisPassUse;
  395. set => SetProperty(ref _AxisPassUse, value);
  396. }
  397. }
  398. }