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

  1. // Copyright (c) Shenyang Leading Edge Intelligent Technology Co., Ltd. All rights reserved.
  2. package base
  3. import (
  4. "LAPP_LF_MOM_BACKEND/grmi"
  5. "xorm.io/core"
  6. )
  7. /******************************************************************************
  8. *
  9. * @Struct Name : LabelParserHead
  10. *-----------------------------------------------------------------------------
  11. *
  12. * @Description : LabelParserHead的实体映射
  13. *
  14. * @Author : 代码生成器创建
  15. *
  16. * @Date : 2021-06-02 09:38:09
  17. *
  18. ******************************************************************************/
  19. type LabelParserHead struct {
  20. PlantNr int `xorm:"pk int 'PlantNr'" json:"LabelParserHead-PlantNr"`
  21. ParserId string `xorm:"pk nvarchar(40) 'ParserId'" json:"LabelParserHead-ParserId"`
  22. Length int `xorm:"int 'Length' not null" json:"LabelParserHead-Length"`
  23. ParserType string `xorm:"nvarchar(40) 'ParserType' not null" json:"LabelParserHead-ParserType"`
  24. Split string `xorm:"nvarchar(40) 'Split' not null" json:"LabelParserHead-Split"`
  25. Descr string `xorm:"nvarchar(40) 'Descr' not null" json:"LabelParserHead-Descr"`
  26. Example string `xorm:"nvarchar(100) 'Example' not null" json:"LabelParserHead-Example"`
  27. LastModify grmi.DateTime `xorm:"datetime 'LastModify' not null updated" json:"LabelParserHead-LastModify"`
  28. LastUser string `xorm:"nvarchar(20) 'LastUser' not null" json:"LabelParserHead-LastUser"`
  29. CreateTime grmi.DateTime `xorm:"datetime 'CreateTime' not null created" json:"LabelParserHead-CreateTime"`
  30. Valst []LabelParserDetailLst `json:"valst" xorm:"-"`
  31. }
  32. /******************************************************************************
  33. *
  34. * @Function Name : GetKey
  35. *-----------------------------------------------------------------------------
  36. *
  37. * @Description : 获取实体的主键
  38. *
  39. * @Return Value : 实体的主键
  40. *
  41. * @Author : 代码生成器创建
  42. *
  43. * @Date : 2021-06-02 09:38:09
  44. *
  45. ******************************************************************************/
  46. func (self *LabelParserHead) GetKey() core.PK {
  47. return core.PK{self.PlantNr, self.ParserId}
  48. }
  49. /******************************************************************************
  50. *
  51. * @Function Name :
  52. *-----------------------------------------------------------------------------
  53. *
  54. * @Description : 获取实体的主键
  55. *
  56. * @Return Value : 实体的主键
  57. *
  58. * @Author : 代码生成器创建
  59. *
  60. * @Date : 2021-06-02 09:38:09
  61. *
  62. ******************************************************************************/
  63. func ParseBarcode(str string, data []LabelParserDetailLst) map[string]string {
  64. result := make(map[string]string)
  65. for _, v := range data {
  66. key := v.Abrev
  67. startPos := v.StartPos
  68. endPos := v.EndPos
  69. if endPos > len(str) {
  70. continue
  71. }
  72. value := str[startPos:endPos]
  73. result[key] = value
  74. }
  75. return result
  76. }