Subversion Repositories SmartDukaan

Rev

Rev 442 | Rev 477 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 442 Rev 472
Line 14... Line 14...
14
except:
14
except:
15
  fastbinary = None
15
  fastbinary = None
16
 
16
 
17
 
17
 
18
class Iface:
18
class Iface:
-
 
19
  def getLogisticsEstimation(self, itemId, destination_pin, provider_id):
-
 
20
    """
-
 
21
    Parameters:
-
 
22
     - itemId
-
 
23
     - destination_pin
-
 
24
     - provider_id
-
 
25
    """
-
 
26
    pass
-
 
27
 
-
 
28
  def addDeliveryEstimate(self, warahouse_id, destination_pin, provider_id, delivery_time):
-
 
29
    """
-
 
30
    Parameters:
-
 
31
     - warahouse_id
-
 
32
     - destination_pin
-
 
33
     - provider_id
-
 
34
     - delivery_time
-
 
35
    """
-
 
36
    pass
-
 
37
 
19
  def addEmptyAWBs(self, numbers, provider_id):
38
  def addEmptyAWBs(self, numbers, provider_id):
20
    """
39
    """
21
    Parameters:
40
    Parameters:
22
     - numbers
41
     - numbers
23
     - provider_id
42
     - provider_id
Line 87... Line 106...
87
    self._iprot = self._oprot = iprot
106
    self._iprot = self._oprot = iprot
88
    if oprot != None:
107
    if oprot != None:
89
      self._oprot = oprot
108
      self._oprot = oprot
90
    self._seqid = 0
109
    self._seqid = 0
91
 
110
 
-
 
111
  def getLogisticsEstimation(self, itemId, destination_pin, provider_id):
-
 
112
    """
-
 
113
    Parameters:
-
 
114
     - itemId
-
 
115
     - destination_pin
-
 
116
     - provider_id
-
 
117
    """
-
 
118
    self.send_getLogisticsEstimation(itemId, destination_pin, provider_id)
-
 
119
    return self.recv_getLogisticsEstimation()
-
 
120
 
-
 
121
  def send_getLogisticsEstimation(self, itemId, destination_pin, provider_id):
-
 
122
    self._oprot.writeMessageBegin('getLogisticsEstimation', TMessageType.CALL, self._seqid)
-
 
123
    args = getLogisticsEstimation_args()
-
 
124
    args.itemId = itemId
-
 
125
    args.destination_pin = destination_pin
-
 
126
    args.provider_id = provider_id
-
 
127
    args.write(self._oprot)
-
 
128
    self._oprot.writeMessageEnd()
-
 
129
    self._oprot.trans.flush()
-
 
130
 
-
 
131
  def recv_getLogisticsEstimation(self, ):
-
 
132
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
-
 
133
    if mtype == TMessageType.EXCEPTION:
-
 
134
      x = TApplicationException()
-
 
135
      x.read(self._iprot)
-
 
136
      self._iprot.readMessageEnd()
-
 
137
      raise x
-
 
138
    result = getLogisticsEstimation_result()
-
 
139
    result.read(self._iprot)
-
 
140
    self._iprot.readMessageEnd()
-
 
141
    if result.success != None:
-
 
142
      return result.success
-
 
143
    if result.se != None:
-
 
144
      raise result.se
-
 
145
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getLogisticsEstimation failed: unknown result");
-
 
146
 
-
 
147
  def addDeliveryEstimate(self, warahouse_id, destination_pin, provider_id, delivery_time):
-
 
148
    """
-
 
149
    Parameters:
-
 
150
     - warahouse_id
-
 
151
     - destination_pin
-
 
152
     - provider_id
-
 
153
     - delivery_time
-
 
154
    """
-
 
155
    self.send_addDeliveryEstimate(warahouse_id, destination_pin, provider_id, delivery_time)
-
 
156
    self.recv_addDeliveryEstimate()
-
 
157
 
-
 
158
  def send_addDeliveryEstimate(self, warahouse_id, destination_pin, provider_id, delivery_time):
-
 
159
    self._oprot.writeMessageBegin('addDeliveryEstimate', TMessageType.CALL, self._seqid)
-
 
160
    args = addDeliveryEstimate_args()
-
 
