// source, target are assigned at this point yet public SimpleConveyorCommand(TelegramTransportTO tel) : base() { this.ID = tel.MFCS_ID; this.Material = tel.Palette.Barcode; switch (tel.Order) { case TelegramTransportTO.ORDER_MOVE: Task = EnumTask.Move; break; case TelegramTransportTO.ORDER_PALETTECREATE: Task = EnumTask.Create; break; case TelegramTransportTO.ORDER_PALETTEDELETE: Task = EnumTask.Delete; break; default: break; } //this.Source = tel.Source //this.Target = tel.Target; this.Time = DateTime.Now; }
public virtual void InitialNotify(Telegram t, UInt32 material) { try { // InitialNotified = true; // Warehouse.DBService.InitialNotify(Name, (int) material); // Place = Warehouse.DBService.FindPlace(Name); InitialNotified = true; Place p = Warehouse.DBService.FindMaterial((int)material); if (WriteToDB == WriteToDB.Always || (WriteToDB == WriteToDB.Try && (p == null || p.Place1 == Name))) { Warehouse.DBService.InitialNotify(Name, (int)material); Place = Warehouse.DBService.FindPlace(Name); if (Place != null) { Warehouse.OnMaterialMove?.Invoke(Place, EnumMovementTask.Move); } } else if (material != 0) { Place = new Place { Material = (int)material, Place1 = Name }; Warehouse.OnMaterialMove?.Invoke(Place, EnumMovementTask.Move); } if (this is ConveyorJunction) { ConveyorJunction jc = this as ConveyorJunction; TelegramTransportTO to = t as TelegramTransportTO; if (to != null && jc.ActiveRoute != null && (to.Target != jc.ActiveRoute.Items[0].Final.PLC_ID)) { jc.ActiveRoute = null; jc.ActiveMaterial = null; } } } catch (Exception ex) { Warehouse.AddEvent(Event.EnumSeverity.Error, Event.EnumType.Exception, ex.Message); throw new ConveyorBasicException(String.Format("{0} ConveyorBasic.InitialNotify material({1}) fault.", Name, material)); } }
public void ProcesMaterialNotify(TelegramTransportTO tel) { try { // update materialID if (tel.Confirmation != TelegramTransportTO.CONFIRMATION_PALETTETAKEN && tel.Confirmation != TelegramTransportTO.CONFIRMATION_PALETTEDELETED) { // TAI specific: change hc to 2 if we can store to higher rack if (tel.SenderTransport == 100 && Warehouse.DBService.IsRackSlotHC2Empty()) { tel.Palette.Weight = (ushort)(20000 + tel.Palette.Weight % 10000); } CreateOrUpdateMaterialID(tel.Palette); } if (tel.Confirmation == TelegramTransportTO.CONFIRMATION_NOTIFY || tel.Confirmation == TelegramTransportTO.CONFIRMATION_DIMENSIONCHECKERROR) { // Move(tel.Palette.Barcode, Warehouse.FindDeviceByPLC_ID(tel.Previous), this); ConveyorBasic src = Warehouse.FindDeviceByPLC_ID(tel.Previous); Move(tel.Palette.Barcode, src, this); } else if (tel.Confirmation == TelegramTransportTO.CONFIRMATION_INITIALNOTIFY) { InitialNotify(tel, tel.Palette.Barcode); } else if (tel.Confirmation == TelegramTransportTO.CONFIRMATION_NEWPALETTE || tel.Confirmation == TelegramTransportTO.CONFIRMATION_PALETTECREATED) { try { Place p = Warehouse.DBService.FindMaterial((int)tel.Palette.Barcode); if (p != null) { Warehouse.AddEvent(Event.EnumSeverity.Error, Event.EnumType.Material, string.Format("Place {0}: pallet {1} exists in the system", p.Place1, tel.Palette.Barcode)); } MaterialCreate(tel.Palette.Barcode); FinishCommand(tel.MFCS_ID, Command, SimpleCommand.EnumStatus.Finished); } catch { Command.Reason = SimpleCommand.EnumReason.MFCS; FinishCommand(tel.MFCS_ID, Command, SimpleCommand.EnumStatus.Canceled); throw; } finally { Command = null; } } else if (tel.Confirmation == TelegramTransportTO.CONFIRMATION_PALETTETAKEN || tel.Confirmation == TelegramTransportTO.CONFIRMATION_PALETTEDELETED) { try { MaterialDelete(tel.Palette.Barcode); FinishCommand(tel.MFCS_ID, Command, SimpleCommand.EnumStatus.Finished); } catch { Command.Reason = SimpleCommand.EnumReason.MFCS; FinishCommand(tel.MFCS_ID, Command, SimpleCommand.EnumStatus.Canceled); throw; } finally { Command = null; } } else if (tel.Confirmation == TelegramTransportTO.CONFIRMATION_COMMANDFINISHED) { try { Move(tel.Palette.Barcode, Warehouse.FindDeviceByPLC_ID(tel.Previous), this); // for output we need additional confirmation PALETTETAKEN if (tel.MFCS_ID != 0 && (!(this is IConveyorOutput))) { FinishCommand(tel.MFCS_ID, Command, SimpleCommand.EnumStatus.Finished); } } finally { if (tel.MFCS_ID != 0 && (!(this is IConveyorOutput))) { Command = null; } } } else if (tel.Confirmation == TelegramTransportTO.CONFIRMATION_FAULT) { try { Command.Reason = (Database.SimpleCommand.EnumReason)tel.Confirmation; FinishCommand(tel.MFCS_ID, Command, SimpleCommand.EnumStatus.Canceled); } finally { Command = null; } } else if (tel.Confirmation == TelegramTransportTO.CONFIRMATION_NONE) { try { Command.Reason = (Database.SimpleCommand.EnumReason)tel.Fault; FinishCommand(tel.MFCS_ID, Command, SimpleCommand.EnumStatus.Canceled); } finally { Command = null; } } } catch (Exception ex) { Command.Reason = SimpleCommand.EnumReason.MFCS; FinishCommand(tel.MFCS_ID, Command, SimpleCommand.EnumStatus.Canceled); Warehouse.AddEvent(Event.EnumSeverity.Error, Event.EnumType.Exception, ex.Message); throw new ConveyorException(String.Format("{0} ProcesMaterialNotify failed", Name)); } }