示例#1
0
        // returns an ArrayList of WorkOrders who parts are available now
        public ArrayList GetWorkToAssemble()
        {
            ArrayList workOrdersReady = null;

            foreach (string workOrderId in partsList.Keys)
            {
                DateTime deliveryDate = GetDeliveryDate(workOrderId);
                if (deliveryDate == DateTime.MinValue)
                {
                    continue;
                }
                if (deliveryDate <= DateTime.Now)
                {
                    // WorkOrder is ready
                    if (workOrdersReady == null)
                    {
                        workOrdersReady = new ArrayList();
                    }
                    ArrayList parts = partsList[workOrderId] as ArrayList;
                    if (parts.Count > 0)
                    {
                        // if there is at least one scheduled part, get its WorkOrder
                        // parent. All the parts are for the same WorkOrderID
                        ScheduledPart part = parts[0] as ScheduledPart;
                        workOrdersReady.Add(part.workOrder);
                    }
                }
            }
            return(workOrdersReady);
        }
示例#2
0
        public void AddPart(WorkOrder theWorkOrder, string thePart, DateTime theDeliveryDate)
        {
            ScheduledPart part = new ScheduledPart(theWorkOrder, thePart, theDeliveryDate);

            // see if this WorkOrder already has pending parts
            ArrayList pendingParts = partsList[theWorkOrder.Id] as ArrayList;

            if (pendingParts == null)
            {
                // no: create a new list and add it to the list
                pendingParts = new ArrayList();
                partsList.Add(theWorkOrder.Id, pendingParts);
            }

            pendingParts.Add(part);
        }