Subversion Repositories SmartDukaan

Rev

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

Rev 2821 Rev 2832
Line 33... Line 33...
33
    Parameters:
33
    Parameters:
34
     - id
34
     - id
35
    """
35
    """
36
    pass
36
    pass
37
 
37
 
-
 
38
  def getSupplier(self, id):
-
 
39
    """
-
 
40
    Returns the supplier with the given order id. Throws an exception if there is no such supplier.
-
 
41
    
-
 
42
    Parameters:
-
 
43
     - id
-
 
44
    """
-
 
45
    pass
-
 
46
 
38
  def startPurchase(self, purchaseOrderId, invoiceNumber, freightCharges):
47
  def startPurchase(self, purchaseOrderId, invoiceNumber, freightCharges):
39
    """
48
    """
40
    Creates a purchase for the given purchase order.
49
    Creates a purchase for the given purchase order.
41
    Throws an exception if no more purchases are allowed against the given purchase order.
50
    Throws an exception if no more purchases are allowed against the given purchase order.
42
    
51
    
Line 162... Line 171...
162
      return result.success
171
      return result.success
163
    if result.wex != None:
172
    if result.wex != None:
164
      raise result.wex
173
      raise result.wex
165
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getPurchaseOrder failed: unknown result");
174
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getPurchaseOrder failed: unknown result");
166
 
175
 
-
 
176
  def getSupplier(self, id):
-
 
177
    """
-
 
178
    Returns the supplier with the given order id. Throws an exception if there is no such supplier.
-
 
179
    
-
 
180
    Parameters:
-
 
181
     - id
-
 
182
    """
-
 
183
    self.send_getSupplier(id)
-
 
184
    return self.recv_getSupplier()
-
 
185
 
-
 
186
  def send_getSupplier(self, id):
-
 
187
    self._oprot.writeMessageBegin('getSupplier', TMessageType.CALL, self._seqid)
-
 
188
    args = getSupplier_args()
-
 
189
    args.id = id
-
 
190
    args.write(self._oprot)
-
 
191
    self._oprot.writeMessageEnd()
-
 
192
    self._oprot.trans.flush()
-
 
193
 
-
 
194
  def recv_getSupplier(self, ):
-
 
195
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
-
 
196
    if mtype == TMessageType.EXCEPTION:
-
 
197
      x = TApplicationException()
-
 
198
      x.read(self._iprot)
-
 
199
      self._iprot.readMessageEnd()
-
 
200
      raise x
-
 
201
    result = getSupplier_result()
-
 
202
    result.read(self._iprot)
-
 
203
    self._iprot.readMessageEnd()
-
 
204
    if result.success != None:
-
 
205
      return result.success
-
 
206
    if result.wex != None:
-
 
207
      raise result.wex
-
 
208
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getSupplier failed: unknown result");
-
 
209
 
167
  def startPurchase(self, purchaseOrderId, invoiceNumber, freightCharges):
210
  def startPurchase(self, purchaseOrderId, invoiceNumber, freightCharges):
168
    """
211
    """
169
    Creates a purchase for the given purchase order.
212
    Creates a purchase for the given purchase order.
170
    Throws an exception if no more purchases are allowed against the given purchase order.
213
    Throws an exception if no more purchases are allowed against the given purchase order.
171
    
214
    
Line 325... Line 368...
325
  def __init__(self, handler):
368
  def __init__(self, handler):
326
    self._handler = handler
369
    self._handler = handler
327
    self._processMap = {}
370
    self._processMap = {}
328
    self._processMap["createPurchaseOrder"] = Processor.process_createPurchaseOrder
371
    self._processMap["createPurchaseOrder"] = Processor.process_createPurchaseOrder
329
    self._processMap["getPurchaseOrder"] = Processor.process_getPurchaseOrder
372
    self._processMap["getPurchaseOrder"] = Processor.process_getPurchaseOrder
-
 
373
    self._processMap["getSupplier"] = Processor.process_getSupplier
330
    self._processMap["startPurchase"] = Processor.process_startPurchase
374
    self._processMap["startPurchase"] = Processor.process_startPurchase
331
    self._processMap["closePurchase"] = Processor.process_closePurchase
375
    self._processMap["closePurchase"] = Processor.process_closePurchase
332
    self._processMap["scanIn"] = Processor.process_scanIn
376
    self._processMap["scanIn"] = Processor.process_scanIn
333
    self._processMap["scanOut"] = Processor.process_scanOut
377
    self._processMap["scanOut"] = Processor.process_scanOut
334
 
378
 
Line 373... Line 417...
373
    oprot.writeMessageBegin("getPurchaseOrder", TMessageType.REPLY, seqid)
417
    oprot.writeMessageBegin("getPurchaseOrder", TMessageType.REPLY, seqid)
374
    result.write(oprot)
418
    result.write(oprot)
375
    oprot.writeMessageEnd()
419
    oprot.writeMessageEnd()
376
    oprot.trans.flush()
420
    oprot.trans.flush()
377
 
421
 
-
 
422
  def process_getSupplier(self, seqid, iprot, oprot):
-
 
423
    args = getSupplier_args()
-
 
424
    args.read(iprot)
-
 
425
    iprot.readMessageEnd()
-
 
426
    result = getSupplier_result()
-
 
427
    try:
-
 
428
      result.success = self._handler.getSupplier(args.id)
-
 
429
    except WarehouseServiceException, wex:
-
 
430
      result.wex = wex
-
 
431
    oprot.writeMessageBegin("getSupplier", TMessageType.REPLY, seqid)
-
 
432
    result.write(oprot)
-
 
433
    oprot.writeMessageEnd()
-
 
434
    oprot.trans.flush()
-
 
435
 
378
  def process_startPurchase(self, seqid, iprot, oprot):
436
  def process_startPurchase(self, seqid, iprot, oprot):
379
    args = startPurchase_args()
437
    args = startPurchase_args()
380
    args.read(iprot)
438
    args.read(iprot)
381
    iprot.readMessageEnd()
439
    iprot.readMessageEnd()
382
    result = startPurchase_result()
440
    result = startPurchase_result()
Line 665... Line 723...
665
    if self.success != None:
723
    if self.success != None:
666
      oprot.writeFieldBegin('success', TType.STRUCT, 0)
724
      oprot.writeFieldBegin('success', TType.STRUCT, 0)
667
      self.success.write(oprot)
725
      self.success.write(oprot)
668
      oprot.writeFieldEnd()
726
      oprot.writeFieldEnd()
669
    if self.wex != None:
727
    if self.wex != None:
-
 
728
      oprot.writeFieldBegin('wex', TType.STRUCT, 1)
-
 
729
      self.wex.write(oprot)
-
 
730
      oprot.writeFieldEnd()
-
 
731
    oprot.writeFieldStop()
-
 
732
    oprot.writeStructEnd()
-
 
733
 
-
 
734
  def __repr__(self):
-
 
735
    L = ['%s=%r' % (key, value)
-
 
736
      for key, value in self.__dict__.iteritems()]
-
 
737
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
738
 
-
 
739
  def __eq__(self, other):
-
 
740
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
741
 
-
 
742
  def __ne__(self, other):
-
 
743
    return not (self == other)
-
 
744
 
-
 
745
class getSupplier_args:
-
 
746
  """
-
 
747
  Attributes:
-
 
748
   - id
-
 
749
  """
-
 
750
 
-
 
751
  thrift_spec = (
-
 
752
    None, # 0
-
 
753
    (1, TType.I64, 'id', None, None, ), # 1
-
 
754
  )
-
 
755
 
-
 
756
  def __init__(self, id=None,):
-
 
757
    self.id = id
-
 
758
 
-
 
759
  def read(self, iprot):
-
 
760
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
761
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
762
      return
-
 
763
    iprot.readStructBegin()
-
 
764
    while True:
-
 
765
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
766
      if ftype == TType.STOP:
-
 
767
        break
-
 
768
      if fid == 1:
-
 
769
        if ftype == TType.I64:
-
 
770
          self.id = iprot.readI64();
-
 
771
        else:
-
 
772
          iprot.skip(ftype)
-
 
773
      else:
-
 
774
        iprot.skip(ftype)
-
 
775
      iprot.readFieldEnd()
-
 
776
    iprot.readStructEnd()
-
 
777
 
-
 
778
  def write(self, oprot):
-
 
779
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
780
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
781
      return
-
 
782
    oprot.writeStructBegin('getSupplier_args')
-
 
783
    if self.id != None:
-
 
784
      oprot.writeFieldBegin('id', TType.I64, 1)
-
 
785
      oprot.writeI64(self.id)
-
 
786
      oprot.writeFieldEnd()
-
 
787
    oprot.writeFieldStop()
-
 
788
    oprot.writeStructEnd()
-
 
789
 
-
 
790
  def __repr__(self):
-
 
791
    L = ['%s=%r' % (key, value)
-
 
792
      for key, value in self.__dict__.iteritems()]
-
 
793
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
794
 
-
 
795
  def __eq__(self, other):
-
 
796
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
797
 
-
 
798
  def __ne__(self, other):
-
 
799
    return not (self == other)
-
 
800
 
-
 
801
class getSupplier_result:
-
 
802
  """
-
 
803
  Attributes:
-
 
804
   - success
-
 
805
   - wex
-
 
806
  """
-
 
807
 
-
 
808
  thrift_spec = (
-
 
809
    (0, TType.STRUCT, 'success', (Supplier, Supplier.thrift_spec), None, ), # 0
-
 
810
    (1, TType.STRUCT, 'wex', (WarehouseServiceException, WarehouseServiceException.thrift_spec), None, ), # 1
-
 
811
  )
-
 
812
 
-
 
813
  def __init__(self, success=None, wex=None,):
-
 
814
    self.success = success
-
 
815
    self.wex = wex
-
 
816
 
-
 
817
  def read(self, iprot):
-
 
818
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
819
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
820
      return
-
 
821
    iprot.readStructBegin()
-
 
822
    while True:
-
 
823
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
824
      if ftype == TType.STOP:
-
 
825
        break
-
 
826
      if fid == 0:
-
 
827
        if ftype == TType.STRUCT:
-
 
828
          self.success = Supplier()
-
 
829
          self.success.read(iprot)
-
 
830
        else:
-
 
831
          iprot.skip(ftype)
-
 
832
      elif fid == 1:
-
 
833
        if ftype == TType.STRUCT:
-
 
834
          self.wex = WarehouseServiceException()
-
 
835
          self.wex.read(iprot)
-
 
836
        else:
-
 
837
          iprot.skip(ftype)
-
 
838
      else:
-
 
839
        iprot.skip(ftype)
-
 
840
      iprot.readFieldEnd()
-
 
841
    iprot.readStructEnd()
-
 
842
 
-
 
843
  def write(self, oprot):
-
 
844
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
845
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
846
      return
-
 
847
    oprot.writeStructBegin('getSupplier_result')
-
 
848
    if self.success != None:
-
 
849
      oprot.writeFieldBegin('success', TType.STRUCT, 0)
-
 
850
      self.success.write(oprot)
-
 
851
      oprot.writeFieldEnd()
-
 
852
    if self.wex != None:
670
      oprot.writeFieldBegin('wex', TType.STRUCT, 1)
853
      oprot.writeFieldBegin('wex', TType.STRUCT, 1)
671
      self.wex.write(oprot)
854
      self.wex.write(oprot)
672
      oprot.writeFieldEnd()
855
      oprot.writeFieldEnd()
673
    oprot.writeFieldStop()
856
    oprot.writeFieldStop()
674
    oprot.writeStructEnd()
857
    oprot.writeStructEnd()