COM_STL_COMMAND.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. using System;
  2. using System.Collections;
  3. using System.Data;
  4. using System.Diagnostics;
  5. using System.Reflection;
  6. namespace Core.StlMes.Client.LgClassModel
  7. {
  8. [Serializable]
  9. public class COM_STL_COMMAND
  10. {
  11. private string _id_ = ""; //ID
  12. private string _stationcode = ""; //岗位编号(如:BOF、CAS)
  13. private decimal _sortid = 0; //岗位编号内顺序
  14. private string _opttype = ""; //操作类型(1:正常操作、2:异常操作、3:切换岗位信息)
  15. private string _objectpos = ""; //执行目标位置(如:LFS01_DEVICE)
  16. private string _optcaption = ""; //操作说明
  17. /// <summary>
  18. /// 操作命令类型:
  19. /// TAPPING:出钢;
  20. /// GONEXT:出下道工序;
  21. /// ASSIGNEDPOS:指定位置;
  22. /// ARRIVE:进站/上台;
  23. /// LEAVE:出站/下台;
  24. /// TRANS:位置对换;
  25. /// OPENCAST:开浇;
  26. /// STOPCAST:停浇;
  27. /// OVER:强制结束;
  28. /// SWITCH:切换信息显示;
  29. /// MELTDOWN:钢水回炉
  30. /// </summary>
  31. private COM_STL_COMMAND_CMDTYPE _optcommandtype = COM_STL_COMMAND_CMDTYPE.NONE;
  32. private string _filedname01 = ""; //更新时间字段名称1
  33. private string _filedname02 = ""; //更新时间字段名称2
  34. private string _filedname03 = ""; //更新时间字段名称3
  35. private string _visible_idle = ""; //IDLE位可见
  36. private string _visible_front = ""; //FRONT位可见
  37. private string _visible_device = ""; //DEVICE位可见
  38. private string _visible_back = ""; //BACK位可见
  39. /// <summary>
  40. /// ID
  41. /// </summary>
  42. public string ID_
  43. {
  44. get { return this._id_; }
  45. set { if (value != this._id_) this._id_ = value; }
  46. }
  47. /// <summary>
  48. ///岗位编号(如:BOF、CAS)
  49. /// </summary>
  50. public string STATIONCODE
  51. {
  52. get { return this._stationcode; }
  53. set { if (value != this._stationcode) this._stationcode = value; }
  54. }
  55. /// <summary>
  56. /// 岗位编号内顺序
  57. /// </summary>
  58. public decimal SORTID
  59. {
  60. get { return this._sortid; }
  61. set { if (value != this._sortid) this._sortid = value; }
  62. }
  63. /// <summary>
  64. /// 操作类型(1:正常操作、2:异常操作、3:切换岗位信息)
  65. /// </summary>
  66. public string OPTTYPE
  67. {
  68. get { return this._opttype; }
  69. set { if (value != this._opttype) this._opttype = value; }
  70. }
  71. /// <summary>
  72. /// 执行目标位置(如:LFS01_DEVICE)
  73. /// </summary>
  74. public string OBJECTPOS
  75. {
  76. get { return this._objectpos; }
  77. set { if (value != this._objectpos) this._objectpos = value; }
  78. }
  79. /// <summary>
  80. /// 操作说明
  81. /// </summary>
  82. public string OPTCAPTION
  83. {
  84. get { return this._optcaption; }
  85. set { if (value != this._optcaption) this._optcaption = value; }
  86. }
  87. /// <summary>
  88. /// 操作命令类型:
  89. /// TAPPING:出钢;
  90. /// GONEXT:出下道工序;
  91. /// ASSIGNEDPOS:指定位置;
  92. /// ARRIVE:进站/上台;
  93. /// LEAVE:出站/下台;
  94. /// TRANS:位置对换;
  95. /// OPENCAST:开浇;
  96. /// STOPCAST:停浇;
  97. /// OVER:强制结束;
  98. /// SWITCH:切换信息显示;
  99. /// MELTDOWN:钢水回炉
  100. /// </summary>
  101. public COM_STL_COMMAND_CMDTYPE OPTCOMMANDTYPE
  102. {
  103. get { return this._optcommandtype; }
  104. set { if (value != this._optcommandtype) this._optcommandtype = value; }
  105. }
  106. /// <summary>
  107. /// 更新时间字段名称1
  108. /// </summary>
  109. public string FILEDNAME01
  110. {
  111. get { return this._filedname01; }
  112. set { if (value != this._filedname01) this._filedname01 = value; }
  113. }
  114. /// <summary>
  115. /// 更新时间字段名称2
  116. /// </summary>
  117. public string FILEDNAME02
  118. {
  119. get { return this._filedname02; }
  120. set { if (value != this._filedname02) this._filedname02 = value; }
  121. }
  122. /// <summary>
  123. /// 更新时间字段名称3
  124. /// </summary>
  125. public string FILEDNAME03
  126. {
  127. get { return this._filedname03; }
  128. set { if (value != this._filedname03) this._filedname03 = value; }
  129. }
  130. /// <summary>
  131. /// IDLE位可见
  132. /// </summary>
  133. public string VISIBLE_IDLE
  134. {
  135. get { return this._visible_idle; }
  136. set { if (value != this._visible_idle) this._visible_idle = value; }
  137. }
  138. /// <summary>
  139. /// FRONT位可见
  140. /// </summary>
  141. public string VISIBLE_FRONT
  142. {
  143. get { return this._visible_front; }
  144. set { if (value != this._visible_front) this._visible_front = value; }
  145. }
  146. /// <summary>
  147. /// DEVICE位可见
  148. /// </summary>
  149. public string VISIBLE_DEVICE
  150. {
  151. get { return this._visible_device; }
  152. set { if (value != this._visible_device) this._visible_device = value; }
  153. }
  154. /// <summary>
  155. /// BACK位可见
  156. /// </summary>
  157. public string VISIBLE_BACK
  158. {
  159. get { return this._visible_back; }
  160. set { if (value != this._visible_back) this._visible_back = value; }
  161. }
  162. /// <summary>
  163. /// 数据重置
  164. /// </summary>
  165. public void Reset()
  166. {
  167. PropertyInfo[] PropertyInfos = this.GetType().GetProperties();
  168. if (PropertyInfos == null || PropertyInfos.Length == 0) return;
  169. object value = null;
  170. foreach (PropertyInfo oPropertyInfo in PropertyInfos)
  171. {
  172. try
  173. {
  174. if (oPropertyInfo.Name.ToUpper().Equals("OPTCOMMANDTYPE"))
  175. oPropertyInfo.SetValue(this, COM_STL_COMMAND_CMDTYPE.NONE, null);
  176. else
  177. oPropertyInfo.SetValue(this, value, null);
  178. }
  179. catch (Exception ex)
  180. {
  181. Debug.Print(ex.Message);
  182. }
  183. }
  184. }
  185. /// <summary>
  186. /// 复制
  187. /// </summary>
  188. /// <param name="par"></param>
  189. public void Copy(ref STL_IRON_ARRIVE par)
  190. {
  191. if (par != null)
  192. {
  193. PropertyInfo[] PropertyInfos = this.GetType().GetProperties();
  194. if (PropertyInfos == null || PropertyInfos.Length == 0) return;
  195. object value;
  196. foreach (PropertyInfo oPropertyInfo in PropertyInfos)
  197. {
  198. try
  199. {
  200. value = oPropertyInfo.GetValue(par, null);
  201. oPropertyInfo.SetValue(this, value, null);
  202. }
  203. catch (Exception ex)
  204. {
  205. Debug.Print(ex.Message);
  206. }
  207. }
  208. }
  209. }
  210. /// <summary>
  211. ///设置数据
  212. /// </summary>
  213. /// <param name="Row"></param>
  214. public void SetData(DataRow Row)
  215. {
  216. if (Row == null) return;
  217. PropertyInfo[] PropertyInfos = this.GetType().GetProperties();
  218. if (PropertyInfos == null || PropertyInfos.Length == 0) return;
  219. COM_STL_COMMAND_CMDTYPE cmdType = COM_STL_COMMAND_CMDTYPE.NONE;
  220. foreach (PropertyInfo oPropertyInfo in PropertyInfos)
  221. {
  222. try
  223. {
  224. if (Row.Table.Columns.Contains(oPropertyInfo.Name.ToUpper()))
  225. {
  226. if (oPropertyInfo.Name.ToUpper().Equals("OPTCOMMANDTYPE"))
  227. {
  228. try
  229. {
  230. cmdType = (COM_STL_COMMAND_CMDTYPE)Enum.Parse(typeof(COM_STL_COMMAND_CMDTYPE), Convert.ToString(Row[oPropertyInfo.Name.ToUpper()]), true);
  231. }
  232. catch
  233. {
  234. cmdType = COM_STL_COMMAND_CMDTYPE.NONE;
  235. }
  236. oPropertyInfo.SetValue(this, cmdType, null);
  237. }
  238. else oPropertyInfo.SetValue(this, Row[oPropertyInfo.Name.ToUpper()], null);
  239. }
  240. }
  241. catch (Exception ex)
  242. {
  243. Debug.Print(ex.Message);
  244. }
  245. }
  246. }
  247. }
  248. public class CommandCollection
  249. {
  250. private ArrayList _Keys;
  251. private Hashtable _Values;
  252. public CommandCollection()
  253. {
  254. _Keys = new ArrayList();
  255. _Values = new Hashtable();
  256. }
  257. public bool Contains(COM_STL_COMMAND Item)
  258. {
  259. return (Item != null && _Keys.Contains(Item.ID_));
  260. }
  261. public int Count
  262. {
  263. get
  264. {
  265. return _Keys.Count;
  266. }
  267. }
  268. public COM_STL_COMMAND this[int index]
  269. {
  270. get
  271. {
  272. if (_Keys != null && index >= 0 && index < _Keys.Count)
  273. {
  274. return (COM_STL_COMMAND)_Values[_Keys[index]];
  275. }
  276. return null;
  277. }
  278. }
  279. public COM_STL_COMMAND this[string Key]
  280. {
  281. get
  282. {
  283. if (_Keys != null && _Keys.Contains(Key))
  284. {
  285. return (COM_STL_COMMAND)_Values[Key];
  286. }
  287. return null;
  288. }
  289. }
  290. public COM_STL_COMMAND Add(COM_STL_COMMAND Item)
  291. {
  292. if (Item == null || _Keys.Contains(Item.ID_))
  293. {
  294. return null;
  295. }
  296. else
  297. {
  298. _Keys.Add(Item.ID_);
  299. _Values.Add(Item.ID_, Item);
  300. return Item;
  301. }
  302. }
  303. public void Remove(COM_STL_COMMAND Item)
  304. {
  305. if (Item != null && _Keys.Contains(Item.ID_))
  306. {
  307. _Keys.Remove(Item.ID_);
  308. _Values.Remove(Item.ID_);
  309. }
  310. }
  311. public void RemoveAt(int index)
  312. {
  313. if (index >= 0 && index < _Keys.Count)
  314. {
  315. object obj = _Keys[index];
  316. if (obj != null)
  317. {
  318. _Keys.Remove(obj);
  319. _Values.Remove(obj);
  320. }
  321. }
  322. }
  323. public void RemoveAll()
  324. {
  325. Clear();
  326. }
  327. public void Clear()
  328. {
  329. _Keys.Clear();
  330. _Values.Clear();
  331. }
  332. }
  333. /// <summary>
  334. /// 炼钢作业手动操作命令类型
  335. /// </summary>
  336. public enum COM_STL_COMMAND_CMDTYPE
  337. {
  338. /// <summary>
  339. /// 空
  340. /// </summary>
  341. NONE,
  342. /// <summary>
  343. /// 出钢
  344. /// </summary>
  345. TAPPING,
  346. /// <summary>
  347. /// 出下道工序
  348. /// </summary>
  349. GONEXT,
  350. /// <summary>
  351. /// 指定位置
  352. /// </summary>
  353. ASSIGNEDPOS,
  354. /// <summary>
  355. /// 进站/上台
  356. /// </summary>
  357. ARRIVE,
  358. /// <summary>
  359. /// 出站/下台
  360. /// </summary>
  361. LEAVE,
  362. /// <summary>
  363. /// 位置对换
  364. /// </summary>
  365. TRANS,
  366. /// <summary>
  367. /// 开浇
  368. /// </summary>
  369. OPENCAST,
  370. /// <summary>
  371. /// 停浇
  372. /// </summary>
  373. STOPCAST,
  374. /// <summary>
  375. /// 强制结束
  376. /// </summary>
  377. OVER,
  378. /// <summary>
  379. /// 切换信息显示
  380. /// </summary>
  381. SWITCH,
  382. /// <summary>
  383. /// 钢水回炉
  384. /// </summary>
  385. MELTDOWN,
  386. }
  387. }