|
@@ -142,6 +142,7 @@ public class JobRequisitionItemStore : BaseStore<JobRequisitionItem>
|
|
|
x => x.Style.ID,
|
|
|
x => x.Product.ID,
|
|
|
x => x.Qty,
|
|
|
+ x => x.Dimensions.Value,
|
|
|
x => x.Notes);
|
|
|
}
|
|
|
|
|
@@ -164,28 +165,29 @@ public class JobRequisitionItemStore : BaseStore<JobRequisitionItem>
|
|
|
// However, we do include transfers out of this requi, since then the stuff ain't actually been allocated.
|
|
|
var stockMovements = GetNotIssued(store, item.ID,
|
|
|
new Columns<StockMovement>(x => x.Units)
|
|
|
- .Add(x => x.Style.ID));
|
|
|
+ .Add(x => x.Style.ID)
|
|
|
+ .Add(x=>x.Dimensions.Value));
|
|
|
var styleTotal = 0.0;
|
|
|
var total = 0.0;
|
|
|
foreach (var mvt in stockMovements)
|
|
|
{
|
|
|
if (mvt.Style.ID == item.Style.ID)
|
|
|
{
|
|
|
- styleTotal += mvt.Units;
|
|
|
+ styleTotal += mvt.Units * mvt.Dimensions.Value;
|
|
|
}
|
|
|
total += mvt.Units;
|
|
|
}
|
|
|
|
|
|
- var remStyle = item.Qty - styleTotal;
|
|
|
- var remTotal = item.Qty - total;
|
|
|
+ var remStyle = (item.Qty * item.Dimensions.Value) - styleTotal;
|
|
|
+ var remTotal = (item.Qty * item.Dimensions.Value) - total;
|
|
|
|
|
|
if (remStyle <= 0)
|
|
|
{
|
|
|
// Now, we care about what's actually been issued.
|
|
|
- var issued = GetIssued(store, item.ID, new Columns<StockMovement>(x => x.Units));
|
|
|
+ var issued = GetIssued(store, item.ID, new Columns<StockMovement>(x => x.Units).Add(x=>x.Dimensions.Value));
|
|
|
|
|
|
// If everything has been issued, the issued total will be a negative value to balance the Qty.
|
|
|
- if(item.Qty + issued.Sum(x => x.Units) <= 0)
|
|
|
+ if(item.Qty + issued.Sum(x => x.Units * x.Dimensions.Value) <= 0)
|
|
|
{
|
|
|
item.Status = JobRequisitionItemStatus.Issued;
|
|
|
}
|
|
@@ -214,13 +216,14 @@ public class JobRequisitionItemStore : BaseStore<JobRequisitionItem>
|
|
|
new Filter<JobRequisitionItemPurchaseOrderItem>(x => x.JobRequisitionItem.ID).IsEqualTo(item.ID)
|
|
|
.And(x => x.PurchaseOrderItem.ReceivedDate).IsEqualTo(DateTime.MinValue),
|
|
|
new Columns<JobRequisitionItemPurchaseOrderItem>(x => x.PurchaseOrderItem.Product.ID)
|
|
|
- .Add(x => x.PurchaseOrderItem.Qty))
|
|
|
+ .Add(x => x.PurchaseOrderItem.Qty)
|
|
|
+ .Add(x=>x.PurchaseOrderItem.Dimensions.Value))
|
|
|
.ToObjects<JobRequisitionItemPurchaseOrderItem>()
|
|
|
.ToList();
|
|
|
var stockOrders = jriPois.Where(x => x.PurchaseOrderItem.Product.ID == item.Product.ID).ToList();
|
|
|
var treatmentOrders = jriPois.Where(x => x.PurchaseOrderItem.Product.ID != item.Product.ID).ToList();
|
|
|
|
|
|
- remTotal -= stockOrders.Sum(x => x.PurchaseOrderItem.Qty);
|
|
|
+ remTotal -= stockOrders.Sum(x => x.PurchaseOrderItem.Qty * x.PurchaseOrderItem.Dimensions.Value);
|
|
|
if (remTotal <= 0)
|
|
|
{
|
|
|
if (stockOrders.Count > 0)
|