移交管理查询优化,单选条件修改多选查询

This commit is contained in:
2025-02-24 15:36:00 +08:00
parent 062d7bf0fd
commit c3699e594e
6 changed files with 85 additions and 19 deletions
@@ -31,7 +31,8 @@ namespace FineUIPro.Web.Transfer
if (!IsPostBack)
{
GetButtonPower();
BLL.PunchlistFromService.InitActionByUnitDropDownList(this.ddlAction_By, this.CurrUser.LoginProjectId, true);
BLL.PunchlistFromService.InitTurnoverSystemCodeUnitDropDownList(this.drpTurnoverSystemCode, this.CurrUser.LoginProjectId, false);
BLL.PunchlistFromService.InitActionByUnitDropDownList(this.ddlAction_By, this.CurrUser.LoginProjectId, false);
BindGrid();
this.btnNew.OnClientClick = Window1.GetShowReference("PunchlistFromEdit.aspx") + "return false;";
@@ -58,10 +59,25 @@ namespace FineUIPro.Web.Transfer
strSql += " AND System_No like @System_No";
listStr.Add(new SqlParameter("@System_No", "%" + this.txtSystem_No.Text.Trim() + "%"));
}
if (!string.IsNullOrEmpty(this.txtSub_Sys_No.Text.Trim()))
//if (!string.IsNullOrEmpty(this.txtSub_Sys_No.Text.Trim()))
//{
// strSql += " AND Sub_Sys_No like @Sub_Sys_No";
// listStr.Add(new SqlParameter("@Sub_Sys_No", "%" + this.txtSub_Sys_No.Text.Trim() + "%"));
//}
if (this.drpTurnoverSystemCode.SelectedItemArray.Count() > 1 || (this.drpTurnoverSystemCode.SelectedValue != BLL.Const._Null && this.drpTurnoverSystemCode.SelectedItemArray.Count() == 1))
{
strSql += " AND Sub_Sys_No like @Sub_Sys_No";
listStr.Add(new SqlParameter("@Sub_Sys_No", "%" + this.txtSub_Sys_No.Text.Trim() + "%"));
strSql += " AND (1=2 ";
int i = 0;
foreach (var item in this.drpTurnoverSystemCode.SelectedValueArray)
{
if (!string.IsNullOrEmpty(item) && item != BLL.Const._Null)
{
strSql += " OR Sub_Sys_No = @Sub_Sys_No" + i.ToString();
listStr.Add(new SqlParameter("@Sub_Sys_No" + i.ToString(), item));
}
i++;
}
strSql += ")";
}
//if (!string.IsNullOrEmpty(txtStartDate_Raised.Text.Trim()))
//{
@@ -123,11 +139,33 @@ namespace FineUIPro.Web.Transfer
// strSql += " AND Action_By = @Action_By";
// listStr.Add(new SqlParameter("@Action_By", txtAction_By.Text.Trim()));
//}
if (ddlAction_By.SelectedValue != BLL.Const._Null)
//if (ddlAction_By.SelectedValue != null && ddlAction_By.SelectedValue != BLL.Const._Null)
//{
// strSql += " AND Action_By = @Action_By";
// listStr.Add(new SqlParameter("@Action_By", ddlAction_By.SelectedValue.Trim()));
//}
if (this.ddlAction_By.SelectedItemArray.Count() > 1 || (this.ddlAction_By.SelectedValue != BLL.Const._Null && this.ddlAction_By.SelectedItemArray.Count() == 1))
{
strSql += " AND Action_By = @Action_By";
listStr.Add(new SqlParameter("@Action_By", ddlAction_By.SelectedValue.Trim()));
strSql += " AND (1=2 ";
int i = 0;
foreach (var item in this.ddlAction_By.SelectedValueArray)
{
if (!string.IsNullOrEmpty(item) && item != BLL.Const._Null)
{
strSql += " OR Action_By = @Action_By" + i.ToString();
listStr.Add(new SqlParameter("@Action_By" + i.ToString(), item));
}
i++;
}
strSql += ")";
}
//if (ddlAction_By.SelectedValue != null && ddlAction_By.SelectedValue != BLL.Const._Null)
//{
// strSql += " AND Action_By = @Action_By";
// listStr.Add(new SqlParameter("@Action_By", ddlAction_By.SelectedValue.Trim()));
//}
if (!string.IsNullOrEmpty(txtPIC.Text.Trim()))
{
strSql += " AND PIC = @PIC";