|
- 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
- #region 菜品库高度测距点位
- public bool PositionMaterialHeight { get { return _PositionMaterialHeight; } set { _PositionMaterialHeight = value; OnPropertyChanged(); } }
- private bool _PositionMaterialHeight;
- public int MaterialHeightX { get { return _MaterialHeightX; } set { _MaterialHeightX = value; OnPropertyChanged(); } }
- private int _MaterialHeightX;
- public int MaterialHeightY { get { return _MaterialHeightY; } set { _MaterialHeightY = value; OnPropertyChanged(); } }
- private int _MaterialHeightY;
- #endregion
- #region 炒锅1菜品交互位置
- public bool PositionFrying1 { get { return _PositionFrying1; } set { _PositionFrying1 = value; OnPropertyChanged(); } }
- private bool _PositionFrying1;
- public int Frying1X { get { return _Frying1X; } set { _Frying1X = value; OnPropertyChanged(); } }
- private int _Frying1X;
- public int Frying1Y { get { return _Frying1Y; } set { _Frying1Y = value; OnPropertyChanged(); } }
- private int _Frying1Y;
- #endregion
- #region 炒锅2菜品交互位置
- public bool PositionFrying2 { get { return _PositionFrying2; } set { _PositionFrying2 = value; OnPropertyChanged(); } }
- private bool _PositionFrying2;
- public int Frying2X { get { return _Frying2X; } set { _Frying2X = value; OnPropertyChanged(); } }
- private int _Frying2X;
- public int Frying2Y { get { return _Frying2Y; } set { _Frying2Y = value; OnPropertyChanged(); } }
- private int _Frying2Y;
- #endregion
- #region 第一层菜品库出菜位置
- public bool PositionMaterialOne { get { return _PositionMaterialOne; } set { _PositionMaterialOne = value; OnPropertyChanged(); } }
- private bool _PositionMaterialOne;
- public int MaterialOneX { get { return _MaterialOneX; } set { _MaterialOneX = value; OnPropertyChanged(); } }
- private int _MaterialOneX;
- #endregion
- #region 第二层菜品库出菜位置
- public bool PositionMaterialTwo { get { return _PositionMaterialTwo; } set { _PositionMaterialTwo = value; OnPropertyChanged(); } }
- private bool _PositionMaterialTwo;
- public int MaterialTwoX { get { return _MaterialTwoX; } set { _MaterialTwoX = value; OnPropertyChanged(); } }
- private int _MaterialTwoX;
- #endregion
- #region 第三层菜品库出菜位置
- public bool PositionMaterialThree { get { return _PositionMaterialThree; } set { _PositionMaterialThree = value; OnPropertyChanged(); } }
- private bool _PositionMaterialThree;
- public int MaterialThreeX { get { return _MaterialThreeX; } set { _MaterialThreeX = value; OnPropertyChanged(); } }
- private int _MaterialThreeX;
- #endregion
- #region 菜品库各传感器高度临时值
- public int Distance_1 { get { return _Distance_1; } set { _Distance_1 = value; OnPropertyChanged(); } }
- private int _Distance_1;
- public int Distance_2 { get { return _Distance_2; } set { _Distance_2 = value; OnPropertyChanged(); } }
- private int _Distance_2;
- public int Distance_3 { get { return _Distance_3; } set { _Distance_3 = value; OnPropertyChanged(); } }
- private int _Distance_3;
- #endregion
-
- #region 控制
- public int SettingX { get { return _settingX; } set { _settingX = value; OnPropertyChanged(); } }
- private int _settingX = 0;
- public int SettingY { get { return _settingY; } set { _settingY = value; OnPropertyChanged(); } }
- private int _settingY = 0;
- public int MoveSpeed { get { return _moveSpeed; } set { _moveSpeed = value; OnPropertyChanged(); } }
- private int _moveSpeed;
-
- public int SensingDistance_1 { get { return _sensingDistance_1; } set { _sensingDistance_1 = value; OnPropertyChanged(); } }
- private int _sensingDistance_1;
- public int SensingDistance_2 { get { return _sensingDistance_2; } set { _sensingDistance_2 = value; OnPropertyChanged(); } }
- private int _sensingDistance_2;
- public int SensingDistance_3 { get { return _sensingDistance_3; } set { _sensingDistance_3 = value; OnPropertyChanged(); } }
- private int _sensingDistance_3;
-
- public RelayCommand SetSpeed { get; set; }//速度设定
- public RelayCommand SetArmPosition { get; set; }//机器臂位置设定
-
- public RelayCommand GetTestDistance_1 { get; set; }//获取感应器距离1
- public RelayCommand GetTestDistance_2 { get; set; }//获取感应器距离2
- public RelayCommand GetTestDistance_3 { get; set; }//获取感应器距离3
-
- #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 = 54000;
-
- /// <summary>
- /// Y轴小菜品库的间隙
- /// </summary>
- private const int smartMaterialClearanceY = 28000;
-
- /// <summary>
- /// X轴菜品库的间隙
- /// </summary>
- private const int materialClearanceX1 = 78000;
-
- /// <summary>
- /// X轴菜品库的间隙
- /// </summary>
- private const int materialClearanceX2 = 88000;
-
- /// <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; }//设置机械臂基于当前坐标往下移动
-
- public RelayCommand FoodLibInit { get; set; }//初始化
- public RelayCommand StartElectromagnetism { get; set; }//电磁阀启动
- public RelayCommand StopElectromagnetism { get; set; }
- public RelayCommand PawTurnFront { get; set; }//夹爪正转
- public RelayCommand PawTurnBack { get; set; }//夹爪反转
- public RelayCommand PawToPoint1 { get; set; }//夹爪位置1
- public RelayCommand PawToPoint2 { get; set; }//夹爪位置2
- public RelayCommand PawToPoint3 { get; set; }//夹爪位置3
- public RelayCommand GetDistance_1 { get; set; }//感应测距1
- public RelayCommand GetDistance_2 { get; set; }//感应测距2
- public RelayCommand GetDistance_3 { get; set; }//感应测距3
-
- 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 = TwentyThreeY;
- 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;
- }
- }
-
- materialCoordinate.frying1.X = Frying1X;
- materialCoordinate.frying1.Y = Frying1Y;
- materialCoordinate.frying2.X = Frying2X;
- materialCoordinate.frying2.Y = Frying2Y;
- materialCoordinate.materialHeight.X = MaterialHeightX;
- materialCoordinate.materialHeight.Y = MaterialHeightY;
- materialCoordinate.distance_1 = Distance_1;
- materialCoordinate.distance_2 = Distance_2;
- materialCoordinate.distance_3 = Distance_3;
- materialCoordinate.MaterialOneX = MaterialOneX;
- materialCoordinate.MaterialTwoX = MaterialTwoX;
- materialCoordinate.MaterialThreeX = MaterialThreeX;
-
- Json<MaterialCoordinate>.Data = materialCoordinate;
- Json<MaterialCoordinate>.Save();
- //更新当前的菜品库数据
- MaterialCoordinate.GetInstance().frying1 = materialCoordinate.frying1;
- MaterialCoordinate.GetInstance().frying2 = materialCoordinate.frying2;
- MaterialCoordinate.GetInstance().materialHeight = materialCoordinate.materialHeight;
- MaterialCoordinate.GetInstance().dicNoMaterialCoordinate = materialCoordinate.dicNoMaterialCoordinate;
- MaterialCoordinate.GetInstance().MaterialOneX = materialCoordinate.MaterialOneX;
- MaterialCoordinate.GetInstance().MaterialTwoX = materialCoordinate.MaterialTwoX;
- MaterialCoordinate.GetInstance().MaterialThreeX = materialCoordinate.MaterialThreeX;
- }
-
- /// <summary>
- /// 读取坐标系
- /// </summary>
- /// <returns></returns>
- private MaterialCoordinate ReadMaterialCoordinate()
- {
- try
- {
- Json<MaterialCoordinate>.Read();
- MaterialCoordinate materialCoordinate = Json<MaterialCoordinate>.Data;
- return materialCoordinate;
- }
- catch (Exception ex)
- {
- return null;
- }
- }
-
- /// <summary>
- /// 从json文件中读取菜品库坐标系数据
- /// </summary>
- private void PhysicalMaterialCoordinate()
- {
- MaterialCoordinate materialCoordinate = ReadMaterialCoordinate();
-
- if(materialCoordinate == null)
- {
- return;
- }
-
- 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;
- case "MaterialHeight":
- MaterialHeightX = materialCoordinate.materialHeight.X;
- MaterialHeightY = materialCoordinate.materialHeight.Y;
- break;
- case "Frying1":
- Frying1X = materialCoordinate.frying1.X;
- Frying1Y = materialCoordinate.frying1.Y;
- break;
- case "Frying2":
- Frying2X = materialCoordinate.frying2.X;
- Frying2Y = materialCoordinate.frying2.Y;
- break;
- default:
- break;
- }
- }
- }
-
- MaterialOneX = materialCoordinate.MaterialOneX;
- MaterialTwoX = materialCoordinate.MaterialTwoX;
- MaterialThreeX = materialCoordinate.MaterialThreeX;
- MaterialHeightX = materialCoordinate.materialHeight.X;
- MaterialHeightY = materialCoordinate.materialHeight.Y;
- Frying1X = materialCoordinate.frying1.X;
- Frying1Y = materialCoordinate.frying1.Y;
- Frying2X = materialCoordinate.frying2.X;
- Frying2Y = materialCoordinate.frying2.Y;
- Distance_1 = materialCoordinate.distance_1;
- Distance_2 = materialCoordinate.distance_2;
- Distance_3 = materialCoordinate.distance_3;
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="Num"></param>
- 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;
- case "MaterialHeight":
- MaterialHeightX = MaterialHeightX + OperationX;
- MaterialHeightY = MaterialHeightY + OperationY;
- break;
- case "Frying1":
- Frying1X = Frying1X + OperationX;
- Frying1Y = Frying1Y + OperationY;
- break;
- case "Frying2":
- Frying2X = Frying2X + OperationX;
- Frying2Y = Frying2Y + OperationY;
- break;
- case "MaterialOne":
- MaterialOneX = MaterialOneX + OperationX;
- break;
- case "MaterialTwo":
- MaterialTwoX = MaterialTwoX + OperationX;
- break;
- case "MaterialThree":
- MaterialThreeX = MaterialThreeX + OperationX;
- 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
- && !PositionMaterialHeight && !PositionFrying1 && !PositionFrying2 && !PositionMaterialOne && !PositionMaterialThree &&!PositionMaterialTwo)
- {
- 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", ThreeX + 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 });//设定机械臂当前位置
- //}
- if (PositionMaterialHeight)
- {
- ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "MaterialHeight", MaterialHeightX + OperationX, MaterialHeightY + OperationY });//设定机械臂当前位置
- }
- if (PositionFrying1)
- {
- ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "Frying1", Frying1X + OperationX, Frying1Y + OperationY });//设定机械臂当前位置
- }
- if (PositionFrying2)
- {
- ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "Frying2", Frying2X + OperationX, Frying2Y + OperationY });//设定机械臂当前位置
- }
- if(PositionMaterialOne)
- {
- ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "MaterialOne", MaterialOneX + OperationX, 0 });//设定机械臂当前位置
- }
- if (PositionMaterialTwo)
- {
- ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "MaterialTwo", MaterialTwoX + OperationX, 0 });//设定机械臂当前位置
- }
- if (PositionMaterialThree)
- {
- ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "MaterialThree", MaterialThreeX + OperationX, 0 });//设定机械臂当前位置
- }
- }
-
- public MaterialCalibrationViewModel()
- {
- StartElectromagnetism = new RelayCommand(() => { ActionManage.GetInstance.Send("Electromagnetism", new List<bool> { false }); });//电磁阀启动
- StopElectromagnetism = new RelayCommand(() => { ActionManage.GetInstance.Send("Electromagnetism", new List<bool> { true }); });//电磁阀关闭
-
- FoodLibInit = new RelayCommand(() => { ActionManage.GetInstance.Send("FoodLibInit"); });//菜品库初始化
- PawToPoint1 = new RelayCommand(() => { ActionManage.GetInstance.Send("PawToPoint1"); });//爪子去1号位
- PawToPoint2 = new RelayCommand(() => { ActionManage.GetInstance.Send("PawToPoint2"); });//爪子去2号位
- PawToPoint3 = new RelayCommand(() => { ActionManage.GetInstance.Send("PawToPoint3"); });//爪子去3号位
- PawTurnFront = new RelayCommand(() => {
- ActionManage.GetInstance.Send("PawTurnFront");
- });//夹爪伸出
- PawTurnBack = new RelayCommand(() => {
- ActionManage.GetInstance.Send("PawTurnBack");
- });//夹爪收缩
- GetDistance_1 = new RelayCommand(() => { ActionManage.GetInstance.Send("GetDistance_1"); });//感应距离1
- GetDistance_2 = new RelayCommand(() => { ActionManage.GetInstance.Send("GetDistance_2"); });//感应距离2
- GetDistance_3 = new RelayCommand(() => { ActionManage.GetInstance.Send("GetDistance_3"); });//感应距离3
-
- SetSpeed = new RelayCommand(() => { ActionManage.GetInstance.Send("SetSpeed", new List<int> { MoveSpeed }); });//速度设定
- SetArmPosition = new RelayCommand(() => {
- ActionManage.GetInstance.Send("SetArmPosition", new List<int> { SettingX, SettingY });
- });//设定移动位置
-
- PhysicalMaterialCoordinate();
- ActionManage.GetInstance.Register(new Action<object>((o) =>
- {
- ThreadManage.GetInstance().Start(new Action(() =>
- {
- if(o is List<string> nums)
- {
- Calibration(nums[0]);
- }
- }), "CalibrationCallBack");
- }), "CalibrationCallBack");
- ActionManage.GetInstance.Register(new Action<object>((o) =>
- {
- ThreadManage.GetInstance().Start(new Action(() =>
- {
- if (o is List<string> nums)
- {
- int distance = 0;
- bool ret = false;
- ret = int.TryParse(nums[1], out distance);
- if (ret == false) { return; }
- if (nums[0] == "1")
- {
- Distance_1= distance;
- }
- else if (nums[0] == "2")
- {
- Distance_2 = distance;
- }
- else if (nums[0] == "3")
- {
- Distance_3 = distance;
- }
- }
- }), "GetDistanceCallBack");
- }), "GetDistanceCallBack");
- 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 + 1000;
- ThreeY = OneY + 1000+smartMaterialClearanceY;
- FourY = OneY + 1000 + smartMaterialClearanceY + bigMaterialClearanceY;
- FiveY = OneY + 1000 + 2 * smartMaterialClearanceY + bigMaterialClearanceY;
- SixY = OneY + 3 * smartMaterialClearanceY + bigMaterialClearanceY;
- SevenY = OneY + 3 * smartMaterialClearanceY + 2*bigMaterialClearanceY;
- EightY = OneY + 4 * smartMaterialClearanceY + 2 * bigMaterialClearanceY;
- NineY = OneY + 5 * smartMaterialClearanceY + 2 * bigMaterialClearanceY;
- #endregion
- #region 菜品库二层计算
- //X轴改变
- TenX = ElevenX = TwelveX = ThirteenX = FourteenX = FifteenX = SixteenX = SeventeenX = EighteenX = (OneX + materialClearanceX1);
- TenY = OneY;
- ElevenY = OneY + 1000;
- TwelveY = OneY + smartMaterialClearanceY;
- ThirteenY = OneY + smartMaterialClearanceY + bigMaterialClearanceY;
- FourteenY = OneY + 2 * smartMaterialClearanceY + bigMaterialClearanceY;
- FifteenY = OneY + 3 * smartMaterialClearanceY + bigMaterialClearanceY;
- SixteenY = OneY + 3 * smartMaterialClearanceY + 2 * bigMaterialClearanceY;
- SeventeenY = OneY + 4 * smartMaterialClearanceY + 2 * bigMaterialClearanceY;
- EighteenY = OneY + 5 * smartMaterialClearanceY + 2 * bigMaterialClearanceY;
- #endregion
- #region 菜品库三层计算
- //X轴改变
- NineteenX = TwentyX = TwentyOneX = TwentyTwoX = TwentyThreeX = TwentyFourX = TwentyFiveX = TwentySixX = TwentySevenX = (OneX + 2 * materialClearanceX2);
- NineteenY = OneY;
- TwentyY = OneY + 1000;
- TwentyOneY = OneY + smartMaterialClearanceY;
- TwentyTwoY = OneY + smartMaterialClearanceY + bigMaterialClearanceY;
- TwentyThreeY = OneY + 2 * smartMaterialClearanceY + bigMaterialClearanceY;
- TwentyFourY = OneY + 3 * smartMaterialClearanceY + bigMaterialClearanceY;
- TwentyFiveY = OneY + 3 * smartMaterialClearanceY + 2 * bigMaterialClearanceY;
- TwentySixY = OneY + 4 * smartMaterialClearanceY + 2 * bigMaterialClearanceY;
- TwentySevenY = OneY + 5 * smartMaterialClearanceY + 2 * bigMaterialClearanceY;
- #endregion
- }
-
- #endregion
-
- }
- }
|