This commit is contained in:
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -53,7 +53,7 @@
|
||||
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
|
||||
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
|
||||
"AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles",
|
||||
"AYANOVA_SERVER_TEST_MODE": "false",
|
||||
"AYANOVA_SERVER_TEST_MODE": "true",
|
||||
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
|
||||
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7",
|
||||
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\"
|
||||
|
||||
@@ -74,45 +74,6 @@ namespace AyaNova.Biz
|
||||
}
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// //DUPLICATE
|
||||
// //
|
||||
// internal async Task<PurchaseOrder> DuplicateAsync(long id)
|
||||
// {
|
||||
// //TODO: allow this but only with ZEROS set for the actual received amount and ignore woitempart requested during dupe?
|
||||
|
||||
// var dbObject = await GetAsync(id, false, false);
|
||||
// if (dbObject == null)
|
||||
// {
|
||||
// AddError(ApiErrorCode.NOT_FOUND, "id");
|
||||
// return null;
|
||||
// }
|
||||
// PurchaseOrder newObject = new PurchaseOrder();
|
||||
// CopyObject.Copy(dbObject, newObject, "Wiki,Serial");
|
||||
// newObject.Id = 0;
|
||||
// newObject.Concurrency = 0;
|
||||
// newObject.Status = PurchaseOrderStatus.OpenNotYetOrdered;
|
||||
// foreach (var item in newObject.Items)
|
||||
// {
|
||||
// item.Id = 0;
|
||||
// item.Concurrency = 0;
|
||||
// item.QuantityReceived = 0;
|
||||
// item.ReceivedCost = 0;
|
||||
// item.ReceivedDate = null;
|
||||
// item.PurchaseOrderId = 0;
|
||||
// item.WorkOrderItemPartRequestId = null;
|
||||
// item.PartRequestedById = null;
|
||||
// }
|
||||
|
||||
// await ct.PurchaseOrder.AddAsync(newObject);
|
||||
// await ct.SaveChangesAsync();
|
||||
// await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||
// await SearchIndexAsync(newObject, true);
|
||||
// await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||
// await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||
// await SetDisplayFields(newObject);
|
||||
// return newObject;
|
||||
// }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//GET
|
||||
@@ -217,8 +178,8 @@ namespace AyaNova.Biz
|
||||
if (item.WorkOrderItemPartRequestId != null)
|
||||
{
|
||||
po.HasPartRequest = true;
|
||||
|
||||
item.WorkOrderItemPartRequestViz=(await WorkOrderBiz.GetWorkOrderSerialFromRelativeAsync(AyaType.WorkOrderItemPartRequest, (long)item.WorkOrderItemPartRequestId, ct)).ToString();
|
||||
|
||||
item.WorkOrderItemPartRequestViz = (await WorkOrderBiz.GetWorkOrderSerialFromRelativeAsync(AyaType.WorkOrderItemPartRequest, (long)item.WorkOrderItemPartRequestId, ct)).ToString();
|
||||
if (item.PartRequestedById != null)
|
||||
item.PartRequestedByViz = await ct.User.AsNoTracking().Where(x => x.Id == item.PartRequestedById).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
}
|
||||
@@ -472,8 +433,19 @@ namespace AyaNova.Biz
|
||||
AddError(ApiErrorCode.API_SERVER_ERROR, "generalerror", $"Error updating inventory ({i.Description}):{pib.GetErrorsAsString()}");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//MIGRATE_OUTSTANDING - update workorderitempart here if applicable
|
||||
foreach (var poItem in oldObj.Items)
|
||||
{
|
||||
if (poItem.WorkOrderItemPartRequestId != null)
|
||||
{
|
||||
//De-request it
|
||||
var w = await ct.WorkOrderItemPartRequest.FirstOrDefaultAsync(x => x.Id == poItem.WorkOrderItemPartRequestId);
|
||||
if (w != null)
|
||||
{
|
||||
w.PurchaseOrderItemId = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;//done, nothing more to do here
|
||||
}
|
||||
@@ -506,12 +478,25 @@ namespace AyaNova.Biz
|
||||
|
||||
await PartBiz.AppendSerialsAsync(poItem.PartId, poItem.Serials, ct, UserId);
|
||||
|
||||
//MIGRATE_OUTSTANDING - update workorderitempart here if applicable
|
||||
}
|
||||
|
||||
//All new so set them all
|
||||
foreach (var poItem in newObj.Items)
|
||||
SetPoItemDefaultPartValues(poItem, PoParts, newObj.VendorId);
|
||||
|
||||
foreach (var poItem in newObj.Items)
|
||||
{
|
||||
if (poItem.WorkOrderItemPartRequestId != null)
|
||||
{
|
||||
//set it on request
|
||||
var w = await ct.WorkOrderItemPartRequest.FirstOrDefaultAsync(x => x.Id == poItem.WorkOrderItemPartRequestId);
|
||||
if (w != null)
|
||||
{
|
||||
w.PurchaseOrderItemId = poItem.Id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -851,7 +836,7 @@ namespace AyaNova.Biz
|
||||
public async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj = null)
|
||||
{
|
||||
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<PurchaseOrderBiz>();
|
||||
if(ServerBootConfig.SEEDING || ServerBootConfig.MIGRATING) return;
|
||||
if (ServerBootConfig.SEEDING || ServerBootConfig.MIGRATING) return;
|
||||
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{this.BizType}, AyaEvent:{ayaEvent}]");
|
||||
|
||||
bool isNew = currentObj == null;
|
||||
|
||||
@@ -4571,6 +4571,10 @@ namespace AyaNova.Biz
|
||||
o.PurchaseOrderIdViz = po.Id;
|
||||
o.PurchaseOrderDateViz = po.OrderedDate;
|
||||
o.PurchaseOrderExpectedDateViz = po.ExpectedReceiveDate;
|
||||
|
||||
if(o.RequestedByUserId!=null){
|
||||
o.RequestedByUserViz=await ct.User.AsNoTracking().Where(x => x.Id == o.RequestedByUserId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,9 @@ namespace AyaNova.Models
|
||||
public string WholesalerName { get; set; }
|
||||
public long AltWholesalerId { get; set; }
|
||||
public string AltWholesalerName { get; set; }
|
||||
public string RequestedByUserName { get; set; }
|
||||
public long RequestedByUserId { get; set; }
|
||||
|
||||
}//eoc
|
||||
}//eons
|
||||
|
||||
|
||||
@@ -26,6 +26,9 @@ namespace AyaNova.Models
|
||||
[Required]
|
||||
public decimal Quantity { get; set; }
|
||||
|
||||
public long? RequestedByUserId { get; set; }
|
||||
[NotMapped]
|
||||
public string RequestedByUserViz { get; set; }
|
||||
public long? PurchaseOrderItemId { get; set; }
|
||||
[NotMapped]
|
||||
public string PurchaseOrderViz { get; set; }
|
||||
|
||||
@@ -833,7 +833,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
|
||||
//WORKORDERITEM PART REQUEST
|
||||
await ExecQueryAsync("CREATE TABLE aworkorderitempartrequest (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, workorderitemid BIGINT NOT NULL REFERENCES aworkorderitem (id), "
|
||||
+ "partid BIGINT NOT NULL REFERENCES apart, partwarehouseid BIGINT NOT NULL REFERENCES apartwarehouse, quantity DECIMAL(19,5) NOT NULL default 0, received DECIMAL(19,5) NOT NULL default 0, "
|
||||
+ "purchaseorderitemid BIGINT NULL REFERENCES apurchaseorderitem"
|
||||
+ "requestedbyuserid BIGINT NULL REFERENCES auser, purchaseorderitemid BIGINT NULL REFERENCES apurchaseorderitem"
|
||||
+ ")");
|
||||
|
||||
//WORKORDERITEM SCHEDULED USER
|
||||
@@ -915,9 +915,10 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
|
||||
//VIEWPARTREQUESTLIST
|
||||
await ExecQueryAsync("CREATE VIEW viewpartrequestlist AS SELECT AWORKORDERITEMPARTREQUEST.ID AS REQUESTID, PARTID, PARTWAREHOUSEID, QUANTITY, AWORKORDER.SERIAL, "
|
||||
+"APART.PARTNUMBER AS PARTNUMBER, APART.NAME AS PARTNAME, APARTWAREHOUSE.NAME AS PARTWAREHOUSENAME, AWHOLESALER.NAME AS WHOLESALERNAME, "
|
||||
+"AWORKORDERITEMPARTREQUEST.REQUESTEDBYUSERID AS REQUESTEDBYUSERID, AUSER.NAME AS REQUESTEDBYUSERNAME, "
|
||||
+"AWHOLESALER.ID AS WHOLESALERID, AALTWHOLESALER.ID AS ALTWHOLESALERID, AALTWHOLESALER.NAME AS ALTWHOLESALERNAME FROM AWORKORDERITEMPARTREQUEST "
|
||||
+"LEFT JOIN AWORKORDERITEM ON AWORKORDERITEM.ID = AWORKORDERITEMPARTREQUEST.WORKORDERITEMID LEFT JOIN AWORKORDER ON AWORKORDERITEM.WORKORDERID = AWORKORDER.ID "
|
||||
+"LEFT JOIN AWORKORDERSTATUS ON AWORKORDER.LASTSTATUSID = AWORKORDERSTATUS.ID LEFT JOIN APART ON AWORKORDERITEMPARTREQUEST.PARTID = APART.ID "
|
||||
+"LEFT JOIN AWORKORDERSTATUS ON AWORKORDER.LASTSTATUSID = AWORKORDERSTATUS.ID LEFT JOIN APART ON AWORKORDERITEMPARTREQUEST.PARTID = APART.ID LEFT JOIN AUSER ON AWORKORDERITEMPARTREQUEST.REQUESTEDBYUSERID "
|
||||
+"LEFT JOIN APARTWAREHOUSE ON AWORKORDERITEMPARTREQUEST.PARTWAREHOUSEID = APARTWAREHOUSE.ID LEFT JOIN AVENDOR AS AWHOLESALER ON (APART.WHOLESALERID = AWHOLESALER.ID) "
|
||||
+"LEFT JOIN AVENDOR AS AALTWHOLESALER ON (APART.ALTERNATIVEWHOLESALERID = AALTWHOLESALER.ID) WHERE AWORKORDERITEMPARTREQUEST.PURCHASEORDERITEMID IS NULL AND "
|
||||
+"(AWORKORDER.LASTSTATUSID IS NULL OR AWORKORDERSTATUS.COMPLETED = FALSE) ORDER BY AWORKORDERITEMPARTREQUEST.ID;");
|
||||
|
||||
Reference in New Issue
Block a user