|
@@ -4,6 +4,7 @@ using System.Linq.Expressions;
|
|
|
using Comal.Classes;
|
|
|
using InABox.Core;
|
|
|
using System;
|
|
|
+using NPOI.Util;
|
|
|
|
|
|
namespace Comal.Stores
|
|
|
{
|
|
@@ -58,6 +59,8 @@ namespace Comal.Stores
|
|
|
.Add(x =>x.JobLink.ID)
|
|
|
.AddDimensionsColumns(x => x.Dimensions, Dimensions.ColumnsType.Local)
|
|
|
.Add(x => x.ActualQuantity)
|
|
|
+ .AddSubColumns(x => x.Charge, Columns.All<ActualCharge>())
|
|
|
+ .Add(x => x.JobScope.ID)
|
|
|
.AddDimensionsColumns(x => x.Product.DefaultInstance.Dimensions, Dimensions.ColumnsType.Local)
|
|
|
).ToList<RequisitionItem>();
|
|
|
return requisitionitems.Any();
|
|
@@ -236,7 +239,7 @@ namespace Comal.Stores
|
|
|
#region StockMovements
|
|
|
|
|
|
private StockMovement CreateStockMovement(IEmployee employee, DateTime date, IStockMovementBatch batch, IProduct product, IStockLocation location,
|
|
|
- IProductStyle style, IJob? job, IJobRequisitionItem? jri, IDimensions dimensions, Guid txnid, bool system, string note)
|
|
|
+ IProductStyle style, IJob? job, IJobRequisitionItem? jri, IDimensions dimensions, Guid txnid, ActualCharge charge, JobScopeLink scope, bool system, string note)
|
|
|
{
|
|
|
var movement = new StockMovement();
|
|
|
movement.Batch.ID = batch.ID;
|
|
@@ -247,6 +250,9 @@ namespace Comal.Stores
|
|
|
movement.JobRequisitionItem.ID = jri?.ID ?? Guid.Empty;
|
|
|
movement.Dimensions.CopyFrom(dimensions);
|
|
|
|
|
|
+ movement.Charge.CopyFrom(charge);
|
|
|
+ movement.JobScope.CopyFrom(scope);
|
|
|
+
|
|
|
movement.System = system;
|
|
|
movement.Transaction = txnid;
|
|
|
movement.Notes = note;
|
|
@@ -311,13 +317,13 @@ namespace Comal.Stores
|
|
|
|
|
|
// Transfer the necessary balance from General Stock...
|
|
|
var from = CreateStockMovement(entity.Employee, timestamp, batch, item.Product, item.Location, item.Style, null, null,
|
|
|
- dimensions, txnid, true, $"Requisition #{entity.Number} Internal Transfer");
|
|
|
+ dimensions, txnid, item.Charge, item.JobScope, true, $"Requisition #{entity.Number} Internal Transfer");
|
|
|
from.Issued = extraRequired;
|
|
|
from.Type = StockMovementType.TransferOut;
|
|
|
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, true,
|
|
|
+ var to = CreateStockMovement(entity.Employee, timestamp, batch, item.Product, item.Location, item.Style, entity.JobLink, item.SourceJRI, dimensions, txnid, item.Charge, item.JobScope, true,
|
|
|
$"Requisition #{entity.Number} Internal Transfer");
|
|
|
to.Received = extraRequired;
|
|
|
to.Type = StockMovementType.TransferIn;
|
|
@@ -334,13 +340,13 @@ namespace Comal.Stores
|
|
|
{
|
|
|
// 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,
|
|
|
- dimensions, txnid, true, $"Requisition #{entity.Number} Internal Transfer");
|
|
|
+ dimensions, txnid, item.Charge, item.JobScope, true, $"Requisition #{entity.Number} Internal Transfer");
|
|
|
from.Issued = qty;
|
|
|
from.Type = StockMovementType.TransferOut;
|
|
|
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, true,
|
|
|
+ var to = CreateStockMovement(entity.Employee, timestamp, batch, item.Product, item.Location, item.Style, entity.JobLink, item.SourceJRI, dimensions, txnid, item.Charge, item.JobScope, true,
|
|
|
$"Requisition #{entity.Number} Internal Transfer");
|
|
|
to.Received = qty;
|
|
|
to.Type = StockMovementType.TransferIn;
|
|
@@ -351,7 +357,7 @@ namespace Comal.Stores
|
|
|
|
|
|
}
|
|
|
|
|
|
- var mvt = CreateStockMovement(entity.Employee, timestamp, batch, item.Product, item.Location, item.Style, entity.JobLink, item.SourceJRI, dimensions, txnid,
|
|
|
+ var mvt = CreateStockMovement(entity.Employee, timestamp, batch, item.Product, item.Location, item.Style, entity.JobLink, item.SourceJRI, dimensions, txnid, item.Charge, item.JobScope,
|
|
|
false,
|
|
|
$"Requisition #{entity.Number}");
|
|
|
|