wip
This commit is contained in:
parent
99d1f4d287
commit
69624705ea
@ -73,6 +73,8 @@ func Automigrate(db *gorm.DB) error {
|
||||
&types.BundleData{},
|
||||
&types.ProductionOrder{},
|
||||
&types.CustomerOrder{},
|
||||
&types.BeamCutPattern{},
|
||||
&types.LayerCutPattern{},
|
||||
)
|
||||
}
|
||||
|
||||
|
24
internal/types/beam_cut_pattern.go
Normal file
24
internal/types/beam_cut_pattern.go
Normal file
@ -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"
|
||||
}
|
32
internal/types/beam_group.go
Normal file
32
internal/types/beam_group.go
Normal file
@ -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"
|
||||
}
|
170
internal/types/layer_cut_pattern.go
Normal file
170
internal/types/layer_cut_pattern.go
Normal file
@ -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"
|
||||
}
|
@ -126,6 +126,23 @@ func Run(cmd *cobra.Command, args []string) {
|
||||
log.Error("store customer order data failed", err, logFields)
|
||||
continue
|
||||
}
|
||||
case "sap.in.telegramas.z_sms_10003":
|
||||
co := &types.CustomerOrder{}
|
||||
if err := json.Unmarshal(buffer.Bytes(), co); err != nil {
|
||||
log.Error("decode event message data failed", err, logFields)
|
||||
continue
|
||||
}
|
||||
// log info banner
|
||||
log.Info("received new production data from SAP event", logFields.Add(
|
||||
logger.LogFields{
|
||||
"event_id": event.EventID,
|
||||
"customer_order": co.COrderNo,
|
||||
"production_order": co.POrderNo,
|
||||
}))
|
||||
if err := storage.StoreCustomerOrder(ctx, co); err != nil {
|
||||
log.Error("store customer order data failed", err, logFields)
|
||||
continue
|
||||
}
|
||||
default:
|
||||
continue
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user