feedp.jsp 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  1. <%@ page contentType="text/html; charset=utf-8" session="false" %>
  2. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
  4. <head>
  5. <title>我的工作台</title>
  6. <%@ include file="../common/header.jsp" %>
  7. <link type="text/css" rel="stylesheet" href="${contextPath}/css/themes/easyui.css" />
  8. <script type="text/javascript" src="${contextPath }/js/jquery.easyui.min.js"></script>
  9. <script type="text/javascript">
  10. var mydata,currentId="",isEnableSupplyFeed=0,isMorningPart=0,isNoonPart=0,isNightPart=0,selCurrentId=0,
  11. colName,Calculation = 0,northType=0,southType=1,isSelTr = 0,isShowAvgAgeAndDay=0,Reserved6 = 0,Reserved7 = 0,isLocking = 0,oldUpdateValue = 0;
  12. $(document).ready( function() {
  13. getDefaultConfig();//获取系统默认参数是否启用补料模版,各班比例
  14. loadList(); //加载jqgrid
  15. setTimeout(function(){
  16. $('body').layout('collapse','north');
  17. },0);
  18. $("body").layout("panel","south").panel({
  19. onClose: function(){
  20. panelC = $("body").layout("panel","center").panel();
  21. $("#list").jqGrid("setGridHeight",panelC.height()-60);
  22. southType = 0;
  23. },
  24. onExpand: function(){
  25. if(northType == 0){
  26. panelS = $("body").layout("panel","south").panel();
  27. panelCHeight = document.body.clientHeight - panelS.height();
  28. $("#list").jqGrid("setGridHeight",panelCHeight-160);
  29. }else{
  30. panelS = $("body").layout("panel","south").panel();
  31. panelN = $("body").layout("panel","north").panel();
  32. panelCHeight = document.body.clientHeight - panelS.height() - panelN.height();
  33. $("#list").jqGrid("setGridHeight",panelCHeight-170);
  34. }
  35. southType = 1;
  36. },
  37. onResize: function(){
  38. panelS = $("body").layout("panel","south").panel();
  39. panelN = $("body").layout("panel","north").panel();
  40. if(northType == 0){
  41. panelCHeight = document.body.clientHeight - panelS.height();
  42. }else{
  43. panelCHeight = document.body.clientHeight - panelS.height() - panelN.height() - 10;
  44. }
  45. $("#list").jqGrid("setGridHeight",panelCHeight-160);
  46. $("#list").jqGrid("setGridWidth",document.body.clientWidth - 30);
  47. $("#fpdetaillist").jqGrid("setGridHeight",panelS.height()-55);
  48. $("#fpdetaillist").jqGrid("setGridWidth",document.body.clientWidth - 30);
  49. }
  50. });
  51. $("body").layout("panel","north").panel({
  52. onClose: function(){
  53. panelC = $("body").layout("panel","center").panel();
  54. $("#list").jqGrid("setGridHeight",panelC.height()-55);
  55. $("#list").jqGrid("setGridWidth",document.body.clientWidth - 30);
  56. northType = 0;
  57. },
  58. onExpand: function(){
  59. panelC = $("body").layout("panel","center").panel();
  60. $("#list").jqGrid("setGridHeight",panelC.height()-55);
  61. northType = 1;
  62. }
  63. });
  64. //如果是重量模式、添加按钮
  65. if(Calculation == 0){
  66. $("#rgBtn").hide();
  67. }else{
  68. $("#rgBtn").show();
  69. }
  70. });
  71. $(window).resize(function(){
  72. $("#list").jqGrid("setGridWidth",document.body.clientWidth - 10);
  73. $("#fpdetaillist").jqGrid("setGridWidth",document.body.clientWidth - 10);
  74. });
  75. //jqgrid初始化
  76. function loadList(){
  77. jQuery("#list").jqGrid({
  78. datatype: "local", //从服务器端返回的数据类型,(表格期望接收的数据类型)。可选类型:xml,xmlstring,json,local,function
  79. height: 170, //高度
  80. colNames: colName,
  81. colModel:[
  82. {
  83. name: "ID",
  84. index: "ID",
  85. align: "center",
  86. sorttype: "string",
  87. editable: true,
  88. hidden: true
  89. //editoptions:{readonly:true} 如果要显示该列可以设置只读
  90. },
  91. {
  92. name: "BNAME",
  93. index: "BNAME",
  94. align: "center",
  95. sorttype: "string",
  96. editable: false
  97. },
  98. {
  99. name: "lpplanDry",
  100. index: "lpplanDry",
  101. width: 150,
  102. align: "center",
  103. sorttype: "string",
  104. editable: false
  105. },
  106. {
  107. name: "CCountRatioRtime",
  108. index: "CCountRatioRtime",
  109. width: 150,
  110. align: "center",
  111. sorttype: "string",
  112. editable: true
  113. },
  114. {
  115. name: "beginTime",
  116. index: "beginTime",
  117. width: 150,
  118. align: "center",
  119. sorttype: "string",
  120. editable: true,
  121. hidden: true
  122. },
  123. {
  124. name: "CCOUNT",
  125. index: "CCOUNT",
  126. align: "center",
  127. sorttype: "string",
  128. editable: true,
  129. editrules: {integer: true}
  130. },
  131. {
  132. name: "softCowCount",
  133. index: "softCowCount",
  134. width: 150,
  135. align: "center",
  136. sorttype: "string",
  137. editable: false
  138. },
  139. {
  140. name: "CCountRatio",
  141. index: "CCountRatio",
  142. align: "center",
  143. sorttype: "string",
  144. editable: true,
  145. editrules: {number: true}
  146. },
  147. {
  148. name: "CCountRatioCCOUNT",
  149. index: "CCountRatioCCOUNT",
  150. align: "center",
  151. sorttype: "string",
  152. editable: true
  153. },
  154. {
  155. name: "AvgDim",
  156. index: "AvgDim",
  157. width: 150,
  158. align: "center",
  159. sorttype: "string",
  160. editable: false
  161. },
  162. {
  163. name: "AvgMonthAge",
  164. index: "AvgMonthAge",
  165. width: 150,
  166. align: "center",
  167. sorttype: "string",
  168. editable: false
  169. },
  170. {
  171. name: "PFMB",
  172. index: "PFMB",
  173. align: "center",
  174. sorttype: "int",
  175. editable: true,
  176. edittype: "select",
  177. editoptions:{
  178. dataUrl: "${contextPath }/admin/recipeplan/feedp1select.html"
  179. }
  180. },
  181. {
  182. name: "BLMB",
  183. index: "BLMB",
  184. align: "center",
  185. sorttype: "int",
  186. editable: true,
  187. edittype: "select",
  188. editoptions:{
  189. dataUrl: "${contextPath }/admin/recipeplan/feedp2select.html"
  190. },hidden: true
  191. },
  192. {
  193. name: "ztFeedpName",
  194. index: "ztFeedpName",
  195. align: "center",
  196. sorttype: "int",
  197. editable: true,
  198. edittype: "select",
  199. editoptions:{
  200. dataUrl: "${contextPath }/admin/produce/produceselect.html",
  201. }
  202. },
  203. {
  204. name: "ztRtime",
  205. index: "ztRtime",
  206. align: "center",
  207. sorttype: "string",
  208. editable: true,
  209. edittype:"select",
  210. editoptions:{value:{"":"","早班1":"早班1","早班2":"早班2","中班1":"中班1","中班2":"中班2","晚班1":"晚班1","晚班2":"晚班2"}}
  211. },
  212. {
  213. name: "Rtime1",
  214. index: "Rtime1",
  215. align: "center",
  216. sorttype: "int",
  217. editable: true,
  218. editrules: {number: true}
  219. },
  220. {
  221. name: "Rtime2",
  222. index: "Rtime2",
  223. align: "center",
  224. sorttype: "int",
  225. editable: true,
  226. editrules: {number: true},hidden: true
  227. },
  228. {
  229. name: "Rtime3",
  230. index: "Rtime3",
  231. align: "center",
  232. sorttype: "int",
  233. editable: true,
  234. editrules: {number: true}
  235. },
  236. {
  237. name: "Rtime4",
  238. index: "Rtime4",
  239. align: "center",
  240. sorttype: "int",
  241. editable: true,
  242. editrules: {number: true},hidden: true
  243. },
  244. {
  245. name: "Rtime5",
  246. index: "Rtime5",
  247. align: "center",
  248. sorttype: "int",
  249. editable: true,
  250. editrules: {number: true}
  251. },
  252. {
  253. name: "Rtime6",
  254. index: "Rtime6",
  255. align: "center",
  256. sorttype: "int",
  257. editable: true,
  258. editrules: {number: true},hidden: true
  259. },
  260. {name: "sel1",index: "sel1",align: "center",sorttype: "int",editrules: {number: true},hidden: true},
  261. {name: "sel2",index: "sel2",align: "center",sorttype: "int",editrules: {number: true},hidden: true},
  262. {name: "sel3",index: "sel3",align: "center",sorttype: "int",editrules: {number: true},hidden: true},
  263. {name: "sel4",index: "sel4",align: "center",sorttype: "int",editrules: {number: true},hidden: true},
  264. {name: "sel5",index: "sel5",align: "center",sorttype: "int",editrules: {number: true},hidden: true},
  265. {name: "sel6",index: "sel6",align: "center",sorttype: "int",editrules: {number: true},hidden: true}
  266. ],
  267. //当表格所有数据都加载完成而且其他的处理也都完成时触发此事件,排序,翻页同样也会触发此事件
  268. gridComplete:function(){
  269. //根据栏舍发料班次为班次比例添加背景色
  270. var ids = $("#list").jqGrid("getDataIDs");
  271. for ( var i = 0; i < ids.length; i++) {
  272. var rowData = $("#list").jqGrid("getRowData",ids[i]);
  273. if(rowData.sel1==1){
  274. $("#list").setCell(ids[i],"Rtime1","",{background:'#CCEC9D'});
  275. }
  276. if(rowData.sel2==1){
  277. $("#list").setCell(ids[i],"Rtime2","",{background:'#CCEC9D'});
  278. }
  279. if(rowData.sel3==1){
  280. $("#list").setCell(ids[i],"Rtime3","",{background:'#CCEC9D'});
  281. }
  282. if(rowData.sel4==1){
  283. $("#list").setCell(ids[i],"Rtime4","",{background:'#CCEC9D'});
  284. }
  285. if(rowData.sel5==1){
  286. $("#list").setCell(ids[i],"Rtime5","",{background:'#CCEC9D'});
  287. }
  288. if(rowData.sel6==1){
  289. $("#list").setCell(ids[i],"Rtime6","",{background:'#CCEC9D'});
  290. }
  291. }
  292. },
  293. onSelectCell: function(rowid){
  294. $("#flistState").val(1);
  295. var rowData = $("#list").jqGrid("getRowData",rowid); //获取当前选中行真实对象
  296. if(currentId != rowData.ID){
  297. currentId = rowData.ID;
  298. $("#fpdetailResult").load("${contextPath }/admin/recipeplan/fpdetail.html?currentFpId="+rowData.ID+"&isEnableSupplyFeed="+isEnableSupplyFeed+"&isMorningPart="+isMorningPart+"&isNoonPart="+isNoonPart+"&isNightPart="+isNightPart);
  299. }
  300. },
  301. cellEdit: true,
  302. cellsubmit: "clientArray", //当单元格发生变化后不直接发送请求、"remote"默认直接发送请求
  303. afterEditCell: function(rowid,name,val,iRow,iCol){
  304. oldUpdateValue = val;
  305. $("#list").jqGrid("setGridWidth",document.body.clientWidth - 25);
  306. $("#flistState").val(1);
  307. var rowData = $("#list").jqGrid("getRowData",rowid);
  308. if(currentId != rowData.ID){
  309. currentId = rowData.ID;
  310. $("#fpdetailResult").load("${contextPath }/admin/recipeplan/fpdetail.html?currentFpId="+rowData.ID+"&isEnableSupplyFeed="+isEnableSupplyFeed+"&isMorningPart="+isMorningPart+"&isNoonPart="+isNoonPart+"&isNightPart="+isNightPart);
  311. }
  312. },
  313. afterSaveCell: function(rowid,name,val,iRow,iCol) {
  314. var isFlag = 0;
  315. if(name == "PFMB" || name == "BLMB" || name == "ztFeedpName" || name == "ztRtime" || name == "beginTime"){
  316. isFlag = 1;
  317. }else{
  318. if(val != ""){
  319. isFlag = 1;
  320. }else{
  321. isFlag = 0;
  322. }
  323. }
  324. if(isFlag == 1){
  325. var rowData = $("#list").jqGrid("getRowData",rowid);
  326. isSelTr = rowid;
  327. var mor,noon,nig;
  328. var mor1 = rowData.Rtime1;
  329. var mor2 = rowData.Rtime2;
  330. var noon1 = rowData.Rtime3;
  331. var noon2 = rowData.Rtime4;
  332. var nig1 = rowData.Rtime5;
  333. var nig2 = rowData.Rtime6;
  334. var CCountRatioCCOUNT = rowData.CCountRatioCCOUNT;
  335. //早班分班
  336. if(isMorningPart == 1){
  337. mor = Number(mor1) + Number(mor2);
  338. }else{
  339. mor = Number(mor1);
  340. }
  341. //中班分班
  342. if(isNoonPart == 1){
  343. noon = Number(noon1) + Number(noon2);
  344. }else{
  345. noon = Number(noon1);
  346. }
  347. //晚班分班
  348. if(isNightPart == 1){
  349. nig = Number(nig1) + Number(nig2);
  350. }else{
  351. nig = Number(nig1);
  352. }
  353. var newsmnn = mor + noon;
  354. var smnn = mor + noon + nig;
  355. isLocking = Reserved7;
  356. $.ajax({
  357. async: false,
  358. type: 'POST',
  359. dataType:'json', //返回类型jsond
  360. data: "ID="+rowData.ID+"&colName="+name+"&colValue="+val+"&Calculation="+Calculation+"&CCOUNT="+rowData.CCOUNT+"&CCountRatioCCOUNT="+rowData.CCountRatioCCOUNT+"&isNightPart="+smnn+"&isLocking="+isLocking,
  361. url: "${contextPath }/admin/recipeplan/feedpupdate.html",
  362. error: function(){alert("系统错误");},
  363. success: function(json){
  364. if(json.status == "success"){
  365. if(Calculation == 0){
  366. //如果按比例计算时修改一下内容刷新
  367. if(name == "PFMB" || name == "CCOUNT" || name == "CCountRatio" || name == "CCountRatioCCOUNT"){
  368. //清空主表数据重新加载一次
  369. $("#list").clearGridData();
  370. loadList();
  371. }
  372. }else{
  373. //如果按重量计算时修改一下内容刷新
  374. if(name == "PFMB" || name == "CCOUNT" || name == "CCountRatioRtime" || name == "Rtime1" || name == "Rtime2" || name == "Rtime3" || name == "Rtime4" || name == "Rtime5" || name == "Rtime6"){
  375. //清空主表数据重新加载一次
  376. $("#list").clearGridData();
  377. loadList();
  378. }
  379. }
  380. //后台数据保存成功后加载子表视图
  381. $("#fpdetailResult").load("${contextPath }/admin/recipeplan/fpdetail.html?currentFpId="+rowData.ID+"&isEnableSupplyFeed="+isEnableSupplyFeed+"&isMorningPart="+isMorningPart+"&isNoonPart="+isNoonPart+"&isNightPart="+isNightPart);
  382. }
  383. }
  384. });
  385. if(Calculation == 0){
  386. //如果按比例计算时
  387. //计算系数比例(系数*(班次比例合(50+35)/100))------“计划干物质”(系数比例*(该配方模版里的包含每个饲料的量*该饲料在饲料表中的干物质量(相加总和)))
  388. if(name == "CCountRatio" || name == "Rtime1" || name == "Rtime2" || name == "Rtime3" || name == "Rtime4" || name == "Rtime5" || name == "Rtime6"){
  389. $.ajax({
  390. async: false,
  391. type: 'POST',
  392. dataType:'json', //返回类型jsond
  393. data: "ID="+rowData.ID+"&colName="+name+"&colValue="+val,
  394. url: "${contextPath }/admin/recipeplan/feedpcompute.html",
  395. error: function(){alert("系统错误");},
  396. success: function(json){
  397. if(json.status == "success"){
  398. //清空主表数据重新加载一次
  399. $("#list").clearGridData();
  400. loadList();
  401. //后台数据保存成功后加载子表视图
  402. $("#fpdetailResult").load("${contextPath }/admin/recipeplan/fpdetail.html?currentFpId="+rowData.ID+"&isEnableSupplyFeed="+isEnableSupplyFeed+"&isMorningPart="+isMorningPart+"&isNoonPart="+isNoonPart+"&isNightPart="+isNightPart);
  403. }
  404. }
  405. });
  406. }
  407. }else{
  408. //如果按重量计算时
  409. //if(name == "Rtime1" || name == "Rtime2" || name == "Rtime3" || name == "Rtime4" || name == "Rtime5" || name == "Rtime6"){
  410. // if(newsmnn > CCountRatioCCOUNT && nig > 0){
  411. // alert("该记录操作数据有错误!");
  412. // }
  413. //}
  414. if(isLocking > 0){
  415. //在重量模式下,编辑其中一个牛舍的所有班次的重量后,把(原重量-新重量)的值加到最后一个可见班次里,如果导致最后一个可见班次为负值,则置其为0
  416. // 30 20 20 总重量70 如果30改成40了 最后一个班次20就要减10 保持总重量70不变 如果最后一个班次为负值,则置其为0
  417. if(name == "Rtime1" || name == "Rtime2" || name == "Rtime3" || name == "Rtime4" || name == "Rtime5" || name == "Rtime6"){
  418. $.ajax({
  419. async: false,
  420. type: 'POST',
  421. dataType:'json', //返回类型jsond
  422. data: "ID="+rowData.ID+"&oldUpdateValue="+oldUpdateValue+"&newUpdateValue="+val+"&RTime="+name.charAt(name.length-1),
  423. url: "${contextPath }/admin/recipeplan/updatelastrtime.html",
  424. error: function(){alert("系统错误");},
  425. success: function(json){
  426. if(json.status == "success"){
  427. //清空主表数据重新加载一次
  428. $("#list").clearGridData();
  429. loadList();
  430. //后台数据保存成功后加载子表视图
  431. $("#fpdetailResult").load("${contextPath }/admin/recipeplan/fpdetail.html?currentFpId="+rowData.ID+"&isEnableSupplyFeed="+isEnableSupplyFeed+"&isMorningPart="+isMorningPart+"&isNoonPart="+isNoonPart+"&isNightPart="+isNightPart);
  432. }
  433. }
  434. });
  435. }
  436. }
  437. }
  438. }else{
  439. alert("不能为空");
  440. }
  441. },
  442. pager: "#page", //#page分页控件绑定的位置对象
  443. pginput: false, //不显示分页文本框
  444. pgbuttons: false, //不显示翻页按钮
  445. rowNum: 1000, //每页显示条数
  446. autowidth: true, //自动调节宽度
  447. sortname: 'SORT' //按SORT进行排序 默认asc
  448. });
  449. //获取数据集
  450. mydata = getLists();
  451. if(mydata!=null){
  452. for(var i=0;i<=mydata.length;i++){
  453. jQuery("#list").jqGrid('addRowData',i+1,mydata[i]);
  454. }
  455. jQuery("#list").jqGrid().trigger("reloadGrid"); //添加完数据后客户端自动刷新一次、实现客户端数据与服务器数据的完全分离
  456. }
  457. //绑定、设置工具栏
  458. jQuery("#list").jqGrid("navGrid","#page",{add: false,edit: false,del: false,search: false,refresh: false,searchtext: "搜索",refreshtext: "刷新"});
  459. //栏舍配方合并表头begin
  460. //栏舍配方合并表头end
  461. if(isEnableSupplyFeed == 1){
  462. $("#list").jqGrid("showCol","BLMB");
  463. }
  464. if(isMorningPart == 1){
  465. $("#list").jqGrid("showCol","Rtime2");
  466. }
  467. if(isNoonPart == 1){
  468. $("#list").jqGrid("showCol","Rtime4");
  469. }
  470. if(isNightPart == 1){
  471. $("#list").jqGrid("showCol","Rtime6");
  472. }
  473. if(isSelTr>0){
  474. $("#list").jqGrid("setSelection",isSelTr);
  475. }
  476. //是否显示泌乳天数与平均月龄
  477. if(isShowAvgAgeAndDay == 0){
  478. $("#list").jqGrid("hideCol","AvgDim");
  479. $("#list").jqGrid("hideCol","AvgMonthAge");
  480. }else{
  481. $("#list").jqGrid("showCol","AvgDim");
  482. $("#list").jqGrid("showCol","AvgMonthAge");
  483. }
  484. if(Reserved6 == 0){
  485. //禁用剩料时、隐藏对应两列
  486. $("#list").jqGrid("hideCol","ztFeedpName");
  487. $("#list").jqGrid("hideCol","ztRtime");
  488. }else{
  489. //启用剩料时、显示对应两列
  490. $("#list").jqGrid("showCol","ztFeedpName");
  491. $("#list").jqGrid("showCol","ztRtime");
  492. }
  493. //如果按重量计算、设置总重量\采食量不可被修改
  494. if(Calculation == 1){
  495. $("#list").jqGrid("setColProp", "CCountRatio", {editable: false});
  496. $("#list").jqGrid("setColProp", "CCountRatioCCOUNT", {editable: false});
  497. $("#list").jqGrid("hideCol","lpplanDry");
  498. }
  499. }
  500. //获取服务器数据
  501. function getLists(){
  502. $.ajax({
  503. async: false,
  504. type: 'POST',
  505. dataType:'json', //返回类型json
  506. url: "${contextPath }/admin/recipeplan/feedplist.html?Calculation="+Calculation,
  507. error: function(){alert("系统错误");},
  508. success: function(json){
  509. mydata = json;
  510. }
  511. });
  512. return mydata;
  513. }
  514. function ImportExcel(){
  515. var file = $("#file").val();
  516. var uploadEntityFrm = document.getElementById("uploadEntityFrm");
  517. if(file != ""){
  518. var ext = file.substring(file.lastIndexOf(".")+1);
  519. if(ext == "xls" || ext == "xlsx"){
  520. uploadEntityFrm.action = "${contextPath }/admin/recipeplan/ImportExcel.html?Calculation="+Calculation;
  521. uploadEntityFrm.submit();
  522. return true;
  523. }else{
  524. alert("请选择Excel导入");
  525. return false;
  526. }
  527. }else{
  528. alert("请选择Excel导入");
  529. return false;
  530. }
  531. }
  532. //获取系统默认参数是否启用补料模版,各班比例
  533. function getDefaultConfig(){
  534. $.ajax({
  535. async: false,
  536. type: 'POST',
  537. dataType:'json', //返回类型json
  538. url: "${contextPath }/admin/basicdata/getdefaultconfig.html",
  539. error: function(){alert("系统错误");},
  540. success: function(json){
  541. if(json.status == "success"){
  542. if(json.isEnableSupplyFeed){
  543. isEnableSupplyFeed = 1;
  544. }
  545. if(json.isMorningPart){
  546. isMorningPart = 1;
  547. }
  548. if(json.isNoonPart){
  549. isNoonPart = 1;
  550. }
  551. if(json.isNightPart){
  552. isNightPart = 1;
  553. }
  554. if(json.Calculation==0){
  555. colName = ["主键","栏舍名称","计划干物质","日系数比例(%)","时间","实际头数","软件牛头数","系数(%)", "系数头数","泌乳天数","平均月龄", "配方模版", "补料模版", "转投栏舍", "转投班次", "早班1比例(%)", "早班2比例(%)", "中班1比例(%)", "中班2比例(%)", "晚班1比例(%)", "晚班2比例(%)", "sel1", "sel2", "sel3", "sel4", "sel5", "sel6"];
  556. }else{
  557. colName = ["主键","栏舍名称","计划干物质","日系数比例(%)","时间","实际头数","软件牛头数", "采食量(kg/天)", "总重量(kg)","泌乳天数","平均月龄", "配方模版", "补料模版", "转投栏舍", "转投班次", "早班1(kg)", "早班2(kg)", "中班1(kg)", "中班2(kg)", "晚班1(kg)", "晚班2(kg)", "sel1", "sel2", "sel3", "sel4", "sel5", "sel6"];
  558. }
  559. Calculation = json.Calculation;//记录是按比例计算、还是按重量计算
  560. isShowAvgAgeAndDay=json.isShowAvgAgeAndDay;
  561. Reserved6 = json.Reserved6;//记录是否启用剩料 0禁用时隐藏栏舍配方中的【转投栏舍、转投班次】。 1显示
  562. Reserved7 = json.Reserved7;//锁定两班以上的首班重量:0、否,1是、选是时、栏舍配方中计算时锁定
  563. isLocking = Reserved7;
  564. if(json.Calculation==1){
  565. $("#showInfo").html("导入的Excel总列数为16列:【日期、栏舍名称、软件牛头数、实际牛头数、产奶量、泌乳天数、平均月龄、转投剩料量、日系数比例(%)、1班(kg)、2班(kg)、3班(kg)、4班(kg)、5班(kg)、6班(kg)、转投栏舍】<br/>其中【日期、栏舍名称、转投栏舍】三列格式为文本格式,其他列都是常规格式!");
  566. }else{
  567. $("#showInfo").html("导入的Excel总列数为16列:【日期、栏舍名称、软件牛头数、实际牛头数、产奶量、泌乳天数、平均月龄、转投剩料量、牛头系数、1班比例、2班比例、3班比例、4班比例、5班比例、6班比例、转投栏舍】<br/>其中【日期、栏舍名称、转投栏舍】三列格式为文本格式,其他列都是常规格式!");
  568. }
  569. }
  570. }
  571. });
  572. }
  573. //全部计算
  574. function reCheck(){
  575. $.ajax({
  576. async: false,
  577. type: 'POST',
  578. dataType:'json', //返回类型jsond
  579. data: "Calculation="+Calculation,
  580. url: "${contextPath }/admin/recipeplan/reCheck.html",
  581. error: function(){alert("系统错误");},
  582. success: function(json){
  583. location.reload();
  584. }
  585. });
  586. }
  587. //导出配方
  588. function exportExcel(){
  589. document.location.href="${contextPath}/admin/recipeplan/feedpExportExcel.html?Calculation="+Calculation;
  590. }
  591. //重量生成
  592. //设置每个牛舍的每个班次里的重量为,牛头数*配方里所有原料总重*默认参数设置里的对应班次重量的值/100
  593. function ResetGenerate(){
  594. $.ajax({
  595. async: false,
  596. type: 'POST',
  597. dataType:'json', //返回类型jsond
  598. data: "Calculation="+Calculation,
  599. url: "${contextPath }/admin/recipeplan/resetGenerate.html",
  600. error: function(){alert("系统错误");},
  601. success: function(json){
  602. location.reload();
  603. }
  604. });
  605. }
  606. </script>
  607. </head>
  608. <body class="easyui-layout">
  609. <div region="north" title="导入Excel" style="height:100px;padding:5px;">
  610. <font color="red"> <text id="showInfo"></text></font>
  611. <form id="uploadEntityFrm" method="post" action="" enctype="multipart/form-data">
  612. <input id="file" type="file" name="file" />
  613. <input type="button" value="导入Excel" onclick="ImportExcel();" class="sysub" />
  614. <font color="red"><c:if test="${message eq 1 }">导入成功</c:if></font>
  615. <input type="button" value="全部计算" onclick="reCheck();" class="sysub" />
  616. <input type="button" value="导出配方" onclick="exportExcel();" class="sysub" />
  617. <input id="rgBtn" type="button" value="重量生成" onclick="ResetGenerate();" class="sysub" />
  618. </form>
  619. </div>
  620. <div region="center" title="栏舍配方" style="padding:5px;background:#eee;">
  621. <table id="list"></table>
  622. <div id="page"></div>
  623. </div>
  624. <div region="south" split="true" title="重量" style="padding:5px;height:230px;">
  625. <div id="fpdetailResult"></div>
  626. </div>
  627. </body>
  628. </html>