Added ARMS status mapper.

This commit is contained in:
Patrick Fic
2022-02-08 15:14:56 -08:00
parent 7b65502e26
commit 271850be59

View File

@@ -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() ;
}
}
}