* feat: support product yarn batches * feat: improve product yarn ratio workflow * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
42 lines
1.1 KiB
Go
42 lines
1.1 KiB
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
|
|
ColorNo string
|
|
ProductCode string
|
|
UnitRolls int64
|
|
StockQuantity string
|
|
CostPrice string
|
|
SalesPrice string
|
|
BatchNo string
|
|
YarnRatio string
|
|
WarpWeightGM string
|
|
WeftWeightGM string
|
|
ProductionProcess 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)
|
|
}
|