161
    args.warahouse_id = warahouse_id
-
 
162
    args.destination_pin = destination_pin
-
 
163
    args.provider_id = provider_id
-
 
164
    args.delivery_time = delivery_time
-
 
165
    args.write(self._oprot)
-
 
166
    self._oprot.writeMessageEnd()
-
 
167
    self._oprot.trans.flush()
-
 
168
 
-
 
169
  def recv_addDeliveryEstimate(self, ):
-
 
170
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
-
 
171
    if mtype == TMessageType.EXCEPTION:
-
 
172
      x = TApplicationException()
-
 
173
      x.read(self._iprot)
-
 
174
      self._iprot.readMessageEnd()
-
 
175
      raise x
-
 
176
    result = addDeliveryEstimate_result()
-
 
177
    result.read(self._iprot)
-
 
178
    self._iprot.readMessageEnd()
-
 
179
    return
-
 
180
 
92
  def addEmptyAWBs(self, numbers, provider_id):
181
  def addEmptyAWBs(self, numbers, provider_id):
93
    """
182
    """
94
    Parameters:
183
    Parameters:
95
     - numbers
184
     - numbers
96
     - provider_id
185
     - provider_id
Line 363... Line 452...
363
 
452
 
364
class Processor(Iface, TProcessor):
453
class Processor(Iface, TProcessor):
365
  def __init__(self, handler):
454
  def __init__(self, handler):
366
    self._handler = handler
455
    self._handler = handler
367
    self._processMap = {}
456
    self._processMap = {}
-
 
457
    self._processMap["getLogisticsEstimation"] = Processor.process_getLogisticsEstimation
-
 
458
    self._processMap["addDeliveryEstimate"] = Processor.process_addDeliveryEstimate
368
    self._processMap["addEmptyAWBs"] = Processor.process_addEmptyAWBs
459
    self._processMap["addEmptyAWBs"] = Processor.process_addEmptyAWBs
369
    self._processMap["getEmptyAWB"] = Processor.process_getEmptyAWB
460
    self._processMap["getEmptyAWB"] = Processor.process_getEmptyAWB
370
    self._processMap["getProviders"] = Processor.process_getProviders
461
    self._processMap["getProviders"] = Processor.process_getProviders
371
    self._processMap["getProvider"] = Processor.process_getProvider
462
    self._processMap["getProvider"] = Processor.process_getProvider
372
    self._processMap["createShipment"] = Processor.process_createShipment
463
    self._processMap["createShipment"] = Processor.process_createShipment
Line 388... Line 479...
388
      return
479
      return
389
    else:
480
    else:
390
      self._processMap[name](self, seqid, iprot, oprot)
481
      self._processMap[name](self, seqid, iprot, oprot)
391
    return True
482
    return True
392
 
483
 
-
 
484
  def process_getLogisticsEstimation(self, seqid, iprot, oprot):
-
 
485
    args = getLogisticsEstimation_args()
-
 
486
    args.read(iprot)
-
 
487
    iprot.readMessageEnd()
-
 
488
    result = getLogisticsEstimation_result()
-
 
489
    try:
-
 
490
      result.success = self._handler.getLogisticsEstimation(args.itemId, args.destination_pin, args.provider_id)
-
 
491
    except LogisticsServiceException, se:
-
 
492
      result.se = se
-
 
493
    oprot.writeMessageBegin("getLogisticsEstimation", TMessageType.REPLY, seqid)
-
 
494
    result.write(oprot)
-
 
495
    oprot.writeMessageEnd()
-
 
496
    oprot.trans.flush()
-
 
497
 
-
 
498
  def process_addDeliveryEstimate(self, seqid, iprot, oprot):
-
 
499
    args = addDeliveryEstimate_args()
-
 
500
    args.read(iprot)
-
 
501
    iprot.readMessageEnd()
-
 
502
    result = addDeliveryEstimate_result()
-
 
503
    self._handler.addDeliveryEstimate(args.warahouse_id, args.destination_pin, args.provider_id, args.delivery_time)
-
 
504
    oprot.writeMessageBegin("addDeliveryEstimate", TMessageType.REPLY, seqid)
-
 
505
    result.write(oprot)
-
 
