Przeglądaj źródła

PRS DESKTOP - Reservation Management changes to allocated and refining process

Nick-PRSDigital@bitbucket.org 2 lat temu
rodzic
commit
b412bbe75a

+ 1 - 1
prs.desktop/Forms/DeliveryBuilder.xaml

@@ -6,7 +6,7 @@
         xmlns:local="clr-namespace:PRSDesktop"
 		xmlns:wpf="clr-namespace:InABox.Wpf;assembly=InABox.Wpf"
         mc:Ignorable="d"
-        Title="DeliveryBuilder" Height="700" Width="1000" Loaded="Window_Loaded" Unloaded="Window_Unloaded">
+        Title="DeliveryBuilder" Height="700" Width="1200" Loaded="Window_Loaded" Unloaded="Window_Unloaded">
     <Grid Margin="5">
         <Grid.ColumnDefinitions>
             <ColumnDefinition Width="Auto" />

+ 1 - 1
prs.desktop/Panels/Products/Reservation Management/JobRequisitionHoldingsReview.xaml

@@ -163,7 +163,7 @@
                                 <ColumnDefinition Width="auto"/>
                                 <ColumnDefinition Width="*"/>
                             </Grid.ColumnDefinitions>
-                            <TextBlock Grid.Column="0" Text="Requisitioned" HorizontalAlignment="Center" FontSize="15"  
+                            <TextBlock Grid.Column="0" Text="Allocated" HorizontalAlignment="Center" FontSize="15"  
                                VerticalAlignment="Center" Margin="1, 5, 1, 5">
                                 <TextBlock.LayoutTransform>
                                     <RotateTransform Angle="270"/>

+ 14 - 12
prs.desktop/Panels/Products/Reservation Management/JobRequisitionHoldingsReview.xaml.cs

