|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Data;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Web;
|
|
|
|
|
|
using System.Web.UI;
|
|
|
|
|
|
using System.Web.UI.WebControls;
|
|
|
|
|
|
using BLL.CardBill;
|
|
|
|
|
|
using BLL.Sys;
|
|
|
|
|
|
using CPCBILLSYS.Common;
|
|
|
|
|
|
using Ext.Net;
|
|
|
|
|
|
|
|
|
|
|
|
namespace CPCBILLSYS
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class CPCWarnInfo : System.Web.UI.Page
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 基础
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
DictionaryBLL dicbll = new DictionaryBLL(CommonHelper._dbType, CommonHelper.DbConStr);
|
|
|
|
|
|
FileHelper xml = new FileHelper();
|
|
|
|
|
|
WarnInfoBLL warbll = new WarnInfoBLL(CommonHelper._dbType, CommonHelper.DbConStr);
|
|
|
|
|
|
static string subcomno = string.Empty;
|
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
subcomno = Request.QueryString["subcomno"] == null ? "" : Request.QueryString["subcomno"].ToString();
|
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (CommonHelper._version == "2")
|
|
|
|
|
|
{
|
|
|
|
|
|
ExtNet.ResourceManager.SetTheme(Ext.Net.Theme.Access);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
if (CommonHelper._userType == "1" || CommonHelper._userType == "2")
|
|
|
|
|
|
{
|
|
|
|
|
|
prmisPnl.Hidden = true;
|
|
|
|
|
|
//prmisPnl.Hide();
|
|
|
|
|
|
}
|
|
|
|
|
|
//IniXml();
|
|
|
|
|
|
BindTree();
|
|
|
|
|
|
BindKind();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 基础
|
|
|
|
|
|
public void BindKind()
|
|
|
|
|
|
{
|
|
|
|
|
|
stKind.DataSource = dicbll.GetCBKind(" and VALUE in(1,2,3)");
|
|
|
|
|
|
stKind.DataBind();
|
|
|
|
|
|
}
|
|
|
|
|
|
public void IniXml()
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
string cpcct = xml.ReadXml("warn.xml", "cpcct", "ct");
|
|
|
|
|
|
if (string.IsNullOrEmpty(cpcct))
|
|
|
|
|
|
{
|
|
|
|
|
|
xml.CreateXml("warn.xml");
|
|
|
|
|
|
xml.WriteXml("warn.xml", "cpcct", "ct", "1000");
|
|
|
|
|
|
//s_txtWarnCt.Text = "1000";
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
//s_txtWarnCt.Text = cpcct;
|
|
|
|
|
|
}
|
|
|
|
|
|
string pcbillct = xml.ReadXml("warn.xml", "pcbillct", "ct");
|
|
|
|
|
|
if (string.IsNullOrEmpty(pcbillct))
|
|
|
|
|
|
{
|
|
|
|
|
|
xml.CreateXml("warn.xml");
|
|
|
|
|
|
xml.WriteXml("warn.xml", "pcbillct", "ct", "1000");
|
|
|
|
|
|
}
|
|
|
|
|
|
string sgpct = xml.ReadXml("warn.xml", "sgpct", "ct");
|
|
|
|
|
|
if (string.IsNullOrEmpty(sgpct))
|
|
|
|
|
|
{
|
|
|
|
|
|
xml.CreateXml("warn.xml");
|
|
|
|
|
|
xml.WriteXml("warn.xml", "sgpct", "ct", "1000");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 设置预警值
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void bunSetValue_Click(object sender, Ext.Net.DirectEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
if (string.IsNullOrEmpty(cmbKind.SelectedItem.Value))
|
|
|
|
|
|
{
|
|
|
|
|
|
CommonHelper.MsgShowInfo("请选择告警类别...");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!xml.IsExist("warn.xml"))
|
|
|
|
|
|
{
|
|
|
|
|
|
xml.CreateXml("warn.xml");
|
|
|
|
|
|
}
|
|
|
|
|
|
//if (!string.IsNullOrEmpty(s_txtWarnCt.Text))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// int ct = 0;
|
|
|
|
|
|
// bool f = int.TryParse(s_txtWarnCt.Text.Trim(), out ct);
|
|
|
|
|
|
// if (f)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// if (cmbKind.SelectedItem.Value == "0")//微机票
|
|
|
|
|
|
// {
|
|
|
|
|
|
// xml.WriteXml("warn.xml", "pcbillct", "ct", ct.ToString());
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else if (cmbKind.SelectedItem.Value == "1")//手工票票
|
|
|
|
|
|
// {
|
|
|
|
|
|
// xml.WriteXml("warn.xml", "sgpct", "ct", ct.ToString());
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else//cpc卡
|
|
|
|
|
|
// {
|
|
|
|
|
|
// xml.WriteXml("warn.xml", "cpcct", "ct", ct.ToString());
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else
|
|
|
|
|
|
// {
|
|
|
|
|
|
// CommonHelper.MsgShowInfo("请重新输入正确的预警值...");
|
|
|
|
|
|
// }
|
|
|
|
|
|
//}
|
|
|
|
|
|
//else
|
|
|
|
|
|
//{
|
|
|
|
|
|
// CommonHelper.MsgShowInfo("请输入预警值...");
|
|
|
|
|
|
// return;
|
|
|
|
|
|
//}
|
|
|
|
|
|
CommonHelper.MsgShowInfo("设置预警值设置成功");
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
CommonHelper.MsgShowInfo("设置预警值设置异常:" + ex.Message);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 卡,票的平均使用量
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public void AVGCount()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion 基础
|
|
|
|
|
|
#region 树形
|
|
|
|
|
|
public void BindTree()
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
DataTable dt = dicbll.GetSubCompany("");
|
|
|
|
|
|
DataRow dr = dt.NewRow();
|
|
|
|
|
|
dr["SUBCOMNO"] = "1";
|
|
|
|
|
|
dr["SUBCOMNAME"] = "总公司";
|
|
|
|
|
|
dt.Rows.Add(dr);
|
|
|
|
|
|
Ext.Net.TreePanel treePnl = new Ext.Net.TreePanel();//子节点
|
|
|
|
|
|
treePnl.Border = false;
|
|
|
|
|
|
treePnl.RootVisible = false;
|
|
|
|
|
|
Ext.Net.TreeNode root = new Ext.Net.TreeNode();//根节点存放
|
|
|
|
|
|
foreach (DataRow item in dt.Rows)
|
|
|
|
|
|
{
|
|
|
|
|
|
Ext.Net.TreeNode rootChild = new Ext.Net.TreeNode(item["SUBCOMNAME"].ToString());//根节点存放
|
|
|
|
|
|
string rootChildName = "'" + item["SUBCOMNAME"].ToString() + "'";
|
|
|
|
|
|
rootChild.NodeID = item["SUBCOMNO"].ToString();
|
|
|
|
|
|
rootChild.Leaf = true;
|
|
|
|
|
|
rootChild.Listeners.Click.Handler = "LoadWarn(" + item["SUBCOMNO"].ToString() + ")";
|
|
|
|
|
|
root.Nodes.Add(rootChild);
|
|
|
|
|
|
}
|
|
|
|
|
|
treePnl.Root.Add(root);
|
|
|
|
|
|
prmisPnl.Items.Add(treePnl);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
CommonHelper.MsgShowInfo("单位加载异常:" + ex.Message);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion 树形
|
|
|
|
|
|
#region 数据
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 数据绑定
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void btnSeatch_Click(object sender, Ext.Net.DirectEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
string sqlwhere = "";
|
|
|
|
|
|
string pcsqlwhere = string.Empty;
|
|
|
|
|
|
DateTime dtSt = DateTime.Now.AddMonths(-2).Date;
|
|
|
|
|
|
DateTime dtEnd = DateTime.Now.Date;
|
|
|
|
|
|
DataTable dt = new DataTable();
|
|
|
|
|
|
int kind = 3;
|
|
|
|
|
|
if (!string.IsNullOrEmpty(cmbKind.SelectedItem.Value))
|
|
|
|
|
|
{
|
|
|
|
|
|
kind = int.Parse(cmbKind.SelectedItem.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (hdSubComNo.Value != null && hdSubComNo.Value.ToString() != "")
|
|
|
|
|
|
{
|
|
|
|
|
|
subcomno = hdSubComNo.Value.ToString();
|
|
|
|
|
|
}
|
|
|
|
|
|
if (CommonHelper._userType == "1")
|
|
|
|
|
|
{
|
|
|
|
|
|
if (CommonHelper._dbType == "1")
|
|
|
|
|
|
{
|
|
|
|
|
|
sqlwhere += " and CLASSDATE >= '" + dtSt.ToShortDateString() + "' and CLASSDATE<= '" + dtEnd.ToShortDateString() + "'";
|
|
|
|
|
|
pcsqlwhere += " and dt>='" + dtSt.ToShortDateString() + "' and dt<='" + dtEnd.ToShortDateString() + "'";
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (CommonHelper._dbType == "2")
|
|
|
|
|
|
{
|
|
|
|
|
|
sqlwhere += "and CLASSDATE >=to_date('" + dtSt.ToShortDateString() + "','yyyy-MM-dd') and CLASSDATE<=to_date('" + dtEnd.ToShortDateString() + "','yyyy-MM-dd')";
|
|
|
|
|
|
pcsqlwhere += " and dt>=to_date('" + dtSt.ToShortDateString() + "','yyyy-MM-dd') and dt<=to_date('" + dtEnd.ToShortDateString() + "','yyyy-MM-dd')";
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (CommonHelper._dbType == "4")
|
|
|
|
|
|
{
|
|
|
|
|
|
sqlwhere += "and CLASSDATE >=date_format('" + dtSt.ToShortDateString() + "','%Y-%m-%d %H:%i:%s') and CLASSDATE<=date_format('" + dtEnd.ToShortDateString() + "','%Y-%m-%d %H:%i:%s')";
|
|
|
|
|
|
pcsqlwhere += " and dt>=date_format('" + dtSt.ToShortDateString() + "','%Y-%m-%d %H:%i:%s') and dt<=date_format('" + dtEnd.ToShortDateString() + "','%Y-%m-%d %H:%i:%s')";
|
|
|
|
|
|
}
|
|
|
|
|
|
sqlwhere += " and STANO=" + CommonHelper.checkStaNo() + "";
|
|
|
|
|
|
pcsqlwhere += " and USERTYPE =1 and UNITNO=" + CommonHelper.checkStaNo() + "";
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (CommonHelper._userType == "2")//中心
|
|
|
|
|
|
{
|
|
|
|
|
|
if (CommonHelper._dbType == "1")
|
|
|
|
|
|
{
|
|
|
|
|
|
sqlwhere += " and CLASSDATE>= '" + dtSt.ToShortDateString() + "' and CLASSDATE<= '" + dtEnd.ToShortDateString() + "'";
|
|
|
|
|
|
pcsqlwhere += " and dt>='" + dtSt.ToShortDateString() + "' and dt<='" + dtEnd.ToShortDateString() + "'";
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (CommonHelper._dbType == "4")
|
|
|
|
|
|
{
|
|
|
|
|
|
sqlwhere += "and CLASSDATE>=date_format('" + dtSt.ToShortDateString() + "','%Y-%m-%d %H:%i:%s') and CLASSDATE<=date_format('" + dtEnd.ToShortDateString() + "','%Y-%m-%d %H:%i:%s')";
|
|
|
|
|
|
pcsqlwhere += " and dt>=date_format('" + dtSt.ToShortDateString() + "','%Y-%m-%d %H:%i:%s') and dt<=date_format('" + dtEnd.ToShortDateString() + "','%Y-%m-%d %H:%i:%s')";
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
sqlwhere += "and CLASSDATE >=to_date('" + dtSt.ToShortDateString() + "','yyyy-MM-dd') and CLASSDATE<=to_date('" + dtEnd.ToShortDateString() + "','yyyy-MM-dd')";
|
|
|
|
|
|
pcsqlwhere += " and dt>=to_date('" + dtSt.ToShortDateString() + "','yyyy-MM-dd') and dt<=to_date('" + dtEnd.ToShortDateString() + "','yyyy-MM-dd')";
|
|
|
|
|
|
}
|
|
|
|
|
|
sqlwhere += " and USERTYPE=1 and SUBCOMNO=" + CommonHelper.checkStaNo() + "";
|
|
|
|
|
|
pcsqlwhere += " and USERTYPE=1 and SUBCOMNO=" + CommonHelper.checkStaNo() + "";
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
if (CommonHelper._dbType == "1")
|
|
|
|
|
|
{
|
|
|
|
|
|
sqlwhere += " and ALLOTDT >= '" + dtSt.ToShortDateString() + "' and ALLOTDT<= '" + dtEnd.AddDays(1).AddSeconds(-1) + "'";
|
|
|
|
|
|
pcsqlwhere += " and dt>='" + dtSt.ToShortDateString() + "' and dt<='" + dtEnd.ToShortDateString() + "'";
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (CommonHelper._dbType == "4")
|
|
|
|
|
|
{
|
|
|
|
|
|
sqlwhere += "and ALLOTDT >=date_format('" + dtSt.ToShortDateString() + "','%Y-%m-%d %H:%i:%s') and ALLOTDT<=date_format('" + dtEnd.AddDays(1).AddSeconds(-1) + "','%Y-%m-%d %H:%i:%s')";
|
|
|
|
|
|
pcsqlwhere += " and dt>=date_format('" + dtSt.ToShortDateString() + "','%Y-%m-%d %H:%i:%s') and dt<=date_format('" + dtEnd.ToShortDateString() + "','%Y-%m-%d %H:%i:%s')";
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
sqlwhere += "and ALLOTDT >=to_date('" + dtSt.ToShortDateString() + "','yyyy-MM-dd') and ALLOTDT<=to_date('" + dtEnd.AddDays(1).AddSeconds(-1) + "','yyyy-MM-dd')";
|
|
|
|
|
|
pcsqlwhere += " and dt>=to_date('" + dtSt.ToShortDateString() + "','yyyy-MM-dd') and dt<=to_date('" + dtEnd.ToShortDateString() + "','yyyy-MM-dd')";
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(subcomno))
|
|
|
|
|
|
{
|
|
|
|
|
|
if (subcomno == "1")
|
|
|
|
|
|
{
|
|
|
|
|
|
sqlwhere = " and stateid=2 ";//总中心调出(使用量)
|
|
|
|
|
|
sqlwhere += " and USERTYPE=3";
|
|
|
|
|
|
pcsqlwhere += " and USERTYPE=3";
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
sqlwhere = " and stateid=1 ";//站级调入量
|
|
|
|
|
|
sqlwhere = " and OUTSUBCOMNO=" + subcomno + " and USERTYPE=1";
|
|
|
|
|
|
pcsqlwhere = " and SUBCOMNO=" + subcomno + " and USERTYPE=1";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
sqlwhere = " and stateid=2 ";//分中心调出(使用量)
|
|
|
|
|
|
sqlwhere += " and USERTYPE=2";
|
|
|
|
|
|
pcsqlwhere += " and USERTYPE=2";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool _f = false;
|
|
|
|
|
|
if (kind == 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (CommonHelper._userType != "1" && CommonHelper._userType != "2")
|
|
|
|
|
|
{
|
|
|
|
|
|
sqlwhere += " and BILLTYPE=1";
|
|
|
|
|
|
}
|
|
|
|
|
|
pcsqlwhere += " and type=2 and kind=1";//微机票据
|
|
|
|
|
|
if (CommonHelper._userType == "1")
|
|
|
|
|
|
{
|
|
|
|
|
|
dt = warbll.GetPCbillDTWarning(sqlwhere, pcsqlwhere);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (CommonHelper._userType == "2")
|
|
|
|
|
|
{
|
|
|
|
|
|
dt = warbll.GetBillCPCWarningCen(sqlwhere, pcsqlwhere);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
dt = warbll.GetBillPCWarningLwNew(sqlwhere, pcsqlwhere);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (kind == 2)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (CommonHelper._userType != "1" && CommonHelper._userType != "2")
|
|
|
|
|
|
{
|
|
|
|
|
|
sqlwhere += " and BILLTYPE=2";
|
|
|
|
|
|
}
|
|
|
|
|
|
pcsqlwhere += " and type=2 and kind=2";//手工票据
|
|
|
|
|
|
if (CommonHelper._userType == "1")
|
|
|
|
|
|
{
|
|
|
|
|
|
dt = warbll.GetSGPDTWarning(sqlwhere, pcsqlwhere);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (CommonHelper._userType == "2")
|
|
|
|
|
|
{
|
|
|
|
|
|
dt = warbll.GetSGPPCWarningCen(sqlwhere, pcsqlwhere);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
dt = warbll.GetSGPPCWarningLw(sqlwhere, pcsqlwhere);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (kind == 3)
|
|
|
|
|
|
{
|
|
|
|
|
|
pcsqlwhere += " and type=1 and kind=3";//卡
|
|
|
|
|
|
if (CommonHelper._userType == "1")
|
|
|
|
|
|
{
|
|
|
|
|
|
dt = warbll.GetCPCDTWarning(sqlwhere, pcsqlwhere);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (CommonHelper._userType == "2")
|
|
|
|
|
|
{
|
|
|
|
|
|
dt = warbll.GetCPCDTWarningCen(sqlwhere, pcsqlwhere);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
dt = warbll.GetCPCDTWarningLwNew(sqlwhere, pcsqlwhere);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (kind == 4)
|
|
|
|
|
|
{
|
|
|
|
|
|
pcsqlwhere += " and type=3 and kind=4";//卡
|
|
|
|
|
|
if (CommonHelper._userType == "1")
|
|
|
|
|
|
{
|
|
|
|
|
|
dt = warbll.GetPaperDTWarning(sqlwhere, pcsqlwhere);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (CommonHelper._userType == "2")
|
|
|
|
|
|
{
|
|
|
|
|
|
dt = warbll.GetPaperDTWarningCen(sqlwhere, pcsqlwhere);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
dt = warbll.GetPaperPCDTWarningLw(sqlwhere, pcsqlwhere);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
dt = new DataTable();
|
|
|
|
|
|
}
|
|
|
|
|
|
stUsing.DataSource = dt;
|
|
|
|
|
|
stUsing.DataBind();
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion 数据
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|