122 lines
5.0 KiB
C#
122 lines
5.0 KiB
C#
|
using BLL;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Data;
|
|||
|
using System.Data.SqlClient;
|
|||
|
using System.Linq;
|
|||
|
|
|||
|
namespace FineUIPro.Web.HSSE.CostGoods
|
|||
|
{
|
|||
|
public partial class GoodsManageView : PageBase
|
|||
|
{
|
|||
|
#region 定义项
|
|||
|
/// <summary>
|
|||
|
/// 主键
|
|||
|
/// </summary>
|
|||
|
private string GoodsManageId
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return (string)ViewState["GoodsManageId"];
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
ViewState["GoodsManageId"] = value;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 加载
|
|||
|
/// <summary>
|
|||
|
/// 加载页面
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void Page_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (!IsPostBack)
|
|||
|
{
|
|||
|
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
|||
|
this.GoodsManageId = Request.Params["GoodsManageId"];
|
|||
|
if (!string.IsNullOrEmpty(this.GoodsManageId))
|
|||
|
{
|
|||
|
var goodsManage = BLL.GoodsManageService.GetGoodsManageById(this.GoodsManageId);
|
|||
|
if (goodsManage != null)
|
|||
|
{
|
|||
|
this.txtApplyUnit.Text = UnitService.GetUnitNameByUnitId(goodsManage.ApplyUnitId);
|
|||
|
this.txtApplyTime.Text =string.Format("{0:yyyy-MM-dd HH:mm}", goodsManage.ApplyTime);
|
|||
|
if (goodsManage.BeBack == true)
|
|||
|
{
|
|||
|
this.txtBeBackName.Text = "货物是否返回 【是】。 返回时间:" + string.Format("{0:yyyy-MM-dd HH:mm}", goodsManage.BackTime);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
this.txtBeBackName.Text = "货物是否返回 【否】。 ";
|
|||
|
}
|
|||
|
|
|||
|
this.txtApplyMan.Text = UserService.GetUserNameByUserId(goodsManage.ApplyManId);
|
|||
|
var getoper = from x in Funs.DB.CostGoods_GoodsManageFlowOperate
|
|||
|
where x.GoodsManageId == this.GoodsManageId
|
|||
|
select x;
|
|||
|
if (getoper.Count() > 0)
|
|||
|
{
|
|||
|
var get1 = getoper.FirstOrDefault(x => x.SortIndex == 1);
|
|||
|
if (get1 != null)
|
|||
|
{
|
|||
|
this.txtOperater1.Text = UserService.GetUserNameByUserId(get1.OperaterId);
|
|||
|
}
|
|||
|
var get2 = getoper.FirstOrDefault(x => x.SortIndex == 2);
|
|||
|
if (get2 != null)
|
|||
|
{
|
|||
|
this.txtOperater2.Text = UserService.GetUserNameByUserId(get2.OperaterId);
|
|||
|
}
|
|||
|
var get3 = getoper.FirstOrDefault(x => x.SortIndex == 3);
|
|||
|
if (get3 != null)
|
|||
|
{
|
|||
|
this.txtOperater3.Text = UserService.GetUserNameByUserId(get3.OperaterId);
|
|||
|
}
|
|||
|
}
|
|||
|
// 绑定表格
|
|||
|
this.BindGrid();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 绑定数据
|
|||
|
/// </summary>
|
|||
|
private void BindGrid()
|
|||
|
{
|
|||
|
string strSql = @" SELECT GoodsManageItemId,Item.GoodsManageId,GoodsName,GoodsCounts,CountingUnit
|
|||
|
,C.OutReasons,C.CarNum
|
|||
|
FROM dbo.CostGoods_GoodsManageItem AS Item
|
|||
|
LEFT JOIN dbo.CostGoods_GoodsManage AS C ON Item.GoodsManageId=C.GoodsManageId WHERE 1=1 ";
|
|||
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|||
|
strSql += " AND Item.GoodsManageId = @GoodsManageId";
|
|||
|
listStr.Add(new SqlParameter("@GoodsManageId", this.GoodsManageId));
|
|||
|
SqlParameter[] parameter = listStr.ToArray();
|
|||
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|||
|
Grid1.RecordCount = tb.Rows.Count;
|
|||
|
var table = this.GetPagedDataTable(Grid1, tb);
|
|||
|
Grid1.DataSource = table;
|
|||
|
Grid1.DataBind();
|
|||
|
}
|
|||
|
|
|||
|
#region 附件上传
|
|||
|
/// <summary>
|
|||
|
/// 上传附件
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void btnAttachUrl_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (!string.IsNullOrEmpty(this.GoodsManageId))
|
|||
|
{
|
|||
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/GoodsManageAttachUrl&menuId={1}", GoodsManageId, BLL.Const.GoodsManageMenuId)));
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|