123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898 |
- <%@ page contentType="text/html; charset=utf-8" session="false" %>
- <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
- <head>
- <title>我的工作台</title>
- <%@ include file="../common/header.jsp" %>
- <link type="text/css" rel="stylesheet" href="${contextPath}/css/style.css" />
- <script type="text/javascript" src="${contextPath}/js/redips-drag-min.js"></script>
- <script type="text/javascript" src="${contextPath}/js/script.js"></script>
- <script type="text/javascript">
- var mydata,operCount=0,flCount=2,loadfl2=0,loadfl3=0,loadfl4=0,loadfl5=0,loadfl6=0,loadfl7=0,loadfl8=0,loadfl9=0,
- loadfl10=0,loadfl11=0,loadfl12=0,loadfl13=0,loadfl14=0,loadfl15=0,loadfl16=0,isMorningPart=0,isNoonPart=0,isNightPart=0,
- feedpSize = "${feedpSize}",lastrow,lastcell,UserFeedp = 0;
- $(document).ready( function() {
- getDefaultConfig();//获取系统默认参数是否启用补料模版,各班比例
- getUserFeedp();//查询该登录用户是否有关联栏舍
- loadList(); //加载jqgrid
- var count = feedpSize / 15;
-
- if(count <= 1){
- $("#list").jqGrid("setGridHeight",$(window).height() - 70);
- }else if(count > 1 && count <= 2){
- $("#list").jqGrid("setGridHeight",$(window).height() - 110);
- }else if(count > 2 && count <= 3){
- $("#list").jqGrid("setGridHeight",$(window).height() - 140);
- }else if(count > 3 && count <= 4){
- $("#list").jqGrid("setGridHeight",$(window).height() - 180);
- }else if(count > 4 && count <= 5){
- $("#list").jqGrid("setGridHeight",$(window).height() - 210);
- }else if(count > 5 && count <= 6){
- $("#list").jqGrid("setGridHeight",$(window).height() - 250);
- }else if(count > 6 && count <= 7){
- $("#list").jqGrid("setGridHeight",$(window).height() - 280);
- }else if(count > 7 && count <= 8){
- $("#list").jqGrid("setGridHeight",$(window).height() - 320);
- }else if(count > 8 && count <= 9){
- $("#list").jqGrid("setGridHeight",$(window).height() - 350);
- }else if(count > 9 && count <= 10){
- $("#list").jqGrid("setGridHeight",$(window).height() - 390);
- }
- $("#list").jqGrid("setGridWidth",document.body.clientWidth - 5);
-
- });
-
- $(window).resize(function(){
- $("#list").jqGrid("setGridWidth",document.body.clientWidth - 5);
- var count = feedpSize / 15;
- if(count <= 1){
- $("#list").jqGrid("setGridHeight",$(window).height() - 90);
- }else if(count > 1 && count <= 2){
- $("#list").jqGrid("setGridHeight",$(window).height() - 120);
- }else if(count > 2 && count <= 3){
- $("#list").jqGrid("setGridHeight",$(window).height() - 160);
- }else if(count > 3 && count <= 4){
- $("#list").jqGrid("setGridHeight",$(window).height() - 190);
- }else if(count > 4 && count <= 5){
- $("#list").jqGrid("setGridHeight",$(window).height() - 220);
- }else if(count > 5 && count <= 6){
- $("#list").jqGrid("setGridHeight",$(window).height() - 260);
- }else if(count > 6 && count <= 7){
- $("#list").jqGrid("setGridHeight",$(window).height() - 290);
- }else if(count > 7 && count <= 8){
- $("#list").jqGrid("setGridHeight",$(window).height() - 330);
- }else if(count > 8 && count <= 9){
- $("#list").jqGrid("setGridHeight",$(window).height() - 360);
- }else if(count > 9 && count <= 10){
- $("#list").jqGrid("setGridHeight",$(window).height() - 400);
- }
- });
-
- //jqgrid初始化
- function loadList(){
-
- jQuery("#list").jqGrid({
- datatype: "local", //从服务器端返回的数据类型,(表格期望接收的数据类型)。可选类型:xml,xmlstring,json,local,function
- height: "50%", //高度
- 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"], //列名
- colModel:[
- {name: "ID",index: "ID",width: 1,align: "center",sorttype: "string",hidden: true},
- {name: "SORT",index: "SORT",width: 50,align: "center",sorttype: "int",editable: true,editrules: {integer: true}},
- {name: "TNAME",index: "TNAME",width: 70,align: "center",sorttype: "int",editable: true,edittype: "select",
- editoptions:{
- dataUrl: "${contextPath }/admin/recipeplan/tmrselect.html",
- dataEvents: [{
- type: "change", fn: function(e){
- var selId = $("#list").jqGrid("getGridParam","selrow"); //获取当前选中行号
- var thisval = $(e.target).val();
- if(thisval != ""){
- $.ajax({
- async: false,
- type: "post",
- dataType: "json", //返回类型json
- data: "tmrId="+thisval,
- url: "${contextPath }/admin/recipeplan/getDnameByTmrId.html",
- error: function(){alert("系统错误");},
- success: function(json){
- if(json.status == "success"){
- $("#list").setCell(selId,"DNAME",json.DNAME);
- }
- }
- });
-
-
- }else{
- $("#list").setCell(selId,"DNAME"," ");
- }
- }
- }]
- }
- },
- {name: "DNAME",index: "DNAME",width: 70,align: "center",sorttype: "int",editable: true,edittype: "select",editoptions:{dataUrl: "${contextPath }/admin/recipeplan/pilotselect.html"}},
- {name: "Minutes",index: "Minutes",width: 60,align: "center",sorttype: "int",editable: true,editrules: {integer: true}},
- {name: "remark",index: "remark",width: 70,align: "center",sorttype: "string",editable: true},
- {name: "lpplanType",index: "lpplanType",width: 70,align: "center",sorttype: "string",editable: true,edittype: "select",editoptions:{value:{"混合":"混合","上料":"上料","发料":"发料","剩料":"剩料"}}},
- {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"}},
- {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"}},
- {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"}},
- {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"}},
- {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"}},
- {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"}},
- {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"}},
- {name: "beginTime",index: "beginTime",width: 70,align: "center",sorttype: "string",editable: true},
- {name: "sumWeight",index: "sumWeight",width: 70,align: "center",sorttype: "string",editable: false},
- {name: "templetName",index: "templetName",width: 70,align: "center",sorttype: "string",editable: false},
- {name: "CCountRatioRtime",index: "CCountRatioRtime",width: 70,align: "center",sorttype: "string",editable: false},
- {name: "sumCowCount",index: "sumCowCount",width: 70,align: "center",sorttype: "string",editable: false},
- {name: "FL1",index: "FL1",width: 80,align: "center"},
- {name: "FL2",index: "FL2",width: 80,align: "center",sorttype: "string"},
- {name: "FL3",index: "FL3",width: 80,align: "center",sorttype: "string"},
- {name: "FL4",index: "FL4",width: 80,align: "center",sorttype: "string"},
- {name: "FL5",index: "FL5",width: 80,align: "center"},
- {name: "FL6",index: "FL6",width: 80,align: "center",sorttype: "string"},
- {name: "FL7",index: "FL7",width: 80,align: "center",sorttype: "string"},
- {name: "FL8",index: "FL8",width: 80,align: "center",sorttype: "string"},
- {name: "FL9",index: "FL9",width: 80,align: "center",sorttype: "string"},
- {name: "FL10",index: "FL10",width: 80,align: "center",sorttype: "string"},
- {name: "FL11",index: "FL11",width: 80,align: "center",sorttype: "string"},
- {name: "FL12",index: "FL12",width: 80,align: "center",sorttype: "string"},
- {name: "FL13",index: "FL13",width: 80,align: "center",sorttype: "string"},
- {name: "FL14",index: "FL14",width: 80,align: "center",sorttype: "string"},
- {name: "FL15",index: "FL15",width: 80,align: "center",sorttype: "string"},
- {name: "FL16",index: "FL16",width: 80,align: "center",sorttype: "string"},
- {name: "isTNSame",index: "isTNSame",align: "center",sorttype: "string",hidden: true},
- {name: "isSelFeedpSame",index: "isSelFeedpSame",align: "center",sorttype: "string",hidden: true}
- ],
- cellEdit: true,
- cellsubmit: "clientArray", //当单元格发生变化后不直接发送请求、"remote"默认直接发送请求
- /**
- * 设置水平滚动条 begin
- **/
- shrinkToFit:false,
- autoScroll: true,
- autowidth: true, //自动调节宽度
- rowNum: 1000, //每页显示条数
- /**
- * 设置水平滚动条 end
- **/
-
- toolbar: [true,"top"],
-
- beforeEditCell:function(rowid,cellname,v,iRow,iCol){
- lastrow = iRow;
- lastcell = iCol;
- },
-
- afterInsertRow: function(rowid,rowdata,rowelem){
- //配方模版是否相同:1、不相同,0相同。不相同加标注
- if(rowdata.isTNSame == 1){
- $("#list").setCell(rowid,16,"",{background:'#FFE66F'});
- }
- //不同车次有相同班次相同栏舍提示:0不提示,1、班次1有相同栏舍,2、班次2有相同栏舍……。相同加标注
- if(rowdata.isSelFeedpSame > 0){
- if(rowdata.isSelFeedpSame == 1){
- $("#list").setCell(rowid,8,"",{background:'#FFB5B5'});
- }else if(rowdata.isSelFeedpSame == 2){
- $("#list").setCell(rowid,9,"",{background:'#FFB5B5'});
- }else if(rowdata.isSelFeedpSame == 3){
- $("#list").setCell(rowid,10,"",{background:'#FFB5B5'});
- }else if(rowdata.isSelFeedpSame == 4){
- $("#list").setCell(rowid,11,"",{background:'#FFB5B5'});
- }else if(rowdata.isSelFeedpSame == 5){
- $("#list").setCell(rowid,12,"",{background:'#FFB5B5'});
- }else if(rowdata.isSelFeedpSame == 6){
- $("#list").setCell(rowid,13,"",{background:'#FFB5B5'});
- }
- }
- },
- //ondblClickRow: function(rowid){
- // var rowData = $("#list").jqGrid("getRowData",rowid);
- // $.ajax({
- // async: false,
- // type: 'POST',
- // dataType:'json', //返回类型jsond
- // data: "ID="+rowData.ID,
- // url: "${contextPath }/admin/recipeplan/getfeedpName.html",
- // error: function(){alert("系统错误");},
- // success: function(json){
- // if(json.status == "success"){
- // document.location.href="${contextPath }/admin/recipeplan/lpplan.html?cclass="+json.cclass;
- // //$("#feedpResult").load("${contextPath }/admin/recipeplan/queryfeedplist.html?cclass="+json.cclass);
- // }
- // }
- // });
- //}
-
- });
-
- //$("#list").jqGrid("setFrozenColumns"); //设置冻结列
-
- //获取数据集
- mydata = getLists();
-
- if(mydata!=null){
- for(var i=0;i<=mydata.length;i++){
- jQuery("#list").jqGrid('addRowData',i+1,mydata[i]);
- }
- jQuery("#list").jqGrid().trigger("reloadGrid"); //添加完数据后客户端自动刷新一次、实现客户端数据与服务器数据的完全分离
- }
-
- if(operCount == 0){
- //$("#t_list").append("<input id='lpplanCount' type='text' value='' style='width:50px;font-size:-2;padding-top: 2px;font-size:12px;text-align:center;'/> ");
- //$("#t_list").append("<input class='sysub' type='button' value='更新车次' onClick='modifLpplan()' style='font-size:-2'/> ");
- //$("#t_list").append("<input class='sysub' type='button' value='清空车次' onClick='clearLpplan()' style='font-size:-2'/> ");
- if(UserFeedp == 0){
- $("#t_list").append("<input class='sysub' type='button' value='↑' onClick='moveLpplan(\"top\")' style='font-size:-1'/> ");
- $("#t_list").append("<input class='sysub' type='button' value='↓' onClick='moveLpplan(\"down\")' style='font-size:-1'/> ");
- $("#t_list").append("<input class='sysub' type='button' value='新增车次' onClick='addLpplan()' style='font-size:-2'/> ");
- $("#t_list").append("<input class='sysub' type='button' value='删除车次' onClick='delLpplan()' style='font-size:-2'/> ");
- }
- $("#t_list").append("<input class='sysub' type='button' value='添加发料' onClick='addFL()' style='font-size:-2'/> ");
- $("#t_list").append("<input class='sysub' type='button' value='减少发料' onClick='delFL()' style='font-size:-2'/> ");
- $("#t_list").append("<input class='sysub' type='button' value='确认保存' onClick='saveLpplan()' style='font-size:-2'/>");
- $("#t_list").append(" 名称:<input id='lpplanName' name='lpplanName' style='width:60px;font-size:12px;' value='' /> ");
- $("#t_list").append("<input class='sysub' type='button' value='备份' onClick='backLpplan()' style='font-size:-2'/>");
- $("#t_list").append(" 提取:<select id='tqLpplanId'><c:forEach items='${lpplanbacklist }' var='lpplanback'><option value='${lpplanback.lpplanbackId }'><c:out value='${lpplanback.ProjName }' /></option></c:forEach></select> ");
- $("#t_list").append("<input class='sysub' type='button' value='提取' onClick='tqLpplan()' style='font-size:-2'/>");
- $("#t_list").append("<input class='sysub' type='button' value='删除' onClick='dleLpplan()' style='font-size:-2'/>");
- $("#t_list").append("<input class='sysub' type='button' value='自动' onClick='autoLpplan()' style='font-size:-2'/>");
- $("#t_list").append("<input class='sysub' type='button' value='清空车号' onClick='clearTmr()' style='font-size:-2'/>");
- operCount++;
- }
-
- var ids = $("#list").jqGrid("getDataIDs");
- for ( var i = 0; i < ids.length; i++) {
- var rowData = $("#list").jqGrid("getRowData",ids[i]);
-
- var FL2 = rowData.FL2.indexOf("</div>");
- var FL3 = rowData.FL3.indexOf("</div>");
- var FL4 = rowData.FL4.indexOf("</div>");
- var FL5 = rowData.FL5.indexOf("</div>");
- var FL6 = rowData.FL6.indexOf("</div>");
- var FL7 = rowData.FL7.indexOf("</div>");
- var FL8 = rowData.FL8.indexOf("</div>");
- var FL9 = rowData.FL9.indexOf("</div>");
- var FL10 = rowData.FL10.indexOf("</div>");
- var FL11 = rowData.FL11.indexOf("</div>");
- var FL12 = rowData.FL12.indexOf("</div>");
- var FL13 = rowData.FL13.indexOf("</div>");
- var FL14 = rowData.FL14.indexOf("</div>");
- var FL15 = rowData.FL15.indexOf("</div>");
- var FL16 = rowData.FL16.indexOf("</div>");
-
- if(FL2 > 0){
- loadfl2++;
- flCount = 3;
- }
- if(FL3 > 0){
- loadfl3++;
- flCount = 4;
- }
- if(FL4 > 0){
- loadfl4++;
- flCount = 5;
- }
- if(FL5 > 0){
- loadfl5++;
- flCount = 6;
- }
- if(FL6 > 0){
- loadfl6++;
- flCount = 7;
- }
- if(FL7 > 0){
- loadfl7++;
- flCount = 8;
- }
- if(FL8 > 0){
- loadfl8++;
- flCount = 9;
- }
- if(FL9 > 0){
- loadfl9++;
- flCount = 10;
- }
- if(FL10 > 0){
- loadfl10++;
- flCount = 11;
- }
- if(FL11 > 0){
- loadfl11++;
- flCount = 12;
- }
- if(FL12 > 0){
- loadfl12++;
- flCount = 13;
- }
- if(FL13 > 0){
- loadfl13++;
- flCount = 14;
- }
- if(FL14 > 0){
- loadfl14++;
- flCount = 15;
- }
- if(FL15 > 0){
- loadfl15++;
- flCount = 16;
- }
- if(FL16 > 0){
- loadfl16++;
- }
- }
-
- if(loadfl2 == 0){
- $("#list").jqGrid("hideCol","FL2");
- }
- if(loadfl3 == 0){
- $("#list").jqGrid("hideCol","FL3");
- }
- if(loadfl4 == 0){
- $("#list").jqGrid("hideCol","FL4");
- }
- if(loadfl5 == 0){
- $("#list").jqGrid("hideCol","FL5");
- }
- if(loadfl6 == 0){
- $("#list").jqGrid("hideCol","FL6");
- }
- if(loadfl7 == 0){
- $("#list").jqGrid("hideCol","FL7");
- }
- if(loadfl8 == 0){
- $("#list").jqGrid("hideCol","FL8");
- }
- if(loadfl9 == 0){
- $("#list").jqGrid("hideCol","FL9");
- }
- if(loadfl10 == 0){
- $("#list").jqGrid("hideCol","FL10");
- }
- if(loadfl11 == 0){
- $("#list").jqGrid("hideCol","FL11");
- }
- if(loadfl12 == 0){
- $("#list").jqGrid("hideCol","FL12");
- }
- if(loadfl13 == 0){
- $("#list").jqGrid("hideCol","FL13");
- }
- if(loadfl14 == 0){
- $("#list").jqGrid("hideCol","FL14");
- }
- if(loadfl15 == 0){
- $("#list").jqGrid("hideCol","FL15");
- }
- if(loadfl16 == 0){
- $("#list").jqGrid("hideCol","FL16");
- }
- //$("#list").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : true, defaultSearch:"cn"}); 增加行查询工具条
-
- //判断是否分车
- if(isMorningPart == 1){
- $("#list").jqGrid("showCol","sel2");
- }
- if(isNoonPart == 1){
- $("#list").jqGrid("showCol","sel4");
- }
- if(isNightPart == 1){
- $("#list").jqGrid("showCol","sel6");
- }
-
- }
-
- //获取服务器数据
- function getLists(){
- $.ajax({
- async: false,
- type: 'POST',
- dataType:'json', //返回类型json
- url: "${contextPath }/admin/recipeplan/lpplanlist.html",
- error: function(){alert("系统错误");},
- success: function(json){
- mydata = json;
- }
- });
- return mydata;
- }
-
- //自定义添加方法
- function addLpplan(){
- var ids = $("#list").jqGrid("getDataIDs");
- $("#list").jqGrid("addRowData",ids.length+1,{},"first");
- $.ajax({
- async: false,
- type: "POST",
- dataType:"json", //返回类型jsond
- data: "oper=add&selId=",
- url: "${contextPath }/admin/recipeplan/lpplanupdate.html",
- error: function(){alert("系统错误");},
- success: function(json){
- $("#list").clearGridData(); //清空原grid数据
- loadList(); //重新载入服务器数据
- }
- });
- }
-
- //自定义删除方法
- function delLpplan(){
- var row = $("#list").jqGrid("getGridParam","selrow");
- if(row!=null){
- var flag = confirm("您确定要删除吗?");
- if(flag){
- var selRow = $("#list").jqGrid("getRowData",row);
- $.ajax({
- async: false,
- type: "POST",
- dataType:"json", //返回类型jsond
- data: "oper=del&selId="+selRow.ID,
- url: "${contextPath }/admin/recipeplan/lpplanupdate.html",
- error: function(){alert("系统错误");},
- success: function(json){
- $("#list").clearGridData(); //清空原grid数据
- loadList(); //重新载入服务器数据
- }
- });
- }
- }else{
- alert("请选择记录");
- }
- }
-
- //更新车次
- function modifLpplan(){
- var lpplanCount = $("#lpplanCount").val();
- if(lpplanCount.length > 0){
- if(lpplanCount.search("^[1-9]*[1-9][0-9]*$")!=0){
- $("#lpplanCount").val("");
- $("#lpplanCount").focus();
- alert("必须是有效数字!");
- }else{
- var currentCount = $("#list").jqGrid("getDataIDs");
- if(currentCount.length != lpplanCount){
- $.ajax({
- async: false,
- type: 'POST',
- data: "lpplanCount="+lpplanCount,
- dataType: 'json',
- url: "${contextPath}/admin/recipeplan/modiflpplan.html",
- error: function(){alert("系统错误");},
- success: function(json){
- if(json.status == "success"){
- $("#list").clearGridData(); //清空原grid数据
- loadList(); //加载jqgrid
- }
- }
- });
- }
- }
- }else{
- $("#lpplanCount").focus();
- alert("请填入更新数量!");
- }
- }
-
- //清空车次
- function clearLpplan(){
- var flag = confirm("您确定要清空吗?");
- if (flag){
- $.ajax({
- async: false,
- type: 'POST',
- //data: "entityName="+value+"&type="+operType+"&entityId="+rowData.ID,
- dataType: 'json',
- url: "${contextPath}/admin/recipeplan/clearlpplan.html",
- error: function(){alert("系统错误");},
- success: function(json){
- if(json.status == "success"){
- $("#list").clearGridData(); //清空原grid数据
- }
- }
- });
- }
- }
-
- //自定义添加发料
- function addFL(){
- $("#list").jqGrid("showCol","FL"+flCount);
- if(flCount < 17){
- flCount++;
- }
- }
- //自定义减少发料
- function delFL(){
- if(flCount > 2){
- flCount--;
- }
- if(flCount == 2){
- if(loadfl2 == 0){
- $("#list").jqGrid("hideCol","FL"+flCount);
- }else{
- flCount++;
- }
- }else if(flCount == 3){
- if(loadfl3 == 0){
- $("#list").jqGrid("hideCol","FL"+flCount);
- }else{
- flCount++;
- }
- }else if(flCount == 4){
- if(loadfl4 == 0){
- $("#list").jqGrid("hideCol","FL"+flCount);
- }else{
- flCount++;
- }
- }else if(flCount == 5){
- if(loadfl5 == 0){
- $("#list").jqGrid("hideCol","FL"+flCount);
- }else{
- flCount++;
- }
- }else if(flCount == 6){
- if(loadfl6 == 0){
- $("#list").jqGrid("hideCol","FL"+flCount);
- }else{
- flCount++;
- }
- }else if(flCount == 7){
- if(loadfl7 == 0){
- $("#list").jqGrid("hideCol","FL"+flCount);
- }else{
- flCount++;
- }
- }else if(flCount == 8){
- if(loadfl8 == 0){
- $("#list").jqGrid("hideCol","FL"+flCount);
- }else{
- flCount++;
- }
- }else if(flCount == 9){
- if(loadfl9 == 0){
- $("#list").jqGrid("hideCol","FL"+flCount);
- }else{
- flCount++;
- }
- }else if(flCount == 10){
- if(loadfl10 == 0){
- $("#list").jqGrid("hideCol","FL"+flCount);
- }else{
- flCount++;
- }
- }else if(flCount == 11){
- if(loadfl11 == 0){
- $("#list").jqGrid("hideCol","FL"+flCount);
- }else{
- flCount++;
- }
- }else if(flCount == 12){
- if(loadfl12 == 0){
- $("#list").jqGrid("hideCol","FL"+flCount);
- }else{
- flCount++;
- }
- }else if(flCount == 13){
- if(loadfl13 == 0){
- $("#list").jqGrid("hideCol","FL"+flCount);
- }else{
- flCount++;
- }
- }else if(flCount == 14){
- if(loadfl14 == 0){
- $("#list").jqGrid("hideCol","FL"+flCount);
- }else{
- flCount++;
- }
- }else if(flCount == 15){
- if(loadfl15 == 0){
- $("#list").jqGrid("hideCol","FL"+flCount);
- }else{
- flCount++;
- }
- }else if(flCount == 16){
- if(loadfl16 == 0){
- $("#list").jqGrid("hideCol","FL"+flCount);
- }else{
- flCount++;
- }
- }
- }
-
- //确认保存
- function saveLpplan(){
- $("#list").jqGrid("saveCell",lastrow,lastcell);
- //编辑后按过回车状态、可以保存
- if(isMorningPart == 0){
- var ids = $("#list").jqGrid("getDataIDs");
- for ( var i = 0; i < ids.length; i++) {
- $("#list").setCell(ids[i],"sel2","No");
- }
- }
- if(isNoonPart == 0){
- var ids = $("#list").jqGrid("getDataIDs");
- for ( var i = 0; i < ids.length; i++) {
- $("#list").setCell(ids[i],"sel4","No");
- }
- }
- if(isNightPart == 0){
- var ids = $("#list").jqGrid("getDataIDs");
- for ( var i = 0; i < ids.length; i++) {
- $("#list").setCell(ids[i],"sel6","No");
- }
- }
-
- var lpplanStr = "";
- var ids = $("#list").jqGrid("getDataIDs");
- for ( var i = 0; i < ids.length; i++) {
- var rowData = $("#list").jqGrid("getRowData",ids[i]);
-
- var ID = rowData.ID;
- var TNAME = $.trim(rowData.TNAME);
- var DNAME = $.trim(rowData.DNAME);
- var Minutes = rowData.Minutes;
- var remark = rowData.remark;
- var lpplanType = rowData.lpplanType;
- var SORT = rowData.SORT;
- var Sel = rowData.Sel;
- var sel1 = rowData.sel1;
- var sel2 = rowData.sel2;
- var sel3 = rowData.sel3;
- var sel4 = rowData.sel4;
- var sel5 = rowData.sel5;
- var sel6 = rowData.sel6;
- var beginTime = rowData.beginTime;
- var FL1 = rowData.FL1.substring(rowData.FL1.indexOf('>')+1,rowData.FL1.lastIndexOf('<'));
- var FL2 = rowData.FL2.substring(rowData.FL2.indexOf('>')+1,rowData.FL2.lastIndexOf('<'));
- var FL3 = rowData.FL3.substring(rowData.FL3.indexOf('>')+1,rowData.FL3.lastIndexOf('<'));
- var FL4 = rowData.FL4.substring(rowData.FL4.indexOf('>')+1,rowData.FL4.lastIndexOf('<'));
- var FL5 = rowData.FL5.substring(rowData.FL5.indexOf('>')+1,rowData.FL5.lastIndexOf('<'));
- var FL6 = rowData.FL6.substring(rowData.FL6.indexOf('>')+1,rowData.FL6.lastIndexOf('<'));
- var FL7 = rowData.FL7.substring(rowData.FL7.indexOf('>')+1,rowData.FL7.lastIndexOf('<'));
- var FL8 = rowData.FL8.substring(rowData.FL8.indexOf('>')+1,rowData.FL8.lastIndexOf('<'));
- var FL9 = rowData.FL9.substring(rowData.FL9.indexOf('>')+1,rowData.FL9.lastIndexOf('<'));
- var FL10 = rowData.FL10.substring(rowData.FL10.indexOf('>')+1,rowData.FL10.lastIndexOf('<'));
- var FL11 = rowData.FL11.substring(rowData.FL11.indexOf('>')+1,rowData.FL11.lastIndexOf('<'));
- var FL12 = rowData.FL12.substring(rowData.FL12.indexOf('>')+1,rowData.FL12.lastIndexOf('<'));
- var FL13 = rowData.FL13.substring(rowData.FL13.indexOf('>')+1,rowData.FL13.lastIndexOf('<'));
- var FL14 = rowData.FL14.substring(rowData.FL14.indexOf('>')+1,rowData.FL14.lastIndexOf('<'));
- var FL15 = rowData.FL15.substring(rowData.FL15.indexOf('>')+1,rowData.FL15.lastIndexOf('<'));
- var FL16 = rowData.FL16.substring(rowData.FL16.indexOf('>')+1,rowData.FL16.lastIndexOf('<'));
- if(lpplanStr == ""){
- 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;
- }else{
- 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;
- }
- }
-
- $.ajax({
- async: false,
- type: 'POST',
- data: "lpplanStr="+lpplanStr,
- dataType: 'json',
- url: "${contextPath}/admin/recipeplan/updateall.html",
- error: function(){alert("系统错误");},
- success: function(json){
- if(json.status == "success"){
- $("#list").clearGridData(); //清空原grid数据
- window.location.reload();
-
- }
- }
- });
- }
-
- //获取系统默认参数是否启用补料模版,各班比例
- function getDefaultConfig(){
- $.ajax({
- async: false,
- type: 'POST',
- dataType:'json', //返回类型json
- url: "${contextPath }/admin/basicdata/getdefaultconfig.html",
- error: function(){alert("系统错误");},
- success: function(json){
- if(json.status == "success"){
- if(json.isMorningPart){
- isMorningPart = 1;
- }
- if(json.isNoonPart){
- isNoonPart = 1;
- }
- if(json.isNightPart){
- isNightPart = 1;
- }
- }
- }
- });
- }
- //记录移动
- function moveLpplan(moveType){
- $("#list").jqGrid("saveCell",lastrow,lastcell);
- var selId = $("#list").jqGrid("getGridParam","selrow"); //获取当前选中行号
- var rowData = $("#list").jqGrid("getRowData",selId); //获取当前选中行真实对象
- if(selId != null){
- $.ajax({
- async: false,
- type: 'POST',
- dataType:'json', //返回类型json
- url: "${contextPath }/admin/recipeplan/movelpplan.html?planId="+rowData.ID+"&moveType="+moveType+"&Sort="+rowData.SORT,
- error: function(){alert("系统错误");},
- success: function(json){
- if(json.status == "success"){
- if(moveType == "top"){
- selId = Number(selId) - 1;
- }else{
- selId = Number(selId) + 1;
- }
- $("#list").clearGridData(); //清空原grid数据
- loadList(); //加载jqgrid
- }else{
- alert("请正确移动");
- }
- }
- });
- $("#list").jqGrid("setSelection",selId);
- }else{
- alert("请选择记录");
- }
- }
-
- //查询该登录用户是否有关联栏舍
- function getUserFeedp(){
- $.ajax({
- async: false,
- type: 'POST',
- dataType:'json', //返回类型json
- url: "${contextPath }/admin/recipeplan/getUserFeedp.html",
- error: function(){alert("系统错误");},
- success: function(json){
- if(json.status == "success"){
- UserFeedp = json.count;
- }
- }
- });
- }
-
- //备份
- function backLpplan(){
- var lpplanName = $("#lpplanName").val();
- if(lpplanName == ""){
- alert("请输入本次备份的计划名称");
- $("#lpplanName").focus();
- }else{
- $.ajax({
- async: false,
- type: 'POST',
- dataType:'json', //返回类型json
- url: "${contextPath }/admin/recipeplan/backLpplan.html?lpplanName="+lpplanName,
- error: function(){alert("系统错误");},
- success: function(json){
- if(json.status == "success"){
- if(json.lnamecount == "0"){
- alert("备份完成");
- }else{
- alert("计划名称不能重复");
- $("#lpplanName").focus();
- $("#lpplanName").select();
- }
- }
- }
- });
- }
-
- }
-
- //提取
- function tqLpplan(){
- var tqLpplanId = $("#tqLpplanId").val();
- var flag = confirm("提取时,当前页面计划将被清空,您确定提取备份计划吗?");
- if (flag){
- $.ajax({
- async: false,
- type: 'POST',
- data: "tqLpplanId="+tqLpplanId+"&lbacktype=0",
- dataType: 'json',
- url: "${contextPath}/admin/recipeplan/tqlpplan.html",
- error: function(){alert("系统错误");},
- success: function(json){
- if(json.status == "success"){
- location.reload();
- }
- }
- });
- }
- }
-
-
- //删除
- function dleLpplan(){
- var tqLpplanId = $("#tqLpplanId").val();
- var flag = confirm("您确定删除备份计划吗?");
- if (flag){
- $.ajax({
- async: false,
- type: 'POST',
- data: "tqLpplanId="+tqLpplanId+"&lbacktype=1",
- dataType: 'json',
- url: "${contextPath}/admin/recipeplan/tqlpplan.html",
- error: function(){alert("系统错误");},
- success: function(json){
- if(json.status == "success"){
- location.reload();
- }
- }
- });
- }
- }
-
- //自动计划
- function autoLpplan(){
- var flag = confirm("自动计划时,当前页面计划将被清空,您确定自动计划吗?");
- if (flag){
- $.ajax({
- async: false,
- type: 'POST',
- dataType: 'json',
- url: "${contextPath}/admin/recipeplan/autoLpplan.html",
- error: function(){alert("系统错误");},
- success: function(json){
- if(json.status == "success"){
- location.reload();
- alert("自动计划执行结束,请点击【确认保存】保存此计划!");
- }
- }
- });
- }
- }
-
- function clearTmr(){
- var flag = confirm("您确定清空车号吗?");
- if (flag){
- $.ajax({
- async: false,
- type: 'POST',
- dataType: 'json',
- url: "${contextPath}/admin/recipeplan/clearTmr.html",
- error: function(){alert("系统错误");},
- success: function(json){
- if(json.status == "success"){
- location.reload();
- }
- }
- });
- }
- }
-
- </script>
- </head>
- <body style="background-color: #E0E0E0">
- <div>
- <div id="drag">
- <table width="200px">
- <tr style="background-color: #eee">
- <c:forEach var="feedp" items="${feedplists}" varStatus="status">
- <c:if test="${(status.index+1) mod 15 !=1}">
- <td>
- <div class="drag t1" style="background-color: #${feedp.tColor };"><c:out value="${feedp.BNAME }" /></div>
- </td>
- </c:if>
-
- <c:if test="${(status.index+1) mod 15==1}">
- </tr>
- <tr>
- <td>
- <div class="drag t1" style="background-color: #${feedp.tColor };"><c:out value="${feedp.BNAME }" /></div>
- </td>
- </c:if>
- </c:forEach>
- </tr>
- <tr>
- </table>
- <table id="list"></table>
- </div>
- <input type="hidden" id="message"/>
- <input type="hidden" id="colorValue" value="" />
- </div>
- </body>
- </html>
|