// Copyright (c) Shenyang Leading Edge Intelligent Technology Co., Ltd. All rights reserved.
|
|
package models
|
|
|
|
import (
|
|
"LAPP_SJA_ME/db"
|
|
"LAPP_SJA_ME/utils"
|
|
"fmt"
|
|
"xorm.io/core"
|
|
)
|
|
|
|
type Pln_batchorder_intstatus struct {
|
|
Finr int `xorm:"not null pk comment('车间编号') INT(0)" json:"finr"`
|
|
Batchordernr string `xorm:"not null pk comment('批次单号') VARCHAR(18)" json:"batchordernr"`
|
|
Releaseflag int `xorm:"not null comment('标记状态') INT(0)" json:"releaseflag"`
|
|
Runningflag int `xorm:"not null comment('启动状态') INT(0)" json:"runningflag"`
|
|
Finishflag int `xorm:"not null comment('结束状态') INT(0)" json:"finishflag"`
|
|
Lastmodif string `xorm:"not null comment('上一次更改日期') VARCHAR(14)" json:"lastmodif"`
|
|
Lastuser string `xorm:"not null comment('最后编辑人员') VARCHAR(20)" json:"lastuser"`
|
|
Credatuz string `xorm:"not null comment('创建时间') VARCHAR(14)" json:"credatuz"`
|
|
}
|
|
|
|
func (t *Pln_batchorder_intstatus) TableName() string {
|
|
return "pln_batchorder_intstatus"
|
|
}
|
|
|
|
// 清除string字段的右侧空格
|
|
func (t *Pln_batchorder_intstatus) Clipped() {
|
|
utils.TrimStruct(t, *t)
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name :
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description :
|
|
*
|
|
* @Function Parameters:
|
|
*
|
|
* @Return Value :
|
|
*
|
|
* @Author : Lou Wenzhi
|
|
*
|
|
* @Date : 2021/3/10 11:18
|
|
*
|
|
******************************************************************************/
|
|
func (t *Pln_batchorder_intstatus) Add() error {
|
|
e := db.Eloquent.Master()
|
|
countrole := new(Pln_batchorder_intstatus)
|
|
affw, err := e.Table("pln_batchorder_intstatus").ID(core.PK{t.Finr, t.Batchordernr}).Count(countrole)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if affw > 0 {
|
|
return nil
|
|
}
|
|
_, err = e.Table("pln_batchorder_intstatus").Insert(t)
|
|
if err != nil {
|
|
fmt.Printf("err is :%v", err)
|
|
return err
|
|
}
|
|
return nil
|
|
}
|