SystemConfiguration.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  1. using Prism.Mvvm;
  2. using System;
  3. using System.Collections.ObjectModel;
  4. using System.Reflection;
  5. using System.Windows;
  6. using TeamAAS_VP.Enums;
  7. namespace TeamAAS_VP.Models
  8. {
  9. /// <summary>
  10. /// 系统配置:保存软件版本、标题、语言、字体大小等全局设置。
  11. /// </summary>
  12. public class SystemConfiguration : BindableBase
  13. {
  14. public SystemConfiguration()
  15. {
  16. // 尝试从程序集信息读取版本号作为默认值
  17. try
  18. {
  19. var version = Assembly.GetEntryAssembly()?.GetName()?.Version?.ToString();
  20. if (string.IsNullOrEmpty(version))
  21. {
  22. version = Assembly.GetExecutingAssembly()?.GetName()?.Version?.ToString();
  23. }
  24. SoftwareVersion = version ?? "1.0.0.0";
  25. }
  26. catch
  27. {
  28. SoftwareVersion = "1.0.0.0";
  29. }
  30. Title = "Team Vision";
  31. CompanyTitle = "江苏新惕姆智能装备有限公司";
  32. CurrentLanguage = Language.ChineseSimplified;
  33. Font = new FontSizeSettings();
  34. }
  35. private string _softwareVersion;
  36. /// <summary>
  37. /// 软件版本号
  38. /// </summary>
  39. public string SoftwareVersion
  40. {
  41. get => _softwareVersion;
  42. set => SetProperty(ref _softwareVersion, value);
  43. }
  44. private string _title;
  45. /// <summary>
  46. /// 软件标题
  47. /// </summary>
  48. public string Title
  49. {
  50. get => _title;
  51. set => SetProperty(ref _title, value);
  52. }
  53. private string _companyTitle;
  54. /// <summary>
  55. /// 公司名称/标题
  56. /// </summary>
  57. public string CompanyTitle
  58. {
  59. get => _companyTitle;
  60. set => SetProperty(ref _companyTitle, value);
  61. }
  62. private Language _currentLanguage;
  63. /// <summary>
  64. /// 当前语言
  65. /// </summary>
  66. public Language CurrentLanguage
  67. {
  68. get => _currentLanguage;
  69. set => SetProperty(ref _currentLanguage, value);
  70. }
  71. private FontSizeSettings _font;
  72. /// <summary>
  73. /// 字体大小配置
  74. /// </summary>
  75. public FontSizeSettings Font
  76. {
  77. get => _font;
  78. set => SetProperty(ref _font, value);
  79. }
  80. private Guid _lastOpenedProductId = Guid.Empty;
  81. /// <summary>
  82. /// 最近打开的产品 ID(可用于自动加载)
  83. /// </summary>
  84. public Guid LastOpenedProductId
  85. {
  86. get => _lastOpenedProductId;
  87. set => SetProperty(ref _lastOpenedProductId, value);
  88. }
  89. // 新增相机/拍照/检测计数属性
  90. private Int16 _WorkMode = 0;
  91. /// <summary>
  92. /// 工作模式 =1 拍1打1 =2 拍1打所有 =3先拍1打1打3颗再拍2打所有
  93. /// </summary>
  94. public Int16 WorkMode
  95. {
  96. get { return _WorkMode; }
  97. set { SetProperty(ref _WorkMode, value); }
  98. }
  99. private Int16 _PickPointNum = 0;
  100. /// <summary>
  101. /// 取料位置 =0 不需要取料 =1 需要取料
  102. /// </summary>
  103. public Int16 PickPointNum
  104. {
  105. get { return _PickPointNum; }
  106. set { SetProperty(ref _PickPointNum, value); }
  107. }
  108. private double _JumpLimitZ = 0;
  109. /// <summary>
  110. /// 取料位置 =0 不需要取料 =1 需要取料
  111. /// </summary>
  112. public double JumpLimitZ
  113. {
  114. get { return _JumpLimitZ; }
  115. set { SetProperty(ref _JumpLimitZ, value); }
  116. }
  117. private Int16 _DowmCameraNum = 0;
  118. /// <summary>
  119. /// 相机拍照次数
  120. /// </summary>
  121. public Int16 DowmCameraNum
  122. {
  123. get => _DowmCameraNum;
  124. set => SetProperty(ref _DowmCameraNum, value);
  125. }
  126. private Int16 _UpCameraPickNum = 0;
  127. /// <summary>
  128. /// 上相机取料拍照次数
  129. /// </summary>
  130. public Int16 UpCameraPickNum
  131. {
  132. get => _UpCameraPickNum;
  133. set => SetProperty(ref _UpCameraPickNum, value);
  134. }
  135. private Int16 _UpCameraPutNum = 0;
  136. /// <summary>
  137. /// 上相机放料拍照次数
  138. /// </summary>
  139. public Int16 UpCameraPutNum
  140. {
  141. get => _UpCameraPutNum;
  142. set => SetProperty(ref _UpCameraPutNum, value);
  143. }
  144. private Int16 _UPCameracheckNum = 0;
  145. /// <summary>
  146. /// 上相机锁附/组装次数
  147. /// </summary>
  148. public Int16 UPCameracheckNum
  149. {
  150. get => _UPCameracheckNum;
  151. set => SetProperty(ref _UPCameracheckNum, value);
  152. }
  153. private Int16 _FixedCameraPickNum = 0;
  154. /// <summary>
  155. /// 取料固定位置拍产品相机数量
  156. /// </summary>
  157. public Int16 FixedCameraPickNum
  158. {
  159. get => _FixedCameraPickNum;
  160. set => SetProperty(ref _FixedCameraPickNum, value);
  161. }
  162. private Int16 _FixedCameraPutNum = 0;
  163. /// <summary>
  164. /// 锁附/组装固定位置拍产品相机数量
  165. /// </summary>
  166. public Int16 FixedCameraPutNum
  167. {
  168. get => _FixedCameraPutNum;
  169. set => SetProperty(ref _FixedCameraPutNum, value);
  170. }
  171. private Int16 _FixedCameracheckNum = 0;
  172. /// <summary>
  173. /// 固定相机检测锁附/组装次数
  174. /// </summary>
  175. public Int16 FixedCameracheckNum
  176. {
  177. get => _FixedCameracheckNum;
  178. set => SetProperty(ref _FixedCameracheckNum, value);
  179. }
  180. private Int16 _ScrewTeachNum = 0;
  181. /// <summary>
  182. /// 披头矫正的模式,1:初始化时矫正,2:每个产品矫正一次,3:每颗螺丝矫正一次
  183. /// </summary>
  184. public Int16 ScrewTeachNum
  185. {
  186. get => _ScrewTeachNum;
  187. set => SetProperty(ref _ScrewTeachNum, value);
  188. }
  189. private ObservableCollection<PressureSensorSettings> _PressureSensorConfig;
  190. /// <summary>
  191. /// 压力传感器配置列表
  192. /// </summary>
  193. public ObservableCollection<PressureSensorSettings> PressureSensorConfig
  194. {
  195. get { return _PressureSensorConfig; }
  196. set { SetProperty(ref _PressureSensorConfig, value); }
  197. }
  198. private bool _IsSaveScrewCurve = false;
  199. /// <summary>
  200. /// 是否保存锁付曲线图
  201. /// </summary>
  202. public bool IsSaveScrewCurve
  203. {
  204. get => _IsSaveScrewCurve;
  205. set => SetProperty(ref _IsSaveScrewCurve, value);
  206. }
  207. private string _ScrewCurvePath = "";
  208. /// <summary>
  209. /// 锁付曲线图保存的文件夹路径
  210. /// </summary>
  211. public string ScrewCurvePath
  212. {
  213. get => _ScrewCurvePath;
  214. set => SetProperty(ref _ScrewCurvePath, value);
  215. }
  216. private bool _IsBasePartCodeGetSN = false;
  217. /// <summary>
  218. /// 是否基于零件码获取流程码
  219. /// </summary>
  220. public bool IsBasePartCodeGetSN
  221. {
  222. get { return _IsBasePartCodeGetSN; }
  223. set { SetProperty(ref _IsBasePartCodeGetSN, value); }
  224. }
  225. private bool _IsBasePartCodeChooseScrew = false;
  226. /// <summary>
  227. /// 是否通过零件码判断螺丝型号
  228. /// </summary>
  229. public bool IsBasePartCodeChooseScrew
  230. {
  231. get { return _IsBasePartCodeChooseScrew; }
  232. set { SetProperty(ref _IsBasePartCodeChooseScrew, value); }
  233. }
  234. private bool _IsBasePartOpenLight = false;
  235. /// <summary>
  236. /// 是否启用最后一次拍照关闭光源
  237. /// </summary>
  238. public bool IsBasePartOpenLight
  239. {
  240. get { return _IsBasePartOpenLight; }
  241. set { SetProperty(ref _IsBasePartOpenLight, value); }
  242. }
  243. private bool _IsBasePartOpenLightKB = false;
  244. /// <summary>
  245. /// 是否启用KB复检
  246. /// </summary>
  247. public bool IsBasePartOpenLightKB
  248. {
  249. get { return _IsBasePartOpenLightKB; }
  250. set { SetProperty(ref _IsBasePartOpenLightKB, value); }
  251. }
  252. private string _ChooseScrewModel = "***********abc123****";
  253. /// <summary>
  254. /// 螺丝型号判断,如******123**,*为忽略字符
  255. /// </summary>
  256. public string ChooseScrewModel
  257. {
  258. get { return _ChooseScrewModel; }
  259. set { SetProperty(ref _ChooseScrewModel, value); }
  260. }
  261. private bool _DoubleSoftMode = false;
  262. /// <summary>
  263. /// 双软件模式
  264. /// </summary>
  265. public bool DoubleSoftMode
  266. {
  267. get => _DoubleSoftMode;
  268. set => SetProperty(ref _DoubleSoftMode, value);
  269. }
  270. /// <summary>
  271. /// 字体大小子设置
  272. /// </summary>
  273. public class FontSizeSettings : BindableBase
  274. {
  275. private double _title1 = 20;
  276. public double Title1 { get => _title1; set => SetProperty(ref _title1, value); }
  277. private double _title2 = 18;
  278. public double Title2 { get => _title2; set => SetProperty(ref _title2, value); }
  279. private double _title3 = 16;
  280. public double Title3 { get => _title3; set => SetProperty(ref _title3, value); }
  281. private double _title4 = 14;
  282. public double Title4 { get => _title4; set => SetProperty(ref _title4, value); }
  283. private double _body1 = 15;
  284. public double Body1 { get => _body1; set => SetProperty(ref _body1, value); }
  285. private double _body2 = 14;
  286. public double Body2 { get => _body2; set => SetProperty(ref _body2, value); }
  287. private double _body3 = 13;
  288. public double Body3 { get => _body3; set => SetProperty(ref _body3, value); }
  289. private double _body4 = 12;
  290. public double Body4 { get => _body4; set => SetProperty(ref _body4, value); }
  291. private double _captions1 = 11;
  292. public double Captions1 { get => _captions1; set => SetProperty(ref _captions1, value); }
  293. private double _captions2 = 10;
  294. public double Captions2 { get => _captions2; set => SetProperty(ref _captions2, value); }
  295. private double _captions3 = 9;
  296. public double Captions3 { get => _captions3; set => SetProperty(ref _captions3, value); }
  297. private double _captions4 = 8;
  298. public double Captions4 { get => _captions4; set => SetProperty(ref _captions4, value); }
  299. }
  300. /// <summary>
  301. /// 压力传感器配置
  302. /// </summary>
  303. public class PressureSensorSettings : BindableBase
  304. {
  305. private string _sensorName;
  306. /// <summary>
  307. /// 压力传感器的名称
  308. /// </summary>
  309. public string SensorName
  310. {
  311. get => _sensorName;
  312. set => SetProperty(ref _sensorName, value);
  313. }
  314. private int _sensorId;
  315. /// <summary>
  316. /// 压力传感器的编号
  317. /// </summary>
  318. public int SensorId
  319. {
  320. get => _sensorId;
  321. set => SetProperty(ref _sensorId, value);
  322. }
  323. private bool _IsSavePressureCurve;
  324. /// <summary>
  325. /// 是否保存压力曲线图
  326. /// </summary>
  327. public bool IsSavePressureCurve
  328. {
  329. get => _IsSavePressureCurve;
  330. set => SetProperty(ref _IsSavePressureCurve, value);
  331. }
  332. private string _pressureCurvePath;
  333. /// <summary>
  334. /// 压力曲线图保存路径
  335. /// </summary>
  336. public string PressureCurvePath
  337. {
  338. get => _pressureCurvePath;
  339. set => SetProperty(ref _pressureCurvePath, value);
  340. }
  341. }
  342. }
  343. }