downloadedplan.go 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. package models
  2. import (
  3. "time"
  4. )
  5. type DownloadedPlan struct {
  6. ID int64 `xorm:"'id' bigint(20) pk autoincr"`
  7. PastureID int64 `xorm:"'pastureid' bigint(20) not null"`
  8. MyDate time.Time `xorm:"'mydate' datetime not null comment('计划日期')"`
  9. ProjName string `xorm:"'projname' varchar(30) comment('计划编号')"`
  10. DataCaptureNo int `xorm:"'datacaptureno' int(11) comment('设备编号')"`
  11. TmrID int64 `xorm:"'tmrid' bigint(20) comment('tmr主键')"`
  12. TmrtName string `xorm:"'tmrtname' varchar(20) comment('tmr名称')"`
  13. HaveButton bool `xorm:"'havebutton' tinyint(1) default 0 comment('是否开始执行')"`
  14. InButtonType int `xorm:"'inbuttontype' int(11) default 0 comment('按钮类型')"`
  15. PlanTime string `xorm:"'plantime' varchar(50) comment('计划时分')"`
  16. InTime time.Time `xorm:"'intime' datetime comment('开始执行时间')"`
  17. CompletedTime time.Time `xorm:"'completedtime' datetime comment('结束执行时间')"`
  18. // ProcessTime string `xorm:"'processtime' time comment('过程时间')"`
  19. IsCompleted int `xorm:"'iscompleted' tinyint(4) default 0 comment('是否已完成')"`
  20. LpPlanType int `xorm:"'lpplantype' int(11) default 0 comment('计算模式')"`
  21. Times int `xorm:"'times' int(11) default 0 comment('班次')"`
  22. Sort int `xorm:"'sort' int(11) default 0 comment('顺序')"`
  23. Remark string `xorm:"'remark' varchar(50) comment('备注')"`
  24. ItemNum int `xorm:"'itemnum' int(11) comment('添加饲料种类数')"`
  25. OutItems int `xorm:"'outitems' int(11) comment('发料牛舍数')"`
  26. FeedPName string `xorm:"'feedpname' varchar(200) comment('牛舍列表')"`
  27. FeedPCount int `xorm:"'feedpcount' int(11) default 0 comment('牛头数')"`
  28. Pid int64 `xorm:"'pid' bigint(20) comment('发料计划编号')"`
  29. TempID int64 `xorm:"'tempid' bigint(20) comment('配方id')"`
  30. TempletName string `xorm:"'templetname' varchar(50) comment('配方模版名称')"`
  31. PtsTempID int64 `xorm:"'ptstempid' bigint(20) comment('补料配方id')"`
  32. PtsTempletName string `xorm:"'ptstempletname' varchar(50) comment('补料配方模版名称')"`
  33. ThoWeight string `xorm:"'thoweight' char(20) comment('配方理论干物质')"`
  34. FpWeight string `xorm:"'fpweight' char(20) comment('配方总重')"`
  35. LWeight float64 `xorm:"'lweight' decimal(38,2) comment('应做料总量')"`
  36. IWeight int `xorm:"'iweight' int(11) comment('实际做料总量')"`
  37. OWeight int `xorm:"'oweight' int(11) comment('实发料重量')"`
  38. TVersion int `xorm:"'tversion' int(11) default 0 comment('配方版本')"`
  39. PtVersion int `xorm:"'ptversion' int(11) default 0 comment('补料配方版本')"`
  40. Enable int `xorm:"'enable' tinyint(4) default 1 comment('是否启用')"`
  41. IsUse int `xorm:"'isUse' int(11) default 0 comment('是否使用')"`
  42. OldTmrID int64 `xorm:"'oldtmrid' bigint(20)"`
  43. DriverID int64 `xorm:"'driverId' bigint(20) comment('驾驶员')"`
  44. Artificial bool `xorm:"'artificial' tinyint(1) not null default 0 comment('手动完成')"`
  45. }
  46. func (d *DownloadedPlan) TableName() string {
  47. return "downloadedplan"
  48. }
  49. type DownloadPlanDtl1 struct {
  50. ID int64 `xorm:"'id' bigint(20) pk autoincr"`
  51. PastureID int64 `xorm:"'pastureid' bigint(20) not null"`
  52. Pid int64 `xorm:"'pid' bigint(20) not null comment('计划id')"`
  53. Flpid int64 `xorm:"'flpid' bigint(20) comment('发料计划的主id')"`
  54. Fid int64 `xorm:"'fid' bigint(20) not null comment('饲料id')"`
  55. LWeight float64 `xorm:"'lweight' decimal(20,2) not null comment('理论重量')"`
  56. Sort int `xorm:"'sort' int(11) not null default 0 comment('顺序')"`
  57. LastActualWeight float64 `xorm:"'lastactualweight' decimal(10,2) comment('上次重量')"`
  58. ActualWeight float64 `xorm:"'actualweight' decimal(10,2) comment('实际重量')"`
  59. ActualWeightMinus float64 `xorm:"'actualweightminus' decimal(10,2) comment('实际重量')"`
  60. HaveButton bool `xorm:"'havebuttom' tinyint(1) default 0 comment('是否操作')"`
  61. BeginTime time.Time `xorm:"'begintime' datetime comment('操作开始时间')"`
  62. InTime time.Time `xorm:"'intime' datetime comment('操作结束时间')"`
  63. ButtonType int `xorm:"'buttontype' int(11) default 0 comment('操作类型')"`
  64. OptDevice int64 `xorm:"'optdevice' bigint(20) comment('操作车id')"`
  65. FeedCode string `xorm:"'feedcode' varchar(50) comment('饲料编码')"`
  66. FName string `xorm:"'fname' varchar(120) comment('饲料名称')"`
  67. FeedSort int `xorm:"'feedsort' int(11) default 0 comment('饲料顺序')"`
  68. FeedAllowRatio float32 `xorm:"'feedallowratio' float default 0 comment('饲料允许误差率')"`
  69. StirDelay int `xorm:"'stirdelay' int(11) default 0 comment('搅拌延时(分钟)')"`
  70. FWeight float64 `xorm:"'fweight' decimal(10,3) comment('配方明细量')"`
  71. TmrLoadName string `xorm:"'tmrloadname' varchar(150) comment('相同饲料顺序在tmr车上的显示名称')"`
  72. DryFeed float64 `xorm:"'dryfeed' decimal(38,2) comment('饲料干物质')"`
  73. PriceFeed float64 `xorm:"'pricefeed' decimal(38,2) comment('饲料单价')"`
  74. OutWeight int `xorm:"'outweight' int(11) comment('人工确认出库量')"`
  75. ErrRatio float64 `xorm:"'errratio' decimal(38,2)"`
  76. Date time.Time `xorm:"'date' date not null"`
  77. ButtonSucc int `xorm:"'buttonsucc' tinyint(4)"`
  78. Type int `xorm:"'type' tinyint(4) default 0 comment('类型')"`
  79. Deviation int `xorm:"'deviation' int(11) comment('搅拌延时值允许延时偏差')"`
  80. XxwFeedCode string `xorm:"'xxwFeedCode' varchar(100)"`
  81. }
  82. func (d *DownloadPlanDtl1) TableName() string {
  83. return "downloadplandtl1"
  84. }
  85. // 如果需要定义索引,可以添加以下方法
  86. func (d *DownloadPlanDtl1) TableIndex() [][]string {
  87. return [][]string{
  88. {"pastureid", "flpid", "fid", "date", "pid"},
  89. {"fid"},
  90. {"date"},
  91. {"pid", "pastureid"},
  92. {"pastureid", "flpid", "type", "date"},
  93. {"pastureid", "intime", "date"},
  94. }
  95. }
  96. // 复合主键配置(XORM对复合主键支持有限,这里提供一种方式)
  97. func (d *DownloadPlanDtl1) PrimaryKeys() []string {
  98. return []string{"id", "pastureid", "date"}
  99. }
  100. // 或者使用ID作为主键,其他作为唯一索引
  101. func (d *DownloadPlanDtl1) Id() int64 {
  102. return d.ID
  103. }
  104. type DownloadPlanDtl1Exec struct {
  105. ID int64 `xorm:"'id' bigint(20) pk autoincr"`
  106. PastureID int64 `xorm:"'pastureid' bigint(20) not null"`
  107. Pid int64 `xorm:"'pid' bigint(20) not null comment('计划id')"`
  108. Flpid int64 `xorm:"'flpid' bigint(20)"`
  109. LastActualWeight float64 `xorm:"'lastactualweight' decimal(10,2) comment('上次重量')"`
  110. ActualWeight float64 `xorm:"'actualweight' decimal(10,2) comment('本次重量')"`
  111. LWeight float64 `xorm:"'lweight' decimal(16,2) not null comment('理论重量')"`
  112. ActualWeightMinus float64 `xorm:"'actualweightminus' decimal(10,2) comment('实际重量')"`
  113. // BeginTime time.Time `xorm:"'begintime' datetime comment('操作开始时间')"`
  114. // InTime time.Time `xorm:"'intime' datetime comment('操作结束时间')"`
  115. HaveButton bool `xorm:"'havebuttom' tinyint(1) not null default 0 comment('是否已操作')"`
  116. ButtonType int `xorm:"'buttontype' int(11) default 0 comment('按钮类型')"`
  117. OptDevice int64 `xorm:"'optdevice' bigint(20) comment('操作车id')"`
  118. Sort int `xorm:"'sort' int(11) not null default 0 comment('顺序')"`
  119. FName string `xorm:"'fname' varchar(120) comment('饲料名称')"`
  120. FCount int `xorm:"'fcount' int(11) comment('饲料数')"`
  121. TmrLoadName string `xorm:"'tmrloadname' varchar(120) comment('相同饲料顺序在tmr车上的显示名称')"`
  122. FeedAllowRatio float32 `xorm:"'feedallowratio' float default 0 comment('饲料允许误差公斤')"`
  123. // ProcessTime string `xorm:"'processtime' time comment('过程时间')"`
  124. StirDelay int `xorm:"'stirdelay' int(11) default 0 comment('搅拌延时(分钟)')"`
  125. ButtonSucc int `xorm:"'buttonsucc' tinyint(4) default 0"`
  126. ErrRatio float64 `xorm:"'errratio' decimal(38,2)"`
  127. Date time.Time `xorm:"'date' date not null"`
  128. Type int `xorm:"'type' tinyint(4) default 0 comment('类型')"`
  129. Deviation int `xorm:"'deviation' int(11) comment('搅拌延时值允许延时偏差')"`
  130. XxwFeedCode string `xorm:"'xxwFeedCode' varchar(100)"`
  131. }
  132. func (d *DownloadPlanDtl1Exec) TableName() string {
  133. return "downloadplandtl1_exec"
  134. }
  135. // 定义索引
  136. func (d *DownloadPlanDtl1Exec) TableIndex() [][]string {
  137. return [][]string{
  138. {"pastureid", "pid", "sort", "date", "type"},
  139. {"pid"},
  140. {"pastureid", "pid"},
  141. {"date", "pastureid"},
  142. {"intime", "pastureid"},
  143. {"flpid"},
  144. }
  145. }
  146. // 复合主键配置
  147. func (d *DownloadPlanDtl1Exec) PrimaryKeys() []string {
  148. return []string{"id", "pastureid", "date"}
  149. }
  150. // 如果需要使用ID作为主键,可以添加这个方法
  151. func (d *DownloadPlanDtl1Exec) Id() int64 {
  152. return d.ID
  153. }
  154. type DownloadPlanDtl2 struct {
  155. ID int64 `xorm:"'id' bigint(20) pk autoincr"`
  156. PastureID int64 `xorm:"'pastureid' bigint(20) not null"`
  157. Pid int64 `xorm:"'pid' bigint(20) not null comment('计划id')"`
  158. Flpid int64 `xorm:"'flpid' bigint(20) comment('发料计划的主id')"`
  159. Fbarid int64 `xorm:"'fbarid' bigint(20) not null comment('牛舍id')"`
  160. FName string `xorm:"'fname' varchar(50) comment('牛舍名称')"`
  161. LastActualWeight float64 `xorm:"'lastactualweight' decimal(10,0) comment('上次重量')"`
  162. ActualWeight float64 `xorm:"'actualweight' decimal(10,2) comment('本次重量')"`
  163. LWeight float64 `xorm:"'lweight' decimal(16,2) comment('理论重量')"`
  164. LWeightHis float64 `xorm:"'lweighthis' decimal(10,2) comment('历史理论重量')"`
  165. RemainLeftW float64 `xorm:"'remainleftw' decimal(10,2) comment('剩料量')"`
  166. AllowRW float64 `xorm:"'allowrw' decimal(10,2) comment('允许分配剩料量')"`
  167. ActualWeightMinus float64 `xorm:"'actualweightminus' decimal(10,2) comment('实际重量')"`
  168. Sort int `xorm:"'sort' int(11) not null default 0 comment('顺序')"`
  169. HaveButton bool `xorm:"'havebuttom' tinyint(1) default 0 comment('是否操作')"`
  170. BeginTime time.Time `xorm:"'begintime' datetime comment('操作开始时间')"`
  171. BeginTag string `xorm:"'begintag' varchar(50) comment('开始标签')"`
  172. InTime time.Time `xorm:"'intime' datetime comment('操作完成时间')"`
  173. EndTag string `xorm:"'endtag' varchar(50) comment('结束标签')"`
  174. ButtonType int `xorm:"'buttontype' int(11) default 0 comment('操作按键类型')"`
  175. OptDevice int64 `xorm:"'optdevice' bigint(20) comment('操作车id')"`
  176. CowCount int `xorm:"'cowcount' int(11) default 0 comment('牛头数')"`
  177. CowClassID int64 `xorm:"'cowclassid' bigint(20) comment('牛只类型id')"`
  178. CowClassName string `xorm:"'cowclassname' varchar(50) comment('类型名称')"`
  179. BigCowName string `xorm:"'bigcowname' varchar(50)"`
  180. PWeight float64 `xorm:"'pweight' decimal(10,2) comment('通过加料计算出重量')"`
  181. CCountRatio float32 `xorm:"'ccountratio' float default 100 comment('牛头系数')"`
  182. SumRTime float32 `xorm:"'sumrtime' float default 0 comment('该班次比例')"`
  183. FeedTempletID int64 `xorm:"'feedtempletid' bigint(20) comment('配方模版id')"`
  184. FeedTempletName string `xorm:"'feedtempletname' varchar(20) comment('配方模版名称')"`
  185. DryWeight float64 `xorm:"'dryweight' decimal(10,2) comment('配方干物质')"`
  186. SumWeight float64 `xorm:"'sumweight' decimal(10,2) comment('配方饲料总重量')"`
  187. PriceWeight float64 `xorm:"'priceweight' decimal(10,2) comment('配方单价')"`
  188. // ProcessTime string `xorm:"'processtime' time comment('过程时间')"`
  189. Fpid int64 `xorm:"'fpid' bigint(20) comment('栏舍配方id')"`
  190. UseInBarType int64 `xorm:"'useinbartype' bigint(20) comment('转投栏舍类型')"`
  191. Date time.Time `xorm:"'date' date not null"`
  192. AllowRatio int `xorm:"'allowratio' int(11) comment('栏舍允许误差')"`
  193. ErrRatio float64 `xorm:"'errratio' decimal(38,2)"`
  194. ButtonSucc int `xorm:"'buttonsucc' tinyint(4)"`
  195. Type int `xorm:"'type' tinyint(4) default 0 comment('类型')"`
  196. XxwTempletCode string `xorm:"'xxwTempletCode' varchar(100)"`
  197. XxwBarCode string `xorm:"'xxwBarCode' varchar(100)"`
  198. }
  199. func (d *DownloadPlanDtl2) TableName() string {
  200. return "downloadplandtl2"
  201. }
  202. // 定义索引
  203. func (d *DownloadPlanDtl2) TableIndex() [][]string {
  204. return [][]string{
  205. {"fbarid"},
  206. {"flpid"},
  207. {"pid"},
  208. {"intime"},
  209. {"date"},
  210. {"pastureid", "pid", "type"},
  211. {"pastureid", "flpid", "type", "date"},
  212. }
  213. }
  214. // 复合主键配置
  215. func (d *DownloadPlanDtl2) PrimaryKeys() []string {
  216. return []string{"id", "pastureid", "date"}
  217. }
  218. // 获取ID的方法
  219. func (d *DownloadPlanDtl2) Id() int64 {
  220. return d.ID
  221. }