2024-05-18 15:28: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 ;
using System.IO ;
using Maticsoft.Model ;
using Ajax ;
public partial class Sample_browse : System . Web . UI . Page
{
//创建一个操作记录bll
2024-05-23 14:54:07 +08:00
Maticsoft . BLL . nr_sys_rizhi rizhibll = new Maticsoft . BLL . nr_sys_rizhi ( ) ;
2024-05-18 15:28:29 +08:00
//创建一个共同的申购单bll
2024-05-23 14:54:07 +08:00
Maticsoft . BLL . nr_z_ypdj ypdjbll = new Maticsoft . BLL . nr_z_ypdj ( ) ;
2024-05-18 15:28:29 +08:00
//创建一个操作记录模板
Maticsoft . Model . nr_sys_rizhi rizhi = new Maticsoft . Model . nr_sys_rizhi ( ) ;
//创建一个共用的编码bll层
Maticsoft . BLL . nr_sys_bianma bm = new Maticsoft . BLL . nr_sys_bianma ( ) ;
//创建一个共用的类型BLL层
Maticsoft . BLL . nr_sys_leixing bmlx = new Maticsoft . BLL . nr_sys_leixing ( ) ;
protected void Page_Load ( object sender , EventArgs e )
{
Utility . RegisterTypeForAjax ( typeof ( Sample_browse ) ) ;
if ( ! IsPostBack )
{
if ( Session [ "user" ] = = null )
{
Response . Redirect ( "../index.aspx" ) ;
}
//获取角色权限
2024-05-23 14:54:07 +08:00
Maticsoft . Model . nr_z_yhzh user = ( Maticsoft . Model . nr_z_yhzh ) ( Session [ "user" ] ) ;
2024-05-18 15:28:29 +08:00
if ( Request . QueryString [ "uid" ] ! = null & & Request . QueryString [ "uid" ] . ToString ( ) . Length > 0 )
{
string uid = Request . QueryString [ "uid" ] . ToString ( ) ;
id . Value = uid ;
initdata ( Convert . ToInt32 ( uid ) ) ;
2024-05-23 14:54:07 +08:00
pdquanxian ( user . juese ) ;
}
getqdgj ( ) ;
getxmxx ( ) ;
getxgfyxx ( ) ;
getscyl ( ) ;
getcpxmxx ( ) ;
2024-05-18 15:28:29 +08:00
}
}
#region 修 改 时 获 取 真 正 数 据 值
private void initdata ( int did )
{
DataTable dt = DBHlper . Execute ( "select * from nr_z_ypdj where id=" + did ) . Tables [ 0 ] ;
if ( dt . Rows . Count > 0 )
{
kfh . Text = dt . Rows [ 0 ] [ "kfh" ] . ToString ( ) ;
huohao . Text = dt . Rows [ 0 ] [ "huohao" ] . ToString ( ) ;
xlh . Text = dt . Rows [ 0 ] [ "xiliehao" ] . ToString ( ) ;
cpmc . Text = dt . Rows [ 0 ] [ "cpmc" ] . ToString ( ) ;
zdysj . Text = Convert . ToDateTime ( dt . Rows [ 0 ] [ "zdysj" ] ) . ToString ( "yyyy-MM-dd" ) ;
xgsj . Text = Convert . ToDateTime ( dt . Rows [ 0 ] [ "xgsj" ] ) . ToString ( "yyyy-MM-dd" ) ;
ypcc . Text = dt . Rows [ 0 ] [ "ypcc" ] . ToString ( ) ;
zhongliang . Text = Convert . ToDouble ( dt . Rows [ 0 ] [ "zhongl" ] ) . ToString ( ) ;
rongliang . Text = Convert . ToDouble ( dt . Rows [ 0 ] [ "rongl" ] ) . ToString ( ) ;
banci . Text = dt . Rows [ 0 ] [ "banci" ] . ToString ( ) ;
zhuangtai . Text = dt . Rows [ 0 ] [ "zt" ] . ToString ( ) ;
qdqz . Text = dt . Rows [ 0 ] [ "qdqz" ] . ToString ( ) ;
zdqz . Text = dt . Rows [ 0 ] [ "zdqz" ] . ToString ( ) ;
hdqz . Text = dt . Rows [ 0 ] [ "hdqz" ] . ToString ( ) ;
shr . Text = dt . Rows [ 0 ] [ "shr" ] . ToString ( ) ;
tp . Src = "../Client_Folder/" + dt . Rows [ 0 ] [ "tupian" ] . ToString ( ) + "" ;
}
}
#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" ) ;
}
2024-05-21 15:05:24 +08:00
if ( DBHlper . GetPermission ( juese , "样品登记" , "nr_z_ypdj" , "查看全部" ) = = false )
2024-05-18 15:28:29 +08:00
{
Response . Redirect ( "../Common/nopower.htm" ) ;
}
2024-05-23 14:54:07 +08:00
2024-05-21 15:05:24 +08:00
if ( DBHlper . GetPermission ( juese , "样品登记" , "nr_z_ypdj" , "编辑全部" ) )
2024-05-18 15:28:29 +08:00
{
bt_bj . Visible = true ;
2024-05-23 14:54:07 +08:00
}
2024-05-21 15:05:24 +08:00
if ( DBHlper . GetPermission ( juese , "样品登记" , "nr_z_ypdj" , "删除全部" ) )
2024-05-18 15:28:29 +08:00
{
2024-05-23 14:54:07 +08:00
shanchu . Visible = true ;
2024-05-18 15:28:29 +08:00
}
2024-05-21 15:05:24 +08:00
if ( DBHlper . GetPermission ( juese , "样品登记" , "nr_z_ypdj" , "前段签字" ) )
2024-05-18 15:28:29 +08:00
{
bt_qdsh . Visible = true ;
}
2024-05-21 15:05:24 +08:00
if ( DBHlper . GetPermission ( juese , "样品登记" , "nr_z_ypdj" , "添加" ) )
2024-05-18 15:28:29 +08:00
{
bt_add . Visible = true ;
}
2024-05-21 15:05:24 +08:00
if ( DBHlper . GetPermission ( juese , "样品登记" , "nr_z_ypdj" , "中段签字" ) )
2024-05-18 15:28:29 +08:00
{
bt_zdsh . Visible = true ;
}
2024-05-21 15:05:24 +08:00
if ( DBHlper . GetPermission ( juese , "样品登记" , "nr_z_ypdj" , "后段签字" ) )
2024-05-18 15:28:29 +08:00
{
bt_hdsh . Visible = true ;
2024-05-23 14:54:07 +08:00
}
if ( DBHlper . GetPermission ( juese , "样品登记" , "nr_z_ypdj" , "生成产品" ) )
2024-05-18 15:28:29 +08:00
{
2024-05-23 14:54:07 +08:00
bt_sccpda . Visible = true ;
2024-05-18 15:28:29 +08:00
}
2024-05-21 15:05:24 +08:00
if ( DBHlper . GetPermission ( juese , "样品登记" , "nr_z_ypdj" , "打印" ) )
2024-05-18 15:28:29 +08:00
{
dayin . Visible = true ;
}
2024-05-21 15:05:24 +08:00
if ( DBHlper . GetPermission ( juese , "样品登记" , "nr_z_ypdj" , "审核" ) )
2024-05-18 15:28:29 +08:00
{
bt_shtg . Visible = true ;
bt_shbg . Visible = true ;
}
2024-05-23 14:54:07 +08:00
if ( zhuangtai . Text = = "通过" )
2024-05-18 15:28:29 +08:00
{
bt_shtg . Enabled = false ;
2024-05-23 14:54:07 +08:00
bt_shtg . BackColor = System . Drawing . Color . Gray ;
2024-05-18 15:28:29 +08:00
bt_bj . Enabled = false ;
2024-05-23 14:54:07 +08:00
bt_bj . BackColor = System . Drawing . Color . Gray ;
2024-05-18 15:28:29 +08:00
shanchu . Enabled = false ;
shanchu . BackColor = System . Drawing . Color . Gray ;
2024-05-23 14:54:07 +08:00
}
2024-05-18 15:28:29 +08:00
if ( zhuangtai . Text = = "不过" )
{
bt_shbg . Enabled = false ;
bt_shbg . BackColor = System . Drawing . Color . Gray ;
2024-05-23 14:54:07 +08:00
2024-05-18 15:28:29 +08:00
}
2024-05-23 14:54:07 +08:00
if ( zhuangtai . Text ! = "通过" )
2024-05-18 15:28:29 +08:00
{
2024-05-23 14:54:07 +08:00
bt_sccpda . Enabled = false ;
2024-05-18 15:28:29 +08:00
bt_sccpda . BackColor = System . Drawing . Color . Gray ;
}
2024-05-23 14:54:07 +08:00
2024-05-18 15:28:29 +08:00
}
#endregion
2024-05-23 14:54:07 +08:00
2024-05-18 15:28:29 +08:00
#region 加 载 工 价 信 息
private void getqdgj ( )
{
//加载前段工价
2024-05-23 14:54:07 +08:00
string qdgjstring = "<table id='qdgjtb' class='bule'>" ;
string getgjsql = "select * from nr_z_ypdj_gj where ypdid='" + id . Value + "' and jieduan='前段工价'" ;
DataSet ds = DBHlper . Execute ( getgjsql ) ;
//判断拼接列值,根据值更改前台样式
2024-05-18 15:28:29 +08:00
int lies = 0 ;
2024-05-23 14:54:07 +08:00
if ( ds ! = null & & ds . Tables [ 0 ] . Rows . Count > 0 )
{
foreach ( DataRow r in ds . Tables [ 0 ] . Rows )
{
if ( lies = = 0 )
{
qdgjstring + = "<tr>" ;
}
qdgjstring + = "<td ><span>" + r [ "gjmc" ] . ToString ( ) + ": </span> <span>" + Convert . ToDouble ( r [ "gjjg" ] ) . ToString ( ) + " </span></td>" ;
lies = lies + 1 ;
if ( lies = = 7 )
{
lies = 0 ;
qdgjstring + = "</tr>" ;
}
}
if ( 7 - lies > 0 & & lies > 0 )
{
for ( int x = 0 ; x < 7 - lies ; x + + )
{
qdgjstring + = "<td ></td> " ;
}
qdgjstring + = "</tr>" ;
}
}
qdgjxx . InnerHtml = qdgjstring + "</table>" ;
//中段工价
2024-05-18 15:28:29 +08:00
qdgjstring = "<table id='zdgjtb' class='bule'>" ;
getgjsql = "select * from nr_z_ypdj_gj where ypdid='" + id . Value + "' and jieduan='中段工价'" ;
ds = DBHlper . Execute ( getgjsql ) ;
2024-05-23 14:54:07 +08:00
//判断拼接列值,根据值更改前台样式
lies = 0 ;
if ( ds ! = null & & ds . Tables [ 0 ] . Rows . Count > 0 )
{
foreach ( DataRow r in ds . Tables [ 0 ] . Rows )
{
if ( lies = = 0 )
{
qdgjstring + = "<tr>" ;
}
qdgjstring + = "<td ><span>" + r [ "gjmc" ] . ToString ( ) + ": </span> <span>" + Convert . ToDouble ( r [ "gjjg" ] ) . ToString ( ) + "</span></td>" ;
lies = lies + 1 ;
if ( lies = = 7 )
{
lies = 0 ;
qdgjstring + = "</tr>" ;
}
}
if ( 7 - lies > 0 & & lies > 0 )
{
for ( int x = 0 ; x < 7 - lies ; x + + )
{
qdgjstring + = "<td ></td> " ;
}
qdgjstring + = "</tr>" ;
}
}
zdgjxx . InnerHtml = qdgjstring + "</table>" ;
//后段工价
qdgjstring = "<table id='hdgjtb' class='bule'>" ;
getgjsql = "select * from nr_z_ypdj_gj where ypdid='" + id . Value + "' and jieduan='后段工价'" ;
ds = DBHlper . Execute ( getgjsql ) ;
//判断拼接列值,根据值更改前台样式
lies = 0 ;
if ( ds ! = null & & ds . Tables [ 0 ] . Rows . Count > 0 )
{
foreach ( DataRow r in ds . Tables [ 0 ] . Rows )
{
if ( lies = = 0 )
{
qdgjstring + = "<tr>" ;
}
qdgjstring + = "<td ><span>" + r [ "gjmc" ] . ToString ( ) + ": </span> <span>" + Convert . ToDouble ( r [ "gjjg" ] ) . ToString ( ) + "</span></td>" ;
lies = lies + 1 ;
if ( lies = = 7 )
{
lies = 0 ;
qdgjstring + = "</tr>" ;
}
}
if ( 7 - lies > 0 & & lies > 0 )
{
for ( int x = 0 ; x < 7 - lies ; x + + )
{
qdgjstring + = "<td ></td> " ;
}
qdgjstring + = "</tr>" ;
}
}
hdgjxx . InnerHtml = qdgjstring + "</table>" ;
2024-05-18 15:28:29 +08:00
}
#endregion
#region 加 载 项 目 信 息
private void getxmxx ( )
{
//加载前段项目
string qdgjstring = "<table id='qdxmtb' class='bule'> <tr class='tbtilt'><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><td><span>用量</span></td></tr>" ;
string getgjsql = "select * from view_nr_z_ypdj_xmxx where ypdid='" + id . Value + "' and jieduan='前段项目'" ;
DataSet ds = DBHlper . Execute ( getgjsql ) ;
//判断拼接列值,根据值更改前台样式
int lies = 0 ;
if ( ds ! = null & & ds . Tables [ 0 ] . Rows . Count > 0 )
{
foreach ( DataRow r in ds . Tables [ 0 ] . Rows )
{
if ( lies = = 0 )
{
qdgjstring + = "<tr>" ;
}
qdgjstring + = "<td><span>" + r [ "xmmc" ] . ToString ( ) + "</span></td> <td><span>" + r [ "wlmc" ] . ToString ( ) + "</span></td><td><span>" + Convert . ToDouble ( r [ "wlyl" ] ) . ToString ( ) + "</span></td>" ;
lies = lies + 1 ;
2024-05-23 14:54:07 +08:00
if ( lies = = 3 )
2024-05-18 15:28:29 +08:00
{
lies = 0 ;
qdgjstring + = "</tr>" ;
}
}
if ( 3 - lies > 0 & & lies > 0 )
{
for ( int x = 0 ; x < 3 - lies ; x + + )
{
qdgjstring + = "<td ></td><td ></td><td ></td>" ;
}
qdgjstring + = "</tr>" ;
}
}
qdxmxx . InnerHtml = qdgjstring + "</table>" ;
//加载中段项目
qdgjstring = "<table id='zdxmtb' class='bule'> <tr class='tbtilt'><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><td ><span>用量</span></td></tr>" ;
getgjsql = "select * from view_nr_z_ypdj_xmxx where ypdid='" + id . Value + "' and jieduan='中段项目'" ;
ds = DBHlper . Execute ( getgjsql ) ;
//判断拼接列值,根据值更改前台样式
lies = 0 ;
if ( ds ! = null & & ds . Tables [ 0 ] . Rows . Count > 0 )
{
foreach ( DataRow r in ds . Tables [ 0 ] . Rows )
{
if ( lies = = 0 )
{
qdgjstring + = "<tr>" ;
}
qdgjstring + = "<td ><span>" + r [ "xmmc" ] . ToString ( ) + "</span></td> <td ><span>" + r [ "wlmc" ] . ToString ( ) + "</span></td><td ><span> " + Convert . ToDouble ( r [ "wlyl" ] ) . ToString ( ) + "</span></td>" ;
lies = lies + 1 ;
if ( lies = = 3 )
{
lies = 0 ;
qdgjstring + = "</tr>" ;
}
}
if ( 3 - lies > 0 & & lies > 0 )
{
2024-05-23 14:54:07 +08:00
for ( int x = 0 ; x < 3 - lies ; x + + )
2024-05-18 15:28:29 +08:00
{
qdgjstring + = "<td class='head3'></td><td class='content'></td><td class='content'></td>" ;
}
qdgjstring + = "</tr>" ;
}
}
zdxmxx . InnerHtml = qdgjstring + "</table>" ;
//加载后段项目
qdgjstring = "<table id='hdxmtb' class='bule'> <tr class='tbtilt'><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><td><span>用量</span></td></tr>" ;
getgjsql = "select * from view_nr_z_ypdj_xmxx where ypdid='" + id . Value + "' and jieduan='后段项目'" ;
ds = DBHlper . Execute ( getgjsql ) ;
//判断拼接列值,根据值更改前台样式
lies = 0 ;
if ( ds ! = null & & ds . Tables [ 0 ] . Rows . Count > 0 )
{
foreach ( DataRow r in ds . Tables [ 0 ] . Rows )
{
if ( lies = = 0 )
{
qdgjstring + = "<tr>" ;
}
qdgjstring + = "<td ><span>" + r [ "xmmc" ] . ToString ( ) + "</span></td> <td ><span>" + r [ "wlmc" ] . ToString ( ) + "</span></td><td><span> " + Convert . ToDouble ( r [ "wlyl" ] ) . ToString ( ) + "</span></td>" ;
lies = lies + 1 ;
if ( lies = = 3 )
{
lies = 0 ;
qdgjstring + = "</tr>" ;
}
}
if ( 3 - lies > 0 & & lies > 0 )
{
for ( int x = 0 ; x < 3 - lies ; x + + )
{
qdgjstring + = "<td ></td><td ></td><td ></td>" ;
}
qdgjstring + = "</tr>" ;
}
}
hdxmxx . InnerHtml = qdgjstring + "</table>" ;
}
#endregion
#region 加 载 相 关 费 用 信 息
private void getxgfyxx ( )
{
//加载前段工价
string qdgjstring = "<table id='ypxgfytd' class='bule'>" ;
2024-05-23 14:54:07 +08:00
string getgjsql = "select * from nr_z_ypdj_xgfy where ypdid='" + id . Value + "'" ;
2024-05-18 15:28:29 +08:00
DataSet ds = DBHlper . Execute ( getgjsql ) ;
//判断拼接列值,根据值更改前台样式
int lies = 0 ;
if ( ds ! = null & & ds . Tables [ 0 ] . Rows . Count > 0 )
{
foreach ( DataRow r in ds . Tables [ 0 ] . Rows )
{
if ( lies = = 0 )
{
qdgjstring + = "<tr>" ;
}
qdgjstring + = "<td ><span>" + r [ "fymc" ] . ToString ( ) + ": </span><span> " + Convert . ToDouble ( r [ "fyje" ] ) . ToString ( ) + "</span></td>" ;
lies = lies + 1 ;
if ( lies = = 7 )
{
lies = 0 ;
qdgjstring + = "</tr>" ;
}
}
if ( 7 - lies > 0 & & lies > 0 )
{
for ( int x = 0 ; x < 7 - lies ; x + + )
{
qdgjstring + = "<td ></td> " ;
}
qdgjstring + = "</tr>" ;
2024-05-23 14:54:07 +08:00
}
2024-05-18 15:28:29 +08:00
}
xgfydiv . InnerHtml = qdgjstring + "</table>" ;
}
2024-05-23 14:54:07 +08:00
#endregion
2024-05-18 15:28:29 +08:00
#region 加 载 水 彩 信 息
private void getscyl ( )
{
//加载前段工价
string getgjsql = "select * from view_nr_z_ypdj_scyl where ypdid='" + id . Value + "'" ;
string cltable = "<table id='scylxxtb' class='bule'>" +
"<tr id='0' class='tbtilt'> <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><td><span>备注</span></td></tr>" ;
DataSet ds = DBHlper . Execute ( getgjsql ) ;
if ( ds ! = null & & ds . Tables [ 0 ] . Rows . Count > 0 )
{
int sjint = 0 ;
int hcount = 1 ;
2024-05-23 14:54:07 +08:00
foreach ( DataRow r in ds . Tables [ 0 ] . Rows )
2024-05-18 15:28:29 +08:00
{
if ( sjint = = 0 )
{
cltable + = "<tr>" ;
}
sjint = sjint + 1 ;
cltable + = " <td ><span>" + r [ "wlmc" ] . ToString ( ) + "</span></td><td><span>" + Convert . ToDouble ( r [ "scyl" ] ) . ToString ( ) + "</span></td><td><span>" + r [ "beizhu" ] . ToString ( ) + "</span></td>" ;
if ( sjint = = 3 )
{
cltable + = "</tr>" ;
}
hcount = hcount + 1 ;
2024-05-23 14:54:07 +08:00
}
if ( 3 - sjint > 0 )
2024-05-18 15:28:29 +08:00
{
2024-05-23 14:54:07 +08:00
for ( int hz = 0 ; hz < 3 - sjint ; hz + + )
2024-05-18 15:28:29 +08:00
{
cltable + = " <td > </td><td > </td><td > </td>" ;
}
cltable + = "</tr>" ;
}
2024-05-23 14:54:07 +08:00
2024-05-18 15:28:29 +08:00
}
cltable + = "</table>" ;
scylxxdiv . InnerHtml = cltable ;
2024-05-23 14:54:07 +08:00
2024-05-18 15:28:29 +08:00
}
#endregion
#region 获 取 页 面 参 数 赋 值 model对象
private void getmd ( )
{
//给日志模板赋值
rizhi . riqi = DateTime . Now ;
rizhi . leixing = "样品登记" ;
}
#endregion
#region 加 载 设 置 跟 随 项 目
public void getcpxmxx ( )
{
string code = "" ;
DataTable dt = DBHlper . Execute ( "select * from view_bianma where zhonglei='前段项目'" ) . Tables [ 0 ] ;
DataTable xmdjds = DBHlper . Execute ( "select * from nr_z_ypdj_cpxgxm" ) . Tables [ 0 ] ; ;
foreach ( DataRow dr in dt . Rows )
{
DataRow [ ] xmtr = xmdjds . Select ( "xmmc='" + dr [ "mingcheng" ] + "'" ) ;
if ( xmtr ! = null & & xmtr . Length > 0 )
{
code + = "<li><input type='checkbox' class='cbo_gx' checked tag=" + dr [ "mingcheng" ] + ">" + dr [ "mingcheng" ] + "</li>" ;
}
else
{
code + = "<li><input type='checkbox' class='cbo_gx' tag=" + dr [ "mingcheng" ] + ">" + dr [ "mingcheng" ] + "</li>" ;
}
}
ul_gx . InnerHtml = code ;
code = "" ;
dt = DBHlper . Execute ( "select * from view_bianma where zhonglei='中段项目'" ) . Tables [ 0 ] ;
foreach ( DataRow dr in dt . Rows )
{
DataRow [ ] xmtr = xmdjds . Select ( "xmmc='" + dr [ "mingcheng" ] + "'" ) ;
if ( xmtr ! = null & & xmtr . Length > 0 )
{
code + = "<li><input type='checkbox' class='cbo_gxzd' checked tag=" + dr [ "mingcheng" ] + ">" + dr [ "mingcheng" ] + "</li>" ;
}
else
{
code + = "<li><input type='checkbox' class='cbo_gxzd' tag=" + dr [ "mingcheng" ] + ">" + dr [ "mingcheng" ] + "</li>" ;
}
}
ul_gxzd . InnerHtml = code ;
code = "" ;
dt = DBHlper . Execute ( "select * from view_bianma where zhonglei='后段项目'" ) . Tables [ 0 ] ;
foreach ( DataRow dr in dt . Rows )
{
DataRow [ ] xmtr = xmdjds . Select ( "xmmc='" + dr [ "mingcheng" ] + "'" ) ;
if ( xmtr ! = null & & xmtr . Length > 0 )
{
code + = "<li><input type='checkbox' class='cbo_gxhd' checked tag=" + dr [ "mingcheng" ] + ">" + dr [ "mingcheng" ] + "</li>" ;
}
else
{
code + = "<li><input type='checkbox' class='cbo_gxhd' tag=" + dr [ "mingcheng" ] + ">" + dr [ "mingcheng" ] + "</li>" ;
}
}
ul_gxhd . InnerHtml = code ;
}
#endregion
//保存项目
[Ajax.AjaxMethod]
public int savegx ( string [ ] gx , string djid , string xmjd )
{
int fhz = 0 ;
2024-05-23 14:54:07 +08:00
DBHlper . excutecmd ( "delete from nr_z_ypdj_cpxgxm where xmjd='" + xmjd + "'" ) ;
2024-05-18 15:28:29 +08:00
foreach ( string i in gx )
{
2024-05-23 14:54:07 +08:00
fhz = DBHlper . excutecmd ( "insert into nr_z_ypdj_cpxgxm(kfid,xmmc,xmjd) values(" + djid + ",'" + i + "','" + xmjd + "')" ) ;
2024-05-18 15:28:29 +08:00
}
return fhz ;
}
protected void wj_Click ( object sender , EventArgs e )
{
DataSet ds = DBHlper . Execute ( "select wenjian from nr_z_ypdj where id='" + id . Value + "'" ) ;
string filenams = ds . Tables [ 0 ] . Rows [ 0 ] [ "wenjian" ] . ToString ( ) ;
if ( filenams ! = "" & & filenams ! = null )
{
string f5 = filenams ;
string fileName = f5 ; //客户端保存的文件名
string filePath = Server . MapPath ( "~/Client_Folder/" + f5 ) ; //路径
FileStream fs = new FileStream ( filePath , FileMode . Open ) ;
byte [ ] bytes = new byte [ ( int ) fs . Length ] ;
fs . Read ( bytes , 0 , bytes . Length ) ;
fs . Close ( ) ;
Response . ContentType = "application/octet-stream" ;
//通知浏览器下载文件而不是打开
Response . AddHeader ( "Content-Disposition" , "attachment; filename=" + HttpUtility . UrlEncode ( fileName , System . Text . Encoding . UTF8 ) ) ;
Response . BinaryWrite ( bytes ) ;
Response . Flush ( ) ;
Response . End ( ) ;
}
else
{
Response . Write ( "<script Language='javascript'>alert('没有文件!');window.location.href='Sample_browse.aspx?uid=" + id . Value + "'</script>" ) ;
return ;
}
}
protected void bt_bj_Click ( object sender , EventArgs e )
{
Response . Redirect ( "Sample_Form.aspx?uid=" + id . Value ) ;
}
protected void Shanchu_Click ( object sender , EventArgs e )
{
getmd ( ) ;
if ( ypdjbll . Delete ( Convert . ToInt32 ( id . Value ) ) )
{
2024-05-23 14:54:07 +08:00
DBHlper . excutecmd ( " delete nr_z_ypdj_gj where ypdid='" + id . Value + "'" ) ;
2024-05-18 15:28:29 +08:00
DBHlper . excutecmd ( " delete nr_z_ypdj_scyl where ypdid='" + id . Value + "'" ) ;
DBHlper . excutecmd ( " delete nr_z_ypdj_xgfy where ypdid='" + id . Value + "'" ) ;
DBHlper . excutecmd ( " delete nr_z_ypdj_xmxx where ypdid='" + id . Value + "'" ) ;
//将session转换对象取值
Maticsoft . Model . nr_z_yhzh zh = ( Maticsoft . Model . nr_z_yhzh ) Session [ "user" ] ;
//拼接字符串插入日志
rizhi . jilu = zh . zhanghao + "删除了样品登记,开发号为:" + kfh . Text . Trim ( ) ;
rizhi . yonghuming = zh . zhanghao ;
rizhibll . Add ( rizhi ) ;
Response . Redirect ( "Sample_list.aspx" , false ) ;
}
}
protected void bt_qdsh_Click ( object sender , EventArgs e )
{
getmd ( ) ;
Maticsoft . Model . nr_z_yhzh zh = ( Maticsoft . Model . nr_z_yhzh ) Session [ "user" ] ;
2024-05-23 14:54:07 +08:00
string sqldj = "update nr_z_ypdj set qdqz='" + zh . zhanghao + "' where id='" + id . Value + "'" ;
2024-05-18 15:28:29 +08:00
int fzhi = DBHlper . excutecmd ( sqldj ) ;
2024-05-23 14:54:07 +08:00
if ( fzhi > 0 )
2024-05-18 15:28:29 +08:00
{
2024-05-23 14:54:07 +08:00
rizhi . jilu = zh . zhanghao + "进行了前段签字,开发号为:" + kfh . Text . Trim ( ) ;
rizhi . yonghuming = zh . zhanghao ;
rizhibll . Add ( rizhi ) ;
Response . Redirect ( "Sample_browse.aspx?uid=" + id . Value ) ;
2024-05-18 15:28:29 +08:00
}
}
protected void bt_zdsh_Click ( object sender , EventArgs e )
{
getmd ( ) ;
Maticsoft . Model . nr_z_yhzh zh = ( Maticsoft . Model . nr_z_yhzh ) Session [ "user" ] ;
string sqldj = "update nr_z_ypdj set zdqz='" + zh . zhanghao + "' where id='" + id . Value + "'" ;
int fzhi = DBHlper . excutecmd ( sqldj ) ;
if ( fzhi > 0 )
{
rizhi . jilu = zh . zhanghao + "进行了中段签字,开发号为:" + kfh . Text . Trim ( ) ;
rizhi . yonghuming = zh . zhanghao ;
rizhibll . Add ( rizhi ) ;
Response . Redirect ( "Sample_browse.aspx?uid=" + id . Value ) ;
}
}
protected void bt_hdsh_Click ( object sender , EventArgs e )
{
getmd ( ) ;
Maticsoft . Model . nr_z_yhzh zh = ( Maticsoft . Model . nr_z_yhzh ) Session [ "user" ] ;
string sqldj = "update nr_z_ypdj set hdqz='" + zh . zhanghao + "' where id='" + id . Value + "'" ;
int fzhi = DBHlper . excutecmd ( sqldj ) ;
if ( fzhi > 0 )
{
rizhi . jilu = zh . zhanghao + "进行了后段签字,开发号为:" + kfh . Text . Trim ( ) ;
rizhi . yonghuming = zh . zhanghao ;
rizhibll . Add ( rizhi ) ;
Response . Redirect ( "Sample_browse.aspx?uid=" + id . Value ) ;
}
}
protected void bt_shtg_Click ( object sender , EventArgs e )
{
getmd ( ) ;
Maticsoft . Model . nr_z_yhzh zh = ( Maticsoft . Model . nr_z_yhzh ) Session [ "user" ] ;
string sqldj = "update nr_z_ypdj set shr='" + zh . zhanghao + "',zt='通过' where id='" + id . Value + "'" ;
int fzhi = DBHlper . excutecmd ( sqldj ) ;
if ( fzhi > 0 )
{
rizhi . jilu = zh . zhanghao + "进行了审核通过,开发号为:" + kfh . Text . Trim ( ) ;
rizhi . yonghuming = zh . zhanghao ;
rizhibll . Add ( rizhi ) ;
Response . Redirect ( "Sample_browse.aspx?uid=" + id . Value ) ;
}
}
protected void bt_shbg_Click ( object sender , EventArgs e )
{
getmd ( ) ;
Maticsoft . Model . nr_z_yhzh zh = ( Maticsoft . Model . nr_z_yhzh ) Session [ "user" ] ;
string sqldj = "update nr_z_ypdj set shr='" + zh . zhanghao + "',zt='不过' where id='" + id . Value + "'" ;
int fzhi = DBHlper . excutecmd ( sqldj ) ;
if ( fzhi > 0 )
{
rizhi . jilu = zh . zhanghao + "进行了审核不过,开发号为:" + kfh . Text . Trim ( ) ;
rizhi . yonghuming = zh . zhanghao ;
rizhibll . Add ( rizhi ) ;
Response . Redirect ( "Sample_browse.aspx?uid=" + id . Value ) ;
}
2024-05-23 14:54:07 +08:00
}
2024-05-18 15:28:29 +08:00
protected void bt_sccpda_Click ( object sender , EventArgs e )
{
Maticsoft . Model . nr_z_yhzh user = ( Maticsoft . Model . nr_z_yhzh ) ( Session [ "user" ] ) ;
2024-05-23 14:54:07 +08:00
string cpbh = DBHlper . getbh ( "CP-" , "nr_z_cpkc" , "cpbh" , 4 ) ;
string ypdcpjsql = "insert into nr_z_cpkc(cpbh,cpmc,riqi,gg,zhongliang,tiji,dj,jsr,tp)select '" + cpbh + "',cpmc,'" + DateTime . Now . ToString ( "yyyy-MM-dd" ) + "',ypcc,zhongl,rongl,'0','" + user . zhanghao + "',tupian from nr_z_ypdj where id='" + id . Value + "';SELECT id from nr_z_cpkc WHERE (id = @@IDENTITY)" ;
int getcpz = DBHlper . ExecuteReid ( ypdcpjsql ) ;
if ( getcpz > 0 )
{
string getxmsql = "select * from nr_z_ypdj_cpxgxm " ;
DataSet ds = DBHlper . Execute ( getxmsql ) ;
if ( ds ! = null & & ds . Tables [ 0 ] . Rows . Count > 0 )
{
foreach ( DataRow r in ds . Tables [ 0 ] . Rows )
{
int xmz = DBHlper . excutecmd ( "insert into nr_z_cpkc_wlxq(cpid,xmmc,wlbh,xqyl) select '" + getcpz + "',xmmc,wlbh,wlyl from nr_z_ypdj_xmxx where xmmc='" + r [ "xmmc" ] + "' and ypdid='" + id . Value + "'" ) ;
}
}
int scfhz = DBHlper . excutecmd ( "insert into nr_z_cpkc_scyl(cpid,scwlbh,scyl,beizhu) select '" + getcpz + "',scwlbh,scyl,beizhu from nr_z_ypdj_scyl where ypdid='" + id . Value + "'" ) ;
int scmjz = DBHlper . excutecmd ( "insert into nr_z_mjda (mjdm,mjmc,riqi,beizhu) select '" + DBHlper . getbh ( "MJ-" , "nr_z_mjda" , "mjdm" , 4 ) + "',cpmc,'" + DateTime . Now . ToString ( "yyyy-MM-dd" ) + "','' from nr_z_ypdj where id='" + id . Value + "'" ) ;
int ypgjz = DBHlper . excutecmd ( "insert into dbo.nr_z_cpkc_gj(cpid,gjmc,gjjg) select '" + getcpz + "',gjmc,gjjg from nr_z_ypdj_gj where ypdid='" + id . Value + "'" ) ;
Response . Redirect ( "Product_browse.aspx?uid=" + getcpz ) ;
}
2024-05-18 15:28:29 +08:00
}
}