fix(backend): 往来单位下拉返回全部 + 入库售价写入产品

- partner List 分页上限 200→1000:避免下拉请求大页被 ValidatePageSize
  回退到默认 20(超上限返回默认值而非截断),供应商/客户下拉一次取全部
- 入库明细 sale_price 建独立产品时写入 product.SalePrice(建议售价);
  SalePrice 为 gorm:"-" 仅作建库入参,不落 stock_in_items 表
- 补 partner 大页返回全部、入库售价入产品两条回归测试

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-07-02 11:44:50 +08:00
parent 1bd8b8f877
commit d0c71a9252
6 changed files with 70 additions and 4 deletions
+2 -1
View File
@@ -88,7 +88,7 @@ func nextProductCode(tx *gorm.DB, shopID uint64) (string, error) {
// createIndependentProduct 为入库明细新建一个独立产品(特有产品/序列号),返回新 product。
// "入库每行 = 一个特有产品"模型:每条明细建一个独立 product、发新序列号,不按名称复用。
// 含 nextProductCode 自增 + 撞 uk_shop_code 唯一约束时重试。必须在事务内调用。
func createIndependentProduct(tx *gorm.DB, shopID uint64, name, series, spec, batchNo string, prodDate *model.Date, price float64) (model.Product, error) {
func createIndependentProduct(tx *gorm.DB, shopID uint64, name, series, spec, batchNo string, prodDate *model.Date, price, salePrice float64) (model.Product, error) {
namePinyin, nameInitials := util.ToPinyin(name)
var prod model.Product
var err error
@@ -107,6 +107,7 @@ func createIndependentProduct(tx *gorm.DB, shopID uint64, name, series, spec, ba
BatchNo: batchNo,
ProductionDate: prodDate,
PurchasePrice: price,
SalePrice: salePrice,
NamePinyin: namePinyin,
NameInitials: nameInitials,
}