update.sql 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. ALTER TABLE `tmrwatch2`.`tmr`
  2. ADD COLUMN `gps` varchar(50) NULL AFTER `lastinorout`;
  3. ALTER TABLE `tmrwatch2`.`downloadedplan`
  4. ADD COLUMN `driverId` bigint NOT NULL DEFAULT 0 COMMENT '驾驶员' ;
  5. ALTER TABLE `tmrwatch2`.`tmr`
  6. ADD INDEX(`pastureid`, `gps`);
  7. ALTER TABLE `tmrwatch2`.`pasture`
  8. ADD COLUMN `werks` varchar(30) NULL AFTER `isgroups`;
  9. ALTER TABLE `tmrwatch2`.`bar`
  10. ADD COLUMN `AUFNR` varchar(50) NULL COMMENT 'sap牛群订单行号' AFTER `backup2`;
  11. ALTER TABLE `tmrwatch2`.`bar`
  12. ADD COLUMN `class` varchar(50) NULL COMMENT '牛舍类型' AFTER `AUFNR`,
  13. ADD COLUMN `classcode` varchar(50) NULL COMMENT '牛舍类型编码' AFTER `class`,
  14. ADD COLUMN `cattle` varchar(50) NULL COMMENT '牛群' AFTER `classcode`,
  15. ADD COLUMN `cattlecode` varchar(50) NULL COMMENT '牛群编码' AFTER `cattle`;
  16. ALTER TABLE `tmrwatch2`.`bar`
  17. ADD COLUMN `sapCode` varchar(50) NULL AFTER `cattlecode`;
  18. ALTER TABLE `tmrwatch2`.`feed`
  19. ADD COLUMN `sapMtart` bigint(20) DEFAULT NULL COMMENT 'sap编码',
  20. ADD COLUMN `sapGewei` varchar(20) DEFAULT NULL COMMENT 'sap单位',
  21. ADD COLUMN `sapLGPRO` varchar(20) DEFAULT NULL COMMENT 'sap牧场编码',
  22. ADD COLUMN `sapCHARG` varchar(20) DEFAULT NULL,
  23. ADD COLUMN `sapCode` varchar(20) DEFAULT NULL;
  24. ALTER TABLE `tmrwatch2`.`feed`
  25. MODIFY COLUMN `sapCode` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT 'sap编码' AFTER `sapCHARG`,
  26. ADD COLUMN `sapMaterialtype` varchar(50) NULL COMMENT 'sap物料类型' AFTER `sapCode`,
  27. ADD COLUMN `sapGoods` varchar(50) NULL COMMENT 'sap货位' AFTER `sapMaterialtype`;
  28. ALTER TABLE `tmrwatch2`.`feedtemplet`
  29. ADD COLUMN `cattle` varchar(30) NULL COMMENT '牛群类别' AFTER `backup2`;
  30. CREATE TABLE `saplog` (
  31. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  32. `pastureId` varchar(20) DEFAULT NULL,
  33. `request` longtext DEFAULT NULL,
  34. `response` longtext DEFAULT NULL,
  35. `status` varchar(20) DEFAULT NULL,
  36. `msgtext` varchar(255) DEFAULT NULL,
  37. `url` varchar(255) DEFAULT NULL,
  38. `createTime` datetime DEFAULT NULL ON UPDATE current_timestamp(),
  39. `msgtype` int(1) DEFAULT NULL COMMENT '0饲喂 1剩料 2原料 3栏舍 4配方 5栏舍牛头数 6库存',
  40. `dataDate` varchar(20) DEFAULT NULL COMMENT '数据日期',
  41. PRIMARY KEY (`id`)
  42. ) ENGINE=InnoDB AUTO_INCREMENT=2039 DEFAULT CHARSET=utf8mb3;
  43. CREATE TABLE `dist` (
  44. `id` int(11) NOT NULL AUTO_INCREMENT,
  45. `distType` varchar(30) DEFAULT NULL,
  46. `distName` varchar(50) DEFAULT NULL,
  47. `distCode` varchar(50) DEFAULT NULL,
  48. `remark` varchar(50) DEFAULT NULL,
  49. PRIMARY KEY (`id`) USING BTREE
  50. ) ENGINE=InnoDB AUTO_INCREMENT=321 DEFAULT CHARSET=utf8mb3 ROW_FORMAT=COMPACT;
  51. CREATE TABLE `cattleorder` (
  52. `AUFNR` varchar(20) NOT NULL COMMENT '订单号',
  53. `KTEXT` varchar(50) DEFAULT NULL COMMENT '订单描述',
  54. `ZNZLX` varchar(50) DEFAULT NULL COMMENT '牛只类型 A-母犊牛 B-母育成牛 C-母青年牛 D-母泌乳牛 E-母干奶牛 F-公牛',
  55. `AUART` varchar(50) DEFAULT NULL COMMENT '订单类型编码',
  56. `AUTXT` varchar(50) DEFAULT NULL COMMENT '订单类型名称',
  57. `BUKRS` varchar(50) DEFAULT NULL COMMENT '公司代码',
  58. `BUTXT` varchar(50) DEFAULT NULL COMMENT '公司代码名称',
  59. PRIMARY KEY (`AUFNR`)
  60. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
  61. ALTER TABLE `feedtemplet`
  62. ADD COLUMN
  63. `volume` DECIMAL(12,2) NOT NULL DEFAULT 0.00 COMMENT '容积';
  64. ALTER TABLE `tmr`
  65. ADD COLUMN
  66. `volume` DECIMAL(12,2) NOT NULL DEFAULT 0.00 COMMENT '容积';
  67. ALTER TABLE `feedtemplethistory`
  68. ADD COLUMN
  69. `volume` DECIMAL(12,2) NOT NULL DEFAULT 0.00 COMMENT '容积';
  70. ALTER TABLE `feedtempletdate`
  71. ADD COLUMN
  72. `volume` DECIMAL(12,2) NOT NULL DEFAULT 0.00 COMMENT '容积';
  73. ALTER TABLE `feedtemplethistory`
  74. ADD COLUMN `userId` varchar(30) NULL COMMENT '修改用户' AFTER `volume`;
  75. ALTER TABLE `fpdetailhistory`
  76. ADD COLUMN `userId` varchar(30) NULL COMMENT '修改用户' AFTER `createdate`;
  77. ALTER TABLE `feedphistory`
  78. ADD COLUMN `userId` varchar(30) NULL COMMENT '修改用户' AFTER `createdate`;
  79. ALTER TABLE `lpplandtl1history`
  80. ADD COLUMN `userId` varchar(30) NULL COMMENT '修改用户' AFTER `createdate`;
  81. ALTER TABLE `fit_history`
  82. ADD COLUMN `userId` varchar(30) NULL AFTER `feedgroup`;
  83. ALTER TABLE `fpdetail`
  84. MODIFY COLUMN `ptsid` bigint NOT NULL DEFAULT -1 COMMENT '补料配方' AFTER `ptid`;
  85. ALTER TABLE `fpdetail`
  86. MODIFY COLUMN `ptid` bigint NOT NULL DEFAULT 0 COMMENT '配方模板' AFTER `ccountradio`;
  87. INSERT INTO `cowclass` (`id`, `pastureid`, `classcode`, `classname`, `sort`, `parentid`, `parentname`)
  88. select ccid,pastureId,ccname,ccname,ccid,ccid,ccname from feedtemplet group by ccid,pastureId
  89. ALTER TABLE `ftdry`
  90. ADD COLUMN `excess` tinyint(1) NULL DEFAULT 0 AFTER `ftid`
  91. ALTER TABLE `tmrwatch2`.`feed`
  92. ADD COLUMN `udname` varchar(50) NULL AFTER `sapGoods`
  93. delete from `cowclass` ;
  94. INSERT INTO `cowclass` (`id`, `pastureid`, `classcode`, `classname`, `sort`, `parentid`, `parentname`)
  95. select ccid,pastureId,ccname,ccname,ccid,ccid,ccname from feedtemplet group by ccid,pastureId;
  96. ALTER TABLE `ftdry`
  97. ADD COLUMN `excess` tinyint(1) NULL DEFAULT 0 AFTER `ftid`;
  98. ALTER TABLE `feed`
  99. ADD COLUMN `udname` varchar(50) NULL AFTER `sapGoods`;
  100. INSERT INTO `sysopt` (`pastureid`, `inforname`, `inforvalue`) VALUES ( (select column_default as pastureid from information_schema.COLUMNS
  101. WHERE table_name = 'recweight' AND table_schema = 'tmrwatch2' AND column_name = 'pastureid'), 'gmUdSync', '0');
  102. INSERT INTO `sysopt` (`pastureid`, `inforname`, `inforvalue`) VALUES ( (select column_default as pastureid from information_schema.COLUMNS
  103. WHERE table_name = 'recweight' AND table_schema = 'tmrwatch2' AND column_name = 'pastureid'), 'udFeedpSync', '1');
  104. RENAME TABLE apisql TO apisql231228;
  105. INSERT INTO `sysopt` (`pastureid`, `inforname`, `inforvalue`) VALUES ( (select column_default as pastureid from information_schema.COLUMNS
  106. WHERE table_name = 'recweight' AND table_schema = 'tmrwatch2' AND column_name = 'pastureid'), 'domain', 'http://122.114.177.195:8082');
  107. INSERT INTO `sysopt` (`pastureid`, `inforname`, `inforvalue`) VALUES ( (select column_default as pastureid from information_schema.COLUMNS
  108. WHERE table_name = 'recweight' AND table_schema = 'tmrwatch2' AND column_name = 'pastureid'), 'sprinkleFeedTimeAllow', '10');
  109. ALTER TABLE downloadplandtl1_exec ADD COLUMN `xxwFeedCode` varchar(100) DEFAULT NULL;
  110. ALTER TABLE downloadplandtl2 ADD COLUMN `xxwTempletCode` varchar(100) DEFAULT NULL, ADD COLUMN `xxwBarCode` varchar(100) DEFAULT NULL;
  111. ALTER TABLE downloadplandtl1 ADD COLUMN `xxwFeedCode` varchar(100) DEFAULT NULL;
  112. ALTER TABLE feedtemplet ADD COLUMN `xxwTempletCode` varchar(100) DEFAULT NULL;
  113. ALTER TABLE bar ADD COLUMN `xxwBarCode`varchar(50) DEFAULT NULL;
  114. ALTER TABLE feed ADD COLUMN `xxwFeedCode` varchar(100) DEFAULT NULL;
  115. ALTER TABLE `barfeedremain`
  116. ADD COLUMN `dry` decimal(12, 2) NULL COMMENT '干物质' ;
  117. ALTER TABLE `feedtemplethistory`
  118. ADD COLUMN `volume` decimal(12, 2) NULL AFTER `userId`;
  119. ALTER TABLE `feedtemplet`
  120. ADD COLUMN `is_modify` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '是否可修改 0 无效 1 是 2 否',
  121. ADD COLUMN `group_data_id` bigint(11) unsigned NOT NULL DEFAULT '0' COMMENT '集团端数据ID',
  122. ADD COLUMN `group_version` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '集团端版本号';
  123. ALTER TABLE .`bar`
  124. ADD COLUMN `udcode` varchar(50) NULL AFTER `sapCode`,
  125. ADD COLUMN `udname` varchar(50) NULL AFTER `udcode`;
  126. ALTER TABLE `feedtemplet`
  127. ADD COLUMN `autozone` int NOT NULL DEFAULT 0 AFTER `group_version`;
  128. ALTER TABLE `downloadedplan`
  129. ADD COLUMN `artificial` tinyint(1) NOT NULL DEFAULT 0 COMMENT '1 为手动完成' AFTER `driverId`;
  130. CREATE TABLE `tmr_gear` (
  131. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  132. `tmrId` int(11) NOT NULL,
  133. `gear` varchar(30) DEFAULT NULL COMMENT '档位',
  134. `rev` int(11) DEFAULT NULL COMMENT '转速/分钟',
  135. `volume` decimal(12,5) DEFAULT NULL COMMENT '每转体积',
  136. PRIMARY KEY (`id`)
  137. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
  138. ALTER TABLE `tmr`
  139. ADD COLUMN `speed` decimal(12, 0) NOT NULL DEFAULT 0 COMMENT '速度' AFTER `volume`;
  140. ALTER TABLE bar
  141. ADD COLUMN `length` decimal(12, 0) NOT NULL DEFAULT 0 COMMENT '栏舍长度' AFTER `udname`;
  142. ALTER TABLE `bar`
  143. ADD COLUMN `pen` varchar(30) NULL COMMENT '圈舍' AFTER `length`;
  144. INSERT INTO `sysopt` (`id`, `pastureid`, `inforname`, `inforvalue`) VALUES (3029240269385600828, (select column_default as pastureid from information_schema.COLUMNS
  145. WHERE table_name = 'recweight' AND table_schema = 'tmrwatch2' AND column_name = 'pastureid'), 'yhfeedtemplet', '1')
  146. INSERT INTO sysopt (`id`, `pastureid`, `inforname`, `inforvalue`)
  147. VALUES (3029240269385600829,(select column_default as pastureid from information_schema.COLUMNS
  148. WHERE table_name = 'recweight' AND table_schema = 'tmrwatch2' AND column_name = 'pastureid'), 'yhautosecond', '0')
  149. ALTER TABLE `ftdetail` ADD COLUMN
  150. `is_show` tinyint(1) unsigned NOT NULL DEFAULT 1 COMMENT '是否显示 0 无效 1 显示 2 隐藏';
  151. CREATE TABLE `resetplan` (
  152. `id` bigint(20) NOT NULL,
  153. `sort` int(11) NOT NULL DEFAULT 0,
  154. `status` tinyint(1) NOT NULL DEFAULT 0,
  155. `mydate` datetime NOT NULL,
  156. `plansort` int(11) DEFAULT 0,
  157. `lastsort` int(11) DEFAULT 0,
  158. `lastweight` decimal(12,4) DEFAULT NULL,
  159. `weight` decimal(12,4) DEFAULT 0.0000,
  160. `datacaptureno` int(11) DEFAULT NULL,
  161. PRIMARY KEY (`id`),
  162. UNIQUE KEY `id` (`id`)
  163. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
  164. ALTER TABLE `ftdetail`
  165. ADD COLUMN `shutdown` tinyint(1) NOT NULL DEFAULT 0 COMMENT '停机时间 秒' AFTER `is_show`;
  166. ALTER TABLE `tmr`
  167. ADD COLUMN `shutdown` tinyint(1) NULL DEFAULT 0 COMMENT '停机时间 秒' AFTER `speed`;
  168. ALTER TABLE `tmr`
  169. ADD COLUMN `appoint` int NULL COMMENT '撒料车指定搅拌车' AFTER `shutdown`;
  170. ALTER TABLE `tmrwatch2`.`downloadplandtl1`
  171. DROP INDEX `downloadplandtl1_uni`,
  172. ADD UNIQUE INDEX `downloadplandtl1_uni`(`pastureid`, `flpid`, `fid`, `date`, `pid`, `type`) USING BTREE;
  173. CREATE TABLE `surplus` (
  174. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  175. `pastureId` int(11) DEFAULT NULL,
  176. `surplus` varchar(50) DEFAULT NULL,
  177. `feedId` bigint(20) DEFAULT NULL,
  178. PRIMARY KEY (`id`),
  179. UNIQUE KEY `surplus` (`surplus`)
  180. ) ENGINE=InnoDB AUTO_INCREMENT=180 DEFAULT CHARSET=utf8mb3;
  181. ALTER TABLE `feedtemplet`
  182. ADD COLUMN `surplus` int NULL COMMENT '剩料配置' AFTER `autozone`;
  183. ALTER TABLE `ftdetail`
  184. ADD COLUMN `is_surplus` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0 不是剩料' AFTER `shutdown`;
  185. ALTER TABLE `downloadplandtl1_exec`
  186. ADD COLUMN `surplus` decimal(10, 2) NULL COMMENT '剩料重量' AFTER `xxwFeedCode`;
  187. INSERT INTO `dictlist` ( `pid`, `pastureId`, `label`, `value`, `orderby`, `enable`) VALUES ( 19, NULL, '剩料', '5', NULL, 1);
  188. INSERT INTO sysopt (`id`, `pastureid`, `inforname`, `inforvalue`)
  189. VALUES (3029240269385600831,(select column_default as pastureid from information_schema.COLUMNS
  190. WHERE table_name = 'recweight' AND table_schema = 'tmrwatch2' AND column_name = 'pastureid'), 'language', '0');
  191. INSERT INTO sysopt (`id`, `pastureid`, `inforname`, `inforvalue`)
  192. VALUES (3029240269385600832,(select column_default as pastureid from information_schema.COLUMNS
  193. WHERE table_name = 'recweight' AND table_schema = 'tmrwatch2' AND column_name = 'pastureid'), 'YynSync', '1');