コード例 #1
0
 public PackScheduleEntityObjectMother(RioAccessSQLEntities oldContext, RioValleyChiliDataContext newContext, Action <CallbackParameters> loggingCallback)
     : base(oldContext, loggingCallback)
 {
     _newContextHelper = new NewContextHelper(newContext);
     _packagingHelper  = new PackSchedulePackagingHelper(oldContext.CreateObjectSet <tblPackaging>().ToList());
     _notebookFactory  = NotebookFactory.Create(newContext);
     _serializedData   = new SerializedData(oldContext);
 }
コード例 #2
0
 public CustomerProductCodeMother(ObjectContext oldContext, RioValleyChiliDataContext newContext, Action <CallbackParameters> loggingCallback) : base(oldContext, loggingCallback)
 {
     if (newContext == null)
     {
         throw new ArgumentNullException("newContext");
     }
     _newContextHelper = new NewContextHelper(newContext);
 }
コード例 #3
0
 protected LotInventoryEntityObjectMotherBase(ObjectContext oldContext, RioValleyChiliDataContext newContext, Action <CallbackParameters> loggingCallback)
     : base(oldContext, loggingCallback)
 {
     if (newContext == null)
     {
         throw new ArgumentNullException("newContext");
     }
     NewContextHelper = new NewContextHelper(newContext);
 }
コード例 #4
0
 public LotEntityObjectMother(ObjectContext oldContext, RioValleyChiliDataContext newContext, Action <CallbackParameters> loggingCallback) : base(oldContext, loggingCallback)
 {
     if (newContext == null)
     {
         throw new ArgumentNullException("newContext");
     }
     _newContextHelper     = new NewContextHelper(newContext);
     _createChileLotHelper = new CreateChileLotHelper(this, oldContext.CreateObjectSet <tblLotStatu>());
 }
コード例 #5
0
 public ProductionScheduleEntityObjectMother(ObjectContext oldContext, RioValleyChiliDataContext newContext, Action <CallbackParameters> loggingCallback) : base(oldContext, loggingCallback)
 {
     if (newContext == null)
     {
         throw new ArgumentNullException("newContext");
     }
     _newContextHelper = new NewContextHelper(newContext);
     _loadCount        = new MotherLoadCount <EntityTypes>();
 }
コード例 #6
0
 public CompanyAndContactsMother(ObjectContext oldContext, RioValleyChiliDataContext newContext, Action <CallbackParameters> loggingCallback = null) : base(oldContext, loggingCallback)
 {
     if (newContext == null)
     {
         throw new ArgumentNullException("newContext");
     }
     _newContext       = newContext;
     _newContextHelper = new NewContextHelper(_newContext);
 }
コード例 #7
0
 public LotAllowancesEntityObjectMother(ObjectContext oldContext, RioValleyChiliDataContext newContext, Action <CallbackParameters> loggingCallback)
     : base(oldContext, loggingCallback)
 {
     if (newContext == null)
     {
         throw new ArgumentNullException("newContext");
     }
     _newContextHelper = new NewContextHelper(newContext);
 }
コード例 #8
0
        public InventoryAdjustmentsMother(ObjectContext oldContext, RioValleyChiliDataContext newContext, Action <CallbackParameters> loggingCallback) : base(oldContext, loggingCallback)
        {
            if (newContext == null)
            {
                throw new ArgumentNullException("newContext");
            }

            _newContextHelper = new NewContextHelper(newContext);
            _notebookFactory  = NotebookFactory.Create(newContext);
        }
コード例 #9
0
        public ProductionBatchEntityObjectMother(RioAccessSQLEntities oldContext, RioValleyChiliDataContext newContext, Action <CallbackParameters> loggingCallback)
            : base(oldContext, loggingCallback)
        {
            if (newContext == null)
            {
                throw new ArgumentNullException("newContext");
            }

            _newContextHelper                  = new NewContextHelper(newContext);
            _serializedData                    = new SerializedData(oldContext);
            _productionResultHelper            = new ProductionResultHelper(_newContextHelper, _serializedData);
            _pickedInventoryItemLocationHelper = new PickedInventoryItemLocationHelper(_newContextHelper);
            _notebookFactory                   = NotebookFactory.Create(newContext);
        }
コード例 #10
0
        private IInventoryTreatmentKey DeterminedOrderTreatment(MovementOrderDTO order, SerializableMove deserialized)
        {
            if (deserialized != null && deserialized.TreatmentOrder != null && deserialized.TreatmentOrder.TreatmentKey != null)
            {
                return(deserialized.TreatmentOrder.TreatmentKey);
            }

            int treatmentId;

            if (order.ToWHID == null || !_treatmentIdsByFacility.TryGetValue(order.ToWHID.Value, out treatmentId))
            {
                treatmentId = order.tblOutgoings.Where(o => o.TTypeID == (int)TransType.FrmTrmt)
                              .Select(o => o.TrtmtID)
                              .Distinct().FirstOrDefault(i => i != 0);
                if (treatmentId == 0)
                {
                    return(null);
                }
            }

            return(NewContextHelper.GetInventoryTreatment(treatmentId));
        }
コード例 #11
0
 public LotHistoryEntityObjectMother(ObjectContext oldContext, RioValleyChiliDataContext newContext, Action <CallbackParameters> loggingCallback) : base(oldContext, loggingCallback)
 {
     _newContextHelper = new NewContextHelper(newContext);
 }
 protected override IDerivedLot GetLot(LotKey lotKey)
 {
     return(NewContextHelper.GetPackagingLotWithProduct(lotKey));
 }
コード例 #13
0
 public SalesQuoteEntityObjectMother(RioValleyChiliDataContext newContext, ObjectContext oldContext, Action <CallbackParameters> loggingCallback)
     : base(oldContext, loggingCallback)
 {
     _newContextHelper = new NewContextHelper(newContext);
 }
コード例 #14
0
 public ChileMaterialsReceivedEntityMother(ObjectContext oldContext, RioValleyChiliDataContext newContext, Action <CallbackParameters> loggingCallback)
     : base(oldContext, loggingCallback)
 {
     _newContext       = newContext;
     _newContextHelper = new NewContextHelper(_newContext);
 }
コード例 #15
0
 public MillAndWetdownMother(ObjectContext oldContext, RioValleyChiliDataContext newContext, Action <CallbackParameters> analyzerCallback)
     : base(oldContext, analyzerCallback)
 {
     _newContextHelper = new NewContextHelper(newContext);
 }
コード例 #16
0
        protected override IEnumerable <TreatmentOrder> BirthRecords()
        {
            foreach (var order in SelectMovementOrdersToLoad())
            {
                var entityType = GetEntityType(order.TTypeID);
                LoadCount.AddRead(entityType);

                if (order.EntryDate == null)
                {
                    Log(new CallbackParameters(CallbackReason.NullEntryDate)
                    {
                        MovementOrder = order
                    });
                    continue;
                }
                var dateCreated = order.EntryDate.Value.ConvertLocalToUTC().Date;

                var sourceFacility = NewContextHelper.GetFacility(order.FromWHID);
                if (sourceFacility == null)
                {
                    Log(new CallbackParameters(CallbackReason.SourceWarehouseNotLoaded)
                    {
                        MovementOrder = order
                    });
                    continue;
                }

                var destinationFacility = NewContextHelper.GetFacility(order.ToWHID);
                if (destinationFacility == null)
                {
                    Log(new CallbackParameters(CallbackReason.TreatmentFaciltyNotLoaded)
                    {
                        MovementOrder = order
                    });
                    continue;
                }
                destinationFacility.FacilityType = FacilityType.Treatment;

                var deserialized = SerializableMove.Deserialize(order.Serialized);

                var treatment = DeterminedOrderTreatment(order, deserialized);
                if (treatment == null)
                {
                    Log(new CallbackParameters(CallbackReason.TreatmentNotDetermined)
                    {
                        MovementOrder = order
                    });
                    continue;
                }

                var shipmentDate = order.Date.GetDate() ?? order.EntryDate.GetDate();
                if (shipmentDate == null)
                {
                    Log(new CallbackParameters(CallbackReason.UndeterminedShipmentDate)
                    {
                        MovementOrder = order
                    });
                    continue;
                }

                var sequence      = PickedInventoryKeyHelper.Singleton.GetNextSequence(dateCreated);
                var shipmentOrder = SetOrderProperties(new InventoryShipmentOrder
                {
                    DateCreated             = dateCreated,
                    Sequence                = sequence,
                    ShipmentInfoDateCreated = dateCreated,
                    ShipmentInfoSequence    = NewContextHelper.ShipmentInformationKeys.GetNextSequence(dateCreated),
                    DestinationFacilityId   = destinationFacility.Id,
                    SourceFacilityId        = sourceFacility.Id
                }, order);
                if (shipmentOrder == null)
                {
                    continue;
                }

                var treatmentOrder = new TreatmentOrder
                {
                    DateCreated = dateCreated,
                    Sequence    = sequence,

                    InventoryTreatmentId   = treatment.InventoryTreatmentKey_Id,
                    InventoryShipmentOrder = shipmentOrder,
                    Returned = order.Returned.ConvertLocalToUTC()
                };
                treatmentOrder.InventoryShipmentOrder.ShipmentInformation = CreateShipmentInformation(treatmentOrder.InventoryShipmentOrder, order);
                treatmentOrder.InventoryShipmentOrder.InventoryPickOrder  = CreateInventoryPickOrder(treatmentOrder.InventoryShipmentOrder, order);
                treatmentOrder.InventoryShipmentOrder.PickedInventory     = CreatePickedInventory(treatmentOrder.InventoryShipmentOrder, order, treatmentOrder.InventoryShipmentOrder.ShipmentInformation.Status);
                if (treatmentOrder.InventoryShipmentOrder.PickedInventory == null)
                {
                    continue;
                }
                treatmentOrder.InventoryShipmentOrder.PickedInventory.Items.ForEach(i => i.TreatmentId = NewContextHelper.NoTreatment.Id);

                if (deserialized != null)
                {
                    deserialized.SetOrder(treatmentOrder);
                }

                LoadCount.AddLoaded(entityType);
                LoadCount.AddLoaded(EntityTypes.InventoryShipmentOrder);
                LoadCount.AddLoaded(EntityTypes.PickOrder);
                LoadCount.AddLoaded(EntityTypes.PickOrderItem, (uint)treatmentOrder.InventoryShipmentOrder.InventoryPickOrder.Items.Count);
                LoadCount.AddLoaded(EntityTypes.PickedInventory);
                LoadCount.AddLoaded(EntityTypes.PickedInventoryItem, (uint)treatmentOrder.InventoryShipmentOrder.PickedInventory.Items.Count);
                LoadCount.AddLoaded(EntityTypes.ShipmentInformation);

                yield return(treatmentOrder);
            }

            LoadCount.LogResults(l => Log(new CallbackParameters(l)));
        }
コード例 #17
0
 public ContractEntityObjectMother(ObjectContext oldContext, RioValleyChiliDataContext newContext, Action <CallbackParameters> loggingCallback) : base(oldContext, loggingCallback)
 {
     _newContextHelper = new NewContextHelper(newContext);
     _notebookFactory  = NotebookFactory.Create(newContext);
 }
コード例 #18
0
        protected override IEnumerable <InventoryShipmentOrder> BirthRecords()
        {
            LoadCount.Reset();

            foreach (var order in SelectMovementOrdersToLoad())
            {
                var entityType = GetEntityType(order.TTypeID);
                LoadCount.AddRead(entityType);

                if (order.EntryDate == null)
                {
                    Log(new CallbackParameters(CallbackReason.NullEntryDate)
                    {
                        MovementOrder = order
                    });
                    continue;
                }
                var dateCreated = order.EntryDate.Value.ConvertLocalToUTC().Date;
                var sequence    = PickedInventoryKeyHelper.Singleton.GetNextSequence(dateCreated);

                var sourceWarehouse = NewContextHelper.GetFacility(order.FromWHID);
                if (sourceWarehouse == null)
                {
                    Log(new CallbackParameters(CallbackReason.SourceWarehouseNotLoaded)
                    {
                        MovementOrder = order
                    });
                    continue;
                }

                var destinationWarehouse = NewContextHelper.GetFacility(order.ToWHID);
                if (destinationWarehouse == null)
                {
                    Log(new CallbackParameters(CallbackReason.DestinationWarehouseNotLoaded)
                    {
                        MovementOrder = order
                    });
                    continue;
                }

                var shipmentInformationSequence = NewContextHelper.ShipmentInformationKeys.GetNextSequence(dateCreated);

                var shipmentOrder = SetOrderProperties(new InventoryShipmentOrder
                {
                    DateCreated             = dateCreated,
                    Sequence                = sequence,
                    ShipmentInfoDateCreated = dateCreated,
                    ShipmentInfoSequence    = shipmentInformationSequence,
                    DestinationFacilityId   = destinationWarehouse.Id,
                    SourceFacilityId        = sourceWarehouse.Id
                }, order);
                if (shipmentOrder == null)
                {
                    continue;
                }

                shipmentOrder.ShipmentInformation = CreateShipmentInformation(shipmentOrder, order);
                shipmentOrder.InventoryPickOrder  = CreateInventoryPickOrder(shipmentOrder, order);
                shipmentOrder.PickedInventory     = CreatePickedInventory(shipmentOrder, order, shipmentOrder.ShipmentInformation.Status);
                if (shipmentOrder.PickedInventory == null)
                {
                    continue;
                }

                var deserialized = SerializableMove.Deserialize(order.Serialized);
                if (deserialized != null)
                {
                    deserialized.SetOrder(shipmentOrder);
                }

                LoadCount.AddLoaded(entityType);
                LoadCount.AddLoaded(EntityTypes.InventoryShipmentOrder);
                LoadCount.AddLoaded(EntityTypes.PickOrder);
                LoadCount.AddLoaded(EntityTypes.PickOrderItem, (uint)shipmentOrder.InventoryPickOrder.Items.Count);
                LoadCount.AddLoaded(EntityTypes.PickedInventory);
                LoadCount.AddLoaded(EntityTypes.PickedInventoryItem, (uint)shipmentOrder.PickedInventory.Items.Count);
                LoadCount.AddLoaded(EntityTypes.ShipmentInformation);

                yield return(shipmentOrder);
            }

            LoadCount.LogResults(l => Log(new CallbackParameters(l)));
        }
コード例 #19
0
 public CustomerProductSpecMother(ObjectContext oldContext, RioValleyChiliDataContext newContext, Action <CallbackParameters> loggingCallback) : base(oldContext, loggingCallback)
 {
     _newContextHelper = new NewContextHelper(newContext);
 }