| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 | 
							- namespace Comal.Classes
 
- {
 
- }
 
- //public class CalendarBooking : BaseObject, IPackable
 
- //   {
 
- //	public Guid Packet { get; set; }
 
- //	public Guid Station { get; set; }
 
- //	public DateTime Start { get; set; }
 
- //	public DateTime End { get; set; }
 
- //	public Boolean IsShared { get; set; }
 
- //       public void Pack(FastBinaryWriter writer)
 
- //       {
 
- //           writer.Write(Packet.ToByteArray());
 
- //           writer.Write(Station.ToByteArray());
 
- //           writer.Write(Start.ToBinary());
 
- //           writer.Write(End.ToBinary());
 
- //           writer.Write(IsShared);
 
- //       }
 
- //       public void Unpack(FastBinaryReader reader)
 
- //       {
 
- //           Packet = new Guid(reader.ReadBytes(16));
 
- //           Station = new Guid(reader.ReadBytes(16));
 
- //           Start = DateTime.FromBinary(reader.ReadInt64());
 
- //           End = DateTime.FromBinary(reader.ReadInt64());
 
- //           IsShared = reader.ReadBoolean();
 
- //       }
 
- //   }
 
- //   [UserTracking(false)]
 
- //public class Calendar : Entity, IPersistent, IRemotable, ILicense<ManufacturingLicense>
 
- //{
 
- //	public String Summary { get; set; }
 
- //	public PackableList<CalendarBooking> Bookings { get; set; }
 
- //	public bool IsActive { get; set; }
 
- //	protected override void Init()
 
- //	{
 
- //		Summary = "";
 
- //		Bookings = new PackableList<CalendarBooking>();
 
- //		IsActive = true;
 
- //	}
 
- //       public void Build(ManufacturingPacket[] packets)
 
- //       {
 
- //           this.Bookings.Clear();
 
- //           //Progress.Show("Recalculating Manufacturing Calendar");
 
- //           var config = new GlobalConfiguration<FactorySetup>();
 
- //           FactorySetup settings = config.Load();
 
- //           if (settings.Sections.Count == 0)
 
- //               return;
 
- //           CalendarFactory factory = new CalendarFactory();
 
- //           foreach (FactorySection section in settings.Sections)
 
- //               factory.Sections.Add(new Section(section.Name, section.ID, section.Stations));
 
- //           //Progress.SetMessage("Loading Manufacturing Packets");
 
- //           //var packets = new Client<ManufacturingPacket>().Load(new Filter<ManufacturingPacket>(x => x.Issued).IsNotEqualTo(DateTime.MinValue).And(x => x.IsComplete).IsEqualTo(false), new SortOrder<ManufacturingPacket>(x => x.DueDate));
 
- //           //Progress.SetMessage("Calculating");
 
- //           foreach (ManufacturingPacket packet in packets)
 
- //           {
 
- //               List<Step> steps = new List<Step>();
 
- //               //foreach (SetoutStage stage in packet.Stages)
 
- //               //{
 
- //               //    if (stage.Completed.IsEmpty())
 
- //               //        steps.Add(new Step(stage.SectionID, stage.Minutes * packet.Quantity, stage.Sequence));
 
- //               //}
 
- //               if (steps.Count > 0)
 
- //               {
 
- //                   factory.Widgets.Add(
 
- //                       new Widget(packet.ID, packet.SetoutLink.Description, packet.SetoutLink.JobLink.Name, packet.Serial, packet.DueDate, steps.ToArray())
 
- //                   );
 
- //               }
 
- //           }
 
- //           StringBuilder summary = new StringBuilder();
 
- //           factory.ProcessWidgets(DateTime.Today.AddHours(7), summary);
 
- //           this.Summary = summary.ToString();
 
- //           //Comal.Classes.Calendar calendar = new Comal.Classes.Calendar()
 
- //           //{
 
- //           //    IsActive = true,
 
- //           //    Summary = summary.ToString()
 
- //           //};
 
- //           Dictionary<Guid, DateTime> dates = new Dictionary<Guid, DateTime>();
 
- //           foreach (Section section in factory.Sections)
 
- //           {
 
- //               foreach (Station station in section.Stations)
 
- //               {
 
- //                   List<Booking> bookings = station.Bookings.OrderBy(x => x.Start).ToList();
 
- //                   foreach (Booking booking in bookings)
 
- //                   {
 
- //                       if (!dates.ContainsKey(booking.Widget.PacketID))
 
- //                           dates[booking.Widget.PacketID] = DateTime.MinValue;
 
- //                       if (dates[booking.Widget.PacketID].CompareTo(booking.End) < 0)
 
- //                           dates[booking.Widget.PacketID] = booking.End;
 
- //                       CalendarBooking calendarbooking = new CalendarBooking()
 
- //                       {
 
- //                           Start = booking.Start,
 
- //                           End = booking.End,
 
- //                           Packet = booking.Widget.PacketID,
 
- //                           Station = station.ID,
 
- //                           IsShared = booking.Shared
 
- //                       };
 
- //                       this.Bookings.Add(calendarbooking);
 
- //                   }
 
- //               }
 
- //           }
 
- //           // Need to move this into CalendarStore.. ManufacturingPacketForecast is not remotable..
 
- //           //var fstore = new Client<ManufacturingPacketForecast>();
 
- //           //foreach (Guid setoutid in dates.Keys)
 
- //           //{
 
- //           //    ManufacturingPacket packet = packets.Where(x => x.ID.Equals(setoutid)).FirstOrDefault();
 
- //           //    if (packet != null)
 
- //           //    {
 
- //           //        ManufacturingPacketForecast forecast = packet.Forecast;
 
- //           //        if (forecast != null)
 
- //           //        {
 
- //           //            if (forecast.ManufacturingDate.CompareTo(dates[setoutid]) != 0)
 
- //           //            {
 
- //           //                forecast.ManufacturingDate = dates[setoutid];
 
- //           //                fstore.Save(ref forecast, "Updated because of change to Manufacturing Packet");
 
- //           //            }
 
- //           //        }
 
- //           //    }
 
- //           //}
 
- //           //Progress.SetMessage("Saving Updated Calendar");
 
- //           //new Client<Comal.Classes.Calendar>().Save(ref calendar, "Updated because of changed Manufacturing Packet");
 
- //           //Progress.Close();
 
- //       }
 
- //   }
 
 
  |