From 5431cba7bd1d87e9eb936cbaf7490bd349f69d51 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Mon, 23 Aug 2021 19:24:23 +0000 Subject: [PATCH] --- server/AyaNova/biz/WorkOrderBiz.cs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/server/AyaNova/biz/WorkOrderBiz.cs b/server/AyaNova/biz/WorkOrderBiz.cs index 0f3222fe..6506a192 100644 --- a/server/AyaNova/biz/WorkOrderBiz.cs +++ b/server/AyaNova/biz/WorkOrderBiz.cs @@ -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); } }