107 lines
5.0 KiB
C#
107 lines
5.0 KiB
C#
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 DispatchPrint : System.Web.UI.Page
|
||
{
|
||
//创建一个共用的订单bll层
|
||
Maticsoft.BLL.nr_z_dd ddbll = new Maticsoft.BLL.nr_z_dd();
|
||
//创建一个共用的订单模板
|
||
Maticsoft.Model.nr_z_dd dd = new Maticsoft.Model.nr_z_dd();
|
||
//创建一个共用的客户bll层
|
||
Maticsoft.BLL.nr_z_kehu kehubll = new Maticsoft.BLL.nr_z_kehu();
|
||
//创建一个操作记录模板
|
||
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();
|
||
public string userinfo = "";
|
||
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
if (!IsPostBack)
|
||
{
|
||
DataTable dtuserinfo = DBHlper.Execute("select mingcheng,logourl from nr_sysuserinfo").Tables[0];
|
||
if (dtuserinfo.Rows.Count > 0)
|
||
{
|
||
userinfo = dtuserinfo.Rows[0]["mingcheng"].ToString();
|
||
img_logo.Src = "../UseFile/" + dtuserinfo.Rows[0]["logourl"].ToString();
|
||
}
|
||
else
|
||
{
|
||
img_logo.Visible = false;
|
||
}
|
||
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(id.Value);
|
||
getsccpxm(Convert.ToInt32(id.Value));
|
||
}
|
||
}
|
||
|
||
#region 获取真正数据值
|
||
private void initdata(string did)
|
||
{
|
||
DataSet scdds = DBHlper.Execute("select * from view_nr_z_scd where id='" + did + "'");
|
||
if (scdds != null && scdds.Tables[0].Rows.Count > 0)
|
||
{
|
||
bh.Text = scdds.Tables[0].Rows[0]["bh"].ToString();
|
||
sclx.Text = scdds.Tables[0].Rows[0]["sclx"].ToString();
|
||
xdrq.Text = Convert.ToDateTime(scdds.Tables[0].Rows[0]["xdrq"]).ToString("yyyy-MM-dd");
|
||
wgrq.Text = Convert.ToDateTime(scdds.Tables[0].Rows[0]["wgrq"]).ToString("yyyy-MM-dd");
|
||
ywy.Text = scdds.Tables[0].Rows[0]["kdr"].ToString();
|
||
ddbz.Text = scdds.Tables[0].Rows[0]["bz"].ToString();
|
||
zt.Text = scdds.Tables[0].Rows[0]["zt"].ToString();
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 用来加载项目
|
||
private void getsccpxm(int scdid)
|
||
{
|
||
//修改页面时,首先吧项目明细的表头加载出来
|
||
string biao = "<table id='scdcptab' class='bule' > <tr id='0' class='tbtilt'>"
|
||
+ "<td><span>单据编号</span></td><td><span>客户编号</span></td><td><span>产品货号</td>"
|
||
+ "<td><span>产品名称</span></td><td><span>种类</span></td> <td><span>工艺要求</span></td><td><span>订单数量</span></td>"
|
||
+ "<td><span>提取库存数量</span></td><td><span>生产数量</span></td><td><span>交货日期</span></td>"
|
||
+ "<td><span>备注</span></td></tr>";
|
||
//查询数据视图,获取当前订单下的所有明细
|
||
DataSet ds = DBHlper.Execute("select * from nr_z_scd_cp where scdid='" + scdid + "' order by id ");
|
||
if (ds != null && ds.Tables[0].Rows.Count > 0)
|
||
{
|
||
//如果当前订单下存在明细就加载成tr行
|
||
foreach (DataRow r in ds.Tables[0].Rows)
|
||
{
|
||
//为保证唯一性,获取id拼接,保证稳定性
|
||
string hcount = r["id"].ToString();
|
||
DataSet tqds = DBHlper.Execute("select * from nr_z_scd_cp_tqkc where xmid='" + r["id"] + "'");
|
||
string tqxxst = "";
|
||
if (tqds != null && tqds.Tables[0].Rows.Count > 0)
|
||
{
|
||
tqxxst = tqds.Tables[0].Rows[0]["tptqsl"].ToString() + "," + tqds.Tables[0].Rows[0]["sptqsl"].ToString() + "," + tqds.Tables[0].Rows[0]["bdtqsl"].ToString();
|
||
}
|
||
biao += "<tr id='" + hcount + "' name='" + hcount + "'>"
|
||
+ "<td><span>" + r["djbh"].ToString() + "</span></td><td><span>" + r["khbh"].ToString() + "</span></td>"
|
||
+ "<td><span>" + r["cphh"].ToString() + "</span></td>"
|
||
+ "<td><span>" + r["cpmc"] + "</span></td><td><span>" + r["zl"].ToString() + "</span></td>"
|
||
+ "<td><span>" + r["scfs"].ToString() + "</span> </td><td><span>" + r["ddsl"].ToString() + "</span></td>"
|
||
+ "<td><span>" + tqxxst + "</span></td> "
|
||
+ "<td><span>" + r["scsl"].ToString() + "</span></td> "
|
||
+ "<td><span>" + Convert.ToDateTime(r["jhrq"]).ToString("yyyy-MM-dd") + "</span></td> "
|
||
+ "<td><span>" + r["bz"].ToString() + "</span></td></tr>";
|
||
}
|
||
}
|
||
|
||
cpxx.InnerHtml = biao + "</table>";
|
||
}
|
||
#endregion
|
||
} |