public void carryIn(string name) { name = name.Replace("_", ""); Dictionary <string, int> keys = new Dictionary <string, int>(); keys.Add("RX09RAWIN", 18); keys.Add("RX09EMPTYIN", 7); keys.Add("RX08RAWIN", 17); keys.Add("RX08EMPTYIN", 10); keys.Add("RX07RAWIN", 11); foreach (var item in keys) { if (name.Contains(item.Key)) { int qty = 0; TestRightCarryService <AllenBradleyControlDevice> carry = new TestRightCarryService <AllenBradleyControlDevice>(new AllenBradleyControlDevice()); var ret = carry.CarryOut("1", keys[item.Key].ToString(), ref qty); break; } } }
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(); }); }
//料库执行出库 private bool WareHouseOutMission(AgvOutMissonModel mission) { if (missionContext.carryDevice as RightCarryService.TestControlDevice != null) { mission.CarryProcess = CarryMissonProcessEnum.FINISHED; return(true); } TestRightCarryService <IControlDevice> carry = new TestRightCarryService <IControlDevice>(missionContext.carryDevice); int quantity = 0; var ret = carry.CarryOut(mission.ProductId, mission.MaterialId, ref quantity); if (ret == false) { mission.Process = AgvMissonProcessEnum.CANCEL; mission.CarryProcess = CarryMissonProcessEnum.CANCEL; carry.ReleaseLock(); return(false); } mission.CarryProcess = CarryMissonProcessEnum.FINISHED; carry.ReleaseLock(); return(true); }