package models import ( "time" ) type DownloadedPlan struct { ID int64 `xorm:"'id' bigint(20) pk autoincr"` PastureID int64 `xorm:"'pastureid' bigint(20) not null"` MyDate time.Time `xorm:"'mydate' datetime not null comment('计划日期')"` ProjName string `xorm:"'projname' varchar(30) comment('计划编号')"` DataCaptureNo int `xorm:"'datacaptureno' int(11) comment('设备编号')"` TmrID int64 `xorm:"'tmrid' bigint(20) comment('tmr主键')"` TmrtName string `xorm:"'tmrtname' varchar(20) comment('tmr名称')"` HaveButton bool `xorm:"'havebutton' tinyint(1) default 0 comment('是否开始执行')"` InButtonType int `xorm:"'inbuttontype' int(11) default 0 comment('按钮类型')"` PlanTime string `xorm:"'plantime' varchar(50) comment('计划时分')"` InTime time.Time `xorm:"'intime' datetime comment('开始执行时间')"` CompletedTime time.Time `xorm:"'completedtime' datetime comment('结束执行时间')"` // ProcessTime string `xorm:"'processtime' time comment('过程时间')"` IsCompleted int `xorm:"'iscompleted' tinyint(4) default 0 comment('是否已完成')"` LpPlanType int `xorm:"'lpplantype' int(11) default 0 comment('计算模式')"` Times int `xorm:"'times' int(11) default 0 comment('班次')"` Sort int `xorm:"'sort' int(11) default 0 comment('顺序')"` Remark string `xorm:"'remark' varchar(50) comment('备注')"` ItemNum int `xorm:"'itemnum' int(11) comment('添加饲料种类数')"` OutItems int `xorm:"'outitems' int(11) comment('发料牛舍数')"` FeedPName string `xorm:"'feedpname' varchar(200) comment('牛舍列表')"` FeedPCount int `xorm:"'feedpcount' int(11) default 0 comment('牛头数')"` Pid int64 `xorm:"'pid' bigint(20) comment('发料计划编号')"` TempID int64 `xorm:"'tempid' bigint(20) comment('配方id')"` TempletName string `xorm:"'templetname' varchar(50) comment('配方模版名称')"` PtsTempID int64 `xorm:"'ptstempid' bigint(20) comment('补料配方id')"` PtsTempletName string `xorm:"'ptstempletname' varchar(50) comment('补料配方模版名称')"` ThoWeight string `xorm:"'thoweight' char(20) comment('配方理论干物质')"` FpWeight string `xorm:"'fpweight' char(20) comment('配方总重')"` LWeight float64 `xorm:"'lweight' decimal(38,2) comment('应做料总量')"` IWeight int `xorm:"'iweight' int(11) comment('实际做料总量')"` OWeight int `xorm:"'oweight' int(11) comment('实发料重量')"` TVersion int `xorm:"'tversion' int(11) default 0 comment('配方版本')"` PtVersion int `xorm:"'ptversion' int(11) default 0 comment('补料配方版本')"` Enable int `xorm:"'enable' tinyint(4) default 1 comment('是否启用')"` IsUse int `xorm:"'isUse' int(11) default 0 comment('是否使用')"` OldTmrID int64 `xorm:"'oldtmrid' bigint(20)"` DriverID int64 `xorm:"'driverId' bigint(20) comment('驾驶员')"` Artificial bool `xorm:"'artificial' tinyint(1) not null default 0 comment('手动完成')"` } func (d *DownloadedPlan) TableName() string { return "downloadedplan" } type DownloadPlanDtl1 struct { ID int64 `xorm:"'id' bigint(20) pk autoincr"` PastureID int64 `xorm:"'pastureid' bigint(20) not null"` Pid int64 `xorm:"'pid' bigint(20) not null comment('计划id')"` Flpid int64 `xorm:"'flpid' bigint(20) comment('发料计划的主id')"` Fid int64 `xorm:"'fid' bigint(20) not null comment('饲料id')"` LWeight float64 `xorm:"'lweight' decimal(20,2) not null comment('理论重量')"` Sort int `xorm:"'sort' int(11) not null default 0 comment('顺序')"` LastActualWeight float64 `xorm:"'lastactualweight' decimal(10,2) comment('上次重量')"` ActualWeight float64 `xorm:"'actualweight' decimal(10,2) comment('实际重量')"` ActualWeightMinus float64 `xorm:"'actualweightminus' decimal(10,2) comment('实际重量')"` HaveButton bool `xorm:"'havebuttom' tinyint(1) default 0 comment('是否操作')"` BeginTime time.Time `xorm:"'begintime' datetime comment('操作开始时间')"` InTime time.Time `xorm:"'intime' datetime comment('操作结束时间')"` ButtonType int `xorm:"'buttontype' int(11) default 0 comment('操作类型')"` OptDevice int64 `xorm:"'optdevice' bigint(20) comment('操作车id')"` FeedCode string `xorm:"'feedcode' varchar(50) comment('饲料编码')"` FName string `xorm:"'fname' varchar(120) comment('饲料名称')"` FeedSort int `xorm:"'feedsort' int(11) default 0 comment('饲料顺序')"` FeedAllowRatio float32 `xorm:"'feedallowratio' float default 0 comment('饲料允许误差率')"` StirDelay int `xorm:"'stirdelay' int(11) default 0 comment('搅拌延时(分钟)')"` FWeight float64 `xorm:"'fweight' decimal(10,3) comment('配方明细量')"` TmrLoadName string `xorm:"'tmrloadname' varchar(150) comment('相同饲料顺序在tmr车上的显示名称')"` DryFeed float64 `xorm:"'dryfeed' decimal(38,2) comment('饲料干物质')"` PriceFeed float64 `xorm:"'pricefeed' decimal(38,2) comment('饲料单价')"` OutWeight int `xorm:"'outweight' int(11) comment('人工确认出库量')"` ErrRatio float64 `xorm:"'errratio' decimal(38,2)"` Date time.Time `xorm:"'date' date not null"` ButtonSucc int `xorm:"'buttonsucc' tinyint(4)"` Type int `xorm:"'type' tinyint(4) default 0 comment('类型')"` Deviation int `xorm:"'deviation' int(11) comment('搅拌延时值允许延时偏差')"` XxwFeedCode string `xorm:"'xxwFeedCode' varchar(100)"` } func (d *DownloadPlanDtl1) TableName() string { return "downloadplandtl1" } // 如果需要定义索引,可以添加以下方法 func (d *DownloadPlanDtl1) TableIndex() [][]string { return [][]string{ {"pastureid", "flpid", "fid", "date", "pid"}, {"fid"}, {"date"}, {"pid", "pastureid"}, {"pastureid", "flpid", "type", "date"}, {"pastureid", "intime", "date"}, } } // 复合主键配置(XORM对复合主键支持有限,这里提供一种方式) func (d *DownloadPlanDtl1) PrimaryKeys() []string { return []string{"id", "pastureid", "date"} } // 或者使用ID作为主键,其他作为唯一索引 func (d *DownloadPlanDtl1) Id() int64 { return d.ID } type DownloadPlanDtl1Exec struct { ID int64 `xorm:"'id' bigint(20) pk autoincr"` PastureID int64 `xorm:"'pastureid' bigint(20) not null"` Pid int64 `xorm:"'pid' bigint(20) not null comment('计划id')"` Flpid int64 `xorm:"'flpid' bigint(20)"` LastActualWeight float64 `xorm:"'lastactualweight' decimal(10,2) comment('上次重量')"` ActualWeight float64 `xorm:"'actualweight' decimal(10,2) comment('本次重量')"` LWeight float64 `xorm:"'lweight' decimal(16,2) not null comment('理论重量')"` ActualWeightMinus float64 `xorm:"'actualweightminus' decimal(10,2) comment('实际重量')"` // BeginTime time.Time `xorm:"'begintime' datetime comment('操作开始时间')"` // InTime time.Time `xorm:"'intime' datetime comment('操作结束时间')"` HaveButton bool `xorm:"'havebuttom' tinyint(1) not null default 0 comment('是否已操作')"` ButtonType int `xorm:"'buttontype' int(11) default 0 comment('按钮类型')"` OptDevice int64 `xorm:"'optdevice' bigint(20) comment('操作车id')"` Sort int `xorm:"'sort' int(11) not null default 0 comment('顺序')"` FName string `xorm:"'fname' varchar(120) comment('饲料名称')"` FCount int `xorm:"'fcount' int(11) comment('饲料数')"` TmrLoadName string `xorm:"'tmrloadname' varchar(120) comment('相同饲料顺序在tmr车上的显示名称')"` FeedAllowRatio float32 `xorm:"'feedallowratio' float default 0 comment('饲料允许误差公斤')"` // ProcessTime string `xorm:"'processtime' time comment('过程时间')"` StirDelay int `xorm:"'stirdelay' int(11) default 0 comment('搅拌延时(分钟)')"` ButtonSucc int `xorm:"'buttonsucc' tinyint(4) default 0"` ErrRatio float64 `xorm:"'errratio' decimal(38,2)"` Date time.Time `xorm:"'date' date not null"` Type int `xorm:"'type' tinyint(4) default 0 comment('类型')"` Deviation int `xorm:"'deviation' int(11) comment('搅拌延时值允许延时偏差')"` XxwFeedCode string `xorm:"'xxwFeedCode' varchar(100)"` } func (d *DownloadPlanDtl1Exec) TableName() string { return "downloadplandtl1_exec" } // 定义索引 func (d *DownloadPlanDtl1Exec) TableIndex() [][]string { return [][]string{ {"pastureid", "pid", "sort", "date", "type"}, {"pid"}, {"pastureid", "pid"}, {"date", "pastureid"}, {"intime", "pastureid"}, {"flpid"}, } } // 复合主键配置 func (d *DownloadPlanDtl1Exec) PrimaryKeys() []string { return []string{"id", "pastureid", "date"} } // 如果需要使用ID作为主键,可以添加这个方法 func (d *DownloadPlanDtl1Exec) Id() int64 { return d.ID } type DownloadPlanDtl2 struct { ID int64 `xorm:"'id' bigint(20) pk autoincr"` PastureID int64 `xorm:"'pastureid' bigint(20) not null"` Pid int64 `xorm:"'pid' bigint(20) not null comment('计划id')"` Flpid int64 `xorm:"'flpid' bigint(20) comment('发料计划的主id')"` Fbarid int64 `xorm:"'fbarid' bigint(20) not null comment('牛舍id')"` FName string `xorm:"'fname' varchar(50) comment('牛舍名称')"` LastActualWeight float64 `xorm:"'lastactualweight' decimal(10,0) comment('上次重量')"` ActualWeight float64 `xorm:"'actualweight' decimal(10,2) comment('本次重量')"` LWeight float64 `xorm:"'lweight' decimal(16,2) comment('理论重量')"` LWeightHis float64 `xorm:"'lweighthis' decimal(10,2) comment('历史理论重量')"` RemainLeftW float64 `xorm:"'remainleftw' decimal(10,2) comment('剩料量')"` AllowRW float64 `xorm:"'allowrw' decimal(10,2) comment('允许分配剩料量')"` ActualWeightMinus float64 `xorm:"'actualweightminus' decimal(10,2) comment('实际重量')"` Sort int `xorm:"'sort' int(11) not null default 0 comment('顺序')"` HaveButton bool `xorm:"'havebuttom' tinyint(1) default 0 comment('是否操作')"` BeginTime time.Time `xorm:"'begintime' datetime comment('操作开始时间')"` BeginTag string `xorm:"'begintag' varchar(50) comment('开始标签')"` InTime time.Time `xorm:"'intime' datetime comment('操作完成时间')"` EndTag string `xorm:"'endtag' varchar(50) comment('结束标签')"` ButtonType int `xorm:"'buttontype' int(11) default 0 comment('操作按键类型')"` OptDevice int64 `xorm:"'optdevice' bigint(20) comment('操作车id')"` CowCount int `xorm:"'cowcount' int(11) default 0 comment('牛头数')"` CowClassID int64 `xorm:"'cowclassid' bigint(20) comment('牛只类型id')"` CowClassName string `xorm:"'cowclassname' varchar(50) comment('类型名称')"` BigCowName string `xorm:"'bigcowname' varchar(50)"` PWeight float64 `xorm:"'pweight' decimal(10,2) comment('通过加料计算出重量')"` CCountRatio float32 `xorm:"'ccountratio' float default 100 comment('牛头系数')"` SumRTime float32 `xorm:"'sumrtime' float default 0 comment('该班次比例')"` FeedTempletID int64 `xorm:"'feedtempletid' bigint(20) comment('配方模版id')"` FeedTempletName string `xorm:"'feedtempletname' varchar(20) comment('配方模版名称')"` DryWeight float64 `xorm:"'dryweight' decimal(10,2) comment('配方干物质')"` SumWeight float64 `xorm:"'sumweight' decimal(10,2) comment('配方饲料总重量')"` PriceWeight float64 `xorm:"'priceweight' decimal(10,2) comment('配方单价')"` // ProcessTime string `xorm:"'processtime' time comment('过程时间')"` Fpid int64 `xorm:"'fpid' bigint(20) comment('栏舍配方id')"` UseInBarType int64 `xorm:"'useinbartype' bigint(20) comment('转投栏舍类型')"` Date time.Time `xorm:"'date' date not null"` AllowRatio int `xorm:"'allowratio' int(11) comment('栏舍允许误差')"` ErrRatio float64 `xorm:"'errratio' decimal(38,2)"` ButtonSucc int `xorm:"'buttonsucc' tinyint(4)"` Type int `xorm:"'type' tinyint(4) default 0 comment('类型')"` XxwTempletCode string `xorm:"'xxwTempletCode' varchar(100)"` XxwBarCode string `xorm:"'xxwBarCode' varchar(100)"` } func (d *DownloadPlanDtl2) TableName() string { return "downloadplandtl2" } // 定义索引 func (d *DownloadPlanDtl2) TableIndex() [][]string { return [][]string{ {"fbarid"}, {"flpid"}, {"pid"}, {"intime"}, {"date"}, {"pastureid", "pid", "type"}, {"pastureid", "flpid", "type", "date"}, } } // 复合主键配置 func (d *DownloadPlanDtl2) PrimaryKeys() []string { return []string{"id", "pastureid", "date"} } // 获取ID的方法 func (d *DownloadPlanDtl2) Id() int64 { return d.ID }