/**
|
* OrderEdit.aspx.cs
|
*
|
* 功 能: 订单列表
|
* 类 名: OrderEdit
|
*
|
* Ver 变更日期 负责人 变更内容
|
* ───────────────────────────────────
|
* V0.01 2013-5-8 13:55 吴崎均 初版
|
* V0.02 2013-5-8 15:47 吴崎均 实现下拉数据绑定与数据级联
|
* V0.03 2013-5-8 18:00 吴崎均 初步完成新增线下订单(未调试)
|
*
|
*/
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Web;
|
using System.Web.UI;
|
using System.Web.UI.WebControls;
|
using CY.BLL.Sys;
|
using CY.BLL;
|
using CY.Model;
|
using CY.Infrastructure.Common;
|
using CY.WebForm.Pages.common;
|
using CY.BLL.EC;
|
using CY.Model.Inquiry;
|
|
namespace CY.WebForm.Pages.business
|
{
|
public partial class DeliverPlanWentiEdit : BasePage
|
{
|
public int Orderid = 0;
|
public int printNum = 0;
|
|
OA_CarManageBll _OA_CarManageBll = null;
|
OA_DeliverPlanPaicheBLL oA_DeliverPlanBLL = null;
|
OA_StaffBLL _OA_StaffBLL = null;
|
|
//初始化
|
public DeliverPlanWentiEdit()
|
{
|
|
|
_OA_CarManageBll = new OA_CarManageBll();
|
oA_DeliverPlanBLL = new OA_DeliverPlanPaicheBLL();
|
_OA_StaffBLL = new OA_StaffBLL();
|
|
|
}
|
|
/// <summary>
|
/// 页面加载事件
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
try
|
{
|
switch (Request["Target"])
|
{
|
case "GetCommunication":
|
LoadCommunication();
|
break;
|
case "wanjie":
|
AcceptAll();
|
return;
|
case "ReBindClients":
|
Response.Write(ReLoadClients());
|
break;
|
|
default:
|
Page_Load_Default();
|
return;
|
}
|
}
|
catch (Exception ex)
|
{
|
PAGEHandleException(ex);
|
Response.Clear();
|
//Response.Write("-1");
|
Response.Write(ex.Message);
|
}
|
Response.End();
|
}
|
|
|
/// <summary>
|
/// 批量受理订单
|
/// </summary>
|
public void AcceptAll()
|
{
|
|
|
var keyid = Request["keyid"].ToGuid2();
|
|
var oA_DeliverPlan = oA_DeliverPlanBLL.GetModelByKeyid(keyid, null, null);
|
|
if (oA_DeliverPlan != null)
|
{
|
if (oA_DeliverPlan.Wanjiestatus == 1)
|
{
|
JavaScript.MessageBox("订单已经完结", this, true, false);
|
return;
|
}
|
oA_DeliverPlan.Wanjiestatus = 1;
|
oA_DeliverPlan.Wanjieren = CurrentUser.ShortName;
|
oA_DeliverPlan.WanjieTime = DateTime.Now;
|
if (oA_DeliverPlanBLL.UpdateModel(oA_DeliverPlan))
|
{
|
JavaScript.MessageBox("操作成功", this, true, true);
|
return;
|
}
|
else
|
{
|
JavaScript.MessageBox("操作失败", this, true, false);
|
return;
|
}
|
|
}
|
|
|
}
|
|
|
/// <summary>
|
/// 默认执行方法
|
/// </summary>
|
private void Page_Load_Default()
|
{
|
|
|
|
if (!IsPostBack && !IsCallback)
|
{
|
|
this.selZerenren.DataSource = _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("全部", ""));
|
|
var keyid = Request["keyid"].ToGuid2();
|
var oA_DeliverPlan = oA_DeliverPlanBLL.GetModelByKeyid(keyid, null, null);
|
|
if (oA_DeliverPlan != null)
|
{
|
if (oA_DeliverPlan.Wanjiestatus == 1)
|
{
|
JavaScript.MessageBox("订单已经完结", this, true, false);
|
return;
|
}
|
|
spnwentifankui.InnerHtml = oA_DeliverPlan.wentifankui;
|
this.selZerenren.Value = oA_DeliverPlan.Zerenren.HasValue ? oA_DeliverPlan.Zerenren.Value.ToString() : "";
|
this.txtFakuan.Value = oA_DeliverPlan.Fakuan.HasValue ? oA_DeliverPlan.Fakuan.Value.ToString("F2") : "";
|
}
|
|
|
|
|
|
}
|
}
|
|
/// <summary>
|
/// 保存点击事件
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
protected void btnSave_ServerClick(object sender, EventArgs e)
|
{
|
|
if (SaveOrder())
|
{
|
//操作成功
|
JavaScript.MessageBox("操作成功", this, true,true);
|
}
|
else
|
{
|
//操作失败
|
JavaScript.MessageBox("操作失败", this);
|
}
|
}
|
|
|
|
|
|
/// <summary>
|
/// 加载客户联系方式
|
/// </summary>
|
private void LoadCommunication()
|
{
|
Response.Clear();
|
string id = Request["id"];
|
if (string.IsNullOrEmpty(id))
|
{
|
Response.Write("-2");
|
return;
|
}
|
|
OA_CorporateClientsBLL _oA_CorporateClientsBLL = new OA_CorporateClientsBLL();
|
OA_CorporateClients m_OA_CorporateClients = _oA_CorporateClientsBLL.SelectModelByFirmIdandMemberId(CurrentUser.MemberId, id.ToGuid2());
|
OA_CustomerCommunications _oA_CustomerCommunications = _oA_CorporateClientsBLL.GetModel_CustomerCommunications(m_OA_CorporateClients.Keyid);
|
_oA_CustomerCommunications.DegreeImportanId = m_OA_CorporateClients.DegreeImportanId;
|
_oA_CustomerCommunications.AccountManagerId = m_OA_CorporateClients.AccountManagerId;
|
_oA_CustomerCommunications.BusinessManagerId = m_OA_CorporateClients.BusinessManagerId;
|
_oA_CustomerCommunications.CompanyName = m_OA_CorporateClients.CompanyName;
|
Response.Write(null == _oA_CustomerCommunications ? "" : JsonHelper.GetJsonStringByObject(_oA_CustomerCommunications));
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
/// 保存订单
|
/// </summary>
|
private bool SaveOrder()
|
{
|
|
|
bool isWin = false;
|
try
|
{
|
var keyid = Request["keyid"].ToGuid2();
|
var oA_DeliverPlan = oA_DeliverPlanBLL.GetModelByKeyid(keyid, null, null);
|
|
if (oA_DeliverPlan != null)
|
{
|
oA_DeliverPlan.Zerenren = this.selZerenren.Value.ToInt32();
|
oA_DeliverPlan.Fakuan = this.txtFakuan.Value.Trim().ToDecimal2();
|
oA_DeliverPlan.Zerenoperater = CurrentUser.ShortName;
|
oA_DeliverPlan.ZerenTime = DateTime.Now;
|
}
|
|
isWin = oA_DeliverPlanBLL.UpdateModel(oA_DeliverPlan);
|
|
|
}
|
catch (Exception ex)
|
{
|
isWin = false;
|
}
|
|
|
|
|
|
return isWin;
|
}
|
|
|
|
/// <summary>
|
/// 重新加载客户列表
|
/// </summary>
|
/// <returns></returns>
|
private string ReLoadClients()
|
{
|
try
|
{
|
string res = "<option value=''>请选择</option>";
|
OA_CorporateClientsBLL bll_OA_CorporateClientsBLL = new OA_CorporateClientsBLL();
|
IList<OA_CorporateClients> m_OA_CorporateClientsList = bll_OA_CorporateClientsBLL.SelectListByFirmId(CurrentUser.MemberId) as IList<OA_CorporateClients>;
|
if (null != m_OA_CorporateClientsList)
|
{
|
m_OA_CorporateClientsList.Where(cc => CurrentUser.MemberId.Equals(cc.MemberId) && m_OA_CorporateClientsList.Remove(cc));
|
if (m_OA_CorporateClientsList.Count > 0)
|
{
|
foreach (var m_OA_CorporateClients in m_OA_CorporateClientsList)
|
{
|
res = res + ("<option value='" + m_OA_CorporateClients.MemberId + "'>" + m_OA_CorporateClients.CompanyName + "</option>");
|
}
|
}
|
}
|
return res;
|
}
|
catch (Exception ex)
|
{
|
PAGEHandleException(ex);
|
return "";
|
}
|
}
|
}
|
}
|