终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1135 lines
30 KiB

  1. using FryPot_DosingSystem.AGV;
  2. using Microsoft.Toolkit.Mvvm.ComponentModel;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Collections.ObjectModel;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading;
  9. using System.Threading.Tasks;
  10. using System.Windows;
  11. namespace FryPot_DosingSystem.ViewModel
  12. {
  13. /// <summary>
  14. /// AGV 视图
  15. /// </summary>
  16. public class AgvViewModel : ObservableObject
  17. {
  18. #region 单例模式
  19. private volatile static AgvViewModel _Instance;
  20. public static AgvViewModel GetInstance() => _Instance ?? (_Instance = new AgvViewModel());
  21. public AgvViewModel()
  22. {
  23. Init();
  24. }
  25. #endregion
  26. #region 私有函数
  27. public void Init()
  28. {
  29. //初始化车辆控制
  30. cartModel_1 = new CartModel();
  31. cartModel_2 = new CartModel();
  32. cartModel_3 = new CartModel();
  33. cartModel_4 = new CartModel();
  34. //初始化滚筒线
  35. RollerLines_1 = new RollerLinesModel();
  36. RollerLines_2 = new RollerLinesModel();
  37. RollerLines_3 = new RollerLinesModel();
  38. RollerLines_4 = new RollerLinesModel();
  39. //初始化停车桩
  40. ParkingPileModel_1 = new ParkingPileModel { isBool = IsBool.Yes };
  41. ParkingPileModel_2 = new ParkingPileModel { isBool = IsBool.Yes };
  42. ParkingPileModel_3 = new ParkingPileModel { isBool = IsBool.Yes };
  43. ParkingPileModel_4 = new ParkingPileModel { isBool = IsBool.Yes };
  44. ParkingPileModel_5 = new ParkingPileModel { isBool = IsBool.No };
  45. ParkingPileModel_6 = new ParkingPileModel { isBool = IsBool.No };
  46. //初始化炒锅
  47. wokModel_1 = new WokModel();
  48. wokModel_2 = new WokModel();
  49. wokModel_3 = new WokModel();
  50. wokModel_4 = new WokModel();
  51. wokModel_5 = new WokModel();
  52. // Test();
  53. }
  54. #endregion
  55. #region 公共调用函数
  56. public void Test()
  57. {
  58. RollerLines_2.DishesNum = "3";
  59. wokModel_1.goodsName = "番茄炒蛋";
  60. wokModel_1.workflows = new ObservableCollection<WorkflowModel>
  61. {
  62. new WorkflowModel {id=1,Name="取番茄",isBool= IsBool.Yes},
  63. new WorkflowModel {id=2,Name="取蛋" } };
  64. }
  65. /// <summary>
  66. /// 设置停车桩或充电桩
  67. /// </summary>
  68. /// <param name="id">设置哪一个停车桩:1 2 3(5 6 为充电桩)</param>
  69. /// <param name="isBool">是否有小车</param>
  70. public void Set停车桩(int id, IsBool isBool)
  71. {
  72. try
  73. {
  74. switch (id)
  75. {
  76. case 1:
  77. ParkingPileModel_1.isBool = isBool;
  78. break;
  79. case 2:
  80. ParkingPileModel_2.isBool = isBool;
  81. break;
  82. case 3:
  83. ParkingPileModel_3.isBool = isBool;
  84. break;
  85. case 4:
  86. ParkingPileModel_4.isBool = isBool;
  87. break;
  88. case 5:
  89. ParkingPileModel_5.isBool = isBool;
  90. break;
  91. case 6:
  92. ParkingPileModel_6.isBool = isBool;
  93. break;
  94. }
  95. }
  96. catch (Exception ex)
  97. {
  98. }
  99. }
  100. /// <summary>
  101. /// 小车停止
  102. /// </summary>
  103. /// <param name="id">默认:1 2 3 4,代表四辆车</param>
  104. public void Set小车停止(int id)
  105. {
  106. try
  107. {
  108. switch (id)
  109. {
  110. case 1:
  111. cartModel_1.cartMotionTrajectory = CartMotionTrajectory.Stop;
  112. break;
  113. case 2:
  114. cartModel_2.cartMotionTrajectory = CartMotionTrajectory.Stop;
  115. break;
  116. case 3:
  117. cartModel_3.cartMotionTrajectory = CartMotionTrajectory.Stop;
  118. break;
  119. case 4:
  120. cartModel_4.cartMotionTrajectory = CartMotionTrajectory.Stop;
  121. break;
  122. }
  123. }
  124. catch (Exception ex)
  125. {
  126. }
  127. }
  128. /// <summary>
  129. /// 控制小车运行
  130. /// </summary>
  131. /// <param name="id">默认:1 2 3 4,代表四辆车</param>
  132. /// <param name="cart"></param>
  133. public void Set小车运动(int id, CartMotionTrajectory cart)
  134. {
  135. try
  136. {
  137. switch (id)
  138. {
  139. case 1:
  140. cartModel_1.cartMotionTrajectory = CartMotionTrajectory.Stop;
  141. Thread.Sleep(10);
  142. cartModel_1.cartMotionTrajectory = cart;
  143. break;
  144. case 2:
  145. cartModel_2.cartMotionTrajectory = CartMotionTrajectory.Stop;
  146. Thread.Sleep(10);
  147. cartModel_2.cartMotionTrajectory = cart;
  148. break;
  149. case 3:
  150. cartModel_3.cartMotionTrajectory = CartMotionTrajectory.Stop;
  151. Thread.Sleep(10);
  152. cartModel_3.cartMotionTrajectory = cart;
  153. break;
  154. case 4:
  155. cartModel_4.cartMotionTrajectory = CartMotionTrajectory.Stop;
  156. Thread.Sleep(10);
  157. cartModel_4.cartMotionTrajectory = cart;
  158. break;
  159. }
  160. }
  161. catch (Exception ex)
  162. {
  163. }
  164. }
  165. /// <summary>
  166. /// 小车是否承载物品
  167. /// </summary>
  168. /// <param name="id">默认:1 2 3 4,代表四辆车</param>
  169. /// <param name="cart"></param>
  170. public void Set小车是否承载物品(int id, IsBool cart)
  171. {
  172. try
  173. {
  174. switch (id)
  175. {
  176. case 1:
  177. cartModel_1.isBool = cart;
  178. break;
  179. case 2:
  180. cartModel_2.isBool = cart;
  181. break;
  182. case 3:
  183. cartModel_3.isBool = cart;
  184. break;
  185. case 4:
  186. cartModel_4.isBool = cart;
  187. break;
  188. }
  189. }
  190. catch (Exception ex)
  191. {
  192. }
  193. }
  194. /// <summary>
  195. /// 滚筒线状态
  196. /// </summary>
  197. /// <param name="id">默认:1 2 3 4,代表四条滚筒线,(4 代表空桶线)</param>
  198. /// <param name="cart"></param>
  199. public void Set滚筒线状态(int id, IsRun cart)
  200. {
  201. try
  202. {
  203. switch (id)
  204. {
  205. case 1:
  206. RollerLines_1.isRun = cart;
  207. break;
  208. case 2:
  209. RollerLines_2.isRun = cart;
  210. break;
  211. case 3:
  212. RollerLines_3.isRun = cart;
  213. break;
  214. case 4:
  215. RollerLines_4.isRun = cart;
  216. break;
  217. }
  218. }
  219. catch (Exception ex)
  220. {
  221. }
  222. }
  223. /// <summary>
  224. /// 滚筒线上数量
  225. /// </summary>
  226. /// <param name="id">默认:1 2 3 4,代表四条滚筒线,(4 代表空桶线)</param>
  227. /// <param name="cart">默认: 1 - 8,最多承载 8个菜品或者8个空碗</param>
  228. public void Set滚筒线上数量(int id, string cart)
  229. {
  230. try
  231. {
  232. switch (id)
  233. {
  234. case 1:
  235. RollerLines_1.DishesNum = cart;
  236. break;
  237. case 2:
  238. RollerLines_2.DishesNum = cart;
  239. break;
  240. case 3:
  241. RollerLines_3.DishesNum = cart;
  242. break;
  243. case 4:
  244. RollerLines_4.DishesNum = cart;
  245. break;
  246. }
  247. }
  248. catch (Exception ex)
  249. {
  250. }
  251. }
  252. /// <summary>
  253. /// 设置炒锅显示流程
  254. /// </summary>
  255. /// <param name="id">默认:1 2 3 4 5,代表五个炒锅</param>
  256. /// <param name="mode"></param>
  257. public void Set炒锅显示流程(int id, WokModel mode)
  258. {
  259. try
  260. {
  261. switch (id)
  262. {
  263. case 1:
  264. wokModel_1=mode;
  265. break;
  266. case 2:
  267. wokModel_2 = mode;
  268. break;
  269. case 3:
  270. wokModel_3 = mode;
  271. break;
  272. case 4:
  273. wokModel_4 = mode;
  274. break;
  275. case 5:
  276. wokModel_5 = mode;
  277. break;
  278. }
  279. }
  280. catch (Exception ex)
  281. {
  282. }
  283. }
  284. /// <summary>
  285. /// 启动或停止炒锅
  286. /// </summary>
  287. /// <param name="id">默认:1 2 3 4 5,代表五个炒锅</param>
  288. /// <param name="mode"></param>
  289. public void Set启动或停止炒锅(int id, IsRun mode)
  290. {
  291. try
  292. {
  293. switch (id)
  294. {
  295. case 1:
  296. wokModel_1.isRun= mode;
  297. break;
  298. case 2:
  299. wokModel_2.isRun = mode;
  300. break;
  301. case 3:
  302. wokModel_3.isRun = mode;
  303. break;
  304. case 4:
  305. wokModel_4.isRun = mode;
  306. break;
  307. case 5:
  308. wokModel_5.isRun = mode;
  309. break;
  310. }
  311. }
  312. catch (Exception ex)
  313. {
  314. }
  315. }
  316. #endregion
  317. #region 其他函数
  318. /// <summary>
  319. /// 获取所有命令
  320. /// </summary>
  321. public List<string> GetCommand()
  322. {
  323. List<string> vs = new List<string>();
  324. try
  325. {
  326. vs = System.Enum.GetNames(typeof(CartMotionTrajectory))?.ToList();
  327. }
  328. catch (Exception ex)
  329. {
  330. return vs;
  331. }
  332. return vs;
  333. }
  334. /// <summary>
  335. /// 根据命令获取值
  336. /// </summary>
  337. public CartMotionTrajectory GetCommandValue(string name)
  338. {
  339. return ToEnumValue<CartMotionTrajectory>(name);
  340. }
  341. /// <summary>
  342. /// 根据枚举名称获取枚举值
  343. /// </summary>
  344. public T ToEnumValue<T>(string name)
  345. {
  346. return (T)Enum.Parse(typeof(T), name);
  347. }
  348. #endregion
  349. #region 4个滚筒线控制
  350. /// <summary>
  351. /// 一号滚筒线
  352. /// </summary>
  353. private RollerLinesModel _RollerLines_1;
  354. public RollerLinesModel RollerLines_1
  355. {
  356. get
  357. {
  358. return _RollerLines_1;
  359. }
  360. set
  361. {
  362. if (_RollerLines_1 == value)
  363. return;
  364. _RollerLines_1 = value;
  365. OnPropertyChanged("RollerLines_1");
  366. }
  367. }
  368. /// <summary>
  369. /// 二号滚筒线
  370. /// </summary>
  371. private RollerLinesModel _RollerLines_2;
  372. public RollerLinesModel RollerLines_2
  373. {
  374. get
  375. {
  376. return _RollerLines_2;
  377. }
  378. set
  379. {
  380. if (_RollerLines_2 == value)
  381. return;
  382. _RollerLines_2 = value;
  383. OnPropertyChanged("RollerLines_2");
  384. }
  385. }
  386. /// <summary>
  387. /// 三号滚筒线
  388. /// </summary>
  389. private RollerLinesModel _RollerLines_3;
  390. public RollerLinesModel RollerLines_3
  391. {
  392. get
  393. {
  394. return _RollerLines_3;
  395. }
  396. set
  397. {
  398. if (_RollerLines_3 == value)
  399. return;
  400. _RollerLines_3 = value;
  401. OnPropertyChanged("RollerLines_3");
  402. }
  403. }
  404. /// <summary>
  405. /// 四号滚筒线
  406. /// </summary>
  407. private RollerLinesModel _RollerLines_4;
  408. public RollerLinesModel RollerLines_4
  409. {
  410. get
  411. {
  412. return _RollerLines_4;
  413. }
  414. set
  415. {
  416. if (_RollerLines_4 == value)
  417. return;
  418. _RollerLines_4 = value;
  419. OnPropertyChanged("RollerLines_4");
  420. }
  421. }
  422. #endregion
  423. #region 4个运动小车控制
  424. /// <summary>
  425. /// 一号车控制
  426. /// </summary>
  427. private CartModel _cartModel_1;
  428. public CartModel cartModel_1
  429. {
  430. get
  431. {
  432. return _cartModel_1;
  433. }
  434. set
  435. {
  436. if (_cartModel_1 == value)
  437. return;
  438. _cartModel_1 = value;
  439. OnPropertyChanged("cartModel_1");
  440. }
  441. }
  442. /// <summary>
  443. /// 二号车控制
  444. /// </summary>
  445. private CartModel _cartModel_2;
  446. public CartModel cartModel_2
  447. {
  448. get
  449. {
  450. return _cartModel_2;
  451. }
  452. set
  453. {
  454. if (_cartModel_2 == value)
  455. return;
  456. _cartModel_2 = value;
  457. OnPropertyChanged("cartModel_2");
  458. }
  459. }
  460. /// <summary>
  461. /// 三号车控制
  462. /// </summary>
  463. private CartModel _cartModel_3;
  464. public CartModel cartModel_3
  465. {
  466. get
  467. {
  468. return _cartModel_3;
  469. }
  470. set
  471. {
  472. if (_cartModel_3 == value)
  473. return;
  474. _cartModel_3 = value;
  475. OnPropertyChanged("cartModel_3");
  476. }
  477. }
  478. /// <summary>
  479. /// 四号车控制
  480. /// </summary>
  481. private CartModel _cartModel_4;
  482. public CartModel cartModel_4
  483. {
  484. get
  485. {
  486. return _cartModel_4;
  487. }
  488. set
  489. {
  490. if (_cartModel_4 == value)
  491. return;
  492. _cartModel_4 = value;
  493. OnPropertyChanged("cartModel_4");
  494. }
  495. }
  496. #endregion
  497. #region 6个停车桩控制
  498. /// <summary>
  499. /// 一号停车装
  500. /// </summary>
  501. private ParkingPileModel _ParkingPileModel_1;
  502. public ParkingPileModel ParkingPileModel_1
  503. {
  504. get
  505. {
  506. return _ParkingPileModel_1;
  507. }
  508. set
  509. {
  510. if (_ParkingPileModel_1 == value)
  511. return;
  512. _ParkingPileModel_1 = value;
  513. OnPropertyChanged("ParkingPileModel_1");
  514. }
  515. }
  516. /// <summary>
  517. /// 二号停车装
  518. /// </summary>
  519. private ParkingPileModel _ParkingPileModel_2;
  520. public ParkingPileModel ParkingPileModel_2
  521. {
  522. get
  523. {
  524. return _ParkingPileModel_2;
  525. }
  526. set
  527. {
  528. if (_ParkingPileModel_2 == value)
  529. return;
  530. _ParkingPileModel_2 = value;
  531. OnPropertyChanged("ParkingPileModel_2");
  532. }
  533. }
  534. /// <summary>
  535. /// 三号停车装
  536. /// </summary>
  537. private ParkingPileModel _ParkingPileModel_3;
  538. public ParkingPileModel ParkingPileModel_3
  539. {
  540. get
  541. {
  542. return _ParkingPileModel_3;
  543. }
  544. set
  545. {
  546. if (_ParkingPileModel_3 == value)
  547. return;
  548. _ParkingPileModel_3 = value;
  549. OnPropertyChanged("ParkingPileModel_3");
  550. }
  551. }
  552. /// <summary>
  553. /// 四号停车装
  554. /// </summary>
  555. private ParkingPileModel _ParkingPileModel_4;
  556. public ParkingPileModel ParkingPileModel_4
  557. {
  558. get
  559. {
  560. return _ParkingPileModel_4;
  561. }
  562. set
  563. {
  564. if (_ParkingPileModel_4 == value)
  565. return;
  566. _ParkingPileModel_4 = value;
  567. OnPropertyChanged("ParkingPileModel_4");
  568. }
  569. }
  570. /// <summary>
  571. /// 五号停车装
  572. /// </summary>
  573. private ParkingPileModel _ParkingPileModel_5;
  574. public ParkingPileModel ParkingPileModel_5
  575. {
  576. get
  577. {
  578. return _ParkingPileModel_5;
  579. }
  580. set
  581. {
  582. if (_ParkingPileModel_5 == value)
  583. return;
  584. _ParkingPileModel_5 = value;
  585. OnPropertyChanged("ParkingPileModel_5");
  586. }
  587. }
  588. /// <summary>
  589. /// 六号停车装
  590. /// </summary>
  591. private ParkingPileModel _ParkingPileModel_6;
  592. public ParkingPileModel ParkingPileModel_6
  593. {
  594. get
  595. {
  596. return _ParkingPileModel_6;
  597. }
  598. set
  599. {
  600. if (_ParkingPileModel_6 == value)
  601. return;
  602. _ParkingPileModel_6 = value;
  603. OnPropertyChanged("ParkingPileModel_6");
  604. }
  605. }
  606. #endregion
  607. #region 5个炒锅流程控制
  608. /// <summary>
  609. /// 一号炒锅工作流程
  610. /// </summary>
  611. private WokModel _wokModel_1;
  612. public WokModel wokModel_1
  613. {
  614. get
  615. {
  616. if (_wokModel_1 == null)
  617. {
  618. _wokModel_1 = new WokModel();
  619. }
  620. return _wokModel_1;
  621. }
  622. set
  623. {
  624. if (_wokModel_1 == value)
  625. return;
  626. _wokModel_1 = value;
  627. OnPropertyChanged("wokModel_1");
  628. }
  629. }
  630. /// <summary>
  631. /// 二号炒锅工作流程
  632. /// </summary>
  633. private WokModel _wokModel_2;
  634. public WokModel wokModel_2
  635. {
  636. get
  637. {
  638. return _wokModel_2;
  639. }
  640. set
  641. {
  642. if (_wokModel_2 == value)
  643. return;
  644. _wokModel_2 = value;
  645. OnPropertyChanged("wokModel_2");
  646. }
  647. }
  648. /// <summary>
  649. /// 三号炒锅工作流程
  650. /// </summary>
  651. private WokModel _wokModel_3;
  652. public WokModel wokModel_3
  653. {
  654. get
  655. {
  656. return _wokModel_3;
  657. }
  658. set
  659. {
  660. if (_wokModel_3 == value)
  661. return;
  662. _wokModel_3 = value;
  663. OnPropertyChanged("wokModel_3");
  664. }
  665. }
  666. /// <summary>
  667. /// 四号炒锅工作流程
  668. /// </summary>
  669. private WokModel _wokModel_4;
  670. public WokModel wokModel_4
  671. {
  672. get
  673. {
  674. return _wokModel_4;
  675. }
  676. set
  677. {
  678. if (_wokModel_4 == value)
  679. return;
  680. _wokModel_4 = value;
  681. OnPropertyChanged("wokModel_4");
  682. }
  683. }
  684. /// <summary>
  685. /// 五号炒锅工作流程
  686. /// </summary>
  687. private WokModel _wokModel_5;
  688. public WokModel wokModel_5
  689. {
  690. get
  691. {
  692. return _wokModel_5;
  693. }
  694. set
  695. {
  696. if (_wokModel_5 == value)
  697. return;
  698. _wokModel_5 = value;
  699. OnPropertyChanged("wokModel_5");
  700. }
  701. }
  702. #endregion
  703. }
  704. /// <summary>
  705. /// 小车控制Model
  706. /// </summary>
  707. public class CartModel : ObservableObject
  708. {
  709. /// <summary>
  710. /// 车上是否有物品
  711. /// </summary>
  712. private IsBool _isBool = IsBool.No;
  713. public IsBool isBool
  714. {
  715. get
  716. {
  717. return _isBool;
  718. }
  719. set
  720. {
  721. _isBool = value;
  722. Text = _isBool.ToString();
  723. OnPropertyChanged("isBool");
  724. }
  725. }
  726. /// <summary>
  727. /// 车运动轨迹方式
  728. /// </summary>
  729. private CartMotionTrajectory _cartMotionTrajectory = CartMotionTrajectory.Stop;
  730. public CartMotionTrajectory cartMotionTrajectory
  731. {
  732. get
  733. {
  734. return _cartMotionTrajectory;
  735. }
  736. set
  737. {
  738. _cartMotionTrajectory = value;
  739. Tag = _cartMotionTrajectory.ToString();
  740. OnPropertyChanged("cartMotionTrajectory");
  741. }
  742. }
  743. private string _Text = IsBool.No.ToString();
  744. public string Text
  745. {
  746. get
  747. {
  748. return _Text;
  749. }
  750. set
  751. {
  752. _Text = value;
  753. OnPropertyChanged("Text");
  754. }
  755. }
  756. private string _Tag = CartMotionTrajectory.Stop.ToString();
  757. public string Tag
  758. {
  759. get
  760. {
  761. return _Tag;
  762. }
  763. set
  764. {
  765. _Tag = value;
  766. OnPropertyChanged("Tag");
  767. }
  768. }
  769. }
  770. /// <summary>
  771. /// 停车装控制
  772. /// </summary>
  773. public class ParkingPileModel : ObservableObject
  774. {
  775. /// <summary>
  776. /// 是否有小车
  777. /// </summary>
  778. private IsBool _isBool = IsBool.No;
  779. public IsBool isBool
  780. {
  781. get
  782. {
  783. return _isBool;
  784. }
  785. set
  786. {
  787. _isBool = value;
  788. Text = _isBool.ToString();
  789. OnPropertyChanged("isBool");
  790. }
  791. }
  792. private string _Text = IsBool.No.ToString();
  793. public string Text
  794. {
  795. get
  796. {
  797. return _Text;
  798. }
  799. set
  800. {
  801. _Text = value;
  802. OnPropertyChanged("Text");
  803. }
  804. }
  805. }
  806. /// <summary>
  807. /// 滚筒线控制
  808. /// </summary>
  809. public class RollerLinesModel : ObservableObject
  810. {
  811. /// <summary>
  812. /// 是否运行
  813. /// </summary>
  814. private IsRun _isRun = IsRun.Stop;
  815. public IsRun isRun
  816. {
  817. get
  818. {
  819. return _isRun;
  820. }
  821. set
  822. {
  823. _isRun = value;
  824. Text = _isRun.ToString();
  825. OnPropertyChanged("isBool");
  826. }
  827. }
  828. /// <summary>
  829. /// 滚筒线上面的数量
  830. /// </summary>
  831. private string _DishesNum = "8";
  832. public string DishesNum
  833. {
  834. get
  835. {
  836. return _DishesNum;
  837. }
  838. set
  839. {
  840. _DishesNum = value;
  841. if (!string.IsNullOrEmpty(_DishesNum))
  842. {
  843. int count = 1;
  844. try
  845. {
  846. count = int.Parse(_DishesNum);
  847. if (count >= 0 && count <= 8)
  848. {
  849. _DishesNum = count.ToString();
  850. }
  851. else
  852. _DishesNum = 8.ToString();
  853. }
  854. catch (Exception ex)
  855. {
  856. _DishesNum = 8.ToString();
  857. }
  858. }
  859. OnPropertyChanged("DishesNum");
  860. }
  861. }
  862. private string _Text = IsRun.Stop.ToString();
  863. public string Text
  864. {
  865. get
  866. {
  867. return _Text;
  868. }
  869. set
  870. {
  871. _Text = value;
  872. OnPropertyChanged("Text");
  873. }
  874. }
  875. }
  876. /// <summary>
  877. /// 炒锅 流程控制
  878. /// </summary>
  879. public class WokModel : ObservableObject
  880. {
  881. /// <summary>
  882. /// id
  883. /// </summary>
  884. private string _id;
  885. public string id
  886. {
  887. get
  888. {
  889. return _id;
  890. }
  891. set
  892. {
  893. _id = value;
  894. OnPropertyChanged("id");
  895. }
  896. }
  897. /// <summary>
  898. /// 订单id
  899. /// </summary>
  900. private string _orderID;
  901. public string orderID
  902. {
  903. get
  904. {
  905. return _orderID;
  906. }
  907. set
  908. {
  909. _orderID = value;
  910. OnPropertyChanged("orderID");
  911. }
  912. }
  913. /// <summary>
  914. /// 商品名称
  915. /// </summary>
  916. private string _goodsName;
  917. public string goodsName
  918. {
  919. get
  920. {
  921. return _goodsName;
  922. }
  923. set
  924. {
  925. _goodsName = value;
  926. OnPropertyChanged("goodsName");
  927. }
  928. }
  929. /// <summary>
  930. /// 其他信息
  931. /// </summary>
  932. private string _other;
  933. public string other
  934. {
  935. get
  936. {
  937. return _other;
  938. }
  939. set
  940. {
  941. _other = value;
  942. OnPropertyChanged("other");
  943. }
  944. }
  945. /// <summary>
  946. /// 是否运行
  947. /// </summary>
  948. private IsRun _isRun = IsRun.Stop;
  949. public IsRun isRun
  950. {
  951. get
  952. {
  953. return _isRun;
  954. }
  955. set
  956. {
  957. _isRun = value;
  958. Text = _isRun.ToString();
  959. OnPropertyChanged("isBool");
  960. }
  961. }
  962. private string _Text = IsRun.Stop.ToString();
  963. public string Text
  964. {
  965. get
  966. {
  967. return _Text;
  968. }
  969. set
  970. {
  971. _Text = value;
  972. OnPropertyChanged("Text");
  973. }
  974. }
  975. /// <summary>
  976. /// 工作流程
  977. /// </summary>
  978. private ObservableCollection<WorkflowModel> _workflows = new ObservableCollection<WorkflowModel>();
  979. public ObservableCollection<WorkflowModel> workflows
  980. {
  981. get
  982. {
  983. return _workflows;
  984. }
  985. set
  986. {
  987. _workflows = value;
  988. OnPropertyChanged("workflows");
  989. }
  990. }
  991. public WokModel()
  992. {
  993. id = Guid.NewGuid().ToString();
  994. workflows = new ObservableCollection<WorkflowModel>();
  995. }
  996. }
  997. /// <summary>
  998. /// 工作流程
  999. /// </summary>
  1000. public class WorkflowModel : ObservableObject
  1001. {
  1002. /// <summary>
  1003. /// 序号默认:1-10
  1004. /// </summary>
  1005. private int _id=1;
  1006. public int id
  1007. {
  1008. get
  1009. {
  1010. return _id;
  1011. }
  1012. set
  1013. {
  1014. _id = value;
  1015. xh = GetXH.ID(_id);
  1016. OnPropertyChanged("id");
  1017. }
  1018. }
  1019. /// <summary>
  1020. /// 名称
  1021. /// </summary>
  1022. private string _Name;
  1023. public string Name
  1024. {
  1025. get
  1026. {
  1027. return _Name;
  1028. }
  1029. set
  1030. {
  1031. _Name = value;
  1032. OnPropertyChanged("Name");
  1033. }
  1034. }
  1035. /// <summary>
  1036. /// 是否已完成当前步骤
  1037. /// </summary>
  1038. private IsBool _isBool = IsBool.No;
  1039. public IsBool isBool
  1040. {
  1041. get
  1042. {
  1043. return _isBool;
  1044. }
  1045. set
  1046. {
  1047. _isBool = value;
  1048. if (_isBool == IsBool.Yes)
  1049. {
  1050. visibility = Visibility.Visible;
  1051. }
  1052. else
  1053. {
  1054. visibility = Visibility.Collapsed;
  1055. }
  1056. OnPropertyChanged("isBool");
  1057. }
  1058. }
  1059. private Visibility _visibility = Visibility.Collapsed;
  1060. public Visibility visibility
  1061. {
  1062. get
  1063. {
  1064. return _visibility;
  1065. }
  1066. set
  1067. {
  1068. _visibility = value;
  1069. OnPropertyChanged("visibility");
  1070. }
  1071. }
  1072. private string _xh;
  1073. public string xh
  1074. {
  1075. get
  1076. {
  1077. return _xh;
  1078. }
  1079. set
  1080. {
  1081. _xh = value;
  1082. OnPropertyChanged("xh");
  1083. }
  1084. }
  1085. }
  1086. /// <summary>
  1087. /// 获取序号
  1088. /// </summary>
  1089. static class GetXH
  1090. {
  1091. //①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑳㉑㉒㉓㉔㉕㉖㉗㉘㉙㉚㉛㉜㉝㉞㉟㊱㊲㊳㊴㊵㊶㊷㊸㊹㊺㊻㊼㊽㊾㊿
  1092. public static string ID(int i)
  1093. {
  1094. string strbu = "① ";
  1095. string str = "①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑳㉑㉒㉓㉔㉕㉖㉗㉘㉙㉚㉛㉜㉝㉞㉟㊱㊲㊳㊴㊵㊶㊷㊸㊹㊺㊻㊼㊽㊾㊿";
  1096. if (i <= 50)
  1097. {
  1098. strbu= str.Substring(i-1, 1)+" ";
  1099. }
  1100. return strbu;
  1101. }
  1102. }
  1103. }