2024-05-23 16:55:29 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Web;
|
|
|
|
|
using System.Web.UI;
|
|
|
|
|
using System.Web.UI.WebControls;
|
|
|
|
|
using System.Data;
|
|
|
|
|
|
2024-06-01 11:14:26 +08:00
|
|
|
|
public partial class Productin_Form : System.Web.UI.Page
|
2024-05-23 16:55:29 +08:00
|
|
|
|
{
|
|
|
|
|
//创建一个操作记录bll
|
|
|
|
|
Maticsoft.BLL.nr_sys_rizhi rizhibll = new Maticsoft.BLL.nr_sys_rizhi();
|
|
|
|
|
//创建一个共用的申购单模板
|
2024-06-06 12:26:43 +08:00
|
|
|
|
Maticsoft.Model.nr_z_cprk cpckmodel = new Maticsoft.Model.nr_z_cprk();
|
2024-05-23 16:55:29 +08:00
|
|
|
|
//创建一个共同的申购单bll
|
2024-06-06 12:26:43 +08:00
|
|
|
|
Maticsoft.BLL.nr_z_cprk cprkbll = new Maticsoft.BLL.nr_z_cprk();
|
2024-05-23 16:55:29 +08:00
|
|
|
|
//创建一个操作记录模板
|
|
|
|
|
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;
|
2024-06-06 12:26:43 +08:00
|
|
|
|
//shr.Value = user.zhanghao;
|
2024-05-23 16:55:29 +08:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#region 修改时获取真正数据值
|
|
|
|
|
private void initdata(int did)
|
|
|
|
|
{
|
2024-06-06 12:26:43 +08:00
|
|
|
|
cpckmodel = cprkbll.GetModel(did);
|
|
|
|
|
ckdh.Text = cpckmodel.rkbh;
|
2024-05-23 16:55:29 +08:00
|
|
|
|
riqi.Value = cpckmodel.riqi.ToString("yyyy-MM-dd");
|
|
|
|
|
scdh.Value = cpckmodel.scdh;
|
2024-06-06 12:26:43 +08:00
|
|
|
|
//khming.Value = cpckmodel.khmc;
|
2024-05-23 16:55:29 +08:00
|
|
|
|
cpbh.Value = cpckmodel.cpbh;
|
|
|
|
|
cpmc.Value = cpckmodel.cpmc;
|
2024-06-06 12:26:43 +08:00
|
|
|
|
//danjia.Value = cpckmodel.cpdj.ToString();
|
2024-05-23 16:55:29 +08:00
|
|
|
|
guige.Value = cpckmodel.guige.ToString();
|
|
|
|
|
zzshuliang.Value = cpckmodel.zzsl.ToString();
|
|
|
|
|
lingtou.Value = cpckmodel.lt.ToString();
|
|
|
|
|
shuliang.Value = cpckmodel.sl.ToString();
|
|
|
|
|
danwei.Value = cpckmodel.danwei;
|
2024-06-06 12:26:43 +08:00
|
|
|
|
//lxr.Value = cpckmodel.lxr;
|
2024-05-23 16:55:29 +08:00
|
|
|
|
zongjine.Value = cpckmodel.zje.ToString();
|
2024-06-06 12:26:43 +08:00
|
|
|
|
//lxdh.Value = cpckmodel.lxdh;
|
2024-05-23 16:55:29 +08:00
|
|
|
|
jingshouren.Value = cpckmodel.jsr;
|
2024-06-06 12:26:43 +08:00
|
|
|
|
//shr.Value = cpckmodel.shr;
|
|
|
|
|
//dizhi.Value = cpckmodel.shdizhi;
|
2024-05-23 16:55:29 +08:00
|
|
|
|
txt_beizhu.Text = cpckmodel.beizhu;
|
|
|
|
|
zhuangtai.Value = cpckmodel.zt;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 获取页面参数赋值model对象
|
|
|
|
|
private void getmd()
|
|
|
|
|
{
|
2024-06-06 12:26:43 +08:00
|
|
|
|
cpckmodel.rkbh = ckdh.Text;
|
2024-05-23 16:55:29 +08:00
|
|
|
|
cpckmodel.riqi = Convert.ToDateTime(riqi.Value);
|
|
|
|
|
cpckmodel.scdh = scdh.Value;
|
2024-06-06 12:26:43 +08:00
|
|
|
|
//cpckmodel.khmc = khming.Value;
|
2024-05-23 16:55:29 +08:00
|
|
|
|
cpckmodel.cpbh = cpbh.Value;
|
|
|
|
|
cpckmodel.cpmc = cpmc.Value;
|
2024-06-06 12:26:43 +08:00
|
|
|
|
//cpckmodel.cpdj = Convert.ToDecimal(danjia.Value);
|
2024-05-23 16:55:29 +08:00
|
|
|
|
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;
|
2024-06-06 12:26:43 +08:00
|
|
|
|
//cpckmodel.lxr = lxr.Value;
|
2024-05-23 16:55:29 +08:00
|
|
|
|
cpckmodel.zje = Convert.ToDecimal(zongjine.Value);
|
2024-06-06 12:26:43 +08:00
|
|
|
|
//cpckmodel.lxdh = lxdh.Value;
|
2024-05-23 16:55:29 +08:00
|
|
|
|
cpckmodel.jsr = jingshouren.Value;
|
2024-06-06 12:26:43 +08:00
|
|
|
|
//cpckmodel.shr = shr.Value;
|
|
|
|
|
//cpckmodel.shdizhi = dizhi.Value;
|
2024-05-23 16:55:29 +08:00
|
|
|
|
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);
|
2024-06-06 12:26:43 +08:00
|
|
|
|
if (cprkbll.Update(cpckmodel))
|
2024-05-23 16:55:29 +08:00
|
|
|
|
{
|
|
|
|
|
rtx = Convert.ToInt32(id.Value);
|
|
|
|
|
caozuo = "修改";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2024-06-06 12:26:43 +08:00
|
|
|
|
cpckmodel.rkbh = DBHlper.getbh("CPRK-", "nr_z_cprk", "rkbh", 4);
|
2024-05-23 16:55:29 +08:00
|
|
|
|
// bh.Text = sgdmodel.sgdbianhao;
|
2024-06-06 12:26:43 +08:00
|
|
|
|
rtx = cprkbll.Add(cpckmodel);
|
2024-05-23 16:55:29 +08:00
|
|
|
|
}
|
|
|
|
|
if (rtx > 0)
|
|
|
|
|
{
|
|
|
|
|
//将session转换对象取值
|
|
|
|
|
Maticsoft.Model.nr_z_yhzh zh = (Maticsoft.Model.nr_z_yhzh)Session["user"];
|
|
|
|
|
rizhi.yonghuming = zh.zhanghao;
|
|
|
|
|
//拼接字符串插入日志
|
2024-06-06 12:26:43 +08:00
|
|
|
|
rizhi.jilu = zh.zhanghao + caozuo + "了成品入库,入库单号为:" + ckdh.Text.Trim();
|
|
|
|
|
rizhi.leixing = "成品入库";
|
2024-05-23 16:55:29 +08:00
|
|
|
|
rizhi.riqi = DateTime.Now;
|
|
|
|
|
rizhibll.Add(rizhi);
|
2024-06-01 11:14:26 +08:00
|
|
|
|
Response.Redirect("Productin_browse.aspx?uid=" + rtx, false);
|
2024-05-23 16:55:29 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Response.Redirect("../Common/error.aspx");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
Response.Redirect("../Common/error.aspx");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|