This commit is contained in:
@@ -4020,7 +4020,7 @@ namespace AyaNova.Biz
|
||||
{
|
||||
PartId = oldObj.PartId,
|
||||
PartWarehouseId = oldObj.PartWarehouseId,
|
||||
Quantity = oldObj.Quantity * -1,//was originally returned (negative) so needs to be consumed
|
||||
Quantity = oldObj.Quantity,//was originally returned (negative) and added to inventory so to reverse just use as is to remain negative and consume out of inventory
|
||||
SourceType = AyaType.WorkOrderItemPart,
|
||||
SourceId = oldObj.Id,
|
||||
Description = await Translate("WorkOrderItemPart") + $" {oldObj.Serials} " + await Translate("EventDeleted")
|
||||
@@ -4054,7 +4054,7 @@ namespace AyaNova.Biz
|
||||
{
|
||||
PartId = oldObj.PartId,
|
||||
PartWarehouseId = oldObj.PartWarehouseId,
|
||||
Quantity = oldObj.Quantity,
|
||||
Quantity = oldObj.Quantity,//was originally positive and was flipped to consume inventory so leave positive to add back to inventory
|
||||
SourceType = null,//null because the po no longer exists so this is technically a manual adjustment
|
||||
SourceId = null,//''
|
||||
Description = await Translate("WorkOrderItemPart") + $" {oldObj.Serials} " + await Translate("EventDeleted")
|
||||
@@ -4092,7 +4092,7 @@ namespace AyaNova.Biz
|
||||
{
|
||||
PartId = newObj.PartId,
|
||||
PartWarehouseId = newObj.PartWarehouseId,
|
||||
Quantity = newObj.Quantity,//is negative
|
||||
Quantity = newObj.Quantity * -1,//is negative, needs to be positive as it's adding inventory
|
||||
SourceType = AyaType.WorkOrderItemPart,
|
||||
SourceId = newObj.Id,
|
||||
Description = await Translate("WorkOrderItemPart") + $" {newObj.Serials} " + await Translate("EventCreated")
|
||||
@@ -4124,7 +4124,7 @@ namespace AyaNova.Biz
|
||||
{
|
||||
PartId = newObj.PartId,
|
||||
PartWarehouseId = newObj.PartWarehouseId,
|
||||
Quantity = newObj.Quantity * -1,
|
||||
Quantity = newObj.Quantity * -1,//is positive needs to be negative as it's consuming inventory
|
||||
SourceType = AyaType.WorkOrderItemPart,
|
||||
SourceId = newObj.Id,
|
||||
Description = await Translate("WorkOrderItemPart") + $" {newObj.Serials} " + await Translate("EventCreated")
|
||||
@@ -4158,7 +4158,7 @@ namespace AyaNova.Biz
|
||||
//QUANTITY OR PART CHANGE?
|
||||
if (newObj.PartId != oldObj.PartId || newObj.Quantity != oldObj.Quantity)
|
||||
{
|
||||
//OUT with the old object
|
||||
//OUT with the old object SAME AS DELETE ABOVE
|
||||
if (oldObj.Quantity != 0)//zero quantity doesn't affect inventory or serials
|
||||
{
|
||||
if (oldObj.Quantity < 0)
|
||||
@@ -4170,7 +4170,7 @@ namespace AyaNova.Biz
|
||||
{
|
||||
PartId = oldObj.PartId,
|
||||
PartWarehouseId = oldObj.PartWarehouseId,
|
||||
Quantity = oldObj.Quantity * -1,//was originally returned (negative) so needs to be consumed
|
||||
Quantity = oldObj.Quantity,//was originally returned (negative) and added to inventory so to reverse just use as is to remain negative and consume out of inventory
|
||||
SourceType = AyaType.WorkOrderItemPart,
|
||||
SourceId = oldObj.Id,
|
||||
Description = await Translate("WorkOrderItemPart") + $" {oldObj.Serials} " + await Translate("EventDeleted")
|
||||
@@ -4202,7 +4202,7 @@ namespace AyaNova.Biz
|
||||
{
|
||||
PartId = oldObj.PartId,
|
||||
PartWarehouseId = oldObj.PartWarehouseId,
|
||||
Quantity = oldObj.Quantity,
|
||||
Quantity = oldObj.Quantity,//was originally positive and was flipped to consume inventory so leave positive to add back to inventory
|
||||
SourceType = null,//null because the po no longer exists so this is technically a manual adjustment
|
||||
SourceId = null,//''
|
||||
Description = await Translate("WorkOrderItemPart") + $" {oldObj.Serials} " + await Translate("EventDeleted")
|
||||
@@ -4232,7 +4232,7 @@ namespace AyaNova.Biz
|
||||
{
|
||||
PartId = newObj.PartId,
|
||||
PartWarehouseId = newObj.PartWarehouseId,
|
||||
Quantity = newObj.Quantity,//is negative
|
||||
Quantity = newObj.Quantity * -1,//is negative, needs to be positive as it's adding inventory
|
||||
SourceType = AyaType.WorkOrderItemPart,
|
||||
SourceId = newObj.Id,
|
||||
Description = await Translate("WorkOrderItemPart") + $" {newObj.Serials} " + await Translate("EventCreated")
|
||||
@@ -4263,7 +4263,7 @@ namespace AyaNova.Biz
|
||||
{
|
||||
PartId = newObj.PartId,
|
||||
PartWarehouseId = newObj.PartWarehouseId,
|
||||
Quantity = newObj.Quantity * -1,
|
||||
Quantity = newObj.Quantity * -1,//is positive needs to be negative as it's consuming inventory
|
||||
SourceType = AyaType.WorkOrderItemPart,
|
||||
SourceId = newObj.Id,
|
||||
Description = await Translate("WorkOrderItemPart") + $" {newObj.Serials} " + await Translate("EventCreated")
|
||||
@@ -4292,9 +4292,9 @@ namespace AyaNova.Biz
|
||||
if (!string.IsNullOrWhiteSpace(oldObj.Serials))
|
||||
{
|
||||
//Reverse old object serials transaction...
|
||||
if (oldObj.Quantity > 0)
|
||||
if (oldObj.Quantity > 0)//old object removed serials to add them back
|
||||
await PartBiz.AppendSerialsAsync(oldObj.PartId, oldObj.Serials, ct, UserId);
|
||||
if (oldObj.Quantity < 0)
|
||||
if (oldObj.Quantity < 0)//old object added to serials so remove them
|
||||
await PartBiz.RemoveSerialsAsync(oldObj.PartId, oldObj.Serials, ct, UserId);
|
||||
}
|
||||
|
||||
@@ -4302,9 +4302,9 @@ namespace AyaNova.Biz
|
||||
if (!string.IsNullOrWhiteSpace(newObj.Serials))
|
||||
{
|
||||
//do new object serials transaction
|
||||
if (newObj.Quantity > 0)
|
||||
if (newObj.Quantity > 0)//consuming serials
|
||||
await PartBiz.RemoveSerialsAsync(newObj.PartId, newObj.Serials, ct, UserId);
|
||||
if (newObj.Quantity < 0)
|
||||
if (newObj.Quantity < 0)//returning serials
|
||||
await PartBiz.AppendSerialsAsync(newObj.PartId, newObj.Serials, ct, UserId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user