public MiddlewareSyncRequest <QcInspectionSync> Create(QcInspectionResponse qc) { var syncRequest = new MiddlewareSyncRequest <QcInspectionSync>(0, MiddlewareObjectTypes.QcInspection.ToString()); var qcSync = QcSync(qc); syncRequest.Data = qcSync; return(syncRequest); }
private QcInspectionSync QcSync(QcInspectionResponse qc) { var sync = new QcInspectionSync(qc.ExternalId); sync.InventoryId = qc.InventoryId; sync.InspectionQty = qc.InspectionQty; return(sync); }
public QcInspectionResponse ParseSapQcInspectionRead(MaterialInspectionReadByIDResponseMessage_sync sapResponse) { QcInspectionResponse response = new QcInspectionResponse(); BaseResponse tempRes = SapLogParser.ParseSapResponseLog(sapResponse.Log); response.Errors = tempRes.Errors; response.Warnings = tempRes.Warnings; try { if (sapResponse.MaterialInspection != null) { response.ExternalId = sapResponse.MaterialInspection.ID.Value; if (sapResponse.MaterialInspection.IdentifiedStockKey != null) { response.InventoryId = sapResponse.MaterialInspection.IdentifiedStockKey.ID.Value; } if (sapResponse.MaterialInspection.InspectionQuantity != null) { response.InspectionQty = sapResponse.MaterialInspection.InspectionQuantity.Value; } if (sapResponse.MaterialInspection.Decision != null && sapResponse.MaterialInspection.Decision.AttachmentFolder != null && sapResponse.MaterialInspection.Decision.AttachmentFolder.Document != null) { var documents = sapResponse.MaterialInspection.Decision.AttachmentFolder.Document; var pdfDocument = documents.FirstOrDefault(x => x.CategoryCode == "3" && x.TypeCode != null && x.TypeCode.Value == "10001"); response.DocumentExternalId = (pdfDocument != null && pdfDocument.UUID != null) ? pdfDocument.UUID.Value : null; } } } catch (Exception e) { response.Errors.Add("Failed to parse Qc Inspection Read Response from Sap: " + e.Message); return(response); } return(response); }