Created
March 4, 2015 22:18
-
-
Save stdray/f30191d16bdb689cd7e0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public module ExternalDocumentProvider | |
| { | |
| public Get(groupType : string, content : XDocument) : Seq[ExternalGroupDocumentInfo] | |
| { | |
| def get(doc) | |
| { | |
| def fromPurchaseDocumentCommonType (x) | |
| { | |
| entity() <- | |
| { | |
| Content = x.XSerialize(); | |
| DocumentType = x.GetType().Name; | |
| GroupExternalType = groupType; | |
| DocumentExternalKey = x.purchaseNumber; | |
| GroupExternalKey = x.purchaseNumber; | |
| PublishDateTime = nullable(x.docPublishDate); | |
| } | |
| } | |
| def fromPurchaseNotificationType (x) | |
| { | |
| entity() <- | |
| { | |
| Content = x.XSerialize(); | |
| DocumentType = x.GetType().Name; | |
| GroupExternalType = groupType; | |
| DocumentExternalKey = x.purchaseNumber; | |
| GroupExternalKey = x.purchaseNumber; | |
| PublishDateTime = nullable(x.docPublishDate); | |
| } | |
| } | |
| choice(doc) | |
| { | |
| when(doc.bankGuarantee(x)) | |
| collection entity() <- | |
| { | |
| Content = x.XSerialize(); | |
| DocumentType = x.GetType().Name; | |
| GroupExternalType = groupType; | |
| DocumentExternalKey = x.regNumber; | |
| GroupExternalKey = x.regNumber; | |
| PublishDateTime = nullable(x.docPublishDate); | |
| PublishVersion = x.versionNumber; | |
| } | |
| when(doc.bankGuaranteeInvalid(x)) | |
| collection entity() <- | |
| { | |
| Content = x.XSerialize(); | |
| DocumentType = x.GetType().Name; | |
| GroupExternalType = groupType; | |
| DocumentExternalKey = x.docNumber; | |
| GroupExternalKey = x.regNumber; | |
| PublishDateTime = x.docPublishDate; | |
| } | |
| when(doc.bankGuaranteeRefusal(x)) | |
| collection entity() <- | |
| { | |
| Content = x.XSerialize(); | |
| DocumentType = x.GetType().Name; | |
| GroupExternalType = groupType; | |
| DocumentExternalKey = x.docNumber; | |
| GroupExternalKey = x.regNumber; | |
| PublishDateTime = nullable(x.docPublishDate); | |
| PublishVersion = x.versionNumber; | |
| } | |
| when(doc.checkPlan(_)) | |
| collection {} | |
| when(doc.checkResult(x)) | |
| collection entity() <- | |
| { | |
| Content = x.XSerialize(); | |
| DocumentType = x.GetType().Name; | |
| GroupExternalType = groupType; | |
| DocumentExternalKey = x.commonInfo.checkResultNumber; | |
| GroupExternalKey = x.commonInfo.checkResultNumber; | |
| PublishDateTime = x.commonInfo.publishDate; | |
| PublishVersion = nullable(x.commonInfo.versionNumber); | |
| } | |
| when(doc.checkResultCancel(x)) | |
| collection entity() <- | |
| { | |
| Content = x.XSerialize(); | |
| DocumentType = x.GetType().Name; | |
| GroupExternalType = groupType; | |
| DocumentExternalKey = x.commonInfo.checkResultNumber; | |
| GroupExternalKey = x.commonInfo.checkResultNumber; | |
| PublishDateTime = x.commonInfo.publishDate; | |
| } | |
| when(doc.complaint(x)) | |
| collection entity() <- | |
| { | |
| Content = x.XSerialize(); | |
| DocumentType = x.GetType().Name; | |
| GroupExternalType = groupType; | |
| DocumentExternalKey = x.commonInfo.complaintNumber; | |
| GroupExternalKey = x.commonInfo.complaintNumber; | |
| PublishDateTime = nullable(x.commonInfo.regDate); | |
| PublishVersion = nullable(x.commonInfo.versionNumber); | |
| } | |
| when(doc.complaintCancel(x)) | |
| collection entity() <- | |
| { | |
| Content = x.XSerialize(); | |
| DocumentType = x.GetType().Name; | |
| GroupExternalType = groupType; | |
| DocumentExternalKey = x.complaintNumber; | |
| GroupExternalKey = x.complaintNumber; | |
| PublishDateTime = nullable(x.regDate); | |
| } | |
| when(doc.complaintGroup(_)) //todo: Это нужно? | |
| collection {} | |
| when(doc.fcsNotificationCancel(x)) | |
| collection fromPurchaseDocumentCommonType (x); | |
| when(doc.fcsNotificationCancelFailure(x)) | |
| collection fromPurchaseDocumentCommonType (x); | |
| when(doc.fcsNotificationEF(x)) | |
| collection fromPurchaseNotificationType(x); | |
| when(doc.fcsNotificationEP(x)) | |
| collection entity() <- | |
| { | |
| Content = x.XSerialize(); | |
| DocumentExternalKey = x.purchaseNumber; | |
| DocumentType = x.GetType().Name; | |
| GroupExternalKey = x.purchaseNumber; | |
| GroupExternalType = groupType; | |
| PublishDateTime = x.docPublishDate; | |
| } | |
| when(doc.fcsNotificationISM(x)) | |
| collection entity() <- | |
| { | |
| Content = x.XSerialize(); | |
| DocumentExternalKey = x.purchaseNumber; | |
| DocumentType = x.GetType().Name; | |
| GroupExternalKey = x.purchaseNumber; | |
| GroupExternalType = groupType; | |
| PublishDateTime = nullable(x.docPublishDate); | |
| } | |
| when(doc.fcsNotificationISO(x)) | |
| collection entity() <- | |
| { | |
| Content = x.XSerialize(); | |
| DocumentExternalKey = x.purchaseNumber; | |
| DocumentType = x.GetType().Name; | |
| GroupExternalKey = x.purchaseNumber; | |
| GroupExternalType = groupType; | |
| PublishDateTime = nullable(x.docPublishDate); | |
| } | |
| when(doc.fcsNotificationOK(x)) | |
| collection fromPurchaseNotificationType(x); | |
| when(doc.fcsNotificationOKD(x)) | |
| collection fromPurchaseNotificationType(x); | |
| when(doc.fcsNotificationOKOU(x)) | |
| collection fromPurchaseNotificationType(x); | |
| when(doc.fcsNotificationPO(x)) | |
| collection fromPurchaseNotificationType(x); | |
| when(doc.fcsNotificationZakA(x)) | |
| collection fromPurchaseNotificationType(x); | |
| when(doc.fcsNotificationZakK(x)) | |
| collection fromPurchaseNotificationType(x); | |
| when(doc.fcsNotificationZakKD(x)) | |
| collection fromPurchaseNotificationType(x); | |
| when(doc.fcsNotificationZakKOU(x)) | |
| collection fromPurchaseNotificationType(x); | |
| when(doc.fcsNotificationZK(x)) | |
| collection fromPurchaseNotificationType(x); | |
| when(doc.fcsNotificationZKBI(x)) | |
| collection entity() <- | |
| { | |
| Content = x.XSerialize(); | |
| DocumentExternalKey = x.purchaseNumber; | |
| DocumentType = x.GetType().Name; | |
| GroupExternalKey = x.purchaseNumber; | |
| GroupExternalType = groupType; | |
| PublishDateTime = nullable(x.docPublishDate); | |
| } | |
| when(doc.fcsNotificationZP(x)) | |
| collection fromPurchaseNotificationType(x); | |
| when(doc.fcsNotificationLotCancel(x)) | |
| collection entity() <- | |
| { | |
| Content = x.XSerialize(); | |
| DocumentExternalKey = x.purchaseNumber; | |
| DocumentType = x.GetType().Name; | |
| GroupExternalKey = x.purchaseNumber; | |
| GroupExternalType = groupType; | |
| PublishDateTime = nullable(x.docPublishDate); | |
| } | |
| when(doc.fcsNotificationLotChange(x)) | |
| collection entity() <- | |
| { | |
| Content = x.XSerialize(); | |
| DocumentExternalKey = x.purchaseNumber; | |
| DocumentType = x.GetType().Name; | |
| GroupExternalKey = x.purchaseNumber; | |
| GroupExternalType = groupType; | |
| PublishDateTime = nullable(x.docPublishDate); | |
| } | |
| when(doc.fcsNotificationOrgChange(x)) | |
| collection entity() <- | |
| { | |
| Content = x.XSerialize(); | |
| DocumentExternalKey = x.purchase.purchaseNumber; | |
| DocumentType = x.GetType().Name; | |
| GroupExternalKey = x.purchase.purchaseNumber;; | |
| GroupExternalType = groupType; | |
| PublishDateTime = nullable(x.docPublishDate); | |
| } | |
| when(doc.fcsPurchaseProlongationOK(x)) | |
| collection entity() <- | |
| { | |
| Content = x.XSerialize(); | |
| DocumentExternalKey = x.purchaseNumber; | |
| DocumentType = x.GetType().Name; | |
| GroupExternalKey = x.purchaseNumber; | |
| GroupExternalType = groupType; | |
| PublishDateTime = nullable(x.docPublishDate); | |
| } | |
| when(doc.fcsPurchaseProlongationZK(x)) | |
| collection entity() <- | |
| { | |
| Content = x.XSerialize(); | |
| DocumentExternalKey = x.purchaseNumber; | |
| DocumentType = x.GetType().Name; | |
| GroupExternalKey = x.purchaseNumber; | |
| GroupExternalType = groupType; | |
| PublishDateTime = nullable(x.docPublishDate); | |
| } | |
| when(doc.fcsClarification(x)) | |
| collection entity() <- | |
| { | |
| Content = x.XSerialize(); | |
| DocumentExternalKey = x.purchaseNumber; | |
| DocumentType = x.GetType().Name; | |
| GroupExternalKey = x.purchaseNumber; | |
| GroupExternalType = groupType; | |
| PublishDateTime = x.docPublishDate; | |
| } | |
| when(doc.fcsPlacementResult(x)) | |
| collection entity() <- | |
| { | |
| Content = x.XSerialize(); | |
| DocumentExternalKey = x.purchaseNumber; | |
| DocumentType = x.GetType().Name; | |
| GroupExternalKey = x.purchaseNumber; | |
| GroupExternalType = groupType; | |
| PublishDateTime = nullable(x.createDate); | |
| } | |
| when(doc.nsiOrganizationList(list)) | |
| from x in list.nsiOrganization | |
| select entity() <- | |
| { | |
| Content = x.XSerialize(); | |
| DocumentType = x.GetType().Name; | |
| GroupExternalType = groupType; | |
| DocumentExternalKey = x.regNumber; | |
| GroupExternalKey = x.regNumber; | |
| } | |
| //todo: нам нужен? | |
| when(doc.fcsPurchaseDocument(_)) | |
| collection {} | |
| when(doc.tenderPlan(x)) | |
| collection entity() <- | |
| { | |
| Content = x.XSerialize(); | |
| DocumentType = x.GetType().Name; | |
| GroupExternalType = groupType; | |
| DocumentExternalKey = x.commonInfo.planNumber; | |
| GroupExternalKey = x.commonInfo.planNumber; | |
| PublishDateTime = x.commonInfo.publishDate; | |
| PublishVersion = x.commonInfo.versionNumber; | |
| } | |
| when(doc.tenderPlanCancel(x)) | |
| collection entity() <- | |
| { | |
| Content = x.XSerialize(); | |
| DocumentType = x.GetType().Name; | |
| GroupExternalType = groupType; | |
| DocumentExternalKey = x.planNumber; | |
| GroupExternalKey = x.planNumber; | |
| PublishDateTime = x.cancelDate; | |
| PublishVersion = x.versionNumber; | |
| } | |
| when(doc.tenderPlanUnstructured(_)) | |
| collection {} | |
| when(doc.unfairSupplier(x)) | |
| collection entity() <- | |
| { | |
| Content = x.XSerialize(); | |
| DocumentType = x.GetType().Name; | |
| GroupExternalType = groupType; | |
| DocumentExternalKey = x.registryNum; | |
| GroupExternalKey = x.registryNum; | |
| PublishDateTime = nullable(x.publishDate); | |
| } | |
| when(doc.unplannedCheck(x)) | |
| collection entity() <- | |
| { | |
| Content = x.XSerialize(); | |
| DocumentType = x.GetType().Name; | |
| GroupExternalType = groupType; | |
| DocumentExternalKey = x.commonInfo.checkNumber; | |
| GroupExternalKey = x.commonInfo.checkNumber; | |
| PublishDateTime = nullable(x.commonInfo.publishDate); | |
| PublishVersion = nullable(x.commonInfo.versionNumber); | |
| } | |
| when(doc.unplannedCheckCancel(x)) | |
| collection entity() <- | |
| { | |
| Content = x.XSerialize(); | |
| DocumentType = x.GetType().Name; | |
| GroupExternalType = groupType; | |
| DocumentExternalKey = x.checkNumber; | |
| GroupExternalKey = x.checkNumber; | |
| PublishDateTime = nullable(x.publishDate); | |
| } | |
| } | |
| } | |
| def result = List(); | |
| foreach(item in content.asExport().ItemsChoice) | |
| foreach(res in get(item)) | |
| result.Add(res); | |
| result; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment