2025-03-27 15:05:14 +08:00

303 lines
14 KiB
C#

using System;
using System.Data;
using System.Linq;
using System.Drawing;
using System.Web.UI.WebControls;
using SuperMap.RealEstate.CoreFrameWork;
using SuperMap.RealEstate.Web.UI.WebControls;
using SuperMap.RealEstate.HighWay.Storage.Business;
using FWB = SuperMap.RealEstate.FrameWork.Business;
using Business = SuperMap.RealEstate.SendRec.Storage.Business;
namespace SuperMap.RealEstate.SendRec.Modules.PrintBill
{
public partial class Default : BasePage
{
protected override void OnLoadComplete(EventArgs e)
{
base.OnLoadComplete(e);
}
#region ->
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack) return;
if (!string.IsNullOrEmpty(Request["APPLYPROINST_CODE"]))
{
SERVERPART_ID.Visible = false;
APPLYPROINST_TYPE.Visible = false;
APPLYPROINST_STATE.Visible = false;
}
InitWebControls();
//初始化并加载列表
GridViewEx1.SelectingWithInit<Business.APPLYPROINST>(ObjectDataSource1, GridPageEx1);
//工具条按钮事件
//GridViewEx1.SetOpenControl(ButtonNew);
//设置回车焦点按钮
SetControlClientAction(ButtonSearch);
}
private void InitWebControls()
{
APPLYPROINST_TYPE.Clear();
ListItemEx _ListItemEx = new ListItemEx();
_ListItemEx.Text = "全部业务";
_ListItemEx.Value = "1=1";
APPLYPROINST_TYPE.Items.Add(_ListItemEx);
DictionaryHelper.BindingDropDownList("APPLYPROINST_TYPE", APPLYPROINST_TYPE.Items, this.Transaction);
APPLYPROINST_TYPE.SelectedIndex = 1;
SERVERPART_ID.Clear();
SERVERPART_ID.Items.Add(new ListItemEx() { Text = "全部", Value = "1=1" });
new SERVERPART(Transaction).BindingDropDownList(SERVERPART_ID.Items, "",
PassportInfo.CityAuthority, false, 1, " AND STATISTICS_TYPE IN (1000,1001,1010,4000)");
SERVERPART_ID.SelectedValue = "1=1";
}
#endregion
#region ->
//查询
protected void ButtonSearch_CallBackClick(object sender, ClientSetEventArgs e)
{
GridViewEx1.Selecting<Business.APPLYPROINST>(ObjectDataSource1, GridPageEx1);
//设置UI变化
e.SetValue(GridViewEx1);
e.SetValue(GridPageEx1);
}
//翻页事件
protected void GridPageEx1_CallBackPageChanged(object src, ClientSetEventArgs e)
{
GridViewEx1.Pagging<Business.APPLYPROINST>(ObjectDataSource1, GridPageEx1);
//设置UI变化
e.SetValue(GridViewEx1);
}
//查询SQL设置
protected void GridViewEx1_SelectMethodParameters(object sender, SelectMethodParametersArgs e)
{
//搜索选项的搜索条件过滤
if (!string.IsNullOrEmpty(TextBox_Search.Text))
e.AddOrParams(GridViewSearch1, TextBox_Search.Text);
//且搜索条件
e.AddAndParams("1", 1);
if (string.IsNullOrEmpty(Request["APPLYPROINST_CODE"]))
{
//添加填写人过滤
if (APPLYPROINST_TYPE.SelectedIndex > -1 && APPLYPROINST_TYPE.SelectedValue != "1=1")
{
e.AddAndParams("APPLYPROINST_TYPE", APPLYPROINST_TYPE.SelectedValue);
}
//添加人员条件
//if (PassportInfo.UserName != "system")
//{
// e.AddAndParams("APPROVED_PASSPORT", PassportInfo.ID);
//}
if (APPLYPROINST_STATE.SelectedValue == "0")
{
e.SetOtherUserCustomWhereSqlString =
"((APPLYPROINST_STATE < 9000 AND APPLYPROINST_TYPE <> 1000) OR (APPLYPROINST_STATE < 5000 AND APPLYPROINST_TYPE = 1000))";
}
else if (APPLYPROINST_STATE.SelectedValue == "1")
{
e.SetOtherUserCustomWhereSqlString =
"(APPLYPROINST_STATE >= 9000 OR (APPLYPROINST_STATE >= 5000 AND APPLYPROINST_TYPE = 1000))";
}
if (SERVERPART_ID.SelectedValue != "" && SERVERPART_ID.SelectedValue != "1=1")
e.AddAndParams("SERVERPART_ID", SERVERPART_ID.SelectedValue);
else
e.SetOtherUserCustomWhereSqlString += (e.SetOtherUserCustomWhereSqlString == "" ? "" : " AND ") +
"SERVERPART_ID IN (" + (new SERVERPART(Transaction)).GetPassportServerPartID(PassportInfo.CityAuthority) + ")";
}
else
{
e.SetOtherUserCustomWhereSqlString += (e.SetOtherUserCustomWhereSqlString == "" ? "" : " AND ") +
" APPLYPROINST_CODE IN ('" + Request["APPLYPROINST_CODE"].ToDecrypt() + "')";
}
//或搜索条件
//e.AddOrParams(字段名, 值);
//排序
e.AddOrderByParams(GridViewOrderBy1);
}
#endregion
#region ->
protected void GridViewEx1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string _APPLYPROINST_TYPE = GridViewEx1.DataKeys[e.Row.RowIndex]["APPLYPROINST_TYPE"].ToString();
string _APPLYPROINST_ID = GridViewEx1.DataKeys[e.Row.RowIndex].Values["APPLYPROINST_ID"].ToString().ToEncrypt();
LinkButton ApprovedBill = (LinkButton)e.Row.FindControl("ApprovedBill");
LinkButton _LinkButton_More = e.Row.FindControl("LinkButton_More") as LinkButton;
_LinkButton_More.OnClientClick = GridViewEx1.GetOpenPopDialogClientScript(
"/SendRec/Modules/SearchProinst/APPLYPROINSTPage.aspx?ID=" + _APPLYPROINST_ID + "&EditType=" + Request["EditType"]);
if (_APPLYPROINST_TYPE == "5000")
{
e.Row.Cells[6].ForeColor = Color.Red;
}
//解析业务类型
foreach (ListItemEx _ListItemEx in APPLYPROINST_TYPE.Items)
{
if (_ListItemEx.Value == e.Row.Cells[6].Text)
{
e.Row.Cells[6].Text = _ListItemEx.Text;
}
}
//解析服务区名称
foreach (ListItemEx _ListItemEx in SERVERPART_ID.Items)
{
if (_ListItemEx.Value == e.Row.Cells[e.Row.Cells.Count - 3].Text)
{
e.Row.Cells[e.Row.Cells.Count - 3].Text = _ListItemEx.Text;
}
}
//解析经办人
if (!string.IsNullOrEmpty(e.Row.Cells[e.Row.Cells.Count - 4].Text.Replace("&nbsp;", "")))
{
FWB.User _User = new FWB.User(Transaction);
_User.User_ID_Encrypt = e.Row.Cells[e.Row.Cells.Count - 4].Text.ToEncrypt();
if (_User.Select())
{
e.Row.Cells[e.Row.Cells.Count - 4].Text = _User.User_Name;
}
}
#region
switch (_APPLYPROINST_TYPE)
{
case "1000":
//申请业务
e.Row.Attributes["data-type"] = "getApplyCommodity";
switch (e.Row.Cells[7].Text)
{
case "1000":
e.Row.Cells[7].Text = "申请填写";
if (e.Row.Cells[7].Text == "10")
{
e.Row.Cells[6].Text += "【补】";
}
break;
case "2000":
e.Row.Cells[7].Text = "部门负责人审核";
break;
case "3000":
e.Row.Cells[7].Text = "财务审核";
break;
case "4000":
e.Row.Cells[7].Text = "经理审批";
break;
default:
e.Row.Cells[7].Text = "办结";
ApprovedBill.Visible = true;
ApprovedBill.OnClientClick = GridViewEx1.GetOpenPopDialogClientScript(
"/SendRec/Modules/PrintBill/BillDefault.aspx?ID=" + _APPLYPROINST_ID, 1000, 600);
break;
}
break;
case "2000":
//入库业务
e.Row.Attributes["data-type"] = "getRecCommodity";
switch (e.Row.Cells[7].Text)
{
case "10":
e.Row.Cells[6].Text += "【补】";
e.Row.Cells[7].Text = "采购员填写";
break;
case "1000":
e.Row.Cells[7].Text = "采购员填写";
break;
case "2000":
e.Row.Cells[7].Text = "验收员审核";
break;
case "3000":
e.Row.Cells[7].Text = "仓管审核";
break;
default:
if (e.Row.Cells[7].Text == "9090")
{
e.Row.Cells[6].Text += "【补】";
}
e.Row.Cells[7].Text = "办结";
ApprovedBill.Visible = true;
ApprovedBill.OnClientClick = GridViewEx1.GetOpenPopDialogClientScript(
"/SendRec/Modules/PrintBill/BillDefaultForRk.aspx?ID=" + _APPLYPROINST_ID, 1000, 600);
break;
}
break;
case "3000":
//领用业务
e.Row.Attributes["data-type"] = "getApplyCommodity";
switch (e.Row.Cells[7].Text)
{
case "10":
e.Row.Cells[6].Text += "【补】";
e.Row.Cells[7].Text = "领料填写";
break;
case "1000":
e.Row.Cells[7].Text = "领料填写";
if (e.Row.Cells[7].Text == "10")
{
e.Row.Cells[6].Text += "【补】";
}
break;
case "2000":
e.Row.Cells[7].Text = "部门负责人审核";
break;
case "3000":
e.Row.Cells[7].Text = "仓管审核";
break;
case "4000":
e.Row.Cells[7].Text = "财务审核";
break;
case "5000":
e.Row.Cells[7].Text = "经理审批";
break;
default:
e.Row.Attributes["data-type"] = "getRecCommodity";
if (e.Row.Cells[7].Text == "9090")
{
e.Row.Cells[6].Text += "【补】";
}
e.Row.Cells[7].Text = "办结";
ApprovedBill.Visible = true;
ApprovedBill.OnClientClick = GridViewEx1.GetOpenPopDialogClientScript(
"/SendRec/Modules/PrintBill/BillDefaultForLy.aspx?ID=" + _APPLYPROINST_ID, 1000, 600);
break;
}
break;
case "4000":
case "5000":
//退货/冲红业务
e.Row.Attributes["data-type"] = "getBackCommodity";
switch (e.Row.Cells[7].Text)
{
case "1000":
e.Row.Cells[7].Text = "退货填写";
break;
default:
e.Row.Cells[7].Text = "办结";
ApprovedBill.Visible = true;
ApprovedBill.OnClientClick = GridViewEx1.GetOpenPopDialogClientScript(
"/SendRec/Modules/PrintBill/BillDefaultForTH.aspx?ID=" + _APPLYPROINST_ID, 1000, 600);
break;
}
break;
}
#endregion
e.Row.Attributes["data-code"] = _APPLYPROINST_ID;
e.Row.Attributes["ondblclick"] = "showDetail(this)";
e.Row.Attributes["itemtype"] = "datatype";
e.Row.ToolTip = "双击查看详情";
}
}
#endregion
}
}