506
    oprot.writeMessageEnd()
-
 
507
    oprot.trans.flush()
-
 
508
 
393
  def process_addEmptyAWBs(self, seqid, iprot, oprot):
509
  def process_addEmptyAWBs(self, seqid, iprot, oprot):
394
    args = addEmptyAWBs_args()
510
    args = addEmptyAWBs_args()
395
    args.read(iprot)
511
    args.read(iprot)
396
    iprot.readMessageEnd()
512
    iprot.readMessageEnd()
397
    result = addEmptyAWBs_result()
513
    result = addEmptyAWBs_result()
Line 490... Line 606...
490
    oprot.trans.flush()
606
    oprot.trans.flush()
491
 
607
 
492
 
608
 
493
# HELPER FUNCTIONS AND STRUCTURES
609
# HELPER FUNCTIONS AND STRUCTURES
494
 
610
 
-
 
611
class getLogisticsEstimation_args:
-
 
612
  """
-
 
613
  Attributes:
-
 
614
   - itemId
-
 
615
   - destination_pin
-
 
616
   - provider_id
-
 
617
  """
-
 
618
 
-
 
619
  thrift_spec = (
-
 
620
    None, # 0
-
 
621
    (1, TType.I64, 'itemId', None, None, ), # 1
-
 
622
    (2, TType.STRING, 'destination_pin', None, None, ), # 2
-
 
623
    (3, TType.I64, 'provider_id', None, None, ), # 3
-
 
624
  )
-
 
625
 
-
 
626
  def __init__(self, itemId=None, destination_pin=None, provider_id=None,):
-
 
627
    self.itemId = itemId
-
 
628
    self.destination_pin = destination_pin
-
 
629
    self.provider_id = provider_id
-
 
630
 
-
 
631
  def read(self, iprot):
-
 
632
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
633
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
634
      return
-
 
635
    iprot.readStructBegin()
-
 
636
    while True:
-
 
637
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
638
      if ftype == TType.STOP:
-
 
639
        break
-
 
640
      if fid == 1:
-
 
641
        if ftype == TType.I64:
-
 
642
          self.itemId = iprot.readI64();
-
 
643
        else:
-
 
644
          iprot.skip(ftype)
-
 
645
      elif fid == 2:
-
 
646
        if ftype == TType.STRING:
-
 
647
          self.destination_pin = iprot.readString();
-
 
648
        else:
-
 
649
          iprot.skip(ftype)
-
 
650
      elif fid == 3:
-
 
651
        if ftype == TType.I64:
-
 
652
          self.provider_id = iprot.readI64();
-
 
653
        else:
-
 
654
          iprot.skip(ftype)
-
 
655
      else:
-
 
656
        iprot.skip(ftype)
-
 
657
      iprot.readFieldEnd()
-
 
658
    iprot.readStructEnd()
-
 
659
 
-
 
660
  def write(self, oprot):
-
 
661
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
662
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
663
      return
-
 
664
    oprot.writeStructBegin('getLogisticsEstimation_args')
-
 
665
    if self.itemId != None:
-
 
666
      oprot.writeFieldBegin('itemId', TType.I64, 1)
-
 
667
      oprot.writeI64(self.itemId)
-
 
668
      oprot.writeFieldEnd()
-
 
669
    if self.destination_pin != None:
-
 
670
      oprot.writeFieldBegin('destination_pin', TType.STRING, 2)
-
 
671
      oprot.writeString(self.destination_pin)
-
 
672
      oprot.writeFieldEnd()
-
 
673
    if self.provider_id != None:
-
 
674
      oprot.writeFieldBegin('provider_id', TType.I64, 3)
-
 
675
      oprot.writeI64(self.provider_id)
-
 
676
      oprot.writeFieldEnd()
-
 
677
    oprot.writeFieldStop()
-
 
678
    oprot.writeStructEnd()
-
 
679
 
-
 
680
  def __repr__(self):
-
 
681
    L = ['%s=%r' % (key, value)
-
 
682
      for key, value in self.__dict__.iteritems()]
-
 
683
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
684
 
-
 
685
  def __eq__(self, other):
-
 
686
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
687
 
-
 
688
  def __ne__(self, other):
-
 
689
    return not (self == other)
-
 
690
 
-
 
691
class getLogisticsEstimation_result:
-
 
692
  """
-
 
693
  Attributes:
-
 
694
   - success
-
 
695
   - se
-
 
696
  """
-
 
697
 
-
 
698
  thrift_spec = (
-
 
699
    (0, TType.STRUCT, 'success', (ItemLogistics, ItemLogistics.thrift_spec), None, ), # 0
-
 
700
    (1, TType.STRUCT, 'se', (LogisticsServiceException, LogisticsServiceException.thrift_spec), None, ), # 1
-
 
701
  )
-
 
702
 
-
 
703
  def __init__(self, success=None, se=None,):
-
 
704
    self.success = success
-
 
705
    self.se = se
-
 
706
 
-
 
707
  def read(self, iprot):
-
 
708
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
709
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
710
      return
-
 
711
    iprot.readStructBegin()
-
 
712
    while True:
-
 
713
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
714
      if ftype == TType.STOP:
-
 
715
        break
-
 
716
      if fid == 0:
-
 
717
        if ftype == TType.STRUCT:
-
 
718
          self.success = ItemLogistics()
-
 
719
          self.success.read(iprot)
-
 
720
        else:
-
 
721
          iprot.skip(ftype)
-
 
722
      elif fid == 1:
-
 
723
        if ftype == TType.STRUCT:
-
 
724
          self.se = LogisticsServiceException()
-
 
725
          self.se.read(iprot)
-
 
726
        else:
-
 
727
          iprot.skip(ftype)
-
 
728
      else:
-
 
729
        iprot.skip(ftype)
-
 
730
      iprot.readFieldEnd()
-
 
731
    iprot.readStructEnd()
-
 
732
 
-
 
733
  def write(self, oprot):
-
 
734
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
735
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
736
      return
-
 
737
    oprot.writeStructBegin('getLogisticsEstimation_result')
-
 
738
    if self.success != None:
-
 
739
      oprot.writeFieldBegin('success', TType.STRUCT, 0)
-
 
740
      self.success.write(oprot)
-
 
741
      oprot.writeFieldEnd()
-
 
742
    if self.se != None:
-
 
743
      oprot.writeFieldBegin('se', TType.STRUCT, 1)
-
 
744
      self.se.write(oprot)
-
 
745
      oprot.writeFieldEnd()
-
 
746
    oprot.writeFieldStop()
-
 
747
    oprot.writeStructEnd()
-
 
748
 
-
 
749
  def __repr__(self):
-
 
750
    L = ['%s=%r' % (key, value)
-
 
751
      for key, value in self.__dict__.iteritems()]
-
 
752
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
753
 
-
 
754
  def __eq__(self, other):
-
 
755
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
756
 
-
 
757
  def __ne__(self, other):
-
 
758
    return not (self == other)
-
 
759
 
-
 
760
class addDeliveryEstimate_args:
-
 
761
  """
-
 
762
  Attributes:
-
 
763
   - warahouse_id
-
 
764
   - destination_pin
-
 
765
   - provider_id
-
 
766
   - delivery_time
-
 
767
  """
-
 
768
 
-
 
769
  thrift_spec = (
-
 
770
    None, # 0
-
 
771
    (1, TType.I64, 'warahouse_id', None, None, ), # 1
-
 
772
    (2, TType.STRING, 'destination_pin', None, None, ), # 2
-
 
773
    (3, TType.I64, 'provider_id', None, None, ), # 3
-
 
774
    (4, TType.I64, 'delivery_time', None, None, ), # 4
-
 
775
  )
-
 
776
 
-
 
777
  def __init__(self, warahouse_id=None, destination_pin=None, provider_id=None, delivery_time=None,):
-
 
778
    self.warahouse_id = warahouse_id
-
 
779
    self.destination_pin = destination_pin
-
 
780
    self.provider_id = provider_id
-
 
781
    self.delivery_time = delivery_time
-
 
782
 
-
 
783
  def read(self, iprot):
-
 
784
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
785
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
786
      return
-
 
787
    iprot.readStructBegin()
-
 
788
    while True:
-
 
789
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
790
      if ftype == TType.STOP:
-
 
791
        break
-
 
792
      if fid == 1:
-
 
793
        if ftype == TType.I64:
-
 
794
          self.warahouse_id = iprot.readI64();
-
 
795
        else:
-
 
796
          iprot.skip(ftype)
-
 
797
      elif fid == 2:
-
 
798
        if ftype == TType.STRING:
-
 
799
          self.destination_pin = iprot.readString();
-
 
800
        else:
-
 
801
          iprot.skip(ftype)
-
 
802
      elif fid == 3:
-
 
803
        if ftype == TType.I64:
-
 
804
          self.provider_id = iprot.readI64();
-
 
805
        else:
-
 
806
          iprot.skip(ftype)
-
 
807
      elif fid == 4:
-
 
808
        if ftype == TType.I64:
-
 
809
          self.delivery_time = iprot.readI64();
-
 
810
        else:
-
 
811
          iprot.skip(ftype)
-
 
812
      else:
-
 
813
        iprot.skip(ftype)
-
 
814
      iprot.readFieldEnd()
-
 
815
    iprot.readStructEnd()
-
 
816
 
-
 
817
  def write(self, oprot):
-
 
818
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
819
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
820
      return
-
 
821
    oprot.writeStructBegin('addDeliveryEstimate_args')
-
 
822
    if self.warahouse_id != None:
-
 
823
      oprot.writeFieldBegin('warahouse_id', TType.I64, 1)
-
 
824
      oprot.writeI64(self.warahouse_id)
-
 
825
      oprot.writeFieldEnd()
-
 
826
    if self.destination_pin != None:
-
 
827
      oprot.writeFieldBegin('destination_pin', TType.STRING, 2)
-
 
828
      oprot.writeString(self.destination_pin)
-
 
829
      oprot.writeFieldEnd()
-
 
830
    if self.provider_id != None:
-
 
831
      oprot.writeFieldBegin('provider_id', TType.I64, 3)
-
 
832
      oprot.writeI64(self.provider_id)
-
 
833
      oprot.writeFieldEnd()
-
 
834
    if self.delivery_time != None:
-
 
835
      oprot.writeFieldBegin('delivery_time', TType.I64, 4)
-
 
836
      oprot.writeI64(self.delivery_time)
-
 
837
      oprot.writeFieldEnd()
-
 
838
    oprot.writeFieldStop()
-
 
839
    oprot.writeStructEnd()
-
 
840
 
-
 
841
  def __repr__(self):
-
 
842
    L = ['%s=%r' % (key, value)
-
 
843
      for key, value in self.__dict__.iteritems()]
-
 
844
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
845
 
-
 
846
  def __eq__(self, other):
-
 
847
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
848
 
-
 
849
  def __ne__(self, other):
-
 
850
    return not (self == other)
-
 
851
 
-
 
852
class addDeliveryEstimate_result:
-
 
853
 
-
 
854
  thrift_spec = (
-
 
855
  )
-
 
856
 
-
 
857
  def read(self, iprot):
-
 
858
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
859
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
860
      return
-
 
861
    iprot.readStructBegin()
-
 
862
    while True:
-
 
863
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
864
      if ftype == TType.STOP:
-
 
865
        break
-
 
866
      else:
-
 
867
        iprot.skip(ftype)
-
 
868
      iprot.readFieldEnd()
-
 
869
    iprot.readStructEnd()
-
 
870
 
-
 
871
  def write(self, oprot):
-
 
872
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
873
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
874
      return
-
 
875
    oprot.writeStructBegin('addDeliveryEstimate_result')
-
 
876
    oprot.writeFieldStop()
-
 
877
    oprot.writeStructEnd()
-
 
878
 
-
 
879
  def __repr__(self):
-
 
880
    L = ['%s=%r' % (key, value)
-
 
881
      for key, value in self.__dict__.iteritems()]
-
 
882
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
883
 
-
 
884
  def __eq__(self, other):
-
 
885
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
886
 
-
 
887
  def __ne__(self, other):
-
 
888
    return not (self == other)
-
 
889
 
495
class addEmptyAWBs_args:
890
class addEmptyAWBs_args:
496
  """
891
  """
497
  Attributes:
892
  Attributes:
498
   - numbers
893
   - numbers
499
   - provider_id
894
   - provider_id