示例#1
0
        //料库执行入库
        private bool WareHouseInMission(AgvInMissonModel mission)
        {
            if (missionContext.carryDevice as RightCarryService.TestControlDevice != null)
            {
                mission.CarryProcess = CarryMissonProcessEnum.FINISHED;
                return(true);
            }

            TestRightCarryService <IControlDevice> carry = new TestRightCarryService <IControlDevice>(missionContext.carryDevice);

            var ret = carry.CarryIn(mission.ProductId, mission.MaterialId);

            if (ret == false)
            {
                mission.Process      = AgvMissonProcessEnum.CANCEL;
                mission.CarryProcess = CarryMissonProcessEnum.CANCEL;
                carry.ReleaseLock();
                return(false);
            }

            mission.CarryProcess = CarryMissonProcessEnum.FINISHED;
            carry.ReleaseLock();
            return(true);
        }
示例#2
0
        private void OnReq_Command()
        {
            Task.Factory.StartNew(() =>
            {
                if (Req_Fin == 1)
                {
                    return;
                }

                Req_Fin = 1;

                TestRightCarryService <AllenBradleyControlDevice> carry = new TestRightCarryService <AllenBradleyControlDevice>(carryDevice);
                carry.SendRightCarryServiceStateMessageEvent           += (s) => {
                    DispatcherHelper.CheckBeginInvokeOnUI(() =>
                    {
                        Messages.Add(new MessageItem {
                            State = s.State, Message = s.Message, CreateDateTime = DateTime.Now
                        });
                    });
                };

                if (In_Out == false)
                {
                    var ret = carry.CarryIn(Prod_Type.ToString(), Mate_Type.ToString());
                    Req_Fin = ret == true ? 2 : 3;
                }
                else
                {
                    int qty = 0;
                    var ret = carry.CarryOut(Prod_Type.ToString(), Mate_Type.ToString(), ref qty);
                    Req_Fin = ret == true ? 2 : 3;
                }

                carry.ReleaseLock();
            });
        }