fix: 优化 gen_number_with_rule

This commit is contained in:
caoqianming 2025-05-30 11:11:06 +08:00
parent 7429b7d5fb
commit ec42e70118
1 changed files with 4 additions and 1 deletions

View File

@ -695,9 +695,12 @@ class MlogbInViewSet(CreateModelMixin, UpdateModelMixin, DestroyModelMixin, Cust
c_month = now.month
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()
cq_w = 4
if '02d' in rule:
cq_w = 2
if wpr:
try:
n_count = int(wpr.number.split("-")[-1].lstrip('0'))
n_count = int(wpr.number[-cq_w:].lstrip('0'))
except Exception as e:
raise ParseError(f"获取该类产品最后编号错误: {str(e)}")
try: