265 lines
12 KiB
Plaintext
265 lines
12 KiB
Plaintext
<%@ WebService Language="C#" Class="checkmsg" %>
|
|
|
|
using System;
|
|
using System.Web;
|
|
using System.Web.Services;
|
|
using System.Web.Services.Protocols;
|
|
using System.Data;
|
|
[WebService(Namespace = "http://tempuri.org/")]
|
|
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
|
|
//若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消对下行的注释。
|
|
[System.Web.Script.Services.ScriptService]
|
|
public class checkmsg : System.Web.Services.WebService {
|
|
|
|
[WebMethod(EnableSession = true)]
|
|
public string getmsg() {
|
|
Maticsoft.Model.nr_z_yhzh user = (Maticsoft.Model.nr_z_yhzh)(Session["user"]);
|
|
int juese = user.juese;
|
|
int zhid=user.id;
|
|
//html语句
|
|
string htmlyj = "<ul>";
|
|
int ts = 0;
|
|
|
|
/*-------------------------订单提醒-----------------------------*/
|
|
//订单的提醒
|
|
if (DBHlper.GetPermission(juese, "订单管理", "nr_z_dd", "查看全部"))
|
|
{
|
|
//查看待提交条数
|
|
if (DBHlper.GetPermission(juese, "订单管理", "nr_z_dd", "提交个人") || DBHlper.GetPermission(juese, "订单管理", "nr_z_dd", "提交全部"))
|
|
{
|
|
ts = 0;
|
|
ts = DBHlper.getcount("select count(*) from view_nr_z_dd where ddzt='草稿'");
|
|
if (ts > 0)
|
|
{
|
|
htmlyj += chckmsgdata(1, zhid, ts, "TcOrder_list.aspx?ddzt=草稿");
|
|
}
|
|
}
|
|
//查看待审核条数
|
|
if (DBHlper.GetPermission(juese, "订单管理", "nr_z_dd", "审核"))
|
|
{
|
|
ts = 0;
|
|
ts = DBHlper.getcount("select count(*) from view_nr_z_dd where ddzt='待审'");
|
|
if (ts > 0)
|
|
{
|
|
htmlyj += chckmsgdata(2, zhid, ts, "TcOrder_list.aspx?ddzt=待审");
|
|
}
|
|
}
|
|
|
|
}
|
|
else if (DBHlper.GetPermission(juese, "订单管理", "nr_z_dd", "查看个人"))
|
|
{
|
|
ts = 0;
|
|
//查看个人待提交条数
|
|
if (DBHlper.GetPermission(juese, "订单管理", "nr_z_dd", "提交个人") || DBHlper.GetPermission(juese, "订单管理", "nr_z_dd", "提交全部"))
|
|
{
|
|
ts = DBHlper.getcount("select count(*) from view_nr_z_dd where ddzt='草稿' where ywy='" + user.zhanghao + "'");
|
|
if (ts > 0)
|
|
{
|
|
htmlyj += chckmsgdata(1, zhid, ts, "TcOrder_list.aspx?ddzt=草稿");
|
|
}
|
|
}
|
|
//查看个人待审核条数
|
|
if (DBHlper.GetPermission(juese, "订单管理", "nr_z_dd", "审核"))
|
|
{
|
|
ts = DBHlper.getcount("select count(*) from view_nr_z_dd where ddzt='待审' where ywy='" + user.zhanghao + "'");
|
|
if (ts > 0)
|
|
{
|
|
htmlyj += chckmsgdata(2, zhid, ts, "TcOrder_list.aspx?ddzt=待审");
|
|
}
|
|
}
|
|
}
|
|
|
|
/*---------------------------------生成单提醒---------------------------------------*/
|
|
if (DBHlper.GetPermission(juese, "生产施工单", "nr_z_scd", "查看全部"))
|
|
{
|
|
ts = 0;
|
|
ts = DBHlper.getcount("select count(*) from view_nr_z_scd where scdzt='未开工' ");
|
|
if (ts > 0)
|
|
{
|
|
htmlyj += chckmsgdata(3, zhid, ts, "Dispatch_list.aspx?sczt=未开工");
|
|
}
|
|
ts = DBHlper.getcount("select count(*) from view_nr_z_scd where scdzt='暂停' ");
|
|
if (ts > 0)
|
|
{
|
|
htmlyj += chckmsgdata(4, zhid, ts, "Dispatch_list.aspx?sczt=暂停");
|
|
}
|
|
}
|
|
/*---------------------------------生产单待领料提醒---------------------------------------*/
|
|
if (DBHlper.GetPermission(juese, "生产单待领料", "view_nr_z_scddll", "查看全部"))
|
|
{
|
|
ts = 0;
|
|
ts = DBHlper.getcount("select count(*) from view_nr_z_scddll");
|
|
if (ts > 0)
|
|
{
|
|
htmlyj += chckmsgdata(5, zhid, ts, "scdll_list.aspx");
|
|
}
|
|
}
|
|
|
|
/*---------------------------------申购单提醒---------------------------------------*/
|
|
if (DBHlper.GetPermission(juese, "物料需求单", "nr_z_shengoudan", "查看全部"))
|
|
{
|
|
ts = 0;
|
|
ts = DBHlper.getcount("select count(*) from view_nr_z_shengoudan where cgzt='待采购' and zt='审核通过'");
|
|
if (ts > 0)
|
|
{
|
|
htmlyj += chckmsgdata(6, zhid, ts, "DemandSheet_list.aspx?cgzt=待采购&zt=审核通过");
|
|
}
|
|
}
|
|
/*---------------------------------采购待入库提醒---------------------------------------*/
|
|
if (DBHlper.GetPermission(juese, "采购待入库", "view_nr_z_cgddrk", "查看全部"))
|
|
{
|
|
ts = DBHlper.getcount("select count(*) from view_nr_z_cgddrk");
|
|
if (ts > 0)
|
|
{
|
|
htmlyj += chckmsgdata(7, zhid, ts, "Purchasepend_list.aspx");
|
|
}
|
|
}
|
|
|
|
/*---------------------------------最高库存提醒---------------------------------------*/
|
|
if (DBHlper.GetPermission(juese, "库存查询", "view_nr_z_kc", "查看全部"))
|
|
{
|
|
ts = 0;
|
|
ts = DBHlper.getcount("select COUNT(*) from dbo.view_nr_z_kc where (zuidkucun>0 and zuidkucun>0) and kucun>zuigkucun");
|
|
if (ts > 0)
|
|
{
|
|
htmlyj += chckmsgdata(8, zhid, ts, "MaterialLibrary_list.aspx?kctj=0");
|
|
}
|
|
}
|
|
/*---------------------------------最低库存提醒---------------------------------------*/
|
|
if (DBHlper.GetPermission(juese, "库存查询", "view_nr_z_kc", "查看全部"))
|
|
{
|
|
ts = 0;
|
|
ts = DBHlper.getcount("select COUNT(*) from dbo.view_nr_z_kc where (zuidkucun>0 and zuidkucun>0)and kucun<zuidkucun");
|
|
if (ts > 0)
|
|
{
|
|
htmlyj += chckmsgdata(9, zhid, ts, "MaterialLibrary_list.aspx?kctj=1");
|
|
}
|
|
}
|
|
/*---------------------------------订单到期收款提醒---------------------------------------*/
|
|
string ids = "";
|
|
DataTable dt = new DataTable();
|
|
if (DBHlper.GetPermission(juese, "订单管理", "nr_z_dd", "查看全部"))
|
|
{
|
|
ts = 0;
|
|
if (DBHlper.GetPermission(juese, "订单收款", "nr_z_dd_fysk", "查看个人"))
|
|
{
|
|
ts = DBHlper.getcount("select COUNT(*) from view_nr_z_dd as dd,view_nr_z_dd_wfkd as ddsk where dd.jzrq>='" + DateTime.Now.ToShortDateString() + "' and ddsk.wsje>0 and dd.bh=ddsk.bh and ddsk.ywy='" + user.zhanghao + "'");
|
|
if (ts > 0)
|
|
{
|
|
dt = DBHlper.Execute("select ddsk.id from view_nr_z_dd as dd,view_nr_z_dd_wfkd as ddsk where dd.jzrq>='" + DateTime.Now.ToShortDateString() + "' and ddsk.wsje>0 and dd.bh=ddsk.bh and ddsk.ywy='" + user.zhanghao + "'").Tables[0];
|
|
if (dt.Rows.Count > 0)
|
|
{
|
|
foreach (DataRow dr in dt.Rows)
|
|
{
|
|
ids += dr["id"] + ",";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else if (DBHlper.GetPermission(juese, "订单收款", "nr_z_dd_fysk", "查看全部"))
|
|
{
|
|
ts = DBHlper.getcount("select COUNT(*) from view_nr_z_dd as dd,view_nr_z_dd_wfkd as ddsk where dd.jzrq>='" + DateTime.Now.ToShortDateString() + "' and ddsk.wsje>0 and dd.bh=ddsk.bh");
|
|
if (ts > 0)
|
|
{
|
|
dt = DBHlper.Execute("select ddsk.id from view_nr_z_dd as dd,view_nr_z_dd_wfkd as ddsk where dd.jzrq>='" + DateTime.Now.ToShortDateString() + "' and ddsk.wsje>0 and dd.bh=ddsk.bh").Tables[0];
|
|
if (dt.Rows.Count > 0)
|
|
{
|
|
foreach (DataRow dr in dt.Rows)
|
|
{
|
|
ids += dr["id"] + ",";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (ts > 0)
|
|
{
|
|
ids = ids.TrimEnd(',');
|
|
htmlyj += chckmsgdata(10, zhid, ts, "OrderCollect_list.aspx?ids="+ids);
|
|
}
|
|
|
|
}
|
|
else if (DBHlper.GetPermission(juese, "订单管理", "nr_z_dd", "查看个人"))
|
|
{
|
|
if (DBHlper.GetPermission(juese, "订单收款", "nr_z_dd_fysk", "查看个人"))
|
|
{
|
|
ts = DBHlper.getcount("select COUNT(*) from view_nr_z_dd as dd,view_nr_z_dd_wfkd as ddsk where dd.jzrq>='" + DateTime.Now.ToShortDateString() + "' and ddsk.wsje>0 and dd.bh=ddsk.bh and ddsk.ywy='" + user.zhanghao + "' and dd.ywy='" + user.zhanghao + "' ");
|
|
if (ts > 0)
|
|
{
|
|
dt = DBHlper.Execute("select ddsk.id from view_nr_z_dd as dd,view_nr_z_dd_wfkd as ddsk where dd.jzrq>='" + DateTime.Now.ToShortDateString() + "' and ddsk.wsje>0 and dd.bh=ddsk.bh and ddsk.ywy='" + user.zhanghao + "' and dd.ywy='" + user.zhanghao + "' ").Tables[0];
|
|
if (dt.Rows.Count > 0)
|
|
{
|
|
foreach (DataRow dr in dt.Rows)
|
|
{
|
|
ids += dr["id"] + ",";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else if (DBHlper.GetPermission(juese, "订单收款", "nr_z_dd_fysk", "查看全部"))
|
|
{
|
|
ts = DBHlper.getcount("select COUNT(*) from view_nr_z_dd as dd,view_nr_z_dd_wfkd as ddsk where dd.jzrq>='" + DateTime.Now.ToShortDateString() + "' and ddsk.wsje>0 and dd.bh=ddsk.bh and dd.ywy='" + user.zhanghao + "' ");
|
|
if (ts > 0)
|
|
{
|
|
dt = DBHlper.Execute("select ddsk.id from view_nr_z_dd as dd,view_nr_z_dd_wfkd as ddsk where dd.jzrq>='" + DateTime.Now.ToShortDateString() + "' and ddsk.wsje>0 and dd.bh=ddsk.bh and dd.ywy='" + user.zhanghao + "' ").Tables[0];
|
|
if (dt.Rows.Count > 0)
|
|
{
|
|
foreach (DataRow dr in dt.Rows)
|
|
{
|
|
ids += dr["id"] + ",";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (ts > 0)
|
|
{
|
|
ids = ids.TrimEnd(',');
|
|
htmlyj += chckmsgdata(10, zhid, ts, "OrderCollect_list.aspx?ids="+ids);
|
|
}
|
|
}
|
|
|
|
return htmlyj+"</ul>";
|
|
}
|
|
|
|
|
|
|
|
//根据参数查询数据库返回相应数据
|
|
protected string chckmsgdata(int msgtype,int userid,int ts,string url)
|
|
{
|
|
DataTable msgdt = new DataTable();
|
|
msgdt = DBHlper.Execute("select id,msgval,msgtype,riqi,isview from view_nr_z_sysmsg where msgtypeid=" + msgtype + " and userid=" + userid).Tables[0];
|
|
string htmlyj = "";
|
|
string msgtypestr = "";
|
|
if (msgdt.Rows.Count > 0)
|
|
{
|
|
int ddtjval = Convert.ToInt32(msgdt.Rows[0]["msgval"]);
|
|
msgtypestr = msgdt.Rows[0]["msgtype"].ToString();
|
|
if (msgdt.Rows[0]["isview"].ToString() == "0")
|
|
{
|
|
htmlyj += "<li><div class='iconnew' /><a onclick=setonemsgzt(" + msgdt.Rows[0]["id"] + ") href='../Module_data/" + url + "' style='color:#008ead;' > 有" + ts + msgtypestr + "</a></li>";
|
|
}
|
|
else
|
|
{
|
|
htmlyj += "<li><div class='iconnone' /><a onclick=setonemsgzt(" + msgdt.Rows[0]["id"] + ") href='../Module_data/" + url + "' style='color:#008ead;' > 有" + ts + msgtypestr + "</a></li>";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
htmlyj += "<li><div class='iconnone' /><a onclick=setonemsgzt(" + msgdt.Rows[0]["id"] + ") href='../Module_data/" + url + "' style='color:#008ead;' > 有" + ts + msgtypestr + "</a></li>";
|
|
}
|
|
return htmlyj;
|
|
|
|
}
|
|
[WebMethod(EnableSession = true)]
|
|
public void setzt()
|
|
{
|
|
Maticsoft.Model.nr_z_yhzh user = (Maticsoft.Model.nr_z_yhzh)(Session["user"]);
|
|
DBHlper.excutecmd("update nr_z_sysmsg set isview=1 where userid="+user.id);
|
|
}
|
|
|
|
[WebMethod(EnableSession = true)]
|
|
public void setonezt(int id)
|
|
{
|
|
DBHlper.excutecmd("update nr_z_sysmsg set isview=1 where id="+id);
|
|
}
|
|
|
|
} |