SJA APS后端代码
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.

62 lines
2.0 KiB

  1. // Copyright (c) Shenyang Leading Edge Intelligent Technology Co., Ltd. All rights reserved.
  2. package db
  3. import (
  4. "fmt"
  5. "leit.com/leit_seat_aps/common"
  6. "xorm.io/core"
  7. )
  8. type Pln_batchorder_intstatus struct {
  9. Finr int `xorm:"not null pk comment('车间编号') INT(0)" json:"finr"`
  10. Batchordernr string `xorm:"not null pk comment('批次单号') VARCHAR(18)" json:"batchordernr"`
  11. Releaseflag int `xorm:"not null comment('标记状态') INT(0)" json:"releaseflag"`
  12. Runningflag int `xorm:"not null comment('启动状态') INT(0)" json:"runningflag"`
  13. Finishflag int `xorm:"not null comment('结束状态') INT(0)" json:"finishflag"`
  14. Lastmodif string `xorm:"not null comment('上一次更改日期') VARCHAR(14)" json:"lastmodif"`
  15. Lastuser string `xorm:"not null comment('最后编辑人员') VARCHAR(20)" json:"lastuser"`
  16. Credatuz string `xorm:"not null comment('创建时间') VARCHAR(14)" json:"credatuz"`
  17. }
  18. func (t *Pln_batchorder_intstatus) TableName() string {
  19. return "pln_batchorder_intstatus"
  20. }
  21. // 清除string字段的右侧空格
  22. func (t *Pln_batchorder_intstatus) Clipped() {
  23. common.TrimStruct(t, *t)
  24. }
  25. /******************************************************************************
  26. *
  27. * @Function Name :
  28. *-----------------------------------------------------------------------------
  29. *
  30. * @Description :
  31. *
  32. * @Function Parameters:
  33. *
  34. * @Return Value :
  35. *
  36. * @Author : Lou Wenzhi
  37. *
  38. * @Date : 2021/3/10 11:18
  39. *
  40. ******************************************************************************/
  41. func (t *Pln_batchorder_intstatus) Add() error {
  42. e := G_DbEngine
  43. countrole := new(Pln_batchorder_intstatus)
  44. affw, err := e.Table("pln_batchorder_intstatus").ID(core.PK{G_FINR, t.Batchordernr}).Count(countrole)
  45. if err != nil {
  46. return err
  47. }
  48. if affw > 0 {
  49. return nil
  50. }
  51. _, err = e.Table("pln_batchorder_intstatus").Insert(t)
  52. if err != nil {
  53. fmt.Printf("err is :%v", err)
  54. return err
  55. }
  56. return nil
  57. }