feat: 档口入库码后台批量回写 (#246)

This commit is contained in:
chengma
2026-08-15 17:08:17 +08:00
parent 6b30594f4c
commit f8f22a15c7
21 changed files with 708 additions and 134 deletions
+7 -8
View File
@@ -19,6 +19,7 @@ var innerCodeStatusOptions = []InnerCodeStatusOption{
{"", "全部状态"},
{string(model.InnerCodePending), "待匹配"},
{string(model.InnerCodeReady), "可回写"},
{string(model.InnerCodeQueued), "排队中"},
{string(model.InnerCodeApplying), "回写中"},
{string(model.InnerCodeUpdated), "已回写"},
{string(model.InnerCodeAlreadyFilled), "已存在"},
@@ -27,12 +28,8 @@ var innerCodeStatusOptions = []InnerCodeStatusOption{
{string(model.InnerCodeNeedsCheck), "需核对"},
}
// 删除只改本地数据库,可覆盖最大单页;回写会修改顺运宝,继续限制 20 条。
// 只读匹配不使用这个写操作上限,见 inner_code_match.go 的远端读取分批。
const (
InnerCodeDeleteBatchLimit = 100
InnerCodeApplyBatchLimit = 20
)
// 删除只改本地数据库,可覆盖最大单页。回写已改为后台队列,不再限制选择 20 条。
const InnerCodeDeleteBatchLimit = 100
// InnerCodeRowView 是正式页面的一行。
type InnerCodeRowView struct {
@@ -123,6 +120,7 @@ func validInnerCodeStatusFilter(status string) bool {
func innerCodeRowView(record model.InnerCodeRecord) InnerCodeRowView {
statusText := map[model.InnerCodeStatus]string{
model.InnerCodePending: "待匹配", model.InnerCodeReady: "可回写",
model.InnerCodeQueued: "排队中",
model.InnerCodeApplying: "回写中", model.InnerCodeUpdated: "已回写",
model.InnerCodeAlreadyFilled: "已存在", model.InnerCodeSkipped: "已跳过",
model.InnerCodeFailed: "失败", model.InnerCodeNeedsCheck: "需核对",
@@ -158,6 +156,7 @@ func displayInnerCodeValue(value string) string {
// InnerCodeStatusMessage 生成底栏可读统计。
func InnerCodeStatusMessage(page *InnerCodeListPage) string {
return fmt.Sprintf("共 %d 条,可回写 %d 条,需核对 %d 条;当前筛选 %d 条",
page.Counts.Total, page.Counts.Ready, page.Counts.NeedsCheck, page.Total)
return fmt.Sprintf("共 %d 条,可回写 %d 条,排队中 %d 条,回写中 %d 条,需核对 %d 条;当前筛选 %d 条",
page.Counts.Total, page.Counts.Ready, page.Counts.Queued, page.Counts.Applying,
page.Counts.NeedsCheck, page.Total)
}