using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Web;
|
using System.Web.UI;
|
using System.Web.UI.WebControls;
|
using CY.BLL;
|
using CY.Model;
|
using CY.Infrastructure.Query;
|
using CY.Infrastructure.Common;
|
using CY.BLL.Sys;
|
using CY.BLL.OA;
|
using CY.BLL.EC;
|
using CY.BLL.Inquiry;
|
using CY.Model.Inquiry;
|
using System.Drawing;
|
|
namespace CY.WebForm.Pages.business
|
{
|
public partial class DeliverPlanList : BasePage
|
{
|
|
OA_DeliverPlanBLL _OA_DeliverPlanBLL = null;
|
OA_StaffBLL bll_OA_StaffBLL = null;
|
OA_CarManageBll _OA_CarManageBll = null;
|
|
|
|
//初始化
|
public DeliverPlanList()
|
{
|
|
_OA_DeliverPlanBLL = new OA_DeliverPlanBLL();
|
bll_OA_StaffBLL = new OA_StaffBLL();
|
_OA_CarManageBll = new OA_CarManageBll();
|
|
}
|
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
UCPager1.AspNetPager.PageChanged += AspNetPager1_PageChanged;
|
if (!IsPostBack)
|
{
|
|
|
|
switch (Request["Target"])
|
{
|
|
case "AcceptOrderAll":
|
AcceptAll();
|
break;
|
case "AcceptOrderAll2":
|
AcceptAll2();
|
break;
|
default:
|
InitialSelectData();
|
BindList();
|
return;
|
}
|
Response.End();
|
}
|
}
|
|
|
//加载查询条件
|
protected void InitialSelectData()
|
{
|
this.selDriverId.DataSource = bll_OA_StaffBLL.SelectListByFirmId(CurrentUser.MemberId, null, null).Where(x => x.SM_Post.Equals("驾驶员")) ;
|
this.selDriverId.DataTextField = "Name";
|
this.selDriverId.DataValueField = "Keyid";
|
this.selDriverId.DataBind();
|
this.selDriverId.Items.Insert(0, new ListItem("全部", ""));
|
|
this.selCarId.DataSource = _OA_CarManageBll.SelectListByFirmId(CurrentUser.MemberId);
|
this.selCarId.DataTextField = "CarNumber";
|
this.selCarId.DataValueField = "Keyid";
|
this.selCarId.DataBind();
|
this.selCarId.Items.Insert(0, new ListItem("全部", ""));
|
|
|
this.selDriverIddo.DataSource = bll_OA_StaffBLL.SelectListByFirmId(CurrentUser.MemberId, null, null).Where(x => x.SM_Post.Equals("驾驶员"));
|
this.selDriverIddo.DataTextField = "Name";
|
this.selDriverIddo.DataValueField = "Keyid";
|
this.selDriverIddo.DataBind();
|
this.selDriverIddo.Items.Insert(0, new ListItem("全部", ""));
|
|
this.selCarIddo.DataSource = _OA_CarManageBll.SelectListByFirmId(CurrentUser.MemberId);
|
this.selCarIddo.DataTextField = "CarNumber";
|
this.selCarIddo.DataValueField = "Keyid";
|
this.selCarIddo.DataBind();
|
this.selCarIddo.Items.Insert(0, new ListItem("全部", ""));
|
|
this.Button0.Text = "逾期";
|
this.Button1.Text = DateTime.Now.ToString("yyyy-MM-dd");
|
this.Button2.Text = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd");
|
this.Button3.Text = DateTime.Now.AddDays(2).ToString("yyyy-MM-dd");
|
this.Button4.Text = DateTime.Now.AddDays(3).ToString("yyyy-MM-dd");
|
this.Button5.Text = DateTime.Now.AddDays(4).ToString("yyyy-MM-dd");
|
this.Button6.Text = DateTime.Now.AddDays(5).ToString("yyyy-MM-dd");
|
this.Button7.Text = DateTime.Now.AddDays(6).ToString("yyyy-MM-dd");
|
|
|
//this.DriverId.DataSource = bll_OA_StaffBLL.SelectListByFirmId(CurrentUser.MemberId, null, null).Where(x => x.SM_Post.Equals("驾驶员"));
|
//this.DriverId.DataTextField = "Name";
|
//this.DriverId.DataValueField = "Keyid";
|
//this.DriverId.DataBind();
|
//this.DriverId.Items.Insert(0, new ListItem("请选择", ""));
|
|
//this.CarId.DataSource = _OA_CarManageBll.SelectListByFirmId(CurrentUser.MemberId);
|
//this.CarId.DataTextField = "CarNumber";
|
//this.CarId.DataValueField = "Keyid";
|
//this.CarId.DataBind();
|
//this.CarId.Items.Insert(0, new ListItem("请选择", ""));
|
|
}
|
|
//分页事件
|
protected void AspNetPager1_PageChanged(object src, EventArgs e)
|
{
|
BindList();
|
}
|
|
//查询事件
|
protected void btn_Search_Click(object sender, EventArgs e)
|
{
|
BindList();
|
}
|
protected void btn_Search_Click0(object sender, EventArgs e)
|
{
|
|
this.txtDeliveryTime.Value = this.Button0.Text;
|
|
BindList();
|
}
|
|
protected void btn_Search_Click1(object sender, EventArgs e)
|
{
|
|
this.txtDeliveryTime.Value = this.Button1.Text;
|
|
BindList();
|
}
|
protected void btn_Search_Click2(object sender, EventArgs e)
|
{
|
|
this.txtDeliveryTime.Value = this.Button2.Text;
|
|
BindList();
|
}
|
protected void btn_Search_Click3(object sender, EventArgs e)
|
{
|
|
this.txtDeliveryTime.Value = this.Button3.Text;
|
|
BindList();
|
}
|
protected void btn_Search_Click4(object sender, EventArgs e)
|
{
|
|
this.txtDeliveryTime.Value = this.Button4.Text;
|
|
BindList();
|
}
|
protected void btn_Search_Click5(object sender, EventArgs e)
|
{
|
|
this.txtDeliveryTime.Value = this.Button5.Text;
|
|
BindList();
|
}
|
protected void btn_Search_Click6(object sender, EventArgs e)
|
{
|
|
this.txtDeliveryTime.Value = this.Button6.Text;
|
|
BindList();
|
}
|
protected void btn_Search_Click7(object sender, EventArgs e)
|
{
|
|
this.txtDeliveryTime.Value = this.Button7.Text;
|
|
BindList();
|
}
|
|
//绑定列表
|
private void BindList()
|
{
|
//EC_OrderBLL eC_OrderBLL = new EC_OrderBLL();
|
//Pagination pa1 = new Pagination();
|
//pa1.PageSize = 1000;
|
//pa1.PageIndex = 1;
|
//IEnumerable<OA_DeliverPlan> oA_DeliverPlans1 = eC_OrderBLL.GetshoukuantixingList(pa1,CurrentUser.MemberId, "", "", "", "", "", "", "");
|
|
|
if (this.txtDeliveryTime.Value == "")
|
{
|
this.txtDeliveryTime.Value = this.Button1.Text;
|
}
|
if(this.txtDeliveryTime.Value == this.Button1.Text)
|
{
|
this.Button1.BorderColor = Color.Black;
|
this.Button2.BorderColor = Color.LightBlue;
|
this.Button3.BorderColor = Color.LightBlue;
|
this.Button4.BorderColor = Color.LightBlue;
|
this.Button5.BorderColor = Color.LightBlue;
|
this.Button6.BorderColor = Color.LightBlue;
|
this.Button7.BorderColor = Color.LightBlue;
|
this.Button0.BorderColor = Color.LightBlue;
|
}
|
else if (this.txtDeliveryTime.Value == this.Button2.Text)
|
{
|
this.Button2.BorderColor = Color.Black;
|
this.Button1.BorderColor = Color.LightBlue;
|
this.Button3.BorderColor = Color.LightBlue;
|
this.Button4.BorderColor = Color.LightBlue;
|
this.Button5.BorderColor = Color.LightBlue;
|
this.Button6.BorderColor = Color.LightBlue;
|
this.Button7.BorderColor = Color.LightBlue;
|
this.Button0.BorderColor = Color.LightBlue;
|
}
|
else if (this.txtDeliveryTime.Value == this.Button3.Text)
|
{
|
this.Button3.BorderColor = Color.Black;
|
this.Button2.BorderColor = Color.LightBlue;
|
this.Button1.BorderColor = Color.LightBlue;
|
this.Button4.BorderColor = Color.LightBlue;
|
this.Button5.BorderColor = Color.LightBlue;
|
this.Button6.BorderColor = Color.LightBlue;
|
this.Button7.BorderColor = Color.LightBlue;
|
this.Button0.BorderColor = Color.LightBlue;
|
}
|
else if (this.txtDeliveryTime.Value == this.Button4.Text)
|
{
|
this.Button4.BorderColor = Color.Black;
|
this.Button2.BorderColor = Color.LightBlue;
|
this.Button3.BorderColor = Color.LightBlue;
|
this.Button1.BorderColor = Color.LightBlue;
|
this.Button5.BorderColor = Color.LightBlue;
|
this.Button6.BorderColor = Color.LightBlue;
|
this.Button7.BorderColor = Color.LightBlue;
|
this.Button0.BorderColor = Color.LightBlue;
|
}
|
else if (this.txtDeliveryTime.Value == this.Button5.Text)
|
{
|
this.Button5.BorderColor = Color.Black;
|
this.Button2.BorderColor = Color.LightBlue;
|
this.Button3.BorderColor = Color.LightBlue;
|
this.Button4.BorderColor = Color.LightBlue;
|
this.Button1.BorderColor = Color.LightBlue;
|
this.Button6.BorderColor = Color.LightBlue;
|
this.Button7.BorderColor = Color.LightBlue;
|
this.Button0.BorderColor = Color.LightBlue;
|
}
|
else if (this.txtDeliveryTime.Value == this.Button6.Text)
|
{
|
this.Button6.BorderColor = Color.Black;
|
this.Button2.BorderColor = Color.LightBlue;
|
this.Button3.BorderColor = Color.LightBlue;
|
this.Button4.BorderColor = Color.LightBlue;
|
this.Button5.BorderColor = Color.LightBlue;
|
this.Button1.BorderColor = Color.LightBlue;
|
this.Button7.BorderColor = Color.LightBlue;
|
this.Button0.BorderColor = Color.LightBlue;
|
}
|
else if (this.txtDeliveryTime.Value == this.Button7.Text)
|
{
|
this.Button7.BorderColor = Color.Black;
|
this.Button2.BorderColor = Color.LightBlue;
|
this.Button3.BorderColor = Color.LightBlue;
|
this.Button4.BorderColor = Color.LightBlue;
|
this.Button5.BorderColor = Color.LightBlue;
|
this.Button6.BorderColor = Color.LightBlue;
|
this.Button1.BorderColor = Color.LightBlue;
|
this.Button0.BorderColor = Color.LightBlue;
|
}
|
else if (this.txtDeliveryTime.Value == this.Button0.Text)
|
{
|
this.Button0.BorderColor = Color.Black;
|
this.Button2.BorderColor = Color.LightBlue;
|
this.Button3.BorderColor = Color.LightBlue;
|
this.Button4.BorderColor = Color.LightBlue;
|
this.Button5.BorderColor = Color.LightBlue;
|
this.Button6.BorderColor = Color.LightBlue;
|
this.Button1.BorderColor = Color.LightBlue;
|
this.Button7.BorderColor = Color.LightBlue;
|
}
|
|
|
Pagination pa = new Pagination();
|
pa.PageSize = UCPager1.AspNetPager.PageSize;
|
pa.PageIndex = UCPager1.AspNetPager.CurrentPageIndex;
|
|
IEnumerable<OA_DeliverPlan> oA_DeliverPlans = _OA_DeliverPlanBLL.SelectModelPage(pa,
|
CurrentUser.MemberId,
|
this.txtDeliveryTime.Value,
|
this.selCarId.Value,
|
this.selDriverId.Value
|
);
|
|
|
|
|
this.RepClientList.DataSource = oA_DeliverPlans;
|
|
|
|
this.RepClientList.DataBind();
|
UCPager1.AspNetPager.RecordCount = pa.RecordCount;
|
}
|
|
/// <summary>
|
/// 批量受理订单
|
/// </summary>
|
public void AcceptAll()
|
{
|
Response.Clear();
|
|
string ids = string.Empty;
|
string DeliverTimes = string.Empty;
|
string BuyerIds = string.Empty;
|
if (Request["ids"] != null)
|
{
|
ids = Request["ids"].ToString();
|
}
|
if (Request["DeliverTimes"] != null)
|
{
|
DeliverTimes = Request["DeliverTimes"].ToString();
|
}
|
if (Request["BuyerIds"] != null)
|
{
|
BuyerIds = Request["BuyerIds"].ToString();
|
}
|
|
string[] idsArray = ids.Split(',');
|
string[] DeliverTimesArray = DeliverTimes.Split(',');
|
string[] BuyerIdsArray = BuyerIds.Split(',');
|
|
if(idsArray!=null&& idsArray.Length > 0)
|
{
|
for(int i = 0; i < idsArray.Length; i++)
|
{
|
bool result = true;
|
|
OA_DeliverPlan oA_DeliverPlan = _OA_DeliverPlanBLL.GetModelByKeyid(idsArray[i].ToGuid2(), BuyerIdsArray[i].ToGuid2(), DeliverTimesArray[i].ToDateTime2());
|
if (oA_DeliverPlan == null)
|
{
|
oA_DeliverPlan = new OA_DeliverPlan();
|
oA_DeliverPlan.Keyid = Guid.NewGuid();
|
oA_DeliverPlan.FirmId = CurrentUser.MemberId;
|
oA_DeliverPlan.DeliverTime = DeliverTimesArray[i].ToDateTime2();
|
oA_DeliverPlan.BuyerId = BuyerIdsArray[i].ToGuid2();
|
oA_DeliverPlan.DeliveredTime = null;
|
oA_DeliverPlan.Zhuyishixiang = "";
|
oA_DeliverPlan.Gongzuokaoping = "";
|
oA_DeliverPlan.CarId = 0;
|
oA_DeliverPlan.DriverId = 0;
|
oA_DeliverPlan.Transferstatus = 2;
|
oA_DeliverPlan.TransfersTime = DateTime.Now;
|
oA_DeliverPlan.Sort = 1;
|
oA_DeliverPlan.Creater = CurrentUser.TrueMemberId;
|
oA_DeliverPlan.CreateTime = DateTime.Now;
|
oA_DeliverPlan.Updater = CurrentUser.TrueMemberId;
|
oA_DeliverPlan.LastUpdateTime = DateTime.Now;
|
oA_DeliverPlan.wentifankui = "";
|
result = _OA_DeliverPlanBLL.InsertModel(oA_DeliverPlan);
|
}
|
else
|
{
|
oA_DeliverPlan.Transferstatus = 2;
|
oA_DeliverPlan.TransfersTime = DateTime.Now;
|
result = _OA_DeliverPlanBLL.UpdateModel(oA_DeliverPlan);
|
}
|
if (!result)
|
{
|
//BindList();
|
Response.Write("-2");
|
return;
|
}
|
}
|
}
|
// BindList();
|
Response.Write("1");
|
|
|
|
}
|
|
|
/// <summary>
|
/// 批量派车
|
/// </summary>
|
public void AcceptAll2()
|
{
|
Response.Clear();
|
int? carid = Request["CarId"].ToInt32(); //this.CarId.Value.ToGuid2();
|
int? driverId = Request["DriverId"].ToInt32(); //this.DriverId.Value.ToGuid2();
|
string ids = string.Empty;
|
string DeliverTimes = string.Empty;
|
string BuyerIds = string.Empty;
|
if (Request["ids"] != null)
|
{
|
ids = Request["ids"].ToString();
|
}
|
if (Request["DeliverTimes"] != null)
|
{
|
DeliverTimes = Request["DeliverTimes"].ToString();
|
}
|
if (Request["BuyerIds"] != null)
|
{
|
BuyerIds = Request["BuyerIds"].ToString();
|
}
|
|
string[] idsArray = ids.Split(',');
|
string[] DeliverTimesArray = DeliverTimes.Split(',');
|
string[] BuyerIdsArray = BuyerIds.Split(',');
|
|
if (idsArray != null && idsArray.Length > 0)
|
{
|
for (int i = 0; i < idsArray.Length; i++)
|
{
|
bool result = true;
|
|
OA_DeliverPlan oA_DeliverPlan = _OA_DeliverPlanBLL.GetModelByKeyid(idsArray[i].ToGuid2(), BuyerIdsArray[i].ToGuid2(), DeliverTimesArray[i].ToDateTime2());
|
if (oA_DeliverPlan == null)
|
{
|
oA_DeliverPlan = new OA_DeliverPlan();
|
oA_DeliverPlan.Keyid = Guid.NewGuid();
|
oA_DeliverPlan.FirmId = CurrentUser.MemberId;
|
oA_DeliverPlan.DeliverTime = DeliverTimesArray[i].ToDateTime2();
|
oA_DeliverPlan.BuyerId = BuyerIdsArray[i].ToGuid2();
|
oA_DeliverPlan.DeliveredTime = null;
|
oA_DeliverPlan.Zhuyishixiang = "";
|
oA_DeliverPlan.Gongzuokaoping = "";
|
oA_DeliverPlan.CarId = carid;
|
oA_DeliverPlan.DriverId = driverId;
|
oA_DeliverPlan.Transferstatus = 1;
|
oA_DeliverPlan.TransfersTime = null;
|
oA_DeliverPlan.Sort = 1;
|
oA_DeliverPlan.Creater = CurrentUser.TrueMemberId;
|
oA_DeliverPlan.CreateTime = DateTime.Now;
|
oA_DeliverPlan.Updater = CurrentUser.TrueMemberId;
|
oA_DeliverPlan.LastUpdateTime = DateTime.Now;
|
oA_DeliverPlan.wentifankui = "";
|
result = _OA_DeliverPlanBLL.InsertModel(oA_DeliverPlan);
|
}
|
else
|
{
|
oA_DeliverPlan.CarId = carid;
|
oA_DeliverPlan.DriverId = driverId;
|
result = _OA_DeliverPlanBLL.UpdateModel(oA_DeliverPlan);
|
}
|
if (!result)
|
{
|
// BindList();
|
Response.Write("-2");
|
return;
|
}
|
}
|
}
|
//BindList();
|
Response.Write("1");
|
|
|
|
}
|
}
|
}
|