// Copyright (c) Shenyang Leading Edge Intelligent Technology Co., Ltd. All rights reserved.
|
|
|
|
package base
|
|
|
|
import (
|
|
"LAPP_ACURA_MOM_BACKEND/grmi"
|
|
"xorm.io/core"
|
|
)
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Struct Name : LabelParserHead
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : LabelParserHead的实体映射
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-08-20 11:28:44
|
|
*
|
|
******************************************************************************/
|
|
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"`
|
|
Descr string `xorm:"nvarchar(40) 'Descr' not null" json:"LabelParserHead-Descr"`
|
|
Example string `xorm:"nvarchar(100) 'Example' not null" json:"LabelParserHead-Example"`
|
|
Split string `xorm:"nvarchar(32) 'Split'" json:"LabelParserHead-Split"`
|
|
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-08-20 11:28:44
|
|
*
|
|
******************************************************************************/
|
|
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
|
|
|
|
}
|