89 lines
3.6 KiB
C#
89 lines
3.6 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Data.SqlClient;
|
|||
|
using System.Data;
|
|||
|
using BLL;
|
|||
|
|
|||
|
namespace FineUIPro.Web.WeldMat.MatBake
|
|||
|
{
|
|||
|
public partial class ShowStock : PageBase
|
|||
|
{
|
|||
|
protected void Page_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (!IsPostBack)
|
|||
|
{
|
|||
|
BindGrid();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#region 绑定数据
|
|||
|
/// <summary>
|
|||
|
/// 绑定数据
|
|||
|
/// </summary>
|
|||
|
private void BindGrid()
|
|||
|
{
|
|||
|
string strSql = @"SELECT (recycleMat.RecycleMatId) AS StockInId, recycleMat.WeldId,recycleMat.Warrantybook,
|
|||
|
WeldInfo.WeldCode,WeldInfo.WeldName,WeldInfo.WeldSpec,WeldInfo.WeldTypeId,
|
|||
|
WeldType.WeldTypeName,WeldType.WeldUnit,recycleMat.Number,
|
|||
|
(recycleMat.RecycleAmount-ISNULL(recycleMat.UsingAmount,0)) AS StockAmount
|
|||
|
FROM dbo.Weld_RecycleMat AS recycleMat
|
|||
|
LEFT JOIN Weld_WeldInfo AS WeldInfo ON WeldInfo.WeldId = recycleMat.WeldId
|
|||
|
LEFT JOIN Weld_WeldType AS WeldType ON WeldType.WeldTypeId = WeldInfo.WeldTypeId
|
|||
|
WHERE (recycleMat.RecycleAmount-ISNULL(recycleMat.UsingAmount,0))>0 and Number is null
|
|||
|
UNION ALL
|
|||
|
SELECT StockIn.StockInId, StockIn.WeldId,StockIn.Warrantybook,
|
|||
|
WeldInfo.WeldCode,WeldInfo.WeldName,WeldInfo.WeldSpec,WeldInfo.WeldTypeId,
|
|||
|
WeldType.WeldTypeName,WeldType.WeldUnit,NULL AS Number,
|
|||
|
(StockIn.Amount-ISNULL(StockIn.UsingAmount,0)) AS StockAmount
|
|||
|
FROM Weld_StockIn AS StockIn
|
|||
|
LEFT JOIN Weld_WeldInfo AS WeldInfo ON WeldInfo.WeldId = StockIn.WeldId
|
|||
|
LEFT JOIN Weld_WeldType AS WeldType ON WeldType.WeldTypeId = WeldInfo.WeldTypeId
|
|||
|
WHERE (StockIn.Amount-ISNULL(StockIn.UsingAmount,0))>0 ";
|
|||
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|||
|
|
|||
|
SqlParameter[] parameter = listStr.ToArray();
|
|||
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|||
|
|
|||
|
// 2.获取当前分页数据
|
|||
|
Grid1.RecordCount = tb.Rows.Count;
|
|||
|
//tb = GetFilteredTable(Grid1.FilteredData, tb);
|
|||
|
var table = this.GetSortTable(Grid1, tb);
|
|||
|
|
|||
|
Grid1.DataSource = table;
|
|||
|
Grid1.DataBind();
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 排序
|
|||
|
/// <summary>
|
|||
|
/// 排序
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
|||
|
{
|
|||
|
this.BindGrid();
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 确定按钮
|
|||
|
/// <summary>
|
|||
|
/// 确定按钮
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void btnSure_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
string itemsString = "";
|
|||
|
string[] selectRowId = Grid1.SelectedRowIDArray;
|
|||
|
foreach (var item in selectRowId)
|
|||
|
{
|
|||
|
itemsString += item + "|";
|
|||
|
}
|
|||
|
|
|||
|
PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(itemsString)
|
|||
|
+ ActiveWindow.GetHidePostBackReference());
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|