Exemplo n.º 1
0
 public void PartMoveEnd(EnumSlotSelect openSlot = EnumSlotSelect.None)
 {
     FakeMoveArrivalQueue.Enqueue(new PositionArgs()
     {
         EnumLocalArrival = EnumLocalArrival.EndArrival,
         MapPosition      = MoveStatus.LastMapPosition
     });
 }
        private void btnSendMove_Click(object sender, EventArgs e)
        {
            try
            {
                MapPosition             mapPosition = new MapPosition(decimal.ToDouble(numMovePositionX.Value), decimal.ToDouble(numMovePositionY.Value));
                int                     headAngle   = decimal.ToInt32(numHeadAngle.Value);
                int                     speed       = decimal.ToInt32(numMoveSpeed.Value);
                EnumAseMoveCommandIsEnd isEnd       = (EnumAseMoveCommandIsEnd)boxIsEnd.SelectedItem;
                EnumIsExecute           isExecute   = (EnumIsExecute)boxKeepOrGo.SelectedItem;
                EnumSlotSelect          slotOpen    = (EnumSlotSelect)boxSlotOpen.SelectedItem;

                asePackage.PartMove(mapPosition, headAngle, speed, isEnd, isExecute, slotOpen);
            }
            catch (Exception ex)
            {
                LogException(GetType().Name + ":" + MethodBase.GetCurrentMethod().Name, ex.Message);
            }
        }
        private void btnSendRobot_Click(object sender, EventArgs e)
        {
            try
            {
                string         pioDirection = boxPioDirection.SelectedIndex.ToString("0");
                string         gateType     = numGateType.Value.ToString("0");
                EnumLDUD       loadunload1  = (EnumLDUD)boxLDUD1.SelectedItem;
                EnumSlotSelect slotSelect1  = (EnumSlotSelect)boxSlotSelect1.SelectedItem;
                if (slotSelect1 == EnumSlotSelect.None || slotSelect1 == EnumSlotSelect.Both)
                {
                    return;
                }
                string slot1       = slotSelect1 == EnumSlotSelect.Left ? "0000L" : "0000R";
                string portNumber1 = numPortNumber1.Value.ToString("0");
                string addressId1  = txtAddressId1.Text.Trim().PadLeft(5, '0').Substring(0, 5);

                string robotCommandInfo = "";

                switch (loadunload1)
                {
                case EnumLDUD.LD:
                {
                    robotCommandInfo = string.Concat(pioDirection, addressId1, slot1, gateType, portNumber1);
                }
                break;

                case EnumLDUD.UD:
                {
                    robotCommandInfo = string.Concat(pioDirection, slot1, addressId1, gateType, portNumber1);
                }
                break;

                case EnumLDUD.None:
                default:
                    return;
                }

                EnumLDUD       loadunload2 = (EnumLDUD)boxLDUD2.SelectedItem;
                EnumSlotSelect slotSelect2 = (EnumSlotSelect)boxSlotSelect2.SelectedItem;
                if (slotSelect2 == EnumSlotSelect.Both)
                {
                    return;
                }
                string slot2       = slotSelect2 == EnumSlotSelect.Left ? "0000L" : "0000R";
                string portNumber2 = numPortNumber2.Value.ToString("0");
                string addressId2  = txtAddressId2.Text.Trim().PadLeft(5, '0').Substring(0, 5);

                switch (loadunload2)
                {
                case EnumLDUD.LD:
                {
                    robotCommandInfo = string.Concat(robotCommandInfo, addressId2, slot2, portNumber2);
                }
                break;

                case EnumLDUD.UD:
                {
                    robotCommandInfo = string.Concat(robotCommandInfo, slot2, addressId2, portNumber2);
                }
                break;

                case EnumLDUD.None:
                {
                    robotCommandInfo = robotCommandInfo.PadRight(24, '0');
                }
                break;
                }

                asePackage.DoRobotCommand(robotCommandInfo);
            }
            catch (Exception ex)
            {
                LogException(GetType().Name + ":" + MethodBase.GetCurrentMethod().Name, ex.Message);
            }
        }