2024-02-04 试车分包管理添加
This commit is contained in:
@@ -1,10 +1,37 @@
|
||||
using BLL;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace FineUIPro.Web.TestRun.DriverSub
|
||||
{
|
||||
public partial class DriverSubEdit :PageBase
|
||||
{
|
||||
public string DriverSubPlanId {
|
||||
get
|
||||
{
|
||||
return (string)ViewState["DriverSubPlanId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["DriverSubPlanId"] = value;
|
||||
}
|
||||
}
|
||||
public string DriverSubId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["DriverSubId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["DriverSubId"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region 加载
|
||||
/// <summary>
|
||||
/// 页面加载
|
||||
@@ -15,37 +42,76 @@ namespace FineUIPro.Web.TestRun.DriverSub
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
BLL.UnitService.InitUnitDownList(this.drpSubUnitId, this.CurrUser.LoginProjectId, true);
|
||||
this.drpImplement.DataTextField = "Text";
|
||||
this.drpImplement.DataValueField = "Value";
|
||||
this.drpImplement.DataSource = BLL.DropListService.drpImplementItemList();
|
||||
this.drpImplement.DataBind();
|
||||
Funs.FineUIPleaseSelect(this.drpImplement);
|
||||
|
||||
string id = Request.Params["id"];
|
||||
if (!string.IsNullOrEmpty(id))
|
||||
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
||||
DriverSubPlanId = Request.Params["DriverSubPlanId"];
|
||||
if (!string.IsNullOrEmpty(DriverSubPlanId))
|
||||
{
|
||||
Model.DriverSub_DriverSub data = BLL.DriverSubService.GetDriverSubById(id);
|
||||
if (data != null)
|
||||
{
|
||||
this.hdId.Text = id;
|
||||
this.txtCode.Text = data.Code;
|
||||
if (!string.IsNullOrEmpty(data.SubUnitId))
|
||||
{
|
||||
this.drpSubUnitId.SelectedValue = data.SubUnitId;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(data.Code))
|
||||
{
|
||||
this.drpImplement.SelectedValue = data.Code;
|
||||
}
|
||||
this.txtInstruction.Text = data.Instruction;
|
||||
this.txtRemark.Text = data.Remark;
|
||||
}
|
||||
InitTreeMenu();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
void InitTreeMenu()
|
||||
{
|
||||
this.tvControlItem.Nodes.Clear();
|
||||
var subPlanModel= DriverSubPlanService.GetDriverSubPlanById(DriverSubPlanId);
|
||||
if (subPlanModel != null)
|
||||
{
|
||||
foreach (var item in subPlanModel.DriverSubNames.Split(','))
|
||||
{
|
||||
var name = DropListService.drpDriverSubNameList().Where(x => x.Value == item) .First().Text;
|
||||
FineUIPro.TreeNode node = new FineUIPro.TreeNode();
|
||||
node.NodeID = item;
|
||||
node.Text = name;
|
||||
node.CommandName = name;
|
||||
node.Expanded = true;
|
||||
this.tvControlItem.Nodes.Add(node);
|
||||
BindNode(node, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BindNode(TreeNode node,string type )
|
||||
{
|
||||
var SubContractorsList= DriverSubContactService.GetDriverSubContactByDriverSubPlanId(DriverSubPlanId)
|
||||
.Where(x => x.SubcontractingType == type).Select(x => x.DriverSubContractorsId).ToArray();
|
||||
foreach (var item in SubContractorsList)
|
||||
{
|
||||
string unitName= BLL.DriversubcontractorsService.GetDriverSub_DriverSubContractorsById(item).SubUnitName;
|
||||
FineUIPro.TreeNode node1 = new FineUIPro.TreeNode();
|
||||
node1.NodeID = item;
|
||||
node1.Text = unitName;
|
||||
node1.CommandName = node1.Text;
|
||||
node1.EnableClickEvent=true;
|
||||
node.Nodes.Add(node1);
|
||||
}
|
||||
}
|
||||
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
|
||||
{
|
||||
var list= BLL.DriverSubService.GetDriverSubEvaluationData(DriverSubPlanId, tvControlItem.SelectedNodeID);
|
||||
var model= BLL.DriverSubService.GetDriverSubBySubPlanIdAndTractorsId(DriverSubPlanId,tvControlItem.SelectedNodeID);
|
||||
if (model!=null)
|
||||
{
|
||||
DriverSubId = model.DriverSubId;
|
||||
}
|
||||
else
|
||||
{
|
||||
DriverSubId = "";
|
||||
}
|
||||
if (list.Count>0 )
|
||||
{
|
||||
Grid1.DataSource = list;
|
||||
Grid1.DataBind();
|
||||
}
|
||||
else
|
||||
{
|
||||
Grid1.DataSource = BLL.DriverSubService.GetDriverSubEvaluationData();
|
||||
Grid1.DataBind();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#region 附件上传
|
||||
/// <summary>
|
||||
/// 附件上传
|
||||
@@ -54,11 +120,8 @@ namespace FineUIPro.Web.TestRun.DriverSub
|
||||
/// <param name="e"></param>
|
||||
protected void btnAttach_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.hdId.Text)) //新增记录
|
||||
{
|
||||
this.hdId.Text = SQLHelper.GetNewID(typeof(Model.DriverSub_DriverSub));
|
||||
}
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/TestRun/DriverSub/DriverSub&menuId={1}", this.hdId.Text, BLL.Const.DriverSubMenuId)));
|
||||
Save();
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/TestRun/DriverSub/DriverSub&menuId={1}", DriverSubId, BLL.Const.DriverSubMenuId)));
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -70,65 +133,49 @@ namespace FineUIPro.Web.TestRun.DriverSub
|
||||
/// <param name="e"></param>
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.drpImplement.SelectedValue==BLL.Const._Null)
|
||||
|
||||
Save();
|
||||
tvControlItem_NodeCommand(null,null);
|
||||
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
||||
// PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
|
||||
void Save()
|
||||
{
|
||||
JArray EditorArr = Grid1.GetMergedData();
|
||||
//JArray 转换成List<Model.DriverSubEvaluationData>
|
||||
List<Model.DriverSubEvaluationData> list = new List<Model.DriverSubEvaluationData>();
|
||||
foreach (JObject item in EditorArr)
|
||||
{
|
||||
Alert.ShowInTop("请选择开车分包单位!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
Model.DriverSubEvaluationData data = new Model.DriverSubEvaluationData();
|
||||
data.Number = Convert.ToInt32(item["values"]["Number"]);
|
||||
data.Matter = item["values"]["Matter"].ToString();
|
||||
data.Grade = item["values"]["Grade"].ToString();
|
||||
list.Add(data);
|
||||
}
|
||||
if (this.drpSubUnitId.SelectedValue == BLL.Const._Null)
|
||||
{
|
||||
Alert.ShowInTop("请选择记录/报告/执行情况!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
string id = Request.Params["id"];
|
||||
//list转换成json数据
|
||||
string json = BLL.DriverSubService.GetDriverSubEvaluationDataJson(list);
|
||||
Model.DriverSub_DriverSub newData = new Model.DriverSub_DriverSub();
|
||||
newData.Code = this.txtCode.Text.Trim();
|
||||
if (this.drpSubUnitId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
newData.SubUnitId = this.drpSubUnitId.SelectedValue;
|
||||
}
|
||||
if (this.drpImplement.SelectedValue!=BLL.Const._Null)
|
||||
{
|
||||
newData.Implement = this.drpImplement.SelectedItem.Text;
|
||||
}
|
||||
newData.Instruction = this.txtInstruction.Text.Trim();
|
||||
newData.Remark = this.txtRemark.Text.Trim();
|
||||
newData.ProjectId = this.CurrUser.LoginProjectId;
|
||||
if (!string.IsNullOrEmpty(id))
|
||||
newData.DriverSubPlanId = DriverSubPlanId;
|
||||
newData.DriverSubContractorsId = tvControlItem.SelectedNodeID;
|
||||
newData.EvaluationData = json;
|
||||
|
||||
if (string.IsNullOrEmpty(DriverSubId))
|
||||
{
|
||||
newData.DriverSubId = id;
|
||||
BLL.DriverSubService.UpdateDriverSub(newData);
|
||||
newData.DriverSubId = SQLHelper.GetNewID(typeof(Model.DriverSub_DriverSub));
|
||||
DriverSubId= newData.DriverSubId;
|
||||
DriverSubService.AddDriverSub(newData);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.hdId.Text))
|
||||
{
|
||||
newData.DriverSubId = this.hdId.Text.Trim();
|
||||
}
|
||||
else
|
||||
{
|
||||
newData.DriverSubId = SQLHelper.GetNewID(typeof(Model.DriverSub_DriverSub));
|
||||
this.hdId.Text = newData.DriverSubId;
|
||||
}
|
||||
BLL.DriverSubService.AddDriverSub(newData);
|
||||
newData.DriverSubId = DriverSubId;
|
||||
DriverSubService.UpdateDriverSub(newData);
|
||||
}
|
||||
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region DropDownList下拉选择事件
|
||||
protected void drpImplement_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (this.drpImplement.SelectedValue == BLL.Const._Null)
|
||||
{
|
||||
this.txtCode.Text = string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.txtCode.Text = this.drpImplement.SelectedValue;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user