From 271850be598099549b4c874bdf16aaf96f361656 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Tue, 8 Feb 2022 15:14:56 -0800 Subject: [PATCH] Added ARMS status mapper. --- BodyshopUploader/Utils/ARMSRoData.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/BodyshopUploader/Utils/ARMSRoData.cs b/BodyshopUploader/Utils/ARMSRoData.cs index 632355e..3325699 100644 --- a/BodyshopUploader/Utils/ARMSRoData.cs +++ b/BodyshopUploader/Utils/ARMSRoData.cs @@ -7,6 +7,8 @@ using System.Text.RegularExpressions; using System.Threading.Tasks; using FileHelpers; using GraphQL; +using Newtonsoft; +using Newtonsoft.Json.Linq; namespace BodyshopPartner.Utils { @@ -118,6 +120,7 @@ query ENTEGRAL_EXPORT($bodyshopid: uuid!, $start: timestamptz!, $end: timestampt entegral_id shopname md_ro_statuses + features } } @@ -231,7 +234,7 @@ query ENTEGRAL_EXPORT($bodyshopid: uuid!, $start: timestamptz!, $end: timestampt Vehiclecolor = job.v_color?.Value, PaintTechID = job.employee_refinish_rel?.Value == null ? "" : job.employee_refinish_rel?.employee_number?.Value, PaintTechName = job.employee_refinish_rel?.Value == null ? "" : $"{job.employee_refinish_rel?.first_name?.Value} {job.employee_refinish_rel?.last_name?.Value}", - ProductionStageCode = (job.actual_delivery?.Value != null || job.date_invoiced != null) ? "8D" : "33", + ProductionStageCode = StatusMapper(job, data.bodyshops_by_pk.features.entegral), Vehiclescheduledindate = job.scheduled_in?.Value }); } @@ -247,5 +250,14 @@ query ENTEGRAL_EXPORT($bodyshopid: uuid!, $start: timestamptz!, $end: timestampt } + + public static string StatusMapper(dynamic job,dynamic features) + { + JArray j = (JArray)(features); + + var x = j.Where(v => v["status"] == job.status).FirstOrDefault(); + if (x == null) return "8D"; + return x["code"].ToString() ; + } } }