You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

82 lines
3.1 KiB

// Copyright (c) Shenyang Leading Edge Intelligent Technology Co., Ltd. All rights reserved.
package base
import (
"LAPP_LF_MOM_BACKEND/grmi"
"xorm.io/core"
)
/******************************************************************************
*
* @Struct Name : LabelParserHead
*-----------------------------------------------------------------------------
*
* @Description : LabelParserHead的实体映射
*
* @Author : 代码生成器创建
*
* @Date : 2021-06-02 09:38:09
*
******************************************************************************/
type LabelParserHead struct {
PlantNr int `xorm:"pk int 'PlantNr'" json:"LabelParserHead-PlantNr"`
ParserId string `xorm:"pk nvarchar(40) 'ParserId'" json:"LabelParserHead-ParserId"`
Length int `xorm:"int 'Length' not null" json:"LabelParserHead-Length"`
ParserType string `xorm:"nvarchar(40) 'ParserType' not null" json:"LabelParserHead-ParserType"`
Split string `xorm:"nvarchar(40) 'Split' not null" json:"LabelParserHead-Split"`
Descr string `xorm:"nvarchar(40) 'Descr' not null" json:"LabelParserHead-Descr"`
Example string `xorm:"nvarchar(100) 'Example' not null" json:"LabelParserHead-Example"`
LastModify grmi.DateTime `xorm:"datetime 'LastModify' not null updated" json:"LabelParserHead-LastModify"`
LastUser string `xorm:"nvarchar(20) 'LastUser' not null" json:"LabelParserHead-LastUser"`
CreateTime grmi.DateTime `xorm:"datetime 'CreateTime' not null created" json:"LabelParserHead-CreateTime"`
Valst []LabelParserDetailLst `json:"valst" xorm:"-"`
}
/******************************************************************************
*
* @Function Name : GetKey
*-----------------------------------------------------------------------------
*
* @Description : 获取实体的主键
*
* @Return Value : 实体的主键
*
* @Author : 代码生成器创建
*
* @Date : 2021-06-02 09:38:09
*
******************************************************************************/
func (self *LabelParserHead) GetKey() core.PK {
return core.PK{self.PlantNr, self.ParserId}
}
/******************************************************************************
*
* @Function Name :
*-----------------------------------------------------------------------------
*
* @Description : 获取实体的主键
*
* @Return Value : 实体的主键
*
* @Author : 代码生成器创建
*
* @Date : 2021-06-02 09:38:09
*
******************************************************************************/
func ParseBarcode(str string, data []LabelParserDetailLst) map[string]string {
result := make(map[string]string)
for _, v := range data {
key := v.Abrev
startPos := v.StartPos
endPos := v.EndPos
if endPos > len(str) {
continue
}
value := str[startPos:endPos]
result[key] = value
}
return result
}