Skip to content

Instantly share code, notes, and snippets.

@metametaclass
Created September 14, 2012 06:57
Show Gist options
  • Save metametaclass/3720338 to your computer and use it in GitHub Desktop.
Save metametaclass/3720338 to your computer and use it in GitHub Desktop.
module Tekinsoft.agnks_fs
open Tekinsoft.Utils
open Tekinsoft.Types
open Tekinsoft.agnks
type TransactTypesVariant =
|OperSetCommonParam
|OperSetTaxRate
|OperSetClientParam
|OperSetAGNKSParam
|OperSetUMGParam
|OperPayment of TRPaymentNoParentIfaceRO
|OperPaymentReturn of TRPaymentNoParentIfaceRO
|OperPaymentReassign of TRPaymentNoParentIfaceRO
|FillingEKI of FillingNoParentIfaceRO * SaleNoParentIfaceRO
|FillingCash of FillingNoParentIfaceRO * SaleNoParentIfaceRO * TRCashNoParentIfaceRO
|OperReservEKR
|OperRefuelPAGZ of FillingNoParentIfaceRO * SaleNoParentIfaceRO
|OperPipeLine of FillingNoParentIfaceRO * SaleNoParentIfaceRO
|IncomGas
|ReturnGas
|OperAGNKSExpenses
|OperAGNKSExpensesReassign
|FillingBankCard of FillingNoParentIfaceRO * SaleNoParentIfaceRO
|DomestGas
|TechGas
|CashDeposit of TRCashNoParentIfaceRO
|CashWithdrawal of TRCashNoParentIfaceRO
|CashCancellation of TRCashNoParentIfaceRO
|CashBack of TRCashNoParentIfaceRO
//Transacts,TransactDescendants
let TransactsToVariant (desc:TransactDescendantsIfaceRO) =
match desc.Transact.Type with
|1 ->
let result = desc.Transact,TransactTypesVariant.OperSetCommonParam
let hasNotNullInUnused = (desc.TRPaymentNoParent <> null) ||
(desc.TRCashNoParent <> null) ||
(desc.TRExtPaymentNoParent <> null) ||
(desc.SaleNoParent <> null) ||
(desc.FillingNoParent <> null)
if hasNotNullInUnused then DescDataExtra(result) else
DescValid(result)
|2 ->
let result = desc.Transact,TransactTypesVariant.OperSetTaxRate
let hasNotNullInUnused = (desc.TRPaymentNoParent <> null) ||
(desc.TRCashNoParent <> null) ||
(desc.TRExtPaymentNoParent <> null) ||
(desc.SaleNoParent <> null) ||
(desc.FillingNoParent <> null)
if hasNotNullInUnused then DescDataExtra(result) else
DescValid(result)
|3 ->
let result = desc.Transact,TransactTypesVariant.OperSetClientParam
let hasNotNullInUnused = (desc.TRPaymentNoParent <> null) ||
(desc.TRCashNoParent <> null) ||
(desc.TRExtPaymentNoParent <> null) ||
(desc.SaleNoParent <> null) ||
(desc.FillingNoParent <> null)
if hasNotNullInUnused then DescDataExtra(result) else
DescValid(result)
|4 ->
let result = desc.Transact,TransactTypesVariant.OperSetAGNKSParam
let hasNotNullInUnused = (desc.TRPaymentNoParent <> null) ||
(desc.TRCashNoParent <> null) ||
(desc.TRExtPaymentNoParent <> null) ||
(desc.SaleNoParent <> null) ||
(desc.FillingNoParent <> null)
if hasNotNullInUnused then DescDataExtra(result) else
DescValid(result)
|5 ->
let result = desc.Transact,TransactTypesVariant.OperSetUMGParam
let hasNotNullInUnused = (desc.TRPaymentNoParent <> null) ||
(desc.TRCashNoParent <> null) ||
(desc.TRExtPaymentNoParent <> null) ||
(desc.SaleNoParent <> null) ||
(desc.FillingNoParent <> null)
if hasNotNullInUnused then DescDataExtra(result) else
DescValid(result)
|6 ->
let hasNullInUsed = (desc.TRPaymentNoParent = null)
if hasNullInUsed then DescDataLost(desc.Transact) else
let result = desc.Transact,TransactTypesVariant.OperPayment(desc.TRPaymentNoParent)
let hasNotNullInUnused = (desc.TRCashNoParent <> null) ||
(desc.TRExtPaymentNoParent <> null) ||
(desc.SaleNoParent <> null) ||
(desc.FillingNoParent <> null)
if hasNotNullInUnused then DescDataExtra(result) else
DescValid(result)
|7 ->
let hasNullInUsed = (desc.TRPaymentNoParent = null)
if hasNullInUsed then DescDataLost(desc.Transact) else
let result = desc.Transact,TransactTypesVariant.OperPaymentReturn(desc.TRPaymentNoParent)
let hasNotNullInUnused = (desc.TRCashNoParent <> null) ||
(desc.TRExtPaymentNoParent <> null) ||
(desc.SaleNoParent <> null) ||
(desc.FillingNoParent <> null)
if hasNotNullInUnused then DescDataExtra(result) else
DescValid(result)
|8 ->
let hasNullInUsed = (desc.TRPaymentNoParent = null)
if hasNullInUsed then DescDataLost(desc.Transact) else
let result = desc.Transact,TransactTypesVariant.OperPaymentReassign(desc.TRPaymentNoParent)
let hasNotNullInUnused = (desc.TRCashNoParent <> null) ||
(desc.TRExtPaymentNoParent <> null) ||
(desc.SaleNoParent <> null) ||
(desc.FillingNoParent <> null)
if hasNotNullInUnused then DescDataExtra(result) else
DescValid(result)
|10 ->
let hasNullInUsed = (desc.FillingNoParent = null) ||
(desc.SaleNoParent = null)
if hasNullInUsed then DescDataLost(desc.Transact) else
let result = desc.Transact,TransactTypesVariant.FillingEKI(desc.FillingNoParent, desc.SaleNoParent)
let hasNotNullInUnused = (desc.TRPaymentNoParent <> null) ||
(desc.TRCashNoParent <> null) ||
(desc.TRExtPaymentNoParent <> null)
if hasNotNullInUnused then DescDataExtra(result) else
DescValid(result)
|11 ->
let hasNullInUsed = (desc.FillingNoParent = null) ||
(desc.SaleNoParent = null) ||
(desc.TRCashNoParent = null)
if hasNullInUsed then DescDataLost(desc.Transact) else
let result = desc.Transact,TransactTypesVariant.FillingCash(desc.FillingNoParent, desc.SaleNoParent, desc.TRCashNoParent)
let hasNotNullInUnused = (desc.TRPaymentNoParent <> null) ||
(desc.TRExtPaymentNoParent <> null)
if hasNotNullInUnused then DescDataExtra(result) else
DescValid(result)
|12 ->
let result = desc.Transact,TransactTypesVariant.OperReservEKR
let hasNotNullInUnused = (desc.TRPaymentNoParent <> null) ||
(desc.TRCashNoParent <> null) ||
(desc.TRExtPaymentNoParent <> null) ||
(desc.SaleNoParent <> null) ||
(desc.FillingNoParent <> null)
if hasNotNullInUnused then DescDataExtra(result) else
DescValid(result)
|13 ->
let hasNullInUsed = (desc.FillingNoParent = null) ||
(desc.SaleNoParent = null)
if hasNullInUsed then DescDataLost(desc.Transact) else
let result = desc.Transact,TransactTypesVariant.OperRefuelPAGZ(desc.FillingNoParent, desc.SaleNoParent)
let hasNotNullInUnused = (desc.TRPaymentNoParent <> null) ||
(desc.TRCashNoParent <> null) ||
(desc.TRExtPaymentNoParent <> null)
if hasNotNullInUnused then DescDataExtra(result) else
DescValid(result)
|14 ->
let hasNullInUsed = (desc.FillingNoParent = null) ||
(desc.SaleNoParent = null)
if hasNullInUsed then DescDataLost(desc.Transact) else
let result = desc.Transact,TransactTypesVariant.OperPipeLine(desc.FillingNoParent, desc.SaleNoParent)
let hasNotNullInUnused = (desc.TRPaymentNoParent <> null) ||
(desc.TRCashNoParent <> null) ||
(desc.TRExtPaymentNoParent <> null)
if hasNotNullInUnused then DescDataExtra(result) else
DescValid(result)
|15 ->
let result = desc.Transact,TransactTypesVariant.IncomGas
let hasNotNullInUnused = (desc.TRPaymentNoParent <> null) ||
(desc.TRCashNoParent <> null) ||
(desc.TRExtPaymentNoParent <> null) ||
(desc.SaleNoParent <> null) ||
(desc.FillingNoParent <> null)
if hasNotNullInUnused then DescDataExtra(result) else
DescValid(result)
|16 ->
let result = desc.Transact,TransactTypesVariant.ReturnGas
let hasNotNullInUnused = (desc.TRPaymentNoParent <> null) ||
(desc.TRCashNoParent <> null) ||
(desc.TRExtPaymentNoParent <> null) ||
(desc.SaleNoParent <> null) ||
(desc.FillingNoParent <> null)
if hasNotNullInUnused then DescDataExtra(result) else
DescValid(result)
|17 ->
let result = desc.Transact,TransactTypesVariant.OperAGNKSExpenses
let hasNotNullInUnused = (desc.TRPaymentNoParent <> null) ||
(desc.TRCashNoParent <> null) ||
(desc.TRExtPaymentNoParent <> null) ||
(desc.SaleNoParent <> null) ||
(desc.FillingNoParent <> null)
if hasNotNullInUnused then DescDataExtra(result) else
DescValid(result)
|18 ->
let result = desc.Transact,TransactTypesVariant.OperAGNKSExpensesReassign
let hasNotNullInUnused = (desc.TRPaymentNoParent <> null) ||
(desc.TRCashNoParent <> null) ||
(desc.TRExtPaymentNoParent <> null) ||
(desc.SaleNoParent <> null) ||
(desc.FillingNoParent <> null)
if hasNotNullInUnused then DescDataExtra(result) else
DescValid(result)
|19 ->
let hasNullInUsed = (desc.FillingNoParent = null) ||
(desc.SaleNoParent = null)
if hasNullInUsed then DescDataLost(desc.Transact) else
let result = desc.Transact,TransactTypesVariant.FillingBankCard(desc.FillingNoParent, desc.SaleNoParent)
let hasNotNullInUnused = (desc.TRPaymentNoParent <> null) ||
(desc.TRCashNoParent <> null) ||
(desc.TRExtPaymentNoParent <> null)
if hasNotNullInUnused then DescDataExtra(result) else
DescValid(result)
|22 ->
let result = desc.Transact,TransactTypesVariant.DomestGas
let hasNotNullInUnused = (desc.TRPaymentNoParent <> null) ||
(desc.TRCashNoParent <> null) ||
(desc.TRExtPaymentNoParent <> null) ||
(desc.SaleNoParent <> null) ||
(desc.FillingNoParent <> null)
if hasNotNullInUnused then DescDataExtra(result) else
DescValid(result)
|24 ->
let result = desc.Transact,TransactTypesVariant.TechGas
let hasNotNullInUnused = (desc.TRPaymentNoParent <> null) ||
(desc.TRCashNoParent <> null) ||
(desc.TRExtPaymentNoParent <> null) ||
(desc.SaleNoParent <> null) ||
(desc.FillingNoParent <> null)
if hasNotNullInUnused then DescDataExtra(result) else
DescValid(result)
|100 ->
let hasNullInUsed = (desc.TRCashNoParent = null)
if hasNullInUsed then DescDataLost(desc.Transact) else
let result = desc.Transact,TransactTypesVariant.CashDeposit(desc.TRCashNoParent)
let hasNotNullInUnused = (desc.TRPaymentNoParent <> null) ||
(desc.TRExtPaymentNoParent <> null) ||
(desc.SaleNoParent <> null) ||
(desc.FillingNoParent <> null)
if hasNotNullInUnused then DescDataExtra(result) else
DescValid(result)
|101 ->
let hasNullInUsed = (desc.TRCashNoParent = null)
if hasNullInUsed then DescDataLost(desc.Transact) else
let result = desc.Transact,TransactTypesVariant.CashWithdrawal(desc.TRCashNoParent)
let hasNotNullInUnused = (desc.TRPaymentNoParent <> null) ||
(desc.TRExtPaymentNoParent <> null) ||
(desc.SaleNoParent <> null) ||
(desc.FillingNoParent <> null)
if hasNotNullInUnused then DescDataExtra(result) else
DescValid(result)
|102 ->
let hasNullInUsed = (desc.TRCashNoParent = null)
if hasNullInUsed then DescDataLost(desc.Transact) else
let result = desc.Transact,TransactTypesVariant.CashCancellation(desc.TRCashNoParent)
let hasNotNullInUnused = (desc.TRPaymentNoParent <> null) ||
(desc.TRExtPaymentNoParent <> null) ||
(desc.SaleNoParent <> null) ||
(desc.FillingNoParent <> null)
if hasNotNullInUnused then DescDataExtra(result) else
DescValid(result)
|103 ->
let hasNullInUsed = (desc.TRCashNoParent = null)
if hasNullInUsed then DescDataLost(desc.Transact) else
let result = desc.Transact,TransactTypesVariant.CashBack(desc.TRCashNoParent)
let hasNotNullInUnused = (desc.TRPaymentNoParent <> null) ||
(desc.TRExtPaymentNoParent <> null) ||
(desc.SaleNoParent <> null) ||
(desc.FillingNoParent <> null)
if hasNotNullInUnused then DescDataExtra(result) else
DescValid(result)
|i -> failwithf "invalid enum value %d in %A" i desc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment