def GetNewSequence(self, fullName, defaultSequence, sequenceLength, fillZeroPrefix): """ 获取新序列号 Args: fullName (string): 序列名称 defaultSequence (int): 默认序列 sequenceLength (int): 序列长度 fillZeroPrefix (bool): 是否填充补零 Returns: returnValue (string): 序列号 """ sequenceEntity = Cisequence.objects.get_or_create( defaults={'fullname': fullName}, fullname=fullName, sequence=defaultSequence, reduction=SequenceService.DefaultReduction, step=SequenceService.DefaultStep, prefix=fillZeroPrefix, separate=SequenceService.DefaultSeparator) sequence = sequenceEntity.sequence if SequenceService.FillZeroPrefix: sequence = StringHelper.RepeatString( self, '0', len( sequenceEntity.sequence)) + sequenceEntity.sequence if SequenceService.UsePrefix: sequence = sequenceEntity.prefix + sequenceEntity.separate + sequence return sequence
def GetSequence(self, fullName): """ 获取序列号 Args: fullName (string): 序列名称 Returns: returnValue (string): 序列号 """ sequenceEntity = SequenceService.GetEntityByAdd(self, fullName) SequenceService.UpdateSequence(self, fullName, 1) sequence = sequenceEntity.sequence if SequenceService.FillZeroPrefix: sequence = StringHelper.RepeatString( self, '0', len(str(sequenceEntity.sequence))) + str( sequenceEntity.sequence) if SequenceService.UsePrefix: sequence = sequenceEntity.prefix + sequenceEntity.separate + sequence return sequence
def GetUserids(self, fullName, count): """ 获取序列号 Args: fullName (string): 序列名称 count (int): 个数 Returns: returnValue (string): 序列号 """ returnValue = [count] sequenceEntity = SequenceService.GetEntityByAdd(self, fullName) SequenceService.UpdateSequence(self, fullName, count) sequence = sequenceEntity.sequence if SequenceService.FillZeroPrefix: sequence = StringHelper.RepeatString( self, '0', len( sequenceEntity.sequence)) + sequenceEntity.sequence if SequenceService.UsePrefix: sequence = sequenceEntity.prefix + sequenceEntity.separate + sequence return sequence