From 55103538111a9eb60dcfd57310a76dd8a711ca67 Mon Sep 17 00:00:00 2001 From: Ling0925 <2449858657a@gmail.com> Date: Thu, 23 May 2024 16:55:29 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20=E6=88=90=E5=93=81=E5=87=BA=E5=BA=93?= =?UTF-8?q?=E7=A1=AE=E8=AE=A4=E6=8A=A5=E9=94=99=20Add=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=88=90=E5=93=81=E5=85=A5=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- newyt/Module_data/DemandSheet_list.aspx | 2 +- newyt/Module_data/ProductLibrary_list.aspx.cs | 4 +- newyt/Module_data/Productin_Form.aspx | 171 ++++++++ newyt/Module_data/Productin_Form.aspx.cs | 187 ++++++++ newyt/Module_data/Productin_browse.aspx | 80 ++++ newyt/Module_data/Productin_browse.aspx.cs | 228 ++++++++++ newyt/Module_data/Productin_list.aspx | 180 ++++++++ newyt/Module_data/Productin_list.aspx.cs | 414 ++++++++++++++++++ newyt/Module_data/Productout_Form.aspx.cs | 53 +-- newyt/Module_data/Productout_browse.aspx.cs | 4 +- newyt/ddselect/Product_list.aspx.cs | 6 +- 11 files changed, 1296 insertions(+), 33 deletions(-) create mode 100644 newyt/Module_data/Productin_Form.aspx create mode 100644 newyt/Module_data/Productin_Form.aspx.cs create mode 100644 newyt/Module_data/Productin_browse.aspx create mode 100644 newyt/Module_data/Productin_browse.aspx.cs create mode 100644 newyt/Module_data/Productin_list.aspx create mode 100644 newyt/Module_data/Productin_list.aspx.cs diff --git a/newyt/Module_data/DemandSheet_list.aspx b/newyt/Module_data/DemandSheet_list.aspx index c61f989..b05bae7 100644 --- a/newyt/Module_data/DemandSheet_list.aspx +++ b/newyt/Module_data/DemandSheet_list.aspx @@ -84,7 +84,7 @@
  • 月历
  • 收藏
  • 全部待采购 已采购
  • -
  • +
  • 添加到采购
  • diff --git a/newyt/Module_data/ProductLibrary_list.aspx.cs b/newyt/Module_data/ProductLibrary_list.aspx.cs index fc9fa3a..afb7505 100644 --- a/newyt/Module_data/ProductLibrary_list.aspx.cs +++ b/newyt/Module_data/ProductLibrary_list.aspx.cs @@ -296,11 +296,11 @@ public partial class ProductLibrary_list : System.Web.UI.Page public string isquanxian(int uid) { - if (DBHlper.GetPermission(uid, "产品库存", "view_nr_z_cpkfcl", "查看全部")) + if (DBHlper.GetPermission(uid, "产品库存", "view_nr_z_cpkc", "查看全部")) { return "1"; } - else if (DBHlper.GetPermission(uid, "产品库存", "view_nr_z_cpkfcl", "查看个人")) + else if (DBHlper.GetPermission(uid, "产品库存", "view_nr_z_cpkc", "查看个人")) { return "0"; } diff --git a/newyt/Module_data/Productin_Form.aspx b/newyt/Module_data/Productin_Form.aspx new file mode 100644 index 0000000..9771888 --- /dev/null +++ b/newyt/Module_data/Productin_Form.aspx @@ -0,0 +1,171 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Productin_Form.aspx.cs" Inherits="Productout_Form" %> + + + + + + + + + + + + + + + + + + + +
    +
    +
    +

    成品出库表单页   

    回到列表
    + +
    +
    +温馨提示: +

    • 信息表单中加*号红色标题框为必填项,为了可以顺利保存信息,请您注意填写红色栏目中的信息

    +
    +
    +

    出库基本信息

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    出库编号出库日期单据编号客户名称产品编号产品名称 
    产品单价 产品包装规格整装数量零头数量总金额 
    单位联系人联系电话经手人送货人状态 
    送货地址 
    备注 
    + +
    +
    + + + + + + + + + + + <%--关闭弹出层--%> + + + + + + + diff --git a/newyt/Module_data/Productin_Form.aspx.cs b/newyt/Module_data/Productin_Form.aspx.cs new file mode 100644 index 0000000..aa56da1 --- /dev/null +++ b/newyt/Module_data/Productin_Form.aspx.cs @@ -0,0 +1,187 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Data; + +public partial class Productout_Form : System.Web.UI.Page +{ + //创建一个操作记录bll + Maticsoft.BLL.nr_sys_rizhi rizhibll = new Maticsoft.BLL.nr_sys_rizhi(); + //创建一个共用的申购单模板 + Maticsoft.Model.nr_z_cpck cpckmodel = new Maticsoft.Model.nr_z_cpck(); + //创建一个共同的申购单bll + Maticsoft.BLL.nr_z_cpck cpckbll = new Maticsoft.BLL.nr_z_cpck(); + //创建一个操作记录模板 + Maticsoft.Model.nr_sys_rizhi rizhi = new Maticsoft.Model.nr_sys_rizhi(); + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + if (Session["user"] == null) + { + Response.Redirect("../index.aspx"); + } + //获取角色权限 + Maticsoft.Model.nr_z_yhzh user = (Maticsoft.Model.nr_z_yhzh)(Session["user"]); + + if (Request.QueryString["uid"] != null && Request.QueryString["uid"].ToString().Length > 0) + { + string uid = Request.QueryString["uid"].ToString(); + id.Value = uid; + initdata(Convert.ToInt32(uid)); + pdquanxianbj(user.juese); + } + else + { + + pdquanxian(user.juese); + riqi.Value = DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day; + jingshouren.Value = user.zhanghao; + shr.Value = user.zhanghao; + + } + + } + } + #region 修改时获取真正数据值 + private void initdata(int did) + { + cpckmodel = cpckbll.GetModel(did); + ckdh.Text = cpckmodel.ckbh; + riqi.Value = cpckmodel.riqi.ToString("yyyy-MM-dd"); + scdh.Value = cpckmodel.scdh; + khming.Value = cpckmodel.khmc; + cpbh.Value = cpckmodel.cpbh; + cpmc.Value = cpckmodel.cpmc; + danjia.Value = cpckmodel.cpdj.ToString(); + guige.Value = cpckmodel.guige.ToString(); + zzshuliang.Value = cpckmodel.zzsl.ToString(); + lingtou.Value = cpckmodel.lt.ToString(); + shuliang.Value = cpckmodel.sl.ToString(); + danwei.Value = cpckmodel.danwei; + lxr.Value = cpckmodel.lxr; + zongjine.Value = cpckmodel.zje.ToString(); + lxdh.Value = cpckmodel.lxdh; + jingshouren.Value = cpckmodel.jsr; + shr.Value = cpckmodel.shr; + dizhi.Value = cpckmodel.shdizhi; + txt_beizhu.Text = cpckmodel.beizhu; + zhuangtai.Value = cpckmodel.zt; + } + #endregion + + #region 获取页面参数赋值model对象 + private void getmd() + { + cpckmodel.ckbh = ckdh.Text; + cpckmodel.riqi = Convert.ToDateTime(riqi.Value); + cpckmodel.scdh = scdh.Value; + cpckmodel.khmc = khming.Value; + cpckmodel.cpbh = cpbh.Value; + cpckmodel.cpmc = cpmc.Value; + cpckmodel.cpdj = Convert.ToDecimal(danjia.Value); + cpckmodel.guige = Convert.ToDecimal(guige.Value); + cpckmodel.zzsl = Convert.ToInt32(zzshuliang.Value); + cpckmodel.lt = Convert.ToDecimal(lingtou.Value); + cpckmodel.sl = Convert.ToDecimal(shuliang.Value); + cpckmodel.danwei = danwei.Value; + cpckmodel.lxr = lxr.Value; + cpckmodel.zje = Convert.ToDecimal(zongjine.Value); + cpckmodel.lxdh = lxdh.Value; + cpckmodel.jsr = jingshouren.Value; + cpckmodel.shr = shr.Value; + cpckmodel.shdizhi = dizhi.Value; + cpckmodel.beizhu = txt_beizhu.Text; + cpckmodel.zt = zhuangtai.Value; + + } + #endregion + + #region 敏感权限查看 + void pdquanxian(int juese) + { + Maticsoft.Model.nr_z_yhzh user = (Maticsoft.Model.nr_z_yhzh)(Session["user"]); + if (DBHlper.getzt(user.id) != 1) + { + Response.Redirect("../index.aspx"); + } + if (DBHlper.GetPermission(juese, "成品入库", "nr_z_cprk", "添加") == false) + { + Response.Redirect("../Common/nopower.htm"); + } + + + } + #endregion + + #region 编辑权限查看 + void pdquanxianbj(int juese) + { + Maticsoft.Model.nr_z_yhzh user = (Maticsoft.Model.nr_z_yhzh)(Session["user"]); + if (DBHlper.getzt(user.id) != 1) + { + Response.Redirect("../index.aspx"); + } + if (DBHlper.GetPermission(juese, "成品入库", "nr_z_cprk", "编辑个人") == false + && DBHlper.GetPermission(juese, "成品入库", "nr_z_cprk", "编辑全部") == false) + { + Response.Redirect("../Common/nopower.htm"); + } + + + } + + #endregion + protected void bt_tj_Click(object sender, EventArgs e) + { + try + { + string caozuo = "添加"; + getmd(); + //接收成功参数值 + int rtx = 0; + //判断uid是否存在值,有值为修改,无值为添加 + if (id.Value != null && id.Value != "") + { + cpckmodel.id = Convert.ToInt32(id.Value); + if (cpckbll.Update(cpckmodel)) + { + rtx = Convert.ToInt32(id.Value); + caozuo = "修改"; + } + } + else + { + cpckmodel.ckbh = DBHlper.getbh("CPCK-", "nr_z_cpck", "ckbh", 4); + // bh.Text = sgdmodel.sgdbianhao; + rtx = cpckbll.Add(cpckmodel); + } + if (rtx > 0) + { + //将session转换对象取值 + Maticsoft.Model.nr_z_yhzh zh = (Maticsoft.Model.nr_z_yhzh)Session["user"]; + rizhi.yonghuming = zh.zhanghao; + //拼接字符串插入日志 + rizhi.jilu = zh.zhanghao + caozuo + "了成品出库,出库单号为:" + ckdh.Text.Trim(); + rizhi.leixing = "成品出库"; + rizhi.riqi = DateTime.Now; + rizhibll.Add(rizhi); + Response.Redirect("Productout_browse.aspx?uid=" + rtx, false); + } + else + { + Response.Redirect("../Common/error.aspx"); + } + + } + catch (Exception) + { + Response.Redirect("../Common/error.aspx"); + } + + } +} \ No newline at end of file diff --git a/newyt/Module_data/Productin_browse.aspx b/newyt/Module_data/Productin_browse.aspx new file mode 100644 index 0000000..50d6dc6 --- /dev/null +++ b/newyt/Module_data/Productin_browse.aspx @@ -0,0 +1,80 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Productin_browse.aspx.cs" Inherits="Productout_browse" %> + + + + + + + + + + + + + + + + + + + +
    +
    +
    +

    成品出库详细页   

    回到列表
    +
    +添加 + +   + +   +   + +
    +
    +
    +

    出库基本信息

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    出库编号:出库日期:单据编号:客户名称:产品编号:产品名称:
    产品单价:产品包装规格:整装数量:零头:数量:总金额:
    单位:联系人:联系电话:经手人:送货人:状态:
    送货地址:
    备注:
    +
    +
    + + + + + diff --git a/newyt/Module_data/Productin_browse.aspx.cs b/newyt/Module_data/Productin_browse.aspx.cs new file mode 100644 index 0000000..42c26db --- /dev/null +++ b/newyt/Module_data/Productin_browse.aspx.cs @@ -0,0 +1,228 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Data; + +public partial class Productout_browse : System.Web.UI.Page +{ + Maticsoft.Model.nr_z_cprk cpckmodel = new Maticsoft.Model.nr_z_cprk(); + Maticsoft.BLL.nr_z_cprk cpckbll = new Maticsoft.BLL.nr_z_cprk(); + //创建一个操作记录模板 + 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(); + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + if (Session["user"] == null) + { + Response.Redirect("../index.aspx"); + } + Maticsoft.Model.nr_z_yhzh user = (Maticsoft.Model.nr_z_yhzh)(Session["user"]); + if (Request.QueryString["uid"] != null && Request.QueryString["uid"] != "") + { + id.Value = Request.QueryString["uid"].ToString(); + } + initdata(Convert.ToInt32(id.Value)); + pdquanxian(user.juese); + + } + + } + #region 获取真正数据值 + private void initdata(int did) + { + cpckmodel = cpckbll.GetModel(did); + ckdh.Text = cpckmodel.rkbh; + riqi.Text = cpckmodel.riqi.ToString("yyyy-MM-dd"); + scdh.Text = cpckmodel.scdh; + //khming.Text = cpckmodel.; + //cpbh.Text = cpckmodel.cpmc; + cpmc.Text = cpckmodel.cpmc; + //danjia.Text = cpckmodel..ToString(); + //guige.Text = cpckmodel.guige.ToString(); + zzshuliang.Text = cpckmodel.zzsl.ToString(); + lingtou.Text = cpckmodel.lt.ToString(); + shuliang.Text = cpckmodel.sl.ToString(); + //danwei.Text = cpckmodel.danwei; + //lxr.Text = cpckmodel.lxr; + //zongjine.Text = cpckmodel.zje.ToString(); + //lxdh.Text = cpckmodel.lxdh; + jingshouren.Text = cpckmodel.jsr; + //shr.Text = cpckmodel.shr; + //dizhi.Text = cpckmodel.shdizhi; + //txt_beizhu.Text = cpckmodel.beizhu; + zhuangtai.Text = cpckmodel.zt; + } + #endregion + + #region 敏感权限查看 + void pdquanxian(int juese) + { + Maticsoft.Model.nr_z_yhzh user = (Maticsoft.Model.nr_z_yhzh)(Session["user"]); + if (DBHlper.getzt(user.id) != 1) + { + Response.Redirect("../index.aspx"); + } + if (DBHlper.GetPermission(juese, "成品入库", "nr_z_cprk", "查看全部") == false && DBHlper.GetPermission(juese, "成品入库", "nr_z_cprk", "查看个人") == false) + { + Response.Redirect("../Common/nopower.htm"); + } + + if (DBHlper.GetPermission(juese, "成品入库", "nr_z_cprk", "编辑个人") && jingshouren.Text == user.zhanghao) + { + bt_tj.Visible = true; + + } + if (DBHlper.GetPermission(juese, "成品入库", "nr_z_cprk", "编辑全部")) + { + bt_tj.Visible = true; + + } + if (DBHlper.GetPermission(juese, "成品入库", "nr_z_cprk", "删除个人") && jingshouren.Text == user.zhanghao) + { + shanchu.Visible = true; + } + if (DBHlper.GetPermission(juese, "成品入库", "nr_z_cprk", "删除全部")) + { + shanchu.Visible = true; + + } + + if (DBHlper.GetPermission(juese, "成品入库", "nr_z_cprk", "入库确认")) + { + ckqr.Visible = true; + } + + if (DBHlper.GetPermission(juese, "成品入库", "nr_z_cprk", "入库冲红")) + { + ckch.Visible = true; + } + + if (DBHlper.GetPermission(juese, "成品入库", "nr_z_cprk", "添加")) + { + bt_add.Visible = true; + } + + if (zhuangtai.Text == "已入库") + { + ckqr.Enabled = false; + ckqr.BackColor = System.Drawing.Color.Gray; + shanchu.Enabled = false; + shanchu.BackColor = System.Drawing.Color.Gray; + bt_tj.Enabled = false; + bt_tj.BackColor = System.Drawing.Color.Gray; + } + if (zhuangtai.Text == "待确认") + { + ckch.Enabled = false; + ckch.BackColor = System.Drawing.Color.Gray; + } + if (DBHlper.GetPermission(juese, "成品入库", "nr_z_cprk", "打印")) + { + dayin.Visible = true; + } + } + + #endregion + protected void bt_tj_Click(object sender, EventArgs e) + { + Response.Redirect("Productout_Form.aspx?uid=" + id.Value); + } + protected void Button1_Click(object sender, EventArgs e) + { + + + if (cpckbll.Delete(Convert.ToInt32(id.Value))) + { + //给日志模板赋值 + rizhi.riqi = DateTime.Now; + rizhi.leixing = "成品入库"; + //将session转换对象取值 + Maticsoft.Model.nr_z_yhzh zh = (Maticsoft.Model.nr_z_yhzh)Session["user"]; + //拼接字符串插入日志 + rizhi.jilu = zh.zhanghao + "删除了成品入库,入库单号为:" + cpbh.Text.Trim(); + rizhi.yonghuming = zh.zhanghao.ToString(); + rizhibll.Add(rizhi); + Response.Redirect("Productout_list.aspx", false); + } + else + { + Response.Write(""); + } + } + + protected void btnchonghong_Click(object sender, EventArgs e) + { + + DataTable dt = DBHlper.Execute(string.Format("select * from nr_z_cpkc where scdh='{0}' and xmmc='{1}' and khmc='{2}'", scdh.Text, cpbh.Text, khming.Text)).Tables[0]; + double sl = Convert.ToDouble(dt.Rows[0]["sl"]); + double nowsl = Convert.ToDouble(shuliang.Text); + int gxcount = DBHlper.excutecmd("update nr_z_cpkc set sl=" + (sl + nowsl) + " where id=" + dt.Rows[0]["id"]); + if (gxcount > 0) + { + DBHlper.excutecmd("update nr_z_cprk set zt='待确认' where id=" + id.Value); + } + else + { + Response.Write(""); + } + + //给日志模板赋值 + rizhi.riqi = DateTime.Now; + rizhi.leixing = "成品入库"; + //将session转换对象取值 + Maticsoft.Model.nr_z_yhzh zh = (Maticsoft.Model.nr_z_yhzh)Session["user"]; + //拼接字符串插入日志 + rizhi.jilu = zh.zhanghao + "执行了入库冲红,入库单号为:" + ckdh.Text.Trim(); + rizhi.yonghuming = zh.zhanghao.ToString(); + rizhibll.Add(rizhi); + Response.Redirect("Productout_browse.aspx?uid=" + id.Value); + } + + + protected void btn_chuku_Click(object sender, EventArgs e) + { + //var sql = string.Format("select * from view_nr_z_cpkc where scdh='{0}' and xmmc='{1}' and khmc='{2}'", scdh.Text, cpbh.Text, khming.Text); + var sql = string.Format("select * from view_nr_z_cpkc where cpbh='{0}'", cpbh.Text); + var result = DBHlper.Execute(sql); + DataTable dt = result.Tables[0]; + if (dt.Rows.Count == 0) + { + Response.Write(""); + return; + } + else + { + double sl = Convert.ToDouble(dt.Rows[0]["sl"]); + double nowsl = Convert.ToDouble(shuliang.Text); + if (sl < nowsl) + { + Response.Write(""); + return; + } + else + { + DBHlper.excutecmd("update nr_z_cpkc set sl=" + (sl - nowsl) + " where id=" + dt.Rows[0]["id"]); + DBHlper.excutecmd("update nr_z_cprk set zt='已入库' where id=" + id.Value); + rizhi.riqi = DateTime.Now; + rizhi.leixing = "成品入库"; + //将session转换对象取值 + Maticsoft.Model.nr_z_yhzh zh = (Maticsoft.Model.nr_z_yhzh)Session["user"]; + //拼接字符串插入日志 + rizhi.jilu = zh.zhanghao + "执行了成品入库,成品入库号为:" + ckdh.Text.Trim(); + rizhi.yonghuming = zh.zhanghao.ToString(); + rizhibll.Add(rizhi); + Response.Redirect("Productout_browse.aspx?uid=" + id.Value); + } + } + + } + +} + diff --git a/newyt/Module_data/Productin_list.aspx b/newyt/Module_data/Productin_list.aspx new file mode 100644 index 0000000..b82d445 --- /dev/null +++ b/newyt/Module_data/Productin_list.aspx @@ -0,0 +1,180 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Productin_list.aspx.cs" Inherits="Productout_list" %> + + + + + + + + + + + + + + + + + + + + +
    +
    +
    + + + + + + +
    +

    成品出库主页

    +
    +
    +
    + +
    +
    +
    + + + + + + + + + + + + + + + +
    条数据 + + + + + + 页/共 + + + + + + + +
    +
    +
    +
    +<%-- 工具箱--%> +
    + + + + +
    +
    +
    +
    +
    +
    +<%-- 数据表头--%> +
    + + + +
    +
    +<%-- 数据列表--%> +
    + +
    +
    +<%--数据汇总--%> +
    + + +
    +
    +
    + <%--列配置--%> + +
    + + + + + + + + + + + diff --git a/newyt/Module_data/Productin_list.aspx.cs b/newyt/Module_data/Productin_list.aspx.cs new file mode 100644 index 0000000..624eecb --- /dev/null +++ b/newyt/Module_data/Productin_list.aspx.cs @@ -0,0 +1,414 @@ +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 Productout_list : System.Web.UI.Page +{ + //创建一个客户模板 + Maticsoft.Model.nr_z_ddwxd kehumd = new Maticsoft.Model.nr_z_ddwxd(); + //创建一个共用的客户bll + Maticsoft.BLL.nr_z_ddwxd kehubll = new Maticsoft.BLL.nr_z_ddwxd(); + //创建一个操作记录模板 + 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"); + } + + } + Utility.RegisterTypeForAjax(typeof(Productout_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, "nr_z_cpck"); + 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, "nr_z_cpck", 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, "成品出库", "nr_z_cpck", "查看全部")) + { + wherecode += string.Format(" from nr_z_cpck where " + tiaojian + " id not in(select top ({0}*{1}) id from nr_z_cpck)" + paixu, pg, pageitem); + + } + else if (DBHlper.GetPermission(zhanghao.juese, "成品出库", "nr_z_cpck", "查看个人")) + { + wherecode += string.Format(" from nr_z_cpck where jsr='" + zhanghao.zhanghao + "' and " + tiaojian + " id not in(select top ({0}*{1}) id from nr_z_cpck)" + 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] + ""; + } + htmlcode += ""; + } + return htmlcode; + } + else + { + string lieselect = string.Format("select * from nr_sys_lieming where tblname='{0}' ORDER BY xh", "nr_z_cpck"); + DataTable liedt = DBHlper.Execute(lieselect).Tables[0]; + int lieshuixu = 0; + foreach (DataRow liedr in liedt.Rows) + { + lieshuixu++; + string cmdinsert = string.Format("insert into nr_lt_paixu values('{0}','{1}','{2}','{3}',{4},{5})", zhanghao.id, "nr_z_cpck", liedr["ywlieming"], liedr["zwlieming"], lieshuixu, 1); + DBHlper.excutecmd(cmdinsert); + } + return ""; + } + } + #endregion + + #region 传入条数返回页数以便前台调用 + [Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)] + public int maxpage(int count, string tj) + { + int fanhuizhi = 0; + string cmd = string.Format("select count(*) from nr_z_cpck " + tj); + Maticsoft.Model.nr_z_yhzh yhzh = (Maticsoft.Model.nr_z_yhzh)Session["user"]; + if (!DBHlper.GetPermission(yhzh.juese, "成品出库", "nr_z_cpck", "查看全部")) + { + if (tj == "") + { + cmd += " where jsr='" + yhzh.zhanghao + "'"; + } + else + { + cmd += " and jsr='" + yhzh.zhanghao + "'"; + } + } + int sumcount = DBHlper.getcount(cmd); + if (sumcount > count) + { + fanhuizhi = sumcount / count; + } + return fanhuizhi; + + } + #endregion + + #region 数据排序 + [Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)] + public void itempaixu(string code) + { + Maticsoft.Model.nr_z_yhzh yhzh = (Maticsoft.Model.nr_z_yhzh)Session["user"]; + string[] pxzu = code.Split(';'); + string[] codezu = new string[4]; + foreach (string px in pxzu) + { + codezu = px.Split('/'); + string cmdexits = string.Format("select id from nr_lt_paixu where userid='{0}' and tblname='{1}' and lieming='{2}'", yhzh.id, "nr_z_cpck", codezu[2]); + DataTable paixutable = DBHlper.Execute(cmdexits).Tables[0]; + if (paixutable.Rows.Count > 0) + { + int idfanhui = Convert.ToInt32(paixutable.Rows[0][0]); + string updatepaixu = string.Format("update nr_lt_paixu set shuixu={0},isxianshi={1} where id={2}", codezu[0], codezu[3], idfanhui); + DBHlper.excutecmd(updatepaixu); + + } + else + { + string paixuinsert = string.Format("insert into nr_paixu (userid,tblname,lieming,zhongwen,shuixu,isxianshi) values('{0}','{1}','{2}','{3}',{4},{5})", yhzh.id, "nr_z_cpck", codezu[2], codezu[1], codezu[0], codezu[3]); + DBHlper.excutecmd(paixuinsert); + } + } + } + #endregion + + #region 列头排序 + [Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)] + public string paixu() + { + Maticsoft.Model.nr_z_yhzh zhanghao = (Maticsoft.Model.nr_z_yhzh)Session["user"]; + string paixuselct = string.Format("select * from nr_lt_paixu where userid='{0}' and tblname='{1}' and isxianshi={2} order by shuixu ", zhanghao.id, "nr_z_cpck", 1); + DataTable dtselect = DBHlper.Execute(paixuselct).Tables[0]; + string htmlcode = ""; + foreach (DataRow dr in dtselect.Rows) + { + htmlcode += string.Format("{1}", dr["lieming"], dr["zhongwen"]); + } + return htmlcode; + } + #endregion + + #region 获取隐藏的列 + [Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)] + public string yincanglie(int endid) + { + Maticsoft.Model.nr_z_yhzh zhanghao = (Maticsoft.Model.nr_z_yhzh)Session["user"]; + endid = endid - 1; + string displaycmd = "select * from nr_lt_paixu where isxianshi=0 and tblname='nr_z_cpck' and userid='" + zhanghao.id + "'"; + DataTable distable = DBHlper.Execute(displaycmd).Tables[0]; + string htmlcode = ""; + foreach (DataRow dr in distable.Rows) + { + endid++; + htmlcode += "" + endid + "" + dr["zhongwen"] + " "; + } + return htmlcode; + } + #endregion + + #region 查询数据总数 + [Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)] + public int sumitem(string wheretj) + { + string selectcmd = "select count(*) from nr_z_cpck " + wheretj; + Maticsoft.Model.nr_z_yhzh yhzh = (Maticsoft.Model.nr_z_yhzh)Session["user"]; + if (!DBHlper.GetPermission(yhzh.juese, "成品出库", "nr_z_cpck", "查看全部")) + { + if (wheretj == "") + { + selectcmd += " where jsr='" + yhzh.zhanghao + "'"; + } + else + { + selectcmd += " and jsr='" + yhzh.zhanghao + "'"; + } + } + int sumcount = DBHlper.getcount(selectcmd); + return sumcount; + } + #endregion + #region 日期查询 + [Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)] + public string nowdaycount(string zt, int selmonth) + { + DateTime nowdt = DateTime.Now; + int days = DateTime.DaysInMonth(nowdt.Year, selmonth); + string yuechu = nowdt.Year + "-" + selmonth + "-" + "1"; + string yuemo = Convert.ToDateTime(nowdt.Year + "-" + selmonth + "-" +days).AddDays(1).ToString("yyyy-MM-dd"); + DateTime yc = Convert.ToDateTime(yuechu); + string cmd = ""; + if (zt == "") + { + cmd = string.Format("select CONVERT(varchar(12),riqi,111) as riqi from nr_z_cpck where riqi>='{0}' and riqi<='{1}' ", yuechu, yuemo); + } + else { + cmd = string.Format("select CONVERT(varchar(12),riqi,111) as riqi from nr_z_cpck where riqi>='{0}' and riqi<='{1}' and zt='"+zt+"' ", yuechu, yuemo); + } + + Maticsoft.Model.nr_z_yhzh yhzh = (Maticsoft.Model.nr_z_yhzh)Session["user"]; + if (!DBHlper.GetPermission(yhzh.juese, "成品出库", "nr_z_cpck", "查看全部")) + { + cmd += " and jsr='" + yhzh.zhanghao + "'"; + } + DataTable dt = DBHlper.Execute(cmd).Tables[0]; + var biao = "" + + ""; + for (var x = 1; x <= days; x++) + { + biao += ""; + } + biao += ""; + for (var x = 1; x <= days; x++) + { + string str = yc.ToShortDateString(); + int lenth = dt.Select("riqi='" + yc.ToShortDateString() + "'").Length; + string everday = yc.Year.ToString(); + if (yc.Month < 10) + { + everday += "/0" + yc.Month; + } + else + { + everday += "/" + yc.Month; + } + if (yc.Day < 10) + { + everday += "/0" + yc.Day; + } + else + { + everday += "/" + yc.Day; + } + + biao += ""; + yc = yc.AddDays(1); + } + biao += "
    日期
    < " + selmonth + " >
    " + x + "
    数量" + dt.Select("riqi='" + everday + "'").Length + "
    "; + return biao; + } + #endregion + + #region 敏感权限查看 + void pdquanxian(int juese) + { + Maticsoft.Model.nr_z_yhzh user = (Maticsoft.Model.nr_z_yhzh)(Session["user"]); + if (DBHlper.getzt(user.id) != 1) + { + Response.Redirect("../index.aspx"); + } + if (!DBHlper.GetPermission(juese, "成品出库", "nr_z_cpck", "查看全部") && !DBHlper.GetPermission(juese, "成品出库", "nr_z_cpck", "查看个人")) + { + Response.Redirect("../Common/nopower.htm"); + } + if (DBHlper.GetPermission(juese, "成品出库", "nr_z_cpck", "添加")) + { + li_add.Visible = true; + } + if (DBHlper.GetPermission(juese, "成品出库", "nr_z_cpck", "导出")) + { + xiazai.Visible = true; + } + if (DBHlper.GetPermission(juese, "成品出库", "nr_z_cpck", "配置")) + { + leiset.Visible = true; + } + + } + + #endregion + #region 判断查看权限 + [Ajax.AjaxMethod] + public string isquanxian(int uid) + { + + if (DBHlper.GetPermission(uid, "成品出库", "nr_z_cpck", "查看全部")) + { + return "1"; + } + else if (DBHlper.GetPermission(uid, "成品出库", "nr_z_cpck", "查看个人")) + { + return "0"; + } + else + { + return ""; + } + } + #endregion + #region 下载方法 + public void DownLoad(object o, EventArgs e) + { + Maticsoft.Model.nr_z_yhzh zhanghao = (Maticsoft.Model.nr_z_yhzh)Session["user"]; + string selectid = this.selectid.Value; + string colmn = ""; + ArrayList sList = new ArrayList(); + DataTable dtcolmnname = DBHlper.Execute("select lieming,zhongwen from nr_lt_paixu where tblname='nr_z_cpck' and isxianshi=1 and userid='" + ((Maticsoft.Model.nr_z_yhzh)Session["user"]).id + "' order by shuixu").Tables[0]; + string tj = strwhere.Value; + foreach (DataRow r in dtcolmnname.Rows) + { + colmn += r["lieming"].ToString() + ','; + sList.Add(r["zhongwen"].ToString()); + } + colmn = colmn.TrimEnd(','); + string selectcode = ""; + if (drp_zt.SelectedItem.Value != "") + { + selectcode = "select " + colmn + " from nr_z_cpck where zt='" + drp_zt.Text + "'"; + } + else + { + selectcode = "select " + colmn + " from nr_z_cpck where 1=1 "; + } + if (tj != "") + { + selectcode += tj.Replace("where", "and"); + } + if (selectid != "") + { + selectcode += " and id in(" + selectid.TrimEnd(',') + ")"; + } + if (DBHlper.GetPermission(zhanghao.juese, "成品出库", "nr_z_cpck", "查看全部")) + { + + } + else if (DBHlper.GetPermission(zhanghao.juese, "成品出库", "nr_z_cpck", "查看个人")) + { + selectcode += " and jsr='" + zhanghao.zhanghao + "'"; + } + DataTable dt = DBHlper.Execute(selectcode + " order by id desc").Tables[0]; + DBHlper.ExportByWeb(dt, "成品出库"+DateTime.Now, sList); + } + #endregion + #region 汇总 + [Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)] + public string gethuizong(string tiaojian, string[] hzlie) + { + Maticsoft.Model.nr_z_yhzh zhanghao = (Maticsoft.Model.nr_z_yhzh)Session["user"]; + string code = ""; + string paixuselct = string.Format("select * from nr_lt_paixu where userid='{0}' and tblname='{1}' and isxianshi={2} order by shuixu ", zhanghao.id, "nr_z_cpck", 1); + DataTable dtselect = DBHlper.Execute(paixuselct).Tables[0]; + string datacolmn = ""; + string wherecode = ""; + int exits = 0; + foreach (DataRow dr in dtselect.Rows) + { + exits = 0; + foreach (string lie in hzlie) + { + if (dr["zhongwen"].ToString() == lie) + { + exits++; + } + } + if (exits == 0) + { + code += ""; + } + else + { + datacolmn = dr["lieming"].ToString(); + wherecode = "select sum(" + datacolmn + ") "; + if (DBHlper.GetPermission(zhanghao.juese, "成品出库", "nr_z_cpck", "查看全部")) + { + wherecode += " from nr_z_cpck where " + tiaojian; + } + else if (DBHlper.GetPermission(zhanghao.juese, "成品出库", "nr_z_cpck", "查看个人")) + { + wherecode += " from nr_z_cpck where jsr='" + zhanghao.zhanghao + "' and " + tiaojian; + } + wherecode += " 1=1 "; + code += "" + DBHlper.getfirstcolmn(wherecode) + ""; + } + } + return code; + + } + #endregion + +} \ No newline at end of file diff --git a/newyt/Module_data/Productout_Form.aspx.cs b/newyt/Module_data/Productout_Form.aspx.cs index a31313d..aa56da1 100644 --- a/newyt/Module_data/Productout_Form.aspx.cs +++ b/newyt/Module_data/Productout_Form.aspx.cs @@ -33,7 +33,7 @@ public partial class Productout_Form : System.Web.UI.Page string uid = Request.QueryString["uid"].ToString(); id.Value = uid; initdata(Convert.ToInt32(uid)); - pdquanxianbj(user.juese); + pdquanxianbj(user.juese); } else { @@ -41,7 +41,7 @@ public partial class Productout_Form : System.Web.UI.Page pdquanxian(user.juese); riqi.Value = DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day; jingshouren.Value = user.zhanghao; - shr.Value = user.zhanghao; + shr.Value = user.zhanghao; } @@ -50,27 +50,27 @@ public partial class Productout_Form : System.Web.UI.Page #region 修改时获取真正数据值 private void initdata(int did) { - cpckmodel=cpckbll.GetModel(did); - ckdh.Text = cpckmodel.ckbh; - riqi.Value = cpckmodel.riqi.ToString("yyyy-MM-dd"); - scdh.Value = cpckmodel.scdh; - khming.Value = cpckmodel.khmc; - cpbh.Value = cpckmodel.cpbh; - cpmc.Value= cpckmodel.cpmc; - danjia.Value= cpckmodel.cpdj.ToString(); - guige.Value= cpckmodel.guige.ToString(); - zzshuliang.Value= cpckmodel.zzsl.ToString(); - lingtou.Value= cpckmodel.lt.ToString(); - shuliang.Value= cpckmodel.sl.ToString(); - danwei.Value= cpckmodel.danwei ; - lxr.Value= cpckmodel.lxr; - zongjine.Value= cpckmodel.zje.ToString(); - lxdh.Value= cpckmodel.lxdh; - jingshouren.Value= cpckmodel.jsr; - shr.Value= cpckmodel.shr; - dizhi.Value= cpckmodel.shdizhi; - txt_beizhu.Text= cpckmodel.beizhu; - zhuangtai.Value = cpckmodel.zt; + cpckmodel = cpckbll.GetModel(did); + ckdh.Text = cpckmodel.ckbh; + riqi.Value = cpckmodel.riqi.ToString("yyyy-MM-dd"); + scdh.Value = cpckmodel.scdh; + khming.Value = cpckmodel.khmc; + cpbh.Value = cpckmodel.cpbh; + cpmc.Value = cpckmodel.cpmc; + danjia.Value = cpckmodel.cpdj.ToString(); + guige.Value = cpckmodel.guige.ToString(); + zzshuliang.Value = cpckmodel.zzsl.ToString(); + lingtou.Value = cpckmodel.lt.ToString(); + shuliang.Value = cpckmodel.sl.ToString(); + danwei.Value = cpckmodel.danwei; + lxr.Value = cpckmodel.lxr; + zongjine.Value = cpckmodel.zje.ToString(); + lxdh.Value = cpckmodel.lxdh; + jingshouren.Value = cpckmodel.jsr; + shr.Value = cpckmodel.shr; + dizhi.Value = cpckmodel.shdizhi; + txt_beizhu.Text = cpckmodel.beizhu; + zhuangtai.Value = cpckmodel.zt; } #endregion @@ -78,7 +78,7 @@ public partial class Productout_Form : System.Web.UI.Page private void getmd() { cpckmodel.ckbh = ckdh.Text; - cpckmodel.riqi =Convert.ToDateTime(riqi.Value); + cpckmodel.riqi = Convert.ToDateTime(riqi.Value); cpckmodel.scdh = scdh.Value; cpckmodel.khmc = khming.Value; cpckmodel.cpbh = cpbh.Value; @@ -126,7 +126,8 @@ public partial class Productout_Form : System.Web.UI.Page { Response.Redirect("../index.aspx"); } - if (DBHlper.GetPermission(juese, "成品入库", "nr_z_cprk", "编辑个人") == false && DBHlper.GetPermission(juese, "成品入库", "nr_z_cprk", "编辑全部") == false) + if (DBHlper.GetPermission(juese, "成品入库", "nr_z_cprk", "编辑个人") == false + && DBHlper.GetPermission(juese, "成品入库", "nr_z_cprk", "编辑全部") == false) { Response.Redirect("../Common/nopower.htm"); } @@ -155,7 +156,7 @@ public partial class Productout_Form : System.Web.UI.Page } else { - cpckmodel.ckbh = DBHlper.getbh("CPCK-", "nr_z_cpck", "ckbh", 4); + cpckmodel.ckbh = DBHlper.getbh("CPCK-", "nr_z_cpck", "ckbh", 4); // bh.Text = sgdmodel.sgdbianhao; rtx = cpckbll.Add(cpckmodel); } diff --git a/newyt/Module_data/Productout_browse.aspx.cs b/newyt/Module_data/Productout_browse.aspx.cs index 495748b..6bfc58b 100644 --- a/newyt/Module_data/Productout_browse.aspx.cs +++ b/newyt/Module_data/Productout_browse.aspx.cs @@ -188,7 +188,9 @@ public partial class Productout_browse : System.Web.UI.Page protected void btn_chuku_Click(object sender, EventArgs e) { - var result = DBHlper.Execute(string.Format("select * from view_nr_z_cpkc where scdh='{0}' and xmmc='{1}' and khmc='{2}'", scdh.Text, cpbh.Text, khming.Text)); + //var sql = string.Format("select * from view_nr_z_cpkc where scdh='{0}' and xmmc='{1}' and khmc='{2}'", scdh.Text, cpbh.Text, khming.Text); + var sql = string.Format("select * from view_nr_z_cpkc where cpbh='{0}'", cpbh.Text); + var result = DBHlper.Execute(sql); DataTable dt = result.Tables[0]; if (dt.Rows.Count == 0) { diff --git a/newyt/ddselect/Product_list.aspx.cs b/newyt/ddselect/Product_list.aspx.cs index b05c411..4a72b51 100644 --- a/newyt/ddselect/Product_list.aspx.cs +++ b/newyt/ddselect/Product_list.aspx.cs @@ -222,7 +222,7 @@ public partial class Product_list : System.Web.UI.Page { Response.Redirect("../index.aspx"); } - if (!DBHlper.GetPermission(juese, "产品档案", "nr_z_cpkc", "查看全部") && !DBHlper.GetPermission(juese, "产品档案", "nr_z_cpkc", "查看个人")) + if (!DBHlper.GetPermission(juese, "产品档案", "view_nr_z_cpkc", "查看全部") && !DBHlper.GetPermission(juese, "产品档案", "nr_z_cpkc", "查看个人")) { Response.Redirect("../Common/nopower.htm"); } @@ -236,11 +236,11 @@ public partial class Product_list : System.Web.UI.Page public string isquanxian(int uid) { - if (DBHlper.GetPermission(uid, "产品档案", "nr_z_cpkc", "查看全部")) + if (DBHlper.GetPermission(uid, "产品档案", "view_nr_z_cpkc", "查看全部")) { return "1"; } - else if (DBHlper.GetPermission(uid, "产品档案", "nr_z_cpkc", "查看个人")) + else if (DBHlper.GetPermission(uid, "产品档案", "view_nr_z_cpkc", "查看个人")) { return "0"; }