You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
847 B
32 lines
847 B
3 months ago
|
# -*- coding: utf-8 -*-
|
||
|
"""
|
||
|
utils.BatchCode
|
||
|
~~~~~~~~~~~~~~
|
||
|
|
||
|
入库批次码生成,随机9位.
|
||
|
|
||
|
:copyright: 云南新八达科技有限公司.
|
||
|
:author: 李进才.
|
||
|
"""
|
||
|
from random import randint
|
||
|
from utils.apiDoc import *
|
||
|
|
||
|
|
||
|
def GetBatchCode():
|
||
|
range_start = 10 ** (9 - 1)
|
||
|
range_end = (10 ** 9) - 1
|
||
|
batchCode = randint(range_start, range_end)
|
||
|
while not ReagtStock.query.filter_by(Code=F'{batchCode}').first() is None:
|
||
|
batchCode = randint(range_start, range_end)
|
||
|
return batchCode
|
||
|
|
||
|
|
||
|
def GetGroupCode():
|
||
|
range_start = 10 ** (9 - 1)
|
||
|
range_end = (10 ** 9) - 1
|
||
|
batchCode = randint(range_start, range_end)
|
||
|
while not ReagtGroup.query.filter_by(GroupCode=F'{batchCode}').first() is None:
|
||
|
batchCode = randint(range_start, range_end)
|
||
|
return batchCode
|
||
|
|