2026-02-28 15:29:16 +08:00
|
|
|
package svc
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"muyu-apiserver/model"
|
|
|
|
|
"muyu-apiserver/rpc/inventory/internal/config"
|
|
|
|
|
|
|
|
|
|
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type ServiceContext struct {
|
|
|
|
|
Config config.Config
|
|
|
|
|
ProductModel model.InvProductModel
|
2026-07-05 08:06:28 +09:00
|
|
|
YarnModel model.InvYarnModel
|
|
|
|
|
ProductBatchModel model.InvProductBatchModel
|
2026-06-14 15:24:02 +08:00
|
|
|
PanModel model.InvProductPanModel
|
|
|
|
|
BoltModel model.InvProductBoltModel
|
2026-07-05 08:06:28 +09:00
|
|
|
SupplierModel model.PurSupplierModel
|
2026-02-28 15:29:16 +08:00
|
|
|
ImportLogModel model.InvStockImportLogModel
|
|
|
|
|
StockCheckModel model.InvStockCheckModel
|
|
|
|
|
CheckDetailModel model.InvStockCheckDetailModel
|
|
|
|
|
StockAdjustModel model.InvStockAdjustModel
|
|
|
|
|
AdjustDetailModel model.InvStockAdjustDetailModel
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func NewServiceContext(c config.Config) *ServiceContext {
|
|
|
|
|
conn := sqlx.NewMysql(c.DataSource)
|
|
|
|
|
return &ServiceContext{
|
|
|
|
|
Config: c,
|
|
|
|
|
ProductModel: model.NewInvProductModel(conn, c.Cache),
|
2026-07-05 08:06:28 +09:00
|
|
|
YarnModel: model.NewInvYarnModel(conn),
|
|
|
|
|
ProductBatchModel: model.NewInvProductBatchModel(conn),
|
2026-06-14 15:24:02 +08:00
|
|
|
PanModel: model.NewInvProductPanModel(conn),
|
|
|
|
|
BoltModel: model.NewInvProductBoltModel(conn),
|
2026-07-05 08:06:28 +09:00
|
|
|
SupplierModel: model.NewPurSupplierModel(conn, c.Cache),
|
2026-02-28 15:29:16 +08:00
|
|
|
ImportLogModel: model.NewInvStockImportLogModel(conn, c.Cache),
|
|
|
|
|
StockCheckModel: model.NewInvStockCheckModel(conn, c.Cache),
|
|
|
|
|
CheckDetailModel: model.NewInvStockCheckDetailModel(conn, c.Cache),
|
|
|
|
|
StockAdjustModel: model.NewInvStockAdjustModel(conn, c.Cache),
|
|
|
|
|
AdjustDetailModel: model.NewInvStockAdjustDetailModel(conn, c.Cache),
|
|
|
|
|
}
|
|
|
|
|
}
|