|
|
@@ -1,4 +1,5 @@ |
|
|
|
using Microsoft.Toolkit.Mvvm.ComponentModel; |
|
|
|
using FryPot_DosingSystem.AGV; |
|
|
|
using Microsoft.Toolkit.Mvvm.ComponentModel; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
@@ -17,11 +18,479 @@ namespace FryPot_DosingSystem.ViewModel |
|
|
|
public static AgvViewModel GetInstance() => _Instance ?? (_Instance = new AgvViewModel()); |
|
|
|
public AgvViewModel() |
|
|
|
{ |
|
|
|
Init(); |
|
|
|
} |
|
|
|
#endregion |
|
|
|
|
|
|
|
#region 私有函数 |
|
|
|
public void Init() |
|
|
|
{ |
|
|
|
//初始化车辆控制 |
|
|
|
cartModel_1 = new CartModel(); |
|
|
|
cartModel_2 = new CartModel(); |
|
|
|
cartModel_3 = new CartModel(); |
|
|
|
cartModel_4 = new CartModel(); |
|
|
|
|
|
|
|
RollerLines_1 = new RollerLinesModel(); |
|
|
|
RollerLines_2 = new RollerLinesModel(); |
|
|
|
RollerLines_3 = new RollerLinesModel(); |
|
|
|
RollerLines_4 = new RollerLinesModel(); |
|
|
|
|
|
|
|
ParkingPileModel_1 = new ParkingPileModel { isBool = IsBool.Yes }; |
|
|
|
ParkingPileModel_2 = new ParkingPileModel { isBool = IsBool.Yes }; |
|
|
|
ParkingPileModel_3 = new ParkingPileModel { isBool = IsBool.Yes }; |
|
|
|
ParkingPileModel_4 = new ParkingPileModel { isBool = IsBool.Yes }; |
|
|
|
ParkingPileModel_5 = new ParkingPileModel { isBool = IsBool.No }; |
|
|
|
ParkingPileModel_6 = new ParkingPileModel { isBool = IsBool.No }; |
|
|
|
|
|
|
|
RollerLines_2.DishesNum = "3"; |
|
|
|
} |
|
|
|
#endregion |
|
|
|
|
|
|
|
#region 公共函数 |
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
#region 4个滚筒线控制 |
|
|
|
/// <summary> |
|
|
|
/// 一号滚筒线 |
|
|
|
/// </summary> |
|
|
|
private RollerLinesModel _RollerLines_1; |
|
|
|
public RollerLinesModel RollerLines_1 |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
return _RollerLines_1; |
|
|
|
} |
|
|
|
set |
|
|
|
{ |
|
|
|
if (_RollerLines_1 == value) |
|
|
|
return; |
|
|
|
_RollerLines_1 = value; |
|
|
|
OnPropertyChanged("RollerLines_1"); |
|
|
|
} |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 二号滚筒线 |
|
|
|
/// </summary> |
|
|
|
private RollerLinesModel _RollerLines_2; |
|
|
|
public RollerLinesModel RollerLines_2 |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
return _RollerLines_2; |
|
|
|
} |
|
|
|
set |
|
|
|
{ |
|
|
|
if (_RollerLines_2 == value) |
|
|
|
return; |
|
|
|
_RollerLines_2 = value; |
|
|
|
OnPropertyChanged("RollerLines_2"); |
|
|
|
} |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 三号滚筒线 |
|
|
|
/// </summary> |
|
|
|
private RollerLinesModel _RollerLines_3; |
|
|
|
public RollerLinesModel RollerLines_3 |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
return _RollerLines_3; |
|
|
|
} |
|
|
|
set |
|
|
|
{ |
|
|
|
if (_RollerLines_3 == value) |
|
|
|
return; |
|
|
|
_RollerLines_3 = value; |
|
|
|
OnPropertyChanged("RollerLines_3"); |
|
|
|
} |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 四号滚筒线 |
|
|
|
/// </summary> |
|
|
|
private RollerLinesModel _RollerLines_4; |
|
|
|
public RollerLinesModel RollerLines_4 |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
return _RollerLines_4; |
|
|
|
} |
|
|
|
set |
|
|
|
{ |
|
|
|
if (_RollerLines_4 == value) |
|
|
|
return; |
|
|
|
_RollerLines_4 = value; |
|
|
|
OnPropertyChanged("RollerLines_4"); |
|
|
|
} |
|
|
|
} |
|
|
|
#endregion |
|
|
|
|
|
|
|
//public ObservableCollection<ActionMenu> menus { get; set; } = new ObservableCollection<ActionMenu>(); |
|
|
|
#region 4个运动小车控制 |
|
|
|
/// <summary> |
|
|
|
/// 一号车控制 |
|
|
|
/// </summary> |
|
|
|
private CartModel _cartModel_1; |
|
|
|
public CartModel cartModel_1 |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
return _cartModel_1; |
|
|
|
} |
|
|
|
set |
|
|
|
{ |
|
|
|
if (_cartModel_1 == value) |
|
|
|
return; |
|
|
|
_cartModel_1 = value; |
|
|
|
OnPropertyChanged("cartModel_1"); |
|
|
|
} |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 二号车控制 |
|
|
|
/// </summary> |
|
|
|
private CartModel _cartModel_2; |
|
|
|
public CartModel cartModel_2 |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
return _cartModel_2; |
|
|
|
} |
|
|
|
set |
|
|
|
{ |
|
|
|
if (_cartModel_2 == value) |
|
|
|
return; |
|
|
|
_cartModel_2 = value; |
|
|
|
OnPropertyChanged("cartModel_2"); |
|
|
|
} |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 三号车控制 |
|
|
|
/// </summary> |
|
|
|
private CartModel _cartModel_3; |
|
|
|
public CartModel cartModel_3 |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
return _cartModel_3; |
|
|
|
} |
|
|
|
set |
|
|
|
{ |
|
|
|
if (_cartModel_3 == value) |
|
|
|
return; |
|
|
|
_cartModel_3 = value; |
|
|
|
OnPropertyChanged("cartModel_3"); |
|
|
|
} |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 四号车控制 |
|
|
|
/// </summary> |
|
|
|
private CartModel _cartModel_4; |
|
|
|
public CartModel cartModel_4 |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
return _cartModel_4; |
|
|
|
} |
|
|
|
set |
|
|
|
{ |
|
|
|
if (_cartModel_4 == value) |
|
|
|
return; |
|
|
|
_cartModel_4 = value; |
|
|
|
OnPropertyChanged("cartModel_4"); |
|
|
|
} |
|
|
|
} |
|
|
|
#endregion |
|
|
|
|
|
|
|
#region 6个停车桩控制 |
|
|
|
/// <summary> |
|
|
|
/// 一号停车装 |
|
|
|
/// </summary> |
|
|
|
private ParkingPileModel _ParkingPileModel_1; |
|
|
|
public ParkingPileModel ParkingPileModel_1 |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
return _ParkingPileModel_1; |
|
|
|
} |
|
|
|
set |
|
|
|
{ |
|
|
|
if (_ParkingPileModel_1 == value) |
|
|
|
return; |
|
|
|
_ParkingPileModel_1 = value; |
|
|
|
OnPropertyChanged("ParkingPileModel_1"); |
|
|
|
} |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 二号停车装 |
|
|
|
/// </summary> |
|
|
|
private ParkingPileModel _ParkingPileModel_2; |
|
|
|
public ParkingPileModel ParkingPileModel_2 |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
return _ParkingPileModel_2; |
|
|
|
} |
|
|
|
set |
|
|
|
{ |
|
|
|
if (_ParkingPileModel_2 == value) |
|
|
|
return; |
|
|
|
_ParkingPileModel_2 = value; |
|
|
|
OnPropertyChanged("ParkingPileModel_2"); |
|
|
|
} |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 三号停车装 |
|
|
|
/// </summary> |
|
|
|
private ParkingPileModel _ParkingPileModel_3; |
|
|
|
public ParkingPileModel ParkingPileModel_3 |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
return _ParkingPileModel_3; |
|
|
|
} |
|
|
|
set |
|
|
|
{ |
|
|
|
if (_ParkingPileModel_3 == value) |
|
|
|
return; |
|
|
|
_ParkingPileModel_3 = value; |
|
|
|
OnPropertyChanged("ParkingPileModel_3"); |
|
|
|
} |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 四号停车装 |
|
|
|
/// </summary> |
|
|
|
private ParkingPileModel _ParkingPileModel_4; |
|
|
|
public ParkingPileModel ParkingPileModel_4 |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
return _ParkingPileModel_4; |
|
|
|
} |
|
|
|
set |
|
|
|
{ |
|
|
|
if (_ParkingPileModel_4 == value) |
|
|
|
return; |
|
|
|
_ParkingPileModel_4 = value; |
|
|
|
OnPropertyChanged("ParkingPileModel_4"); |
|
|
|
} |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 五号停车装 |
|
|
|
/// </summary> |
|
|
|
private ParkingPileModel _ParkingPileModel_5; |
|
|
|
public ParkingPileModel ParkingPileModel_5 |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
return _ParkingPileModel_5; |
|
|
|
} |
|
|
|
set |
|
|
|
{ |
|
|
|
if (_ParkingPileModel_5 == value) |
|
|
|
return; |
|
|
|
_ParkingPileModel_5 = value; |
|
|
|
OnPropertyChanged("ParkingPileModel_5"); |
|
|
|
} |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 六号停车装 |
|
|
|
/// </summary> |
|
|
|
private ParkingPileModel _ParkingPileModel_6; |
|
|
|
public ParkingPileModel ParkingPileModel_6 |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
return _ParkingPileModel_6; |
|
|
|
} |
|
|
|
set |
|
|
|
{ |
|
|
|
if (_ParkingPileModel_6 == value) |
|
|
|
return; |
|
|
|
_ParkingPileModel_6 = value; |
|
|
|
OnPropertyChanged("ParkingPileModel_6"); |
|
|
|
} |
|
|
|
} |
|
|
|
#endregion |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 小车控制Model |
|
|
|
/// </summary> |
|
|
|
public class CartModel : ObservableObject |
|
|
|
{ |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 车上是否有物品 |
|
|
|
/// </summary> |
|
|
|
private IsBool _isBool = IsBool.No; |
|
|
|
public IsBool isBool |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
return _isBool; |
|
|
|
} |
|
|
|
set |
|
|
|
{ |
|
|
|
_isBool = value; |
|
|
|
Text= _isBool.ToString(); |
|
|
|
OnPropertyChanged("isBool"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 车运动轨迹方式 |
|
|
|
/// </summary> |
|
|
|
private CartMotionTrajectory _cartMotionTrajectory = CartMotionTrajectory.Stop; |
|
|
|
public CartMotionTrajectory cartMotionTrajectory |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
return _cartMotionTrajectory; |
|
|
|
} |
|
|
|
set |
|
|
|
{ |
|
|
|
_cartMotionTrajectory = value; |
|
|
|
Tag= _cartMotionTrajectory.ToString(); |
|
|
|
OnPropertyChanged("cartMotionTrajectory"); |
|
|
|
} |
|
|
|
} |
|
|
|
private string _Text = IsBool.No.ToString(); |
|
|
|
public string Text |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
return _Text; |
|
|
|
} |
|
|
|
set |
|
|
|
{ |
|
|
|
_Text = value; |
|
|
|
OnPropertyChanged("Text"); |
|
|
|
} |
|
|
|
} |
|
|
|
private string _Tag = CartMotionTrajectory.Stop.ToString(); |
|
|
|
public string Tag |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
return _Tag; |
|
|
|
} |
|
|
|
set |
|
|
|
{ |
|
|
|
_Tag = value; |
|
|
|
OnPropertyChanged("Tag"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 停车装控制 |
|
|
|
/// </summary> |
|
|
|
public class ParkingPileModel : ObservableObject |
|
|
|
{ |
|
|
|
/// <summary> |
|
|
|
/// 是否有小车 |
|
|
|
/// </summary> |
|
|
|
private IsBool _isBool = IsBool.No; |
|
|
|
public IsBool isBool |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
return _isBool; |
|
|
|
} |
|
|
|
set |
|
|
|
{ |
|
|
|
_isBool = value; |
|
|
|
Text = _isBool.ToString(); |
|
|
|
OnPropertyChanged("isBool"); |
|
|
|
} |
|
|
|
} |
|
|
|
private string _Text = IsBool.No.ToString(); |
|
|
|
public string Text |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
return _Text; |
|
|
|
} |
|
|
|
set |
|
|
|
{ |
|
|
|
_Text = value; |
|
|
|
OnPropertyChanged("Text"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 滚筒线控制 |
|
|
|
/// </summary> |
|
|
|
public class RollerLinesModel : ObservableObject |
|
|
|
{ |
|
|
|
/// <summary> |
|
|
|
/// 是否运行 |
|
|
|
/// </summary> |
|
|
|
private IsRun _isRun = IsRun.Stop; |
|
|
|
public IsRun isRun |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
return _isRun; |
|
|
|
} |
|
|
|
set |
|
|
|
{ |
|
|
|
_isRun = value; |
|
|
|
Text= _isRun.ToString(); |
|
|
|
OnPropertyChanged("isBool"); |
|
|
|
} |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 滚筒线上面的数量 |
|
|
|
/// </summary> |
|
|
|
private string _DishesNum = "8"; |
|
|
|
public string DishesNum |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
return _DishesNum; |
|
|
|
} |
|
|
|
set |
|
|
|
{ |
|
|
|
_DishesNum = value; |
|
|
|
if (!string.IsNullOrEmpty(_DishesNum)) |
|
|
|
{ |
|
|
|
int count = 1; |
|
|
|
try |
|
|
|
{ |
|
|
|
count = int.Parse(_DishesNum); |
|
|
|
if (count > 0 && count <= 8) |
|
|
|
{ |
|
|
|
_DishesNum = count.ToString(); |
|
|
|
} |
|
|
|
else |
|
|
|
_DishesNum = 8.ToString(); |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
_DishesNum = 8.ToString(); |
|
|
|
} |
|
|
|
} |
|
|
|
OnPropertyChanged("DishesNum"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private string _Text = IsRun.Stop.ToString(); |
|
|
|
public string Text |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
return _Text; |
|
|
|
} |
|
|
|
set |
|
|
|
{ |
|
|
|
_Text = value; |
|
|
|
OnPropertyChanged("Text"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |