2024-01-26 16:50:18 +08:00
|
|
|
|
using BLL;
|
|
|
|
|
using BLL.CQMS.Comprehensive;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Data.SqlClient;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
namespace FineUIPro.Web.Transfer
|
|
|
|
|
{
|
|
|
|
|
public partial class PunchlistFrom : PageBase
|
|
|
|
|
{
|
|
|
|
|
#region 加载
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 加载页面
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
{
|
|
|
|
|
GetButtonPower();
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 数据绑定
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void BindGrid()
|
|
|
|
|
{
|
2024-07-24 14:53:46 +08:00
|
|
|
|
string strSql = @"select *
|
|
|
|
|
,(CASE isnull(IsEng,0) WHEN 1 THEN 'Y' ELSE 'N' END) IsEngStr
|
|
|
|
|
,(CASE isnull(IsMatI,0) WHEN 1 THEN 'Y' ELSE 'N' END) IsMatIStr
|
|
|
|
|
from Transfer_PunchlistFrom
|
2024-01-26 16:50:18 +08:00
|
|
|
|
where ProjectId = @ProjectId";
|
|
|
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
|
|
|
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
|
|
|
|
|
|
2024-07-24 14:53:46 +08:00
|
|
|
|
if (!string.IsNullOrEmpty(this.txtNum_NO.Text.Trim()))
|
2024-01-26 16:50:18 +08:00
|
|
|
|
{
|
2024-07-24 14:53:46 +08:00
|
|
|
|
strSql += " AND Num_NO like @Num_NO";
|
|
|
|
|
listStr.Add(new SqlParameter("@Num_NO", "%" + this.txtNum_NO.Text.Trim() + "%"));
|
2024-01-26 16:50:18 +08:00
|
|
|
|
}
|
2024-07-24 14:53:46 +08:00
|
|
|
|
if (!string.IsNullOrEmpty(this.txtSystem_No.Text.Trim()))
|
2024-02-01 16:50:35 +08:00
|
|
|
|
{
|
2024-07-24 14:53:46 +08:00
|
|
|
|
strSql += " AND System_No like @System_No";
|
|
|
|
|
listStr.Add(new SqlParameter("@System_No", "%" + this.txtSystem_No.Text.Trim() + "%"));
|
2024-02-01 16:50:35 +08:00
|
|
|
|
}
|
2024-07-24 14:53:46 +08:00
|
|
|
|
if (!string.IsNullOrEmpty(this.txtSub_Sys_No.Text.Trim()))
|
2024-02-01 16:50:35 +08:00
|
|
|
|
{
|
2024-07-24 14:53:46 +08:00
|
|
|
|
strSql += " AND Sub_Sys_No like @Sub_Sys_No";
|
|
|
|
|
listStr.Add(new SqlParameter("@Sub_Sys_No", "%" + this.txtSub_Sys_No.Text.Trim() + "%"));
|
2024-02-01 16:50:35 +08:00
|
|
|
|
}
|
2024-07-24 14:53:46 +08:00
|
|
|
|
if (!string.IsNullOrEmpty(txtStartDate_Raised.Text.Trim()))
|
2024-01-26 16:50:18 +08:00
|
|
|
|
{
|
2024-07-24 14:53:46 +08:00
|
|
|
|
strSql += " AND Date_Raised >= @StartDate_Raised";
|
|
|
|
|
listStr.Add(new SqlParameter("@StartDate_Raised", Funs.GetNewDateTime(txtStartDate_Raised.Text.Trim())));
|
2024-01-26 16:50:18 +08:00
|
|
|
|
}
|
2024-07-24 14:53:46 +08:00
|
|
|
|
if (!string.IsNullOrEmpty(txtEndDate_Raised.Text.Trim()))
|
2024-01-26 16:50:18 +08:00
|
|
|
|
{
|
2024-07-24 14:53:46 +08:00
|
|
|
|
strSql += " AND Date_Raised <= @EndDate_Raised";
|
|
|
|
|
listStr.Add(new SqlParameter("@EndDate_Raised", Funs.GetNewDateTime(txtEndDate_Raised.Text.Trim())));
|
2024-01-26 16:50:18 +08:00
|
|
|
|
}
|
2024-07-24 14:53:46 +08:00
|
|
|
|
if (!string.IsNullOrEmpty(txtStartRequired_Date.Text.Trim()))
|
2024-02-01 16:50:35 +08:00
|
|
|
|
{
|
2024-07-25 14:58:40 +08:00
|
|
|
|
strSql += " AND Required_Date >= @StartRequired_Date";
|
|
|
|
|
listStr.Add(new SqlParameter("@StartRequired_Date", Funs.GetNewDateTime(txtStartRequired_Date.Text.Trim())));
|
2024-02-01 16:50:35 +08:00
|
|
|
|
}
|
2024-07-24 14:53:46 +08:00
|
|
|
|
if (!string.IsNullOrEmpty(txtEndRequired_Date.Text.Trim()))
|
2024-02-01 16:50:35 +08:00
|
|
|
|
{
|
2024-07-25 14:58:40 +08:00
|
|
|
|
strSql += " AND Required_Date <= @EndRequired_Date";
|
|
|
|
|
listStr.Add(new SqlParameter("@EndRequired_Date", Funs.GetNewDateTime(txtEndRequired_Date.Text.Trim())));
|
2024-02-01 16:50:35 +08:00
|
|
|
|
}
|
2024-07-24 14:53:46 +08:00
|
|
|
|
if (!string.IsNullOrEmpty(txtStartActual_Date.Text.Trim()))
|
2024-02-01 16:50:35 +08:00
|
|
|
|
{
|
2024-07-25 14:58:40 +08:00
|
|
|
|
strSql += " AND Actual_Date >= @StartActual_Date";
|
|
|
|
|
listStr.Add(new SqlParameter("@StartActual_Date", Funs.GetNewDateTime(txtStartActual_Date.Text.Trim())));
|
2024-02-01 16:50:35 +08:00
|
|
|
|
}
|
2024-07-24 14:53:46 +08:00
|
|
|
|
if (!string.IsNullOrEmpty(txtEndActual_Date.Text.Trim()))
|
2024-02-01 16:50:35 +08:00
|
|
|
|
{
|
2024-07-25 14:58:40 +08:00
|
|
|
|
strSql += " AND Actual_Date <= @EndActual_Date";
|
|
|
|
|
listStr.Add(new SqlParameter("@EndActual_Date", Funs.GetNewDateTime(txtEndActual_Date.Text.Trim())));
|
2024-02-01 16:50:35 +08:00
|
|
|
|
}
|
2024-07-25 14:19:34 +08:00
|
|
|
|
if (!string.IsNullOrEmpty(txtDisc.Text.Trim()))
|
|
|
|
|
{
|
|
|
|
|
strSql += " AND Disc = @Disc";
|
|
|
|
|
listStr.Add(new SqlParameter("@Disc", txtDisc.Text.Trim()));
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(ddlEng.SelectedValue.Trim()))
|
|
|
|
|
{
|
|
|
|
|
strSql += " AND IsEng = @IsEng";
|
|
|
|
|
listStr.Add(new SqlParameter("@IsEng", ddlEng.SelectedValue.Trim() == "Y" ? 1 : 0));
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(ddlMatI.SelectedValue.Trim()))
|
|
|
|
|
{
|
|
|
|
|
strSql += " AND IsMatI = @IsMatI";
|
|
|
|
|
listStr.Add(new SqlParameter("@IsMatI", ddlMatI.SelectedValue.Trim() == "Y" ? 1 : 0));
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(ddlPunchType.SelectedValue.Trim()))
|
|
|
|
|
{
|
|
|
|
|
strSql += " AND Punch_Type = @Punch_Type";
|
|
|
|
|
listStr.Add(new SqlParameter("@Punch_Type", ddlPunchType.SelectedValue.Trim()));
|
|
|
|
|
}
|
2024-07-24 14:53:46 +08:00
|
|
|
|
strSql += " order by Num_No ";
|
2024-01-26 16:50:18 +08:00
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 分页、排序
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 分页下拉
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 分页索引事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 排序
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Grid1.SortDirection = e.SortDirection;
|
|
|
|
|
Grid1.SortField = e.SortField;
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 查询
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 查询
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnSearch_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 关闭弹出窗口
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 关闭弹出窗口
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 删除
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 右键删除
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnMenuDel_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (Grid1.SelectedRowIndexArray.Length > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
|
|
|
|
{
|
|
|
|
|
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
|
|
|
|
Model.Transfer_PunchlistFrom model = Funs.DB.Transfer_PunchlistFrom.FirstOrDefault(x => x.Id == rowID);
|
|
|
|
|
if (model != null)
|
|
|
|
|
{
|
|
|
|
|
Funs.DB.Transfer_PunchlistFrom.DeleteOnSubmit(model);
|
|
|
|
|
Funs.DB.SubmitChanges();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
BindGrid();
|
|
|
|
|
ShowNotify("删除数据成功!", MessageBoxIcon.Success);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
2024-07-24 14:53:46 +08:00
|
|
|
|
|
|
|
|
|
#region Photoes附件
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 右键附件上传功能
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnMenuAttachA_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (Grid1.SelectedRowIndexArray.Length > 0)
|
|
|
|
|
{
|
|
|
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../AttachFile/webuploader.aspx?type=0&toKeyId={0}_A&path=FileUpload/Transfer/PunchlistFrom&menuId={1}", Grid1.SelectedRowID, BLL.Const.PunchlistFromMenuId)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Corrected_Photos附件
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 右键附件上传功能
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnMenuAttachB_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (Grid1.SelectedRowIndexArray.Length > 0)
|
|
|
|
|
{
|
|
|
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../AttachFile/webuploader.aspx?type=0&toKeyId={0}_B&path=FileUpload/Transfer/PunchlistFrom&menuId={1}", Grid1.SelectedRowID, BLL.Const.PunchlistFromMenuId)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取附件(放于Img中)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="Id_type"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
protected string ConvertImageUrlByImage(object Id_type)
|
|
|
|
|
{
|
|
|
|
|
string url = string.Empty;
|
|
|
|
|
if (Id_type != null)
|
|
|
|
|
{
|
|
|
|
|
var registration = BLL.AttachFileService.GetAttachFile(Id_type.ToString(), BLL.Const.PunchlistFromMenuId);
|
|
|
|
|
if (registration != null)
|
|
|
|
|
{
|
|
|
|
|
url = BLL.UploadAttachmentService.ShowImage("../../", registration.AttachUrl);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return url;
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-26 16:50:18 +08:00
|
|
|
|
#region 导入
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 导入按钮
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnImport_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("PunchlistFromDataIn.aspx", "导入 - ")));
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 获取按钮权限
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取按钮权限
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="button"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private void GetButtonPower()
|
|
|
|
|
{
|
|
|
|
|
if (Request.Params["value"] == "0")
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.PunchlistFromMenuId);
|
|
|
|
|
if (buttonList.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
if (buttonList.Contains(BLL.Const.BtnAdd))
|
|
|
|
|
{
|
|
|
|
|
//this.btnNew.Hidden = false;
|
2024-07-25 14:19:34 +08:00
|
|
|
|
btnMenuAttachA.Hidden = false;
|
2024-07-24 14:53:46 +08:00
|
|
|
|
btnMenuAttachB.Hidden = false;
|
2024-01-26 16:50:18 +08:00
|
|
|
|
}
|
|
|
|
|
if (buttonList.Contains(BLL.Const.BtnModify))
|
|
|
|
|
{
|
|
|
|
|
//this.btnMenuModify.Hidden = false;
|
|
|
|
|
this.Grid1.EnableRowDoubleClickEvent = true;
|
2024-07-24 14:53:46 +08:00
|
|
|
|
btnMenuAttachA.Hidden = false;
|
|
|
|
|
btnMenuAttachB.Hidden = false;
|
2024-01-26 16:50:18 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
this.Grid1.EnableRowDoubleClickEvent = false;
|
|
|
|
|
}
|
|
|
|
|
if (buttonList.Contains(BLL.Const.BtnDelete))
|
|
|
|
|
{
|
|
|
|
|
this.btnMenuDel.Hidden = false;
|
|
|
|
|
}
|
|
|
|
|
if (buttonList.Contains(BLL.Const.BtnSave))
|
|
|
|
|
{
|
|
|
|
|
this.btnImport.Hidden = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
2024-02-04 14:26:05 +08:00
|
|
|
|
|
|
|
|
|
#region 附件上传
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 附件上传
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnAttach_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.PunchlistFromMenuId);
|
|
|
|
|
if (buttonList.Contains(BLL.Const.BtnAdd))
|
|
|
|
|
{
|
2024-07-25 14:19:34 +08:00
|
|
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/Transfer/PunchlistFrom&menuId={1}", this.CurrUser.LoginProjectId + "PunchlistFrom", BLL.Const.PunchlistFromMenuId)));
|
2024-02-04 14:26:05 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../AttachFile/webuploader.aspx?type=-1&toKeyId={0}&path=FileUpload/Transfer/PunchlistFrom&menuId={1}", this.CurrUser.LoginProjectId + "PunchlistFrom", BLL.Const.PunchlistFromMenuId)));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
2024-01-26 16:50:18 +08:00
|
|
|
|
}
|
|
|
|
|
}
|