Align origin/main with upstream/main (GitHub). The two branches diverged due to pre-rebase vs post-rebase merge commits for the k8s-amd64-dockerfiles feature. Includes: multi-stage Go compilation Dockerfiles, pan-bolt inventory features, CRM relations, Excel import tooling, proto/gRPC updates, migration scripts, and tools/ directory. Excludes deploy/bin/ pre-compiled binaries (arm64, not needed for amd64 K3s cluster; builds use multi-stage Dockerfiles now).
35 lines
870 B
Go
35 lines
870 B
Go
package excelparse
|
|
|
|
import "errors"
|
|
|
|
var (
|
|
ErrUnknownFormat = errors.New("unrecognized excel format; supported: 秒账, 领星")
|
|
ErrEmptyFile = errors.New("excel file has no data rows")
|
|
ErrUnsupportedExt = errors.New("unsupported file extension; use .xls or .xlsx")
|
|
)
|
|
|
|
type ParsedProduct struct {
|
|
ProductName string
|
|
Spec string
|
|
Color string
|
|
UnitRolls int64
|
|
StockQuantity string
|
|
CostPrice string
|
|
SalesPrice string
|
|
Remark string
|
|
}
|
|
|
|
type ParseResult struct {
|
|
Products []ParsedProduct
|
|
ParserName string
|
|
SkippedRows int
|
|
}
|
|
|
|
// FormatParser transforms raw spreadsheet rows into structured products.
|
|
// Each competitor format (秒账, 领星, etc.) implements this interface.
|
|
type FormatParser interface {
|
|
Name() string
|
|
Match(headers []string) bool
|
|
ParseRows(headers []string, rows [][]string) (*ParseResult, error)
|
|
}
|