|
@@ -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)
|