This commit is contained in:
@@ -166,6 +166,7 @@ namespace AyaNova.Biz
|
||||
|
||||
//NOTE: not running individual notification here for children, seeder won't require it and that's all that posts an entire wo currently
|
||||
}
|
||||
|
||||
await transaction.CommitAsync();
|
||||
if (populateViz)
|
||||
await WorkOrderPopulateVizFields(newObject, true, false);
|
||||
@@ -987,8 +988,7 @@ namespace AyaNova.Biz
|
||||
o.FromQuoteViz = await ct.Quote.AsNoTracking().Where(x => x.Id == o.FromQuoteId).Select(x => x.Serial.ToString()).FirstOrDefaultAsync();
|
||||
if (o.FromPMId != null)
|
||||
o.FromPMViz = await ct.PM.AsNoTracking().Where(x => x.Id == o.FromPMId).Select(x => x.Serial.ToString()).FirstOrDefaultAsync();
|
||||
if (o.FromCSRId != null)
|
||||
o.FromCSRViz = await ct.CustomerServiceRequest.AsNoTracking().Where(x => x.Id == o.FromCSRId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1768,8 +1768,23 @@ namespace AyaNova.Biz
|
||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, AyaType.WorkOrderItem, AyaEvent.Created), ct);
|
||||
await ItemSearchIndexAsync(newObject, true);
|
||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||
|
||||
//Is this a new CSR fulfillment?
|
||||
if (newObject.FromCSRId != null)
|
||||
{
|
||||
//flag the CSR
|
||||
CustomerServiceRequestBiz biz = CustomerServiceRequestBiz.GetBiz(ct);
|
||||
var csr = await biz.GetAsync((long)newObject.FromCSRId, false);
|
||||
csr.WorkOrderItemId = newObject.Id;
|
||||
await biz.PutAsync(csr);
|
||||
}
|
||||
|
||||
await ItemPopulateVizFields(newObject, false);
|
||||
await ItemHandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||
|
||||
|
||||
|
||||
|
||||
return newObject;
|
||||
}
|
||||
}
|
||||
@@ -1962,6 +1977,9 @@ namespace AyaNova.Biz
|
||||
//
|
||||
private async Task ItemPopulateVizFields(WorkOrderItem o, bool populateForReporting)
|
||||
{
|
||||
if (o.FromCSRId != null)
|
||||
o.FromCSRViz = await ct.CustomerServiceRequest.AsNoTracking().Where(x => x.Id == o.FromCSRId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
|
||||
foreach (var v in o.Expenses)
|
||||
await ExpensePopulateVizFields(v);
|
||||
foreach (var v in o.Labors)
|
||||
@@ -6089,7 +6107,7 @@ namespace AyaNova.Biz
|
||||
if (o is WorkOrder)
|
||||
{
|
||||
WorkOrder dto = new WorkOrder();
|
||||
CopyObject.Copy(o, dto,"Name");
|
||||
CopyObject.Copy(o, dto, "Name");
|
||||
return await WorkOrderPutAsync((WorkOrder)dto);
|
||||
}
|
||||
return await WorkOrderPutAsync((WorkOrder)o) as ICoreBizObjectModel;
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace AyaNova.Models
|
||||
public string CustomerContactName { get; set; }
|
||||
public long? FromQuoteId { get; set; }
|
||||
public long? FromPMId { get; set; }
|
||||
public long? FromCSRId { get; set; }
|
||||
|
||||
public DateTime CreatedDate { get; set; } = DateTime.UtcNow;
|
||||
public DateTime? ServiceDate { get; set; }
|
||||
public DateTime? CompleteByDate { get; set; }
|
||||
@@ -86,8 +86,7 @@ namespace AyaNova.Models
|
||||
public string FromQuoteViz { get; set; }
|
||||
[NotMapped]
|
||||
public string FromPMViz { get; set; }
|
||||
[NotMapped]
|
||||
public string FromCSRViz { get; set; }
|
||||
|
||||
|
||||
[NotMapped]
|
||||
public bool IsCompleteRecord { get; set; } = true;//indicates if some items were removed due to user role / type restrictions (i.e. woitems they are not scheduled on)
|
||||
|
||||
@@ -31,10 +31,14 @@ namespace AyaNova.Models
|
||||
public bool WarrantyService { get; set; } = false;
|
||||
public int Sequence { get; set; }
|
||||
|
||||
public long? FromCSRId { get; set; }
|
||||
[NotMapped]
|
||||
public string FromCSRViz { get; set; }
|
||||
|
||||
//workaround for notification
|
||||
[NotMapped, JsonIgnore]
|
||||
public string Name { get; set; }
|
||||
|
||||
|
||||
//Principle
|
||||
[JsonIgnore]
|
||||
public WorkOrder WorkOrder { get; set; }
|
||||
|
||||
@@ -1142,7 +1142,9 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
|
||||
|
||||
|
||||
//WORKORDER "FROM" LINKS
|
||||
await ExecQueryAsync("ALTER TABLE aworkorder ADD column fromquoteid BIGINT REFERENCES aquote (id), ADD column frompmid BIGINT REFERENCES apm (id), ADD column fromcsrid BIGINT REFERENCES acustomerservicerequest (id)");
|
||||
await ExecQueryAsync("ALTER TABLE aworkorder ADD column fromquoteid BIGINT REFERENCES aquote (id), ADD column frompmid BIGINT REFERENCES apm (id)");
|
||||
await ExecQueryAsync("ALTER TABLE aworkorderitem ADD column fromcsrid BIGINT REFERENCES acustomerservicerequest (id)");
|
||||
|
||||
|
||||
//VIEWWORKORDER - adds AGE expression column for datalist queries
|
||||
await ExecQueryAsync("CREATE VIEW viewworkorder AS select aworkorder.*, AGE(timezone('UTC', now()), aworkorder.createddate) as expwoage from aworkorder");
|
||||
|
||||
@@ -329,7 +329,7 @@ namespace AyaNova.Util
|
||||
ServerGlobalBizSettings.Cache.TaxPartSaleId = null;
|
||||
ServerGlobalBizSettings.Cache.TaxRateSaleId = null;
|
||||
|
||||
cmd.CommandText = "update aworkorder set fromcsrid=null;";
|
||||
cmd.CommandText = "update aworkorderitem set fromcsrid=null;";
|
||||
await cmd.ExecuteNonQueryAsync();
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user