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; using CY.Infrastructure.Logging; using CY.SQLDAL; using CY.Model.OA; using System.Data.SqlClient; namespace CY.WebForm.Pages.business { public partial class DeliverPlanWentiList : BasePage { OA_DeliverPlanPaicheBLL _OA_DeliverPlanPaicheBLL = null; OA_StaffBLL bll_OA_StaffBLL = null; OA_CarManageBll _OA_CarManageBll = null; //初始化 public DeliverPlanWentiList() { _OA_DeliverPlanPaicheBLL = new OA_DeliverPlanPaicheBLL(); 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 "wanjie": AcceptAll(); break; case "AcceptOrderAll": 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.BF_IsDriver == true);//.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.selDriverIddo.DataSource = bll_OA_StaffBLL.SelectListByFirmId(CurrentUser.MemberId, null, null);//.Where(x => x.BF_IsDriver == true); this.selDriverIddo.DataTextField = "Name"; this.selDriverIddo.DataValueField = "Keyid"; this.selDriverIddo.DataBind(); this.selDriverIddo.Items.Insert(0, new ListItem("全部", "")); this.selZerenren.DataSource = bll_OA_StaffBLL.SelectListByFirmId(CurrentUser.MemberId, false, false); this.selZerenren.DataTextField = "Name"; this.selZerenren.DataValueField = "Keyid"; this.selZerenren.DataBind(); this.selZerenren.Items.Insert(0, new ListItem("全部", "")); this.selWanjiestatus.Value = "0"; } //分页事件 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(); } //绑定列表 private void BindList() { Pagination pa = new Pagination(); pa.PageSize = UCPager1.AspNetPager.PageSize; pa.PageIndex = UCPager1.AspNetPager.CurrentPageIndex; IEnumerable oA_DeliverPlans = _OA_DeliverPlanPaicheBLL.SelectModelPageWenti(pa, CurrentUser.MemberId, this.txtBeginDate.Value, this.txtEndDate.Value, this.selDriverIddo.Value, this.selZerenren.Value, this.txtCustormerName.Value.Trim(), this.selWanjiestatus.Value ); this.RepClientList.DataSource = oA_DeliverPlans; var sss = oA_DeliverPlans.Sum(x => x.Fakuan); this.heji.InnerText = sss.HasValue ? sss.Value.ToString("F2") : "0"; this.RepClientList.DataBind(); UCPager1.AspNetPager.RecordCount = pa.RecordCount; } /// /// 批量受理订单 /// public void AcceptAll() { var keyid = Request["keyid"].ToGuid2(); var oA_DeliverPlan = _OA_DeliverPlanPaicheBLL.GetModelByKeyid(keyid,null,null); if (oA_DeliverPlan != null) { if(oA_DeliverPlan.Wanjiestatus == 1) { JavaScript.MessageBox("订单已经完结", this, true, false); } oA_DeliverPlan.Wanjiestatus = 1; oA_DeliverPlan.Wanjieren = CurrentUser.ShortName; oA_DeliverPlan.WanjieTime = DateTime.Now; if (_OA_DeliverPlanPaicheBLL.UpdateModel(oA_DeliverPlan)) { JavaScript.MessageBox("操作成功", this, true, true); } else { JavaScript.MessageBox("操作失败", this, true, false); } } } /// /// 批量派车 /// public void AcceptAll2() { Response.Clear(); string ids = string.Empty; if (Request["ids"] != null) { ids = Request["ids"].ToString(); } string[] idsArray = ids.Split(','); if (idsArray != null && idsArray.Length > 0) { for (int i = 0; i < idsArray.Length; i++) { bool result = true; OA_DeliverPlan oA_DeliverPlan = _OA_DeliverPlanPaicheBLL.GetModelByKeyid(idsArray[i].ToGuid2(), null, null); if (oA_DeliverPlan != null) { oA_DeliverPlan.wentifankui = ""; oA_DeliverPlan.LastUpdateTime = DateTime.Now; oA_DeliverPlan.Updater = CurrentUser.TrueMemberId; result = _OA_DeliverPlanPaicheBLL.UpdateModel(oA_DeliverPlan); } if (!result) { // BindList(); Response.Write("-2"); return; } } } //BindList(); Response.Write("1"); } } }