zhangqian
2023-12-19 c688f083caf965cd13f640098ad204d8fd8c9e69
接收字节序参数
3个文件已修改
14 ■■■■■ 已修改文件
constvar/const.go 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/common/common.go 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/device_plc.go 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
constvar/const.go
@@ -20,6 +20,18 @@
    PlcStartAddressTypeTotalNumberWrite PlcStartAddressType = 3
)
type EndianType string
const (
    EndianTypeBig    EndianType = "big"
    EndianTypeLittle EndianType = "little"
    EndianTypeMix    EndianType = "mix"
)
func (t EndianType) Valid() bool {
    return t == EndianTypeBig || t == EndianTypeLittle || t == EndianTypeMix
}
type PlcStartAddressValueType string
const (
model/common/common.go
@@ -96,6 +96,7 @@
        Length       int                          `json:"length"`       // 数据长度
        Type         string                       `json:"type"`         // 数据类型
        FieldName    constvar.PlcStartAddressType `json:"fieldName"`    // 对应系统字段,完成量或总量
        Endian       constvar.EndianType          `json:"endian" gorm:"type:varchar(255)"` // 字节存储顺序,big(ABCD)/little(CDBA)/mix(CDAB)
    }
)
model/device_plc.go
@@ -41,6 +41,7 @@
        Length       int                               `json:"length"`       // 数据长度
        Type         constvar.PlcStartAddressValueType `json:"type"`         // 数据类型
        FieldName    constvar.PlcStartAddressType      `json:"fieldName"`    // 对应系统字段
        Endian       constvar.EndianType               `json:"endian"`       // 字节存储顺序,big(ABCD)/little(CDBA)/mix(CDAB)
    }
    DevicePlcSearch struct {