SystemConfiguration.cs 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. using Prism.Mvvm;
  2. using System;
  3. using System.Collections.ObjectModel;
  4. using System.Reflection;
  5. using TeamAAS_VP.Enums;
  6. namespace TeamAAS_VP.Models
  7. {
  8. /// <summary>
  9. /// 系统配置:保存软件版本、标题、语言、字体大小等全局设置。
  10. /// </summary>
  11. public class SystemConfiguration : BindableBase
  12. {
  13. public SystemConfiguration()
  14. {
  15. // 尝试从程序集信息读取版本号作为默认值
  16. try
  17. {
  18. var version = Assembly.GetEntryAssembly()?.GetName()?.Version?.ToString();
  19. if (string.IsNullOrEmpty(version))
  20. {
  21. version = Assembly.GetExecutingAssembly()?.GetName()?.Version?.ToString();
  22. }
  23. SoftwareVersion = version ?? "1.0.0.0";
  24. }
  25. catch
  26. {
  27. SoftwareVersion = "1.0.0.0";
  28. }
  29. Title = "Team Vision";
  30. CompanyTitle = "江苏新惕姆智能装备有限公司";
  31. CurrentLanguage = Language.ChineseSimplified;
  32. Font = new FontSizeSettings();
  33. }
  34. private string _softwareVersion;
  35. /// <summary>
  36. /// 软件版本号
  37. /// </summary>
  38. public string SoftwareVersion
  39. {
  40. get => _softwareVersion;
  41. set => SetProperty(ref _softwareVersion, value);
  42. }
  43. private string _title;
  44. /// <summary>
  45. /// 软件标题
  46. /// </summary>
  47. public string Title
  48. {
  49. get => _title;
  50. set => SetProperty(ref _title, value);
  51. }
  52. private string _companyTitle;
  53. /// <summary>
  54. /// 公司名称/标题
  55. /// </summary>
  56. public string CompanyTitle
  57. {
  58. get => _companyTitle;
  59. set => SetProperty(ref _companyTitle, value);
  60. }
  61. private Language _currentLanguage;
  62. /// <summary>
  63. /// 当前语言
  64. /// </summary>
  65. public Language CurrentLanguage
  66. {
  67. get => _currentLanguage;
  68. set => SetProperty(ref _currentLanguage, value);
  69. }
  70. private FontSizeSettings _font;
  71. /// <summary>
  72. /// 字体大小配置
  73. /// </summary>
  74. public FontSizeSettings Font
  75. {
  76. get => _font;
  77. set => SetProperty(ref _font, value);
  78. }
  79. private Guid _lastOpenedProductId = Guid.Empty;
  80. /// <summary>
  81. /// 最近打开的产品 ID(可用于自动加载)
  82. /// </summary>
  83. public Guid LastOpenedProductId
  84. {
  85. get => _lastOpenedProductId;
  86. set => SetProperty(ref _lastOpenedProductId, value);
  87. }
  88. // 新增相机/拍照/检测计数属性
  89. private Int16 _WorkMode = 0;
  90. /// <summary>
  91. /// 工作模式 =1 拍1打1 =2 拍1打所有
  92. /// </summary>
  93. public Int16 WorkMode
  94. {
  95. get { return _WorkMode; }
  96. set { SetProperty(ref _WorkMode, value); }
  97. }
  98. private Int16 _PickPointNum = 0;
  99. /// <summary>
  100. /// 取料位置 =0 不需要取料 =1 需要取料
  101. /// </summary>
  102. public Int16 PickPointNum
  103. {
  104. get { return _PickPointNum; }
  105. set { SetProperty(ref _PickPointNum, value); }
  106. }
  107. private Int16 _DowmCameraNum = 0;
  108. /// <summary>
  109. /// 相机拍照次数
  110. /// </summary>
  111. public Int16 DowmCameraNum
  112. {
  113. get => _DowmCameraNum;
  114. set => SetProperty(ref _DowmCameraNum, value);
  115. }
  116. private Int16 _UpCameraPickNum = 0;
  117. /// <summary>
  118. /// 上相机取料拍照次数
  119. /// </summary>
  120. public Int16 UpCameraPickNum
  121. {
  122. get => _UpCameraPickNum;
  123. set => SetProperty(ref _UpCameraPickNum, value);
  124. }
  125. private Int16 _UpCameraPutNum = 0;
  126. /// <summary>
  127. /// 上相机放料拍照次数
  128. /// </summary>
  129. public Int16 UpCameraPutNum
  130. {
  131. get => _UpCameraPutNum;
  132. set => SetProperty(ref _UpCameraPutNum, value);
  133. }
  134. private Int16 _UPCameracheckNum = 0;
  135. /// <summary>
  136. /// 上相机锁附/组装次数
  137. /// </summary>
  138. public Int16 UPCameracheckNum
  139. {
  140. get => _UPCameracheckNum;
  141. set => SetProperty(ref _UPCameracheckNum, value);
  142. }
  143. private Int16 _FixedCameraPickNum = 0;
  144. /// <summary>
  145. /// 取料固定位置拍产品相机数量
  146. /// </summary>
  147. public Int16 FixedCameraPickNum
  148. {
  149. get => _FixedCameraPickNum;
  150. set => SetProperty(ref _FixedCameraPickNum, value);
  151. }
  152. private Int16 _FixedCameraPutNum = 0;
  153. /// <summary>
  154. /// 锁附/组装固定位置拍产品相机数量
  155. /// </summary>
  156. public Int16 FixedCameraPutNum
  157. {
  158. get => _FixedCameraPutNum;
  159. set => SetProperty(ref _FixedCameraPutNum, value);
  160. }
  161. private Int16 _FixedCameracheckNum = 0;
  162. /// <summary>
  163. /// 固定相机检测锁附/组装次数
  164. /// </summary>
  165. public Int16 FixedCameracheckNum
  166. {
  167. get => _FixedCameracheckNum;
  168. set => SetProperty(ref _FixedCameracheckNum, value);
  169. }
  170. private Int16 _ScrewTeachNum = 0;
  171. /// <summary>
  172. /// 披头矫正的模式,1:初始化时矫正,2:每个产品矫正一次,3:每颗螺丝矫正一次
  173. /// </summary>
  174. public Int16 ScrewTeachNum
  175. {
  176. get => _ScrewTeachNum;
  177. set => SetProperty(ref _ScrewTeachNum, value);
  178. }
  179. private ObservableCollection<PressureSensorSettings> _PressureSensorConfig;
  180. /// <summary>
  181. /// 压力传感器配置列表
  182. /// </summary>
  183. public ObservableCollection<PressureSensorSettings> PressureSensorConfig
  184. {
  185. get { return _PressureSensorConfig; }
  186. set { SetProperty(ref _PressureSensorConfig, value); }
  187. }
  188. /// <summary>
  189. /// 字体大小子设置
  190. /// </summary>
  191. public class FontSizeSettings : BindableBase
  192. {
  193. private double _title1 = 20;
  194. public double Title1 { get => _title1; set => SetProperty(ref _title1, value); }
  195. private double _title2 = 18;
  196. public double Title2 { get => _title2; set => SetProperty(ref _title2, value); }
  197. private double _title3 = 16;
  198. public double Title3 { get => _title3; set => SetProperty(ref _title3, value); }
  199. private double _title4 = 14;
  200. public double Title4 { get => _title4; set => SetProperty(ref _title4, value); }
  201. private double _body1 = 15;
  202. public double Body1 { get => _body1; set => SetProperty(ref _body1, value); }
  203. private double _body2 = 14;
  204. public double Body2 { get => _body2; set => SetProperty(ref _body2, value); }
  205. private double _body3 = 13;
  206. public double Body3 { get => _body3; set => SetProperty(ref _body3, value); }
  207. private double _body4 = 12;
  208. public double Body4 { get => _body4; set => SetProperty(ref _body4, value); }
  209. private double _captions1 = 11;
  210. public double Captions1 { get => _captions1; set => SetProperty(ref _captions1, value); }
  211. private double _captions2 = 10;
  212. public double Captions2 { get => _captions2; set => SetProperty(ref _captions2, value); }
  213. private double _captions3 = 9;
  214. public double Captions3 { get => _captions3; set => SetProperty(ref _captions3, value); }
  215. private double _captions4 = 8;
  216. public double Captions4 { get => _captions4; set => SetProperty(ref _captions4, value); }
  217. }
  218. /// <summary>
  219. /// 压力传感器配置
  220. /// </summary>
  221. public class PressureSensorSettings : BindableBase
  222. {
  223. private string _sensorName;
  224. /// <summary>
  225. /// 压力传感器的名称
  226. /// </summary>
  227. public string SensorName
  228. {
  229. get => _sensorName;
  230. set => SetProperty(ref _sensorName, value);
  231. }
  232. private int _sensorId;
  233. /// <summary>
  234. /// 压力传感器的编号
  235. /// </summary>
  236. public int SensorId
  237. {
  238. get => _sensorId;
  239. set => SetProperty(ref _sensorId, value);
  240. }
  241. private bool _IsSavePressureCurve;
  242. /// <summary>
  243. /// 是否保存压力曲线图
  244. /// </summary>
  245. public bool IsSavePressureCurve
  246. {
  247. get => _IsSavePressureCurve;
  248. set => SetProperty(ref _IsSavePressureCurve, value);
  249. }
  250. private string _pressureCurvePath;
  251. /// <summary>
  252. /// 压力曲线图保存路径
  253. /// </summary>
  254. public string PressureCurvePath
  255. {
  256. get => _pressureCurvePath;
  257. set => SetProperty(ref _pressureCurvePath, value);
  258. }
  259. }
  260. }
  261. }