558 lines
22 KiB
Plaintext
558 lines
22 KiB
Plaintext
|
|
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
|||
|
|
<%@ page import="com.sipai.tools.SessionManager"%>
|
|||
|
|
<%
|
|||
|
|
SessionManager sessionManager = new SessionManager();
|
|||
|
|
%>
|
|||
|
|
|
|||
|
|
<%request.setAttribute("TO_Flag_ERPConfirm",com.sipai.entity.plan.Taskorder.TO_Flag_ERPConfirm);%>
|
|||
|
|
<%request.setAttribute("TO_Flag_Issued",com.sipai.entity.plan.Taskorder.TO_Flag_Issued);%>
|
|||
|
|
<%request.setAttribute("TO_Flag_Working",com.sipai.entity.plan.Taskorder.TO_Flag_Working);%>
|
|||
|
|
<%request.setAttribute("TO_Flag_Closed",com.sipai.entity.plan.Taskorder.TO_Flag_Closed);%>
|
|||
|
|
<%request.setAttribute("TO_Flag_Cancel",com.sipai.entity.plan.Taskorder.TO_Flag_Cancel);%>
|
|||
|
|
<%request.setAttribute("TO_Flag_NoPlan",com.sipai.entity.plan.Taskorder.TO_Flag_NoPlan);%>
|
|||
|
|
<%request.setAttribute("TO_Flag_ERPIssued",com.sipai.entity.plan.Taskorder.TO_Flag_ERPIssued);%>
|
|||
|
|
<!DOCTYPE html>
|
|||
|
|
<html>
|
|||
|
|
<head>
|
|||
|
|
<title></title>
|
|||
|
|
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
|||
|
|
<script type="text/javascript">
|
|||
|
|
var idays = 15;
|
|||
|
|
var dm = '${displaymodel}';
|
|||
|
|
var distFun = function(tasklistcode,dt,prid) {
|
|||
|
|
console.log("dm",dm)
|
|||
|
|
var dialog = parent.ext.modalDialog({
|
|||
|
|
width: 1200,
|
|||
|
|
height:550,
|
|||
|
|
title : '分配任务量',
|
|||
|
|
url : ext.contextPath + '/plan/taskorder/showDistricWork.do?displaymodel='+dm+'&tasklistcode='+tasklistcode+'&stdt='+dt+'&prid='+prid,
|
|||
|
|
buttons : [ {
|
|||
|
|
text : '关闭',
|
|||
|
|
handler : function() {
|
|||
|
|
|
|||
|
|
dialog.dialog('destroy');
|
|||
|
|
}
|
|||
|
|
}],
|
|||
|
|
onDestroy:function(){
|
|||
|
|
grid.datagrid('reload');
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
var viewDetailFun = function(stdt) {
|
|||
|
|
var dialog = parent.ext.modalDialog({
|
|||
|
|
title : '查看详细信息',
|
|||
|
|
width:1250,
|
|||
|
|
height:580,
|
|||
|
|
url : ext.contextPath + '/plan/taskorder/viewTaskOrderDetailDayPlan.do?stdt=' + stdt
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
//当前日期前7天
|
|||
|
|
var startdateFun = function(n){
|
|||
|
|
var now = new Date;
|
|||
|
|
now.setDate(now.getDate() - n);
|
|||
|
|
return now;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
var startdateOrder = function(){
|
|||
|
|
var syear = startdateFun(7).getFullYear();
|
|||
|
|
var smonth = startdateFun(7).getMonth()+1;
|
|||
|
|
if(smonth<10)
|
|||
|
|
{
|
|||
|
|
smonth="0"+smonth;
|
|||
|
|
}
|
|||
|
|
var sdate = startdateFun(7).getDate();
|
|||
|
|
if(sdate<10)
|
|||
|
|
{
|
|||
|
|
sdate="0"+sdate;
|
|||
|
|
}
|
|||
|
|
stD = dateToString(new Date(syear+"-"+smonth+"-"+sdate));
|
|||
|
|
return stD;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
//当前日期后7天
|
|||
|
|
var enddateFun = function(n){
|
|||
|
|
var now = new Date;
|
|||
|
|
now.setDate(now.getDate() + n);
|
|||
|
|
return now;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
var enddateOrder = function(){
|
|||
|
|
var syear = enddateFun(7).getFullYear();
|
|||
|
|
var smonth = enddateFun(7).getMonth()+1;
|
|||
|
|
if(smonth<10)
|
|||
|
|
{
|
|||
|
|
smonth="0"+smonth;
|
|||
|
|
}
|
|||
|
|
var sdate = enddateFun(7).getDate();
|
|||
|
|
if(sdate<10)
|
|||
|
|
{
|
|||
|
|
sdate="0"+sdate;
|
|||
|
|
}
|
|||
|
|
stD = dateToString(new Date(syear+"-"+smonth+"-"+sdate));
|
|||
|
|
return stD;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
var clearFun= function(){
|
|||
|
|
startDate1 = startdateOrder();
|
|||
|
|
document.getElementById('startDate').value=startDate1;
|
|||
|
|
|
|||
|
|
endDate1 = enddateOrder();
|
|||
|
|
document.getElementById('endDate').value= enddateOrder();
|
|||
|
|
|
|||
|
|
$('#search_proced').combobox('clear');
|
|||
|
|
|
|||
|
|
var search_days1 = DateDiff(new Date(endDate1), new Date(startDate1))+1;
|
|||
|
|
//console.log("sd2",search_days1);
|
|||
|
|
var daysArr = new Array(2 * search_days1);
|
|||
|
|
|
|||
|
|
window.MES = {
|
|||
|
|
startDate: startDate1,
|
|||
|
|
endDate: endDate1,
|
|||
|
|
search_days: 15,
|
|||
|
|
daysArr: new Array(30)
|
|||
|
|
}
|
|||
|
|
init(MES.search_days,MES.daysArr,MES.startDate,MES.endDate);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
$(function() {
|
|||
|
|
$('#search_proced').combobox({
|
|||
|
|
url : ext.contextPath + '/process/taskprocedure/getprocedlist.do?random=' + Math.random(),
|
|||
|
|
valueField:'procedurecode',
|
|||
|
|
textField:'procedurename',
|
|||
|
|
method:'get'
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
// 查询开始日期
|
|||
|
|
var startDate1 = $('#startDate').val();
|
|||
|
|
// 查询结束日期
|
|||
|
|
var endDate1 = $('#endDate').val();
|
|||
|
|
// 查询了多少天
|
|||
|
|
if (startDate1 == "") {
|
|||
|
|
startDate1 = startdateOrder();
|
|||
|
|
document.getElementById('startDate').value=startDate1;
|
|||
|
|
//console.log("sd",startDate1);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (endDate1 == "") {
|
|||
|
|
endDate1 = enddateOrder();
|
|||
|
|
document.getElementById('endDate').value= enddateOrder();
|
|||
|
|
//console.log("ed",endDate1);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var search_days1 = DateDiff(new Date(endDate1), new Date(startDate1))+1;
|
|||
|
|
//console.log("sd2",search_days1);
|
|||
|
|
var daysArr = new Array(2 * search_days1);
|
|||
|
|
|
|||
|
|
window.MES = {
|
|||
|
|
startDate: startDate1,
|
|||
|
|
endDate: endDate1,
|
|||
|
|
search_days: 15,
|
|||
|
|
daysArr: new Array(30)
|
|||
|
|
}
|
|||
|
|
init(MES.search_days,MES.daysArr,MES.startDate,MES.endDate);
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
var searchFun = function() {
|
|||
|
|
$(function(){
|
|||
|
|
var startDate1 = $('#startDate').val();
|
|||
|
|
// 查询结束日期
|
|||
|
|
var endDate1 = $('#endDate').val();
|
|||
|
|
// 查询了多少天
|
|||
|
|
if (startDate1 == "") {
|
|||
|
|
startDate1 = dateToString(new Date(startdateFun));
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (endDate1 == "") {
|
|||
|
|
endDate1 = dateFromToday(new Date(startDate1), 15);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var search_days1 = DateDiff(new Date(endDate1), new Date(startDate1))+1;
|
|||
|
|
|
|||
|
|
var daysArr = new Array(2 * search_days1);
|
|||
|
|
window.MES = {
|
|||
|
|
startDate: startDate1,
|
|||
|
|
endDate: endDate1,
|
|||
|
|
search_days: search_days1,
|
|||
|
|
daysArr: daysArr
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
init(MES.search_days,MES.daysArr,MES.startDate,MES.endDate);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function init(search_days, daysArr,startDate,endDate){
|
|||
|
|
//console.log("search_days", search_days);
|
|||
|
|
$.getJSON(ext.contextPath +"/activiti/workflow/getLASTPDAmount.do?displaymodel="+dm+"&startDate=" + startDate +"&endDate=" + endDate + "&search_proced="+$('#search_proced').textbox('getValue'),callback);
|
|||
|
|
function callback(data){
|
|||
|
|
localStorage.setItem("urldata",JSON.stringify(data));
|
|||
|
|
initTaskOrderData(search_days);
|
|||
|
|
//组装后的数据
|
|||
|
|
//console.log("dailyTA1:", initTaskOrderData(search_days));
|
|||
|
|
fLoadTable(search_days, daysArr);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 处理后台数据,处理没有任务量的那些日期
|
|||
|
|
var initTaskOrderData = function(search_day) {
|
|||
|
|
//console.log("weichuli",localStorage.getItem("urldata"));
|
|||
|
|
var taskOrderData1 = cloneObj(JSON.parse(localStorage.getItem("urldata")));
|
|||
|
|
//console.log("chulihou",taskOrderData1);
|
|||
|
|
//localStorage.removeItem("urldata");
|
|||
|
|
for(var i = 0;i < taskOrderData1.rows.length; i++){
|
|||
|
|
var temArr = new Array(2*MES.search_days);
|
|||
|
|
var tas = makeData(taskOrderData1.rows[i].dailytotalamount,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);
|
|||
|
|
return taskOrderData1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var fLoadTable = function(search_days, daysArr) {
|
|||
|
|
$("#grid").datagrid({
|
|||
|
|
data: initTaskOrderData(search_days).rows,
|
|||
|
|
title: '',
|
|||
|
|
striped: true,
|
|||
|
|
rownumbers: true,
|
|||
|
|
//pagination: true,
|
|||
|
|
singleSelect: true,
|
|||
|
|
selectOnCheck: true,
|
|||
|
|
checkOnSelect: false,
|
|||
|
|
idField: 'id',
|
|||
|
|
pageSize: 50,
|
|||
|
|
pageList: [20, 50, 100],
|
|||
|
|
columns: configColumns(search_days, daysArr),
|
|||
|
|
toolbar : '#toolbar',
|
|||
|
|
onHeaderContextMenu : function(e, field){
|
|||
|
|
if(field.length>8&&field!="tasklistcode"&&field!="salesno"&&field!="processrealid"){
|
|||
|
|
viewDetailFun(field);
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
onBeforeSortColumn:function(sort, order){
|
|||
|
|
if(sort.length>8&&sort!="tasklistcode"&&sort!="salesno"&&sort!="processrealid"){
|
|||
|
|
viewDetailFun(sort);
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
onDblClickCell: function(index,field,value){
|
|||
|
|
if(dm!="TO")
|
|||
|
|
{
|
|||
|
|
<%if (sessionManager.havePermission(session,"plan/taskorder/editTaskorder.do")) {%>
|
|||
|
|
if(value != ""){
|
|||
|
|
var tasklistcode =$('#grid').datagrid('getRows')[index].id;//获取点击单元格任务单
|
|||
|
|
//console.log("tasklistcode",tasklistcode);
|
|||
|
|
var d = new Date(MES.startDate);
|
|||
|
|
d.setDate(d.getDate()+parseInt(field.substring(1,field.length)/2));
|
|||
|
|
var dt = d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
|
|||
|
|
if(d.getDate()<10)
|
|||
|
|
{
|
|||
|
|
dt = d.getFullYear()+"-"+(d.getMonth()+1)+"-0"+d.getDate();
|
|||
|
|
}
|
|||
|
|
var prid = $('#grid').datagrid('getRows')[index].processrealid;//获取点击单元格工艺号
|
|||
|
|
distFun(tasklistcode,dt,prid);
|
|||
|
|
}
|
|||
|
|
<%}%>
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
onLoadSuccess: function(data){
|
|||
|
|
var mark=1; //这里涉及到简单的运算,mark是计算每次需要合并的格子数
|
|||
|
|
for (var i=1; i <data.rows.length; i++) { //这里循环表格当前的数据
|
|||
|
|
if (data.rows[i]['tasklistcode'] == data.rows[i-1]['tasklistcode']) { //后一行的值与前一行的值做比较,相同就需要合并
|
|||
|
|
mark += 1;
|
|||
|
|
$(this).datagrid('mergeCells',{
|
|||
|
|
index: i+1-mark, //datagrid的index,表示从第几行开始合并;紫色的内容需是最精髓的,就是记住最开始需要合并的位置
|
|||
|
|
field: 'tasklistcode', //合并单元格的区域,就是clomun中的filed对应的列
|
|||
|
|
rowspan:mark //纵向合并的格数,如果想要横向合并,就使用colspan:mark
|
|||
|
|
});
|
|||
|
|
$(this).datagrid('mergeCells',{
|
|||
|
|
index: i+1-mark, //datagrid的index,表示从第几行开始合并;紫色的内容需是最精髓的,就是记住最开始需要合并的位置
|
|||
|
|
field: 'salesno', //合并单元格的区域,就是clomun中的filed对应的列
|
|||
|
|
rowspan:mark //纵向合并的格数,如果想要横向合并,就使用colspan:mark
|
|||
|
|
});
|
|||
|
|
$(this).datagrid('mergeCells',{
|
|||
|
|
index: i+1-mark, //datagrid的index,表示从第几行开始合并;紫色的内容需是最精髓的,就是记住最开始需要合并的位置
|
|||
|
|
field: 'prodamount', //合并单元格的区域,就是clomun中的filed对应的列
|
|||
|
|
rowspan:mark //纵向合并的格数,如果想要横向合并,就使用colspan:mark
|
|||
|
|
});
|
|||
|
|
}else{
|
|||
|
|
mark=1; //一旦前后两行的值不一样了,那么需要合并的格子数mark就需要重新计算
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
// 组装表头的方法
|
|||
|
|
var configColumns = function(search_days, daysArr) {
|
|||
|
|
var columns = [];
|
|||
|
|
// 配置固定列表头
|
|||
|
|
columns.push([{
|
|||
|
|
"title": "销售订单号",
|
|||
|
|
"field": "salesno",
|
|||
|
|
halign:'center',
|
|||
|
|
rowspan: 3
|
|||
|
|
}, {
|
|||
|
|
"title": "任务单编号",
|
|||
|
|
"field": "tasklistcode",
|
|||
|
|
halign:'center',
|
|||
|
|
rowspan: 3
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
"title": "工艺编号",
|
|||
|
|
"field": "processrealid",
|
|||
|
|
halign:'center',
|
|||
|
|
rowspan: 3
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
"title": "运行状态",
|
|||
|
|
"field": "billstatus",
|
|||
|
|
halign:'center',
|
|||
|
|
rowspan: 1,
|
|||
|
|
rowspan: 3,
|
|||
|
|
formatter:function(value,row){
|
|||
|
|
switch (value) {
|
|||
|
|
case '${TO_Flag_ERPConfirm}':
|
|||
|
|
return '确认';
|
|||
|
|
case '${TO_Flag_Issued}':
|
|||
|
|
return '下发';
|
|||
|
|
case '${TO_Flag_Working}':
|
|||
|
|
return '开工';
|
|||
|
|
case '${TO_Flag_Closed}':
|
|||
|
|
return '结案';
|
|||
|
|
case '${TO_Flag_Cancel}':
|
|||
|
|
return '作废';
|
|||
|
|
case '${TO_Flag_NoPlan}':
|
|||
|
|
return '未排计划';
|
|||
|
|
case '${TO_Flag_ERPIssued}':
|
|||
|
|
return 'ERP下达';
|
|||
|
|
default:
|
|||
|
|
return '';
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
},
|
|||
|
|
// {
|
|||
|
|
// "title": "产品编号",
|
|||
|
|
// "field": "productno",
|
|||
|
|
// rowspan: 3
|
|||
|
|
// },
|
|||
|
|
{
|
|||
|
|
"title": "计划产量",
|
|||
|
|
"field": "prodamount",
|
|||
|
|
halign:'center',
|
|||
|
|
rowspan: 3
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
"title": "实际产量(周期内)",
|
|||
|
|
"field": "totalactamount",
|
|||
|
|
halign:'center',
|
|||
|
|
rowspan: 3
|
|||
|
|
},
|
|||
|
|
//{
|
|||
|
|
// "title": "计划开工日期",
|
|||
|
|
// "field": "pstdate",
|
|||
|
|
// rowspan: 3
|
|||
|
|
// }, {
|
|||
|
|
// "title": "计划完工日期",
|
|||
|
|
// "field": "pendate",
|
|||
|
|
// rowspan: 3
|
|||
|
|
// },
|
|||
|
|
{
|
|||
|
|
"title": "产量(" + dateToString(MES.startDate) + " 至 " + dateFromToday(new Date(MES.startDate), search_days-1) + ")",
|
|||
|
|
colspan: search_days * 2
|
|||
|
|
}
|
|||
|
|
]);
|
|||
|
|
// 配置日期表头
|
|||
|
|
columns.push(configDaysAmount(search_days));
|
|||
|
|
columns.push(configAPAmount(search_days, daysArr));
|
|||
|
|
return columns;
|
|||
|
|
}
|
|||
|
|
// 配置日期表头的方法
|
|||
|
|
var configDaysAmount = function(search_days) {
|
|||
|
|
var daysAmount = [];
|
|||
|
|
for (var i = 0; i < search_days; i++) {
|
|||
|
|
var year = new Date(dateFromToday(new Date(MES.startDate), i)).getFullYear();
|
|||
|
|
var month = new Date(dateFromToday(new Date(MES.startDate), i)).getMonth()+1;
|
|||
|
|
if(month<10)
|
|||
|
|
{
|
|||
|
|
month="0"+month;
|
|||
|
|
}
|
|||
|
|
var date = new Date(dateFromToday(new Date(MES.startDate), i)).getDate();
|
|||
|
|
if(date<10)
|
|||
|
|
{
|
|||
|
|
date="0"+date;
|
|||
|
|
}
|
|||
|
|
daysAmount.push({
|
|||
|
|
title:month+"-"+date,
|
|||
|
|
field: year+"-"+month+"-"+date,
|
|||
|
|
colspan: 2,
|
|||
|
|
halign:'center',
|
|||
|
|
sortable:true
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
return daysAmount;
|
|||
|
|
}
|
|||
|
|
// 配置每日计划(包含实际和计划)表头的方法
|
|||
|
|
var configAPAmount = function(search_days, daysArr) {
|
|||
|
|
var APAmount = [];
|
|||
|
|
|
|||
|
|
var thisGGG = initTaskOrderData(search_days);
|
|||
|
|
thisGGG.rows.map(function(ele){
|
|||
|
|
var currentArr=[];
|
|||
|
|
for (var j = 0; j < 2*search_days; j++) {
|
|||
|
|
// console.log("sed:",search_days);
|
|||
|
|
var amountobj = {
|
|||
|
|
field: "u"+j,
|
|||
|
|
rowspan: 1,
|
|||
|
|
align: 'center',
|
|||
|
|
title: '计划'
|
|||
|
|
};
|
|||
|
|
if(j%2 == 0){
|
|||
|
|
amountobj.title = "计划";
|
|||
|
|
amountobj.formatter=function(value,row,index){
|
|||
|
|
if (value != undefined){
|
|||
|
|
planvalue = value;
|
|||
|
|
}
|
|||
|
|
return value;
|
|||
|
|
};
|
|||
|
|
} else {
|
|||
|
|
amountobj.title = "实际";
|
|||
|
|
amountobj.styler= function(value,row,index){
|
|||
|
|
//console.log("planvalue",planvalue);
|
|||
|
|
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 DateDiff = function(endDate, startDate) { //endDate和endDate是yyyy-MM-dd格式
|
|||
|
|
var iDays = parseInt(Math.abs(endDate - startDate) / 1000 / 60 / 60 / 24); //把相差的毫秒数转换为天数
|
|||
|
|
return Math.abs(iDays); //返回相差天数
|
|||
|
|
}
|
|||
|
|
//将日期转换为“YYYY-MM-DD”格式的日期
|
|||
|
|
var dateToString = function(date) {
|
|||
|
|
var today = new Date(date);
|
|||
|
|
var year = today.getFullYear();
|
|||
|
|
var month = today.getMonth() + 1;
|
|||
|
|
var day = today.getDate();
|
|||
|
|
return year + "-" + paddingZero(month) + "-" + paddingZero(day);
|
|||
|
|
}
|
|||
|
|
//空位补零
|
|||
|
|
var paddingZero = function(n) {
|
|||
|
|
//return n<10 ? "0" + n : "" + n;
|
|||
|
|
return (Array(2).join('0') + n).slice(-2);
|
|||
|
|
}
|
|||
|
|
//距离某天多少天(n:正整数为多少天之后,负整数为多少天之前),返回“YYYY-MM-DD”格式的日期
|
|||
|
|
var dateFromToday = function(date, n) {
|
|||
|
|
return dateToString(new Date(date.getTime() + n * 24 * 60 * 60 * 1000));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
var makeData = function(dailytotalamount,temArr){
|
|||
|
|
// 查询开始日期
|
|||
|
|
// var startDate = $('#startDate').val();
|
|||
|
|
// if (startDate == "") {
|
|||
|
|
// startDate = dateToString(new Date("2017-08-16"));
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// var endDate = $('#endDate').val();
|
|||
|
|
|
|||
|
|
// if (endDate == "") {
|
|||
|
|
// endDate = dateToString(new Date(startDate),14);
|
|||
|
|
// }
|
|||
|
|
// var endDate = MES.endDate;
|
|||
|
|
// console.log("endDate:",endDate);
|
|||
|
|
// console.log("MES.endDate:",MES.endDate);
|
|||
|
|
dailytotalamount.map( function(ele, index){
|
|||
|
|
if(ele.stdt != "sss"){
|
|||
|
|
var jj = (new Date(ele.stdt).getTime() - new Date(MES.startDate).getTime()) / 24 / 60 / 60 / 1000;
|
|||
|
|
if (jj>=0){
|
|||
|
|
temArr[2*jj] = {"amount":ele.preamount,"stdt":ele.stdt};
|
|||
|
|
temArr[2*jj+1] = {"amount":ele.actamount,"stdt":ele.stdt};
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
for (var i = 0; i < temArr.length; i++) {
|
|||
|
|
if (temArr[i] == undefined) {
|
|||
|
|
temArr[i] = PlainAmount("sss");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return temArr;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var PlainAmount = function(stdt) {
|
|||
|
|
return {
|
|||
|
|
amount: '',
|
|||
|
|
stdt: stdt,
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
</script>
|
|||
|
|
</head>
|
|||
|
|
<body>
|
|||
|
|
<div id="cc" class="easyui-layout" data-options="fit:true,border:false">
|
|||
|
|
<div class="easyui-layout" data-options="fit:true,border:false">
|
|||
|
|
<div id="toolbar" style="display: none;">
|
|||
|
|
<table>
|
|||
|
|
<tr>
|
|||
|
|
<td>开始时间</td>
|
|||
|
|
<td><input id="startDate" name="startDate" class="Wdate" bind-value=" justep.Date.toString(new Date(),'yyyy-MM-dd')"
|
|||
|
|
onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" data-options="required:true,validType:'isBlank'" readonly/></td>
|
|||
|
|
<td>结束时间</td>
|
|||
|
|
<td><input id="endDate" name="endDate" class="Wdate"
|
|||
|
|
onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" data-options="required:true,validType:'isBlank'" readonly/></td>
|
|||
|
|
<td><table class="tooltable">
|
|||
|
|
<tr>
|
|||
|
|
<td>工序</td>
|
|||
|
|
<td><input id="search_proced" name="search_proced" class="easyui-combobox" /></td>
|
|||
|
|
</tr>
|
|||
|
|
</table></td>
|
|||
|
|
<td><button id = "btns" onclick="searchFun()" class="easyui-linkbutton" data-options="iconCls:'ext-icon-search',plain:true" >搜索</button></td>
|
|||
|
|
<td><a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true"
|
|||
|
|
onclick="clearFun();">重置</a>
|
|||
|
|
</td>
|
|||
|
|
</tr>
|
|||
|
|
</table>
|
|||
|
|
</div>
|
|||
|
|
<div data-options="region:'center',fit:true,border:false">
|
|||
|
|
<table id="grid" data-options="fit:true,border:false"></table>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</body>
|
|||
|
|
</html>
|