Add more than on product to a Route

This commit is contained in:
Oliver Jakoubek 2020-06-28 20:18:41 +02:00
parent dc9728eb06
commit d0f726621f
2 changed files with 14 additions and 6 deletions

View file

@ -16,7 +16,7 @@ type Route struct {
eaAddressDefinition int eaAddressDefinition int
topsheetTemplateDirectory int topsheetTemplateDirectory int
editionName string editionName string
productReferenceNumber int productReferenceNumbers []int
ProductionDrops []*ProductionDrop ProductionDrops []*ProductionDrop
} }
@ -58,6 +58,10 @@ func (r *Route) GetRouteMessage() string {
return info return info
} }
func (r *Route) AddProductReferenceNumber(prnr int) {
r.productReferenceNumbers = append(r.productReferenceNumbers, prnr)
}
func (r *Route) AddProductionDrop(pd *ProductionDrop) error { func (r *Route) AddProductionDrop(pd *ProductionDrop) error {
r.ProductionDrops = append(r.ProductionDrops, pd) r.ProductionDrops = append(r.ProductionDrops, pd)
return nil return nil

View file

@ -16,7 +16,7 @@ type RouteInfo struct {
eaAddressDefinition int eaAddressDefinition int
topsheetTemplateDirectory int topsheetTemplateDirectory int
editionName string editionName string
productReferenceNumber int productReferenceNumbers []int
} }
func (ri *RouteInfo) ParameterSz() string { func (ri *RouteInfo) ParameterSz() string {
@ -27,12 +27,16 @@ func (ri *RouteInfo) SetParameterSz(parameterSz int) {
ri.parameterSz = parameterSz ri.parameterSz = parameterSz
} }
func (ri *RouteInfo) ProductReferenceNumber() string { func (ri *RouteInfo) ProductReferenceNumbers() string {
return fmt.Sprintf("+41%02d", ri.productReferenceNumber) var prreffmt string
for _, pr := range ri.productReferenceNumbers {
prreffmt += fmt.Sprintf("+41%02d", pr)
}
return prreffmt
} }
func (ri *RouteInfo) SetProductReferenceNumber(productReferenceNumber int) { func (ri *RouteInfo) AddProductReferenceNumber(productReferenceNumber int) {
ri.productReferenceNumber = productReferenceNumber ri.productReferenceNumbers = append(ri.productReferenceNumbers, productReferenceNumber)
} }
func (ri *RouteInfo) TopsheetTemplateDirectory() string { func (ri *RouteInfo) TopsheetTemplateDirectory() string {