Beispiel #1
0
        public override void FinishCommand(Int32 id, SimpleCommand cmd, SimpleCommand.EnumStatus s)
        {
            try
            {
                if (cmd == null)
                {
                    Warehouse.AddEvent(Event.EnumSeverity.Event, Event.EnumType.Program, String.Format("Conveyor.FinishCommand ({0},{1},{2}) ", id, "null", s));
                }

                SimpleConveyorCommand cOld = null;
                if (cmd == null || cmd.ID != id)
                {
                    if (id != 0)
                    {
                        cOld = Warehouse.DBService.FindSimpleConveyorCommandByID(id);
                    }
                }

                if (cmd == null)
                {
                    cmd = cOld;
                }

                if (cmd != null)
                {
                    cmd.Status = s;
                    Warehouse.DBService.UpdateSimpleCommand(cmd);
                    if (cmd.Status == SimpleCommand.EnumStatus.Finished || cmd.Status == SimpleCommand.EnumStatus.Canceled)
                    {
                        OnSimpleCommandFinish(cmd);
                    }
                    Warehouse.AddEvent(Event.EnumSeverity.Event, Event.EnumType.Command, cmd.ToString());
                }
                if (cOld != null && cOld.Status < SimpleCommand.EnumStatus.Canceled)
                {
                    cOld.Status = SimpleCommand.EnumStatus.Canceled;
                    cOld.Reason = SimpleCommand.EnumReason.MFCS;
                    Warehouse.DBService.UpdateSimpleCommand(cOld);
                    OnSimpleCommandFinish(cOld);
                    Warehouse.AddEvent(Event.EnumSeverity.Event, Event.EnumType.Command, cOld.ToString());
                }
                if (cmd != null && cOld == null && cmd.ID != id && id != 0)
                {
                    throw new ConveyorException("Can't find command by Id");
                }
            }
            catch (Exception ex)
            {
                Warehouse.AddEvent(Event.EnumSeverity.Error, Event.EnumType.Exception, ex.Message);
                throw new ConveyorException(String.Format("{0} Conveyor.FinishCommand failed ({1},{2},{3})", Name, id, cmd != null ?  cmd.ToString() : "null", s));
            }
        }
Beispiel #2
0
 public abstract void FinishCommand(Int32 id, SimpleCommand cmd, SimpleCommand.EnumStatus s);