fix: 优化 gen_number_with_rule
This commit is contained in:
parent
7429b7d5fb
commit
ec42e70118
|
@ -695,9 +695,12 @@ class MlogbInViewSet(CreateModelMixin, UpdateModelMixin, DestroyModelMixin, Cust
|
||||||
c_month = now.month
|
c_month = now.month
|
||||||
m_model = material_out.model
|
m_model = material_out.model
|
||||||
wpr = Wpr.objects.filter(material_start=material_out, create_time__year=c_year, create_time__month=c_month).order_by("number").last()
|
wpr = Wpr.objects.filter(material_start=material_out, create_time__year=c_year, create_time__month=c_month).order_by("number").last()
|
||||||
|
cq_w = 4
|
||||||
|
if '02d' in rule:
|
||||||
|
cq_w = 2
|
||||||
if wpr:
|
if wpr:
|
||||||
try:
|
try:
|
||||||
n_count = int(wpr.number.split("-")[-1].lstrip('0'))
|
n_count = int(wpr.number[-cq_w:].lstrip('0'))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise ParseError(f"获取该类产品最后编号错误: {str(e)}")
|
raise ParseError(f"获取该类产品最后编号错误: {str(e)}")
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue