/**
* PrintAwbOrder.aspx.cs
*
* 功 能: 打印送货单
* 类 名: PrintAwbOrder
*
* Ver 变更日期 负责人 变更内容
* ───────────────────────────────────
* V0.01 2013-5-17 17:54 吴崎均 初版
*
*
*
*/
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.BLL;
using CY.Model;
using CY.Infrastructure.Common;
using System.Text;
using CY.BLL.Sys;
using System.Transactions;
using CY.Model.Inquiry;
namespace CY.WebForm.Pages.business
{
public partial class DeliverOrderPrint : BasePage
{
EC_OrderBasicBLL _eC_OrderBasicBLL = null;
OA_CorporateClientsBLL _oA_CorporateClientsBLL = null;
EC_MemberBasicBLL _eC_MemberBasicBLL = null;
OA_StaffBLL oA_StaffBLL = null;
OA_DeliverPlanBLL _OA_DeliverPlanBLL = null;
OA_DeliverPlanBLL oA_DeliverPlanBLL = null;
EC_OrderPrintParameterBLL eC_OrderPrintParameterBLL = null;
Sys_DictionaryBLL dictionaryBLL = null;
///
/// 初始化构造
///
public DeliverOrderPrint()
{
_eC_OrderBasicBLL = new EC_OrderBasicBLL();
_oA_CorporateClientsBLL = new OA_CorporateClientsBLL();
_eC_MemberBasicBLL = new EC_MemberBasicBLL();
oA_StaffBLL = new OA_StaffBLL();
_OA_DeliverPlanBLL = new OA_DeliverPlanBLL();
oA_DeliverPlanBLL = new OA_DeliverPlanBLL();
eC_OrderPrintParameterBLL = new EC_OrderPrintParameterBLL();
dictionaryBLL = new Sys_DictionaryBLL();
}
///
/// 界面加载事件
///
///
///
protected void Page_Load(object sender, EventArgs e)
{
Guid deliverorderId = Request["deliverorderId"].ToGuid2();
List eC_AcceptWayByOrders = null;
//OA_CorporateClients oA_CorporateClients = null;
OA_CorporateClients oA_CorporateClientsBiddingcompany = null;
OA_DeliverPlan oA_DeliverPlan = null;
try
{
oA_DeliverPlan = _OA_DeliverPlanBLL.GetModelByKeyid(deliverorderId, null, null);
// oA_CorporateClients = _oA_CorporateClientsBLL.SelectModelByFirmIdandMemberId(CurrentUser.MemberId, oA_DeliverPlan.BuyerId);
oA_CorporateClientsBiddingcompany = _oA_CorporateClientsBLL.SelectBiddingcompanyByFirmId(CurrentUser.MemberId).Where(x => x.Keyid1 == oA_DeliverPlan.Biddingcompany).FirstOrDefault();
if (oA_CorporateClientsBiddingcompany != null)
{
this.spnD.InnerText = oA_CorporateClientsBiddingcompany.CompanyName;
}
OA_Staff oA_Staff = oA_StaffBLL.GetModelByKeyid(oA_DeliverPlan.BusinessManagerId);
if (oA_Staff != null)
{
this.spnB.InnerText = oA_Staff.Name;
}
OA_Staff oA_Staffsss = oA_StaffBLL.GetModelByMemberId(oA_DeliverPlan.Creater.Value);
if (oA_Staffsss != null)
{
this.spnC.InnerText = oA_Staffsss.Name;
}
this.spnBuyerName.InnerText = oA_DeliverPlan.CompanyName;
this.spnBuyerAddress.InnerText = oA_DeliverPlan.Dizhi;
this.spnNowTime.InnerText = oA_DeliverPlan.DeliverTime.Value.ToString("yyyy-MM-dd");
this.SellerOrderId.InnerText = oA_DeliverPlan.SellerOrderId;
this.spnBuyerPhone.InnerText = oA_DeliverPlan.Dianhua;
List eC_OrderBasics = _eC_OrderBasicBLL.GetEC_OrderBasicListBydeliverorderId(deliverorderId,CurrentUser.MemberId).ToList();
decimal SumPrice = 0;
if (eC_OrderBasics != null && eC_OrderBasics.Count > 0)
{
for (int i = 0; i < eC_OrderBasics.Count; i++)
{
if (i == 0)
{
EC_AwbInfo m_EC_AwbInfo = _eC_OrderBasicBLL.SelectAwbInfoById(eC_OrderBasics[i].Keyid.Value);
if (m_EC_AwbInfo != null)
{
this.spnRemark.InnerText = m_EC_AwbInfo.Remark;
}
}
SumPrice += eC_OrderBasics[i].SumPrice.Value;
EC_OrderPrintParameter _eC_OrderPrintParameter = eC_OrderPrintParameterBLL.GetModel(eC_OrderBasics[i].Keyid.Value);
InquiryCommonModel _inquiryCommonModel = null;
if (null == _eC_OrderPrintParameter)
{
_inquiryCommonModel = new InquiryCommonModel();
}
else
{
_inquiryCommonModel = SerializationHelper.DeSerialize(typeof(InquiryCommonModel), _eC_OrderPrintParameter.PrintParameter) as InquiryCommonModel;
}
eC_OrderBasics[i].PrintSizeName = _inquiryCommonModel.PrintSizeName;
var sss = dictionaryBLL.GetDataByType("印刷单位").Where(x=>x.MeanValue == eC_OrderBasics[i].OrderExtend.printunit).FirstOrDefault();
if (sss != null)
{
eC_OrderBasics[i].yssldw = sss.Name;
}
}
}
else
{
this.spnRemark.InnerText = oA_DeliverPlan.Remark;
}
rptData.DataSource = eC_OrderBasics;
rptData.DataBind();
this.spnSumPrice.InnerText = SumPrice.ToString("#0.00");
this.spnSumPriceUpper.InnerText = GetChinaMoney(SumPrice);
}
catch (Exception ex)
{
PAGEHandleException(ex);
Response.Clear();
Response.Write("");
Response.End();
}
}
public static string GetChinaMoney(decimal money)
{
string[] strArray;
string str = "";
string str2 = "";
string str3 = money.ToString("0.00");
switch (str3.Trim().Length)
{
case 4:
strArray = new string[] { str3[0].ToString(), "y", str3[2].ToString(), "j", str3[3].ToString(), "f" };
str = string.Concat(strArray);
break;
case 5:
strArray = new string[] { str3[0].ToString(), "s", str3[1].ToString(), "y", str3[3].ToString(), "j", str3[4].ToString(), "f" };
str = string.Concat(strArray);
break;
case 6:
strArray = new string[] { str3[0].ToString(), "b", str3[1].ToString(), "s", str3[2].ToString(), "y", str3[4].ToString(), "j", str3[5].ToString(), "f" };
str = string.Concat(strArray);
break;
case 7:
strArray = new string[] { str3[0].ToString(), "q", str3[1].ToString(), "b", str3[2].ToString(), "s", str3[3].ToString(), "y", str3[5].ToString(), "j", str3[6].ToString(), "f" };
str = string.Concat(strArray);
break;
case 8:
strArray = new string[] { str3[0].ToString(), "w", str3[1].ToString(), "q", str3[2].ToString(), "b", str3[3].ToString(), "s", str3[4].ToString(), "y", str3[6].ToString(), "j", str3[7].ToString(), "f" };
str = string.Concat(strArray);
break;
case 9:
strArray = new string[] { str3[0].ToString(), "s", str3[1].ToString(), "w", str3[2].ToString(), "q", str3[3].ToString(), "b", str3[4].ToString(), "s", str3[5].ToString(), "y", str3[7].ToString(), "j", str3[8].ToString(), "f" };
str = string.Concat(strArray);
break;
case 10:
strArray = new string[] {
str3[0].ToString(), "b", str3[1].ToString(), "s", str3[2].ToString(), "w", str3[3].ToString(), "q", str3[4].ToString(), "b", str3[5].ToString(), "s", str3[6].ToString(), "y", str3[8].ToString(), "j",
str3[9].ToString(), "f"
};
str = string.Concat(strArray);
break;
case 11:
strArray = new string[] {
str3[0].ToString(), "q", str3[1].ToString(), "b", str3[2].ToString(), "s", str3[3].ToString(), "w", str3[4].ToString(), "q", str3[5].ToString(), "b", str3[6].ToString(), "s", str3[7].ToString(), "y",
str3[9].ToString(), "j", str3[10].ToString(), "f"
};
str = string.Concat(strArray);
break;
case 12:
strArray = new string[] {
str3[0].ToString(), "m", str3[1].ToString(), "q", str3[2].ToString(), "b", str3[3].ToString(), "s", str3[4].ToString(), "w", str3[5].ToString(), "q", str3[6].ToString(), "b", str3[7].ToString(), "s",
str3[8].ToString(), "y", str3[10].ToString(), "j", str3[11].ToString(), "f"
};
str = string.Concat(strArray);
break;
}
for (int i = 0; i < str.Trim().Length; i++)
{
switch (str[i])
{
case '0':
str2 = str2 + "零";
break;
case '1':
str2 = str2 + "壹";
break;
case '2':
str2 = str2 + "贰";
break;
case '3':
str2 = str2 + "叁";
break;
case '4':
str2 = str2 + "肆";
break;
case '5':
str2 = str2 + "伍";
break;
case '6':
str2 = str2 + "陆";
break;
case '7':
str2 = str2 + "柒";
break;
case '8':
str2 = str2 + "捌";
break;
case '9':
str2 = str2 + "玖";
break;
case 'b':
str2 = str2 + "佰";
break;
case 'f':
str2 = str2 + "分";
break;
case 'j':
str2 = str2 + "角";
break;
case 'm':
str2 = str2 + "亿";
break;
case 'q':
str2 = str2 + "仟";
break;
case 's':
str2 = str2 + "拾";
break;
case 'w':
str2 = str2 + "万";
break;
case 'y':
str2 = str2 + "元";
break;
}
}
return str2;
}
}
}