<html>
<!Doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>经营数据展示</title>
<link rel="stylesheet" href="css/loading.css">
<link rel="stylesheet" href="css/animate.css">
<script src="js/jquery-3.2.1.min.js"></script>
<link href="css/default.css?2022003" type="text/css" rel="stylesheet" />
<script src="js/common.js" type="text/javascript"></script>
<script src="js/echarts.min.js" type="text/javascript"></script>
<script src="js/walden.js" type="text/javascript"></script>
</head>
<body style="font-family: Microsoft YaHei; transform-origin: top left; -moz-transform-origin: top left; width: 100%; height: 100%; margin: 0px; overflow: hidden;background-color:rgb(0,42,77);" οnresize="resize();">
<div id="loading">
<div id="loading-center">
<div id="loading-center-absolute">
<div class="object" id="object_one"></div>
<div class="object" id="object_two"></div>
<div class="object" id="object_three"></div>
<div class="object" id="object_four"></div>
<div class="object" id="object_five"></div>
<div class="object" id="object_six"></div>
<div class="object" id="object_seven"></div>
<div class="object" id="object_eight"></div>
<div class="object" id="object_big"></div>
</div>
</div>
</div>
<div class="box" style="padding:110px 20px 60px 20px;width:1920px;height:1080px;background:url(images/bg30.png) no-repeat;overflow:hidden;">
<div style="left: 2.5%; top: 1%; width: 60px; height: 60px; cursor: pointer; position: absolute;border:0"><img style="height: 60px;border:0" id="deptlogo" /> </div>
<div id="divc" style="width:1880px; height: 910px;overflow:hidden;">
<div id="div1" style="width: 1880px; height: 910px;display: flex;align-content: space-between;justify-content: space-between;flex-wrap: wrap;"></div>
<div id="div2" style="width: 1880px; height: 910px;display: flex;align-content: space-between;justify-content: space-between;flex-wrap: wrap;"></div>
</div>
</div>
<script type="text/javascript">
const data_refresh_interval = 60 * 1000; //毫秒
const page_scroll_interval = 15 * 1000; //毫秒
var userAgent = navigator.userAgent.toLowerCase();
var currPageIndex = 0;
var pages = [];
var incoffset = 1;
var page_scroll_timer = -1;
let intervals = {};
var timer = setInterval(function(){
//window.open('http://apps.njatech.cn:8082/wms/app_webs/core/programs/WMSBoard/scr_stockunique.html?a5960a6929534341948392bwekunique','_self')
clearInterval(timer);
},120*1000);
function resize()
{
var curWidth=document.documentElement.clientWidth ;
var curHeight=document.documentElement.clientHeight ;
var s1 = curWidth/1920;
var s2 = curHeight/1080;
var scale=(s1>s2?s2:s1);
if (userAgent.indexOf("firefox") != -1) {
//-moz-transform:scale(0.66);
document.body.style.MozTransform = "scale(" + scale + ")";
}
else
{
document.body.style.transform = "scale(" + scale + ")";
}
}
function load_data()
{
var content = window.location.href;
var ori = content.split('?')
console.log(ori[1])
GetJsonByUrl2("getData_stockunique.ashx?workline=" + ori[1], get_html);
// get_html(data_json);
}
function get_html(d)
{
$("#loading").fadeOut(2000); $("#deptlogo").attr('src', "../../../../logos/" + d.DEPTLOGO);
var pageCount = 0;
var h = "";
var dataLength = d.data.length;
var n1, n2, n3, n4;
for (var i = 0; i < dataLength; i++) {
var color = d.data[i].name1 == "" ? "red" : "green";
console.log('333==',typeof (d.data[i].name1))
h += "<div class='div_cell' style='background-color:" + color + "'><div style='color:rgb(1,212,231);font-size:20px;padding:7px 0px 0px 0px;width:200px;text-align:center;'>" + d.data[i].positon + "</div>";
h += "<div style='font-size:25px;line-height:40px;color:white;padding:10px 0px 0px 40px'>";
n1 = typeof (d.data[i].name1) == "undefined" ? "" : d.data[i].name1;
n2 = typeof (d.data[i].name2) == "undefined" ? "" : d.data[i].name2;
n3 = typeof (d.data[i].name3) == "undefined" ? "" : d.data[i].name3;
n4 = typeof (d.data[i].name4) == "undefined" ? "" : d.data[i].name4;
if (n1+n2+n3+n4 == "" )
{
h+="<div></div>"
}
else
{
if (n1 != "") { h += "<div><span style='font-size:18px;'>" + n1 + "</span> <span style='font-size:18px;padding-left:14px;font-weight:bold;color:#ffa82c;'>" + d.data[i].num1 + "</span></div>"; }
if (n2 != "") { h += "<div><span style='font-size:18px;'>" + n2 + "</span> <span style='font-size:18px;padding-left:14px;font-weight:bold;color:#ffa82c;'>" + d.data[i].num2 + "</span></div>"; }
if (n3 != "") { h += "<div><span style='font-size:18px;'>" + n3 + "</span> <span style='font-size:18px;padding-left:14px;font-weight:bold;color:#ffa82c;'>" + d.data[i].num3 + "</span></div>"; }
if (n4 != "") { h += "<div><span style='font-size:18px;'>" + n4 + "</span> <span style='font-size:18px;padding-left:14px;font-weight:bold;color:#ffa82c;'>" + d.data[i].num4 + "</span></div>"; }
}
h+="</div></div>";
if ((i + 1) % 20 == 0) {
pages[pageCount] = h;
pageCount++;
h = "";
}
}
dataLength = 20 - dataLength % 20;
for (var i = 0; i < dataLength; i++) {
h += "<div class='div_cell_null'></div> ";
}
if (h != "") { pages[pageCount] = h; pageCount++; }
if (pageCount < d.length) { pages.splice(pageCount-1, pages.length - pageCount);}
if (g("div1").innerHTML == "") { g("div1").innerHTML = pages[0]; }
if (page_scroll_timer == -1) { page_scroll_timer = setTimeout(auto_scroll, page_scroll_interval); }
setTimeout(load_data, data_refresh_interval);
}
function screen_scroll() {
var c = g("divc").scrollTop;
if (c < 910) {
incoffset = incoffset * 1.1;
g("divc").scrollTop = incoffset;
window.requestAnimationFrame(screen_scroll);
}
else {
incoffset = 1;
g("div1").innerHTML = pages[currPageIndex];
g("divc").scrollTop = 0;
}
}
function auto_scroll() {
if (pages.length == 1) { return;}
var nextPageIndex = currPageIndex + 1;
if (nextPageIndex >= pages.length) { nextPageIndex = 0; }
g("div2").innerHTML = pages[nextPageIndex];
currPageIndex = nextPageIndex;
screen_scroll();
page_scroll_timer = setTimeout(auto_scroll, page_scroll_interval);
}
window.onblur = function () { clearTimeout(page_scroll_timer); };
window.onfocus = function () { auto_scroll(); };
resize();
load_data();
</script>
<ashx>
</body>
</html>
<%@ WebHandler Language="C#" Class="Load" %>
using System;
using System.Web;
using System.Configuration;
using System.Data;
using System.Text;
using MysqlHelpers;
using Newtonsoft.Json.Linq;
using System.Net;
using System.Web.SessionState;
using System.IO;
using InitData;
public class Load : IHttpHandler, IRequiresSessionState
{
static string constr = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
public dataManager dmBase = new dataManager(constr);
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
//string ORGID1 = Convert.ToString(context.Session["ORGID"]);
string ORGID1 = "a5960a6929534341948392bwekunique";
//Context.Request["workline"];
string or = context.Request["workline"];
string ORGID = or;
if (or.Length <10)
{
ORGID =ORGID1;
}
//获取分布式DataSource
DataTable DataSourceDept = InitDataCaching.GetDataTable(dmBase, "DS_"+ORGID, "select xt_sysdb.FACCODE,DBNAME,DBADDRESS,USERID,`PASSWORD` from xt_sysdb join xt_dept on xt_dept.FACCODE=xt_sysdb.FACCODE where xt_dept.deptid='"+ORGID+"'");
string deptlogo = Convert.ToString(dmBase.ExecuteScalar("select deptlogo from xt_dept where deptid='"+ORGID+"'"));
string DSCon = "";
if (DataSourceDept.Rows.Count > 0)
{
DSCon = "server=" + DataSourceDept.Rows[0]["DBADDRESS"].ToString() + ";User Id=" + DataSourceDept.Rows[0]["USERID"].ToString() + ";password=" + DataSourceDept.Rows[0]["PASSWORD"].ToString() + ";Database=" + DataSourceDept.Rows[0]["DBNAME"].ToString() + ";charset=utf8;SslMode = none;Allow User Variables=True";
}
//激活分布式数据连接
dataManager dm_Active = new dataManager(DSCon);
DataTable dt_location = dm_Active.ExecuteDataTable("select ID,LOCATIONNAME,LOCATIONNO from bb_location order by LOCATIONNO asc");
DataTable dt_all_stockpack = dm_Active.ExecuteDataTable("select PWMATCODE,sum(PWSTOCKPILE) PWSTOCKPILE,PWPOSITION from store_pack where PWSTATE=2 and orgid='"+ORGID+"' group by PWPOSITION,PWMATCODE ");
StringBuilder sb = new StringBuilder();
foreach(DataRow dr in dt_location.Rows)
{
sb.Append("{\"positon\":\"").Append(dr["LOCATIONNAME"].ToString().Trim()).Append("\",");
DataRow[] drs = dt_all_stockpack.Select("PWPOSITION='" + dr["ID"] + "'","PWSTOCKPILE desc");
if (drs.Length >=4)
{
sb.Append("\"name1\":\"").Append(drs[0]["PWMATCODE"].ToString()).Append("\",\"num1\": "+drs[0]["PWSTOCKPILE"].ToString()+",");
sb.Append("\"name2\":\"").Append(drs[1]["PWMATCODE"].ToString()).Append("\",\"num2\": "+drs[1]["PWSTOCKPILE"].ToString()+",");
sb.Append("\"name3\":\"").Append(drs[2]["PWMATCODE"].ToString()).Append("\",\"num3\": "+drs[2]["PWSTOCKPILE"].ToString()+",");
sb.Append("\"name4\":\"").Append(drs[3]["PWMATCODE"].ToString()).Append("\",\"num4\": "+drs[3]["PWSTOCKPILE"].ToString()+"},");
}
if (drs.Length ==3)
{
sb.Append("\"name1\":\"").Append(drs[0]["PWMATCODE"].ToString()).Append("\",\"num1\": "+drs[0]["PWSTOCKPILE"].ToString()+",");
sb.Append("\"name2\":\"").Append(drs[1]["PWMATCODE"].ToString()).Append("\",\"num2\": "+drs[1]["PWSTOCKPILE"].ToString()+",");
sb.Append("\"name3\":\"").Append(drs[2]["PWMATCODE"].ToString()).Append("\",\"num3\": "+drs[2]["PWSTOCKPILE"].ToString()+"},");
}
if (drs.Length ==2)
{
sb.Append("\"name1\":\"").Append(drs[0]["PWMATCODE"].ToString()).Append("\",\"num1\": "+drs[0]["PWSTOCKPILE"].ToString()+",");
sb.Append("\"name2\":\"").Append(drs[1]["PWMATCODE"].ToString()).Append("\",\"num2\": "+drs[1]["PWSTOCKPILE"].ToString()+"},");
}
if (drs.Length ==1)
{
sb.Append("\"name1\":\"").Append(drs[0]["PWMATCODE"].ToString()).Append("\",\"num1\": "+drs[0]["PWSTOCKPILE"].ToString()+",");
sb.Append("\"name2\":\"\",\"num2\":0},");
}
if (drs.Length ==0)
{
sb.Append("\"name1\":\"\",\"num1\":0,");
sb.Append("\"name2\":\"\",\"num2\":0},");
}
}
string str = sb.ToString();
if (str.Length > 0)
{
str = str.Substring(0, str.Length - 1);
}
//{ "positon": "A-01", "name1": "N-12-A", "num1": 10000, "name2": "N-12-A", "num2": 10000 },
//{ "positon": "A-02", "name1": "N-12-A", "num1": 10000, "name2": "N-12-A", "num2": 10000 },
string json = "["+str+"]";
string jsonstr="{\"data\":"+json+",\"DEPTLOGO\":\""+deptlogo+"\"}";
context.Response.ContentType = "application/json";
context.Response.ContentEncoding = System.Text.Encoding.UTF8;
context.Response.Write(jsonstr);
context.Response.End();
}
public bool IsReusable
{
get
{
return false;
}
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="warp1.aspx.cs" Inherits="App_webs_Devices_blank" %>
<%@ Import Namespace="MysqlHelpers" %>
<%@ Import Namespace="InitData" %>
<%@ Import Namespace="System.Data" %>
<script runat="server">
public string ProId,R,DataGridStr,ret,USERNAME,Company,ABBR,CompanyName,ORGID;
private dataManager dm = new dataManager(ConfigurationManager.ConnectionStrings["ConnectionString"].ToString());
public string userid= null;
protected void Page_Load(object sender, EventArgs e)
{
ORGID =Convert.ToString(Session["ORGID"]);
}
</script>
<aspx>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<script src="<%=ConfigurationManager.AppSettings["rooturl"].ToString()%>/js/jquery.min.js"></script>
<script charset="utf-8" src="<%=ConfigurationManager.AppSettings["rooturl"].ToString()%>/js/jquery.easyui.min.js"></script>
<script src="<%=ConfigurationManager.AppSettings["rooturl"].ToString()%>/js/easyui-lang-zh_CN.js"></script>
<link href="<%=ConfigurationManager.AppSettings["rooturl"].ToString()%>/themes/icon.css" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="<%=ConfigurationManager.AppSettings["rooturl"].ToString()%>/themes/<%=ConfigurationManager.AppSettings["theme"].ToString()%>/easyui.css" />
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
<script>
$(function () {
let orgid='<%=ORGID%>'
var tempwindow = window.open('_blank'); // 先打开页面
tempwindow.location = 'http://apps.njatech.cn:8082/wms/app_webs/core/programs/WMSBoard/scr_boardunique.html'; //雅格专用地址
var nextall = parent.$('#tabs').tabs('tabs').length;
if (nextall > 0) {
parent.$('#tabs').tabs('close', nextall-1);
}
})
</script>
</html>