From 204fe8562e2cfc668aa41bd17a70cb377b944c4d Mon Sep 17 00:00:00 2001 From: albert Date: Sun, 6 Oct 2024 04:55:38 +0200 Subject: [PATCH] wip --- go.mod | 6 +- go.sum | 11 ++- storage/storage.go | 33 ++++++- templates/hbcp.html | 18 ++-- types/barcode.go | 25 ++++++ types/beam_cut_pattern.go | 24 ++++++ types/beam_group.go | 32 +++++++ types/bundle.go | 164 +++++++++++++++++++++++++++++++++++ types/customer_order.go | 87 +++++++++++++++++++ types/layer_cut_pattern.go | 170 +++++++++++++++++++++++++++++++++++++ types/production_order.go | 78 +++++++++++++++++ 11 files changed, 637 insertions(+), 11 deletions(-) create mode 100644 types/barcode.go create mode 100644 types/beam_cut_pattern.go create mode 100644 types/beam_group.go create mode 100644 types/bundle.go create mode 100644 types/customer_order.go create mode 100644 types/layer_cut_pattern.go create mode 100644 types/production_order.go diff --git a/go.mod b/go.mod index 50c1f48..97f666f 100644 --- a/go.mod +++ b/go.mod @@ -5,11 +5,15 @@ go 1.23.1 require ( git.espin.casa/albert/logger v1.0.0 github.com/julienschmidt/httprouter v1.3.0 + gorm.io/gorm v1.25.12 ) require ( + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/jinzhu/now v1.1.5 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/stretchr/testify v1.7.1 // indirect - golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/text v0.14.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 85f1681..ecb8948 100644 --- a/go.sum +++ b/go.sum @@ -3,6 +3,10 @@ git.espin.casa/albert/logger v1.0.0/go.mod h1:TXbZ7mayDtJvcs+DucVbs2klio9jq5k1eW github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= +github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -13,9 +17,14 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gorm.io/gorm v1.25.12 h1:I0u8i2hWQItBq1WfE0o2+WuL9+8L21K9e2HHSTE/0f8= +gorm.io/gorm v1.25.12/go.mod h1:xh7N7RHfYlNc5EmcI/El95gXusucDrQnHXe0+CgWcLQ= diff --git a/storage/storage.go b/storage/storage.go index c2cde4f..cbebb50 100644 --- a/storage/storage.go +++ b/storage/storage.go @@ -1,9 +1,40 @@ package storage -type Storager interface{} +import ( + "context" + + "git.espin.casa/albert/cml04-falcon-ui/types" +) + +type Storager interface { + Barcode(ctx context.Context, reading string) (barcode *types.Barcode, err error) + ListBarcode(ctx context.Context, lb types.LoadingBed, inicio, final string) (barcodes []types.Barcode, err error) + Bundle(ctx context.Context, ua string) (bundle *types.BundleData, err error) + ListBundle(ctx context.Context) +} type storage struct{} +// ListBundle implements Storager. +func (s *storage) ListBundle(ctx context.Context) { + panic("unimplemented") +} + +// Bundle implements Storager. +func (s *storage) Bundle(ctx context.Context, ua string) (bundle *types.BundleData, err error) { + panic("unimplemented") +} + +// ListBarcode implements Storager. +func (s *storage) ListBarcode(ctx context.Context, lb types.LoadingBed, inicio string, final string) (barcodes []types.Barcode, err error) { + panic("unimplemented") +} + +// Barcode implements Storager. +func (s *storage) Barcode(ctx context.Context, reading string) (barcode *types.Barcode, err error) { + panic("unimplemented") +} + func New() Storager { return &storage{} } diff --git a/templates/hbcp.html b/templates/hbcp.html index a5f4566..9e607b5 100644 --- a/templates/hbcp.html +++ b/templates/hbcp.html @@ -39,14 +39,16 @@
diff --git a/types/barcode.go b/types/barcode.go new file mode 100644 index 0000000..8ef3a2b --- /dev/null +++ b/types/barcode.go @@ -0,0 +1,25 @@ +package types + +import ( + "time" + + "gorm.io/gorm" +) + +type BarcodeStatus uint16 + +type LoadingBed uint8 + +const ( + ATA12 LoadingBed = iota + 1 + ATA345 + ALL +) + +type Barcode struct { + Barcode string `gorm:"primaryKey"` + LoadingBed LoadingBed + CreatedAt time.Time `gorm:"->;<-:create" json:"createdat,omitempty"` + UpdatedAt time.Time `json:"updatedat,omitempty"` + DeletedAt gorm.DeletedAt `gorm:"index" json:"deletedat,omitempty"` +} diff --git a/types/beam_cut_pattern.go b/types/beam_cut_pattern.go new file mode 100644 index 0000000..aa1e772 --- /dev/null +++ b/types/beam_cut_pattern.go @@ -0,0 +1,24 @@ +package types + +import ( + "time" + + "gorm.io/gorm" +) + +type BeamCutPattern struct { + Inst string `json:"INST"` + DateTime string `json:"DATE_TIME"` + BeamCutN int `json:"BEAM_CUT_N" gorm:"primaryKey;autoIncrement:false"` + SchedulNo int `json:"SCHEDUL_NO"` + Spli1Len int `json:"SPLI_1_LEN"` + Spli2Len int `json:"SPLI_2_LEN"` + Sortb string `json:"SORTB"` + CreatedAt time.Time `gorm:"->;<-:create" json:"createdat,omitempty"` + UpdatedAt time.Time `json:"updated_at,omitempty"` + DeletedAt gorm.DeletedAt `gorm:"index"` +} + +func (BeamCutPattern) TableName() string { + return "sap_bcp" +} diff --git a/types/beam_group.go b/types/beam_group.go new file mode 100644 index 0000000..a9b0eea --- /dev/null +++ b/types/beam_group.go @@ -0,0 +1,32 @@ +package types + +import ( + "time" + + "gorm.io/gorm" +) + +type BeamGroup struct { + Inst string `json:"INST"` + DateTime string `json:"DATE_TIME"` + BeamDatN int `json:"BEAM_DAT_N" gorm:"primaryKey;autoIncrement:false"` + SchedulNo int `json:"SCHEDUL_NO"` + NoOfBeam int `json:"NO_OF_BEAM"` + MaterCode string `json:"MATER_CODE"` + POrderNo int `json:"P_ORDER_NO"` + IWeight string `json:"I_WEIGHT"` + IWeightT string `json:"I_WEIGHT_T"` + ILength string `json:"I_LENGTH"` + ILengthT string `json:"I_LENGTH_T"` + BeamCutN int `json:"BEAM_CUT_N"` + LayCutP1 int `json:"LAY_CUT_P1"` + LayCutP2 int `json:"LAY_CUT_P2"` + Sortb string `json:"SORTB"` + CreatedAt time.Time `gorm:"->;<-:create" json:"createdat,omitempty"` + UpdatedAt time.Time `json:"updated_at,omitempty"` + DeletedAt gorm.DeletedAt `gorm:"index"` +} + +func (BeamGroup) TableName() string { + return "sap_bg" +} diff --git a/types/bundle.go b/types/bundle.go new file mode 100644 index 0000000..53045bf --- /dev/null +++ b/types/bundle.go @@ -0,0 +1,164 @@ +package types + +import ( + "fmt" + "time" + + "gorm.io/gorm" +) + +type BundleData struct { + Grupo6 string `json:"grupo6"` + Po int `json:"po" gorm:"index"` + Co int `json:"co"` + Colada string `json:"colada"` + Calidad string `json:"calidad"` + Matnr string `json:"matnr"` + Dibujo int `json:"dibujo"` + Operador string `json:"operador"` + Serie int `json:"serie"` + Nromatricula string `gorm:"primaryKey" json:"nromatricula"` + NroBulto string `json:"nro_bulto"` + EtiquetaDoble string `json:"etiqueta_doble"` + Fecha int `json:"fecha"` + Turno string `json:"turno"` + Observacion1 string `json:"observacion1"` + Observacion2 string `json:"observacion2"` + Observacion3 string `json:"observacion3"` + PaqueteLongitud float64 `json:"paquete_longitud"` + PaqueteAncho int `json:"paquete_ancho"` + PaqueteAlto float64 `json:"paquete_alto"` + PaquetePeso int `json:"paquete_peso"` + PaqueteNroSecciones int `json:"paquete_nro_secciones"` + PaqueteNroMantos int `json:"paquete_nro_mantos"` + PaqueteNroSeccManto int `json:"paquete_nro_secc_manto"` + SeccionTipo string `gorm:"index" json:"seccion_tipo"` + SeccionLongitud int `json:"seccion_longitud"` + SeccionAncho float64 `json:"seccion_ancho"` + SeccionAlto float64 `json:"seccion_alto"` + Idioma string `json:"idioma"` + Destino int `json:"destino"` + Hora int `json:"hora"` + Horario int `json:"horario"` + Inst string `json:"inst"` + Tren int `json:"tren"` + Normed string `json:"normed"` + Norpro string `json:"norpro"` + Nortol string `json:"nortol"` + Spras string `json:"spras"` + Statu int `json:"statu"` + Crlf string `json:"crlf"` + Maquina int `json:"maquina"` + Padre string `json:"padre"` + Paqpadre string `json:"paqpadre"` + RelevantTime string `json:"relevant_time"` + Desvio float64 `json:"desvio"` + Pesoteorico float64 `json:"pesoteorico"` + PesoteoricoReal float64 `json:"pesoteorico_real"` + DesvioTeoricoReal float64 `json:"desvio_teorico_real"` + FechaImpresion string `json:"fecha_impresion"` + PesoNivel1 float64 `json:"peso_nivel1"` + L3Sended bool `json:"l3_sended,omitempty"` + Confirmed bool `json:"confirmed,omitempty"` + SAP bool `json:"sap,omitempty"` + CreatedAt time.Time `gorm:"->;<-:create" json:"createdat,omitempty"` + UpdatedAt time.Time `json:"updatedat,omitempty"` + DeletedAt gorm.DeletedAt `gorm:"index" json:"deletedat,omitempty"` +} + +func (BundleData) TableName() string { + return "bundles" +} + +func (b *BundleData) BeforeSave(tx *gorm.DB) error { + // calculate and assign teorical weight + PesoTeorico(b) + // calculation of the deviation of the actual weight from the theoretical weight + if err := Desvio(b); err != nil { + return err + } + // calculation of the "real" theorical weight means lenght + the lenght of the disc saw (10mm) + PesoTeoricoReal(b) + if err := DesvioReal(b); err != nil { + return err + } + // // calculation of the deviation between theorical and SAP + // if err := PesoDesvioSAP(b); err != nil { + // return err + // } + return nil +} + +func PesoTeorico(b *BundleData) { + // get the lenght of the bundle + bl := b.PaqueteLongitud + // weight per meter + bw := b.PaqueteAlto + // number of pieces + bp := b.PaqueteNroSecciones + // calculate theoretical weight + bt := bl * bw * float64(bp) + // set value + b.Pesoteorico = bt +} + +func Desvio(b *BundleData) error { + // check if theorical is 0 + if b.Pesoteorico == 0 { + return fmt.Errorf("theorical weight is zero") + } + // calculate deviation + dv := float64(b.PaquetePeso) - (b.Pesoteorico) + // % of deviation + pdv := (dv / float64(b.Pesoteorico)) * 100 + // set value + b.Desvio = pdv + // done + return nil +} + +func PesoTeoricoReal(b *BundleData) { + // get the lenght of the bundle + bl := b.PaqueteLongitud + 0.01 // added 10 mm + // weight per meter + bw := b.PaqueteAlto + // number of pieces + bp := b.PaqueteNroSecciones + // calculate theoretical weight + bt := bl * bw * float64(bp) + // set value + b.PesoteoricoReal = bt +} + +func DesvioReal(b *BundleData) error { + // check if theorical is 0 + if b.PesoteoricoReal == 0 { + return fmt.Errorf("theorical weight is zero") + } + // calculate deviation + dv := float64(b.PaquetePeso) - (b.PesoteoricoReal) + // % of deviation + pdv := (dv / float64(b.PesoteoricoReal)) * 100 + // set value + b.DesvioTeoricoReal = pdv + // done + return nil +} + +func PesoDesvioSAP(b *BundleData) error { + // check if theorical is 0 + if b.Pesoteorico == 0 { + return fmt.Errorf("theorical weight is zero") + } + // check if SAP deviation is 0 + if b.PesoNivel1 == 0 { + return fmt.Errorf("SAP deviation not found") + } + // get deviation + dvs := b.PesoNivel1 + // calculates weight + res := b.Pesoteorico + (b.Pesoteorico * (dvs / 100)) + // set weight value + b.PesoNivel1 = res + return nil +} diff --git a/types/customer_order.go b/types/customer_order.go new file mode 100644 index 0000000..b055ad7 --- /dev/null +++ b/types/customer_order.go @@ -0,0 +1,87 @@ +package types + +import ( + "time" + + "gorm.io/gorm" +) + +type CustomerOrder struct { + Inst string `json:"INST"` + DateTime string `json:"DATE_TIME"` + COrderNo int `json:"C_ORDER_NO" gorm:"primaryKey;autoIncrement:false"` + POrderNo int `json:"P_ORDER_NO" gorm:"index"` + SchedulNo int `json:"SCHEDUL_NO"` + OrdWeight string `json:"ORD_WEIGHT"` + OrdLen string `json:"ORD_LEN"` + OrLenTU string `json:"OR_LEN_T_U"` + OrLenTL string `json:"OR_LEN_T_L"` + PackType int `json:"PACK_TYPE"` + SectLayer int `json:"SECT_LAYER"` + LayerPack int `json:"LAYER_PACK"` + SecLastL int `json:"SEC_LAST_L"` + TotalSect int `json:"TOTAL_SECT"` + PackWidth int `json:"PACK_WIDTH"` + PackHigh int `json:"PACK_HIGH"` + OutpTolU int `json:"OUTP_TOL_U"` + OutpTolD int `json:"OUTP_TOL_D"` + LogoCode int `json:"LOGO_CODE"` + SecondLab string `json:"SECOND_LAB"` + PaintText string `json:"PAINT_TEXT"` + AddLabel1 string `json:"ADD_LABEL1"` + AddLabel2 string `json:"ADD_LABEL2"` + AddLabel3 string `json:"ADD_LABEL3"` + MaterCode string `json:"MATER_CODE"` + ProduDate int `json:"PRODU_DATE"` + LangLabel string `json:"LANG_LABEL"` + Warehouse string `json:"WAREHOUSE"` + Location string `json:"LOCATION"` + Marking string `json:"MARKING"` + DisForwar string `json:"DIS_FORWAR"` + NumTies int `json:"NUM_TIES"` + DisTies string `json:"DIS_TIES"` + DisMachin string `json:"DIS_MACHIN"` + Vbeln string `json:"VBELN"` + Posnr string `json:"POSNR"` + CoType string `json:"CO_TYPE"` + LoadBed int `json:"LOAD_BED"` + SecNum int `json:"SEC_NUM"` + Numpal int `json:"NUMPAL"` + Numbul string `json:"NUMBUL"` + Marfab int `json:"MARFAB"` + Sortb string `json:"SORTB"` + Strol1 int `json:"STROL1"` + Strol2 string `json:"STROL2"` + Strol3 int `json:"STROL3"` + Strol4 int `json:"STROL4"` + Strol5 int `json:"STROL5"` + Strol6 int `json:"STROL6"` + Strol7 int `json:"STROL7"` + Strol8 int `json:"STROL8"` + Strol9 int `json:"STROL9"` + Strol10 int `json:"STROL10"` + Strol11 int `json:"STROL11"` + Strol12 int `json:"STROL12"` + Strol13 int `json:"STROL13"` + Strol14 int `json:"STROL14"` + Strol15 int `json:"STROL15"` + Strol16 string `json:"STROL16"` + Strol17 string `json:"STROL17"` + Strol18 string `json:"STROL18"` + Strol19 string `json:"STROL19"` + Strol20 string `json:"STROL20"` + Strol21 string `json:"STROL21"` + Strol22 string `json:"STROL22"` + Strol23 string `json:"STROL23"` + Strol24 string `json:"STROL24"` + Strol25 string `json:"STROL25"` + Strol26 string `json:"STROL26"` + Strol27 string `json:"STROL27"` + CreatedAt time.Time `gorm:"->;<-:create" json:"createdat,omitempty"` + UpdatedAt time.Time `json:"updated_at,omitempty"` + DeletedAt gorm.DeletedAt `gorm:"index"` +} + +func (CustomerOrder) TableName() string { + return "sap_co" +} diff --git a/types/layer_cut_pattern.go b/types/layer_cut_pattern.go new file mode 100644 index 0000000..326e0c2 --- /dev/null +++ b/types/layer_cut_pattern.go @@ -0,0 +1,170 @@ +package types + +import ( + "time" + + "gorm.io/gorm" +) + +type LayerCutPattern struct { + Inst string `json:"INST"` + DateTime string `json:"DATE_TIME"` + LayCutNo string `json:"LAY_CUT_NO" gorm:"primaryKey"` + SchedulNo string `json:"SCHEDUL_NO"` + DisSt1L1 string `json:"DIS_ST_1L1"` + DisSt1L2 string `json:"DIS_ST_1L2"` + DisSt1L3 string `json:"DIS_ST_1L3"` + DisSt2 string `json:"DIS_ST_2"` + DisShSaw string `json:"DIS_SH_SAW"` + NumPatter int `json:"NUM_PATTER"` + SepDev01 int `json:"SEP_DEV_01"` + Stope101 int `json:"STOPE_1_01"` + Stope201 int `json:"STOPE_2_01"` + FixSaw01 int `json:"FIX_SAW_01"` + ShiSaw01 int `json:"SHI_SAW_01"` + CusOr101 int `json:"CUS_OR1_01"` + CusOr201 int `json:"CUS_OR2_01"` + SepDev02 int `json:"SEP_DEV_02"` + Stope102 int `json:"STOPE_1_02"` + Stope202 int `json:"STOPE_2_02"` + FixSaw02 int `json:"FIX_SAW_02"` + ShiSaw02 int `json:"SHI_SAW_02"` + CusOr102 int `json:"CUS_OR1_02"` + CusOr202 int `json:"CUS_OR2_02"` + SepDev03 int `json:"SEP_DEV_03"` + Stope103 int `json:"STOPE_1_03"` + Stope203 int `json:"STOPE_2_03"` + FixSaw03 int `json:"FIX_SAW_03"` + ShiSaw03 int `json:"SHI_SAW_03"` + CusOr103 int `json:"CUS_OR1_03"` + CusOr203 int `json:"CUS_OR2_03"` + SepDev04 int `json:"SEP_DEV_04"` + Stope104 int `json:"STOPE_1_04"` + Stope204 int `json:"STOPE_2_04"` + FixSaw04 int `json:"FIX_SAW_04"` + ShiSaw04 int `json:"SHI_SAW_04"` + CusOr104 int `json:"CUS_OR1_04"` + CusOr204 int `json:"CUS_OR2_04"` + Stope105 int `json:"STOPE_1_05"` + Stope205 int `json:"STOPE_2_05"` + FixSaw05 int `json:"FIX_SAW_05"` + ShiSaw05 int `json:"SHI_SAW_05"` + CusOr105 int `json:"CUS_OR1_05"` + CusOr205 int `json:"CUS_OR2_05"` + SepDev06 int `json:"SEP_DEV_06"` + Stope106 int `json:"STOPE_1_06"` + Stope206 int `json:"STOPE_2_06"` + FixSaw06 int `json:"FIX_SAW_06"` + ShiSaw06 int `json:"SHI_SAW_06"` + CusOr106 int `json:"CUS_OR1_06"` + CusOr206 int `json:"CUS_OR2_06"` + SepDev07 int `json:"SEP_DEV_07"` + Stope107 int `json:"STOPE_1_07"` + Stope207 int `json:"STOPE_2_07"` + FixSaw07 int `json:"FIX_SAW_07"` + ShiSaw07 int `json:"SHI_SAW_07"` + CusOr107 int `json:"CUS_OR1_07"` + CusOr207 int `json:"CUS_OR2_07"` + SepDev08 int `json:"SEP_DEV_08"` + Stope108 int `json:"STOPE_1_08"` + Stope208 int `json:"STOPE_2_08"` + FixSaw08 int `json:"FIX_SAW_08"` + ShiSaw08 int `json:"SHI_SAW_08"` + CusOr108 int `json:"CUS_OR1_08"` + CusOr208 int `json:"CUS_OR2_08"` + SepDev09 int `json:"SEP_DEV_09"` + Stope109 int `json:"STOPE_1_09"` + Stope209 int `json:"STOPE_2_09"` + FixSaw09 int `json:"FIX_SAW_09"` + ShiSaw09 int `json:"SHI_SAW_09"` + CusOr109 int `json:"CUS_OR1_09"` + CusOr209 int `json:"CUS_OR2_09"` + SepDev10 int `json:"SEP_DEV_10"` + Stope110 int `json:"STOPE_1_10"` + Stope210 int `json:"STOPE_2_10"` + FixSaw10 int `json:"FIX_SAW_10"` + ShiSaw10 int `json:"SHI_SAW_10"` + CusOr110 int `json:"CUS_OR1_10"` + CusOr210 int `json:"CUS_OR2_10"` + SepDev11 int `json:"SEP_DEV_11"` + Stope111 int `json:"STOPE_1_11"` + Stope211 int `json:"STOPE_2_11"` + FixSaw11 int `json:"FIX_SAW_11"` + ShiSaw11 int `json:"SHI_SAW_11"` + CusOr111 int `json:"CUS_OR1_11"` + CusOr211 int `json:"CUS_OR2_11"` + SepDev12 int `json:"SEP_DEV_12"` + Stope112 int `json:"STOPE_1_12"` + Stope212 int `json:"STOPE_2_12"` + FixSaw12 int `json:"FIX_SAW_12"` + ShiSaw12 int `json:"SHI_SAW_12"` + CusOr112 int `json:"CUS_OR1_12"` + CusOr212 int `json:"CUS_OR2_12"` + SepDev13 int `json:"SEP_DEV_13"` + Stope113 int `json:"STOPE_1_13"` + Stope213 int `json:"STOPE_2_13"` + FixSaw13 int `json:"FIX_SAW_13"` + ShiSaw13 int `json:"SHI_SAW_13"` + CusOr113 int `json:"CUS_OR1_13"` + CusOr213 int `json:"CUS_OR2_13"` + SepDev14 int `json:"SEP_DEV_14"` + Stope114 int `json:"STOPE_1_14"` + Stope214 int `json:"STOPE_2_14"` + FixSaw14 int `json:"FIX_SAW_14"` + ShiSaw14 int `json:"SHI_SAW_14"` + CusOr114 int `json:"CUS_OR1_14"` + CusOr214 int `json:"CUS_OR2_14"` + SepDev15 int `json:"SEP_DEV_15"` + Stope115 int `json:"STOPE_1_15"` + Stope215 int `json:"STOPE_2_15"` + FixSaw15 int `json:"FIX_SAW_15"` + ShiSaw15 int `json:"SHI_SAW_15"` + CusOr115 int `json:"CUS_OR1_15"` + CusOr215 int `json:"CUS_OR2_15"` + SepDev16 int `json:"SEP_DEV_16"` + Stope116 int `json:"STOPE_1_16"` + Stope216 int `json:"STOPE_2_16"` + FixSaw16 int `json:"FIX_SAW_16"` + ShiSaw16 int `json:"SHI_SAW_16"` + CusOr116 int `json:"CUS_OR1_16"` + CusOr216 int `json:"CUS_OR2_16"` + SepDev17 int `json:"SEP_DEV_17"` + Stope117 int `json:"STOPE_1_17"` + Stope217 int `json:"STOPE_2_17"` + FixSaw17 int `json:"FIX_SAW_17"` + ShiSaw17 int `json:"SHI_SAW_17"` + CusOr117 int `json:"CUS_OR1_17"` + CusOr217 int `json:"CUS_OR2_17"` + SepDev18 int `json:"SEP_DEV_18"` + Stope118 int `json:"STOPE_1_18"` + Stope218 int `json:"STOPE_2_18"` + FixSaw18 int `json:"FIX_SAW_18"` + ShiSaw18 int `json:"SHI_SAW_18"` + CusOr118 int `json:"CUS_OR1_18"` + CusOr218 int `json:"CUS_OR2_18"` + SepDev19 int `json:"SEP_DEV_19"` + Stope119 int `json:"STOPE_1_19"` + Stope219 int `json:"STOPE_2_19"` + FixSaw19 int `json:"FIX_SAW_19"` + ShiSaw19 int `json:"SHI_SAW_19"` + CusOr119 int `json:"CUS_OR1_19"` + CusOr219 int `json:"CUS_OR2_19"` + SepDev20 int `json:"SEP_DEV_20"` + Stope120 int `json:"STOPE_1_20"` + Stope220 int `json:"STOPE_2_20"` + FixSaw20 int `json:"FIX_SAW_20"` + ShiSaw20 int `json:"SHI_SAW_20"` + CusOr120 int `json:"CUS_OR1_20"` + CusOr220 int `json:"CUS_OR2_20"` + LLayeDes int `json:"L_LAYE_DES"` + CustOrder int `json:"CUST_ORDER"` + UnderlDes int `json:"UNDERL_DES"` + Sortb string `json:"SORTB"` + CreatedAt time.Time `gorm:"->;<-:create" json:"createdat,omitempty"` + UpdatedAt time.Time `json:"updated_at,omitempty"` + DeletedAt gorm.DeletedAt `gorm:"index"` +} + +func (LayerCutPattern) TableName() string { + return "sap_lcp" +} diff --git a/types/production_order.go b/types/production_order.go new file mode 100644 index 0000000..89f45f1 --- /dev/null +++ b/types/production_order.go @@ -0,0 +1,78 @@ +package types + +import ( + "time" + + "gorm.io/gorm" +) + +type ProductionOrder struct { + Inst string `json:"INST"` + DateTime string `json:"DATE_TIME"` + POrderNo int `json:"P_ORDER_NO" gorm:"primaryKey;autoIncrement:false"` + SchedulNo int `json:"SCHEDUL_NO"` + SeqNumber int `json:"SEQ_NUMBER"` + PptimeWfc string `json:"PPTIME_WFC"` + PptimeMsc string `json:"PPTIME_MSC"` + SteelGrad string `json:"STEEL_GRAD"` + ITemp string `json:"I_TEMP"` + IHeight string `json:"I_HEIGHT"` + IWidth string `json:"I_WIDTH"` + ISection string `json:"I_SECTION"` + HeatingSt int `json:"HEATING_ST"` + FTarTemp string `json:"F_TAR_TEMP"` + FSection string `json:"F_SECTION"` + FSectType string `json:"F_SECT_TYPE"` + TotWeight string `json:"TOT_WEIGHT"` + TBeamBla int `json:"T_BEAM_BLA"` + TCustOrd int `json:"T_CUST_ORD"` + TestLen int `json:"TEST_LEN"` + PostFlag string `json:"POST_FLAG"` + ModuloX string `json:"MODULO_X"` + OvWTolU string `json:"OV_W_TOL_U"` + OvWTolL string `json:"OV_W_TOL_L"` + OvHTolU string `json:"OV_H_TOL_U"` + OvHTolL string `json:"OV_H_TOL_L"` + WeTTolU string `json:"WE_T_TOL_U"` + WeTTolL string `json:"WE_T_TOL_L"` + WeHTolU string `json:"WE_H_TOL_U"` + WeHTolL string `json:"WE_H_TOL_L"` + FlWDsU string `json:"FL_W_DS_U"` + FlWDsL string `json:"FL_W_DS_L"` + FlWOsU string `json:"FL_W_OS_U"` + FlWOsL string `json:"FL_W_OS_L"` + WeMetTU string `json:"WE_MET_T_U"` + WeMetTL string `json:"WE_MET_T_L"` + WeCenTol string `json:"WE_CEN_TOL"` + WeSquTol string `json:"WE_SQU_TOL"` + FlParTol string `json:"FL_PAR_TOL"` + BdRollID string `json:"BD_ROLL_ID"` + UrRollID string `json:"UR_ROLL_ID"` + EdRollID string `json:"ED_ROLL_ID"` + UfRollID string `json:"UF_ROLL_ID"` + SmRollID string `json:"SM_ROLL_ID"` + Grupo6 string `json:"GRUPO6"` + StName string `json:"ST_NAME"` + StWeighM string `json:"ST_WEIGH_M"` + StLen1 string `json:"ST_LEN_1"` + StLen2 string `json:"ST_LEN_2"` + StLen3 string `json:"ST_LEN_3"` + StLen4 string `json:"ST_LEN_4"` + StLen5 string `json:"ST_LEN_5"` + StLen6 string `json:"ST_LEN_6"` + StLen7 string `json:"ST_LEN_7"` + StLen8 string `json:"ST_LEN_8"` + StLen9 string `json:"ST_LEN_9"` + StLen10 string `json:"ST_LEN_10"` + StLen11 string `json:"ST_LEN_11"` + StLen12 string `json:"ST_LEN_12"` + Marfab int `json:"MARFAB"` + Sortb string `json:"SORTB"` + CreatedAt time.Time `gorm:"->;<-:create" json:"createdat,omitempty"` + UpdatedAt time.Time `json:"updated_at,omitempty"` + DeletedAt gorm.DeletedAt `gorm:"index"` +} + +func (ProductionOrder) TableName() string { + return "sap_po" +}