/**
|
* ShejiOrderDeatil.aspx.cs
|
*
|
* 功 能: 订单详情
|
* 类 名: ShejiOrderDeatil
|
*
|
* Ver 变更日期 负责人 变更内容
|
* ───────────────────────────────────
|
* V0.01 2013-4-24 13:25 吴崎均 初版
|
* V0.02 2013-5-15 18:23 吴崎均 编辑界面样式
|
* V0.03 2013-5-15 15:58 吴崎均 完成数据获取
|
* V0.04 2013-5-21 14:38 吴崎均 增加订单进度
|
* V0.05 2013-5-23 9:33 吴崎均 修改继承类为默认类Page使显示信息不受登录控制
|
*
|
*
|
*
|
*
|
*
|
*
|
*/
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Web;
|
using System.Web.UI;
|
using System.Web.UI.WebControls;
|
using CY.BLL.EC;
|
using CY.Infrastructure.Common;
|
using CY.Model;
|
using CY.BLL;
|
using CY.Model.Inquiry;
|
using CY.BLL.Sys;
|
using CY.SQLDAL;
|
using System.Data.SqlClient;
|
|
namespace CY.WebForm.Pages.business
|
{
|
/// <summary>
|
/// 订单详情
|
/// </summary>
|
public partial class ShejiOrderDeatil : BasePage
|
{
|
EC_OrderBasicBLL _eC_OrderBasicBLL = new EC_OrderBasicBLL();
|
Sys_DictionaryBLL _sys_DictionaryBLL = new Sys_DictionaryBLL();//字典业务逻辑操作类对象
|
public int ContractCount = 0;
|
public string BuyerId = "";
|
OA_StaffBLL bll_OA_StaffBLL = new OA_StaffBLL();
|
public int neiyeshu = 1;
|
/// <summary>
|
/// 页面加载事件
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
try
|
{
|
switch (Request["Target"])
|
{
|
case "GetCommunication":
|
break;
|
case "print":
|
int orderId = Request["orderIdStr"].ToString().ToInt32().Value;
|
UpdatePrintState(orderId);
|
break;
|
case "Printfengqian":
|
int orderIds = Request["orderIdStr"].ToString().ToInt32().Value;
|
UpdatePrintfengqianState(orderIds);
|
break;
|
default:
|
Page_Load_Default();
|
return;
|
}
|
}
|
catch (Exception ex)
|
{
|
PAGEHandleException(ex);
|
Response.Clear();
|
Response.Write("-1");
|
}
|
Response.End();
|
}
|
|
/// <summary>
|
/// 默认加载事件方法
|
/// </summary>
|
private void Page_Load_Default()
|
{
|
LoadOrderInfo();
|
}
|
|
/// <summary>
|
/// 加载订单信息
|
/// </summary>
|
private bool LoadOrderInfo()
|
{
|
string orderIdStr = Request["orderId"];
|
this.hideOrderId.Value = orderIdStr;
|
if (string.IsNullOrEmpty(orderIdStr))
|
{
|
CY.WebForm.BasePage.JavaScript.MessageBox("未传递参数!", this);
|
return false;
|
}
|
int? orderId = MyConvert.ConvertToInt32(orderIdStr);
|
if (!orderId.HasValue)
|
{
|
CY.WebForm.BasePage.JavaScript.MessageBox("未传递参数!", this);
|
return false;
|
}
|
|
EC_OrderBasic eC_OrderBasic = _eC_OrderBasicBLL.SelectModelById(orderId.Value);
|
if (null == eC_OrderBasic)
|
{
|
CY.WebForm.BasePage.JavaScript.MessageBox("数据不存在!", this);
|
return false;
|
}
|
//if (CurrentUser.MemberId!=Guid.Parse(UtilConst.AdminFirmId)&&_eC_OrderBasic.BuyerId != CurrentUser.MemberId && _eC_OrderBasic.SellerId != CurrentUser.MemberId)
|
//{
|
// CY.WebForm.BasePage.JavaScript.MessageBox("数据不存在!", this);
|
// return false;
|
//}
|
EC_AcceptWayByOrderBLL _eC_AcceptWayByOrderBLL = new EC_AcceptWayByOrderBLL();
|
EC_AcceptWayByOrder _eC_AcceptWayByOrder = _eC_AcceptWayByOrderBLL.GetModelByTargetId(orderId.Value);
|
if (null == _eC_AcceptWayByOrder)
|
{
|
CY.WebForm.BasePage.JavaScript.MessageBox("数据不存在!", this);
|
return false;
|
}
|
|
if (eC_OrderBasic.OrderExtend.NumPerBag == "NaN")
|
{
|
eC_OrderBasic.OrderExtend.NumPerBag = "";
|
}
|
if (eC_OrderBasic.OrderExtend.BagNum == "NaN")
|
{
|
eC_OrderBasic.OrderExtend.BagNum = "";
|
}
|
|
_eC_AcceptWayByOrder.NumPerBag = eC_OrderBasic.OrderExtend.NumPerBag;
|
_eC_AcceptWayByOrder.BagNum = eC_OrderBasic.OrderExtend.BagNum;
|
|
EC_OrderPrintParameterBLL _eC_OrderPrintParameterBLL = new EC_OrderPrintParameterBLL();
|
EC_OrderPrintParameter _eC_OrderPrintParameter = _eC_OrderPrintParameterBLL.GetModel(orderId.Value);
|
InquiryCommonModel _inquiryCommonModel = null;
|
if (null == _eC_OrderPrintParameter)
|
{
|
_inquiryCommonModel = new InquiryCommonModel();
|
}
|
else
|
{
|
_inquiryCommonModel = SerializationHelper.DeSerialize(typeof(InquiryCommonModel), _eC_OrderPrintParameter.PrintParameter) as InquiryCommonModel;
|
|
}
|
Sys_DictionaryBLL sys_DictionaryBLL = new Sys_DictionaryBLL();
|
_inquiryCommonModel.DeliveryModeName = sys_DictionaryBLL.GetModelByKeyid(_eC_AcceptWayByOrder.AcceptTypeId);
|
_inquiryCommonModel.BillModeName = _eC_AcceptWayByOrder.InvoiceDemand;
|
if (_inquiryCommonModel.PrintTypeId == 13)
|
{
|
_inquiryCommonModel.PrintDemand = _inquiryCommonModel.PrintCountName + "," + _inquiryCommonModel.PrintDemand;
|
}
|
var sys_Dictionarie = _sys_DictionaryBLL.GetDataByType("印刷单位").FirstOrDefault(x=>x.MeanValue == _inquiryCommonModel.Unit);
|
if (sys_Dictionarie != null)
|
{
|
eC_OrderBasic.UnitName = sys_Dictionarie.Name;
|
}
|
BuyerId = eC_OrderBasic.BuyerId.ToString();
|
//查询客户是否有合同
|
Database DC = new Database();
|
try
|
{
|
|
string sqlStr = string.Format("select count(*) from [dbo].[OA_CorporateClientContract] where CorporateClientsid='{0}'", eC_OrderBasic.BuyerId);
|
SqlCommand myCmd = new SqlCommand(sqlStr, DC.Connection);
|
ContractCount = (int)myCmd.ExecuteScalar();
|
}
|
catch (Exception)
|
{
|
|
ContractCount = 0;
|
}
|
finally
|
{
|
if (DC.Connection.State != System.Data.ConnectionState.Closed)
|
DC.Connection.Close();
|
}
|
|
|
|
if (eC_OrderBasic.BusinessManagerId.HasValue && eC_OrderBasic.BusinessManagerId.Value > 0)
|
{
|
var oA_Staff = bll_OA_StaffBLL.GetModelByKeyid(eC_OrderBasic.BusinessManagerId);
|
if (oA_Staff != null)
|
{
|
eC_OrderBasic.BusinessManager = oA_Staff.Name;
|
}
|
}
|
// PageAllMoney +=( eC_OrderBasic.ShejiSumPrice.Value + eC_OrderBasic.ShejiSumPriceneiye.Value);
|
if (eC_OrderBasic.ShejiSumPrice.HasValue && eC_OrderBasic.ShejiSumPrice.Value > 0)
|
{
|
eC_OrderBasic.Shejiticheng = eC_OrderBasic.ShejirenyuanName + eC_OrderBasic.Shejicount + "*" + (eC_OrderBasic.ShejiUnitPrice.HasValue ? eC_OrderBasic.ShejiUnitPrice.Value.ToString("G29") : "0") + "=" + (eC_OrderBasic.ShejiSumPrice.HasValue ? eC_OrderBasic.ShejiSumPrice.Value.ToString("G29") : "0");
|
}
|
|
if (eC_OrderBasic.PrintTypeId == 15 || eC_OrderBasic.PrintTypeId == 38)
|
{
|
if (eC_OrderBasic.ShejiSumPriceneiye.HasValue && eC_OrderBasic.ShejiSumPriceneiye.Value > 0)
|
{
|
eC_OrderBasic.Shejiticheng += "<br/> " + eC_OrderBasic.ShejirenyuanNameneiye + eC_OrderBasic.Shejicountneiye + "*" + (eC_OrderBasic.ShejiUnitPriceneiye.HasValue ? eC_OrderBasic.ShejiUnitPriceneiye.Value.ToString("G29") : "0") + "=" + (eC_OrderBasic.ShejiSumPriceneiye.HasValue ? eC_OrderBasic.ShejiSumPriceneiye.Value.ToString("G29") : "0");
|
}
|
|
}
|
eC_OrderBasic.Shejicountneiyename = (eC_OrderBasic.Shejicountneiye.HasValue && eC_OrderBasic.Shejicountneiye.Value > 0) ? eC_OrderBasic.Shejicountneiye.Value.ToString() : "";
|
if (eC_OrderBasic.PrintTypeId == 6)
|
{
|
if (eC_OrderBasic.ShejiSumPriceneiye.HasValue && eC_OrderBasic.ShejiSumPriceneiye.Value > 0)
|
{
|
eC_OrderBasic.Shejiticheng += "<br/> " + eC_OrderBasic.ShejirenyuanNameneiye + eC_OrderBasic.Shejicountneiye + "*" + (eC_OrderBasic.ShejiUnitPriceneiye.HasValue ? eC_OrderBasic.ShejiUnitPriceneiye.Value.ToString("G29") : "0") + "=" + (eC_OrderBasic.ShejiSumPriceneiye.HasValue ? eC_OrderBasic.ShejiSumPriceneiye.Value.ToString("G29") : "0");
|
}
|
|
|
if (!string.IsNullOrEmpty(eC_OrderBasic.ShejileixingNameneiye1))
|
{
|
if (eC_OrderBasic.ShejiSumPriceneiye1.HasValue && eC_OrderBasic.ShejiSumPriceneiye1.Value > 0)
|
{
|
eC_OrderBasic.Shejiticheng += "<br/> " + eC_OrderBasic.ShejirenyuanNameneiye1 + eC_OrderBasic.Shejicountneiye1 + "*" + (eC_OrderBasic.ShejiUnitPriceneiye1.HasValue ? eC_OrderBasic.ShejiUnitPriceneiye1.Value.ToString("G29") : "0") + "=" + (eC_OrderBasic.ShejiSumPriceneiye1.HasValue ? eC_OrderBasic.ShejiSumPriceneiye1.Value.ToString("G29") : "0");
|
}
|
|
}
|
if (!string.IsNullOrEmpty(eC_OrderBasic.ShejileixingNameneiye2))
|
{
|
if (eC_OrderBasic.ShejiSumPriceneiye2.HasValue && eC_OrderBasic.ShejiSumPriceneiye2.Value > 0)
|
{
|
eC_OrderBasic.Shejiticheng += "<br/> " + eC_OrderBasic.ShejirenyuanNameneiye2 + eC_OrderBasic.Shejicountneiye2 + "*" + (eC_OrderBasic.ShejiUnitPriceneiye2.HasValue ? eC_OrderBasic.ShejiUnitPriceneiye2.Value.ToString("G29") : "0") + "=" + (eC_OrderBasic.ShejiSumPriceneiye2.HasValue ? eC_OrderBasic.ShejiSumPriceneiye2.Value.ToString("G29") : "0");
|
}
|
|
}
|
|
|
int Shejicountneiyecount = 0;
|
if (eC_OrderBasic.Shejicountneiye.HasValue)
|
{
|
Shejicountneiyecount += eC_OrderBasic.Shejicountneiye.Value;
|
}
|
if (eC_OrderBasic.Shejicountneiye1.HasValue)
|
{
|
Shejicountneiyecount += eC_OrderBasic.Shejicountneiye1.Value;
|
}
|
if (eC_OrderBasic.Shejicountneiye2.HasValue)
|
{
|
Shejicountneiyecount += eC_OrderBasic.Shejicountneiye2.Value;
|
}
|
|
eC_OrderBasic.Shejicountneiyename = Shejicountneiyecount.ToString();
|
}
|
|
|
if(eC_OrderBasic.PrintTypeId == 6)
|
{
|
if (_inquiryCommonModel.InquiryInsideList != null)
|
{
|
neiyeshu = _inquiryCommonModel.InquiryInsideList.Count;
|
}
|
}
|
|
|
rptOrder.DataSource = new List<EC_OrderBasic>() { eC_OrderBasic };
|
rptOrder.DataBind();
|
rptAccpteWay.DataSource = "自提".Equals(_inquiryCommonModel.DeliveryModeName) ? null : new List<EC_AcceptWayByOrder>() { _eC_AcceptWayByOrder };
|
rptAccpteWay.DataBind();
|
rptInquiryCommon.DataSource = new List<InquiryCommonModel>() { _inquiryCommonModel };
|
rptInquiryCommon.DataBind();
|
|
this.lblRemark.Text = eC_OrderBasic.Remark;
|
this.lblPrintPackDeliveryRequir.Text = eC_OrderBasic.PrintPackDeliveryRequir;
|
return true;
|
}
|
|
/// <summary>
|
/// 改变打印状态
|
/// </summary>
|
private void UpdatePrintState(int orderId)
|
{
|
EC_OrderBasic _eC_OrderBasic = _eC_OrderBasicBLL.SelectModelById(orderId);
|
if (CurrentUser != null)
|
{
|
var originalGuid = CurrentUser.MemberId;
|
Guid reversedGuid = new Guid(originalGuid.ToByteArray().Reverse().ToArray());
|
//当是卖家时改变打印状态
|
if (reversedGuid == _eC_OrderBasic.SellerId)
|
{
|
_eC_OrderBasicBLL.UpdatePrintState(orderId);
|
}
|
}
|
}
|
|
|
/// <summary>
|
/// 改变打印封签状态
|
/// </summary>
|
private void UpdatePrintfengqianState(int orderId)
|
{
|
|
if (CurrentUser != null)
|
{
|
|
_eC_OrderBasicBLL.UpdatePrintfengqianState(orderId);
|
|
}
|
}
|
}
|
}
|