|
@@ -324,8 +324,8 @@ namespace Comal.Stores
|
|
|
from.Cost = item.Cost;
|
|
|
timestamp = timestamp.AddTicks(1);
|
|
|
|
|
|
- // ... to the job - note this is the final (entity) job/JRI, not the holding job/JRI
|
|
|
- var to = CreateStockMovement(entity.Employee, timestamp, batch, item.Product, item.Location, item.Style, entity.JobLink, item.SourceJRI, dimensions, txnid, item.Charge, item.JobScope, true,
|
|
|
+ // ... to the target job that we are issuing from.
|
|
|
+ var to = CreateStockMovement(entity.Employee, timestamp, batch, item.Product, item.Location, item.Style, entity.JobLink, item.JobRequisitionItem, dimensions, txnid, item.Charge, item.JobScope, true,
|
|
|
$"Requisition #{entity.Number} Internal Transfer");
|
|
|
to.Received = extraRequired;
|
|
|
to.Type = StockMovementType.TransferIn;
|
|
@@ -335,14 +335,14 @@ namespace Comal.Stores
|
|
|
updates.Add(from);
|
|
|
updates.Add(to);
|
|
|
|
|
|
- // Now we have a full qty in the job holding, and we can issue to site.
|
|
|
+ // The remainder that wasn't in the holding has now been moved straight to the target job/JRI
|
|
|
}
|
|
|
|
|
|
// if we have to change either job or JRI
|
|
|
if (!qty.IsEffectivelyEqual(0.0) && (entity.JobLink.ID != item.JobLink.ID || item.JobRequisitionItem.ID != item.SourceJRI.ID))
|
|
|
{
|
|
|
// Transfer from the item job to the requisition job
|
|
|
- var from = CreateStockMovement(entity.Employee, timestamp, batch, item.Product, item.Location, item.Style, item.JobLink, item.JobRequisitionItem,
|
|
|
+ var from = CreateStockMovement(entity.Employee, timestamp, batch, item.Product, item.Location, item.Style, item.JobLink, item.SourceJRI,
|
|
|
dimensions, txnid, item.Charge, item.JobScope, true, $"Requisition #{entity.Number} Internal Transfer");
|
|
|
from.Issued = qty;
|
|
|
from.Type = StockMovementType.TransferOut;
|
|
@@ -350,7 +350,7 @@ namespace Comal.Stores
|
|
|
timestamp = timestamp.AddTicks(1);
|
|
|
|
|
|
// ... to the job.
|
|
|
- var to = CreateStockMovement(entity.Employee, timestamp, batch, item.Product, item.Location, item.Style, entity.JobLink, item.SourceJRI, dimensions, txnid, item.Charge, item.JobScope, true,
|
|
|
+ var to = CreateStockMovement(entity.Employee, timestamp, batch, item.Product, item.Location, item.Style, entity.JobLink, item.JobRequisitionItem, dimensions, txnid, item.Charge, item.JobScope, true,
|
|
|
$"Requisition #{entity.Number} Internal Transfer");
|
|
|
to.Received = qty;
|
|
|
to.Type = StockMovementType.TransferIn;
|
|
@@ -359,10 +359,9 @@ namespace Comal.Stores
|
|
|
|
|
|
updates.Add(from);
|
|
|
updates.Add(to);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
- var mvt = CreateStockMovement(entity.Employee, timestamp, batch, item.Product, item.Location, item.Style, entity.JobLink, item.SourceJRI, dimensions, txnid, item.Charge, item.JobScope,
|
|
|
+ var mvt = CreateStockMovement(entity.Employee, timestamp, batch, item.Product, item.Location, item.Style, entity.JobLink, item.JobRequisitionItem, dimensions, txnid, item.Charge, item.JobScope,
|
|
|
false,
|
|
|
$"Requisition #{entity.Number}");
|
|
|
|