lpplan.jsp 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898
  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/style.css" />
  8. <script type="text/javascript" src="${contextPath}/js/redips-drag-min.js"></script>
  9. <script type="text/javascript" src="${contextPath}/js/script.js"></script>
  10. <script type="text/javascript">
  11. var mydata,operCount=0,flCount=2,loadfl2=0,loadfl3=0,loadfl4=0,loadfl5=0,loadfl6=0,loadfl7=0,loadfl8=0,loadfl9=0,
  12. loadfl10=0,loadfl11=0,loadfl12=0,loadfl13=0,loadfl14=0,loadfl15=0,loadfl16=0,isMorningPart=0,isNoonPart=0,isNightPart=0,
  13. feedpSize = "${feedpSize}",lastrow,lastcell,UserFeedp = 0;
  14. $(document).ready( function() {
  15. getDefaultConfig();//获取系统默认参数是否启用补料模版,各班比例
  16. getUserFeedp();//查询该登录用户是否有关联栏舍
  17. loadList(); //加载jqgrid
  18. var count = feedpSize / 15;
  19. if(count <= 1){
  20. $("#list").jqGrid("setGridHeight",$(window).height() - 70);
  21. }else if(count > 1 && count <= 2){
  22. $("#list").jqGrid("setGridHeight",$(window).height() - 110);
  23. }else if(count > 2 && count <= 3){
  24. $("#list").jqGrid("setGridHeight",$(window).height() - 140);
  25. }else if(count > 3 && count <= 4){
  26. $("#list").jqGrid("setGridHeight",$(window).height() - 180);
  27. }else if(count > 4 && count <= 5){
  28. $("#list").jqGrid("setGridHeight",$(window).height() - 210);
  29. }else if(count > 5 && count <= 6){
  30. $("#list").jqGrid("setGridHeight",$(window).height() - 250);
  31. }else if(count > 6 && count <= 7){
  32. $("#list").jqGrid("setGridHeight",$(window).height() - 280);
  33. }else if(count > 7 && count <= 8){
  34. $("#list").jqGrid("setGridHeight",$(window).height() - 320);
  35. }else if(count > 8 && count <= 9){
  36. $("#list").jqGrid("setGridHeight",$(window).height() - 350);
  37. }else if(count > 9 && count <= 10){
  38. $("#list").jqGrid("setGridHeight",$(window).height() - 390);
  39. }
  40. $("#list").jqGrid("setGridWidth",document.body.clientWidth - 5);
  41. });
  42. $(window).resize(function(){
  43. $("#list").jqGrid("setGridWidth",document.body.clientWidth - 5);
  44. var count = feedpSize / 15;
  45. if(count <= 1){
  46. $("#list").jqGrid("setGridHeight",$(window).height() - 90);
  47. }else if(count > 1 && count <= 2){
  48. $("#list").jqGrid("setGridHeight",$(window).height() - 120);
  49. }else if(count > 2 && count <= 3){
  50. $("#list").jqGrid("setGridHeight",$(window).height() - 160);
  51. }else if(count > 3 && count <= 4){
  52. $("#list").jqGrid("setGridHeight",$(window).height() - 190);
  53. }else if(count > 4 && count <= 5){
  54. $("#list").jqGrid("setGridHeight",$(window).height() - 220);
  55. }else if(count > 5 && count <= 6){
  56. $("#list").jqGrid("setGridHeight",$(window).height() - 260);
  57. }else if(count > 6 && count <= 7){
  58. $("#list").jqGrid("setGridHeight",$(window).height() - 290);
  59. }else if(count > 7 && count <= 8){
  60. $("#list").jqGrid("setGridHeight",$(window).height() - 330);
  61. }else if(count > 8 && count <= 9){
  62. $("#list").jqGrid("setGridHeight",$(window).height() - 360);
  63. }else if(count > 9 && count <= 10){
  64. $("#list").jqGrid("setGridHeight",$(window).height() - 400);
  65. }
  66. });
  67. //jqgrid初始化
  68. function loadList(){
  69. jQuery("#list").jqGrid({
  70. datatype: "local", //从服务器端返回的数据类型,(表格期望接收的数据类型)。可选类型:xml,xmlstring,json,local,function
  71. height: "50%", //高度
  72. colNames:["主键","车次","TMR","驾驶员","设计时长","描述","发料类型","生效","早班1","早班2","中班1","中班2","晚班1","晚班2","时间","合计重量","配方模版","日系数比例","牛头数","发料1","发料2","发料3","发料4","发料5","发料6","发料7","发料8","发料9","发料10","发料11","发料12","发料13","发料14","发料15","发料16","isTNSame","isSelFeedpSame"], //列名
  73. colModel:[
  74. {name: "ID",index: "ID",width: 1,align: "center",sorttype: "string",hidden: true},
  75. {name: "SORT",index: "SORT",width: 50,align: "center",sorttype: "int",editable: true,editrules: {integer: true}},
  76. {name: "TNAME",index: "TNAME",width: 70,align: "center",sorttype: "int",editable: true,edittype: "select",
  77. editoptions:{
  78. dataUrl: "${contextPath }/admin/recipeplan/tmrselect.html",
  79. dataEvents: [{
  80. type: "change", fn: function(e){
  81. var selId = $("#list").jqGrid("getGridParam","selrow"); //获取当前选中行号
  82. var thisval = $(e.target).val();
  83. if(thisval != ""){
  84. $.ajax({
  85. async: false,
  86. type: "post",
  87. dataType: "json", //返回类型json
  88. data: "tmrId="+thisval,
  89. url: "${contextPath }/admin/recipeplan/getDnameByTmrId.html",
  90. error: function(){alert("系统错误");},
  91. success: function(json){
  92. if(json.status == "success"){
  93. $("#list").setCell(selId,"DNAME",json.DNAME);
  94. }
  95. }
  96. });
  97. }else{
  98. $("#list").setCell(selId,"DNAME"," ");
  99. }
  100. }
  101. }]
  102. }
  103. },
  104. {name: "DNAME",index: "DNAME",width: 70,align: "center",sorttype: "int",editable: true,edittype: "select",editoptions:{dataUrl: "${contextPath }/admin/recipeplan/pilotselect.html"}},
  105. {name: "Minutes",index: "Minutes",width: 60,align: "center",sorttype: "int",editable: true,editrules: {integer: true}},
  106. {name: "remark",index: "remark",width: 70,align: "center",sorttype: "string",editable: true},
  107. {name: "lpplanType",index: "lpplanType",width: 70,align: "center",sorttype: "string",editable: true,edittype: "select",editoptions:{value:{"混合":"混合","上料":"上料","发料":"发料","剩料":"剩料"}}},
  108. {name: "Sel",index: "Sel",width: 50,align: "center",sorttype: "string",editable: true,editrules: {required:true},formatter: "checkbox",formatoptions: {disabled:false},edittype: "checkbox",editoptions: {value:"Yes:No"}},
  109. {name: "sel1",index: "sel1",width: 50,align: "center",sorttype: "string",editable: true,editrules: {required:true},formatter: "checkbox",formatoptions: {disabled:false},edittype: "checkbox",editoptions: {value:"Yes:No"}},
  110. {name: "sel2",index: "sel2",hidden: true,width: 50,align: "center",sorttype: "string",editable: true,editrules: {required:true},formatter: "checkbox",formatoptions: {disabled:false},edittype: "checkbox",editoptions: {value:"Yes:No"}},
  111. {name: "sel3",index: "sel3",width: 50,align: "center",sorttype: "string",editable: true,editrules: {required:true},formatter: "checkbox",formatoptions: {disabled:false},edittype: "checkbox",editoptions: {value:"Yes:No"}},
  112. {name: "sel4",index: "sel4",hidden: true,width: 50,align: "center",sorttype: "string",editable: true,editrules: {required:true},formatter: "checkbox",formatoptions: {disabled:false},edittype: "checkbox",editoptions: {value:"Yes:No"}},
  113. {name: "sel5",index: "sel5",width: 50,align: "center",sorttype: "string",editable: true,editrules: {required:true},formatter: "checkbox",formatoptions: {disabled:false},edittype: "checkbox",editoptions: {value:"Yes:No"}},
  114. {name: "sel6",index: "sel6",hidden: true,width: 50,align: "center",sorttype: "string",editable: true,editrules: {required:true},formatter: "checkbox",formatoptions: {disabled:false},edittype: "checkbox",editoptions: {value:"Yes:No"}},
  115. {name: "beginTime",index: "beginTime",width: 70,align: "center",sorttype: "string",editable: true},
  116. {name: "sumWeight",index: "sumWeight",width: 70,align: "center",sorttype: "string",editable: false},
  117. {name: "templetName",index: "templetName",width: 70,align: "center",sorttype: "string",editable: false},
  118. {name: "CCountRatioRtime",index: "CCountRatioRtime",width: 70,align: "center",sorttype: "string",editable: false},
  119. {name: "sumCowCount",index: "sumCowCount",width: 70,align: "center",sorttype: "string",editable: false},
  120. {name: "FL1",index: "FL1",width: 80,align: "center"},
  121. {name: "FL2",index: "FL2",width: 80,align: "center",sorttype: "string"},
  122. {name: "FL3",index: "FL3",width: 80,align: "center",sorttype: "string"},
  123. {name: "FL4",index: "FL4",width: 80,align: "center",sorttype: "string"},
  124. {name: "FL5",index: "FL5",width: 80,align: "center"},
  125. {name: "FL6",index: "FL6",width: 80,align: "center",sorttype: "string"},
  126. {name: "FL7",index: "FL7",width: 80,align: "center",sorttype: "string"},
  127. {name: "FL8",index: "FL8",width: 80,align: "center",sorttype: "string"},
  128. {name: "FL9",index: "FL9",width: 80,align: "center",sorttype: "string"},
  129. {name: "FL10",index: "FL10",width: 80,align: "center",sorttype: "string"},
  130. {name: "FL11",index: "FL11",width: 80,align: "center",sorttype: "string"},
  131. {name: "FL12",index: "FL12",width: 80,align: "center",sorttype: "string"},
  132. {name: "FL13",index: "FL13",width: 80,align: "center",sorttype: "string"},
  133. {name: "FL14",index: "FL14",width: 80,align: "center",sorttype: "string"},
  134. {name: "FL15",index: "FL15",width: 80,align: "center",sorttype: "string"},
  135. {name: "FL16",index: "FL16",width: 80,align: "center",sorttype: "string"},
  136. {name: "isTNSame",index: "isTNSame",align: "center",sorttype: "string",hidden: true},
  137. {name: "isSelFeedpSame",index: "isSelFeedpSame",align: "center",sorttype: "string",hidden: true}
  138. ],
  139. cellEdit: true,
  140. cellsubmit: "clientArray", //当单元格发生变化后不直接发送请求、"remote"默认直接发送请求
  141. /**
  142. * 设置水平滚动条 begin
  143. **/
  144. shrinkToFit:false,
  145. autoScroll: true,
  146. autowidth: true, //自动调节宽度
  147. rowNum: 1000, //每页显示条数
  148. /**
  149. * 设置水平滚动条 end
  150. **/
  151. toolbar: [true,"top"],
  152. beforeEditCell:function(rowid,cellname,v,iRow,iCol){
  153. lastrow = iRow;
  154. lastcell = iCol;
  155. },
  156. afterInsertRow: function(rowid,rowdata,rowelem){
  157. //配方模版是否相同:1、不相同,0相同。不相同加标注
  158. if(rowdata.isTNSame == 1){
  159. $("#list").setCell(rowid,16,"",{background:'#FFE66F'});
  160. }
  161. //不同车次有相同班次相同栏舍提示:0不提示,1、班次1有相同栏舍,2、班次2有相同栏舍……。相同加标注
  162. if(rowdata.isSelFeedpSame > 0){
  163. if(rowdata.isSelFeedpSame == 1){
  164. $("#list").setCell(rowid,8,"",{background:'#FFB5B5'});
  165. }else if(rowdata.isSelFeedpSame == 2){
  166. $("#list").setCell(rowid,9,"",{background:'#FFB5B5'});
  167. }else if(rowdata.isSelFeedpSame == 3){
  168. $("#list").setCell(rowid,10,"",{background:'#FFB5B5'});
  169. }else if(rowdata.isSelFeedpSame == 4){
  170. $("#list").setCell(rowid,11,"",{background:'#FFB5B5'});
  171. }else if(rowdata.isSelFeedpSame == 5){
  172. $("#list").setCell(rowid,12,"",{background:'#FFB5B5'});
  173. }else if(rowdata.isSelFeedpSame == 6){
  174. $("#list").setCell(rowid,13,"",{background:'#FFB5B5'});
  175. }
  176. }
  177. },
  178. //ondblClickRow: function(rowid){
  179. // var rowData = $("#list").jqGrid("getRowData",rowid);
  180. // $.ajax({
  181. // async: false,
  182. // type: 'POST',
  183. // dataType:'json', //返回类型jsond
  184. // data: "ID="+rowData.ID,
  185. // url: "${contextPath }/admin/recipeplan/getfeedpName.html",
  186. // error: function(){alert("系统错误");},
  187. // success: function(json){
  188. // if(json.status == "success"){
  189. // document.location.href="${contextPath }/admin/recipeplan/lpplan.html?cclass="+json.cclass;
  190. // //$("#feedpResult").load("${contextPath }/admin/recipeplan/queryfeedplist.html?cclass="+json.cclass);
  191. // }
  192. // }
  193. // });
  194. //}
  195. });
  196. //$("#list").jqGrid("setFrozenColumns"); //设置冻结列
  197. //获取数据集
  198. mydata = getLists();
  199. if(mydata!=null){
  200. for(var i=0;i<=mydata.length;i++){
  201. jQuery("#list").jqGrid('addRowData',i+1,mydata[i]);
  202. }
  203. jQuery("#list").jqGrid().trigger("reloadGrid"); //添加完数据后客户端自动刷新一次、实现客户端数据与服务器数据的完全分离
  204. }
  205. if(operCount == 0){
  206. //$("#t_list").append("<input id='lpplanCount' type='text' value='' style='width:50px;font-size:-2;padding-top: 2px;font-size:12px;text-align:center;'/> ");
  207. //$("#t_list").append("<input class='sysub' type='button' value='更新车次' onClick='modifLpplan()' style='font-size:-2'/> ");
  208. //$("#t_list").append("<input class='sysub' type='button' value='清空车次' onClick='clearLpplan()' style='font-size:-2'/> ");
  209. if(UserFeedp == 0){
  210. $("#t_list").append("<input class='sysub' type='button' value='↑' onClick='moveLpplan(\"top\")' style='font-size:-1'/> ");
  211. $("#t_list").append("<input class='sysub' type='button' value='↓' onClick='moveLpplan(\"down\")' style='font-size:-1'/> ");
  212. $("#t_list").append("<input class='sysub' type='button' value='新增车次' onClick='addLpplan()' style='font-size:-2'/> ");
  213. $("#t_list").append("<input class='sysub' type='button' value='删除车次' onClick='delLpplan()' style='font-size:-2'/> ");
  214. }
  215. $("#t_list").append("<input class='sysub' type='button' value='添加发料' onClick='addFL()' style='font-size:-2'/> ");
  216. $("#t_list").append("<input class='sysub' type='button' value='减少发料' onClick='delFL()' style='font-size:-2'/> ");
  217. $("#t_list").append("<input class='sysub' type='button' value='确认保存' onClick='saveLpplan()' style='font-size:-2'/>");
  218. $("#t_list").append("&nbsp;&nbsp;名称:<input id='lpplanName' name='lpplanName' style='width:60px;font-size:12px;' value='' />&nbsp;&nbsp;");
  219. $("#t_list").append("<input class='sysub' type='button' value='备份' onClick='backLpplan()' style='font-size:-2'/>");
  220. $("#t_list").append("&nbsp;&nbsp;提取:<select id='tqLpplanId'><c:forEach items='${lpplanbacklist }' var='lpplanback'><option value='${lpplanback.lpplanbackId }'><c:out value='${lpplanback.ProjName }' /></option></c:forEach></select>&nbsp;&nbsp;");
  221. $("#t_list").append("<input class='sysub' type='button' value='提取' onClick='tqLpplan()' style='font-size:-2'/>");
  222. $("#t_list").append("<input class='sysub' type='button' value='删除' onClick='dleLpplan()' style='font-size:-2'/>");
  223. $("#t_list").append("<input class='sysub' type='button' value='自动' onClick='autoLpplan()' style='font-size:-2'/>");
  224. $("#t_list").append("<input class='sysub' type='button' value='清空车号' onClick='clearTmr()' style='font-size:-2'/>");
  225. operCount++;
  226. }
  227. var ids = $("#list").jqGrid("getDataIDs");
  228. for ( var i = 0; i < ids.length; i++) {
  229. var rowData = $("#list").jqGrid("getRowData",ids[i]);
  230. var FL2 = rowData.FL2.indexOf("</div>");
  231. var FL3 = rowData.FL3.indexOf("</div>");
  232. var FL4 = rowData.FL4.indexOf("</div>");
  233. var FL5 = rowData.FL5.indexOf("</div>");
  234. var FL6 = rowData.FL6.indexOf("</div>");
  235. var FL7 = rowData.FL7.indexOf("</div>");
  236. var FL8 = rowData.FL8.indexOf("</div>");
  237. var FL9 = rowData.FL9.indexOf("</div>");
  238. var FL10 = rowData.FL10.indexOf("</div>");
  239. var FL11 = rowData.FL11.indexOf("</div>");
  240. var FL12 = rowData.FL12.indexOf("</div>");
  241. var FL13 = rowData.FL13.indexOf("</div>");
  242. var FL14 = rowData.FL14.indexOf("</div>");
  243. var FL15 = rowData.FL15.indexOf("</div>");
  244. var FL16 = rowData.FL16.indexOf("</div>");
  245. if(FL2 > 0){
  246. loadfl2++;
  247. flCount = 3;
  248. }
  249. if(FL3 > 0){
  250. loadfl3++;
  251. flCount = 4;
  252. }
  253. if(FL4 > 0){
  254. loadfl4++;
  255. flCount = 5;
  256. }
  257. if(FL5 > 0){
  258. loadfl5++;
  259. flCount = 6;
  260. }
  261. if(FL6 > 0){
  262. loadfl6++;
  263. flCount = 7;
  264. }
  265. if(FL7 > 0){
  266. loadfl7++;
  267. flCount = 8;
  268. }
  269. if(FL8 > 0){
  270. loadfl8++;
  271. flCount = 9;
  272. }
  273. if(FL9 > 0){
  274. loadfl9++;
  275. flCount = 10;
  276. }
  277. if(FL10 > 0){
  278. loadfl10++;
  279. flCount = 11;
  280. }
  281. if(FL11 > 0){
  282. loadfl11++;
  283. flCount = 12;
  284. }
  285. if(FL12 > 0){
  286. loadfl12++;
  287. flCount = 13;
  288. }
  289. if(FL13 > 0){
  290. loadfl13++;
  291. flCount = 14;
  292. }
  293. if(FL14 > 0){
  294. loadfl14++;
  295. flCount = 15;
  296. }
  297. if(FL15 > 0){
  298. loadfl15++;
  299. flCount = 16;
  300. }
  301. if(FL16 > 0){
  302. loadfl16++;
  303. }
  304. }
  305. if(loadfl2 == 0){
  306. $("#list").jqGrid("hideCol","FL2");
  307. }
  308. if(loadfl3 == 0){
  309. $("#list").jqGrid("hideCol","FL3");
  310. }
  311. if(loadfl4 == 0){
  312. $("#list").jqGrid("hideCol","FL4");
  313. }
  314. if(loadfl5 == 0){
  315. $("#list").jqGrid("hideCol","FL5");
  316. }
  317. if(loadfl6 == 0){
  318. $("#list").jqGrid("hideCol","FL6");
  319. }
  320. if(loadfl7 == 0){
  321. $("#list").jqGrid("hideCol","FL7");
  322. }
  323. if(loadfl8 == 0){
  324. $("#list").jqGrid("hideCol","FL8");
  325. }
  326. if(loadfl9 == 0){
  327. $("#list").jqGrid("hideCol","FL9");
  328. }
  329. if(loadfl10 == 0){
  330. $("#list").jqGrid("hideCol","FL10");
  331. }
  332. if(loadfl11 == 0){
  333. $("#list").jqGrid("hideCol","FL11");
  334. }
  335. if(loadfl12 == 0){
  336. $("#list").jqGrid("hideCol","FL12");
  337. }
  338. if(loadfl13 == 0){
  339. $("#list").jqGrid("hideCol","FL13");
  340. }
  341. if(loadfl14 == 0){
  342. $("#list").jqGrid("hideCol","FL14");
  343. }
  344. if(loadfl15 == 0){
  345. $("#list").jqGrid("hideCol","FL15");
  346. }
  347. if(loadfl16 == 0){
  348. $("#list").jqGrid("hideCol","FL16");
  349. }
  350. //$("#list").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : true, defaultSearch:"cn"}); 增加行查询工具条
  351. //判断是否分车
  352. if(isMorningPart == 1){
  353. $("#list").jqGrid("showCol","sel2");
  354. }
  355. if(isNoonPart == 1){
  356. $("#list").jqGrid("showCol","sel4");
  357. }
  358. if(isNightPart == 1){
  359. $("#list").jqGrid("showCol","sel6");
  360. }
  361. }
  362. //获取服务器数据
  363. function getLists(){
  364. $.ajax({
  365. async: false,
  366. type: 'POST',
  367. dataType:'json', //返回类型json
  368. url: "${contextPath }/admin/recipeplan/lpplanlist.html",
  369. error: function(){alert("系统错误");},
  370. success: function(json){
  371. mydata = json;
  372. }
  373. });
  374. return mydata;
  375. }
  376. //自定义添加方法
  377. function addLpplan(){
  378. var ids = $("#list").jqGrid("getDataIDs");
  379. $("#list").jqGrid("addRowData",ids.length+1,{},"first");
  380. $.ajax({
  381. async: false,
  382. type: "POST",
  383. dataType:"json", //返回类型jsond
  384. data: "oper=add&selId=",
  385. url: "${contextPath }/admin/recipeplan/lpplanupdate.html",
  386. error: function(){alert("系统错误");},
  387. success: function(json){
  388. $("#list").clearGridData(); //清空原grid数据
  389. loadList(); //重新载入服务器数据
  390. }
  391. });
  392. }
  393. //自定义删除方法
  394. function delLpplan(){
  395. var row = $("#list").jqGrid("getGridParam","selrow");
  396. if(row!=null){
  397. var flag = confirm("您确定要删除吗?");
  398. if(flag){
  399. var selRow = $("#list").jqGrid("getRowData",row);
  400. $.ajax({
  401. async: false,
  402. type: "POST",
  403. dataType:"json", //返回类型jsond
  404. data: "oper=del&selId="+selRow.ID,
  405. url: "${contextPath }/admin/recipeplan/lpplanupdate.html",
  406. error: function(){alert("系统错误");},
  407. success: function(json){
  408. $("#list").clearGridData(); //清空原grid数据
  409. loadList(); //重新载入服务器数据
  410. }
  411. });
  412. }
  413. }else{
  414. alert("请选择记录");
  415. }
  416. }
  417. //更新车次
  418. function modifLpplan(){
  419. var lpplanCount = $("#lpplanCount").val();
  420. if(lpplanCount.length > 0){
  421. if(lpplanCount.search("^[1-9]*[1-9][0-9]*$")!=0){
  422. $("#lpplanCount").val("");
  423. $("#lpplanCount").focus();
  424. alert("必须是有效数字!");
  425. }else{
  426. var currentCount = $("#list").jqGrid("getDataIDs");
  427. if(currentCount.length != lpplanCount){
  428. $.ajax({
  429. async: false,
  430. type: 'POST',
  431. data: "lpplanCount="+lpplanCount,
  432. dataType: 'json',
  433. url: "${contextPath}/admin/recipeplan/modiflpplan.html",
  434. error: function(){alert("系统错误");},
  435. success: function(json){
  436. if(json.status == "success"){
  437. $("#list").clearGridData(); //清空原grid数据
  438. loadList(); //加载jqgrid
  439. }
  440. }
  441. });
  442. }
  443. }
  444. }else{
  445. $("#lpplanCount").focus();
  446. alert("请填入更新数量!");
  447. }
  448. }
  449. //清空车次
  450. function clearLpplan(){
  451. var flag = confirm("您确定要清空吗?");
  452. if (flag){
  453. $.ajax({
  454. async: false,
  455. type: 'POST',
  456. //data: "entityName="+value+"&type="+operType+"&entityId="+rowData.ID,
  457. dataType: 'json',
  458. url: "${contextPath}/admin/recipeplan/clearlpplan.html",
  459. error: function(){alert("系统错误");},
  460. success: function(json){
  461. if(json.status == "success"){
  462. $("#list").clearGridData(); //清空原grid数据
  463. }
  464. }
  465. });
  466. }
  467. }
  468. //自定义添加发料
  469. function addFL(){
  470. $("#list").jqGrid("showCol","FL"+flCount);
  471. if(flCount < 17){
  472. flCount++;
  473. }
  474. }
  475. //自定义减少发料
  476. function delFL(){
  477. if(flCount > 2){
  478. flCount--;
  479. }
  480. if(flCount == 2){
  481. if(loadfl2 == 0){
  482. $("#list").jqGrid("hideCol","FL"+flCount);
  483. }else{
  484. flCount++;
  485. }
  486. }else if(flCount == 3){
  487. if(loadfl3 == 0){
  488. $("#list").jqGrid("hideCol","FL"+flCount);
  489. }else{
  490. flCount++;
  491. }
  492. }else if(flCount == 4){
  493. if(loadfl4 == 0){
  494. $("#list").jqGrid("hideCol","FL"+flCount);
  495. }else{
  496. flCount++;
  497. }
  498. }else if(flCount == 5){
  499. if(loadfl5 == 0){
  500. $("#list").jqGrid("hideCol","FL"+flCount);
  501. }else{
  502. flCount++;
  503. }
  504. }else if(flCount == 6){
  505. if(loadfl6 == 0){
  506. $("#list").jqGrid("hideCol","FL"+flCount);
  507. }else{
  508. flCount++;
  509. }
  510. }else if(flCount == 7){
  511. if(loadfl7 == 0){
  512. $("#list").jqGrid("hideCol","FL"+flCount);
  513. }else{
  514. flCount++;
  515. }
  516. }else if(flCount == 8){
  517. if(loadfl8 == 0){
  518. $("#list").jqGrid("hideCol","FL"+flCount);
  519. }else{
  520. flCount++;
  521. }
  522. }else if(flCount == 9){
  523. if(loadfl9 == 0){
  524. $("#list").jqGrid("hideCol","FL"+flCount);
  525. }else{
  526. flCount++;
  527. }
  528. }else if(flCount == 10){
  529. if(loadfl10 == 0){
  530. $("#list").jqGrid("hideCol","FL"+flCount);
  531. }else{
  532. flCount++;
  533. }
  534. }else if(flCount == 11){
  535. if(loadfl11 == 0){
  536. $("#list").jqGrid("hideCol","FL"+flCount);
  537. }else{
  538. flCount++;
  539. }
  540. }else if(flCount == 12){
  541. if(loadfl12 == 0){
  542. $("#list").jqGrid("hideCol","FL"+flCount);
  543. }else{
  544. flCount++;
  545. }
  546. }else if(flCount == 13){
  547. if(loadfl13 == 0){
  548. $("#list").jqGrid("hideCol","FL"+flCount);
  549. }else{
  550. flCount++;
  551. }
  552. }else if(flCount == 14){
  553. if(loadfl14 == 0){
  554. $("#list").jqGrid("hideCol","FL"+flCount);
  555. }else{
  556. flCount++;
  557. }
  558. }else if(flCount == 15){
  559. if(loadfl15 == 0){
  560. $("#list").jqGrid("hideCol","FL"+flCount);
  561. }else{
  562. flCount++;
  563. }
  564. }else if(flCount == 16){
  565. if(loadfl16 == 0){
  566. $("#list").jqGrid("hideCol","FL"+flCount);
  567. }else{
  568. flCount++;
  569. }
  570. }
  571. }
  572. //确认保存
  573. function saveLpplan(){
  574. $("#list").jqGrid("saveCell",lastrow,lastcell);
  575. //编辑后按过回车状态、可以保存
  576. if(isMorningPart == 0){
  577. var ids = $("#list").jqGrid("getDataIDs");
  578. for ( var i = 0; i < ids.length; i++) {
  579. $("#list").setCell(ids[i],"sel2","No");
  580. }
  581. }
  582. if(isNoonPart == 0){
  583. var ids = $("#list").jqGrid("getDataIDs");
  584. for ( var i = 0; i < ids.length; i++) {
  585. $("#list").setCell(ids[i],"sel4","No");
  586. }
  587. }
  588. if(isNightPart == 0){
  589. var ids = $("#list").jqGrid("getDataIDs");
  590. for ( var i = 0; i < ids.length; i++) {
  591. $("#list").setCell(ids[i],"sel6","No");
  592. }
  593. }
  594. var lpplanStr = "";
  595. var ids = $("#list").jqGrid("getDataIDs");
  596. for ( var i = 0; i < ids.length; i++) {
  597. var rowData = $("#list").jqGrid("getRowData",ids[i]);
  598. var ID = rowData.ID;
  599. var TNAME = $.trim(rowData.TNAME);
  600. var DNAME = $.trim(rowData.DNAME);
  601. var Minutes = rowData.Minutes;
  602. var remark = rowData.remark;
  603. var lpplanType = rowData.lpplanType;
  604. var SORT = rowData.SORT;
  605. var Sel = rowData.Sel;
  606. var sel1 = rowData.sel1;
  607. var sel2 = rowData.sel2;
  608. var sel3 = rowData.sel3;
  609. var sel4 = rowData.sel4;
  610. var sel5 = rowData.sel5;
  611. var sel6 = rowData.sel6;
  612. var beginTime = rowData.beginTime;
  613. var FL1 = rowData.FL1.substring(rowData.FL1.indexOf('>')+1,rowData.FL1.lastIndexOf('<'));
  614. var FL2 = rowData.FL2.substring(rowData.FL2.indexOf('>')+1,rowData.FL2.lastIndexOf('<'));
  615. var FL3 = rowData.FL3.substring(rowData.FL3.indexOf('>')+1,rowData.FL3.lastIndexOf('<'));
  616. var FL4 = rowData.FL4.substring(rowData.FL4.indexOf('>')+1,rowData.FL4.lastIndexOf('<'));
  617. var FL5 = rowData.FL5.substring(rowData.FL5.indexOf('>')+1,rowData.FL5.lastIndexOf('<'));
  618. var FL6 = rowData.FL6.substring(rowData.FL6.indexOf('>')+1,rowData.FL6.lastIndexOf('<'));
  619. var FL7 = rowData.FL7.substring(rowData.FL7.indexOf('>')+1,rowData.FL7.lastIndexOf('<'));
  620. var FL8 = rowData.FL8.substring(rowData.FL8.indexOf('>')+1,rowData.FL8.lastIndexOf('<'));
  621. var FL9 = rowData.FL9.substring(rowData.FL9.indexOf('>')+1,rowData.FL9.lastIndexOf('<'));
  622. var FL10 = rowData.FL10.substring(rowData.FL10.indexOf('>')+1,rowData.FL10.lastIndexOf('<'));
  623. var FL11 = rowData.FL11.substring(rowData.FL11.indexOf('>')+1,rowData.FL11.lastIndexOf('<'));
  624. var FL12 = rowData.FL12.substring(rowData.FL12.indexOf('>')+1,rowData.FL12.lastIndexOf('<'));
  625. var FL13 = rowData.FL13.substring(rowData.FL13.indexOf('>')+1,rowData.FL13.lastIndexOf('<'));
  626. var FL14 = rowData.FL14.substring(rowData.FL14.indexOf('>')+1,rowData.FL14.lastIndexOf('<'));
  627. var FL15 = rowData.FL15.substring(rowData.FL15.indexOf('>')+1,rowData.FL15.lastIndexOf('<'));
  628. var FL16 = rowData.FL16.substring(rowData.FL16.indexOf('>')+1,rowData.FL16.lastIndexOf('<'));
  629. if(lpplanStr == ""){
  630. lpplanStr = "ID:"+ID+",SORT:"+SORT+",TNAME:"+TNAME+",DNAME:"+DNAME+",Minutes:"+Minutes+",remark:"+remark+",lpplanType:"+lpplanType+",Sel:"+Sel+",sel1:"+sel1+",sel2:"+sel2+",sel3:"+sel3+",sel4:"+sel4+",sel5:"+sel5+",sel6:"+sel6+",beginTime:"+beginTime+",FL1:"+FL1+",FL2:"+FL2+",FL3:"+FL3+",FL4:"+FL4+",FL5:"+FL5+",FL6:"+FL6+",FL7:"+FL7+",FL8:"+FL8+",FL9:"+FL9+",FL10:"+FL10+",FL11:"+FL11+",FL12:"+FL12+",FL13:"+FL13+",FL14:"+FL14+",FL15:"+FL15+",FL16:"+FL16;
  631. }else{
  632. lpplanStr += ";" + "ID:"+ID+",SORT:"+SORT+",TNAME:"+TNAME+",DNAME:"+DNAME+",Minutes:"+Minutes+",remark:"+remark+",lpplanType:"+lpplanType+",Sel:"+Sel+",sel1:"+sel1+",sel2:"+sel2+",sel3:"+sel3+",sel4:"+sel4+",sel5:"+sel5+",sel6:"+sel6+",beginTime:"+beginTime+",FL1:"+FL1+",FL2:"+FL2+",FL3:"+FL3+",FL4:"+FL4+",FL5:"+FL5+",FL6:"+FL6+",FL7:"+FL7+",FL8:"+FL8+",FL9:"+FL9+",FL10:"+FL10+",FL11:"+FL11+",FL12:"+FL12+",FL13:"+FL13+",FL14:"+FL14+",FL15:"+FL15+",FL16:"+FL16;
  633. }
  634. }
  635. $.ajax({
  636. async: false,
  637. type: 'POST',
  638. data: "lpplanStr="+lpplanStr,
  639. dataType: 'json',
  640. url: "${contextPath}/admin/recipeplan/updateall.html",
  641. error: function(){alert("系统错误");},
  642. success: function(json){
  643. if(json.status == "success"){
  644. $("#list").clearGridData(); //清空原grid数据
  645. window.location.reload();
  646. }
  647. }
  648. });
  649. }
  650. //获取系统默认参数是否启用补料模版,各班比例
  651. function getDefaultConfig(){
  652. $.ajax({
  653. async: false,
  654. type: 'POST',
  655. dataType:'json', //返回类型json
  656. url: "${contextPath }/admin/basicdata/getdefaultconfig.html",
  657. error: function(){alert("系统错误");},
  658. success: function(json){
  659. if(json.status == "success"){
  660. if(json.isMorningPart){
  661. isMorningPart = 1;
  662. }
  663. if(json.isNoonPart){
  664. isNoonPart = 1;
  665. }
  666. if(json.isNightPart){
  667. isNightPart = 1;
  668. }
  669. }
  670. }
  671. });
  672. }
  673. //记录移动
  674. function moveLpplan(moveType){
  675. $("#list").jqGrid("saveCell",lastrow,lastcell);
  676. var selId = $("#list").jqGrid("getGridParam","selrow"); //获取当前选中行号
  677. var rowData = $("#list").jqGrid("getRowData",selId); //获取当前选中行真实对象
  678. if(selId != null){
  679. $.ajax({
  680. async: false,
  681. type: 'POST',
  682. dataType:'json', //返回类型json
  683. url: "${contextPath }/admin/recipeplan/movelpplan.html?planId="+rowData.ID+"&moveType="+moveType+"&Sort="+rowData.SORT,
  684. error: function(){alert("系统错误");},
  685. success: function(json){
  686. if(json.status == "success"){
  687. if(moveType == "top"){
  688. selId = Number(selId) - 1;
  689. }else{
  690. selId = Number(selId) + 1;
  691. }
  692. $("#list").clearGridData(); //清空原grid数据
  693. loadList(); //加载jqgrid
  694. }else{
  695. alert("请正确移动");
  696. }
  697. }
  698. });
  699. $("#list").jqGrid("setSelection",selId);
  700. }else{
  701. alert("请选择记录");
  702. }
  703. }
  704. //查询该登录用户是否有关联栏舍
  705. function getUserFeedp(){
  706. $.ajax({
  707. async: false,
  708. type: 'POST',
  709. dataType:'json', //返回类型json
  710. url: "${contextPath }/admin/recipeplan/getUserFeedp.html",
  711. error: function(){alert("系统错误");},
  712. success: function(json){
  713. if(json.status == "success"){
  714. UserFeedp = json.count;
  715. }
  716. }
  717. });
  718. }
  719. //备份
  720. function backLpplan(){
  721. var lpplanName = $("#lpplanName").val();
  722. if(lpplanName == ""){
  723. alert("请输入本次备份的计划名称");
  724. $("#lpplanName").focus();
  725. }else{
  726. $.ajax({
  727. async: false,
  728. type: 'POST',
  729. dataType:'json', //返回类型json
  730. url: "${contextPath }/admin/recipeplan/backLpplan.html?lpplanName="+lpplanName,
  731. error: function(){alert("系统错误");},
  732. success: function(json){
  733. if(json.status == "success"){
  734. if(json.lnamecount == "0"){
  735. alert("备份完成");
  736. }else{
  737. alert("计划名称不能重复");
  738. $("#lpplanName").focus();
  739. $("#lpplanName").select();
  740. }
  741. }
  742. }
  743. });
  744. }
  745. }
  746. //提取
  747. function tqLpplan(){
  748. var tqLpplanId = $("#tqLpplanId").val();
  749. var flag = confirm("提取时,当前页面计划将被清空,您确定提取备份计划吗?");
  750. if (flag){
  751. $.ajax({
  752. async: false,
  753. type: 'POST',
  754. data: "tqLpplanId="+tqLpplanId+"&lbacktype=0",
  755. dataType: 'json',
  756. url: "${contextPath}/admin/recipeplan/tqlpplan.html",
  757. error: function(){alert("系统错误");},
  758. success: function(json){
  759. if(json.status == "success"){
  760. location.reload();
  761. }
  762. }
  763. });
  764. }
  765. }
  766. //删除
  767. function dleLpplan(){
  768. var tqLpplanId = $("#tqLpplanId").val();
  769. var flag = confirm("您确定删除备份计划吗?");
  770. if (flag){
  771. $.ajax({
  772. async: false,
  773. type: 'POST',
  774. data: "tqLpplanId="+tqLpplanId+"&lbacktype=1",
  775. dataType: 'json',
  776. url: "${contextPath}/admin/recipeplan/tqlpplan.html",
  777. error: function(){alert("系统错误");},
  778. success: function(json){
  779. if(json.status == "success"){
  780. location.reload();
  781. }
  782. }
  783. });
  784. }
  785. }
  786. //自动计划
  787. function autoLpplan(){
  788. var flag = confirm("自动计划时,当前页面计划将被清空,您确定自动计划吗?");
  789. if (flag){
  790. $.ajax({
  791. async: false,
  792. type: 'POST',
  793. dataType: 'json',
  794. url: "${contextPath}/admin/recipeplan/autoLpplan.html",
  795. error: function(){alert("系统错误");},
  796. success: function(json){
  797. if(json.status == "success"){
  798. location.reload();
  799. alert("自动计划执行结束,请点击【确认保存】保存此计划!");
  800. }
  801. }
  802. });
  803. }
  804. }
  805. function clearTmr(){
  806. var flag = confirm("您确定清空车号吗?");
  807. if (flag){
  808. $.ajax({
  809. async: false,
  810. type: 'POST',
  811. dataType: 'json',
  812. url: "${contextPath}/admin/recipeplan/clearTmr.html",
  813. error: function(){alert("系统错误");},
  814. success: function(json){
  815. if(json.status == "success"){
  816. location.reload();
  817. }
  818. }
  819. });
  820. }
  821. }
  822. </script>
  823. </head>
  824. <body style="background-color: #E0E0E0">
  825. <div>
  826. <div id="drag">
  827. <table width="200px">
  828. <tr style="background-color: #eee">
  829. <c:forEach var="feedp" items="${feedplists}" varStatus="status">
  830. <c:if test="${(status.index+1) mod 15 !=1}">
  831. <td>
  832. <div class="drag t1" style="background-color: #${feedp.tColor };"><c:out value="${feedp.BNAME }" /></div>
  833. </td>
  834. </c:if>
  835. <c:if test="${(status.index+1) mod 15==1}">
  836. </tr>
  837. <tr>
  838. <td>
  839. <div class="drag t1" style="background-color: #${feedp.tColor };"><c:out value="${feedp.BNAME }" /></div>
  840. </td>
  841. </c:if>
  842. </c:forEach>
  843. </tr>
  844. <tr>
  845. </table>
  846. <table id="list"></table>
  847. </div>
  848. <input type="hidden" id="message"/>
  849. <input type="hidden" id="colorValue" value="" />
  850. </div>
  851. </body>
  852. </html>