using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Ajax; using System.Data; using System.IO; using System.Data.OleDb; using System.Collections; using System.Text; public partial class Schedule_list : CommonPage { Maticsoft.Model.nr_sys_rizhi rizhi = new Maticsoft.Model.nr_sys_rizhi(); //创建一个操作记录bll Maticsoft.BLL.nr_sys_rizhi rizhibll = new Maticsoft.BLL.nr_sys_rizhi(); int jsid = 0; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["user"] == null) { Response.Redirect("../index.aspx"); } if (Request.QueryString["sczt"] != null && Request.QueryString["sczt"] != "") { drp_zt.Text = Request.QueryString["sczt"].ToString(); } } Utility.RegisterTypeForAjax(typeof(Schedule_list)); Maticsoft.Model.nr_z_yhzh user = (Maticsoft.Model.nr_z_yhzh)(Session["user"]); hiddenid.Value = user.juese.ToString(); Hiddenname.Value = user.zhanghao; jsid = user.juese; pdquanxian(jsid); } #region 数据加载输出 [Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)] public string page_change(int pg, int pageitem, string paixu, string tiaojian) { Maticsoft.Model.nr_z_yhzh zhanghao = (Maticsoft.Model.nr_z_yhzh)Session["user"]; string htmlcode = ""; string isexits = string.Format("select count(*) from nr_lt_paixu where userid='{0}' and tblname='{1}'", zhanghao.id, "view_nr_z_scjd"); int exitscount = DBHlper.getcount(isexits); if (exitscount > 0) { string paixuselct = string.Format("select * from nr_lt_paixu where userid='{0}' and tblname='{1}' and isxianshi={2} order by shuixu ", zhanghao.id, "view_nr_z_scjd", 1); DataTable dtselect = DBHlper.Execute(paixuselct).Tables[0]; string wherecode = string.Format("select top {0} ", pageitem); foreach (DataRow dtr in dtselect.Rows) { wherecode += dtr["lieming"] + ","; } wherecode += "id"; if (DBHlper.GetPermission(zhanghao.juese, "生产进度", "view_nr_z_scjd", "查看全部")) { wherecode += string.Format(" from view_nr_z_scjd where " + tiaojian + " id not in(select top ({0}*{1}) id from view_nr_z_scjd " + " where " + tiaojian + " 1=1 " + paixu + ")" + paixu, pg, pageitem); } DataTable dt_paixu = DBHlper.Execute(wherecode).Tables[0]; if (dt_paixu.Rows.Count == 0) { return "   没有数据"; } for (int i = 0; i < dt_paixu.Rows.Count; i++) { htmlcode += ""; htmlcode += " "; for (int j = 0; j < dt_paixu.Columns.Count - 1; j++) { htmlcode += "" + dt_paixu.Rows[i][j] + ""; } DataSet gjds = DBHlper.Execute("select * from view_bianma where zhonglei='工序项目' and zt='1'"); if (gjds != null & gjds.Tables[0].Rows.Count > 0) { /*-----制模工序时候获取登记信息------*/ //需产总数量 string xcsl = DBHlper.getfirstcolmn("select isnull(sum(xcmj),0) from nr_z_mjzld where scdbh='" + dt_paixu.Rows[i]["scbh"] + "' and xmid='" + dt_paixu.Rows[i]["id"] + "' and pm='" + dt_paixu.Rows[i]["cpmc"] + "'"); //已登记总数量 string djzsl = DBHlper.getfirstcolmn("select isnull(SUM(djsl),0) from nr_z_scdj_djjl where scxmid='" + dt_paixu.Rows[i]["id"] + "'and djgx='制模'"); //已下发总数量 string yxfzsl = DBHlper.getfirstcolmn("select isnull(SUM(xfsl),0) from nr_z_scdj_xf where scxmid='" + dt_paixu.Rows[i]["id"] + "' and dqgx='制模' and xfgx=(select top 1 xfgx from nr_z_scdj_xf where dqgx='制模')"); //已报废总数量 string ybfzsl = DBHlper.getfirstcolmn("select isnull(SUM(bfsl),0) from nr_z_scdj_djjl where scxmid='" + dt_paixu.Rows[i]["id"] + "' and djgx='制模'"); //待登记数量 int ddjzsl = Convert.ToInt32(xcsl) - Convert.ToInt32(djzsl) - Convert.ToInt32(ybfzsl); //待下发数量 int dxfzsl = Convert.ToInt32(djzsl) - Convert.ToInt32(yxfzsl); //滞留总数量 int zlzsl = ddjzsl + dxfzsl; if (Convert.ToInt32(ybfzsl) > 10) { htmlcode += "