private static void BuildOrderData(InventoryRecoBuilder builder, TSORDERS item) { var loc = item.FTX?.FirstOrDefault()?.TEXTLITERAL_04?.Freetext_01?.Split(';'); var plant = (loc != null && loc.Length >= 2) ? loc[1] : null; var location = (loc != null && loc.Length >= 2) ? loc[0] : null; foreach (var lin in item.LINLoop) { builder.WithMaterial(lin.LIN.ITEMNUMBERIDENTIFICATION_03.Itemnumber_01, plant, location ?? "CA01", lin.QTY.Sum(q => Convert.ToInt32(q.QUANTITYDETAILS_01.Quantity_02))); } }
private static void BuildDesadvData(InventoryRecoBuilder builder, TSDESADV item) { foreach (var cps in item.CPSLoop) { var loc = cps .LINLoop.FirstOrDefault()? .LOCLoop.FirstOrDefault()?.LOC?.LOCATIONIDENTIFICATION_02 ?.Placelocation_04?.Split(' '); var plant = loc != null && loc.Length > 0 ? loc[0] : null; var location = loc != null && loc.Length > 1 ? loc[1] : null; foreach (var lin in cps.LINLoop) { builder.WithMaterial(lin.LIN.ITEMNUMBERIDENTIFICATION_03.Itemnumber_01, plant, location ?? "CA01", lin.QTY.Sum(q => Convert.ToInt32(q.QUANTITYDETAILS_01.Quantity_02))); } } }