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
|
//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();
|
await transaction.CommitAsync();
|
||||||
if (populateViz)
|
if (populateViz)
|
||||||
await WorkOrderPopulateVizFields(newObject, true, false);
|
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();
|
o.FromQuoteViz = await ct.Quote.AsNoTracking().Where(x => x.Id == o.FromQuoteId).Select(x => x.Serial.ToString()).FirstOrDefaultAsync();
|
||||||
if (o.FromPMId != null)
|
if (o.FromPMId != null)
|
||||||
o.FromPMViz = await ct.PM.AsNoTracking().Where(x => x.Id == o.FromPMId).Select(x => x.Serial.ToString()).FirstOrDefaultAsync();
|
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 EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, AyaType.WorkOrderItem, AyaEvent.Created), ct);
|
||||||
await ItemSearchIndexAsync(newObject, true);
|
await ItemSearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
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 ItemPopulateVizFields(newObject, false);
|
||||||
await ItemHandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await ItemHandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1962,6 +1977,9 @@ namespace AyaNova.Biz
|
|||||||
//
|
//
|
||||||
private async Task ItemPopulateVizFields(WorkOrderItem o, bool populateForReporting)
|
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)
|
foreach (var v in o.Expenses)
|
||||||
await ExpensePopulateVizFields(v);
|
await ExpensePopulateVizFields(v);
|
||||||
foreach (var v in o.Labors)
|
foreach (var v in o.Labors)
|
||||||
@@ -6089,7 +6107,7 @@ namespace AyaNova.Biz
|
|||||||
if (o is WorkOrder)
|
if (o is WorkOrder)
|
||||||
{
|
{
|
||||||
WorkOrder dto = new WorkOrder();
|
WorkOrder dto = new WorkOrder();
|
||||||
CopyObject.Copy(o, dto,"Name");
|
CopyObject.Copy(o, dto, "Name");
|
||||||
return await WorkOrderPutAsync((WorkOrder)dto);
|
return await WorkOrderPutAsync((WorkOrder)dto);
|
||||||
}
|
}
|
||||||
return await WorkOrderPutAsync((WorkOrder)o) as ICoreBizObjectModel;
|
return await WorkOrderPutAsync((WorkOrder)o) as ICoreBizObjectModel;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace AyaNova.Models
|
|||||||
public string CustomerContactName { get; set; }
|
public string CustomerContactName { get; set; }
|
||||||
public long? FromQuoteId { get; set; }
|
public long? FromQuoteId { get; set; }
|
||||||
public long? FromPMId { get; set; }
|
public long? FromPMId { get; set; }
|
||||||
public long? FromCSRId { get; set; }
|
|
||||||
public DateTime CreatedDate { get; set; } = DateTime.UtcNow;
|
public DateTime CreatedDate { get; set; } = DateTime.UtcNow;
|
||||||
public DateTime? ServiceDate { get; set; }
|
public DateTime? ServiceDate { get; set; }
|
||||||
public DateTime? CompleteByDate { get; set; }
|
public DateTime? CompleteByDate { get; set; }
|
||||||
@@ -86,8 +86,7 @@ namespace AyaNova.Models
|
|||||||
public string FromQuoteViz { get; set; }
|
public string FromQuoteViz { get; set; }
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public string FromPMViz { get; set; }
|
public string FromPMViz { get; set; }
|
||||||
[NotMapped]
|
|
||||||
public string FromCSRViz { get; set; }
|
|
||||||
|
|
||||||
[NotMapped]
|
[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)
|
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 bool WarrantyService { get; set; } = false;
|
||||||
public int Sequence { get; set; }
|
public int Sequence { get; set; }
|
||||||
|
|
||||||
|
public long? FromCSRId { get; set; }
|
||||||
|
[NotMapped]
|
||||||
|
public string FromCSRViz { get; set; }
|
||||||
|
|
||||||
//workaround for notification
|
//workaround for notification
|
||||||
[NotMapped, JsonIgnore]
|
[NotMapped, JsonIgnore]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
//Principle
|
//Principle
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public WorkOrder WorkOrder { get; set; }
|
public WorkOrder WorkOrder { get; set; }
|
||||||
|
|||||||
@@ -1142,7 +1142,9 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
|
|||||||
|
|
||||||
|
|
||||||
//WORKORDER "FROM" LINKS
|
//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
|
//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");
|
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.TaxPartSaleId = null;
|
||||||
ServerGlobalBizSettings.Cache.TaxRateSaleId = null;
|
ServerGlobalBizSettings.Cache.TaxRateSaleId = null;
|
||||||
|
|
||||||
cmd.CommandText = "update aworkorder set fromcsrid=null;";
|
cmd.CommandText = "update aworkorderitem set fromcsrid=null;";
|
||||||
await cmd.ExecuteNonQueryAsync();
|
await cmd.ExecuteNonQueryAsync();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user