提交代码
This commit is contained in:
@@ -5,6 +5,21 @@ namespace FineUIPro.Web.TestRun.DriverRun
|
||||
{
|
||||
public partial class DriverRunEdit : PageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 办理类型
|
||||
/// </summary>
|
||||
public string State
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["State"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["State"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
#region 加载
|
||||
/// <summary>
|
||||
/// 页面加载
|
||||
@@ -16,32 +31,104 @@ namespace FineUIPro.Web.TestRun.DriverRun
|
||||
if (!IsPostBack)
|
||||
{
|
||||
BLL.UnitService.InitUnitDownList(this.drpUnitId, this.CurrUser.LoginProjectId, true);
|
||||
this.drpImplement.DataTextField = "Text";
|
||||
this.drpImplement.DataValueField = "Value";
|
||||
this.drpImplement.DataSource = BLL.DropListService.drpDriverRunImplementItemList();
|
||||
this.drpImplement.DataBind();
|
||||
Funs.FineUIPleaseSelect(this.drpImplement);
|
||||
|
||||
BLL.UnitWorkService.InitUnitWorkDropDownList(this.drpUnitWorkIds, this.CurrUser.LoginProjectId, true);
|
||||
plApprove1.Hidden = true;
|
||||
plApprove2.Hidden = true;
|
||||
txtRealCompletedDate.Hidden = true;
|
||||
string id = Request.Params["id"];
|
||||
if (!string.IsNullOrEmpty(id))
|
||||
{
|
||||
Model.DriverRun_DriverRun data = BLL.DriverRunService.GetDriverRunById(id);
|
||||
if (data != null)
|
||||
{
|
||||
plApprove1.Hidden = false;
|
||||
plApprove2.Hidden = false;
|
||||
var dt = DriverRunApproveService.getListData(id);
|
||||
gvApprove.DataSource = dt;
|
||||
gvApprove.DataBind();
|
||||
this.hdId.Text = id;
|
||||
this.txtCode.Text = data.Code;
|
||||
if (!string.IsNullOrEmpty(data.UnitId))
|
||||
{
|
||||
this.drpUnitId.SelectedValue = data.UnitId;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(data.Code))
|
||||
{
|
||||
this.drpImplement.SelectedValue = data.Code;
|
||||
}
|
||||
this.drpUnitWorkIds.SelectedValueArray = data.InstallationId.Split(',');
|
||||
this.txtDescriptions.Text = data.Descriptions;
|
||||
this.txtRemark.Text = data.Remark;
|
||||
this.txtObjective.Text = data.Objective;
|
||||
if (data.NeedCompletedDate != null)
|
||||
{
|
||||
this.txtNeedCompletedDate.Text = string.Format("{0:yyyy-MM-dd}", data.NeedCompletedDate);
|
||||
}
|
||||
if (data.RealCompletedDate != null)
|
||||
{
|
||||
this.txtRealCompletedDate.Text = string.Format("{0:yyyy-MM-dd}", data.RealCompletedDate);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(data.State))
|
||||
{
|
||||
State = data.State;
|
||||
}
|
||||
else
|
||||
{
|
||||
State = BLL.Const.DriverRun_Compile;
|
||||
}
|
||||
if (State != BLL.Const.DriverRun_Complete)
|
||||
{
|
||||
DriverRunService.Init(drpHandleType, State, false);
|
||||
}
|
||||
if (State == BLL.Const.DriverRun_Compile)
|
||||
{
|
||||
UserService.Init2(drpHandleMan, CurrUser.LoginProjectId, false);
|
||||
this.drpHandleMan.SelectedIndex = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (State == BLL.Const.DriverRun_Audit2)
|
||||
{
|
||||
Model.DriverRun_DriverRunApprove approve = BLL.DriverRunApproveService.GetAudit2(id);
|
||||
if (approve != null)
|
||||
{
|
||||
ListItem[] list = new ListItem[1];
|
||||
list[0] = new ListItem(BLL.UserService.GetUserByUserId(approve.ApproveMan).UserName ?? "", approve.ApproveMan);
|
||||
drpHandleMan.DataValueField = "Value";
|
||||
drpHandleMan.DataTextField = "Text";
|
||||
drpHandleMan.DataSource = list;
|
||||
drpHandleMan.DataBind();
|
||||
}
|
||||
}
|
||||
else if (State == BLL.Const.DriverRun_Audit3)
|
||||
{
|
||||
txtRealCompletedDate.Hidden = false;
|
||||
Model.DriverRun_DriverRunApprove approve = BLL.DriverRunApproveService.GetAudit1(id);
|
||||
if (approve != null)
|
||||
{
|
||||
ListItem[] list = new ListItem[1];
|
||||
list[0] = new ListItem(BLL.UserService.GetUserByUserId(approve.ApproveMan).UserName ?? "", approve.ApproveMan);
|
||||
drpHandleMan.DataValueField = "Value";
|
||||
drpHandleMan.DataTextField = "Text";
|
||||
drpHandleMan.DataSource = list;
|
||||
drpHandleMan.DataBind();
|
||||
}
|
||||
}
|
||||
else if (State == BLL.Const.DriverRun_Audit4)
|
||||
{
|
||||
txtRealCompletedDate.Hidden = false;
|
||||
drpHandleMan.Items.Clear();
|
||||
drpHandleMan.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
UserService.Init2(drpHandleMan, CurrUser.LoginProjectId, false);
|
||||
}
|
||||
}
|
||||
this.txtOpinions.Text = "同意";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
State = Const.DriverRun_Compile;
|
||||
DriverRunService.Init(drpHandleType, State, false);
|
||||
UserService.Init2(drpHandleMan, CurrUser.LoginProjectId, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -62,7 +149,7 @@ namespace FineUIPro.Web.TestRun.DriverRun
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 保存
|
||||
#region 保存/提交
|
||||
/// <summary>
|
||||
/// 保存按钮
|
||||
/// </summary>
|
||||
@@ -70,16 +157,50 @@ namespace FineUIPro.Web.TestRun.DriverRun
|
||||
/// <param name="e"></param>
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.drpImplement.SelectedValue == BLL.Const._Null)
|
||||
{
|
||||
Alert.ShowInTop("请选择记录/报告/执行情况!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
if (this.drpUnitId.SelectedValue == BLL.Const._Null)
|
||||
{
|
||||
Alert.ShowInTop("请选择单位名称!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
if (this.drpUnitWorkIds.SelectedValue == BLL.Const._Null)
|
||||
{
|
||||
Alert.ShowInTop("请选择区域!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
if (State == BLL.Const.DriverRun_Audit4 && string.IsNullOrEmpty(this.txtRealCompletedDate.Text.Trim()))
|
||||
{
|
||||
Alert.ShowInTop("请选择实际完成时间!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
SaveData("save");
|
||||
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
|
||||
protected void btnSubmit_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.drpUnitId.SelectedValue == BLL.Const._Null)
|
||||
{
|
||||
Alert.ShowInTop("请选择单位名称!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
if (this.drpUnitWorkIds.SelectedValue == BLL.Const._Null)
|
||||
{
|
||||
Alert.ShowInTop("请选择区域!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
if (State == BLL.Const.DriverRun_Audit4 && string.IsNullOrEmpty(this.txtRealCompletedDate.Text.Trim()))
|
||||
{
|
||||
Alert.ShowInTop("请选择实际完成时间!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
SaveData("submit");
|
||||
ShowNotify("提交成功!", MessageBoxIcon.Success);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
|
||||
private void SaveData(string saveType)
|
||||
{
|
||||
string id = Request.Params["id"];
|
||||
Model.DriverRun_DriverRun newData = new Model.DriverRun_DriverRun();
|
||||
newData.Code = this.txtCode.Text.Trim();
|
||||
@@ -87,15 +208,77 @@ namespace FineUIPro.Web.TestRun.DriverRun
|
||||
{
|
||||
newData.UnitId = this.drpUnitId.SelectedValue;
|
||||
}
|
||||
if (this.drpImplement.SelectedValue != BLL.Const._Null)
|
||||
if (!string.IsNullOrEmpty(this.drpUnitWorkIds.SelectedValue))
|
||||
{
|
||||
newData.Implement = this.drpImplement.SelectedItem.Text;
|
||||
newData.InstallationId = GetStringByArray(this.drpUnitWorkIds.SelectedValueArray);
|
||||
string unitWorkNames = string.Empty;
|
||||
foreach (var item in this.drpUnitWorkIds.SelectedValueArray)
|
||||
{
|
||||
var unitWork = BLL.UnitWorkService.getUnitWorkByUnitWorkId(item);
|
||||
if (unitWork != null)
|
||||
{
|
||||
unitWorkNames += unitWork.UnitWorkName + ",";
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(unitWorkNames))
|
||||
{
|
||||
newData.InstallationNames = unitWorkNames.Substring(0, unitWorkNames.LastIndexOf(","));
|
||||
}
|
||||
}
|
||||
newData.Descriptions = this.txtDescriptions.Text.Trim();
|
||||
newData.Remark = this.txtRemark.Text.Trim();
|
||||
newData.Objective = this.txtObjective.Text.Trim();
|
||||
newData.NeedCompletedDate = Funs.GetNewDateTime(this.txtNeedCompletedDate.Text.Trim());
|
||||
newData.ProjectId = this.CurrUser.LoginProjectId;
|
||||
newData.RealCompletedDate = Funs.GetNewDateTime(this.txtRealCompletedDate.Text.Trim());
|
||||
if (saveType == "submit")
|
||||
{
|
||||
newData.State = drpHandleType.SelectedValue.Trim();
|
||||
}
|
||||
else
|
||||
{
|
||||
Model.DriverRun_DriverRun newData1 = BLL.DriverRunService.GetDriverRunById(id);
|
||||
|
||||
if (newData1 != null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(newData1.State))
|
||||
{
|
||||
newData.State = BLL.Const.DriverRun_Compile;
|
||||
}
|
||||
else
|
||||
{
|
||||
newData.State = newData1.State;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
newData.State = BLL.Const.DriverRun_Compile;
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(id))
|
||||
{
|
||||
Model.DriverRun_DriverRunApprove approve1 = BLL.DriverRunApproveService.GetDriverRunApproveByDriverRunId(id);
|
||||
if (approve1 != null && saveType == "submit")
|
||||
{
|
||||
approve1.ApproveDate = DateTime.Now;
|
||||
approve1.ApproveIdea = txtOpinions.Text.Trim();
|
||||
BLL.DriverRunApproveService.UpdateDriverRunApprove(approve1);
|
||||
}
|
||||
if (saveType == "submit" && !string.IsNullOrEmpty(this.drpHandleMan.SelectedValue))
|
||||
{
|
||||
Model.DriverRun_DriverRunApprove approve = new Model.DriverRun_DriverRunApprove();
|
||||
approve.DriverRunId = id;
|
||||
if (!string.IsNullOrEmpty(this.drpHandleMan.SelectedValue))
|
||||
{
|
||||
approve.ApproveMan = this.drpHandleMan.SelectedValue;
|
||||
}
|
||||
approve.ApproveType = this.drpHandleType.SelectedValue;
|
||||
if (this.drpHandleType.SelectedValue == BLL.Const.DriverRun_Complete)
|
||||
{
|
||||
approve.ApproveDate = DateTime.Now;
|
||||
}
|
||||
BLL.DriverRunApproveService.AddDriverRunApprove(approve);
|
||||
APICommonService.SendSubscribeMessage(approve.ApproveMan, "开车保运委托单待办理", this.CurrUser.UserName, string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now));
|
||||
}
|
||||
newData.DriverRunId = id;
|
||||
BLL.DriverRunService.UpdateDriverRun(newData);
|
||||
}
|
||||
@@ -110,25 +293,97 @@ namespace FineUIPro.Web.TestRun.DriverRun
|
||||
newData.DriverRunId = SQLHelper.GetNewID(typeof(Model.DriverRun_DriverRun));
|
||||
this.hdId.Text = newData.DriverRunId;
|
||||
}
|
||||
newData.CompileMan = this.CurrUser.UserId;
|
||||
newData.CompileDate = DateTime.Now;
|
||||
BLL.DriverRunService.AddDriverRun(newData);
|
||||
if (saveType == "submit")
|
||||
{
|
||||
Model.DriverRun_DriverRunApprove approve1 = new Model.DriverRun_DriverRunApprove();
|
||||
approve1.DriverRunId = newData.DriverRunId;
|
||||
approve1.ApproveDate = DateTime.Now;
|
||||
approve1.ApproveMan = this.CurrUser.UserId;
|
||||
approve1.ApproveType = BLL.Const.DriverRun_Compile;
|
||||
BLL.DriverRunApproveService.AddDriverRunApprove(approve1);
|
||||
|
||||
Model.DriverRun_DriverRunApprove approve = new Model.DriverRun_DriverRunApprove();
|
||||
approve.DriverRunId = newData.DriverRunId;
|
||||
if (this.drpHandleMan.SelectedValue != "0")
|
||||
{
|
||||
approve.ApproveMan = this.drpHandleMan.SelectedValue;
|
||||
}
|
||||
approve.ApproveType = this.drpHandleType.SelectedValue;
|
||||
|
||||
BLL.DriverRunApproveService.AddDriverRunApprove(approve);
|
||||
APICommonService.SendSubscribeMessage(approve.ApproveMan, "开车保运委托单待办理", this.CurrUser.UserName, string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now));
|
||||
}
|
||||
else
|
||||
{
|
||||
Model.DriverRun_DriverRunApprove approve1 = new Model.DriverRun_DriverRunApprove();
|
||||
approve1.DriverRunId = newData.DriverRunId;
|
||||
approve1.ApproveMan = this.CurrUser.UserId;
|
||||
approve1.ApproveType = BLL.Const.DriverRun_Compile;
|
||||
BLL.DriverRunApproveService.AddDriverRunApprove(approve1);
|
||||
}
|
||||
}
|
||||
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
|
||||
private string GetStringByArray(string[] array)
|
||||
{
|
||||
string str = string.Empty;
|
||||
foreach (var item in array)
|
||||
{
|
||||
if (item != BLL.Const._Null)
|
||||
{
|
||||
str += item + ",";
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(str))
|
||||
{
|
||||
str = str.Substring(0, str.LastIndexOf(","));
|
||||
}
|
||||
return str;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region DropDownList下拉选择事件
|
||||
protected void drpImplement_SelectedIndexChanged(object sender, EventArgs e)
|
||||
/// <summary>
|
||||
/// 把状态转换代号为文字形式
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
/// <returns></returns>
|
||||
protected string ConvertState(object state)
|
||||
{
|
||||
if (this.drpImplement.SelectedValue == BLL.Const._Null)
|
||||
if (state != null)
|
||||
{
|
||||
this.txtCode.Text = string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.txtCode.Text = this.drpImplement.SelectedValue;
|
||||
if (state.ToString() == BLL.Const.DriverRun_Compile)
|
||||
{
|
||||
return "编制";
|
||||
}
|
||||
else if (state.ToString() == BLL.Const.DriverRun_Audit1)
|
||||
{
|
||||
return "开车负责人审批";
|
||||
}
|
||||
else if (state.ToString() == BLL.Const.DriverRun_Audit2)
|
||||
{
|
||||
return "保运主任审批";
|
||||
}
|
||||
else if (state.ToString() == BLL.Const.DriverRun_Audit3)
|
||||
{
|
||||
return "保运主任确认完成";
|
||||
}
|
||||
else if (state.ToString() == BLL.Const.DriverRun_Audit4)
|
||||
{
|
||||
return "开车负责人确认完成";
|
||||
}
|
||||
else if (state.ToString() == BLL.Const.DriverRun_Complete)
|
||||
{
|
||||
return "流程闭环";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user