SJA工艺
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.

63 lines
2.0 KiB

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