|
@@ -0,0 +1,931 @@ |
|
|
|
|
|
using BPASmartClient.Helper; |
|
|
|
|
|
using BPASmartClient.MorkF.Model; |
|
|
|
|
|
using Google.Protobuf.WellKnownTypes; |
|
|
|
|
|
using Microsoft.Toolkit.Mvvm.ComponentModel; |
|
|
|
|
|
using Microsoft.Toolkit.Mvvm.Input; |
|
|
|
|
|
using System; |
|
|
|
|
|
using System.Collections.Generic; |
|
|
|
|
|
using System.Linq; |
|
|
|
|
|
using System.Text; |
|
|
|
|
|
using System.Threading.Tasks; |
|
|
|
|
|
using System.Windows; |
|
|
|
|
|
|
|
|
|
|
|
namespace BPASmartClient.MorkF.ViewModel |
|
|
|
|
|
{ |
|
|
|
|
|
internal class MaterialCalibrationViewModel : ObservableObject |
|
|
|
|
|
{ |
|
|
|
|
|
#region 菜品库控制 |
|
|
|
|
|
#region 点位1 |
|
|
|
|
|
public bool PositionOne { get { return _PositionOne; } set { _PositionOne = value; OnPropertyChanged(); } } |
|
|
|
|
|
private bool _PositionOne; |
|
|
|
|
|
public int OneX { get { return _OneX; } set { _OneX = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _OneX; |
|
|
|
|
|
public int OneY { get { return _OneY; } set { _OneY = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _OneY; |
|
|
|
|
|
#endregion |
|
|
|
|
|
#region 点位2 |
|
|
|
|
|
public bool PositionTwo { get { return _PositionTwo; } set { _PositionTwo = value; OnPropertyChanged(); } } |
|
|
|
|
|
private bool _PositionTwo; |
|
|
|
|
|
public int TwoX { get { return _TwoX; } set { _TwoX = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _TwoX; |
|
|
|
|
|
public int TwoY { get { return _TwoY; } set { _TwoY = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _TwoY; |
|
|
|
|
|
#endregion |
|
|
|
|
|
#region 点位3 |
|
|
|
|
|
public bool PositionThree { get { return _PositionThree; } set { _PositionThree = value; OnPropertyChanged(); } } |
|
|
|
|
|
private bool _PositionThree; |
|
|
|
|
|
public int ThreeX { get { return _ThreeX; } set { _ThreeX = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _ThreeX; |
|
|
|
|
|
public int ThreeY { get { return _ThreeY; } set { _ThreeY = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _ThreeY; |
|
|
|
|
|
#endregion |
|
|
|
|
|
#region 点位4 |
|
|
|
|
|
public bool PositionFour { get { return _PositionFour; } set { _PositionFour = value; OnPropertyChanged(); } } |
|
|
|
|
|
private bool _PositionFour; |
|
|
|
|
|
public int FourX { get { return _FourX; } set { _FourX = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _FourX; |
|
|
|
|
|
public int FourY { get { return _FourY; } set { _FourY = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _FourY; |
|
|
|
|
|
#endregion |
|
|
|
|
|
#region 点位5 |
|
|
|
|
|
public bool PositionFive { get { return _PositionFive; } set { _PositionFive = value; OnPropertyChanged(); } } |
|
|
|
|
|
private bool _PositionFive; |
|
|
|
|
|
public int FiveX { get { return _FiveX; } set { _FiveX = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _FiveX; |
|
|
|
|
|
public int FiveY { get { return _FiveY; } set { _FiveY = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _FiveY; |
|
|
|
|
|
#endregion |
|
|
|
|
|
#region 点位6 |
|
|
|
|
|
public bool PositionSix { get { return _PositionSix; } set { _PositionSix = value; OnPropertyChanged(); } } |
|
|
|
|
|
private bool _PositionSix; |
|
|
|
|
|
public int SixX { get { return _SixX; } set { _SixX = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _SixX; |
|
|
|
|
|
public int SixY { get { return _SixY; } set { _SixY = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _SixY; |
|
|
|
|
|
#endregion |
|
|
|
|
|
#region 点位7 |
|
|
|
|
|
public bool PositionSeven { get { return _PositionSeven; } set { _PositionSeven = value; OnPropertyChanged(); } } |
|
|
|
|
|
private bool _PositionSeven; |
|
|
|
|
|
public int SevenX { get { return _SevenX; } set { _SevenX = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _SevenX; |
|
|
|
|
|
public int SevenY { get { return _SevenY; } set { _SevenY = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _SevenY; |
|
|
|
|
|
#endregion |
|
|
|
|
|
#region 点位8 |
|
|
|
|
|
public bool PositionEight { get { return _PositionEight; } set { _PositionEight = value; OnPropertyChanged(); } } |
|
|
|
|
|
private bool _PositionEight; |
|
|
|
|
|
public int EightX { get { return _EightX; } set { _EightX = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _EightX; |
|
|
|
|
|
public int EightY { get { return _EightY; } set { _EightY = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _EightY; |
|
|
|
|
|
#endregion |
|
|
|
|
|
#region 点位9 |
|
|
|
|
|
public bool PositionNine { get { return _PositionNine; } set { _PositionNine = value; OnPropertyChanged(); } } |
|
|
|
|
|
private bool _PositionNine; |
|
|
|
|
|
public int NineX { get { return _NineX; } set { _NineX = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _NineX; |
|
|
|
|
|
public int NineY { get { return _NineY; } set { _NineY = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _NineY; |
|
|
|
|
|
#endregion |
|
|
|
|
|
#region 点位10 |
|
|
|
|
|
public bool PositionTen { get { return _PositionTen; } set { _PositionTen = value; OnPropertyChanged(); } } |
|
|
|
|
|
private bool _PositionTen; |
|
|
|
|
|
public int TenX { get { return _TenX; } set { _TenX = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _TenX; |
|
|
|
|
|
public int TenY { get { return _TenY; } set { _TenY = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _TenY; |
|
|
|
|
|
#endregion |
|
|
|
|
|
#region 点位11 |
|
|
|
|
|
public bool PositionEleven { get { return _PositionEleven; } set { _PositionEleven = value; OnPropertyChanged(); } } |
|
|
|
|
|
private bool _PositionEleven; |
|
|
|
|
|
public int ElevenX { get { return _ElevenX; } set { _ElevenX = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _ElevenX; |
|
|
|
|
|
public int ElevenY { get { return _ElevenY; } set { _ElevenY = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _ElevenY; |
|
|
|
|
|
#endregion |
|
|
|
|
|
#region 点位12 |
|
|
|
|
|
public bool PositionTwelve { get { return _PositionTwelve; } set { _PositionTwelve = value; OnPropertyChanged(); } } |
|
|
|
|
|
private bool _PositionTwelve; |
|
|
|
|
|
public int TwelveX { get { return _TwelveX; } set { _TwelveX = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _TwelveX; |
|
|
|
|
|
public int TwelveY { get { return _TwelveY; } set { _TwelveY = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _TwelveY; |
|
|
|
|
|
#endregion |
|
|
|
|
|
#region 点位13 |
|
|
|
|
|
public bool PositionThirteen { get { return _PositionThirteen; } set { _PositionThirteen = value; OnPropertyChanged(); } } |
|
|
|
|
|
private bool _PositionThirteen; |
|
|
|
|
|
public int ThirteenX { get { return _ThirteenX; } set { _ThirteenX = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _ThirteenX; |
|
|
|
|
|
public int ThirteenY { get { return _ThirteenY; } set { _ThirteenY = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _ThirteenY; |
|
|
|
|
|
#endregion |
|
|
|
|
|
#region 点位14 |
|
|
|
|
|
public bool PositionFourteen { get { return _PositionFourteen; } set { _PositionFourteen = value; OnPropertyChanged(); } } |
|
|
|
|
|
private bool _PositionFourteen; |
|
|
|
|
|
public int FourteenX { get { return _FourteenX; } set { _FourteenX = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _FourteenX; |
|
|
|
|
|
public int FourteenY { get { return _FourteenY; } set { _FourteenY = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _FourteenY; |
|
|
|
|
|
#endregion |
|
|
|
|
|
#region 点位15 |
|
|
|
|
|
public bool PositionFifteen { get { return _PositionFifteen; } set { _PositionFifteen = value; OnPropertyChanged(); } } |
|
|
|
|
|
private bool _PositionFifteen; |
|
|
|
|
|
public int FifteenX { get { return _FifteenX; } set { _FifteenX = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _FifteenX; |
|
|
|
|
|
public int FifteenY { get { return _FifteenY; } set { _FifteenY = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _FifteenY; |
|
|
|
|
|
#endregion |
|
|
|
|
|
#region 点位16 |
|
|
|
|
|
public bool PositionSixteen { get { return _PositionSixteen; } set { _PositionSixteen = value; OnPropertyChanged(); } } |
|
|
|
|
|
private bool _PositionSixteen; |
|
|
|
|
|
public int SixteenX { get { return _SixteenX; } set { _SixteenX = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _SixteenX; |
|
|
|
|
|
public int SixteenY { get { return _SixteenY; } set { _SixteenY = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _SixteenY; |
|
|
|
|
|
#endregion |
|
|
|
|
|
#region 点位17 |
|
|
|
|
|
public bool PositionSeventeen { get { return _PositionSeventeen; } set { _PositionSeventeen = value; OnPropertyChanged(); } } |
|
|
|
|
|
private bool _PositionSeventeen; |
|
|
|
|
|
public int SeventeenX { get { return _SeventeenX; } set { _SeventeenX = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _SeventeenX; |
|
|
|
|
|
public int SeventeenY { get { return _SeventeenY; } set { _SeventeenY = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _SeventeenY; |
|
|
|
|
|
#endregion |
|
|
|
|
|
#region 点位18 |
|
|
|
|
|
public bool PositionEighteen { get { return _PositionEighteen; } set { _PositionEighteen = value; OnPropertyChanged(); } } |
|
|
|
|
|
private bool _PositionEighteen; |
|
|
|
|
|
public int EighteenX { get { return _EighteenX; } set { _EighteenX = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _EighteenX; |
|
|
|
|
|
public int EighteenY { get { return _EighteenY; } set { _EighteenY = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _EighteenY; |
|
|
|
|
|
#endregion |
|
|
|
|
|
#region 点位19 |
|
|
|
|
|
public bool PositionNineteen { get { return _PositionNineteen; } set { _PositionNineteen = value; OnPropertyChanged(); } } |
|
|
|
|
|
private bool _PositionNineteen; |
|
|
|
|
|
public int NineteenX { get { return _NineteenX; } set { _NineteenX = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _NineteenX; |
|
|
|
|
|
public int NineteenY { get { return _NineteenY; } set { _NineteenY = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _NineteenY; |
|
|
|
|
|
#endregion |
|
|
|
|
|
#region 点位20 |
|
|
|
|
|
public bool PositionTwenty { get { return _PositionTwenty; } set { _PositionTwenty = value; OnPropertyChanged(); } } |
|
|
|
|
|
private bool _PositionTwenty; |
|
|
|
|
|
public int TwentyX { get { return _TwentyX; } set { _TwentyX = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _TwentyX; |
|
|
|
|
|
public int TwentyY { get { return _TwentyY; } set { _TwentyY = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _TwentyY; |
|
|
|
|
|
#endregion |
|
|
|
|
|
#region 点位21 |
|
|
|
|
|
public bool PositionTwentyOne { get { return _PositionTwentyOne; } set { _PositionTwentyOne = value; OnPropertyChanged(); } } |
|
|
|
|
|
private bool _PositionTwentyOne; |
|
|
|
|
|
public int TwentyOneX { get { return _TwentyOneX; } set { _TwentyOneX = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _TwentyOneX; |
|
|
|
|
|
public int TwentyOneY { get { return _TwentyOneY; } set { _TwentyOneY = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _TwentyOneY; |
|
|
|
|
|
#endregion |
|
|
|
|
|
#region 点位22 |
|
|
|
|
|
public bool PositionTwentyTwo { get { return _PositionTwentyTwo; } set { _PositionTwentyTwo = value; OnPropertyChanged(); } } |
|
|
|
|
|
private bool _PositionTwentyTwo; |
|
|
|
|
|
public int TwentyTwoX { get { return _TwentyTwoX; } set { _TwentyTwoX = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _TwentyTwoX; |
|
|
|
|
|
public int TwentyTwoY { get { return _TwentyTwoY; } set { _TwentyTwoY = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _TwentyTwoY; |
|
|
|
|
|
#endregion |
|
|
|
|
|
#region 点位23 |
|
|
|
|
|
public bool PositionTwentyThree { get { return _PositionTwentyThree; } set { _PositionTwentyThree = value; OnPropertyChanged(); } } |
|
|
|
|
|
private bool _PositionTwentyThree; |
|
|
|
|
|
public int TwentyThreeX { get { return _TwentyThreeX; } set { _TwentyThreeX = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _TwentyThreeX; |
|
|
|
|
|
public int TwentyThreeY { get { return _TwentyThreeY; } set { _TwentyThreeY = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _TwentyThreeY; |
|
|
|
|
|
#endregion |
|
|
|
|
|
#region 点位24 |
|
|
|
|
|
public bool PositionTwentyFour { get { return _PositionTwentyFour; } set { _PositionTwentyFour = value; OnPropertyChanged(); } } |
|
|
|
|
|
private bool _PositionTwentyFour; |
|
|
|
|
|
public int TwentyFourX { get { return _TwentyFourX; } set { _TwentyFourX = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _TwentyFourX; |
|
|
|
|
|
public int TwentyFourY { get { return _TwentyFourY; } set { _TwentyFourY = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _TwentyFourY; |
|
|
|
|
|
#endregion |
|
|
|
|
|
#region 点位25 |
|
|
|
|
|
public bool PositionTwentyFive { get { return _PositionTwentyFive; } set { _PositionTwentyFive = value; OnPropertyChanged(); } } |
|
|
|
|
|
private bool _PositionTwentyFive; |
|
|
|
|
|
public int TwentyFiveX { get { return _TwentyFiveX; } set { _TwentyFiveX = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _TwentyFiveX; |
|
|
|
|
|
public int TwentyFiveY { get { return _TwentyFiveY; } set { _TwentyFiveY = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _TwentyFiveY; |
|
|
|
|
|
#endregion |
|
|
|
|
|
#region 点位26 |
|
|
|
|
|
public bool PositionTwentySix { get { return _PositionTwentySix; } set { _PositionTwentySix = value; OnPropertyChanged(); } } |
|
|
|
|
|
private bool _PositionTwentySix; |
|
|
|
|
|
public int TwentySixX { get { return _TwentySixX; } set { _TwentySixX = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _TwentySixX; |
|
|
|
|
|
public int TwentySixY { get { return _TwentySixY; } set { _TwentySixY = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _TwentySixY; |
|
|
|
|
|
#endregion |
|
|
|
|
|
#region 点位27 |
|
|
|
|
|
public bool PositionTwentySeven { get { return _PositionTwentySeven; } set { _PositionTwentySeven = value; OnPropertyChanged(); } } |
|
|
|
|
|
private bool _PositionTwentySeven; |
|
|
|
|
|
public int TwentySevenX { get { return _TwentySevenX; } set { _TwentySevenX = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _TwentySevenX; |
|
|
|
|
|
public int TwentySevenY { get { return _TwentySevenY; } set { _TwentySevenY = value; OnPropertyChanged(); } } |
|
|
|
|
|
private int _TwentySevenY; |
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
|
|
public bool Up { get { return _Up; } set { _Up = value; OnPropertyChanged(); } } |
|
|
|
|
|
private bool _Up; |
|
|
|
|
|
|
|
|
|
|
|
public bool Down { get { return _Down; } set { _Down = value; OnPropertyChanged(); } } |
|
|
|
|
|
private bool _Down; |
|
|
|
|
|
|
|
|
|
|
|
public bool Left { get { return _Left; } set { _Left = value; OnPropertyChanged(); } } |
|
|
|
|
|
private bool _Left; |
|
|
|
|
|
|
|
|
|
|
|
public bool Right { get { return _Right; } set { _Right = value; OnPropertyChanged(); } } |
|
|
|
|
|
private bool _Right; |
|
|
|
|
|
|
|
|
|
|
|
public bool Point { get { return _Point; } set { _Point = value; OnPropertyChanged(); } } |
|
|
|
|
|
private bool _Point; |
|
|
|
|
|
|
|
|
|
|
|
public string Str { get { return _str; }set { _str = value;OnPropertyChanged(); } } |
|
|
|
|
|
|
|
|
|
|
|
private string _str; |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
/// 操作时,x轴移动的距离 |
|
|
|
|
|
/// </summary> |
|
|
|
|
|
public int OperationX { get; set; } = 0; |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
/// 操作时,y轴移动的距离 |
|
|
|
|
|
/// </summary> |
|
|
|
|
|
public int OperationY { get; set; } = 0; |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
/// Y轴大菜品库的间隙 |
|
|
|
|
|
/// </summary> |
|
|
|
|
|
private const int bigMaterialClearanceY = 9000; |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
/// Y轴小菜品库的间隙 |
|
|
|
|
|
/// </summary> |
|
|
|
|
|
private const int smartMaterialClearanceY = 15000; |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
/// X轴菜品库的间隙 |
|
|
|
|
|
/// </summary> |
|
|
|
|
|
private const int materialClearanceX = 34500; |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
/// 移动系数 |
|
|
|
|
|
/// </summary> |
|
|
|
|
|
public int Factor = 1; |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
/// 移动基础点位 |
|
|
|
|
|
/// </summary> |
|
|
|
|
|
private int BasicPosition { get; set; } = 100; |
|
|
|
|
|
|
|
|
|
|
|
public RelayCommand SetNowPosition { get; set; }//设置机械臂当前坐标 |
|
|
|
|
|
|
|
|
|
|
|
public RelayCommand SaveCoordinate { get; set; }//设置机械臂基于当前坐标往左移动 |
|
|
|
|
|
|
|
|
|
|
|
public RelayCommand ReadCoordinate { get; set; }//设置机械臂基于当前坐标往右移动 |
|
|
|
|
|
|
|
|
|
|
|
public RelayCommand AutoCalculation { get; set; }//设置机械臂基于当前坐标往上移动 |
|
|
|
|
|
|
|
|
|
|
|
public RelayCommand SetNowDownPosition { get; set; }//设置机械臂基于当前坐标往下移动 |
|
|
|
|
|
|
|
|
|
|
|
private static object saveMaterialCoordinateLock = new object(); |
|
|
|
|
|
/// <summary> |
|
|
|
|
|
/// 保存当前的坐标系 |
|
|
|
|
|
/// </summary> |
|
|
|
|
|
public void SaveMaterialCoordinate() |
|
|
|
|
|
{ |
|
|
|
|
|
MaterialCoordinate materialCoordinate = new MaterialCoordinate(); |
|
|
|
|
|
|
|
|
|
|
|
foreach(var dicNoMaterialCoordinate in materialCoordinate.dicNoMaterialCoordinate) |
|
|
|
|
|
{ |
|
|
|
|
|
switch(dicNoMaterialCoordinate.Key) |
|
|
|
|
|
{ |
|
|
|
|
|
case "1": |
|
|
|
|
|
dicNoMaterialCoordinate.Value.X = OneX; |
|
|
|
|
|
dicNoMaterialCoordinate.Value.Y = OneY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "2": |
|
|
|
|
|
dicNoMaterialCoordinate.Value.X = TwoX; |
|
|
|
|
|
dicNoMaterialCoordinate.Value.Y = TwoY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "3": |
|
|
|
|
|
dicNoMaterialCoordinate.Value.X = ThreeX; |
|
|
|
|
|
dicNoMaterialCoordinate.Value.Y = ThreeY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "4": |
|
|
|
|
|
dicNoMaterialCoordinate.Value.X = FourX; |
|
|
|
|
|
dicNoMaterialCoordinate.Value.Y = FourY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "5": |
|
|
|
|
|
dicNoMaterialCoordinate.Value.X = FiveX; |
|
|
|
|
|
dicNoMaterialCoordinate.Value.Y = FiveY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "6": |
|
|
|
|
|
dicNoMaterialCoordinate.Value.X = SixX; |
|
|
|
|
|
dicNoMaterialCoordinate.Value.Y = SixY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "7": |
|
|
|
|
|
dicNoMaterialCoordinate.Value.X = SevenX; |
|
|
|
|
|
dicNoMaterialCoordinate.Value.Y = SevenY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "8": |
|
|
|
|
|
dicNoMaterialCoordinate.Value.X = EightX; |
|
|
|
|
|
dicNoMaterialCoordinate.Value.Y = EightY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "9": |
|
|
|
|
|
dicNoMaterialCoordinate.Value.X = NineX; |
|
|
|
|
|
dicNoMaterialCoordinate.Value.Y = NineY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "10": |
|
|
|
|
|
dicNoMaterialCoordinate.Value.X = TenX; |
|
|
|
|
|
dicNoMaterialCoordinate.Value.Y = TenY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "11": |
|
|
|
|
|
dicNoMaterialCoordinate.Value.X = ElevenX; |
|
|
|
|
|
dicNoMaterialCoordinate.Value.Y = ElevenY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "12": |
|
|
|
|
|
dicNoMaterialCoordinate.Value.X = TwelveX; |
|
|
|
|
|
dicNoMaterialCoordinate.Value.Y = TwelveY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "13": |
|
|
|
|
|
dicNoMaterialCoordinate.Value.X = ThirteenX; |
|
|
|
|
|
dicNoMaterialCoordinate.Value.Y = ThirteenY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "14": |
|
|
|
|
|
dicNoMaterialCoordinate.Value.X = FourteenX; |
|
|
|
|
|
dicNoMaterialCoordinate.Value.Y = FourteenY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "15": |
|
|
|
|
|
dicNoMaterialCoordinate.Value.X = FifteenX; |
|
|
|
|
|
dicNoMaterialCoordinate.Value.Y = FifteenY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "16": |
|
|
|
|
|
dicNoMaterialCoordinate.Value.X = SixteenX; |
|
|
|
|
|
dicNoMaterialCoordinate.Value.Y = SixteenY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "17": |
|
|
|
|
|
dicNoMaterialCoordinate.Value.X = SeventeenX; |
|
|
|
|
|
dicNoMaterialCoordinate.Value.Y = SeventeenY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "18": |
|
|
|
|
|
dicNoMaterialCoordinate.Value.X = EighteenX; |
|
|
|
|
|
dicNoMaterialCoordinate.Value.Y = EighteenY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "19": |
|
|
|
|
|
dicNoMaterialCoordinate.Value.X = NineteenX; |
|
|
|
|
|
dicNoMaterialCoordinate.Value.Y = NineteenY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "20": |
|
|
|
|
|
dicNoMaterialCoordinate.Value.X = TwentyX; |
|
|
|
|
|
dicNoMaterialCoordinate.Value.Y = TwentyY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "21": |
|
|
|
|
|
dicNoMaterialCoordinate.Value.X = TwentyOneX; |
|
|
|
|
|
dicNoMaterialCoordinate.Value.Y = TwentyOneY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "22": |
|
|
|
|
|
dicNoMaterialCoordinate.Value.X = TwentyTwoX; |
|
|
|
|
|
dicNoMaterialCoordinate.Value.Y = TwentyTwoY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "23": |
|
|
|
|
|
dicNoMaterialCoordinate.Value.X = TwentyThreeX; |
|
|
|
|
|
dicNoMaterialCoordinate.Value.Y = TwentyThreeX; |
|
|
|
|
|
break; |
|
|
|
|
|
case "24": |
|
|
|
|
|
dicNoMaterialCoordinate.Value.X = TwentyFourX; |
|
|
|
|
|
dicNoMaterialCoordinate.Value.Y = TwentyFourY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "25": |
|
|
|
|
|
dicNoMaterialCoordinate.Value.X = TwentyFiveX; |
|
|
|
|
|
dicNoMaterialCoordinate.Value.Y = TwentyFiveY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "26": |
|
|
|
|
|
dicNoMaterialCoordinate.Value.X = TwentySixX; |
|
|
|
|
|
dicNoMaterialCoordinate.Value.Y = TwentySixY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "27": |
|
|
|
|
|
dicNoMaterialCoordinate.Value.X = TwentySevenX; |
|
|
|
|
|
dicNoMaterialCoordinate.Value.Y = TwentySevenY; |
|
|
|
|
|
break; |
|
|
|
|
|
default: |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Json<MaterialCoordinate>.Data = materialCoordinate; |
|
|
|
|
|
Json<MaterialCoordinate>.Save(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
/// 读取坐标系 |
|
|
|
|
|
/// </summary> |
|
|
|
|
|
/// <returns></returns> |
|
|
|
|
|
private MaterialCoordinate ReadMaterialCoordinate() |
|
|
|
|
|
{ |
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
Json<MaterialCoordinate>.Read(); |
|
|
|
|
|
MaterialCoordinate materialCoordinate = Json<MaterialCoordinate>.Data; |
|
|
|
|
|
return materialCoordinate; |
|
|
|
|
|
} |
|
|
|
|
|
catch (Exception ex) |
|
|
|
|
|
{ |
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void PhysicalMaterialCoordinate() |
|
|
|
|
|
{ |
|
|
|
|
|
MaterialCoordinate materialCoordinate = ReadMaterialCoordinate(); |
|
|
|
|
|
|
|
|
|
|
|
if (materialCoordinate.dicNoMaterialCoordinate.Count == 27) |
|
|
|
|
|
{ |
|
|
|
|
|
foreach (var dicNoMaterialCoordinate in materialCoordinate.dicNoMaterialCoordinate) |
|
|
|
|
|
{ |
|
|
|
|
|
switch (dicNoMaterialCoordinate.Key) |
|
|
|
|
|
{ |
|
|
|
|
|
case "1": |
|
|
|
|
|
OneX = dicNoMaterialCoordinate.Value.X; |
|
|
|
|
|
OneY = dicNoMaterialCoordinate.Value.Y; |
|
|
|
|
|
break; |
|
|
|
|
|
case "2": |
|
|
|
|
|
TwoX = dicNoMaterialCoordinate.Value.X; |
|
|
|
|
|
TwoY = dicNoMaterialCoordinate.Value.Y; |
|
|
|
|
|
break; |
|
|
|
|
|
case "3": |
|
|
|
|
|
ThreeX = dicNoMaterialCoordinate.Value.X; |
|
|
|
|
|
ThreeY = dicNoMaterialCoordinate.Value.Y; |
|
|
|
|
|
break; |
|
|
|
|
|
case "4": |
|
|
|
|
|
FourX = dicNoMaterialCoordinate.Value.X; |
|
|
|
|
|
FourY = dicNoMaterialCoordinate.Value.Y; |
|
|
|
|
|
break; |
|
|
|
|
|
case "5": |
|
|
|
|
|
FiveX = dicNoMaterialCoordinate.Value.X; |
|
|
|
|
|
FiveY = dicNoMaterialCoordinate.Value.Y; |
|
|
|
|
|
break; |
|
|
|
|
|
case "6": |
|
|
|
|
|
SixX = dicNoMaterialCoordinate.Value.X; |
|
|
|
|
|
SixY = dicNoMaterialCoordinate.Value.Y; |
|
|
|
|
|
break; |
|
|
|
|
|
case "7": |
|
|
|
|
|
SevenX = dicNoMaterialCoordinate.Value.X; |
|
|
|
|
|
SevenY = dicNoMaterialCoordinate.Value.Y; |
|
|
|
|
|
break; |
|
|
|
|
|
case "8": |
|
|
|
|
|
EightX = dicNoMaterialCoordinate.Value.X; |
|
|
|
|
|
EightY = dicNoMaterialCoordinate.Value.Y; |
|
|
|
|
|
break; |
|
|
|
|
|
case "9": |
|
|
|
|
|
NineX = dicNoMaterialCoordinate.Value.X; |
|
|
|
|
|
NineY = dicNoMaterialCoordinate.Value.Y; |
|
|
|
|
|
break; |
|
|
|
|
|
case "10": |
|
|
|
|
|
TenX = dicNoMaterialCoordinate.Value.X; |
|
|
|
|
|
TenY = dicNoMaterialCoordinate.Value.Y; |
|
|
|
|
|
break; |
|
|
|
|
|
case "11": |
|
|
|
|
|
ElevenX = dicNoMaterialCoordinate.Value.X; |
|
|
|
|
|
ElevenY = dicNoMaterialCoordinate.Value.Y; |
|
|
|
|
|
break; |
|
|
|
|
|
case "12": |
|
|
|
|
|
TwelveX = dicNoMaterialCoordinate.Value.X; |
|
|
|
|
|
TwelveY = dicNoMaterialCoordinate.Value.Y; |
|
|
|
|
|
break; |
|
|
|
|
|
case "13": |
|
|
|
|
|
ThirteenX = dicNoMaterialCoordinate.Value.X; |
|
|
|
|
|
ThirteenY = dicNoMaterialCoordinate.Value.Y; |
|
|
|
|
|
break; |
|
|
|
|
|
case "14": |
|
|
|
|
|
FourteenX = dicNoMaterialCoordinate.Value.X; |
|
|
|
|
|
FourteenY = dicNoMaterialCoordinate.Value.Y; |
|
|
|
|
|
break; |
|
|
|
|
|
case "15": |
|
|
|
|
|
FifteenX = dicNoMaterialCoordinate.Value.X; |
|
|
|
|
|
FifteenY = dicNoMaterialCoordinate.Value.Y; |
|
|
|
|
|
break; |
|
|
|
|
|
case "16": |
|
|
|
|
|
SixteenX = dicNoMaterialCoordinate.Value.X; |
|
|
|
|
|
SixteenY = dicNoMaterialCoordinate.Value.Y; |
|
|
|
|
|
break; |
|
|
|
|
|
case "17": |
|
|
|
|
|
SeventeenX = dicNoMaterialCoordinate.Value.X; |
|
|
|
|
|
SeventeenY = dicNoMaterialCoordinate.Value.Y; |
|
|
|
|
|
break; |
|
|
|
|
|
case "18": |
|
|
|
|
|
EighteenX = dicNoMaterialCoordinate.Value.X; |
|
|
|
|
|
EighteenY = dicNoMaterialCoordinate.Value.Y; |
|
|
|
|
|
break; |
|
|
|
|
|
case "19": |
|
|
|
|
|
NineteenX = dicNoMaterialCoordinate.Value.X; |
|
|
|
|
|
NineteenY = dicNoMaterialCoordinate.Value.Y; |
|
|
|
|
|
break; |
|
|
|
|
|
case "20": |
|
|
|
|
|
TwentyX = dicNoMaterialCoordinate.Value.X; |
|
|
|
|
|
TwentyY = dicNoMaterialCoordinate.Value.Y; |
|
|
|
|
|
break; |
|
|
|
|
|
case "21": |
|
|
|
|
|
TwentyOneX = dicNoMaterialCoordinate.Value.X; |
|
|
|
|
|
TwentyOneY = dicNoMaterialCoordinate.Value.Y; |
|
|
|
|
|
break; |
|
|
|
|
|
case "22": |
|
|
|
|
|
TwentyTwoX = dicNoMaterialCoordinate.Value.X; |
|
|
|
|
|
TwentyTwoY = dicNoMaterialCoordinate.Value.Y; |
|
|
|
|
|
break; |
|
|
|
|
|
case "23": |
|
|
|
|
|
TwentyThreeX = dicNoMaterialCoordinate.Value.X; |
|
|
|
|
|
TwentyThreeY = dicNoMaterialCoordinate.Value.Y; |
|
|
|
|
|
break; |
|
|
|
|
|
case "24": |
|
|
|
|
|
TwentyFourX = dicNoMaterialCoordinate.Value.X; |
|
|
|
|
|
TwentyFourY = dicNoMaterialCoordinate.Value.Y; |
|
|
|
|
|
break; |
|
|
|
|
|
case "25": |
|
|
|
|
|
TwentyFiveX = dicNoMaterialCoordinate.Value.X; |
|
|
|
|
|
TwentyFiveY = dicNoMaterialCoordinate.Value.Y; |
|
|
|
|
|
break; |
|
|
|
|
|
case "26": |
|
|
|
|
|
TwentySixX = dicNoMaterialCoordinate.Value.X; |
|
|
|
|
|
TwentySixY = dicNoMaterialCoordinate.Value.Y; |
|
|
|
|
|
break; |
|
|
|
|
|
case "27": |
|
|
|
|
|
TwentySevenX = dicNoMaterialCoordinate.Value.X; |
|
|
|
|
|
TwentySevenY = dicNoMaterialCoordinate.Value.Y; |
|
|
|
|
|
break; |
|
|
|
|
|
default: |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void Calibration(string Num) |
|
|
|
|
|
{ |
|
|
|
|
|
switch (Num) |
|
|
|
|
|
{ |
|
|
|
|
|
case "1": |
|
|
|
|
|
OneX = OneX + OperationX; |
|
|
|
|
|
OneY = OneY + OperationX; |
|
|
|
|
|
break; |
|
|
|
|
|
case "2": |
|
|
|
|
|
TwoX = TwoX + OperationX; |
|
|
|
|
|
TwoY = TwoY + OperationY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "3": |
|
|
|
|
|
ThreeX = ThreeX + OperationX; |
|
|
|
|
|
ThreeY = ThreeY + OperationY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "4": |
|
|
|
|
|
FourX = FourX + OperationX; |
|
|
|
|
|
FourY = FourY + OperationY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "5": |
|
|
|
|
|
FiveX = FiveX + OperationX; |
|
|
|
|
|
FiveY = FiveY + OperationY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "6": |
|
|
|
|
|
SixX = SixX + OperationX; |
|
|
|
|
|
SixY = SixY + OperationY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "7": |
|
|
|
|
|
SevenX = SevenX + OperationX; |
|
|
|
|
|
SevenY = SevenY + OperationY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "8": |
|
|
|
|
|
EightX = EightX + OperationX; |
|
|
|
|
|
EightY = EightY + OperationY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "9": |
|
|
|
|
|
NineX = NineX + OperationX; |
|
|
|
|
|
NineY = NineY + OperationY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "10": |
|
|
|
|
|
TenX = TenX + OperationX; |
|
|
|
|
|
TenY = TenY + OperationY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "11": |
|
|
|
|
|
ElevenX = ElevenX + OperationX; |
|
|
|
|
|
ElevenY = ElevenY + OperationY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "12": |
|
|
|
|
|
TwelveX = TwelveX + OperationX; |
|
|
|
|
|
TwelveY = TwelveY + OperationY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "13": |
|
|
|
|
|
ThirteenX = ThirteenX + OperationX; |
|
|
|
|
|
ThirteenY = ThirteenY + OperationY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "14": |
|
|
|
|
|
FourteenX = FourteenX + OperationX; |
|
|
|
|
|
FourteenY = FourteenY + OperationY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "15": |
|
|
|
|
|
FifteenX = FifteenX + OperationX; |
|
|
|
|
|
FifteenY = FifteenY + OperationY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "16": |
|
|
|
|
|
SixteenX = SixteenX + OperationX; |
|
|
|
|
|
SixteenY = SixteenY + OperationY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "17": |
|
|
|
|
|
SeventeenX = SeventeenX + OperationX; |
|
|
|
|
|
SeventeenY = SeventeenY + OperationY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "18": |
|
|
|
|
|
EighteenX = EighteenX + OperationX; |
|
|
|
|
|
EighteenY = EighteenY + OperationY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "19": |
|
|
|
|
|
NineteenX = NineteenX + OperationX; |
|
|
|
|
|
NineteenY = NineteenY + OperationY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "20": |
|
|
|
|
|
TwentyX = TwentyX + OperationX; |
|
|
|
|
|
TwentyY = TwentyY + OperationY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "21": |
|
|
|
|
|
TwentyOneX = TwentyOneX + OperationX; |
|
|
|
|
|
TwentyOneY = TwentyOneY + OperationY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "22": |
|
|
|
|
|
TwentyTwoX = TwentyTwoX + OperationX; |
|
|
|
|
|
TwentyTwoY = TwentyTwoY + OperationY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "23": |
|
|
|
|
|
TwentyThreeX = TwentyThreeX + OperationX; |
|
|
|
|
|
TwentyThreeY = TwentyThreeY + OperationY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "24": |
|
|
|
|
|
TwentyFourX = TwentyFourX + OperationX; |
|
|
|
|
|
TwentyFourY = TwentyFourY + OperationY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "25": |
|
|
|
|
|
TwentyFiveX = TwentyFiveX + OperationX; |
|
|
|
|
|
TwentyFiveY = TwentyFiveY + OperationY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "26": |
|
|
|
|
|
TwentySixX = TwentySixX + OperationX; |
|
|
|
|
|
TwentySixY = TwentySixY + OperationY; |
|
|
|
|
|
break; |
|
|
|
|
|
case "27": |
|
|
|
|
|
TwentySevenX = TwentySevenX + OperationX; |
|
|
|
|
|
TwentySevenY = TwentySevenY + OperationY; |
|
|
|
|
|
break; |
|
|
|
|
|
default: |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
OperationX = 0; |
|
|
|
|
|
OperationY = 0; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void SetPosition() |
|
|
|
|
|
{ |
|
|
|
|
|
//判断是否有选择下发的设备 |
|
|
|
|
|
if (!PositionOne && !PositionTwo && !PositionThree && !PositionFour && !PositionFive && !PositionSix && !PositionSeven && !PositionEight && !PositionNine |
|
|
|
|
|
&& !PositionTen && !PositionEleven && !PositionTwelve && !PositionThirteen && !PositionFourteen && !PositionFifteen && !PositionSixteen && !PositionSeventeen && !PositionEighteen |
|
|
|
|
|
&& !PositionNineteen && !PositionTwenty && !PositionTwentyOne && !PositionTwentyTwo && !PositionTwentyThree && !PositionTwentyFour && !PositionTwentyFive && !PositionTwentySix && !PositionTwentySeven) |
|
|
|
|
|
{ |
|
|
|
|
|
MessageBox.Show("未选择点位"); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (PositionOne) |
|
|
|
|
|
{ |
|
|
|
|
|
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> {"1", OneX + OperationX, OneY + OperationY });//设定机械臂当前位置 |
|
|
|
|
|
} |
|
|
|
|
|
if (PositionTwo) |
|
|
|
|
|
{ |
|
|
|
|
|
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "2", TwoX + OperationX, TwoY + OperationY });//设定机械臂当前位置 |
|
|
|
|
|
} |
|
|
|
|
|
if (PositionThree) |
|
|
|
|
|
{ |
|
|
|
|
|
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "3", + OperationX, ThreeY + OperationY });//设定机械臂当前位置 |
|
|
|
|
|
} |
|
|
|
|
|
if (PositionFour) |
|
|
|
|
|
{ |
|
|
|
|
|
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "4", FourX + OperationX, FourY + OperationY });//设定机械臂当前位置 |
|
|
|
|
|
} |
|
|
|
|
|
if (PositionFive) |
|
|
|
|
|
{ |
|
|
|
|
|
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "5", FiveX + OperationX, FiveY + OperationY });//设定机械臂当前位置 |
|
|
|
|
|
} |
|
|
|
|
|
if (PositionSix) |
|
|
|
|
|
{ |
|
|
|
|
|
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "6", SixX + OperationX, SixY + OperationY });//设定机械臂当前位置 |
|
|
|
|
|
} |
|
|
|
|
|
if (PositionSeven) |
|
|
|
|
|
{ |
|
|
|
|
|
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "7", SevenX + OperationX, SevenY + OperationY });//设定机械臂当前位置 |
|
|
|
|
|
} |
|
|
|
|
|
if (PositionEight) |
|
|
|
|
|
{ |
|
|
|
|
|
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "8", EightX + OperationX, EightY + OperationY });//设定机械臂当前位置 |
|
|
|
|
|
} |
|
|
|
|
|
if (PositionNine) |
|
|
|
|
|
{ |
|
|
|
|
|
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "9", NineX + OperationX, NineY + OperationY });//设定机械臂当前位置 |
|
|
|
|
|
} |
|
|
|
|
|
if (PositionTen) |
|
|
|
|
|
{ |
|
|
|
|
|
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "10", TenX + OperationX, TenY + OperationY });//设定机械臂当前位置 |
|
|
|
|
|
} |
|
|
|
|
|
if (PositionEleven) |
|
|
|
|
|
{ |
|
|
|
|
|
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "11", ElevenX + OperationX, ElevenY + OperationY });//设定机械臂当前位置 |
|
|
|
|
|
} |
|
|
|
|
|
if (PositionTwelve) |
|
|
|
|
|
{ |
|
|
|
|
|
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "12", TwelveX + OperationX, TwelveY + OperationY });//设定机械臂当前位置 |
|
|
|
|
|
} |
|
|
|
|
|
if (PositionThirteen) |
|
|
|
|
|
{ |
|
|
|
|
|
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "13", ThirteenX + OperationX, ThirteenY + OperationY });//设定机械臂当前位置 |
|
|
|
|
|
} |
|
|
|
|
|
if (PositionFourteen) |
|
|
|
|
|
{ |
|
|
|
|
|
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "14", FourteenX + OperationX, FourteenY + OperationY });//设定机械臂当前位置 |
|
|
|
|
|
} |
|
|
|
|
|
if (PositionFifteen) |
|
|
|
|
|
{ |
|
|
|
|
|
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "15", FifteenX + OperationX, FifteenY + OperationY });//设定机械臂当前位置 |
|
|
|
|
|
} |
|
|
|
|
|
if (PositionSixteen) |
|
|
|
|
|
{ |
|
|
|
|
|
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "16", SixteenX + OperationX, SixteenY + OperationY });//设定机械臂当前位置 |
|
|
|
|
|
} |
|
|
|
|
|
if (PositionSeventeen) |
|
|
|
|
|
{ |
|
|
|
|
|
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "17", SeventeenX + OperationX, SeventeenY + OperationY });//设定机械臂当前位置 |
|
|
|
|
|
} |
|
|
|
|
|
if (PositionEighteen) |
|
|
|
|
|
{ |
|
|
|
|
|
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "18", EighteenX + OperationX, EighteenY + OperationY });//设定机械臂当前位置 |
|
|
|
|
|
} |
|
|
|
|
|
if (PositionNineteen) |
|
|
|
|
|
{ |
|
|
|
|
|
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "19", NineteenX + OperationX, NineteenY + OperationY });//设定机械臂当前位置 |
|
|
|
|
|
} |
|
|
|
|
|
if (PositionTwenty) |
|
|
|
|
|
{ |
|
|
|
|
|
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "20", TwentyX + OperationX, TwentyY + OperationY });//设定机械臂当前位置 |
|
|
|
|
|
} |
|
|
|
|
|
if (PositionTwentyOne) |
|
|
|
|
|
{ |
|
|
|
|
|
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "21", TwentyOneX + OperationX, TwentyOneY + OperationY });//设定机械臂当前位置 |
|
|
|
|
|
} |
|
|
|
|
|
if (PositionTwentyTwo) |
|
|
|
|
|
{ |
|
|
|
|
|
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "22", TwentyTwoX + OperationX, TwentyTwoY + OperationY });//设定机械臂当前位置 |
|
|
|
|
|
} |
|
|
|
|
|
if (PositionTwentyThree) |
|
|
|
|
|
{ |
|
|
|
|
|
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "23", TwentyThreeX + OperationX, TwentyThreeY + OperationY });//设定机械臂当前位置 |
|
|
|
|
|
} |
|
|
|
|
|
if (PositionTwentyFour) |
|
|
|
|
|
{ |
|
|
|
|
|
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "24", TwentyFourX + OperationX, TwentyFourY + OperationY });//设定机械臂当前位置 |
|
|
|
|
|
} |
|
|
|
|
|
if (PositionTwentyFive) |
|
|
|
|
|
{ |
|
|
|
|
|
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "25", TwentyFiveX + OperationX, TwentyFiveY + OperationY });//设定机械臂当前位置 |
|
|
|
|
|
} |
|
|
|
|
|
if (PositionTwentySix) |
|
|
|
|
|
{ |
|
|
|
|
|
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "26", TwentySixX + OperationX, TwentySixY + OperationY });//设定机械臂当前位置 |
|
|
|
|
|
} |
|
|
|
|
|
if (PositionTwentySeven) |
|
|
|
|
|
{ |
|
|
|
|
|
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "27", TwentySevenX + OperationX, TwentySevenY + OperationY });//设定机械臂当前位置 |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public MaterialCalibrationViewModel() |
|
|
|
|
|
{ |
|
|
|
|
|
PhysicalMaterialCoordinate(); |
|
|
|
|
|
ActionManage.GetInstance.Register(new Action<object>((o) => |
|
|
|
|
|
{ |
|
|
|
|
|
ThreadManage.GetInstance().Start(new Action(() => |
|
|
|
|
|
{ |
|
|
|
|
|
if(o is List<string> nums) |
|
|
|
|
|
{ |
|
|
|
|
|
Calibration(nums[0]); |
|
|
|
|
|
} |
|
|
|
|
|
}), "CalibrationCallBack"); |
|
|
|
|
|
}), "CalibrationCallBack"); |
|
|
|
|
|
SetNowPosition = new RelayCommand(() => |
|
|
|
|
|
{ |
|
|
|
|
|
if(!Point && !Left && !Right && !Down && !Up) |
|
|
|
|
|
{ |
|
|
|
|
|
MessageBox.Show("请选择需要移动的方式"); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!Point) |
|
|
|
|
|
{ |
|
|
|
|
|
if (!int.TryParse(Str, out Factor)) |
|
|
|
|
|
{ |
|
|
|
|
|
Factor = 1; |
|
|
|
|
|
} |
|
|
|
|
|
if(Factor > 100 || Factor<0) |
|
|
|
|
|
{ |
|
|
|
|
|
MessageBox.Show("请输入有效系数"); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(Left) |
|
|
|
|
|
{ |
|
|
|
|
|
OperationX = -1 * BasicPosition * Factor; |
|
|
|
|
|
} |
|
|
|
|
|
else if(Right) |
|
|
|
|
|
{ |
|
|
|
|
|
OperationX = BasicPosition * Factor; |
|
|
|
|
|
} |
|
|
|
|
|
else if(Down) |
|
|
|
|
|
{ |
|
|
|
|
|
OperationY = BasicPosition * Factor; |
|
|
|
|
|
} |
|
|
|
|
|
else if(Up) |
|
|
|
|
|
{ |
|
|
|
|
|
OperationY = -1 * BasicPosition * Factor; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
OperationX = 0; |
|
|
|
|
|
OperationY = 0; |
|
|
|
|
|
} |
|
|
|
|
|
SetPosition(); |
|
|
|
|
|
}); |
|
|
|
|
|
SaveCoordinate = new RelayCommand(() => |
|
|
|
|
|
{ |
|
|
|
|
|
SaveMaterialCoordinate(); |
|
|
|
|
|
}); |
|
|
|
|
|
ReadCoordinate = new RelayCommand(() => |
|
|
|
|
|
{ |
|
|
|
|
|
PhysicalMaterialCoordinate(); |
|
|
|
|
|
}); |
|
|
|
|
|
AutoCalculation = new RelayCommand(() => |
|
|
|
|
|
{ |
|
|
|
|
|
AutoCalculationCoordination(); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
/// 自动计算坐标 |
|
|
|
|
|
/// </summary> |
|
|
|
|
|
private void AutoCalculationCoordination() |
|
|
|
|
|
{ |
|
|
|
|
|
#region 菜品库一层计算 |
|
|
|
|
|
//X轴改变 |
|
|
|
|
|
TwoX = ThreeX = FourX = FiveX = SixX = SevenX = EightX = NineX = OneX; |
|
|
|
|
|
TwoY = OneY + smartMaterialClearanceY; |
|
|
|
|
|
ThreeY = OneY + 2*smartMaterialClearanceY; |
|
|
|
|
|
FourY = OneY + 2 * smartMaterialClearanceY + bigMaterialClearanceY; |
|
|
|
|
|
FiveY = OneY + 3 * smartMaterialClearanceY + bigMaterialClearanceY; |
|
|
|
|
|
SixY = OneY + 4 * smartMaterialClearanceY + bigMaterialClearanceY; |
|
|
|
|
|
SevenY = OneY + 4 * smartMaterialClearanceY + 2*bigMaterialClearanceY; |
|
|
|
|
|
EightY = OneY + 5 * smartMaterialClearanceY + 2 * bigMaterialClearanceY; |
|
|
|
|
|
NineY = OneY + 6 * smartMaterialClearanceY + 2 * bigMaterialClearanceY; |
|
|
|
|
|
#endregion |
|
|
|
|
|
#region 菜品库二层计算 |
|
|
|
|
|
//X轴改变 |
|
|
|
|
|
TenX = ElevenX = TwelveX = ThirteenX = FourteenX = FifteenX = SixteenX = SeventeenX = EighteenX = (OneX + materialClearanceX); |
|
|
|
|
|
TenY = OneY; |
|
|
|
|
|
ElevenY = OneY + smartMaterialClearanceY; |
|
|
|
|
|
TwelveY = OneY + 2 * smartMaterialClearanceY; |
|
|
|
|
|
ThirteenY = OneY + 2 * smartMaterialClearanceY + bigMaterialClearanceY; |
|
|
|
|
|
FourteenY = OneY + 3 * smartMaterialClearanceY + bigMaterialClearanceY; |
|
|
|
|
|
FifteenY = OneY + 4 * smartMaterialClearanceY + bigMaterialClearanceY; |
|
|
|
|
|
SixteenY = OneY + 4 * smartMaterialClearanceY + 2 * bigMaterialClearanceY; |
|
|
|
|
|
SeventeenY = OneY + 5 * smartMaterialClearanceY + 2 * bigMaterialClearanceY; |
|
|
|
|
|
EighteenY = OneY + 6 * smartMaterialClearanceY + 2 * bigMaterialClearanceY; |
|
|
|
|
|
#endregion |
|
|
|
|
|
#region 菜品库三层计算 |
|
|
|
|
|
//X轴改变 |
|
|
|
|
|
NineteenX = TwentyX = TwentyOneX = TwentyTwoX = TwentyThreeX = TwentyFourX = TwentyFiveX = TwentySixX = TwentySevenX = (OneX + 2 * materialClearanceX); |
|
|
|
|
|
NineteenY = OneY; |
|
|
|
|
|
TwentyY = OneY + smartMaterialClearanceY; |
|
|
|
|
|
TwentyOneY = OneY + 2 * smartMaterialClearanceY; |
|
|
|
|
|
TwentyTwoY = OneY + 2 * smartMaterialClearanceY + bigMaterialClearanceY; |
|
|
|
|
|
TwentyThreeY = OneY + 3 * smartMaterialClearanceY + bigMaterialClearanceY; |
|
|
|
|
|
TwentyFourY = OneY + 4 * smartMaterialClearanceY + bigMaterialClearanceY; |
|
|
|
|
|
TwentyFiveY = OneY + 4 * smartMaterialClearanceY + 2 * bigMaterialClearanceY; |
|
|
|
|
|
TwentySixY = OneY + 5 * smartMaterialClearanceY + 2 * bigMaterialClearanceY; |
|
|
|
|
|
TwentySevenY = OneY + 6 * smartMaterialClearanceY + 2 * bigMaterialClearanceY; |
|
|
|
|
|
#endregion |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |