コード例 #1
0
ファイル: Scale.cs プロジェクト: dhiren-rsmart/SY-WC
        public string GetContainerStatus(smART.Model.Scale modelEntity, smART.Model.Container container, smART.Model.smARTDBContext dbContext)
        {
            string status = string.Empty;

            try
            {
                Model.Booking modBooking = container.Booking;
                smART.Model.DispatcherRequest modDispatcher = dbContext.T_Dispatcher.FirstOrDefault(m => m.Booking_Ref_No.ID == container.Booking.ID);

                if (modBooking != null && modBooking.Invoice_Generated_Flag == true)
                {
                    status = "Closed";
                }
                else if (modelEntity != null && modelEntity.Ticket_Status.ToLower() == "open")
                {
                    status = "WIP";
                }
                else if (modelEntity != null && modelEntity.Ticket_Status.ToLower() == "close")
                {
                    if (modDispatcher != null && modDispatcher.RequestType.ToLower() == "drop off only")
                    {
                        status = "Shipped";
                    }
                    else if (container.Status.ToLower() == "wip" || container.Status.ToLower() == "open-empty")
                    {
                        status = "Open-Loaded";
                    }
                    else
                    {
                        status = container.Status;
                    }
                }
                else if (modDispatcher != null && modDispatcher.RequestType.ToLower() == "pickup only")
                {
                    status = "Open-Empty";
                }
                else if (modDispatcher != null && modDispatcher.RequestType.ToLower() == "drop off only")
                {
                    if (modelEntity != null)
                    {
                        status = "Shipped";
                    }
                    else
                    {
                        status = "Open-Empty";
                    }
                }
            }
            catch (Exception ex)
            {
                bool rethrow;
                rethrow = BusinessRuleExceptionHandler.HandleException(ref ex, modelEntity.Updated_By, modelEntity.GetType().Name, modelEntity.ID.ToString());
                if (rethrow)
                {
                    throw ex;
                }
            }

            return(status);
        }
コード例 #2
0
ファイル: Scale.cs プロジェクト: dhiren-rsmart/SY-WC
        public void Inventory(smART.Model.Scale modelScale, smART.Model.smARTDBContext dbContext)
        {
            try
            {
                IQueryable <smART.Model.ScaleDetails> scaleDetails = dbContext.Set <smART.Model.ScaleDetails>().AsQueryable().Where(o => o.Scale.ID == modelScale.ID);

                if (scaleDetails != null)
                {
                    scaleDetails = scaleDetails.Include("Apply_To_Item");

                    foreach (var modelEntity in scaleDetails)
                    {
                        modelEntity.Old_Net_Weight = modelEntity.NetWeight;
                        modelEntity.GrossWeight    = modelScale.Gross_Weight * (modelEntity.Split_Value / 100);
                        modelEntity.TareWeight     = modelScale.Tare_Weight * (modelEntity.Split_Value / 100);
                        modelEntity.NetWeight      = modelEntity.GrossWeight - modelEntity.TareWeight - modelEntity.Contamination_Weight + modelEntity.Settlement_Diff_NetWeight;

                        if (modelEntity.Scale != null && modelEntity.Scale.Ticket_Status.ToLower().Equals("close") && modelEntity.Apply_To_Item != null)
                        {
                            AddInventory(modelEntity, dbContext);
                        }
                    }

                    dbContext.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                bool rethrow;
                rethrow = BusinessRuleExceptionHandler.HandleException(ref ex, modelScale.Updated_By, modelScale.GetType().Name, modelScale.ID.ToString());
                if (rethrow)
                {
                    throw ex;
                }
            }
        }
コード例 #3
0
ファイル: Scale.cs プロジェクト: dhiren-rsmart/SY-WC
        public void UpdateScaleDetailNetWeight(smART.Model.Scale modelScale, smART.Model.smARTDBContext dbContext)
        {
            try
            {
                IEnumerable <smART.Model.ScaleDetails> scaleDetails = from scaledetail in dbContext.T_Scale_Details
                                                                      where scaledetail.Scale.ID == modelScale.ID
                                                                      select scaledetail;

                if (scaleDetails != null)
                {
                    foreach (var modelEntity in scaleDetails)
                    {
                        modelEntity.GrossWeight = modelScale.Gross_Weight * (modelEntity.Split_Value / 100);
                        modelEntity.TareWeight  = modelScale.Tare_Weight * (modelEntity.Split_Value / 100);
                        modelEntity.NetWeight   = modelEntity.GrossWeight - modelEntity.TareWeight - modelEntity.Contamination_Weight + modelEntity.Settlement_Diff_NetWeight;
                    }
                    dbContext.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                bool rethrow;
                rethrow = BusinessRuleExceptionHandler.HandleException(ref ex, modelScale.Updated_By, modelScale.GetType().Name, modelScale.ID.ToString());
                if (rethrow)
                {
                    throw ex;
                }
            }
        }