@@ -104,9 +104,11 @@ namespace PRSDesktop
         private void CalculateHoldings()
         {
             CoreTable table = new Client<StockMovement>().Query(
-                new Filter<StockMovement>(x => x.Product.ID).IsEqualTo(item.Product.ID)
+                new Filter<StockMovement>(x => x.Product.ID).IsEqualTo(item.Product.ID).
+                And(x => x.Dimensions.UnitSize).IsEqualTo(item.Dimensions.UnitSize)
                 .And(x => x.Location.ID).IsNotEqualTo(Guid.Empty),
                 new Columns<StockMovement>(
+                    x => x.ID,
                     x => x.Style.ID,
                     x => x.Style.Description,
                     x => x.Style.Code,
@@ -194,7 +196,7 @@ namespace PRSDesktop
             foreach (var job in jobs)
             {
                 var holdings = new JobRequiHoldingsReviewModel(job.ID, job.JobNumber, job.Name, mvts, CompanyDefaultStyle);
-                holdings.AlreadyRequisitioned = true;
+                holdings.AlreadyAllocated = true;
                 holdings.GetStock(job.ID, item.Style.ID);
 
                 if (holdings.StockOfCurrentStyle == 0 && holdings.StockOfNoStyle == 0 && holdings.StockOfOtherStyles == 0)
@@ -255,13 +257,13 @@ namespace PRSDesktop
                     holding.Style.Description = mvt.Style.Description;
                     holding.Style.Code = mvt.Style.Code;
                     holding.Dimensions.CopyFrom(mvt.Dimensions);
-                    if (mvt.JobRequisitionItem.ID != Guid.Empty && model.AlreadyRequisitioned)
+                    if (mvt.JobRequisitionItem.ID != Guid.Empty && model.AlreadyAllocated)
                     {
                         holding.Units = mvt.Received - mvt.Issued;
                         holdings.Add(holding);
                         locationIDs.Add(mvt.Location.ID);
                     }
-                    else if (mvt.JobRequisitionItem.ID == Guid.Empty && !model.AlreadyRequisitioned)
+                    else if (mvt.JobRequisitionItem.ID == Guid.Empty && !model.AlreadyAllocated)
                     {
                         holding.Units = mvt.Received - mvt.Issued;
                         holdings.Add(holding);
@@ -270,12 +272,12 @@ namespace PRSDesktop
                 }
                 else
                 {
-                    if (mvt.JobRequisitionItem.ID != Guid.Empty && model.AlreadyRequisitioned)
+                    if (mvt.JobRequisitionItem.ID != Guid.Empty && model.AlreadyAllocated)
                     {
                         var holding = holdings.First(x => x.Location.ID == mvt.Location.ID);
                         holding.Units = holding.Units + mvt.Received - mvt.Issued;
                     }
-                    else if (mvt.JobRequisitionItem.ID == Guid.Empty && !model.AlreadyRequisitioned)
+                    else if (mvt.JobRequisitionItem.ID == Guid.Empty && !model.AlreadyAllocated)
                     {
                         var holding = holdings.First(x => x.Location.ID == mvt.Location.ID);
                         holding.Units = holding.Units + mvt.Received - mvt.Issued;
@@ -289,11 +291,11 @@ namespace PRSDesktop
                 filteredHoldings,
                 Item,
                 new Job { ID = model.JobID, Name = model.JobName, JobNumber = model.JobNumber },
-                model.AlreadyRequisitioned);
+                model.AlreadyAllocated);
 
             if (page.ShowDialog() == true)
             {
-                MessageBox.Show("Success - stock requisitioned for line");
+                MessageBox.Show("Success - stock allocated to requisition line");
                 OnHoldingsReviewRefresh?.Invoke();
             }
                 
@@ -310,7 +312,7 @@ namespace PRSDesktop
         public double StockOfOtherStyles { get; set; }
         public List<StockMovement> Movements { get; set; }
         public Brush Background { get; set; }
-        public bool AlreadyRequisitioned { get; set; }
+        public bool AlreadyAllocated { get; set; }
         public Guid JobID { get; set; }
         public ProductStyleLink DefaultStyle { get; set; }
 
@@ -335,7 +337,7 @@ namespace PRSDesktop
             if (styleid == Guid.Empty)
                 return;
 
-            if (!AlreadyRequisitioned)
+            if (!AlreadyAllocated)
             {
                 StockOfCurrentStyle = CalculateTotal(Movements
                     .Where(x => x.Job.ID == jobid)
@@ -357,7 +359,7 @@ namespace PRSDesktop
 
         private void GetStockOfOtherStyles(Guid jobid, Guid styleid)
         {
-            if (!AlreadyRequisitioned)
+            if (!AlreadyAllocated)
                 StockOfOtherStyles = CalculateTotal(Movements
                 .Where(x => x.Job.ID == jobid)
                 .Where(x => x.Style.ID != Guid.Empty)
@@ -376,7 +378,7 @@ namespace PRSDesktop
 
         private void GetStockOfNoStyle(Guid jobid)
         {
-            if (!AlreadyRequisitioned)
+            if (!AlreadyAllocated)
                 StockOfNoStyle = CalculateTotal(Movements
                 .Where(x => x.Job.ID == jobid)
                 .Where(x => x.Style.ID == Guid.Empty || x.Style.ID == DefaultStyle.ID)

+ 5 - 3
prs.desktop/Panels/Products/Reservation Management/JobRequisitionReviewGrid.cs

@@ -292,7 +292,7 @@ namespace PRSDesktop
         private bool CheckValidAction(JobRequisitionItem item, bool bypassReserved)
         {
             bool valid = true;
-            if (item.Status == JobRequisitionItemStatus.Reserved && !bypassReserved)
+            if (item.Status == JobRequisitionItemStatus.Allocated && !bypassReserved)
             {
                 MessageBox.Show("Error. Item has already been reserved!");
                 return false;
@@ -315,7 +315,7 @@ namespace PRSDesktop
             JobRequisitionItem item = row.ToObject<JobRequisitionItem>();
             if (CheckValidAction(item, false))
             {
-                SaveRow(row, JobRequisitionItemStatus.Reserved, "Line marked as Reserved by " + empName + " on " + DateTime.Now.ToString("dd MMM yy"));
+                SaveRow(row, JobRequisitionItemStatus.Allocated, "Line marked as Reserved by " + empName + " on " + DateTime.Now.ToString("dd MMM yy"));
             }
         }
 
@@ -379,7 +379,7 @@ namespace PRSDesktop
         private void TreatmentRequired_Clicked(CoreRow row)
         {
             JobRequisitionItem item = row.ToObject<JobRequisitionItem>();
-            if (item.Status != JobRequisitionItemStatus.Reserved)
+            if (item.Status != JobRequisitionItemStatus.Allocated)
             {
                 MessageBox.Show("Stock must first be reserved for this item");
                 return;
@@ -613,6 +613,8 @@ namespace PRSDesktop
         {
             criteria.Add(new Filter<JobRequisitionItem>(x => x.Requisition.Approved).IsNotEqualTo(DateTime.MinValue));
 
+            criteria.Add(new Filter<JobRequisitionItem>(x => x.Archived).IsEqualTo(DateTime.MinValue));
+
             sort = new SortOrder<JobRequisitionItem>(x => x.Requisition.Number, SortDirection.Descending);
             base.Reload(criteria, columns, ref sort, action);
         }

+ 1 - 1
prs.desktop/Panels/Products/Reservation Management/JobRequisitionStockSelectionPage.xaml

@@ -37,7 +37,7 @@
             <TextBlock Grid.Column="2" Text="Style" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="DemiBold" FontSize="14"/>
             <TextBlock Grid.Column="3" x:Name="availableUnitsLbl" Text="Available Units" HorizontalAlignment="Center" VerticalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center"
                        FontWeight="DemiBold" FontSize="14" Margin="0,0,0,0"/>
-            <TextBlock Grid.Column="4" Grid.ColumnSpan="3" Text="Amount to Requisition" HorizontalAlignment="Center" TextAlignment="Center"
+            <TextBlock Grid.Column="4" Grid.ColumnSpan="3" Text="Amount to Allocate" HorizontalAlignment="Center" TextAlignment="Center"
                        VerticalAlignment="Center" FontWeight="DemiBold" FontSize="14" TextWrapping="Wrap"/>
         </Grid>
 

+ 5 - 4
prs.desktop/Panels/Products/Reservation Management/JobRequisitionStockSelectionPage.xaml.cs

@@ -24,7 +24,7 @@ namespace PRSDesktop
         JobRequisitionItem Item = new JobRequisitionItem();
         public Guid EmpID { get; set; }
         public Guid IssuingJobID { get; set; }
-        public bool Requisitioned = false;
+        public bool Allocated = false;
         public JobRequisitionStockSelectionPage(IEnumerable<StockHolding> holdings, JobRequisitionItem item, Job issuingJob, bool requisitioned = false)
         {
             InitializeComponent();
@@ -52,7 +52,7 @@ namespace PRSDesktop
 
             if (requisitioned)
             {
-                availableUnitsLbl.Text = "Requisitioned";
+                availableUnitsLbl.Text = "Allocated";
                 listView.IsEnabled = false;
                 okButton.IsEnabled = false;
             }
@@ -82,7 +82,7 @@ namespace PRSDesktop
             StockMovementBatch batch = new StockMovementBatch();
             batch.TimeStamp = DateTime.Now;
             batch.Type = StockMovementBatchType.Transfer;
-            batch.Notes = "Requisitioned for Job " + Item.Job.JobNumber;
+            batch.Notes = "Allocated to Job " + Item.Job.JobNumber;
             new Client<StockMovementBatch>().Save(batch, "Created for requisitioning stock");
 
             var issuing = CreateBaseMovement(model, batch.ID);
@@ -94,7 +94,7 @@ namespace PRSDesktop
             receiving.Received = model.ChosenUnits;
             receiving.JobRequisitionItem.ID = Item.ID;
 
-            new Client<StockMovement>().Save(new StockMovement[] { issuing, receiving }, "Created from Job Requisition Stock Reserve Screen");
+            new Client<StockMovement>().Save(new StockMovement[] { issuing, receiving }, "Created from Reservation Management Screen");
         }
 
         private StockMovement CreateBaseMovement(JobRequistionStockSelectionViewModel model, Guid batchid)
@@ -108,6 +108,7 @@ namespace PRSDesktop
             mvt.IsTransfer = true;
             mvt.Date = DateTime.Now;
             mvt.Product.ID = Item.Product.ID;
+            mvt.Notes = "Reservation Management Screen - allocating to Job" + Item.Job.JobNumber + " for Requisition Line";
 
             return mvt;
         }