2024-01-26 开车分包管理修改
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
using BLL;
|
||||
using NPOI.POIFS.Crypt.Dsig;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.DataVisualization.Charting;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace FineUIPro.Web.TestRun.DriverSub
|
||||
@@ -20,28 +22,19 @@ namespace FineUIPro.Web.TestRun.DriverSub
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
BLL.UnitService.InitUnitDownList(this.drpSubUnitId, this.CurrUser.LoginProjectId, true);
|
||||
string id = Request.Params["id"];
|
||||
if (!string.IsNullOrEmpty(id))
|
||||
DriverSubPlanService.InitSubPlanDropDownList(drpSubPlanCode,this.CurrUser.LoginProjectId,true);
|
||||
DriverSubName.DataSource = DropListService.drpDriverSubNameList();
|
||||
DriverSubName.DataTextField = "Text";
|
||||
DriverSubName.DataValueField = "Value";
|
||||
DriverSubName.DataBind();
|
||||
string driverSubPlanId = Request.Params["DriverSubPlanId"];
|
||||
if (!string.IsNullOrEmpty(driverSubPlanId))
|
||||
{
|
||||
Model.DriverSub_DriverSubContact data = BLL.DriverSubContactService.GetDriverSubContactById(id);
|
||||
if (data != null)
|
||||
{
|
||||
this.hdId.Text = id;
|
||||
this.txtCode.Text = data.Code;
|
||||
if (!string.IsNullOrEmpty(data.SubUnitId))
|
||||
{
|
||||
this.drpSubUnitId.SelectedValue = data.SubUnitId;
|
||||
}
|
||||
this.txtContactInfo.Text = data.ContactInfo;
|
||||
this.txtChargeManInfo.Text = data.ChargeManInfo;
|
||||
this.txtContactContent.Text = data.ContactContent;
|
||||
this.txtResult.Text = data.Result;
|
||||
this.txtIntTime.Text = data.IntTime.HasValue ? string.Format("{0:yyyy-MM-dd}", data.IntTime) : "";
|
||||
this.txtOutTime.Text = data.OutTime.HasValue ? string.Format("{0:yyyy-MM-dd}", data.OutTime) : "";
|
||||
this.txtRemark.Text = data.Remark;
|
||||
}
|
||||
drpSubPlanCode.SelectedValue= driverSubPlanId;
|
||||
drpSubPlanCode_OnSelectedIndexChanged(null, null);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -70,47 +63,191 @@ namespace FineUIPro.Web.TestRun.DriverSub
|
||||
/// <param name="e"></param>
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.drpSubUnitId.SelectedValue == BLL.Const._Null)
|
||||
if (string.IsNullOrEmpty(drpSubPlanCode.SelectedValue) || drpSubPlanCode.SelectedValue == Const._Null)
|
||||
{
|
||||
Alert.ShowInTop("请选择开车分包单位!", MessageBoxIcon.Warning);
|
||||
ShowNotify("请选择分包计划!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
string id = Request.Params["id"];
|
||||
Model.DriverSub_DriverSubContact newData = new Model.DriverSub_DriverSubContact();
|
||||
newData.Code = this.txtCode.Text.Trim();
|
||||
if (this.drpSubUnitId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
newData.SubUnitId = this.drpSubUnitId.SelectedValue;
|
||||
}
|
||||
newData.ContactInfo = this.txtContactInfo.Text.Trim();
|
||||
newData.ChargeManInfo = this.txtChargeManInfo.Text.Trim();
|
||||
newData.ContactContent = this.txtContactContent.Text.Trim();
|
||||
newData.Result = this.txtResult.Text.Trim();
|
||||
newData.IntTime = Funs.GetNewDateTime(this.txtIntTime.Text.Trim());
|
||||
newData.OutTime = Funs.GetNewDateTime(this.txtOutTime.Text.Trim());
|
||||
newData.Remark = this.txtRemark.Text.Trim();
|
||||
newData.ProjectId = this.CurrUser.LoginProjectId;
|
||||
if (!string.IsNullOrEmpty(id))
|
||||
{
|
||||
newData.DriverSubContactId = id;
|
||||
BLL.DriverSubContactService.UpdateDriverSubContact(newData);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.hdId.Text))
|
||||
{
|
||||
newData.DriverSubContactId = this.hdId.Text.Trim();
|
||||
}
|
||||
else
|
||||
{
|
||||
newData.DriverSubContactId = SQLHelper.GetNewID(typeof(Model.DriverSub_DriverSubContact));
|
||||
this.hdId.Text = newData.DriverSubContactId;
|
||||
}
|
||||
BLL.DriverSubContactService.AddDriverSubContact(newData);
|
||||
}
|
||||
DriverSubContactService.DeleteDriverSubContactByDriverSubPlanId(drpSubPlanCode.SelectedValue);
|
||||
GridSave(drpCatalystLoading.Values,"1");
|
||||
GridSave(drpOven.Values,"2");
|
||||
GridSave(drpChemicalCleaning.Values,"3");
|
||||
GridSave(drpDrivingTeam.Values,"4");
|
||||
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
}
|
||||
|
||||
void GridSave(string[] DriverSubContractorsIdArray,string type )
|
||||
{
|
||||
string id = drpSubPlanCode.SelectedValue;
|
||||
foreach (var item in DriverSubContractorsIdArray)
|
||||
{
|
||||
Model.DriverSub_DriverSubContact newData = new Model.DriverSub_DriverSubContact();
|
||||
newData.DriverSubContactId = SQLHelper.GetNewID(typeof(Model.DriverSub_DriverSubContact));
|
||||
newData.ProjectId = this.CurrUser.LoginProjectId;
|
||||
newData.DriverSubPlanId = id;
|
||||
newData.DriverSubContractorsId = item;
|
||||
newData.SubcontractingType = type;
|
||||
BLL.DriverSubContactService.AddDriverSubContact(newData);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
void BindGrid(Grid grid, string type, string driverSubPlanId, string subUnitName)
|
||||
{
|
||||
//使用linq 查询DriverSub_DriverSubContact表 DriverSubPlanId下关联的分包经销商信息
|
||||
var q = from x in Funs.DB.DriverSub_DriverSubContractors
|
||||
where x.IsUse == true && x.SubcontractingType== type
|
||||
select x;
|
||||
if (!string.IsNullOrEmpty(subUnitName))
|
||||
{
|
||||
q = q.Where(x => x.SubUnitName.Contains(subUnitName));
|
||||
}
|
||||
int count = q.Count();
|
||||
q = q.Skip(grid.PageSize * grid.PageIndex).Take(grid.PageSize);
|
||||
grid.RecordCount= count;
|
||||
grid.DataSource = q;
|
||||
grid.DataBind();
|
||||
|
||||
}
|
||||
|
||||
#region 加载表格
|
||||
|
||||
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
||||
{
|
||||
BindGrid(Grid1,"1", drpSubPlanCode.SelectedValue, ttbSearch1.Text);
|
||||
}
|
||||
|
||||
protected void ttbSearch1_Trigger1Click(object sender, EventArgs e)
|
||||
{
|
||||
ttbSearch1.Text = String.Empty;
|
||||
ttbSearch1.ShowTrigger1 = false;
|
||||
BindGrid(Grid1, "1", drpSubPlanCode.SelectedValue, ttbSearch1.Text);
|
||||
}
|
||||
|
||||
protected void ttbSearch1_Trigger2Click(object sender, EventArgs e)
|
||||
{
|
||||
ttbSearch1.ShowTrigger1 = true;
|
||||
BindGrid(Grid1, "1", drpSubPlanCode.SelectedValue, ttbSearch1.Text);
|
||||
}
|
||||
|
||||
protected void Grid2_PageIndexChange(object sender, GridPageEventArgs e)
|
||||
{
|
||||
BindGrid(Grid2, "2", drpSubPlanCode.SelectedValue, ttbSearch2.Text);
|
||||
}
|
||||
|
||||
protected void ttbSearch2_Trigger1Click(object sender, EventArgs e)
|
||||
{
|
||||
ttbSearch2.Text = String.Empty;
|
||||
ttbSearch2.ShowTrigger1 = false;
|
||||
BindGrid(Grid2, "2", drpSubPlanCode.SelectedValue, ttbSearch2.Text);
|
||||
}
|
||||
|
||||
protected void ttbSearch2_Trigger2Click(object sender, EventArgs e)
|
||||
{
|
||||
ttbSearch2.ShowTrigger1 = true;
|
||||
BindGrid(Grid2, "2", drpSubPlanCode.SelectedValue, ttbSearch2.Text);
|
||||
}
|
||||
|
||||
protected void Grid3_PageIndexChange(object sender, GridPageEventArgs e)
|
||||
{
|
||||
|
||||
BindGrid(Grid3, "3", drpSubPlanCode.SelectedValue, ttbSearch3.Text);
|
||||
}
|
||||
|
||||
protected void ttbSearch3_Trigger1Click(object sender, EventArgs e)
|
||||
{
|
||||
ttbSearch3.Text = String.Empty;
|
||||
ttbSearch3.ShowTrigger1 = false;
|
||||
BindGrid(Grid3, "3", drpSubPlanCode.SelectedValue, ttbSearch3.Text);
|
||||
|
||||
}
|
||||
|
||||
protected void ttbSearch3_Trigger2Click(object sender, EventArgs e)
|
||||
{
|
||||
ttbSearch3.ShowTrigger1 = true;
|
||||
BindGrid(Grid3, "3", drpSubPlanCode.SelectedValue, ttbSearch3.Text);
|
||||
|
||||
}
|
||||
|
||||
protected void Grid4_PageIndexChange(object sender, GridPageEventArgs e)
|
||||
{
|
||||
BindGrid(Grid4, "4", drpSubPlanCode.SelectedValue, ttbSearch4.Text);
|
||||
}
|
||||
|
||||
protected void ttbSearch4_Trigger1Click(object sender, EventArgs e)
|
||||
{
|
||||
ttbSearch4.Text = String.Empty;
|
||||
ttbSearch4.ShowTrigger1 = false;
|
||||
BindGrid(Grid4, "4", drpSubPlanCode.SelectedValue, ttbSearch4.Text);
|
||||
}
|
||||
|
||||
protected void ttbSearch4_Trigger2Click(object sender, EventArgs e)
|
||||
{
|
||||
ttbSearch4.ShowTrigger1 = true;
|
||||
BindGrid(Grid4, "4", drpSubPlanCode.SelectedValue, ttbSearch4.Text);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 下拉列表事件
|
||||
|
||||
protected void drpSubPlanCode_OnSelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(drpSubPlanCode.SelectedValue)|| drpSubPlanCode.SelectedValue==Const._Null)
|
||||
{
|
||||
drpCatalystLoading.Hidden = true;
|
||||
drpOven.Hidden = true;
|
||||
drpChemicalCleaning.Hidden = true;
|
||||
drpDrivingTeam.Hidden = true;
|
||||
DriverSubName.SelectedValueArray=null;
|
||||
return;
|
||||
}
|
||||
var model = BLL.DriverSubPlanService.GetDriverSubPlanById(drpSubPlanCode.SelectedValue);
|
||||
if (model!=null)
|
||||
{
|
||||
BindGrid(Grid1, "1", drpSubPlanCode.SelectedValue, ttbSearch1.Text);
|
||||
BindGrid(Grid2, "2", drpSubPlanCode.SelectedValue, ttbSearch2.Text);
|
||||
BindGrid(Grid3, "3", drpSubPlanCode.SelectedValue, ttbSearch3.Text);
|
||||
BindGrid(Grid4, "4", drpSubPlanCode.SelectedValue, ttbSearch4.Text);
|
||||
this.DriverSubName.SelectedValueArray = model.DriverSubNames.Split(',');
|
||||
|
||||
|
||||
foreach (string item in DriverSubName.SelectedValueArray)
|
||||
{
|
||||
if (item.Contains("1"))
|
||||
{
|
||||
drpCatalystLoading.Hidden = false;
|
||||
drpCatalystLoading.Values = DriverSubContactService.GetDriverSubContactByDriverSubPlanId(drpSubPlanCode.SelectedValue)
|
||||
.Where(x => x.SubcontractingType == "1").Select(x => x.DriverSubContractorsId).ToArray();
|
||||
}
|
||||
else if (item.Contains("2"))
|
||||
{
|
||||
drpOven.Hidden = false;
|
||||
drpOven.Values = DriverSubContactService.GetDriverSubContactByDriverSubPlanId(drpSubPlanCode.SelectedValue)
|
||||
.Where(x => x.SubcontractingType == "2").Select(x => x.DriverSubContractorsId).ToArray();
|
||||
|
||||
}
|
||||
else if (item.Contains("3"))
|
||||
{
|
||||
drpChemicalCleaning.Hidden = false;
|
||||
drpChemicalCleaning.Values = DriverSubContactService.GetDriverSubContactByDriverSubPlanId(drpSubPlanCode.SelectedValue)
|
||||
.Where(x => x.SubcontractingType == "3").Select(x => x.DriverSubContractorsId).ToArray();
|
||||
|
||||
}
|
||||
else if (item.Contains("4"))
|
||||
{
|
||||
drpDrivingTeam.Hidden= false;
|
||||
drpDrivingTeam.Values = DriverSubContactService.GetDriverSubContactByDriverSubPlanId(drpSubPlanCode.SelectedValue)
|
||||
.Where(x => x.SubcontractingType == "4").Select(x => x.DriverSubContractorsId).ToArray();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user