feat: 4项需求实现

1. 供应商/客户编码自动生成(S001/C001...),新建表单隐藏编码字段,编辑保留
2. 财务管理"全部记录"移为第一个 tab
3. 入库单列表 tab 排除 pending 单据,提交后自动移入审核 tab
4. 出库单列表同上;出库表单按仓库+商品自动填最大可用库存数量

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-04-10 22:37:19 +08:00
parent 66e54af8c6
commit 53a60d230f
6 changed files with 72 additions and 29 deletions
+13
View File
@@ -1,6 +1,7 @@
package handler
import (
"fmt"
"net/http"
"strconv"
@@ -51,6 +52,18 @@ func (h *PartnerHandler) Create(c *gin.Context) {
return
}
p.ShopID = shopID
// 编码未提供时自动生成:供应商 S001/S002…,客户 C001/C002…
if p.Code == "" {
prefix := "S"
if p.Type == "customer" {
prefix = "C"
}
var count int64
h.db.Model(&model.Partner{}).
Where("shop_id = ? AND type = ? AND deleted_at IS NULL", shopID, p.Type).
Count(&count)
p.Code = fmt.Sprintf("%s%03d", prefix, count+1)
}
if err := h.db.Create(&p).Error; err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return