Added fetching for Shop Region + OPCODE decoding.
This commit is contained in:
@@ -8,7 +8,10 @@ namespace BodyshopUploader.Utils
|
||||
{
|
||||
public static class AppMetaData
|
||||
{
|
||||
//TODO: Change firebase API Key to be dependent on what environment monitor has been set for.
|
||||
public static string FirebaseAPIKey_DEV = "AIzaSyDV9MsSHZmpLtjoaTK_ObvjFaJ-nMSd2KA";
|
||||
public static string ActiveShopId = Properties.Settings.Default.LastSelectedShop;
|
||||
public static string ShopRegion = "";
|
||||
public static dynamic CiecaOpCodes;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -848,11 +848,7 @@ namespace BodyshopUploader.Utils.Decoder
|
||||
|
||||
var allLines = new JArray();
|
||||
|
||||
//Create new column to capture lbr op code description. in UI, show partno ? partno : op code desc. has to be stamped
|
||||
//If the OEM_PARTNO is empty, use the operation code and look it up in opcode table. If found, take opcode.opcodedescription and populate oem_partno with it
|
||||
//populate lbr_op with opcode.opcodetouse
|
||||
//if part_type is blank, pull in the part type from parttypetousemitchell
|
||||
//if not found, set description to not efined
|
||||
|
||||
|
||||
#region Code
|
||||
//TODO: How to handle price markup and discounts.
|
||||
@@ -964,6 +960,26 @@ namespace BodyshopUploader.Utils.Decoder
|
||||
lin.bett_amt = readValues[43];//BETT_AMT
|
||||
lin.bett_tax = readValues[44];//BETT_TAX
|
||||
|
||||
//Create new column to capture lbr op code description. in UI, show partno ? partno : op code desc. has to be stamped
|
||||
//If the OEM_PARTNO is empty, use the operation code and look it up in opcode table. If found, take opcode.opcodedescription and populate oem_partno with it
|
||||
//populate lbr_op with opcode.opcodetouse
|
||||
//if part_type is blank, pull in the part type from parttypetousemitchell
|
||||
//if not found, set description to not efined
|
||||
|
||||
if (string.IsNullOrEmpty(lin.oem_partno.Value))
|
||||
{
|
||||
try
|
||||
{
|
||||
lin.op_code_desc = Utils.AppMetaData.CiecaOpCodes[lin.lbr_op.Value]["desc"].Value;
|
||||
}
|
||||
catch (Exception Ex)
|
||||
{
|
||||
logger.Warn(Ex, "Couldnt find OpCodeDesc from {0} ", lin.lbr_op.Value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
allLines.Add(lin);
|
||||
}
|
||||
|
||||
@@ -984,6 +1000,10 @@ namespace BodyshopUploader.Utils.Decoder
|
||||
}
|
||||
}
|
||||
|
||||
public static object ReflectPropertyValue(object source, string property)
|
||||
{
|
||||
return source.GetType().GetProperty(property).GetValue(source, null);
|
||||
}
|
||||
|
||||
public static void ParseTtlFile(ref dynamic j, string RootFilePath)
|
||||
{
|
||||
|
||||
@@ -66,6 +66,7 @@ namespace BodyshopUploader.Utils
|
||||
try
|
||||
{
|
||||
Thread.Sleep(1000);//Allow a small amount of time to pass before processing the queue item so that any writes can finish.
|
||||
await GetOpCodes();
|
||||
DecodeQueueItemJob(item);
|
||||
await UpsertQueueItem(item);
|
||||
}
|
||||
@@ -77,6 +78,26 @@ namespace BodyshopUploader.Utils
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task GetOpCodes()
|
||||
{
|
||||
var r = new GraphQLRequest
|
||||
{
|
||||
Query = @"query MyQuery($key: String!) {
|
||||
masterdata(where: {key: {_eq: $key}}) {
|
||||
value
|
||||
key
|
||||
}
|
||||
}",
|
||||
Variables = new
|
||||
{
|
||||
key = "CA_BC_ciecaopcodes"
|
||||
}
|
||||
};
|
||||
var data = await Utils.GraphQL.ExecuteQuery(r);
|
||||
|
||||
Utils.AppMetaData.CiecaOpCodes = JObject.Parse(data.masterdata[0].value.Value);
|
||||
}
|
||||
|
||||
private static void DecodeQueueItemJob(DTO_QueueItem item)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user