public PrintParcelsRequestType Map(CentiroPrintParcels report, string printerType) { PrintParcelsRequestType request = new PrintParcelsRequestType(); request.NumberOfTags = report.numberOfTags; request.LabelPrinterType = printerType; if (report.returnSequenceNumbers.Equals("1")) { request.ReturnSequenceNumbers = true; } else { request.ReturnSequenceNumbers = false; } if (report.returnTrackingUrls.Equals("1")) { request.ReturnTrackingUrls = true; } else { request.ReturnTrackingUrls = false; } request.ShipmentIdentifier = report.shipmentIdentifier; request.SenderCode = report.senderCode; List <string> parcels = new List <string>(); foreach (CentiroPrintParcelType p in report.Parcels.Parcel) { parcels.Add(p.parcelIdentifier); } request.ParcelIdentifierList = parcels; request.MessageId = Convert.ToString(DateTime.Now.Ticks); return(request); }
private void PrintParcel(string requestClob, string whId) { CentiroPrintParcels report = _printParcelSerializer.Deserialize(new StringReader(requestClob)) as CentiroPrintParcels; if (_fetchEachPrinterType) { _printerType = GetPrinterType(report.terminal, "C*CPL", whId); } PrintParcelsRequestType request = _businessDataMapper.Map(report, _printerType); if (request == null) { throw new CentiroAdapterException( string.Format("Failed to deserialize PrintParcel clob. Data = {0}", requestClob)); } else { MessageId = Convert.ToString(DateTime.Now.Ticks); request.MessageId = MessageId; if (_isXmlDumpEnabled) { new XMLHelper().DumpToFile(new XMLHelper().InterfaceClassToXml(request), LogFileName("PrintParcel_Request")); } CentiroServiceAgent csAdapter = GetCachedAdapter(report.url); PrintParcelsResponseType ur = csAdapter.PrintParcel(request, _isXmlDumpEnabled); if (ur == null) { throw new CentiroAdapterException( string.Format("No data in PrintParcel response. MessageId = {0}", request.MessageId)); } else { if (ur.LabelCode != null) { GenericReport document = new GenericReport(); document.MetaData = new MetaDataType(); document.MetaData.applicationIdentity = "Warehouse"; document.MetaData.documentType = "C*CPL"; document.MetaData.documentSubType = ""; document.MetaData.terminalIdentity = report.terminal; document.MetaData.userIdentity = report.user; if (report.printerIdentity == null) { document.MetaData.printerIdentity = ""; } else { document.MetaData.printerIdentity = report.printerIdentity; } document.MetaData.numberOfCopies = 1; document.Data = ur.LabelCode; _receivedDocuments.Add(document); } if (ur.ParcelDetails != null) { foreach (ParcelDetails p in ur.ParcelDetails) { SaveParcel(p); } } } } }