1
0
forked from erp-dev/erp

feat: settlement lineup

This commit is contained in:
2026-03-09 22:40:02 +08:00
parent 86f5dab32b
commit 663276288e
24 changed files with 1730 additions and 33 deletions

View File

@@ -296,9 +296,10 @@ def on_printing_order_created(sender, **kwargs):
if outgoing_dt is not None
else "-"
)
order_id = str(getattr(order, "id", "-") or "-")
message = render_printing_order_created_markdown(
printing_order_id=str(getattr(order, "id", "-") or "-"),
printing_order_id=order_id,
printing_order_human_id=str(getattr(order, "human_id", "-") or "-"),
created_at=str(created_at),
sender_label=str(sender_label),
@@ -325,5 +326,15 @@ def on_printing_order_created(sender, **kwargs):
except Exception:
logger.exception("[printing.handlers] 发送 WeCom webhook 失败(已忽略,不影响主流程)")
# Just for testing
# ==============================================================
try:
from flower.utils import play_speech
play_speech(text=f"生产订单 {order_id} 已创建")
except Exception:
logger.exception("[printing.handlers] 发送语音播报失败(已忽略,不影响主流程)")
# ===================================
# 在事务提交后再发送,避免事务回滚但通知已发出
transaction.on_commit(_send_wecom)

View File

@@ -0,0 +1,21 @@
# Generated by Django 5.2.8 on 2026-03-05 06:25
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('basic_info', '0025_customer_uniq_customer_merchant_name'),
('printing', '0032_alter_printingorder_outgoing_date'),
('stateflow', '0023_remove_statelogparameterrecord_stfl_paramrec_params_gin'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.AddIndex(
model_name='plateorder',
index=models.Index(fields=['merchant', 'plate_date'], name='idx_plateord_merch_pltdt'),
),
]

View File

@@ -182,6 +182,12 @@ class PlateOrder(ModelBase):
verbose_name = '开版订单'
verbose_name_plural = '开版订单'
ordering = ['-created_at']
indexes = [
models.Index(
fields=['merchant', 'plate_date'],
name='idx_plateord_merch_pltdt',
),
]
permissions = [
('can_invalidate_plateorder', '可以作废开版订单'),
('can_activate_plateorder', '可以恢复开版订单'),