// Copyright (c) Shenyang Leading Edge Intelligent Technology Co., Ltd. All rights reserved.
|
|
package models
|
|
|
|
import (
|
|
"errors"
|
|
"leit.com/aps_engine/db"
|
|
"time"
|
|
"xorm.io/core"
|
|
)
|
|
|
|
type OmWooperationartqtyreclst struct {
|
|
Plantnr int `json:"PlantNr" xorm:"not null pk INT(4)"`
|
|
Workorderid string `json:"WorkOrderId" xorm:"not null pk NVARCHAR(80)"`
|
|
Operationnr int `json:"OperationNr" xorm:"not null pk INT(4)"`
|
|
Splitnr int `json:"SplitNr" xorm:"not null pk INT(4)"`
|
|
Pos int `json:"Pos" xorm:"not null pk INT(4)"`
|
|
Artid string `json:"ArtId" xorm:"not null pk NVARCHAR(80)"`
|
|
Actqty float32 `json:"ActQty" xorm:"not null FLOAT(8)"`
|
|
Qtyuomid string `json:"QtyUomId" xorm:"not null NVARCHAR(80)"`
|
|
Batchid string `json:"BatchId" xorm:"not null NVARCHAR(200)"`
|
|
Arttypeid string `json:"ArtTypeId" xorm:"not null NVARCHAR(80)"`
|
|
Workplacenr int `json:"WorkPlaceNr" xorm:"not null INT(4)"`
|
|
Consumetime time.Time `json:"ConsumeTime" xorm:"DATETIME(8)"`
|
|
Warehousenr int `json:"WarehouseNr" xorm:"not null INT(4)"`
|
|
Areaid string `json:"AreaId" xorm:"not null NVARCHAR(80)"`
|
|
Rackid string `json:"RackId" xorm:"not null NVARCHAR(80)"`
|
|
Positionid string `json:"PositionId" xorm:"not null NVARCHAR(80)"`
|
|
Packageunit string `json:"PackageUnit" xorm:"not null NVARCHAR(80)"`
|
|
Ctrlpara1 int `json:"CtrlPara1" xorm:"not null INT(4)"`
|
|
Ctrlpara2 int `json:"CtrlPara2" xorm:"not null INT(4)"`
|
|
Ctrlstr1 string `json:"CtrlStr1" xorm:"not null NVARCHAR(200)"`
|
|
Ctrlstr2 string `json:"CtrlStr2" xorm:"not null NVARCHAR(200)"`
|
|
Lastmodify time.Time `json:"LastModify" xorm:"DATETIME(8)"`
|
|
Lastuser string `json:"LastUser" xorm:"not null NVARCHAR(40)"`
|
|
Createtime time.Time `json:"CreateTime" xorm:"DATETIME(8)"`
|
|
}
|
|
|
|
/******数据表名******/
|
|
func (t *OmWooperationartqtyreclst) TableName() string {
|
|
return "OmWooperationartqtyreclst"
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name :
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 数据添加
|
|
*
|
|
* @Function Parameters:
|
|
*
|
|
* @Return Value :
|
|
*
|
|
* @Author : Lou Wenzhi
|
|
*
|
|
* @Date : 2021/3/6 8:47
|
|
*
|
|
******************************************************************************/
|
|
func (t *OmWooperationartqtyreclst) Add() error {
|
|
e := db.Eloquent.Master()
|
|
count := new(OmWooperationartqtyreclst)
|
|
/**主键:****/
|
|
affw, err := e.Table(t.TableName()).ID(core.PK{t.Plantnr, t.Workorderid, t.Operationnr, t.Splitnr, t.Pos, t.Artid}).Count(count)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if affw > 0 {
|
|
return errors.New("数据已经存在!")
|
|
}
|
|
_, err = e.Table(t.TableName()).Insert(t)
|
|
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name :
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 数据删除
|
|
*
|
|
* @Function Parameters:
|
|
*
|
|
* @Return Value :
|
|
*
|
|
* @Author : Lou Wenzhi
|
|
*
|
|
* @Date : 2021/3/6 8:47
|
|
*
|
|
******************************************************************************/
|
|
func (t *OmWooperationartqtyreclst) Del() (err error) {
|
|
e := db.Eloquent.Master()
|
|
/**主键:****/
|
|
_, err = e.ID(core.PK{t.Plantnr, t.Workorderid, t.Operationnr, t.Splitnr, t.Pos, t.Artid}).Delete(&OmWooperationartqtyreclst{})
|
|
if err != nil {
|
|
return
|
|
}
|
|
return nil
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name :
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 数据修改
|
|
*
|
|
* @Function Parameters:
|
|
*
|
|
* @Return Value :
|
|
*
|
|
* @Author : Lou Wenzhi
|
|
*
|
|
* @Date : 2021/3/6 8:47
|
|
*
|
|
******************************************************************************/
|
|
func (t *OmWooperationartqtyreclst) Update() error {
|
|
e := db.Eloquent.Master()
|
|
/**主键:****/
|
|
_, err := e.ID(core.PK{t.Plantnr, t.Workorderid, t.Operationnr, t.Splitnr, t.Pos, t.Artid}).Update(t)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name :
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 数据查找
|
|
*
|
|
* @Function Parameters:
|
|
*
|
|
* @Return Value :
|
|
*
|
|
* @Author : Lou Wenzhi
|
|
*
|
|
* @Date : 2021/3/6 8:47
|
|
*
|
|
******************************************************************************/
|
|
func (t *OmWooperationartqtyreclst) SelectOne() (OmWooperationartqtyreclst, error) {
|
|
e := db.Eloquent.Master()
|
|
var data OmWooperationartqtyreclst
|
|
/**主键:****/
|
|
_, err := e.ID(core.PK{t.Plantnr, t.Workorderid, t.Operationnr, t.Splitnr, t.Pos, t.Artid}).Get(&data)
|
|
if err != nil {
|
|
return data, err
|
|
}
|
|
return data, nil
|
|
}
|