You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
355 lines
14 KiB
355 lines
14 KiB
2 months ago
|
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MaterialAvailabilityDay.aspx.cs" Inherits="MESWebSite.Manage.MaterialAvailabilityDay" %>
|
||
|
|
||
|
|
||
|
<!DOCTYPE html>
|
||
|
|
||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||
|
<head runat="server">
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
|
<link href="/CSS/Basics.css" rel="stylesheet" />
|
||
|
<link href="/Scripts/jquery-easyui-1.4.3/themes/metro/easyui.css" rel="stylesheet" type="text/css" />
|
||
|
<link href="/Scripts/jquery-easyui-1.4.3/themes/icon.css" rel="stylesheet" type="text/css" />
|
||
|
<link href="/Scripts/jquery-easyui-1.4.3/themes/color.css" rel="stylesheet" type="text/css" />
|
||
|
<script src="/Scripts/jquery-easyui-1.4.3/jquery.min.js" type="text/javascript"></script>
|
||
|
<script src="/Scripts/jquery-easyui-1.4.3/jquery.easyui.min.js" type="text/javascript"></script>
|
||
|
<script src="/Scripts/jquery-easyui-1.4.3/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
|
||
|
<script src="/Scripts/MyJs.js" type="text/javascript"></script>
|
||
|
<link href="../Show/bootstrap/css/bootstrap.css" rel="stylesheet" />
|
||
|
<script src="../Show/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
|
||
|
<script src="../Show/echar/echarts.min.js" type="text/javascript"></script>
|
||
|
<style>
|
||
|
#w td {
|
||
|
padding: 5px 5px;
|
||
|
text-align: left;
|
||
|
vertical-align: middle;
|
||
|
}
|
||
|
|
||
|
#w .title {
|
||
|
vertical-align: middle;
|
||
|
text-align: right;
|
||
|
width: 80px;
|
||
|
height: 40px;
|
||
|
padding: 0px;
|
||
|
}
|
||
|
|
||
|
p {
|
||
|
padding: 0px 5px;
|
||
|
font-size: small;
|
||
|
font-family: 微软雅黑;
|
||
|
margin: 0px;
|
||
|
}
|
||
|
|
||
|
.tree-folder-open, .tree-folder, .tree-file {
|
||
|
display: none;
|
||
|
}
|
||
|
|
||
|
.datagrid {
|
||
|
text-align: center;
|
||
|
}
|
||
|
|
||
|
.ttb {
|
||
|
width: 180px;
|
||
|
display: block;
|
||
|
}
|
||
|
|
||
|
|
||
|
#ReportTable_div {
|
||
|
margin: 0 auto;
|
||
|
margin-top: 20px;
|
||
|
}
|
||
|
|
||
|
#ReportTable_div table {
|
||
|
border: 1px solid #000000;
|
||
|
border-collapse: collapse;
|
||
|
margin: 0 auto;
|
||
|
width: 80%;
|
||
|
}
|
||
|
|
||
|
#bar {
|
||
|
float: left;
|
||
|
margin-left: 0px;
|
||
|
margin-top: 20px;
|
||
|
width: 100%;
|
||
|
height: 500px;
|
||
|
}
|
||
|
</style>
|
||
|
<title>日原料利用率</title>
|
||
|
<script>
|
||
|
|
||
|
|
||
|
</script>
|
||
|
</head>
|
||
|
<body>
|
||
|
<form id="form1" runat="server">
|
||
|
<div class="top">
|
||
|
<table cellpadding="0" cellspacing="0" style="width: 100%">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<td><span class="title">日原料利用率</span></td>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td style="width: 415px;">时间:
|
||
|
<input id="start_time" editable="false" class="easyui-datebox" name="name" data-options="label:'月份:'" />
|
||
|
|
||
|
<a class="topsearchBtn">查询</a>
|
||
|
|
||
|
<a class="topexcelBtn" id="exportbtn">导出</a>
|
||
|
</td>
|
||
|
<td style="width: 75px;"></td>
|
||
|
<td style="width: 75px;"></td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</div>
|
||
|
<div id="ReportTable_div">
|
||
|
</div>
|
||
|
|
||
|
<div id="bar" style=""></div>
|
||
|
<script>
|
||
|
|
||
|
$(function () {
|
||
|
|
||
|
$('#start_time').datebox({
|
||
|
//显示日趋选择对象后再触发弹出月份层的事件,初始化时没有生成月份层
|
||
|
onShowPanel: function () {
|
||
|
//触发click事件弹出月份层
|
||
|
span.trigger('click');
|
||
|
if (!tds)
|
||
|
//延时触发获取月份对象,因为上面的事件触发和对象生成有时间间隔
|
||
|
setTimeout(function () {
|
||
|
tds = p.find('div.calendar-menu-month-inner td');
|
||
|
tds.click(function (e) {
|
||
|
//禁止冒泡执行easyui给月份绑定的事件
|
||
|
e.stopPropagation();
|
||
|
//得到年份
|
||
|
var year = /\d{4}/.exec(span.html())[0],
|
||
|
//月份
|
||
|
//之前是这样的month = parseInt($(this).attr('abbr'), 10) + 1;
|
||
|
month = parseInt($(this).attr('abbr'), 10);
|
||
|
|
||
|
//隐藏日期对象
|
||
|
$('#start_time').datebox('hidePanel')
|
||
|
//设置日期的值
|
||
|
.datebox('setValue', year + '-' + month);
|
||
|
});
|
||
|
}, 0);
|
||
|
},
|
||
|
//配置parser,返回选择的日期
|
||
|
parser: function (s) {
|
||
|
if (!s) return new Date();
|
||
|
var arr = s.split('-');
|
||
|
return new Date(parseInt(arr[0], 10), parseInt(arr[1], 10) - 1, 1);
|
||
|
},
|
||
|
//配置formatter,只返回年月 之前是这样的d.getFullYear() + '-' +(d.getMonth());
|
||
|
formatter: function (d) {
|
||
|
var currentMonth = (d.getMonth() + 1);
|
||
|
var currentMonthStr = currentMonth < 10 ? ('0' + currentMonth) : (currentMonth + '');
|
||
|
return d.getFullYear() + '-' + currentMonthStr;
|
||
|
}
|
||
|
});
|
||
|
//日期选择对象
|
||
|
var p = $('#start_time').datebox('panel'),
|
||
|
//日期选择对象中月份
|
||
|
tds = false,
|
||
|
//显示月份层的触发控件
|
||
|
span = p.find('span.calendar-text');
|
||
|
|
||
|
//搜索按钮
|
||
|
$('.topsearchBtn').first().click(function () {
|
||
|
SearchInfo();
|
||
|
});
|
||
|
|
||
|
$.ajaxSetup({
|
||
|
cache: false //关闭AJAX缓存
|
||
|
});
|
||
|
|
||
|
|
||
|
$("#exportbtn").bind('click', function () {
|
||
|
|
||
|
var StartTime = $('#start_time').datetimebox('getValue');
|
||
|
|
||
|
var queryParams = {
|
||
|
StartTime: StartTime
|
||
|
};
|
||
|
|
||
|
post('<%=ResolveUrl("~/HttpHandlers/MaterialAvailabilityDayHandler.ashx?method=QueryExcel") %>', queryParams);
|
||
|
});
|
||
|
|
||
|
});
|
||
|
|
||
|
function SearchInfo() {
|
||
|
|
||
|
var StartTime = $('#start_time').datetimebox('getValue');
|
||
|
|
||
|
$.ajax({
|
||
|
url: "MaterialAvailabilityDay.aspx/GetDate",
|
||
|
datatype: 'json',
|
||
|
type: "Post",
|
||
|
data: "{'StartTime':'" + StartTime + "'}",
|
||
|
contentType: "application/json; charset=utf-8",
|
||
|
success: function (data) {
|
||
|
if (data != null && data.d != "") {
|
||
|
$('#ReportTable_div').html(data.d);
|
||
|
}
|
||
|
else {
|
||
|
$('#ReportTable_div').html('');
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
|
||
|
var myChart1 = echarts.init(document.getElementById('bar'));
|
||
|
|
||
|
myChart1.setOption({
|
||
|
title: {
|
||
|
text: '异步数据加载示例'
|
||
|
},
|
||
|
tooltip: {},
|
||
|
|
||
|
xAxis: {
|
||
|
data: []
|
||
|
},
|
||
|
yAxis: {},
|
||
|
series: [{
|
||
|
|
||
|
type: 'bar',
|
||
|
data: []
|
||
|
}]
|
||
|
});
|
||
|
|
||
|
$("#bar").width((window.innerWidth / 2) - 50);
|
||
|
$("#bar").height((window.innerHeight / 2) - 50);
|
||
|
|
||
|
$.ajax({
|
||
|
url: "MaterialAvailabilityDay.aspx/GetBarDate",
|
||
|
datatype: 'json',
|
||
|
type: "Post",
|
||
|
data: "{'StartTime':'" + StartTime + "'}",
|
||
|
contentType: "application/json; charset=utf-8",
|
||
|
success: function (result) {
|
||
|
if (result) {
|
||
|
|
||
|
var obj = JSON.parse(result.d);
|
||
|
|
||
|
myChart1.setOption({
|
||
|
title: {
|
||
|
text: obj.text,
|
||
|
subtext: obj.subtext,//副标题文本,'\n'指定换行
|
||
|
},
|
||
|
tooltip: {},
|
||
|
//legend: {
|
||
|
// data: ['产量']
|
||
|
//},
|
||
|
xAxis: {
|
||
|
data: obj.categories
|
||
|
},
|
||
|
//yAxis: {
|
||
|
// type: 'value',
|
||
|
// max: 100
|
||
|
//},
|
||
|
series: [{
|
||
|
// 根据名字对应到相应的系列
|
||
|
//name: '产量',
|
||
|
type: 'bar',
|
||
|
data: obj.data,
|
||
|
itemStyle: { normal: { label: { position: 'top', show: true } } }
|
||
|
}]
|
||
|
});
|
||
|
|
||
|
option = {
|
||
|
tooltip: {
|
||
|
trigger: 'axis',
|
||
|
axisPointer: {
|
||
|
type: 'cross',
|
||
|
crossStyle: {
|
||
|
color: '#999'
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
toolbox: {
|
||
|
feature: {
|
||
|
dataView: { show: true, readOnly: false },
|
||
|
magicType: { show: true, type: ['line', 'bar'] },
|
||
|
restore: { show: true },
|
||
|
saveAsImage: { show: true }
|
||
|
}
|
||
|
},
|
||
|
legend: {
|
||
|
data: ['合格率', '目标值']
|
||
|
},
|
||
|
color: ['#32CD32', '#FF0000'],
|
||
|
visualMap: {
|
||
|
show: false,
|
||
|
dimension: 1,
|
||
|
pieces: [{ gte: 0, lte: 100, color: 'red' }],
|
||
|
outOfRange: { color: 'green' }
|
||
|
},
|
||
|
xAxis: [
|
||
|
{
|
||
|
type: 'category',
|
||
|
data: obj.categories,
|
||
|
axisPointer: {
|
||
|
type: 'shadow'
|
||
|
}
|
||
|
}
|
||
|
],
|
||
|
yAxis: [
|
||
|
{
|
||
|
type: 'value',
|
||
|
name: '合格率',
|
||
|
min: 0,
|
||
|
max: 100,
|
||
|
interval: 10,
|
||
|
axisLabel: {
|
||
|
formatter: '{value} %'
|
||
|
}
|
||
|
}
|
||
|
],
|
||
|
series: [
|
||
|
{
|
||
|
name: '合格率',
|
||
|
type: 'bar',
|
||
|
data: obj.QualifiedData
|
||
|
},
|
||
|
|
||
|
{
|
||
|
name: '目标值',
|
||
|
type: 'line',
|
||
|
data: obj.TargetData
|
||
|
}
|
||
|
]
|
||
|
};
|
||
|
|
||
|
myChart1.setOption(option);
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
function post(url, PARAMS) {
|
||
|
var temp_form = document.createElement("form");
|
||
|
temp_form.action = url;
|
||
|
temp_form.target = "_blank";
|
||
|
temp_form.method = "post";
|
||
|
temp_form.style.display = "none"; for (var x in PARAMS) {
|
||
|
var opt = document.createElement("textarea");
|
||
|
opt.name = x;
|
||
|
opt.value = PARAMS[x];
|
||
|
temp_form.appendChild(opt);
|
||
|
}
|
||
|
document.body.appendChild(temp_form);
|
||
|
temp_form.submit();
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
</script>
|
||
|
</form>
|
||
|
</body>
|
||
|
</html>
|