312 lines
11 KiB
Plaintext
312 lines
11 KiB
Plaintext
|
|
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||
|
|
<%@ page import="com.sipai.tools.SessionManager"%>
|
||
|
|
<%
|
||
|
|
SessionManager sessionManager = new SessionManager();
|
||
|
|
%>
|
||
|
|
<!DOCTYPE html>
|
||
|
|
<html>
|
||
|
|
<head>
|
||
|
|
<title></title>
|
||
|
|
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
||
|
|
<script type="text/javascript">
|
||
|
|
var gridDetail;
|
||
|
|
var id = '${id}';
|
||
|
|
var displaydata;
|
||
|
|
function SearchData(){
|
||
|
|
$.getJSON(ext.contextPath +"/plan/taskorder/getProdtaskAmount.do?random="+new Date()+"&id="+id,cb);
|
||
|
|
}
|
||
|
|
function cb(data){
|
||
|
|
sessionStorage.setItem("urldetaildata",JSON.stringify(data));
|
||
|
|
//console.log("JSON.stringify(data)",JSON.stringify(data));
|
||
|
|
//console.log("data",data);
|
||
|
|
initTaskOrderData(pcarrL);
|
||
|
|
fLoadTable(pcarrL, PAarr);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
var arr = eval('${result}');//获取后台表头数据
|
||
|
|
var configColumns = function() {
|
||
|
|
var columns = [];
|
||
|
|
// 配置固定列表头
|
||
|
|
columns.push([{
|
||
|
|
"title": "日计划",
|
||
|
|
"field": "stdt",
|
||
|
|
halign:'center',
|
||
|
|
rowspan: 3,
|
||
|
|
formatter:function(value,row){
|
||
|
|
var str = value.substring(0,10);
|
||
|
|
return str;
|
||
|
|
}
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"title": "工艺号",
|
||
|
|
"field": "processrealid",
|
||
|
|
halign:'center',
|
||
|
|
rowspan: 3
|
||
|
|
},
|
||
|
|
//{
|
||
|
|
// "title": "计划开工日期",
|
||
|
|
// "field": "pstdate",
|
||
|
|
// halign:'center',
|
||
|
|
// rowspan: 3
|
||
|
|
// }, {
|
||
|
|
// "title": "计划完工日期",
|
||
|
|
// "field": "pendate",
|
||
|
|
// halign:'center',
|
||
|
|
// rowspan: 3
|
||
|
|
// },
|
||
|
|
{
|
||
|
|
"title": "产量",
|
||
|
|
colspan: arr.length * 2
|
||
|
|
}
|
||
|
|
]);
|
||
|
|
// 配置表头
|
||
|
|
columns.push(configDaysAmount());
|
||
|
|
columns.push(configAPAmount());
|
||
|
|
return columns;
|
||
|
|
}
|
||
|
|
|
||
|
|
var configDaysAmount = function() {
|
||
|
|
var daysAmount = [];
|
||
|
|
for (var i = 0; i < arr.length; i++) {
|
||
|
|
daysAmount.push({
|
||
|
|
title:arr[i].procedurename,
|
||
|
|
field:arr[i].procedurecode,
|
||
|
|
colspan: 2,
|
||
|
|
width:100,
|
||
|
|
halign:'center',
|
||
|
|
});
|
||
|
|
}
|
||
|
|
return daysAmount;
|
||
|
|
}
|
||
|
|
// 配置(包含实际和计划)表头的方法
|
||
|
|
var planvalue;//记录计划的值 用于比对
|
||
|
|
var configAPAmount = function() {
|
||
|
|
var APAmount = [];
|
||
|
|
var currentArr=[];
|
||
|
|
for (var j = 0; j < 2*arr.length;j++) {
|
||
|
|
// console.log("sed:",search_days);
|
||
|
|
var amountobj = {
|
||
|
|
field: "u"+j,
|
||
|
|
rowspan: 1,
|
||
|
|
align: 'center',
|
||
|
|
title: '计划',
|
||
|
|
width: '50'
|
||
|
|
};
|
||
|
|
if(j%2 == 0){
|
||
|
|
amountobj.title = "计划";
|
||
|
|
amountobj.formatter=function(value,row,index){
|
||
|
|
if (value != ''){
|
||
|
|
planvalue = value;
|
||
|
|
return value;
|
||
|
|
}else{
|
||
|
|
planvalue = 0;
|
||
|
|
return 0;
|
||
|
|
}
|
||
|
|
};
|
||
|
|
} else {
|
||
|
|
amountobj.title = "实际";
|
||
|
|
amountobj.formatter=function(value,row,index){
|
||
|
|
if (value == ''){
|
||
|
|
return 0;
|
||
|
|
}
|
||
|
|
else{
|
||
|
|
return value;
|
||
|
|
}
|
||
|
|
};
|
||
|
|
amountobj.styler= function(value,row,index){
|
||
|
|
//console.log("planvalue",planvalue);
|
||
|
|
//console.log("value",value);
|
||
|
|
if (value-planvalue<0){
|
||
|
|
return 'color:red;';
|
||
|
|
}
|
||
|
|
else if (value-planvalue>0){
|
||
|
|
return 'color:green;';
|
||
|
|
}
|
||
|
|
};
|
||
|
|
}
|
||
|
|
currentArr.push(amountobj);
|
||
|
|
}
|
||
|
|
APAmount = currentArr;
|
||
|
|
// 循环日期
|
||
|
|
return APAmount;
|
||
|
|
}
|
||
|
|
|
||
|
|
//对象的克隆函数
|
||
|
|
var cloneObj = function(obj) {
|
||
|
|
var str, newobj = obj.constructor === Array ? [] : {};
|
||
|
|
if (typeof obj !== 'object') {
|
||
|
|
return;
|
||
|
|
} else if (window.JSON) {
|
||
|
|
str = JSON.stringify(obj), //系列化对象
|
||
|
|
newobj = JSON.parse(str); //还原
|
||
|
|
} else {
|
||
|
|
for (var i in obj) {
|
||
|
|
newobj[i] = typeof obj[i] === 'object' ?
|
||
|
|
cloneObj(obj[i]) : obj[i];
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return newobj;
|
||
|
|
};
|
||
|
|
|
||
|
|
var makeData = function(dailyplantaskdemand,temArr){
|
||
|
|
dailyplantaskdemand.map( function(ele, index){
|
||
|
|
if(ele.taskcode != "sss"){
|
||
|
|
var jj;
|
||
|
|
for(var i=0;i<arr.length;i++)
|
||
|
|
{
|
||
|
|
//console.log("ele.taskcode",ele.taskcode);
|
||
|
|
//console.log("arr[i]",arr[i].procedurecode);
|
||
|
|
if(ele.taskcode == arr[i].procedurecode)
|
||
|
|
{
|
||
|
|
jj=i;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if (jj>=0){
|
||
|
|
temArr[2*jj] = {"amount":ele.preamount,"taskcode":ele.taskcode};
|
||
|
|
temArr[2*jj+1] = {"amount":ele.actamount,"taskcode":ele.taskcode};
|
||
|
|
}
|
||
|
|
}
|
||
|
|
})
|
||
|
|
for (var i = 0; i < temArr.length; i++) {
|
||
|
|
if (temArr[i] == undefined) {
|
||
|
|
temArr[i] = PlainAmount("sss");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
//console.log("temArr",temArr);
|
||
|
|
return temArr;
|
||
|
|
}
|
||
|
|
|
||
|
|
var PlainAmount = function(taskcode) {
|
||
|
|
return {
|
||
|
|
amount: '',
|
||
|
|
taskcode: taskcode,
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
function initDetail(pcarrL, PAarr){
|
||
|
|
//console.log("search_days", search_days);
|
||
|
|
SearchData( );
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
// 处理后台数据,处理没有任务量的那些日期
|
||
|
|
var initTaskOrderData = function(pcarrL) {
|
||
|
|
var taskOrderData1 = cloneObj(JSON.parse(sessionStorage.getItem("urldetaildata")));
|
||
|
|
sessionStorage.clear();
|
||
|
|
for(var i = 0;i < taskOrderData1.rows.length; i++){
|
||
|
|
var temArr = new Array(2*pcarrL);
|
||
|
|
var tas = makeData(taskOrderData1.rows[i].dailyplantaskdemand,temArr);
|
||
|
|
//console.log("tas",tas);
|
||
|
|
for(var j=0;j<tas.length;j++){
|
||
|
|
var fieldid="u"+j;
|
||
|
|
taskOrderData1.rows[i][fieldid] = tas[j].amount;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
//console.log("tod",taskOrderData1);
|
||
|
|
displaydata = taskOrderData1;
|
||
|
|
}
|
||
|
|
|
||
|
|
var pcarrL, PAarr;
|
||
|
|
$(function() {
|
||
|
|
console.log("id",id);
|
||
|
|
pcarrL = arr.length;//procedurecode array length
|
||
|
|
PAarr = new Array(2 * pcarrL);//Plan & Act amount array
|
||
|
|
initDetail(pcarrL,PAarr);
|
||
|
|
});
|
||
|
|
|
||
|
|
var searchFun = function() {
|
||
|
|
pcarrL = arr.length;//procedurecode array length
|
||
|
|
PAarr = new Array(2 * pcarrL);//Plan & Act amount array
|
||
|
|
if( $('#dpDate').val() != "")
|
||
|
|
{
|
||
|
|
$.getJSON(ext.contextPath +"/plan/taskorder/getProdtaskAmount.do?dpDate="+$('#dpDate').val()+"&id="+id,cab);
|
||
|
|
function cab(data){
|
||
|
|
sessionStorage.setItem("urldetaildata",JSON.stringify(data));
|
||
|
|
//console.log("JSON.stringify(data)",JSON.stringify(data));
|
||
|
|
//console.log("data",data);
|
||
|
|
initTaskOrderData(pcarrL);
|
||
|
|
fLoadTable(pcarrL, PAarr);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
initDetail(pcarrL,PAarr);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
var fLoadTable = function(pcarrL, PAarr) {
|
||
|
|
gridDetail = $("#gridDetail").datagrid({
|
||
|
|
data: displaydata.rows,
|
||
|
|
title : '',
|
||
|
|
//url : ext.contextPath + '/plan/taskorder/getTaskOrderDetailDayPlan.do?id=${id}'+'&stdt=${stdt}',
|
||
|
|
striped : true,
|
||
|
|
rownumbers : true,
|
||
|
|
pagination : true,
|
||
|
|
singleSelect: true,
|
||
|
|
ctrlSelect:true,
|
||
|
|
selectOnCheck: false,
|
||
|
|
checkOnSelect: false,
|
||
|
|
idField : 'id',
|
||
|
|
pageSize : 50,
|
||
|
|
pageList : [ 20, 50, 100],
|
||
|
|
/*columns : [ [
|
||
|
|
{width : '180', title : '日期', field : 'stdt', sortable : true, halign:'center',formatter:function(value,row){
|
||
|
|
var str = value.substring(0,10);
|
||
|
|
return str;
|
||
|
|
}},
|
||
|
|
{width : '180', title : '任务单编号', field : 'tasklistcode', sortable : true, halign:'center'},
|
||
|
|
{width : '180', title : '工序', field : 'taskcode', sortable : true, halign:'center'},
|
||
|
|
{width : '90', title : '计划生产值', field : 'preamount', sortable : true, align:'center', halign:'center'},
|
||
|
|
{width : '90', title : '实际生产值', field : 'actamount', sortable : true, align:'center', halign:'center'},
|
||
|
|
|
||
|
|
] ],*/
|
||
|
|
columns: configColumns(),
|
||
|
|
toolbar : '#toolbar',
|
||
|
|
onLoadSuccess : function(data) {
|
||
|
|
$('.iconImg').attr('src', ext.pixel_0);
|
||
|
|
sessionStorage.clear();
|
||
|
|
//console.log("displaydata",displaydata);
|
||
|
|
//console.log("urldetaildata",sessionStorage.getItem("urldetaildata"));
|
||
|
|
}
|
||
|
|
});
|
||
|
|
};
|
||
|
|
</script>
|
||
|
|
</head>
|
||
|
|
<body>
|
||
|
|
<div id="cc" class="easyui-layout" data-options="fit:true,border:false">
|
||
|
|
<div id="tbar">
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div data-options="region:'center',title:'${taskno}'" style="padding:0px;">
|
||
|
|
<div class="easyui-layout" data-options="fit:true,border:false">
|
||
|
|
<div id="toolbar" style="display: none;">
|
||
|
|
<table>
|
||
|
|
<tr>
|
||
|
|
<td>
|
||
|
|
<form id="searchForm">
|
||
|
|
<table>
|
||
|
|
<tr>
|
||
|
|
<td>日计划</td>
|
||
|
|
<td><input id="dpDate" name="dpDate" class="Wdate" bind-value=" justep.Date.toString(new Date(),'yyyy-MM-dd')"
|
||
|
|
onfocus="WdatePicker({startDate:'%y',dateFmt:'yyyy-MM-dd',maxDate:'%y-%M-{%d}'})" data-options="required:true,validType:'isBlank'" readonly/></td>
|
||
|
|
<td><a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'ext-icon-search',plain:true"
|
||
|
|
onclick="searchFun()">搜索</a>
|
||
|
|
<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true"
|
||
|
|
onclick="$('#searchForm').form('clear');gridDetail.datagrid('load',{});">重置</a>
|
||
|
|
</td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</form>
|
||
|
|
</td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</div>
|
||
|
|
<div data-options="region:'center',fit:true,border:false">
|
||
|
|
<table id="gridDetail" data-options="fit:true,border:false"></table>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</body>
|
||
|
|
</html>
|