using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CY.Model.Inquiry;
using CY.Model;
using CY.Infrastructure.Common;
using CY.Config;
using CY.BLL.OA;
namespace CY.BLL.Inquiry
{
///
/// 询价业务逻辑
///
public class InquiryBLL
{
#region 变量
OA_CorporateClientsBLL _oA_CorporateClientsBLL = new OA_CorporateClientsBLL();
#endregion
#region 方法
///
/// 获取当前的询价参数对象
///
///
public static InquiryCommonModel GetInquiryCommonModel()
{
string inquiryStr1 = Utils.GetCookie("InquiryRecord1");
string inquiryStr2 = Utils.GetCookie("InquiryRecord2");
string inquiryStr = inquiryStr1 + inquiryStr2;
inquiryStr = SerializationHelper.DecryptDES(inquiryStr, "ssssssss");
InquiryCommonModel model = SerializationHelper.DeSerialize(typeof(InquiryCommonModel), inquiryStr) as InquiryCommonModel;
return model;
}
///
/// 获取当前的询价参数对象(内部询价)
///
///
public static InquiryCommonModel GetInquiryCommonModelByInside()
{
string inquiryStr1 = Utils.GetCookie("InsideInquiryRecord1");
string inquiryStr2 = Utils.GetCookie("InsideInquiryRecord2");
string inquiryStr = inquiryStr1 + inquiryStr2;
inquiryStr = SerializationHelper.DecryptDES(inquiryStr, "ssssssss");
InquiryCommonModel model = SerializationHelper.DeSerialize(typeof(InquiryCommonModel), inquiryStr) as InquiryCommonModel;
return model;
}
///
/// 获取当前的询价参数对象(厂商网站)
///
///
public static InquiryCommonModel GetInquiryCommonModelByFirm()
{
string inquiryStr1 = Utils.GetCookie("TTTInsideInquiryRecord1");
string inquiryStr2 = Utils.GetCookie("TTTInsideInquiryRecord2");
string inquiryStr = inquiryStr1 + inquiryStr2;
inquiryStr = SerializationHelper.DecryptDES(inquiryStr, "ssssssss");
InquiryCommonModel model = SerializationHelper.DeSerialize(typeof(InquiryCommonModel), inquiryStr) as InquiryCommonModel;
return model;
}
///
/// 获取当前的询价参数对象的XML字符串
///
///
///
public static string GetInquiryCommonModelXMLStr(InquiryCommonModel model)
{
string xmlStr = SerializationHelper.Serialize(model);
return xmlStr;
}
///
/// 获取memberId对应的CustomerId
///
///
///
///
public Guid GetCustomerId(Guid firmId, Guid memberId)
{
if (memberId == Guid.Empty)
return Guid.Empty;
return _oA_CorporateClientsBLL.GetCustormId(firmId, memberId);
}
///
/// 获取询价参数Id
///
///
///
///
public Guid GetInquiryId(Guid firmId, Guid customerId)
{
return _oA_CorporateClientsBLL.GetInquiryId(firmId, customerId);
}
///
/// 获取内部询价结果(询价厂商)
///
///
private InquiryResultModel GetInquiryResultByInside(InquiryCommonModel model, Guid memberId, Guid customerId)
{
Pay_PaymentAccountBLL _pay_PaymentAccountBLL = new Pay_PaymentAccountBLL();
EC_MemberBasicBLL _eC_MemberBasicBLL = new EC_MemberBasicBLL();
Guid inquiryId = GetInquiryId(memberId, customerId);
InquiryResultModel resultModel = null;
resultModel = new InquiryResultModel();
EC_MemberBasic member = _eC_MemberBasicBLL.GetMemberByMemberId(memberId);
resultModel.FirmId = member.MemberId.ToString();
resultModel.FirmName = member.Name;
resultModel.QQ = member.QQ;
resultModel.TotalPrice = GetInquiryDetail(model, inquiryId, memberId, customerId).TotalPrice;
resultModel.Score = _pay_PaymentAccountBLL.GetScoreBySourceTypeId(87, resultModel.TotalPrice).Value;
Integrity_IntegrityCardBLL _integrity_IntegrityCardBLL = new Integrity_IntegrityCardBLL();
resultModel.LevelImg = _integrity_IntegrityCardBLL.GetLevelImgByMemberIdAndRuleType(member.MemberId, true);
//询价记录保存
RecordInfoBLL _recordInfoBLL = new RecordInfoBLL();
Inquiry_RecordInfo rInfo = new Inquiry_RecordInfo();
string inquiryStr = InquiryBLL.GetInquiryCommonModelXMLStr(model);
rInfo.InquiryPersonId = customerId;
rInfo.FirmId = memberId;
rInfo.PrintParameter = inquiryStr;
rInfo.PrintTypeId = model.PrintTypeId;
rInfo.PrintCount = model.PrintCount;
rInfo.SysPrice = resultModel.TotalPrice;
rInfo.OperateTime = DateTime.Now;
rInfo.ResultStatus = 0;
if (customerId != Guid.Empty)
{
rInfo.PersonTypeId = 2;
}
else
{
rInfo.PersonTypeId = 3;
}
_recordInfoBLL.InsertModel(rInfo);
return resultModel;
}
///
/// 获取内部询价结果(包含其他厂商价格)
///
///
public IList GetInquiryResultListByInside(InquiryCommonModel model, Guid memberId, Guid customerId, int orderType, string firmName, string selectProvince, string selectCity, string selectCounty, int pageIndex, int pageSize, ref int pageCount)
{
Pay_PaymentAccountBLL _pay_PaymentAccountBLL = new Pay_PaymentAccountBLL();
EC_MemberBasicBLL _eC_MemberBasicBLL = new EC_MemberBasicBLL();
IList resultModelList = new List();
resultModelList.Add(GetInquiryResultByInside(model, memberId, customerId));
IList firmList = _eC_MemberBasicBLL.GetFirmListByPage(model.PrintTypeId, model.PrintMode, memberId, orderType, firmName, selectProvince, selectCity, selectCounty, pageIndex, pageSize, ref pageCount);
InquiryResultModel resultModel = null;
foreach (EC_MemberBasic member in firmList)
{
if (member.IsShowInquiry != 1)
{
continue;
}
resultModel = new InquiryResultModel();
resultModel.FirmId = member.MemberId.ToString();
resultModel.FirmName = member.Name;
resultModel.QQ = member.QQ;
resultModel.ConstactPerson = member.BusinessContacts;
resultModel.ConstactType = "电话:" + member.PhoneNum + ";QQ:" + member.QQ;
Guid inquiryId = GetInquiryId(member.MemberId, customerId);
resultModel.TotalPrice = GetInquiryDetail(model, inquiryId, member.MemberId, customerId).TotalPrice;
resultModel.Score = _pay_PaymentAccountBLL.GetScoreBySourceTypeId(87, resultModel.TotalPrice).Value;
Integrity_IntegrityCardBLL _integrity_IntegrityCardBLL = new Integrity_IntegrityCardBLL();
resultModel.LevelImg = _integrity_IntegrityCardBLL.GetLevelImgByMemberIdAndRuleType(member.MemberId, true);
resultModelList.Add(resultModel);
}
return resultModelList;
}
///
/// 公共询价计算
///
///
public IList GetInquiryResultByCommonList(InquiryCommonModel model, Guid memberId, int orderType, string firmName, string selectProvince, string selectCity, string selectCounty, int pageIndex, int pageSize, ref int pageCount)
{
int TruepageSize = pageSize;
int TrueDataCount = 0;
pageSize = 10000;
Pay_PaymentAccountBLL _pay_PaymentAccountBLL = new Pay_PaymentAccountBLL();
EC_MemberBasicBLL _eC_MemberBasicBLL = new EC_MemberBasicBLL();
IList resultModelList = new List();
IList firmList = _eC_MemberBasicBLL.GetFirmListByPage(model.PrintTypeId, model.PrintMode, Guid.Empty, orderType, firmName, selectProvince, selectCity, selectCounty, pageIndex, pageSize, ref pageCount);
InquiryResultModel resultModel = null;
foreach (EC_MemberBasic member in firmList)
{
if (member.IsShowInquiry != 1)
{
continue;
}
resultModel = new InquiryResultModel();
resultModel.FirmId = member.MemberId.ToString();
resultModel.FirmName = member.Name;
resultModel.QQ = member.QQ;
resultModel.ConstactPerson = member.BusinessContacts;
resultModel.ConstactType = "电话:" + member.PhoneNum + ";QQ:" + member.QQ;
Guid customerId = Guid.Empty;
customerId = GetCustomerId(member.MemberId, memberId);
Guid inquiryId = GetInquiryId(member.MemberId, customerId);
resultModel.TotalPrice = GetInquiryDetail(model, inquiryId, member.MemberId, customerId).TotalPrice;
try
{
resultModel.Score = _pay_PaymentAccountBLL.GetScoreBySourceTypeId(87, resultModel.TotalPrice).Value;
}
catch
{
resultModel.Score = 100000;
}
Integrity_IntegrityCardBLL _integrity_IntegrityCardBLL = new Integrity_IntegrityCardBLL();
resultModel.LevelImg = _integrity_IntegrityCardBLL.GetLevelImgByMemberIdAndRuleType(member.MemberId, true);
resultModelList.Add(resultModel);
}
if (orderType == 0)
{
resultModelList = resultModelList.OrderBy(p => p.TotalPrice).ToList();
}
else if (orderType == 1)
{
resultModelList = resultModelList.OrderByDescending(p => p.TotalPrice).ToList();
}
System.Threading.Thread.Sleep(200); //休眠20毫秒
List m_InquiryResultModelList = new List();
if (TruepageSize * pageIndex >= resultModelList.Count)
{
TrueDataCount = resultModelList.Count;
}
else
{
TrueDataCount = TruepageSize * pageIndex;
}
for (int i = (pageIndex - 1) * TruepageSize; i < TrueDataCount; i++)
{
m_InquiryResultModelList.Add(resultModelList[i]);
}
IList firmListDDDD = _eC_MemberBasicBLL.GetFirmListByPage(model.PrintTypeId, model.PrintMode, Guid.Empty, orderType, firmName, selectProvince, selectCity, selectCounty, pageIndex, TruepageSize, ref pageCount);
return m_InquiryResultModelList;
}
///
/// 根据印刷类型获取印刷数量数组
///
///
///
public int[] GetPrintCountArry(int printTypeId)
{
int[] countArry = new int[] { 0 };
if (printTypeId == 14)
{
countArry = new int[]{
500,1000,2000,3000,5000,10000,20000,50000,100000
};
}
else if (printTypeId == 15)
{
countArry = new int[]{
500,1000,2000,3000,5000,10000
};
}
else if (printTypeId == 6)
{
countArry = new int[]{
500,1000,2000,3000,5000,10000
};
}
else if (printTypeId == 13)
{
countArry = new int[]{
2,5,10,20,50,100,200,500
};
}
else if (printTypeId == 31)
{
countArry = new int[]{
1000,2000,5000,10000,20000,30000,50000
};
}
else if (printTypeId == 32)
{
countArry = new int[]{
5000,10000,20000,30000,50000
};
}
else if (printTypeId == 34)
{
countArry = new int[]{
1
};
}
else if (printTypeId == 35)
{
countArry = new int[]{
5000,10000,20000,5000
};
}
else if (printTypeId == 17)
{
countArry = new int[]{
1
};
}
else if (printTypeId == 29)
{
countArry = new int[]{
1000,2000,5000,10000,20000,50000,100000
};
}
else if (printTypeId == 22)
{
countArry = new int[]{
100,200,300,500,1000
};
}
else if (printTypeId == 26)
{
countArry = new int[]{
500,1000,2000,3000,5000,10000
};
}
else if (printTypeId == 16)
{
countArry = new int[]{
500,1000,2000,3000,5000,10000
};
}
else if (printTypeId == 21)
{
countArry = new int[]{
500,1000,2000,3000,5000,10000
};
}
else if (printTypeId == 33)
{
countArry = new int[]{
100,200,300,500,1000,2000,3000,5000,10000
};
}
else if (printTypeId == 7)
{
countArry = new int[]{
500,1000,2000,3000,5000,10000
};
}
else if (printTypeId == 27)
{
countArry = new int[]{
100,200,300,500,1000
};
}
else if (printTypeId == 23)
{
countArry = new int[]{
500,1000,5000,10000,20000,30000,50000
};
}
else if (printTypeId == 19)
{
countArry = new int[]{
1
};
}
else if (printTypeId == 18)
{
countArry = new int[]{
1
};
}
else if (printTypeId == 25)
{
countArry = new int[]{
500,1000,5000,10000,20000,30000,50000
};
}
else if (printTypeId == 36)
{
countArry = new int[]{
500,1000,5000,10000,20000,30000,50000
};
}
else if (printTypeId == 20)
{
countArry = new int[]{
500,1000,2000,3000,5000,10000,20000,30000,50000
};
}
return countArry;
}
///
/// 获取询价详情
///
///
///
///
public IList GetInquiryDetailList(InquiryCommonModel model, Guid firmId, Guid memberId)
{
int TruePrintCount = 0;
TruePrintCount = model.PrintCount;
IList list = new List();
int[] countArry = GetPrintCountArry(model.PrintTypeId);
List printCountList = GetPrintCountList(model.PrintCount, countArry);
Guid customerId = Guid.Empty;
customerId = GetCustomerId(firmId, memberId);
Guid inquiryId = GetInquiryId(firmId, customerId);
InquiryDetail detail = null;
foreach (int printCount in printCountList)
{
model.PrintCount = printCount;
detail = GetInquiryDetail(model, inquiryId, firmId, customerId);
if (detail != null)
list.Add(detail);
}
model.PrintCount = TruePrintCount;
return list;
}
///
/// 内部询价时获取询价详情
///
///
///
///
public IList GetInquiryDetailListByInside(InquiryCommonModel model, Guid firmId, Guid customerId)
{
IList list = new List();
int[] countArry = GetPrintCountArry(model.PrintTypeId);
List printCountList = GetPrintCountList(model.PrintCount, countArry);
Guid inquiryId = GetInquiryId(firmId, customerId);
InquiryDetail detail = null;
foreach (int printCount in printCountList)
{
model.PrintCount = printCount;
detail = GetInquiryDetail(model, inquiryId, firmId, customerId);
if (detail != null)
list.Add(detail);
}
return list;
}
///
/// 确认下单时获取询价详情
///
///
///
///
public InquiryDetail GetInquiryDetailByConfirm(InquiryCommonModel model, Guid firmId, Guid memberId)
{
InquiryDetail detail = new InquiryDetail();
Guid customerId = Guid.Empty;
customerId = GetCustomerId(firmId, memberId);
Guid inquiryId = GetInquiryId(firmId, customerId);
detail = GetInquiryDetail(model, inquiryId, firmId, customerId);
return detail;
}
///
/// 根据印刷类型获取计价结果
///
///
///
///
public InquiryDetail GetInquiryDetail(InquiryCommonModel model, Guid inquiryId, Guid firmId, Guid customerId)
{
switch (model.PrintTypeId)
{
case 13:
return GetBusinessCardInquiryDetail(model, inquiryId, firmId, customerId);
case 14:
return GetDMInquiryDetail(model, inquiryId, firmId, customerId);
case 15:
return GetPictureAlbumInquiryDetail(model, inquiryId, firmId, customerId);
case 6:
return GetBookInquiryDetail(model, inquiryId, firmId, customerId);
case 31:
return GetAdvertisingCupInquiryDetail(model, inquiryId, firmId, customerId);
case 32:
return GetAdvertisingPokerInquiryDetail(model, inquiryId, firmId, customerId);
case 34:
return GetGraphicDesignerInquiryDetail(model, inquiryId, firmId, customerId);
case 35:
return GetRoomCardInquiryDetail(model, inquiryId, firmId, customerId);
case 17:
return GetAirbrushInquiryDetail(model, inquiryId, firmId, customerId);
case 29:
return GetBlackAndWhiteInquiryDetail(model, inquiryId, firmId, customerId);
case 22:
return GetNoteInquiryDetail(model, inquiryId, firmId, customerId);
case 26:
return GetPacketInquiryDetail(model, inquiryId, firmId, customerId);
case 16:
return GetReticuleInquiyrDetail(model, inquiryId, firmId, customerId);
case 21:
return GetEnvelopInquiyrDetail(model, inquiryId, firmId, customerId);
case 33:
return GetPVCInquiryDetail(model, inquiryId, firmId, customerId);
case 7:
return GetNewsPaperInquiryDetail(model, inquiryId, firmId, customerId);
case 27:
return GetReceiptDocumentInquiryDetail(model, inquiryId, firmId, customerId);
case 23:
return GetCalendaryInquiryDetail(model, inquiryId, firmId, customerId);
case 19:
return GetLEDInquiryDetail(model, inquiryId, firmId, customerId);
case 18:
return GetSignboardInquiryDetail(model, inquiryId, firmId, customerId);
case 25:
return GetDeskCalendaryInquiryDetail(model, inquiryId, firmId, customerId);
case 36:
return GetDigitalInquiryDetail(model, inquiryId, firmId, customerId);
case 20:
return GetAdhesiveInquiryDetail(model, inquiryId, firmId, customerId);
}
return new InquiryDetail();
}
///
/// 计算不干胶价格
///
///
///
///
///
///
public InquiryDetail GetAdhesiveInquiryDetail(InquiryCommonModel model, Guid inquiryId, Guid firmId, Guid customerId)
{
InquiryDetail detail = new InquiryDetail();
//总价
decimal totalPrice = 0;
//纸张价格
decimal paperPrice = 0;
//印工费
decimal impressPrice = 0;
//版费
decimal versionCost = 0;
decimal afterWorkPrice = 0;
//货运费
decimal cargagePrice = 0;
//税费
decimal taxationPrice = 0;
string afterWorkListStr = string.Empty;
decimal fastValue = 1;
if ((customerId != Guid.Empty && inquiryId != customerId) || (customerId == Guid.Empty && inquiryId == Guid.Parse(UtilConst.AdminFirmId)))
{
FastSetByFirmBLL _fastSetByFirmBLL = new FastSetByFirmBLL();
Inquiry_FastSetByFirm fastModel = _fastSetByFirmBLL.GetModel(firmId, customerId, model.PrintTypeId);
if (fastModel != null)
{
fastValue = (fastModel.FastValue / 100);
}
}
if (model.PrintMode == 1)
{
paperPrice = GetAdhesiveFastPrice(model, inquiryId, fastValue);
detail.PaperPriceStr = paperPrice.ToString("0.00");
}
else
{
decimal realArea = 0;
int num = 0;
int equipmentId = 0;
int impressCount = 0;
realArea = GetRealArea(model, ref num, ref equipmentId, ref impressCount);
paperPrice = GetAdhesivePaperPrice(model, impressCount, realArea, inquiryId, fastValue, detail);
impressPrice = GetImpressPriceBy2Or4(impressCount, equipmentId, 1, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
if (detail.ImpressPriceStr.EndsWith(";"))
detail.ImpressPriceStr = detail.ImpressPriceStr.Substring(0, detail.ImpressPriceStr.Length - 1);
afterWorkPrice = GetAdhesiveAfterWorkListPrice(model, equipmentId, impressCount, realArea, inquiryId, fastValue, detail);
}
totalPrice = paperPrice + impressPrice + versionCost + afterWorkPrice;
if (model.DeliveryMode != 104)
cargagePrice = GetCargagePrice(totalPrice, inquiryId, model.DeliveryMode) * fastValue;
totalPrice = totalPrice + cargagePrice;
if (model.BillMode != 108)
{
decimal taxValue = GetTaxationValue(model.BillMode, inquiryId);
taxationPrice = (totalPrice * taxValue / 100) * fastValue;
}
totalPrice = totalPrice + taxationPrice;
detail.PrintCount = model.PrintCount;
detail.PaperPrice = paperPrice;
detail.ImpressPrice = impressPrice;
detail.VersionCost = versionCost;
detail.AfterWorkPrice = afterWorkPrice;
detail.CargagePrice = cargagePrice;
detail.TaxationPrice = taxationPrice;
detail.TotalPrice = totalPrice;
return detail;
}
///
/// 计算不干胶后道
///
///
///
///
///
///
///
///
///
public decimal GetAdhesiveAfterWorkListPrice(InquiryCommonModel model, int equipmentId, int impressCount, decimal realArea, Guid inquiryId, decimal fastValue, InquiryDetail detail)
{
decimal allPrice = 0;
decimal price = 0;
if (model.AfterWorkList != null && model.AfterWorkList.Count > 0)
{
AfterParameterInfoBLL _afterParameterInfoBLL = new AfterParameterInfoBLL();
foreach (int workId in model.AfterWorkList)
{
price = 0;
SysInquiry_AfterParameterInfo afterInfo = _afterParameterInfoBLL.GetModel(workId);
if (workId == 1) //覆膜
{
MultipleAfterCostBLL _multipleAfterCostBLL = new MultipleAfterCostBLL();
Inquiry_MultipleAfterCost multipleAfterCostModel = _multipleAfterCostBLL.GetModel(inquiryId, model.PrintTypeId, workId);
if (multipleAfterCostModel != null)
{
price = impressCount * realArea * multipleAfterCostModel.Price;
if (price < multipleAfterCostModel.TotalStartPrice)
{
price = multipleAfterCostModel.TotalStartPrice;
}
}
}
else if (workId == 8)
{
price = GetPriceByGoldStampOrUV(model.PrintCount, model.PrintTypeId, inquiryId, workId, model.TJWith, model.TJHight);
}
else if (workId == 20)
{
price = GetPriceByGoldStampOrUV(model.PrintCount, model.PrintTypeId, inquiryId, workId, model.TYWith, model.TYHight);
}
else if (workId == 5)
{
CuttingCostBLL _cuttingCostBLL = new CuttingCostBLL();
int pageSizeValue = 2;
if (equipmentId == 2)
{
pageSizeValue = 5;
}
Inquiry_CuttingCost cuttingCostModel = _cuttingCostBLL.GetModel(model.PrintTypeId, pageSizeValue, inquiryId);
if (cuttingCostModel != null)
{
price = impressCount * cuttingCostModel.Price;
if (price < cuttingCostModel.StartPrice)
price = cuttingCostModel.StartPrice;
price += cuttingCostModel.PlatemakPrice;
}
}
price = price * fastValue;
allPrice += price;
detail.AfterWorkPriceStr += afterInfo.ParameterName + ":" + price.ToString("0.00") + "元,";
}
detail.AfterWorkPriceStr += "共计:" + allPrice.ToString("0.00") + "元";
}
return allPrice;
}
///
/// 获取换算后的实际面积(平方米)
///
///
///
///
public decimal GetRealArea(InquiryCommonModel model, ref int num, ref int equipmentId, ref int impressCount)
{
decimal realArea = 0;
decimal with4 = 440;
decimal height4 = 590;
int num1 = 0;
int num2 = 0;
int num3 = 0;
int num4 = 0;
int tempNum1 = 0;
int tempNum2 = 0;
decimal oWith = model.firstSize.ToDecimal2().Value + 3;
decimal oHeight = model.secondSize.ToDecimal2().Value + 3;
if ((oWith <= 440 && oHeight <= 590) || (oHeight <= 440 && oWith <= 590))
{
equipmentId = 2; //四开机
}
else if ((441 <= oWith && oWith <= 703 && oHeight >= 590 && oHeight <= 1003) || (441 <= oHeight && oHeight <= 703 && oWith >= 590 && oWith <= 1003))
{
equipmentId = 1; //二开机
}
if (equipmentId == 2)
{
num1 = decimal.Truncate(with4 / oWith).ToInt32().Value;
num2 = decimal.Truncate(height4 / oHeight).ToInt32().Value;
tempNum1 = num1 * num2;
num3 = decimal.Truncate(with4 / oHeight).ToInt32().Value;
num4 = decimal.Truncate(height4 / oWith).ToInt32().Value;
tempNum2 = num3 * num4;
if (tempNum1 < tempNum2)
{
num = tempNum2;
realArea = num3 * oWith * num4 * oHeight;
}
else
{
num = tempNum1;
realArea = num1 * oWith * num2 * oHeight;
}
impressCount = (model.PrintCount.ToDouble2().Value / num).ToDecimal2().Value.JRoundInt();
if (impressCount > 5000)
{
equipmentId = 1;//二开机
realArea = GetRealAreaBy2(model.PrintCount, oWith, oHeight, ref num, ref equipmentId, ref impressCount);
}
}
else
{
equipmentId = 1;//二开机
realArea = GetRealAreaBy2(model.PrintCount, oWith, oHeight, ref num, ref equipmentId, ref impressCount);
}
realArea = realArea / 1000000;
return realArea;
}
///
/// 根据2开机计算换算后的实际面积
///
///
private decimal GetRealAreaBy2(int printCount, decimal oWith, decimal oHeight, ref int num, ref int equipmentId, ref int impressCount)
{
decimal realArea = 0;
int num1 = 0;
int num2 = 0;
int num3 = 0;
int num4 = 0;
int tempNum1 = 0;
int tempNum2 = 0;
decimal with2 = 1003;
decimal height2 = 703;
num1 = decimal.Truncate(with2 / oWith).ToInt32().Value;
num2 = decimal.Truncate(height2 / oHeight).ToInt32().Value;
tempNum1 = num1 * num2;
num3 = decimal.Truncate(with2 / oHeight).ToInt32().Value;
num4 = decimal.Truncate(height2 / oWith).ToInt32().Value;
tempNum2 = num3 * num4;
if (tempNum1 < tempNum2)
{
num = tempNum2;
realArea = num3 * oWith * num4 * oHeight;
}
else
{
num = tempNum1;
realArea = num1 * oWith * num2 * oHeight;
}
equipmentId = 1;
impressCount = (printCount.ToDouble2().Value / num).ToDecimal2().Value.JRoundInt();
return realArea;
}
///
/// 计算不干胶纸价
///
///
///
///
///
///
public decimal GetAdhesivePaperPrice(InquiryCommonModel model, int impressCount, decimal realArea, Guid inquiryId, decimal fastValue, InquiryDetail detail)
{
decimal price = 0;
decimal totalArea = 0;
decimal newArea = realArea * impressCount;
decimal totalConsumptionArea = 0;
BasicConsumptionBLL _basicConsumptionBLL = new BasicConsumptionBLL();
Inquiry_BasicConsumption basicConsumptionModel = _basicConsumptionBLL.GetModel(inquiryId, model.PrintTypeId);
if (basicConsumptionModel != null)
{
totalConsumptionArea = newArea * (basicConsumptionModel.basicRatio / 100);
if (totalConsumptionArea < basicConsumptionModel.minNumber)
{
totalConsumptionArea = basicConsumptionModel.minNumber;
}
}
decimal afterConsumptionArea = 0;
if (model.AfterWorkList != null && model.AfterWorkList.Count > 0)
{
AfterConsumptionBLL _afterConsumptionBLL = new AfterConsumptionBLL();
foreach (int workId in model.AfterWorkList)
{
Inquiry_AfterConsumption afterConsumption = _afterConsumptionBLL.GetModel(inquiryId, model.PrintTypeId, workId);
if (afterConsumption != null)
{
afterConsumptionArea = newArea * (afterConsumption.BasicRatio / 100);
if (afterConsumptionArea < afterConsumption.MinNumber)
{
afterConsumptionArea = afterConsumption.MinNumber;
}
totalConsumptionArea += afterConsumptionArea;
}
}
}
totalArea = newArea + totalConsumptionArea;
decimal priceBysingel = 0;
AdhesivePaperPriceBLL _adhesivePaperPriceBLL = new AdhesivePaperPriceBLL();
Inquiry_AdhesivePaperPrice paperPriceModel = _adhesivePaperPriceBLL.GetModel(inquiryId);
if (paperPriceModel != null)
{
priceBysingel = paperPriceModel.Price * fastValue;
}
price = totalArea * priceBysingel;
detail.PaperPriceStr += totalArea.ToString("0.00") + "(正数:" + newArea.ToString("0.00") + ",消耗:" + totalConsumptionArea.ToString("0.00") + ")平方米×" + priceBysingel.ToString("0.00") + "元,共计:" + price.ToString("0.00") + "元";
return price;
}
///
/// 获取不干胶快速询价价格
///
///
///
///
///
public decimal GetAdhesiveFastPrice(InquiryCommonModel model, Guid inquiryId, decimal fastValue)
{
decimal price = 0;
decimal[] areaArry = new decimal[]{
600,2000,4500,10000,20000
};
string realArea = string.Empty;
decimal areaCount = model.firstSize.ToDecimal2().Value * model.secondSize.ToDecimal2().Value;
decimal i = GetRelArea(areaCount, areaArry);
if (i == 600)
{
realArea = "20×30";
}
else if (i == 2000)
{
realArea = "40×50";
}
else if (i == 4500)
{
realArea = "50×90";
}
else if (i == 10000)
{
realArea = "100×100";
}
else if (i == 20000)
{
realArea = "100×200";
}
int coveredTypeId = 71;
if (model.AfterWorkList != null && model.AfterWorkList.Count > 0)
{
if (model.AfterWorkList.Contains(1))
{
coveredTypeId = 1;
}
}
AdhesiveFastCostBLL _adhesiveFastCostBLL = new AdhesiveFastCostBLL();
Inquiry_AdhesiveFastCost adhesiveModel = _adhesiveFastCostBLL.GetModel(realArea, model.Shape, coveredTypeId, model.PrintCount, inquiryId);
if (adhesiveModel != null)
{
price = adhesiveModel.Price * fastValue;
}
return price;
}
///
/// 获取实际计算的印刷尺寸
///
///
///
///
private decimal GetRelArea(decimal area, decimal[] areaArry)
{
decimal relPrintCount = 0;
foreach (decimal i in areaArry)
{
if (area <= i)
{
relPrintCount = i;
break;
}
}
return relPrintCount;
}
///
/// 计算数码快印价格
///
///
///
///
///
///
public InquiryDetail GetDigitalInquiryDetail(InquiryCommonModel model, Guid inquiryId, Guid firmId, Guid customerId)
{
InquiryDetail detail = new InquiryDetail();
//总价
decimal totalPrice = 0;
//纸张价格
decimal paperPrice = 0;
//印工费
decimal impressPrice = 0;
//版费
decimal versionCost = 0;
decimal afterWorkPrice = 0;
//货运费
decimal cargagePrice = 0;
//税费
decimal taxationPrice = 0;
decimal fastValue = 1;
if ((customerId != Guid.Empty && inquiryId != customerId) || (customerId == Guid.Empty && inquiryId == Guid.Parse(UtilConst.AdminFirmId)))
{
FastSetByFirmBLL _fastSetByFirmBLL = new FastSetByFirmBLL();
Inquiry_FastSetByFirm fastModel = _fastSetByFirmBLL.GetModel(firmId, customerId, model.PrintTypeId);
if (fastModel != null)
{
fastValue = (fastModel.FastValue / 100);
}
}
paperPrice = GetDigitalPaperPrice(model, inquiryId, fastValue, detail);
//计算后工序价格
afterWorkPrice = GetDigitalAfterWorksPrice(model, inquiryId, fastValue, detail);
totalPrice = paperPrice + impressPrice + versionCost + afterWorkPrice;
if (model.DeliveryMode != 104)
cargagePrice = GetCargagePrice(totalPrice, inquiryId, model.DeliveryMode) * fastValue;
totalPrice = totalPrice + cargagePrice;
if (model.BillMode != 108)
{
decimal taxValue = GetTaxationValue(model.BillMode, inquiryId);
taxationPrice = (totalPrice * taxValue / 100) * fastValue;
}
totalPrice = totalPrice + taxationPrice;
detail.PrintCount = model.PrintCount;
detail.PaperPrice = paperPrice;
detail.ImpressPrice = impressPrice;
detail.VersionCost = versionCost;
detail.AfterWorkPrice = afterWorkPrice;
detail.CargagePrice = cargagePrice;
detail.TaxationPrice = taxationPrice;
detail.TotalPrice = totalPrice;
return detail;
}
///
/// 计算数码快印纸张价格
///
///
///
///
///
///
public decimal GetDigitalPaperPrice(InquiryCommonModel model, Guid inquiryId, decimal fastValue, InquiryDetail detail)
{
decimal price = 0;
decimal priceSingle = 0;
DigitalPrintPaperPriceBLL _paperPriceBll = new DigitalPrintPaperPriceBLL();
SysInquiry_DigitalPrintPaperInfoBLL _printPaperInfoBLL = new SysInquiry_DigitalPrintPaperInfoBLL();
SysInquiry_DigitalPrintPaperInfo printPaperInfo = _printPaperInfoBLL.SelectModelByKey(model.PaperId);
if (model.DigitalPrintType == "单张")
{
if (printPaperInfo.PaperName == "自带纸")
{
detail.PaperPriceStr += "自带纸:0元";
return 0;
}
Inquiry_DigitalPrintPaperPrice paperPriceModel = _paperPriceBll.GetModel(inquiryId, model.PaperId);
if (paperPriceModel != null)
{
priceSingle = paperPriceModel.Price;
priceSingle = priceSingle * fastValue;
if (model.PrintSizeName == "A3" || model.PrintSizeName == "A3+")
{
if (model.SingleOrdouble == "单面")
{
price = (model.PrintCount * priceSingle).JRoundInt();
}
else
{
price = (model.PrintCount * priceSingle * 2).JRoundInt();
}
}
else if (model.PrintSizeName == "A4")
{
if (model.SingleOrdouble == "单面")
{
price = ((model.PrintCount.ToDouble2().Value / 2).ToDecimal2().Value * priceSingle).JRoundInt();
}
else
{
price = (model.PrintCount * priceSingle).JRoundInt();
}
}
else if (model.PrintSizeName == "A5")
{
if (model.SingleOrdouble == "单面")
{
price = ((model.PrintCount.ToDouble2().Value / 4).ToDecimal2().Value * priceSingle).JRoundInt();
}
else
{
price = ((model.PrintCount.ToDouble2().Value / 2).ToDecimal2().Value * priceSingle).JRoundInt();
}
}
}
detail.PaperPriceStr += model.PrintCount + "张" + model.GramWeight.ToString() + "克" + printPaperInfo.PaperName + "×" + priceSingle.ToString("0.00") + "元,共计:" + price.ToString("0.00") + "元";
}
else
{
detail.PaperPriceStr += "封面纸价:";
PaperSizeDetailBLL _paperSizeDetailBLL = new PaperSizeDetailBLL();
SysInquiry_PaperSizeDetail paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(6, model.PrintSizeId);
if (printPaperInfo.PaperName == "自带纸")
{
detail.PaperPriceStr += "自带纸:0元;";
}
else
{
Inquiry_DigitalPrintPaperPrice paperPriceModel = _paperPriceBll.GetModel(inquiryId, model.PaperId);
if (paperPriceModel != null)
{
priceSingle = paperPriceModel.Price;
priceSingle = priceSingle * fastValue;
if (paperSize.Value.Value == 64)
{
if (model.SingleOrdouble == "单面")
{
price = ((model.PrintCount.ToDouble2().Value / 4).ToDecimal2().Value * priceSingle).JRoundInt();
}
else
{
price = ((model.PrintCount.ToDouble2().Value / 2).ToDecimal2().Value * priceSingle).JRoundInt();
}
}
else if (paperSize.Value.Value == 32)
{
if (model.SingleOrdouble == "单面")
{
price = ((model.PrintCount.ToDouble2().Value / 2).ToDecimal2().Value * priceSingle).JRoundInt();
}
else
{
price = ((model.PrintCount.ToDouble2().Value).ToDecimal2().Value * priceSingle).JRoundInt();
}
}
else if (paperSize.Value.Value == 24 || paperSize.Value.Value == 16)
{
if (model.SingleOrdouble == "单面")
{
price = ((model.PrintCount.ToDouble2().Value).ToDecimal2().Value * priceSingle).JRoundInt();
}
else
{
price = ((model.PrintCount.ToDouble2().Value * 2).ToDecimal2().Value * priceSingle).JRoundInt();
}
}
else if (paperSize.Value.Value == 12 || paperSize.Value.Value == 8)
{
if (model.SingleOrdouble == "单面")
{
price = ((model.PrintCount.ToDouble2().Value * 2).ToDecimal2().Value * priceSingle).JRoundInt();
}
else
{
price = ((model.PrintCount.ToDouble2().Value * 4).ToDecimal2().Value * priceSingle).JRoundInt();
}
}
}
detail.PaperPriceStr += model.PrintCount + "张" + model.GramWeight.ToString() + "克" + printPaperInfo.PaperName + "×" + priceSingle.ToString("0.00") + "元=" + price.ToString("0.00") + "元;";
}
decimal insidePrice = 0;
int paperNum = 0;
detail.PaperPriceStr += "内页纸价:";
foreach (InquiryInsideModel insideModel in model.InquiryInsideList)
{
paperNum = 0;
detail.PaperPriceStr += "内页" + insideModel.InsideIndex.ToString() + ":";
SysInquiry_DigitalPrintPaperInfo insidePaperInfo = _printPaperInfoBLL.SelectModelByKey(insideModel.PaperId);
if (insidePaperInfo.PaperName == "自带纸")
{
detail.PaperPriceStr += "自带纸:0元;";
continue;
}
else
{
Inquiry_DigitalPrintPaperPrice paperPriceModel = _paperPriceBll.GetModel(inquiryId, insideModel.PaperId);
if (paperPriceModel != null)
{
int realPageNum = GetRealPageNum(insideModel.PageNum, insideModel.PaperId, model.BindingMode);
priceSingle = paperPriceModel.Price;
priceSingle = priceSingle * fastValue;
if (paperSize.Value.Value == 64)
{
paperNum = (((realPageNum.ToDouble2().Value / 8).ToDecimal2().Value) * model.PrintCount).JRoundInt();
}
else if (paperSize.Value.Value == 32)
{
paperNum = (((realPageNum.ToDouble2().Value / 4).ToDecimal2().Value) * model.PrintCount).JRoundInt();
}
else if (paperSize.Value.Value == 24 || paperSize.Value.Value == 16)
{
paperNum = (((realPageNum.ToDouble2().Value / 2).ToDecimal2().Value) * model.PrintCount).JRoundInt();
}
else if (paperSize.Value.Value == 12 || paperSize.Value.Value == 8)
{
paperNum = realPageNum * model.PrintCount;
}
insidePrice = paperNum * priceSingle;
price += insidePrice;
detail.PaperPriceStr += paperNum.ToString() + "张" + model.GramWeight.ToString() + "克" + printPaperInfo.PaperName + "×" + priceSingle.ToString("0.00") + "元=" + insidePrice.ToString("0.00") + "元;";
}
}
}
detail.PaperPriceStr += "共计:" + price.ToString("0.00") + "元";
}
return price;
}
///
/// 计算数码快印后工序价格
///
///
///
///
///
///
public decimal GetDigitalAfterWorksPrice(InquiryCommonModel model, Guid inquiryId, decimal fastValue, InquiryDetail detail)
{
decimal allPrice = 0;
decimal price = 0;
int afterId = 0;
decimal num = 1;
AfterParameterInfoBLL _afterParameterInfoBLL = new AfterParameterInfoBLL();
if (model.DigitalPrintType == "单张")
{
if (model.PrintSizeName == "A4")
{
num = Convert.ToDecimal(0.5);
}
else if (model.PrintSizeName == "A5")
{
num = Convert.ToDecimal(0.25);
}
if (model.AfterWorkList != null && model.AfterWorkList.Count > 0)
{
foreach (int workId in model.AfterWorkList)
{
if (workId == 1)
{
afterId = model.CoveredTypeId;
}
else
{
afterId = workId;
}
if (afterId == 8) //烫金
{
price = GetPriceByGoldStampOrUV(model.PrintCount, model.PrintTypeId, inquiryId, afterId, model.TJWith, model.TJHight);
}
else if (afterId == 9) //击凹凸
{
price = GetPriceByGoldStampOrUV(model.PrintCount, model.PrintTypeId, inquiryId, afterId, model.ATWith, model.ATHight);
}
else if (afterId == 11) //UV
{
price = GetPriceByGoldStampOrUV(model.PrintCount, model.PrintTypeId, inquiryId, afterId, model.UVWith, model.UVHight);
}
else
{
price = GetMultipleAfterPrice(model.PrintCount, model.PrintTypeId, inquiryId, afterId);
}
SysInquiry_AfterParameterInfo afterInfo = _afterParameterInfoBLL.GetModel(afterId);
price = price * fastValue * num;
detail.AfterWorkPriceStr += afterInfo.ParameterName + ":" + price.ToString("0.00") + "元,";
allPrice += price;
}
}
detail.AfterWorkPriceStr += "共计:" + allPrice.ToString("0.00") + "元";
}
else
{
PaperSizeDetailBLL _paperSizeDetailBLL = new PaperSizeDetailBLL();
SysInquiry_PaperSizeDetail paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(6, model.PrintSizeId);
num = (Convert.ToDouble(8) / paperSize.Value.Value).ToDecimal2().Value;
if (model.AfterWorkList != null && model.AfterWorkList.Count > 0)
{
detail.AfterWorkPriceStr += "封面后道:";
foreach (int workId in model.AfterWorkList)
{
if (workId == 8) //烫金
{
price = GetPriceByGoldStampOrUV(model.PrintCount, model.PrintTypeId, inquiryId, workId, model.TJWith, model.TJHight);
}
else if (workId == 9) //击凹凸
{
price = GetPriceByGoldStampOrUV(model.PrintCount, model.PrintTypeId, inquiryId, workId, model.ATWith, model.ATHight);
}
else if (workId == 11) //UV
{
price = GetPriceByGoldStampOrUV(model.PrintCount, model.PrintTypeId, inquiryId, workId, model.UVWith, model.UVHight);
}
else if (workId == 32) //拉封
{
if (model.LaFeng == "封面封底均拉封")
{
price = GetLF(model, inquiryId, 52);
}
else if (model.LaFeng == "封面拉封")
{
price = GetLF(model, inquiryId, 50);
}
else
{
price = GetLF(model, inquiryId, 51);
}
}
else
{
price = GetMultipleAfterPrice(model.PrintCount, model.PrintTypeId, inquiryId, workId);
}
SysInquiry_AfterParameterInfo afterInfo = _afterParameterInfoBLL.GetModel(workId);
price = price * fastValue * num;
allPrice += price;
detail.AfterWorkPriceStr += afterInfo.ParameterName + ":" + price.ToString("0.00") + "元,";
}
detail.AfterWorkPriceStr += "合计:" + allPrice.ToString("0.00") + "元;";
}
decimal insidePrice = 0;
int numCount = 0;
foreach (InquiryInsideModel insideModel in model.InquiryInsideList)
{
insidePrice = 0;
List afterWorkList = insideModel.AfterWorkList;
if (afterWorkList != null && afterWorkList.Count > 0)
{
if (numCount == 0)
{
detail.AfterWorkPriceStr += "内页后道:";
numCount++;
}
detail.AfterWorkPriceStr += "内页" + insideModel.InsideIndex.ToString() + ":";
foreach (int workId in afterWorkList)
{
if (workId == 8) //烫金
{
price = GetPriceByGoldStampOrUVBYLY(model.PrintCount, model.PrintTypeId, inquiryId, workId, insideModel.TJWith, insideModel.TJHight, insideModel.TJNum);
}
else if (workId == 11)//UV
{
price = GetPriceByGoldStampOrUVBYLY(model.PrintCount, model.PrintTypeId, inquiryId, workId, insideModel.UVWith, insideModel.UVHight, insideModel.UVNum);
}
else
{
price = GetLYPrice(model.PrintCount, model.PrintTypeId, inquiryId, workId, insideModel);
}
SysInquiry_AfterParameterInfo afterInfo = _afterParameterInfoBLL.GetModel(workId);
price = price * fastValue * num;
insidePrice += price;
detail.AfterWorkPriceStr += afterInfo.ParameterName + ":" + price.ToString("0.00") + "元,";
}
detail.AfterWorkPriceStr += "合计:" + insidePrice.ToString("0.00") + "元;";
allPrice += insidePrice;
}
}
detail.AfterWorkPriceStr += "共计:" + allPrice.ToString("0.00") + "元;";
}
return allPrice;
}
///
/// 计算招牌字价格
///
///
///
///
///
///
public InquiryDetail GetSignboardInquiryDetail(InquiryCommonModel model, Guid inquiryId, Guid firmId, Guid customerId)
{
InquiryDetail detail = new InquiryDetail();
//总价
decimal totalPrice = 0;
//纸张价格
decimal paperPrice = 0;
//印工费
decimal impressPrice = 0;
//版费
decimal versionCost = 0;
decimal afterWorkPrice = 0;
//货运费
decimal cargagePrice = 0;
//税费
decimal taxationPrice = 0;
decimal fastValue = 1;
if ((customerId != Guid.Empty && inquiryId != customerId) || (customerId == Guid.Empty && inquiryId == Guid.Parse(UtilConst.AdminFirmId)))
{
FastSetByFirmBLL _fastSetByFirmBLL = new FastSetByFirmBLL();
Inquiry_FastSetByFirm fastModel = _fastSetByFirmBLL.GetModel(firmId, customerId, model.PrintTypeId);
if (fastModel != null)
{
fastValue = (fastModel.FastValue / 100);
}
}
decimal installPrice = 0;
string afterWorkListStr = string.Empty;
SignboardCostBLL _signboardCostBLL = new SignboardCostBLL();
Inquiry_SignboardCost signboardCost = _signboardCostBLL.GetModel(model.CharacterName, model.Thickness, inquiryId);
if (signboardCost != null)
{
paperPrice = (model.firstSize.ToDecimal2().Value * model.secondSize.ToDecimal2().Value) * signboardCost.Price * model.PageNum;
if (paperPrice < signboardCost.StartPrice)
{
paperPrice = signboardCost.StartPrice;
}
if (model.IsInstall == 1)
{
installPrice = (model.firstSize.ToDecimal2().Value * model.secondSize.ToDecimal2().Value) * signboardCost.InstallPrice;
if (installPrice < signboardCost.InstallStartPrice)
{
installPrice = signboardCost.InstallStartPrice;
}
afterWorkPrice = installPrice;
afterWorkListStr += "安装费:" + installPrice.ToString("0.00");
}
}
detail.PaperPriceStr = paperPrice.ToString("0.00");
detail.AfterWorkPriceStr = afterWorkListStr;
totalPrice += paperPrice + impressPrice + versionCost + afterWorkPrice;
if (model.DeliveryMode != 104)
cargagePrice = GetCargagePrice(totalPrice, inquiryId, model.DeliveryMode) * fastValue;
totalPrice = totalPrice + cargagePrice;
if (model.BillMode != 108)
{
decimal taxValue = GetTaxationValue(model.BillMode, inquiryId);
taxationPrice = (totalPrice * taxValue / 100) * fastValue;
}
totalPrice = totalPrice + taxationPrice;
detail.PrintCount = model.PrintCount;
detail.PaperPrice = paperPrice;
detail.ImpressPrice = impressPrice;
detail.VersionCost = versionCost;
detail.AfterWorkPrice = afterWorkPrice;
detail.CargagePrice = cargagePrice;
detail.TaxationPrice = taxationPrice;
detail.TotalPrice = totalPrice;
return detail;
}
///
/// 计算LED价格
///
///
///
///
///
///
public InquiryDetail GetLEDInquiryDetail(InquiryCommonModel model, Guid inquiryId, Guid firmId, Guid customerId)
{
InquiryDetail detail = new InquiryDetail();
//总价
decimal totalPrice = 0;
//纸张价格
decimal paperPrice = 0;
//印工费
decimal impressPrice = 0;
//版费
decimal versionCost = 0;
decimal afterWorkPrice = 0;
//货运费
decimal cargagePrice = 0;
//税费
decimal taxationPrice = 0;
decimal fastValue = 1;
if ((customerId != Guid.Empty && inquiryId != customerId) || (customerId == Guid.Empty && inquiryId == Guid.Parse(UtilConst.AdminFirmId)))
{
FastSetByFirmBLL _fastSetByFirmBLL = new FastSetByFirmBLL();
Inquiry_FastSetByFirm fastModel = _fastSetByFirmBLL.GetModel(firmId, customerId, model.PrintTypeId);
if (fastModel != null)
{
fastValue = (fastModel.FastValue / 100);
}
}
decimal installPrice = 0;
string afterWorkListStr = string.Empty;
LEDCostBLL _LEDCostBLL = new LEDCostBLL();
Inquiry_LEDCost ledCostModel = _LEDCostBLL.GetModel(inquiryId, model.LedMaterial);
if (ledCostModel != null)
{
paperPrice = (model.firstSize.ToDecimal2().Value * model.secondSize.ToDecimal2().Value) * ledCostModel.Price;
if (paperPrice < ledCostModel.StartPrice)
{
paperPrice = ledCostModel.StartPrice;
}
if (model.IsInstall == 1)
{
if (ledCostModel.InstallPrice.HasValue)
{
installPrice = (model.firstSize.ToDecimal2().Value * model.secondSize.ToDecimal2().Value) * ledCostModel.InstallPrice.Value;
}
if (ledCostModel.InstallStartPrice.HasValue)
{
if (installPrice < ledCostModel.InstallStartPrice.Value)
{
installPrice = ledCostModel.InstallStartPrice.Value;
}
}
afterWorkPrice = installPrice;
afterWorkListStr += "安装费:" + installPrice.ToString("0.00");
}
}
detail.PaperPriceStr = paperPrice.ToString("0.00");
detail.AfterWorkPriceStr = afterWorkListStr;
totalPrice += paperPrice + impressPrice + versionCost + afterWorkPrice;
if (model.DeliveryMode != 104)
cargagePrice = GetCargagePrice(totalPrice, inquiryId, model.DeliveryMode) * fastValue;
totalPrice = totalPrice + cargagePrice;
if (model.BillMode != 108)
{
decimal taxValue = GetTaxationValue(model.BillMode, inquiryId);
taxationPrice = (totalPrice * taxValue / 100) * fastValue;
}
totalPrice = totalPrice + taxationPrice;
detail.PrintCount = model.PrintCount;
detail.PaperPrice = paperPrice;
detail.ImpressPrice = impressPrice;
detail.VersionCost = versionCost;
detail.AfterWorkPrice = afterWorkPrice;
detail.CargagePrice = cargagePrice;
detail.TaxationPrice = taxationPrice;
detail.TotalPrice = totalPrice;
return detail;
}
///
/// 计算台历价格
///
///
///
///
///
///
public InquiryDetail GetDeskCalendaryInquiryDetail(InquiryCommonModel model, Guid inquiryId, Guid firmId, Guid customerId)
{
InquiryDetail detail = new InquiryDetail();
//总价
decimal totalPrice = 0;
//纸张价格
decimal paperPrice = 0;
//印工费
decimal impressPrice = 0;
//版费
decimal versionCost = 0;
decimal afterWorkPrice = 0;
//货运费
decimal cargagePrice = 0;
//税费
decimal taxationPrice = 0;
decimal fastValue = 1;
if ((customerId != Guid.Empty && inquiryId != customerId) || (customerId == Guid.Empty && inquiryId == Guid.Parse(UtilConst.AdminFirmId)))
{
FastSetByFirmBLL _fastSetByFirmBLL = new FastSetByFirmBLL();
Inquiry_FastSetByFirm fastModel = _fastSetByFirmBLL.GetModel(firmId, customerId, model.PrintTypeId);
if (fastModel != null)
{
fastValue = (fastModel.FastValue / 100);
}
}
PaperSizeDetailBLL _paperSizeDetailBLL = new PaperSizeDetailBLL();
SysInquiry_PaperSizeDetail paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(model.PrintTypeId, model.PrintSizeId);
paperPrice = GetPaperPriceByDeskCalendar(model, inquiryId, paperSize, detail, fastValue);
impressPrice = GetDeskCalendaryImpressPrice(model, paperSize, inquiryId, ref versionCost, detail, fastValue, firmId, customerId);
string afterWorkListStr = string.Empty;
//计算后工序价格
afterWorkPrice = GetAfterWorkListPrice(model, inquiryId, paperSize, ref afterWorkListStr, fastValue);
detail.AfterWorkPriceStr = afterWorkListStr;
totalPrice += paperPrice + impressPrice + versionCost + afterWorkPrice;
if (model.DeliveryMode != 104)
cargagePrice = GetCargagePrice(totalPrice, inquiryId, model.DeliveryMode) * fastValue;
totalPrice = totalPrice + cargagePrice;
if (model.BillMode != 108)
{
decimal taxValue = GetTaxationValue(model.BillMode, inquiryId);
taxationPrice = (totalPrice * taxValue / 100) * fastValue;
}
totalPrice = totalPrice + taxationPrice;
detail.PrintCount = model.PrintCount;
detail.PaperPrice = paperPrice;
detail.ImpressPrice = impressPrice;
detail.VersionCost = versionCost;
detail.AfterWorkPrice = afterWorkPrice;
detail.CargagePrice = cargagePrice;
detail.TaxationPrice = taxationPrice;
detail.TotalPrice = totalPrice;
return detail;
}
///
/// 获取纸张价格(台历)
///
///
///
///
public decimal GetPaperPriceByDeskCalendar(InquiryCommonModel model, Guid inquiryId, SysInquiry_PaperSizeDetail paperSize, InquiryDetail detail, decimal fastValue)
{
decimal toalPaperPrice = 0;
if (model.PaperId == 0)
{
detail.PaperPriceStr = "自带纸:0元";
}
else
{
PaperSizeDetailBLL _paperSizeDetailBLL = new PaperSizeDetailBLL();
paperSize.Name = "大" + paperSize.Name;
decimal priceBySingle = GetPaperPriceBySingle(model.PaperId, model.GramWeight, model.BrandId, inquiryId, paperSize.Name);
priceBySingle = priceBySingle * fastValue;
int toalConsumption = 0;
int allCount = 0;
int totalPaperCount = GetTotalPaperCountByDeskCalendary(model, paperSize, inquiryId, detail, ref toalConsumption, ref allCount);
toalPaperPrice = priceBySingle * totalPaperCount;
PaperInfoBLL _paperInfoBLL = new PaperInfoBLL();
SysInquiry_PaperInfo paperModel = _paperInfoBLL.GetPaperModel(model.PaperId);
detail.PaperPriceStr = model.GramWeight + "克" + paperModel.PaperName + totalPaperCount.ToString() + "张(正数" + allCount.ToString() + "+消耗" + toalConsumption.ToString() + ")×" + priceBySingle.ToString("0.00") + "元,共" + toalPaperPrice.ToString("0.00") + "元";
}
return toalPaperPrice;
}
///
/// 获取纸张总数量(台历)
///
///
///
///
///
///
///
///
public int GetTotalPaperCountByDeskCalendary(InquiryCommonModel model, SysInquiry_PaperSizeDetail paperSize, Guid inquiryId, InquiryDetail detail, ref int toalConsumption, ref int allCount)
{
int totalPaperCount = 0;
int basicConsumption = 0;
int afterWorkConsumption = 0;
int afterConsum = 0;
int minNum = 0;
if (paperSize.Value.Value == 32)
{
if (model.PageNum == 6)
{
minNum = (model.PrintCount.ToDouble2().Value / 16).ToDecimal2().Value.JRoundInt();
allCount = ((model.PrintCount.ToDouble2().Value / 8) + (model.PrintCount.ToDouble2().Value / 16)).ToDecimal2().Value.JRoundInt();
}
else if (model.PageNum == 7)
{
minNum = (model.PrintCount.ToDouble2().Value / 4).ToDecimal2().Value.JRoundInt();
allCount = ((model.PrintCount.ToDouble2().Value / 4)).ToDecimal2().Value.JRoundInt();
}
else if (model.PageNum == 12)
{
minNum = (model.PrintCount.ToDouble2().Value / 8).ToDecimal2().Value.JRoundInt();
allCount = ((model.PrintCount.ToDouble2().Value / 4) + (model.PrintCount.ToDouble2().Value / 8)).ToDecimal2().Value.JRoundInt();
}
else if (model.PageNum == 13)
{
minNum = (model.PrintCount.ToDouble2().Value / 2).ToDecimal2().Value.JRoundInt();
allCount = ((model.PrintCount.ToDouble2().Value / 2)).ToDecimal2().Value.JRoundInt();
}
else if (model.PageNum == 24)
{
minNum = (model.PrintCount.ToDouble2().Value / 4).ToDecimal2().Value.JRoundInt();
allCount = ((model.PrintCount.ToDouble2().Value / 2) + (model.PrintCount.ToDouble2().Value / 4)).ToDecimal2().Value.JRoundInt();
}
else if (model.PageNum == 25)
{
minNum = (model.PrintCount.ToDouble2().Value / 16).ToDecimal2().Value.JRoundInt();
allCount = ((model.PrintCount.ToDouble2().Value / 2) + (model.PrintCount.ToDouble2().Value / 4) + (model.PrintCount.ToDouble2().Value / 16)).ToDecimal2().Value.JRoundInt();
}
}
else if (paperSize.Value.Value == 24)
{
if (model.PageNum == 6)
{
minNum = (model.PrintCount.ToDouble2().Value / 4).ToDecimal2().Value.JRoundInt();
allCount = ((model.PrintCount.ToDouble2().Value / 4)).ToDecimal2().Value.JRoundInt();
}
else if (model.PageNum == 7)
{
minNum = (model.PrintCount.ToDouble2().Value / 16).ToDecimal2().Value.JRoundInt();
allCount = ((model.PrintCount.ToDouble2().Value / 4) + (model.PrintCount.ToDouble2().Value / 16)).ToDecimal2().Value.JRoundInt();
}
else if (model.PageNum == 12)
{
minNum = (model.PrintCount.ToDouble2().Value / 2).ToDecimal2().Value.JRoundInt();
allCount = ((model.PrintCount.ToDouble2().Value / 2)).ToDecimal2().Value.JRoundInt();
}
else if (model.PageNum == 13)
{
minNum = (model.PrintCount.ToDouble2().Value / 16).ToDecimal2().Value.JRoundInt();
allCount = ((model.PrintCount.ToDouble2().Value / 2) + (model.PrintCount.ToDouble2().Value / 16)).ToDecimal2().Value.JRoundInt();
}
else if (model.PageNum == 24)
{
minNum = (model.PrintCount.ToDouble2().Value / 2).ToDecimal2().Value.JRoundInt();
allCount = ((model.PrintCount.ToDouble2().Value / 2) * 2).ToDecimal2().Value.JRoundInt();
}
else if (model.PageNum == 25)
{
minNum = (model.PrintCount.ToDouble2().Value / 16).ToDecimal2().Value.JRoundInt();
allCount = ((model.PrintCount.ToDouble2().Value / 2) * 2 + (model.PrintCount.ToDouble2().Value / 16)).ToDecimal2().Value.JRoundInt();
}
}
else if (paperSize.Value.Value == 16)
{
if (model.PageNum == 6)
{
minNum = (model.PrintCount.ToDouble2().Value / 8).ToDecimal2().Value.JRoundInt();
allCount = ((model.PrintCount.ToDouble2().Value / 4) + (model.PrintCount.ToDouble2().Value / 8)).ToDecimal2().Value.JRoundInt();
}
else if (model.PageNum == 7)
{
minNum = (model.PrintCount.ToDouble2().Value / 2).ToDecimal2().Value.JRoundInt();
allCount = ((model.PrintCount.ToDouble2().Value / 2)).ToDecimal2().Value.JRoundInt();
}
else if (model.PageNum == 12)
{
minNum = (model.PrintCount.ToDouble2().Value / 4).ToDecimal2().Value.JRoundInt();
allCount = ((model.PrintCount.ToDouble2().Value / 2) + (model.PrintCount.ToDouble2().Value / 4)).ToDecimal2().Value.JRoundInt();
}
else if (model.PageNum == 13)
{
minNum = (model.PrintCount.ToDouble2().Value / 16).ToDecimal2().Value.JRoundInt();
allCount = ((model.PrintCount.ToDouble2().Value / 2) + (model.PrintCount.ToDouble2().Value / 4) + (model.PrintCount.ToDouble2().Value / 16)).ToDecimal2().Value.JRoundInt();
}
else if (model.PageNum == 24)
{
minNum = (model.PrintCount.ToDouble2().Value / 2).ToDecimal2().Value.JRoundInt();
allCount = ((model.PrintCount.ToDouble2().Value / 2) * 3).ToDecimal2().Value.JRoundInt();
}
else if (model.PageNum == 25)
{
minNum = (model.PrintCount.ToDouble2().Value / 16).ToDecimal2().Value.JRoundInt();
allCount = ((model.PrintCount.ToDouble2().Value / 2) * 3 + (model.PrintCount.ToDouble2().Value / 16)).ToDecimal2().Value.JRoundInt();
}
}
BasicConsumptionBLL _basicConsumptionBLL = new BasicConsumptionBLL();
Inquiry_BasicConsumption basicConsumptionModel = _basicConsumptionBLL.GetModel(inquiryId, model.PrintTypeId);
basicConsumption = (allCount * (basicConsumptionModel.basicRatio / 100)).JRoundInt();
if (basicConsumption < basicConsumptionModel.minNumber)
basicConsumption = basicConsumptionModel.minNumber;
AfterConsumptionBLL _afterConsumptionBLL = new AfterConsumptionBLL();
if (model.AfterWorkList != null && model.AfterWorkList.Count > 0)
{
foreach (int afterId in model.AfterWorkList)
{
Inquiry_AfterConsumption afterConsumption = _afterConsumptionBLL.GetModel(inquiryId, model.PrintTypeId, afterId);
afterConsum = (minNum * afterConsumption.BasicRatio / 100).JRoundInt();
if (afterConsum < afterConsumption.MinNumber)
afterConsum = afterConsumption.MinNumber;
afterWorkConsumption += afterConsum;
}
}
InquiryInsideModel insideModel = model.InquiryInsideList[0];
if (insideModel.AfterWorkList != null && insideModel.AfterWorkList.Count > 0)
{
foreach (int afterId in insideModel.AfterWorkList)
{
Inquiry_AfterConsumption afterConsumption = _afterConsumptionBLL.GetModel(inquiryId, model.PrintTypeId, afterId);
afterConsum = (minNum * afterConsumption.BasicRatio / 100).JRoundInt();
if (afterConsum < afterConsumption.MinNumber)
afterConsum = afterConsumption.MinNumber;
afterWorkConsumption += afterConsum;
}
}
toalConsumption = basicConsumption + afterWorkConsumption;
totalPaperCount = allCount + toalConsumption;
return totalPaperCount;
}
///
/// 计算台历的印工
///
///
///
///
///
///
///
///
public decimal GetDeskCalendaryImpressPrice(InquiryCommonModel model, SysInquiry_PaperSizeDetail paperSize, Guid inquiryId, ref decimal totalVersionCost, InquiryDetail detail, decimal fastValue, Guid firmId, Guid customerId)
{
decimal totalImpressPrice = 0;
int equipmentId = 0;
int impressionCount = 0;
decimal impressPrice = 0;
decimal versionCost = 0;
int num = 0;
impressionCount = model.PrintCount;
if (paperSize.Value.Value == 32)
{
if (model.PageNum == 6)
{
equipmentId = 2;
num = 2;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
}
else if (model.PageNum == 7)
{
equipmentId = 1;
num = 1;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
}
else if (model.PageNum == 12)
{
equipmentId = 1;
num = 1;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
equipmentId = 2;
num = 1;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
}
else if (model.PageNum == 13)
{
equipmentId = 1;
num = 2;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
}
else if (model.PageNum == 24)
{
equipmentId = 1;
num = 3;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
}
else if (model.PageNum == 25)
{
equipmentId = 1;
num = 3;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
equipmentId = 2;
num = 1;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
}
}
else if (paperSize.Value.Value == 24)
{
if (model.PageNum == 6)
{
equipmentId = 1;
num = 1;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
}
else if (model.PageNum == 7)
{
equipmentId = 1;
num = 3;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
equipmentId = 2;
num = 1;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
}
else if (model.PageNum == 12)
{
equipmentId = 1;
num = 2;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
}
else if (model.PageNum == 13)
{
equipmentId = 1;
num = 2;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
equipmentId = 2;
num = 1;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
}
else if (model.PageNum == 24)
{
equipmentId = 1;
num = 4;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
}
else if (model.PageNum == 25)
{
equipmentId = 1;
num = 4;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
equipmentId = 2;
num = 1;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
}
}
else if (paperSize.Value.Value == 16)
{
if (model.PageNum == 6)
{
equipmentId = 1;
num = 1;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
equipmentId = 2;
num = 1;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
}
else if (model.PageNum == 7)
{
equipmentId = 1;
num = 2;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
}
else if (model.PageNum == 12)
{
equipmentId = 1;
num = 3;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
}
else if (model.PageNum == 13)
{
equipmentId = 1;
num = 3;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
equipmentId = 2;
num = 1;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
}
else if (model.PageNum == 24)
{
equipmentId = 1;
num = 6;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
}
else if (model.PageNum == 25)
{
equipmentId = 1;
num = 6;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
equipmentId = 2;
num = 1;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
}
}
detail.ImpressPriceStr += "共计:" + totalImpressPrice.ToString("0.00") + "元";
return totalImpressPrice;
}
///
/// 计算挂历价格
///
///
public InquiryDetail GetCalendaryInquiryDetail(InquiryCommonModel model, Guid inquiryId, Guid firmId, Guid customerId)
{
InquiryDetail detail = new InquiryDetail();
//总价
decimal totalPrice = 0;
//纸张价格
decimal paperPrice = 0;
//印工费
decimal impressPrice = 0;
//版费
decimal versionCost = 0;
decimal afterWorkPrice = 0;
//货运费
decimal cargagePrice = 0;
//税费
decimal taxationPrice = 0;
decimal fastValue = 1;
if ((customerId != Guid.Empty && inquiryId != customerId) || (customerId == Guid.Empty && inquiryId == Guid.Parse(UtilConst.AdminFirmId)))
{
FastSetByFirmBLL _fastSetByFirmBLL = new FastSetByFirmBLL();
Inquiry_FastSetByFirm fastModel = _fastSetByFirmBLL.GetModel(firmId, customerId, model.PrintTypeId);
if (fastModel != null)
{
fastValue = (fastModel.FastValue / 100);
}
}
PaperSizeDetailBLL _paperSizeDetailBLL = new PaperSizeDetailBLL();
SysInquiry_PaperSizeDetail paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(model.PrintTypeId, model.PrintSizeId);
paperPrice = GetPaperPriceByCalendary(model, inquiryId, paperSize, detail, fastValue);
impressPrice = GetCalendaryImpressPrice(model, paperSize, inquiryId, ref versionCost, detail, fastValue, firmId, customerId);
string afterWorkListStr = string.Empty;
//计算后工序价格
afterWorkPrice = GetAfterWorkListPrice(model, inquiryId, paperSize, ref afterWorkListStr, fastValue);
detail.AfterWorkPriceStr = afterWorkListStr;
totalPrice += paperPrice + impressPrice + versionCost + afterWorkPrice;
if (model.DeliveryMode != 104)
cargagePrice = GetCargagePrice(totalPrice, inquiryId, model.DeliveryMode) * fastValue;
totalPrice = totalPrice + cargagePrice;
if (model.BillMode != 108)
{
decimal taxValue = GetTaxationValue(model.BillMode, inquiryId);
taxationPrice = (totalPrice * taxValue / 100) * fastValue;
}
totalPrice = totalPrice + taxationPrice;
detail.PrintCount = model.PrintCount;
detail.PaperPrice = paperPrice;
detail.ImpressPrice = impressPrice;
detail.VersionCost = versionCost;
detail.AfterWorkPrice = afterWorkPrice;
detail.CargagePrice = cargagePrice;
detail.TaxationPrice = taxationPrice;
detail.TotalPrice = totalPrice;
return detail;
}
///
/// 获取纸张价格(挂历)
///
///
///
///
public decimal GetPaperPriceByCalendary(InquiryCommonModel model, Guid inquiryId, SysInquiry_PaperSizeDetail paperSize, InquiryDetail detail, decimal fastValue)
{
decimal toalPaperPrice = 0;
if (model.PaperId == 0)
{
detail.PaperPriceStr = "自带纸:0元";
}
else
{
PaperSizeDetailBLL _paperSizeDetailBLL = new PaperSizeDetailBLL();
decimal priceBySingle = GetPaperPriceBySingle(model.PaperId, model.GramWeight, model.BrandId, inquiryId, paperSize.Name);
priceBySingle = priceBySingle * fastValue;
int toalConsumption = 0;
int allCount = 0;
int totalPaperCount = GetTotalPaperCountByCalendary(model, paperSize, inquiryId, detail, ref toalConsumption, ref allCount);
toalPaperPrice = priceBySingle * totalPaperCount;
PaperInfoBLL _paperInfoBLL = new PaperInfoBLL();
SysInquiry_PaperInfo paperModel = _paperInfoBLL.GetPaperModel(model.PaperId);
detail.PaperPriceStr = model.GramWeight + "克" + paperModel.PaperName + totalPaperCount.ToString() + "张(正数" + allCount.ToString() + "+消耗" + toalConsumption.ToString() + ")×" + priceBySingle.ToString("0.00") + "元,共" + toalPaperPrice.ToString("0.00") + "元";
}
return toalPaperPrice;
}
///
/// 获取纸张总数量(挂历)
///
///
///
///
///
///
///
///
public int GetTotalPaperCountByCalendary(InquiryCommonModel model, SysInquiry_PaperSizeDetail paperSize, Guid inquiryId, InquiryDetail detail, ref int toalConsumption, ref int allCount)
{
int totalPaperCount = 0;
int basicConsumption = 0;
int afterWorkConsumption = 0;
int afterConsum = 0;
if (paperSize.Value.Value == 8)
{
if (model.PageNum == 6)
{
allCount = ((model.PrintCount.ToDouble2().Value / 2) + (model.PrintCount.ToDouble2().Value / 4)).ToDecimal2().Value.JRoundInt();
}
else if (model.PageNum == 7)
{
allCount = ((model.PrintCount.ToDouble2().Value / 2) + (model.PrintCount.ToDouble2().Value / 4) + (model.PrintCount.ToDouble2().Value / 8)).ToDecimal2().Value.JRoundInt();
}
else if (model.PageNum == 12)
{
allCount = ((model.PrintCount.ToDouble2().Value / 2) * 3).ToDecimal2().Value.JRoundInt();
}
else if (model.PageNum == 13)
{
allCount = ((model.PrintCount.ToDouble2().Value / 2) * 3 + (model.PrintCount.ToDouble2().Value / 8)).ToDecimal2().Value.JRoundInt();
}
}
else if (paperSize.Value.Value == 6)
{
if (model.PageNum == 6)
{
allCount = ((model.PrintCount.ToDouble2().Value / 3) * 3).ToDecimal2().Value.JRoundInt();
}
else if (model.PageNum == 7)
{
allCount = ((model.PrintCount.ToDouble2().Value / 3) * 3 + (model.PrintCount.ToDouble2().Value / 6)).ToDecimal2().Value.JRoundInt();
}
else if (model.PageNum == 12)
{
allCount = ((model.PrintCount.ToDouble2().Value / 3) * 6).ToDecimal2().Value.JRoundInt();
}
else if (model.PageNum == 13)
{
allCount = ((model.PrintCount.ToDouble2().Value / 3) * 6 + (model.PrintCount.ToDouble2().Value / 6)).ToDecimal2().Value.JRoundInt();
}
}
else if (paperSize.Value.Value == 4)
{
if (model.PageNum == 6)
{
allCount = ((model.PrintCount.ToDouble2().Value / 2) * 3).ToDecimal2().Value.JRoundInt();
}
else if (model.PageNum == 7)
{
allCount = ((model.PrintCount.ToDouble2().Value / 2) * 3 + (model.PrintCount.ToDouble2().Value / 4)).ToDecimal2().Value.JRoundInt();
}
else if (model.PageNum == 12)
{
allCount = ((model.PrintCount.ToDouble2().Value / 2) * 6).ToDecimal2().Value.JRoundInt();
}
else if (model.PageNum == 13)
{
allCount = ((model.PrintCount.ToDouble2().Value / 2) * 6 + (model.PrintCount.ToDouble2().Value / 4)).ToDecimal2().Value.JRoundInt();
}
}
else if (paperSize.Value.Value == 3)
{
allCount = ((model.PrintCount.ToDouble2().Value / 3) * model.PageNum).ToDecimal2().Value.JRoundInt();
}
else if (paperSize.Value.Value == 2)
{
allCount = ((model.PrintCount.ToDouble2().Value / 2) * model.PageNum).ToDecimal2().Value.JRoundInt();
}
BasicConsumptionBLL _basicConsumptionBLL = new BasicConsumptionBLL();
Inquiry_BasicConsumption basicConsumptionModel = _basicConsumptionBLL.GetModel(inquiryId, model.PrintTypeId);
basicConsumption = (allCount * (basicConsumptionModel.basicRatio / 100)).JRoundInt();
if (basicConsumption < basicConsumptionModel.minNumber)
basicConsumption = basicConsumptionModel.minNumber;
if (model.AfterWorkList != null && model.AfterWorkList.Count > 0)
{
AfterConsumptionBLL _afterConsumptionBLL = new AfterConsumptionBLL();
foreach (int afterId in model.AfterWorkList)
{
Inquiry_AfterConsumption afterConsumption = _afterConsumptionBLL.GetModel(inquiryId, model.PrintTypeId, afterId);
afterConsum = (allCount * afterConsumption.BasicRatio / 100).JRoundInt();
if (afterConsum < afterConsumption.MinNumber)
afterConsum = afterConsumption.MinNumber;
afterWorkConsumption += afterConsum;
}
}
toalConsumption = basicConsumption + afterWorkConsumption;
totalPaperCount = allCount + toalConsumption;
return totalPaperCount;
}
///
/// 计算挂历的印工
///
///
///
///
///
///
///
///
public decimal GetCalendaryImpressPrice(InquiryCommonModel model, SysInquiry_PaperSizeDetail paperSize, Guid inquiryId, ref decimal totalVersionCost, InquiryDetail detail, decimal fastValue, Guid firmId, Guid customerId)
{
decimal totalImpressPrice = 0;
int equipmentId = 0;
int impressionCount = 0;
decimal impressPrice = 0;
decimal versionCost = 0;
int num = 0;
impressionCount = model.PrintCount;
if (paperSize.Value.Value == 8)
{
if (model.PageNum == 6)
{
equipmentId = 1;
num = 1;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
equipmentId = 2;
num = 1;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
}
else if (model.PageNum == 7)
{
equipmentId = 1;
num = 1;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
equipmentId = 2;
num = 1;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
equipmentId = 2;
num = 1;
impressionCount = ((impressionCount.ToDouble2().Value) / 2).ToDecimal2().Value.JRoundInt();
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
}
else if (model.PageNum == 12)
{
equipmentId = 1;
num = 3;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
}
else if (model.PageNum == 13)
{
equipmentId = 1;
num = 3;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
equipmentId = 2;
num = 1;
impressionCount = ((impressionCount.ToDouble2().Value) / 2).ToDecimal2().Value.JRoundInt();
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
}
}
else if (paperSize.Value.Value == 6)
{
if (model.PageNum == 6)
{
equipmentId = 1;
num = 3;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
}
else if (model.PageNum == 7)
{
equipmentId = 1;
num = 3;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
equipmentId = 2;
num = 1;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
}
else if (model.PageNum == 12)
{
equipmentId = 1;
num = 6;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
}
else if (model.PageNum == 13)
{
equipmentId = 1;
num = 6;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
equipmentId = 2;
num = 1;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
}
}
else if (paperSize.Value.Value == 4)
{
if (model.PageNum == 6)
{
equipmentId = 1;
num = 3;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
}
else if (model.PageNum == 7)
{
equipmentId = 1;
num = 3;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
equipmentId = 2;
num = 1;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
}
else if (model.PageNum == 12)
{
equipmentId = 1;
num = 6;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
}
else if (model.PageNum == 13)
{
equipmentId = 1;
num = 6;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
equipmentId = 2;
num = 1;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
}
}
else if (paperSize.Value.Value == 3)
{
equipmentId = 1;
num = model.PageNum;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
}
else if (paperSize.Value.Value == 2)
{
equipmentId = 1;
num = model.PageNum;
impressPrice = GetImpressPriceBy2Or4(impressionCount, equipmentId, num, inquiryId, ref versionCost, fastValue, detail, firmId, customerId);
totalImpressPrice += impressPrice;
totalVersionCost += versionCost;
}
detail.ImpressPriceStr += "共计:" + totalImpressPrice.ToString("0.00") + "元";
return totalImpressPrice;
}
///
/// 获取优惠后的印次
///
///
///
///
///
///
private int GetRealImpressionCount(int impressionCount, int maxCount, Guid firmId, Guid customerId)
{
int tempImpressionCount = 0;
tempImpressionCount = impressionCount;
if (tempImpressionCount < maxCount)
{
ReduceWorkCountSetBLL _reduceWorkCountSetBLL = new ReduceWorkCountSetBLL();
Inquiry_ReduceWorkCountSet model = _reduceWorkCountSetBLL.GetModel(firmId, customerId);
if (model != null && model.Count.HasValue && model.Count.Value > 0 && tempImpressionCount > model.Count.Value)
{
tempImpressionCount = tempImpressionCount - model.Count.Value;
}
if (tempImpressionCount < 0)
{
tempImpressionCount = 1000;
}
}
return tempImpressionCount;
}
///
/// 获取2开机或者4开机的印工价和版费
///
///
public decimal GetImpressPriceBy2Or4(int impressionCount, int equipmentId, int num, Guid inquiryId, ref decimal versionCost, decimal fastValue, InquiryDetail detail, Guid firmId, Guid customerId)
{
decimal impressPrice = 0;
decimal addimpressionCount = 0;
PrintingWorksBLL _printingWorksBLL = new PrintingWorksBLL();
impressionCount = GetRealImpressionCount(impressionCount, 10001, firmId, customerId);
Inquiry_PrintingWorks printWork = _printingWorksBLL.GetModel(impressionCount, equipmentId, inquiryId);
if (printWork != null)
{
impressPrice = printWork.WorkPrice;
if (impressionCount > 10000)
{
//addimpressionCount = impressionCount - 10000;
//if (printWork.AddPrintCount.HasValue && printWork.AddPrintCount.Value > 0)
//{
// double f = (addimpressionCount.ToDouble2().Value / (1000).ToDouble2().Value / (printWork.AddPrintCount.Value).ToDouble2().Value);
// addimpressionCount = f.ToString("0.0").ToDecimal2().Value;
// impressPrice += addimpressionCount * printWork.AddPrice.Value;
//}
impressPrice = ((impressionCount.ToDouble2().Value / 1000).ToDecimal2().Value) * impressPrice;
}
versionCost = printWork.VersionCost;
}
impressPrice = impressPrice * fastValue;
versionCost = versionCost * fastValue;
impressPrice = impressPrice * num;
versionCost = versionCost * num;
PrintingMachineBLL _printingMachineBLL = new PrintingMachineBLL();
SysInquiry_PrintingMachine machineModel = _printingMachineBLL.GetModelByKeyId(equipmentId);
detail.ImpressPriceStr += num.ToString() + "套" + machineModel.MachineName + impressionCount.ToString() + "印次:" + impressPrice.ToString("0.00") + "元;";
return impressPrice;
}
///
/// 计算收据联单价格
///
///
///
///
///
public InquiryDetail GetReceiptDocumentInquiryDetail(InquiryCommonModel model, Guid inquiryId, Guid firmId, Guid customerId)
{
InquiryDetail detail = new InquiryDetail();
//总价
decimal totalPrice = 0;
//纸张价格
decimal paperPrice = 0;
//印工费
decimal impressPrice = 0;
//版费
decimal versionCost = 0;
decimal afterWorkPrice = 0;
//货运费
decimal cargagePrice = 0;
//税费
decimal taxationPrice = 0;
decimal fastValue = 1;
if ((customerId != Guid.Empty && inquiryId != customerId) || (customerId == Guid.Empty && inquiryId == Guid.Parse(UtilConst.AdminFirmId)))
{
FastSetByFirmBLL _fastSetByFirmBLL = new FastSetByFirmBLL();
Inquiry_FastSetByFirm fastModel = _fastSetByFirmBLL.GetModel(firmId, customerId, model.PrintTypeId);
if (fastModel != null)
{
fastValue = (fastModel.FastValue / 100);
}
}
PaperSizeDetailBLL _paperSizeDetailBLL = new PaperSizeDetailBLL();
SysInquiry_PaperSizeDetail paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(model.PrintTypeId, model.PrintSizeId);
int ryNumCount = 2;
if (model.RLNum == "两联")
{
ryNumCount = 2;
}
else if (model.RLNum == "三联")
{
ryNumCount = 3;
}
else if (model.RLNum == "四联")
{
ryNumCount = 4;
}
else if (model.RLNum == "五联")
{
ryNumCount = 5;
}
if (model.PrintMode == 1)
{
paperPrice = GetReceiptDocumentFast(model, paperSize, inquiryId, detail, fastValue);
}
else
{
string afterWorkListStr = string.Empty;
paperPrice = GetPaperPriceByReceiptDocument(model, inquiryId, paperSize, ryNumCount, detail, fastValue);
impressPrice = GetReceiptDocumentImpressPrice(model, paperSize, ryNumCount, inquiryId, ref versionCost, detail, fastValue);
//计算后工序价格
afterWorkPrice = GetAfterWorkListPrice(model, inquiryId, paperSize, ref afterWorkListStr, fastValue);
detail.AfterWorkPriceStr = afterWorkListStr;
}
totalPrice += paperPrice + impressPrice + versionCost + afterWorkPrice;
if (model.DeliveryMode != 104)
cargagePrice = GetCargagePrice(totalPrice, inquiryId, model.DeliveryMode) * fastValue;
totalPrice = totalPrice + cargagePrice;
if (model.BillMode != 108)
{
decimal taxValue = GetTaxationValue(model.BillMode, inquiryId);
taxationPrice = (totalPrice * taxValue / 100) * fastValue;
}
totalPrice = totalPrice + taxationPrice;
detail.PrintCount = model.PrintCount;
detail.PaperPrice = paperPrice;
detail.ImpressPrice = impressPrice;
detail.VersionCost = versionCost;
detail.AfterWorkPrice = afterWorkPrice;
detail.CargagePrice = cargagePrice;
detail.TaxationPrice = taxationPrice;
detail.TotalPrice = totalPrice;
return detail;
}
///
/// 获取纸张价格(收据联单)
///
///
///
///
public decimal GetPaperPriceByReceiptDocument(InquiryCommonModel model, Guid inquiryId, SysInquiry_PaperSizeDetail paperSize, int rlNumCount, InquiryDetail detail, decimal fastValue)
{
decimal toalPaperPrice = 0;
if (model.PaperId == 0)
{
detail.PaperPriceStr = "自带纸:0元";
}
else
{
PaperSizeDetailBLL _paperSizeDetailBLL = new PaperSizeDetailBLL();
decimal priceBySingle = GetPaperPriceBySingle(model.PaperMP.ToInt32().Value, model.GramWeight, model.BrandId, inquiryId, paperSize.Name);
priceBySingle = priceBySingle * fastValue;
int toalConsumption = 0;
int allCount = 0;
int totalPaperCount = GetTotalPaperCountByReceiptDocument(model, paperSize, inquiryId, detail, ref toalConsumption, ref allCount);
toalPaperPrice = priceBySingle * totalPaperCount * rlNumCount;
PaperInfoBLL _paperInfoBLL = new PaperInfoBLL();
SysInquiry_PaperInfo paperModel = _paperInfoBLL.GetPaperModel(model.PaperId);
detail.PaperPriceStr = model.GramWeight + "克" + paperModel.PaperName + totalPaperCount.ToString() + "张(正数" + allCount.ToString() + "+消耗" + toalConsumption.ToString() + ")×" + rlNumCount.ToString() + "×" + priceBySingle.ToString("0.00") + "元,共" + toalPaperPrice.ToString("0.00") + "元";
}
return toalPaperPrice;
}
///
/// 获取纸张总数量(收据联单)
///
///
///
///
///
///
///
///
public int GetTotalPaperCountByReceiptDocument(InquiryCommonModel model, SysInquiry_PaperSizeDetail paperSize, Guid inquiryId, InquiryDetail detail, ref int toalConsumption, ref int allCount)
{
int totalPaperCount = 0;
int basicConsumption = 0;
int printColorConsumption = 0;
//总份数
int totalNum = model.PrintCount * model.PageNum;
allCount = ((model.PrintCount.ToDouble2().Value / paperSize.Value.Value).ToDecimal2().Value * model.PageNum).JRoundInt();
BasicConsumptionBLL _basicConsumptionBLL = new BasicConsumptionBLL();
Inquiry_BasicConsumption basicConsumptionModel = _basicConsumptionBLL.GetModel(inquiryId, model.PrintTypeId);
basicConsumption = (allCount * (basicConsumptionModel.basicRatio / 100)).JRoundInt();
if (basicConsumption < basicConsumptionModel.minNumber)
basicConsumption = basicConsumptionModel.minNumber;
if (model.PrintColor != "单色")
{
PrintColorConsumptionBLL _printColorConsumptionBLL = new PrintColorConsumptionBLL();
Inquiry_PrintColorConsumption printColorCon = _printColorConsumptionBLL.GetModel(inquiryId, model.PrintTypeId, model.PrintColor);
printColorConsumption = (allCount * (printColorCon.basicRatio / 100)).JRoundInt();
if (printColorCon.minNumber.HasValue)
{
if (printColorConsumption < printColorCon.minNumber)
{
printColorConsumption = printColorCon.minNumber.Value;
}
}
}
toalConsumption = basicConsumption + printColorConsumption;
totalPaperCount = allCount + toalConsumption;
return totalPaperCount;
}
///
/// 计算收据联单的印工
///
///
///
///
///
///
///
///
public decimal GetReceiptDocumentImpressPrice(InquiryCommonModel model, SysInquiry_PaperSizeDetail paperSize, int rlNumCount, Guid inquiryId, ref decimal versionCost, InquiryDetail detail, decimal fastValue)
{
decimal impressPrice = 0;
int equipmentId = 0;
int impressionCount = 0;
int printColorNum = 0;
if (model.PrintColor == "单色")
{
printColorNum = 1;
}
else if (model.PrintColor == "双色")
{
printColorNum = 2;
}
else if (model.PrintColor == "三色")
{
printColorNum = 3;
}
else if (model.PrintColor == "四色")
{
printColorNum = 4;
}
//总份数
int totalNum = model.PrintCount * model.PageNum;
if (paperSize.Value.Value == 64)
{
if (totalNum <= 80000)
{
equipmentId = 5;//8开单色机
}
else if (totalNum > 160000)
{
equipmentId = 4;//2开单色机
}
else
{
equipmentId = 6;//4开单色机
}
}
else if (paperSize.Value.Value == 48)
{
if (totalNum <= 60000)
{
equipmentId = 5;//8开单色机
}
else if (totalNum > 120000)
{
equipmentId = 4;//2开单色机
}
else
{
equipmentId = 6;//4开单色机
}
}
else if (paperSize.Value.Value == 32)
{
if (totalNum <= 40000)
{
equipmentId = 5;//8开单色机
}
else if (totalNum > 80000)
{
equipmentId = 4;//2开单色机
}
else
{
equipmentId = 6;//4开单色机
}
}
else if (paperSize.Value.Value == 16)
{
if (totalNum <= 20000)
{
equipmentId = 5;//8开单色机
}
else if (totalNum > 40000)
{
equipmentId = 4;//2开单色机
}
else
{
equipmentId = 6;//4开单色机
}
}
else if (paperSize.Value.Value == 8)
{
if (totalNum <= 10000)
{
equipmentId = 5;//8开单色机
}
else if (totalNum > 20000)
{
equipmentId = 4;//2开单色机
}
else
{
equipmentId = 6;//4开单色机
}
}
if (equipmentId == 5)
{
impressionCount = ((((model.PrintCount.ToDouble2().Value / paperSize.Value.Value) * model.PageNum) / 8) * rlNumCount * printColorNum).ToDecimal2().Value.JRoundInt();
}
else if (equipmentId == 6)
{
impressionCount = ((((model.PrintCount.ToDouble2().Value / paperSize.Value.Value) * model.PageNum) / 4) * rlNumCount * printColorNum).ToDecimal2().Value.JRoundInt();
}
else
{
impressionCount = ((((model.PrintCount.ToDouble2().Value / paperSize.Value.Value) * model.PageNum) / 2) * rlNumCount * printColorNum).ToDecimal2().Value.JRoundInt();
}
if (impressionCount < 1000)
impressionCount = 1000;
PrintingWorksBLL _printingWorksBLL = new PrintingWorksBLL();
Inquiry_PrintingWorks printWork = _printingWorksBLL.GetModel(equipmentId, inquiryId);
if (printWork != null)
{
impressPrice = (impressionCount.ToDouble2().Value / 1000).ToDecimal2().Value * printWork.WorkPrice;
if (impressPrice < printWork.StartPrice.Value)
impressPrice = printWork.StartPrice.Value;
versionCost = printWork.VersionCost;
}
impressPrice = impressPrice * fastValue;
versionCost = versionCost * fastValue;
PrintingMachineBLL _printingMachineBLL = new PrintingMachineBLL();
SysInquiry_PrintingMachine machineModel = _printingMachineBLL.GetModelByKeyId(equipmentId);
detail.ImpressPriceStr = machineModel.MachineName + impressionCount.ToString() + "印次:" + impressPrice.ToString("0.00") + "元";
return impressPrice;
}
///
/// 获取收据联单快速询价价格
///
///
///
///
///
///
///
public decimal GetReceiptDocumentFast(InquiryCommonModel model, SysInquiry_PaperSizeDetail paperSize, Guid inquiryId, InquiryDetail detail, decimal fastValue)
{
decimal price = 0;
ReceiptDocumentFastCostBLL _receiptDocumentFastCostBLL = new ReceiptDocumentFastCostBLL();
Inquiry_ReceiptDocumentFastCost receiptDocument = _receiptDocumentFastCostBLL.GetModel(paperSize.Name, model.PaperMP, model.RLNum, model.PrintCount, inquiryId);
if (receiptDocument != null)
{
price = receiptDocument.Price * fastValue;
}
if (model.PrintColor != "单色")
{
ColorCostBLL _colorCostBLL = new ColorCostBLL();
Inquiry_ColorCost colorCost = _colorCostBLL.GetModel(inquiryId, model.PrintTypeId, model.PrintColor, paperSize.Value.Value);
if (colorCost != null)
{
price += colorCost.Price * model.PrintCount * fastValue;
}
}
price += GetFrontPrice(model, paperSize, inquiryId, detail, fastValue);
detail.PaperPriceStr = price.ToString("0.00");
return price;
}
///
/// 获取封面费用
///
///
public decimal GetFrontPrice(InquiryCommonModel model, SysInquiry_PaperSizeDetail paperSize, Guid inquiryId, InquiryDetail detail, decimal fastValue)
{
decimal price = 0;
if (model.FrontType != "无封面")
{
FrontCostBLL _frontCostBLL = new FrontCostBLL();
Inquiry_FrontCost frontCost = _frontCostBLL.GetModel(inquiryId, model.PrintTypeId, model.FrontType, model.pDemand, paperSize.Value.Value);
if (frontCost != null)
{
price = frontCost.Price * model.PrintCount * fastValue;
}
}
return price;
}
///
/// 计算报纸价格
///
///
///
///
///
public InquiryDetail GetNewsPaperInquiryDetail(InquiryCommonModel model, Guid inquiryId, Guid firmId, Guid customerId)
{
InquiryDetail detail = new InquiryDetail();
//总价
decimal totalPrice = 0;
//纸张价格
decimal paperPrice = 0;
//印工费
decimal impressPrice = 0;
//版费
decimal versionCost = 0;
decimal afterWorkPrice = 0;
//货运费
decimal cargagePrice = 0;
//税费
decimal taxationPrice = 0;
decimal fastValue = 1;
if ((customerId != Guid.Empty && inquiryId != customerId) || (customerId == Guid.Empty && inquiryId == Guid.Parse(UtilConst.AdminFirmId)))
{
FastSetByFirmBLL _fastSetByFirmBLL = new FastSetByFirmBLL();
Inquiry_FastSetByFirm fastModel = _fastSetByFirmBLL.GetModel(firmId, customerId, model.PrintTypeId);
if (fastModel != null)
{
fastValue = (fastModel.FastValue / 100);
}
}
PaperSizeDetailBLL _paperSizeDetailBLL = new PaperSizeDetailBLL();
SysInquiry_PaperSizeDetail paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(model.PrintTypeId, model.PrintSizeId);
paperPrice = GetPaperPrice(model, inquiryId, paperSize, detail, fastValue);
impressPrice = GetNewsPaperImpressPrice(model, paperSize, inquiryId, ref versionCost, detail, fastValue, firmId, customerId);
string afterWorkPriceStr = string.Empty;
//计算后工序价格
afterWorkPrice = GetAfterWorkListPrice(model, inquiryId, paperSize, ref afterWorkPriceStr, fastValue);
detail.AfterWorkPriceStr = afterWorkPriceStr;
totalPrice = paperPrice + impressPrice + versionCost + afterWorkPrice;
if (model.DeliveryMode != 104)
cargagePrice = GetCargagePrice(totalPrice, inquiryId, model.DeliveryMode) * fastValue;
totalPrice = totalPrice + cargagePrice;
if (model.BillMode != 108)
{
decimal taxValue = GetTaxationValue(model.BillMode, inquiryId);
taxationPrice = (totalPrice * taxValue / 100) * fastValue;
}
totalPrice = totalPrice + taxationPrice;
detail.PrintCount = model.PrintCount;
detail.PaperPrice = paperPrice;
detail.ImpressPrice = impressPrice;
detail.VersionCost = versionCost;
detail.AfterWorkPrice = afterWorkPrice;
detail.CargagePrice = cargagePrice;
detail.TaxationPrice = taxationPrice;
detail.TotalPrice = totalPrice;
return detail;
}
///
/// 计算报纸的印工
///
///
///
///
///
///
///
///
public decimal GetNewsPaperImpressPrice(InquiryCommonModel model, SysInquiry_PaperSizeDetail paperSize, Guid inquiryId, ref decimal versionCost, InquiryDetail detail, decimal fastValue, Guid firmId, Guid customerId)
{
decimal impressPrice = 0;
int equipmentId = 0;
int impressionCount;
int num = model.PageNum / 4;
decimal addimpressionCount = 0;
PrintingWorksBLL _printingWorksBLL = new PrintingWorksBLL();
Inquiry_PrintingWorks printWork = null;
if (model.PrintColor == "单色" || model.PrintColor == "双色")
{
equipmentId = 3;
impressionCount = model.PrintCount;
if (impressionCount < 1000)
{
impressionCount = 1000;
}
impressionCount = GetRealImpressionCount(impressionCount, 5001, firmId, customerId);
printWork = _printingWorksBLL.GetModel2(impressionCount, equipmentId, inquiryId);
if (printWork != null)
{
impressPrice = printWork.WorkPrice;
if (impressionCount > 5000)
{
impressPrice = ((impressionCount.ToDouble2().Value / 1000).ToDecimal2().Value) * impressPrice;
}
//if (impressPrice < printWork.StartPrice.Value)
//{
// impressPrice = printWork.StartPrice.Value;
//}
versionCost = printWork.VersionCost;
}
}
else
{
equipmentId = 1;
impressionCount = model.PrintCount;
if (impressionCount < 1000)
{
impressionCount = 1000;
}
impressionCount = GetRealImpressionCount(impressionCount, 10001, firmId, customerId);
printWork = _printingWorksBLL.GetModel(impressionCount, equipmentId, inquiryId);
if (printWork != null)
{
impressPrice = printWork.WorkPrice;
if (impressionCount > 10000)
{
//addimpressionCount = impressionCount - 10000;
//if (printWork.AddPrintCount.HasValue && printWork.AddPrintCount.Value > 0)
//{
// double f = (addimpressionCount.ToDouble2().Value / (1000).ToDouble2().Value / (printWork.AddPrintCount.Value).ToDouble2().Value);
// addimpressionCount = f.ToString("0.0").ToDecimal2().Value;
// impressPrice += addimpressionCount * printWork.AddPrice.Value;
//}
impressPrice = ((impressionCount.ToDouble2().Value / 1000).ToDecimal2().Value) * impressPrice;
}
versionCost = printWork.VersionCost;
}
}
impressPrice = impressPrice * fastValue;
versionCost = versionCost * fastValue;
PrintingMachineBLL _printingMachineBLL = new PrintingMachineBLL();
SysInquiry_PrintingMachine machineModel = _printingMachineBLL.GetModelByKeyId(equipmentId);
if (model.PrintColor == "双色")
{
impressPrice = impressPrice * 2;
versionCost = versionCost * 2;
}
if (paperSize.Value.Value == 2)
{
impressPrice = impressPrice * 2;
versionCost = versionCost * 2;
}
impressPrice = impressPrice * num;
versionCost = versionCost * num;
detail.ImpressPriceStr += machineModel.MachineName + impressionCount.ToString() + "印次:" + impressPrice.ToString("0.00") + "元";
return impressPrice;
}
///
/// 计算喷绘价格
///
///
///
///
///
public InquiryDetail GetPVCInquiryDetail(InquiryCommonModel model, Guid inquiryId, Guid firmId, Guid customerId)
{
InquiryDetail detail = new InquiryDetail();
//总价
decimal totalPrice = 0;
//纸张价格
decimal paperPrice = 0;
//印工费
decimal impressPrice = 0;
//版费
decimal versionCost = 0;
decimal afterWorkPrice = 0;
//货运费
decimal cargagePrice = 0;
//税费
decimal taxationPrice = 0;
decimal fastValue = 1;
if ((customerId != Guid.Empty && inquiryId != customerId) || (customerId == Guid.Empty && inquiryId == Guid.Parse(UtilConst.AdminFirmId)))
{
FastSetByFirmBLL _fastSetByFirmBLL = new FastSetByFirmBLL();
Inquiry_FastSetByFirm fastModel = _fastSetByFirmBLL.GetModel(firmId, customerId, model.PrintTypeId);
if (fastModel != null)
{
fastValue = (fastModel.FastValue / 100);
}
}
if (model.PVCType == "PVC卡")
{
paperPrice = GetPVCFastPaperPrice(model.CupType, model.PrintCount, inquiryId) * fastValue;
}
else
{
paperPrice = GetPortraitCardFastPaperPrice(model.PrintSizeName, model.PrintCount, inquiryId) * fastValue;
}
detail.PaperPriceStr = paperPrice.ToString("0.00");
//计算后工序价格
afterWorkPrice = GetPVCAfterWorksPrice(model, inquiryId, detail, fastValue);
totalPrice = paperPrice + impressPrice + versionCost + afterWorkPrice;
if (model.DeliveryMode != 104)
cargagePrice = GetCargagePrice(totalPrice, inquiryId, model.DeliveryMode) * fastValue;
totalPrice = totalPrice + cargagePrice;
if (model.BillMode != 108)
{
decimal taxValue = GetTaxationValue(model.BillMode, inquiryId);
taxationPrice = (totalPrice * taxValue / 100) * fastValue;
}
totalPrice = totalPrice + taxationPrice;
detail.PrintCount = model.PrintCount;
detail.PaperPrice = paperPrice;
detail.ImpressPrice = impressPrice;
detail.VersionCost = versionCost;
detail.AfterWorkPrice = afterWorkPrice;
detail.CargagePrice = cargagePrice;
detail.TaxationPrice = taxationPrice;
detail.TotalPrice = totalPrice;
return detail;
}
///
/// 获取PVC卡快速询价价格
///
///
public decimal GetPVCFastPaperPrice(int pvcTypeId, int printCount, Guid inquiryId)
{
decimal price = 0;
PVCFastCostBLL _pvcFastCostBLL = new PVCFastCostBLL();
int[] countArry = GetPrintCountArry(33);
int minPrintCount = 0;
int maxPrintCount = 0;
int[] minAndMaxArry = GetRelPrintCountMinAndMax(countArry, printCount);
minPrintCount = minAndMaxArry[0];
maxPrintCount = minAndMaxArry[1];
decimal priceBysingle = _pvcFastCostBLL.GetPVCFastPaperPrice(pvcTypeId, minPrintCount, inquiryId);
price = priceBysingle * printCount;
if (maxPrintCount != 0)
{
priceBysingle = _pvcFastCostBLL.GetPVCFastPaperPrice(pvcTypeId, maxPrintCount, inquiryId);
decimal nextPrice = priceBysingle * maxPrintCount;
if (price > nextPrice)
{
price = nextPrice;
}
}
return price;
}
public int[] GetRelPrintCountMinAndMax(int[] countArry, int printCount)
{
int[] minAndMaxArry = new int[2];
int minPrintCount = 0;
int maxPrintCount = 0;
int index = 0;
int relIndex = 0;
foreach (int i in countArry)
{
if (printCount >= i)
{
minPrintCount = i;
relIndex = index;
}
index++;
}
if (minPrintCount < countArry[0])
{
minPrintCount = countArry[0];
relIndex = 0;
}
if (relIndex < countArry.Length - 1)
{
maxPrintCount = countArry[relIndex + 1];
}
minAndMaxArry[0] = minPrintCount;
minAndMaxArry[1] = maxPrintCount;
return minAndMaxArry;
}
///
/// 获取人像卡快速询价价格
///
///
///
///
///
public decimal GetPortraitCardFastPaperPrice(string area, int printCount, Guid inquiryId)
{
PortraitCardFastCostBLL _portraitCardFastCostBLL = new PortraitCardFastCostBLL();
return _portraitCardFastCostBLL.GetPortraitCardFastPaperPrice(area, printCount, inquiryId);
}
///
/// 获取PVC卡后道
///
public decimal GetPVCAfterWorksPrice(InquiryCommonModel model, Guid inquiryId, InquiryDetail detail, decimal fastValue)
{
AfterParameterInfoBLL _afterParameterInfoBLL = new AfterParameterInfoBLL();
decimal afterPrice = 0;
decimal price = 0;
if (model.AfterWorkList != null && model.AfterWorkList.Count > 0)
{
foreach (int workId in model.AfterWorkList)
{
SysInquiry_AfterParameterInfo afterModel = _afterParameterInfoBLL.GetModel(workId);
if (workId != 55 && workId != 59) //人像卡
{
price = GetPVCAfterPrice(workId, model.PrintCount, inquiryId);
}
else
{
int tempWorkId = 0;
if (workId == 59)
{
if (model.LsType == "印字")
{
tempWorkId = 54;
}
else
{
tempWorkId = 53;
}
}
else if (workId == 55)
{
if (model.KtType == "真皮卡套")
{
tempWorkId = 56;
}
else if (model.KtType == "塑料卡套")
{
tempWorkId = 57;
}
else
{
tempWorkId = 58;
}
}
price = GetMultipleAfterPrice(model.PrintCount, model.PrintTypeId, inquiryId, tempWorkId);
}
price = price * fastValue;
afterPrice += price;
detail.AfterWorkPriceStr += afterModel.ParameterName + ":" + price.ToString("0.00") + ",";
}
}
detail.AfterWorkPriceStr += "合计:" + afterPrice.ToString("0.00");
return afterPrice;
}
///
/// 获取PVC后道参数价格
///
///
///
///
public decimal GetPVCAfterPrice(int afterParameterId, int printCount, Guid inquiryId)
{
PVCAfterCostBLL _pvcAfterCostBLL = new PVCAfterCostBLL();
return _pvcAfterCostBLL.GetPVCAfterPrice(afterParameterId, printCount, inquiryId);
}
///
/// 计算喷绘价格
///
///
///
///
///
public InquiryDetail GetAirbrushInquiryDetail(InquiryCommonModel model, Guid inquiryId, Guid firmId, Guid customerId)
{
InquiryDetail detail = new InquiryDetail();
//总价
decimal totalPrice = 0;
//纸张价格
decimal paperPrice = 0;
//印工费
decimal impressPrice = 0;
//版费
decimal versionCost = 0;
decimal afterWorkPrice = 0;
//货运费
decimal cargagePrice = 0;
//税费
decimal taxationPrice = 0;
decimal fastValue = 1;
if ((customerId != Guid.Empty && inquiryId != customerId) || (customerId == Guid.Empty && inquiryId == Guid.Parse(UtilConst.AdminFirmId)))
{
FastSetByFirmBLL _fastSetByFirmBLL = new FastSetByFirmBLL();
Inquiry_FastSetByFirm fastModel = _fastSetByFirmBLL.GetModel(firmId, customerId, model.PrintTypeId);
if (fastModel != null)
{
fastValue = (fastModel.FastValue / 100);
}
}
paperPrice = GetAirbrushFastPrice(model, inquiryId) * fastValue;
detail.PaperPriceStr = paperPrice.ToString("0.00");
totalPrice = paperPrice + impressPrice + versionCost + afterWorkPrice;
if (model.DeliveryMode != 104)
cargagePrice = GetCargagePrice(totalPrice, inquiryId, model.DeliveryMode) * fastValue;
totalPrice = totalPrice + cargagePrice;
if (model.BillMode != 108)
{
decimal taxValue = GetTaxationValue(model.BillMode, inquiryId);
taxationPrice = (totalPrice * taxValue / 100) * fastValue;
}
totalPrice = totalPrice + taxationPrice;
detail.PrintCount = model.PrintCount;
detail.PaperPrice = paperPrice;
detail.ImpressPrice = impressPrice;
detail.VersionCost = versionCost;
detail.AfterWorkPrice = afterWorkPrice;
detail.CargagePrice = cargagePrice;
detail.TaxationPrice = taxationPrice;
detail.TotalPrice = totalPrice;
return detail;
}
///
/// 获取喷绘快速询价价格
///
///
///
///
public decimal GetAirbrushFastPrice(InquiryCommonModel model, Guid inquiryId)
{
decimal price = 0;
AirbrushFastBLL _airbrushFastBLL = new AirbrushFastBLL();
Inquiry_AirbrushFastCost air = _airbrushFastBLL.GetModel(model.CupType, inquiryId);
if (air != null)
{
price = (model.BrushWidth * model.BrushHight) * air.Price;
if (price < air.StartPrice)
price = air.StartPrice;
}
return price;
}
///
/// 计算房卡套价格
///
///
///
///
///
public InquiryDetail GetRoomCardInquiryDetail(InquiryCommonModel model, Guid inquiryId, Guid firmId, Guid customerId)
{
InquiryDetail detail = new InquiryDetail();
//总价
decimal totalPrice = 0;
//纸张价格
decimal paperPrice = 0;
//印工费
decimal impressPrice = 0;
//版费
decimal versionCost = 0;
decimal afterWorkPrice = 0;
//货运费
decimal cargagePrice = 0;
//税费
decimal taxationPrice = 0;
decimal fastValue = 1;
if ((customerId != Guid.Empty && inquiryId != customerId) || (customerId == Guid.Empty && inquiryId == Guid.Parse(UtilConst.AdminFirmId)))
{
FastSetByFirmBLL _fastSetByFirmBLL = new FastSetByFirmBLL();
Inquiry_FastSetByFirm fastModel = _fastSetByFirmBLL.GetModel(firmId, customerId, model.PrintTypeId);
if (fastModel != null)
{
fastValue = (fastModel.FastValue / 100);
}
}
paperPrice = GetRoomCardFastPrice(model, inquiryId) * fastValue;
detail.PaperPriceStr = paperPrice.ToString("0.00");
string afterWorkPriceStr = string.Empty;
//计算后工序价格
afterWorkPrice = GetAfterWorkListPrice(model, inquiryId, null, ref afterWorkPriceStr, fastValue);
detail.AfterWorkPriceStr = afterWorkPriceStr;
totalPrice = paperPrice + impressPrice + versionCost + afterWorkPrice;
if (model.DeliveryMode != 104)
cargagePrice = GetCargagePrice(totalPrice, inquiryId, model.DeliveryMode) * fastValue;
totalPrice = totalPrice + cargagePrice;
if (model.BillMode != 108)
{
decimal taxValue = GetTaxationValue(model.BillMode, inquiryId);
taxationPrice = (totalPrice * taxValue / 100) * fastValue;
}
totalPrice = totalPrice + taxationPrice;
detail.PrintCount = model.PrintCount;
detail.PaperPrice = paperPrice;
detail.ImpressPrice = impressPrice;
detail.VersionCost = versionCost;
detail.AfterWorkPrice = afterWorkPrice;
detail.CargagePrice = cargagePrice;
detail.TaxationPrice = taxationPrice;
detail.TotalPrice = totalPrice;
return detail;
}
///
/// 获取房卡套快速询价价格
///
///
///
///
public decimal GetRoomCardFastPrice(InquiryCommonModel model, Guid inquiryId)
{
RoomCardFastBLL _roomCardFastBLL = new RoomCardFastBLL();
decimal price = _roomCardFastBLL.GetRoomCardFastPrice(model.PrintSizeName, model.CoveredTypeId, model.PrintCount, inquiryId);
//特种纸
if (model.PaperId == 16)
{
price = price * WebInfo.Instance.SuperPaper.ToDecimal2().Value + price;
}
else if (model.PaperId == 13) //牛卡纸
{
price = price * WebInfo.Instance.Linerboard.ToDecimal2().Value + price;
}
return price;
}
///
/// 计算平面设计价格
///
///
///
///
///
public InquiryDetail GetGraphicDesignerInquiryDetail(InquiryCommonModel model, Guid inquiryId, Guid firmId, Guid customerId)
{
InquiryDetail detail = new InquiryDetail();
//总价
decimal totalPrice = 0;
//纸张价格
decimal paperPrice = 0;
//印工费
decimal impressPrice = 0;
//版费
decimal versionCost = 0;
decimal afterWorkPrice = 0;
//货运费
decimal cargagePrice = 0;
//税费
decimal taxationPrice = 0;
decimal fastValue = 1;
if ((customerId != Guid.Empty && inquiryId != customerId) || (customerId == Guid.Empty && inquiryId == Guid.Parse(UtilConst.AdminFirmId)))
{
FastSetByFirmBLL _fastSetByFirmBLL = new FastSetByFirmBLL();
Inquiry_FastSetByFirm fastModel = _fastSetByFirmBLL.GetModel(firmId, customerId, model.PrintTypeId);
if (fastModel != null)
{
fastValue = (fastModel.FastValue / 100);
}
}
paperPrice = GetGraphicDesignerFastPrice(model, inquiryId, detail, fastValue, ref afterWorkPrice);
totalPrice = paperPrice + impressPrice + versionCost + afterWorkPrice;
if (model.DeliveryMode != 104)
cargagePrice = GetCargagePrice(totalPrice, inquiryId, model.DeliveryMode) * fastValue;
totalPrice = totalPrice + cargagePrice;
if (model.BillMode != 108)
{
decimal taxValue = GetTaxationValue(model.BillMode, inquiryId);
taxationPrice = (totalPrice * taxValue / 100) * fastValue;
}
totalPrice = totalPrice + taxationPrice;
detail.PrintCount = model.PrintCount;
detail.PaperPrice = paperPrice;
detail.ImpressPrice = impressPrice;
detail.VersionCost = versionCost;
detail.AfterWorkPrice = afterWorkPrice;
detail.CargagePrice = cargagePrice;
detail.TaxationPrice = taxationPrice;
detail.TotalPrice = totalPrice;
return detail;
}
///
/// 获取平面设计快速询价价格
///
///
///
///
public decimal GetGraphicDesignerFastPrice(InquiryCommonModel model, Guid inquiryId, InquiryDetail detail, decimal fastValue, ref decimal afterWorkPrice)
{
decimal price = 0;
decimal priceBySingel = 0;
GraphicDesignerFastBLL _graphicDesignerFastBLL = new GraphicDesignerFastBLL();
Inquiry_GraphicDesignerFastCost gdModel = _graphicDesignerFastBLL.GetGraphicDesignerFastPrice(model.SJType, inquiryId);
if (gdModel != null)
{
priceBySingel = gdModel.Price;
priceBySingel = priceBySingel * fastValue;
if (model.SJType == 53 || model.SJType == 54 || model.SJType == 55)
{
detail.PaperPriceStr += priceBySingel.ToString("0.00");
detail.PaperPriceStr += "×" + model.PageNum.ToString() + "页";
price = priceBySingel * model.PageNum;
if (model.DesignerDemand == "数码印刷")
{
afterWorkPrice = gdModel.StartPrice * fastValue;
afterWorkPrice = afterWorkPrice * model.PageNum;
}
detail.PaperPriceStr += "=" + price.ToString("0.00") + "元";
}
else
{
if (model.DesignerDemand == "数码印刷")
{
afterWorkPrice = gdModel.StartPrice * fastValue;
}
price = priceBySingel;
detail.PaperPriceStr += price.ToString("0.00") + "元";
}
if (model.DesignerDemand == "数码印刷")
{
detail.AfterWorkPriceStr = "数码印刷:" + afterWorkPrice.ToString("0.00") + "元";
}
}
else
{
detail.PaperPriceStr += "0元";
}
return price;
}
///
/// 计算广告扑克价格
///
///
///
///
///
public InquiryDetail GetAdvertisingPokerInquiryDetail(InquiryCommonModel model, Guid inquiryId, Guid firmId, Guid customerId)
{
InquiryDetail detail = new InquiryDetail();
//总价
decimal totalPrice = 0;
//纸张价格
decimal paperPrice = 0;
//印工费
decimal impressPrice = 0;
//版费
decimal versionCost = 0;
decimal afterWorkPrice = 0;
//货运费
decimal cargagePrice = 0;
//税费
decimal taxationPrice = 0;
decimal fastValue = 1;
if ((customerId != Guid.Empty && inquiryId != customerId) || (customerId == Guid.Empty && inquiryId == Guid.Parse(UtilConst.AdminFirmId)))
{
FastSetByFirmBLL _fastSetByFirmBLL = new FastSetByFirmBLL();
Inquiry_FastSetByFirm fastModel = _fastSetByFirmBLL.GetModel(firmId, customerId, model.PrintTypeId);
if (fastModel != null)
{
fastValue = (fastModel.FastValue / 100);
}
}
paperPrice = GetAdvertisingPokerFastPrice(model, inquiryId, fastValue);
detail.PaperPriceStr = paperPrice.ToString("0.00");
totalPrice = paperPrice + impressPrice + versionCost + afterWorkPrice;
if (model.DeliveryMode != 104)
cargagePrice = GetCargagePrice(totalPrice, inquiryId, model.DeliveryMode) * fastValue;
totalPrice = totalPrice + cargagePrice;
if (model.BillMode != 108)
{
decimal taxValue = GetTaxationValue(model.BillMode, inquiryId);
taxationPrice = (totalPrice * taxValue / 100) * fastValue;
}
totalPrice = totalPrice + taxationPrice;
detail.PrintCount = model.PrintCount;
detail.PaperPrice = paperPrice;
detail.ImpressPrice = impressPrice;
detail.VersionCost = versionCost;
detail.AfterWorkPrice = afterWorkPrice;
detail.CargagePrice = cargagePrice;
detail.TaxationPrice = taxationPrice;
detail.TotalPrice = totalPrice;
return detail;
}
///
/// 获取广告扑克快速询价价格
///
///
///
///
public decimal GetAdvertisingPokerFastPrice(InquiryCommonModel model, Guid inquiryId, decimal fastValue)
{
decimal price = 0;
decimal priceBysingle = 0;
AdvertisingPokerFastBLL _advertisingPokerFastBLL = new AdvertisingPokerFastBLL();
int[] countArry = GetPrintCountArry(32);
int minPrintCount = 0;
int maxPrintCount = 0;
int[] minAndMaxArry = GetRelPrintCountMinAndMax(countArry, model.PrintCount);
minPrintCount = minAndMaxArry[0];
maxPrintCount = minAndMaxArry[1];
priceBysingle = _advertisingPokerFastBLL.GetAdvertisingPokerPrice(model.CupType, minPrintCount, inquiryId);
price = priceBysingle * model.PrintCount;
if (maxPrintCount != 0)
{
priceBysingle = _advertisingPokerFastBLL.GetAdvertisingPokerPrice(model.CupType, maxPrintCount, inquiryId);
decimal nextPrice = priceBysingle * maxPrintCount;
if (price > nextPrice)
{
price = nextPrice;
}
}
return price;
}
///
/// 计算广告纸杯价格
///
///
///
///
///
public InquiryDetail GetAdvertisingCupInquiryDetail(InquiryCommonModel model, Guid inquiryId, Guid firmId, Guid customerId)
{
InquiryDetail detail = new InquiryDetail();
//总价
decimal totalPrice = 0;
//纸张价格
decimal paperPrice = 0;
//印工费
decimal impressPrice = 0;
//版费
decimal versionCost = 0;
decimal afterWorkPrice = 0;
//货运费
decimal cargagePrice = 0;
//税费
decimal taxationPrice = 0;
decimal fastValue = 1;
if ((customerId != Guid.Empty && inquiryId != customerId) || (customerId == Guid.Empty && inquiryId == Guid.Parse(UtilConst.AdminFirmId)))
{
FastSetByFirmBLL _fastSetByFirmBLL = new FastSetByFirmBLL();
Inquiry_FastSetByFirm fastModel = _fastSetByFirmBLL.GetModel(firmId, customerId, model.PrintTypeId);
if (fastModel != null)
{
fastValue = (fastModel.FastValue / 100);
}
}
paperPrice = GetAdvertisingCupFastPrice(model, inquiryId, fastValue);
detail.PaperPriceStr = paperPrice.ToString("0.00");
totalPrice = paperPrice + impressPrice + versionCost + afterWorkPrice;
if (model.DeliveryMode != 104)
cargagePrice = GetCargagePrice(totalPrice, inquiryId, model.DeliveryMode) * fastValue;
totalPrice = totalPrice + cargagePrice;
if (model.BillMode != 108)
{
decimal taxValue = GetTaxationValue(model.BillMode, inquiryId);
taxationPrice = (totalPrice * taxValue / 100) * fastValue;
}
totalPrice = totalPrice + taxationPrice;
detail.PrintCount = model.PrintCount;
detail.PaperPrice = paperPrice;
detail.ImpressPrice = impressPrice;
detail.VersionCost = versionCost;
detail.AfterWorkPrice = afterWorkPrice;
detail.CargagePrice = cargagePrice;
detail.TaxationPrice = taxationPrice;
detail.TotalPrice = totalPrice;
return detail;
}
///
/// 获取广告纸杯快速询价价格
///
///
///
///
public decimal GetAdvertisingCupFastPrice(InquiryCommonModel model, Guid inquiryId, decimal fastValue)
{
decimal price = 0;
decimal priceBysingle = 0;
AdvertisingCupFastBLL _advertisingCupFastBLL = new AdvertisingCupFastBLL();
int[] countArry = GetPrintCountArry(31);
int minPrintCount = 0;
int maxPrintCount = 0;
int[] minAndMaxArry = GetRelPrintCountMinAndMax(countArry, model.PrintCount);
minPrintCount = minAndMaxArry[0];
maxPrintCount = minAndMaxArry[1];
priceBysingle = _advertisingCupFastBLL.GetAdvertisingCupFastPrice(model.CupType, model.PaperMP.ToInt32().Value, model.PrintCount, inquiryId);
price = priceBysingle * model.PrintCount;
if (maxPrintCount != 0)
{
priceBysingle = _advertisingCupFastBLL.GetAdvertisingCupFastPrice(model.CupType, model.PaperMP.ToInt32().Value, model.PrintCount, inquiryId);
decimal nextPrice = priceBysingle * maxPrintCount;
if (price > nextPrice)
{
price = nextPrice;
}
}
if (model.PrintColor != "单色")
{
ColorCostBLL _colorCostBLL = new ColorCostBLL();
Inquiry_ColorCost colorCost = _colorCostBLL.GetModel(inquiryId, model.PrintTypeId, model.PrintColor, model.CupType);
if (colorCost != null)
price += colorCost.Price * model.PrintCount;
}
return price;
}
///
/// 计算名片价格
///
///
///
///
///
public InquiryDetail GetBusinessCardInquiryDetail(InquiryCommonModel model, Guid inquiryId, Guid firmId, Guid customerId)
{
InquiryDetail detail = new InquiryDetail();
//总价
decimal totalPrice = 0;
//纸张价格
decimal paperPrice = 0;
//印工费
decimal impressPrice = 0;
//版费
decimal versionCost = 0;
decimal afterWorkPrice = 0;
//货运费
decimal cargagePrice = 0;
//税费
decimal taxationPrice = 0;
decimal fastValue = 1;
if ((customerId != Guid.Empty && inquiryId != customerId) || (customerId == Guid.Empty && inquiryId == Guid.Parse(UtilConst.AdminFirmId)))
{
FastSetByFirmBLL _fastSetByFirmBLL = new FastSetByFirmBLL();
Inquiry_FastSetByFirm fastModel = _fastSetByFirmBLL.GetModel(firmId, customerId, model.PrintTypeId);
if (fastModel != null)
{
fastValue = (fastModel.FastValue / 100);
}
}
paperPrice = GetBusinessCardFastPrice(model, inquiryId) * fastValue;
detail.PaperPriceStr = paperPrice.ToString("0.00");
//计算后工序价格
afterWorkPrice = GetBusinessCardAfterWorksPrice(model, inquiryId, detail, fastValue);
totalPrice = paperPrice + impressPrice + versionCost + afterWorkPrice;
if (model.DeliveryMode != 104)
cargagePrice = GetCargagePrice(totalPrice, inquiryId, model.DeliveryMode) * fastValue;
totalPrice = totalPrice + cargagePrice;
if (model.BillMode != 108)
{
decimal taxValue = GetTaxationValue(model.BillMode, inquiryId);
taxationPrice = (totalPrice * taxValue / 100) * fastValue;
}
totalPrice = totalPrice + taxationPrice;
detail.PrintCount = model.PrintCount;
detail.PaperPrice = paperPrice;
detail.ImpressPrice = impressPrice;
detail.VersionCost = versionCost;
detail.AfterWorkPrice = afterWorkPrice;
detail.CargagePrice = cargagePrice;
detail.TaxationPrice = taxationPrice;
detail.TotalPrice = totalPrice;
return detail;
}
///
/// 获取名片快速设置价格
///
///
public decimal GetBusinessCardFastPrice(InquiryCommonModel model, Guid inquiryId)
{
decimal price = 0;
BusinessCardFastCostBLL _businessCardFastCostBLL = new BusinessCardFastCostBLL();
price = _businessCardFastCostBLL.GetPrice(model.PaperMP, model.SingleOrdouble, model.PrintBoxNumber, model.PrintCount, inquiryId);
if (model.PrintSizeId == 49 || model.PrintSizeId == 50)
{
price = price * 2;
}
return price;
}
///
/// 获取名片后工序价格
///
///
///
///
public decimal GetBusinessCardAfterWorksPrice(InquiryCommonModel model, Guid inquiryId, InquiryDetail detail, decimal fastValue)
{
BusinessCardAfterCostBLL _businessCardAfterCostBLL = new BusinessCardAfterCostBLL();
decimal price = 0;
foreach (int workId in model.AfterWorkList)
{
decimal tempPrice = 0;
Inquiry_BusinessCardAfterCost afterModel = _businessCardAfterCostBLL.GetModel(workId, inquiryId);
if (afterModel != null)
{
tempPrice = afterModel.Price * model.PrintBoxNumber * model.PrintCount;
if (tempPrice < afterModel.StartPrice)
{
tempPrice = afterModel.StartPrice;
}
tempPrice = (tempPrice + afterModel.PlatemakPrice) * fastValue;
detail.AfterWorkPriceStr += afterModel.AfterParameterName + ":" + tempPrice.ToString("0.00") + ",";
}
price += tempPrice;
}
detail.AfterWorkPriceStr += "合计:" + price.ToString("0.00") + "元";
return price;
}
///
/// 获取信封价格
///
///
///
///
///
public InquiryDetail GetEnvelopInquiyrDetail(InquiryCommonModel model, Guid inquiryId, Guid firmId, Guid customerId)
{
InquiryDetail detail = new InquiryDetail();
//总价
decimal totalPrice = 0;
//纸张价格
decimal paperPrice = 0;
//印工费
decimal impressPrice = 0;
//版费
decimal versionCost = 0;
decimal afterWorkPrice = 0;
//货运费
decimal cargagePrice = 0;
//税费
decimal taxationPrice = 0;
decimal fastValue = 1;
if ((customerId != Guid.Empty && inquiryId != customerId) || (customerId == Guid.Empty && inquiryId == Guid.Parse(UtilConst.AdminFirmId)))
{
FastSetByFirmBLL _fastSetByFirmBLL = new FastSetByFirmBLL();
Inquiry_FastSetByFirm fastModel = _fastSetByFirmBLL.GetModel(firmId, customerId, model.PrintTypeId);
if (fastModel != null)
{
fastValue = (fastModel.FastValue / 100);
}
}
SysInquiry_PaperSizeDetail paperSize = null;
PaperSizeDetailBLL _paperSizeDetailBLL = new PaperSizeDetailBLL();
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(model.PrintTypeId, model.PrintSizeId);
if (model.PrintMode == 1)
{
paperPrice = GetEnvelopFastPaperPrice(model.EnvelopType, paperSize.KeyId, model.PrintCount, inquiryId) * fastValue;
detail.PaperPriceStr = paperPrice.ToString("0.00");
}
else
{
paperSize.Name = "正" + paperSize.Name;
model.PaperId = model.PaperMP.ToInt32().Value;
paperPrice = GetPaperPrice(model, inquiryId, paperSize, detail, fastValue);
}
if (model.PrintMode != 1)
{
if (model.PrintColor == "单色")
{
impressPrice = GetImpressionPrice(paperSize.Value.Value, "单面", model.PrintCount, model.PrintTypeId, inquiryId, ref versionCost, detail, fastValue);
}
else if (model.PrintColor == "双色")
{
impressPrice = GetImpressionPrice(paperSize.Value.Value, "单面", model.PrintCount, model.PrintTypeId, inquiryId, ref versionCost, detail, fastValue);
impressPrice = impressPrice * 2;
versionCost = versionCost * 2;
}
else
{
impressPrice = GetImpressionPrice(model, paperSize.Name, paperSize.Value.Value, "单面", model.PrintCount, model.PrintTypeId, false, inquiryId, ref versionCost, detail, fastValue, firmId, customerId);
}
string afterWorkPriceStr = string.Empty;
//计算后工序价格
afterWorkPrice = GetAfterWorkListPrice(model, inquiryId, paperSize, ref afterWorkPriceStr, fastValue);
detail.AfterWorkPriceStr = afterWorkPriceStr;
}
totalPrice = paperPrice + impressPrice + versionCost + afterWorkPrice;
if (model.DeliveryMode != 104)
cargagePrice = GetCargagePrice(totalPrice, inquiryId, model.DeliveryMode) * fastValue;
totalPrice = totalPrice + cargagePrice;
if (model.BillMode != 108)
{
decimal taxValue = GetTaxationValue(model.BillMode, inquiryId);
taxationPrice = (totalPrice * taxValue / 100) * fastValue;
}
totalPrice = totalPrice + taxationPrice;
detail.PrintCount = model.PrintCount;
detail.PaperPrice = paperPrice;
detail.ImpressPrice = impressPrice;
detail.VersionCost = versionCost;
detail.AfterWorkPrice = afterWorkPrice;
detail.CargagePrice = cargagePrice;
detail.TaxationPrice = taxationPrice;
detail.TotalPrice = totalPrice;
return detail;
}
///
/// 获取信封快速询价价格
///
///
public decimal GetEnvelopFastPaperPrice(string envelopeshape, int envelopeModeTypeId, int printCount, Guid inquiryId)
{
EnvelopFastCostBLL _envelopFastCostBLL = new EnvelopFastCostBLL();
return _envelopFastCostBLL.GetEnvelopFastPaperPrice(envelopeshape, envelopeModeTypeId, printCount, inquiryId);
}
///
/// 获取手提袋价格
///
///
///
///
///
public InquiryDetail GetReticuleInquiyrDetail(InquiryCommonModel model, Guid inquiryId, Guid firmId, Guid customerId)
{
InquiryDetail detail = new InquiryDetail();
//总价
decimal totalPrice = 0;
//纸张价格
decimal paperPrice = 0;
//印工费
decimal impressPrice = 0;
//版费
decimal versionCost = 0;
decimal afterWorkPrice = 0;
//货运费
decimal cargagePrice = 0;
//税费
decimal taxationPrice = 0;
decimal fastValue = 1;
if ((customerId != Guid.Empty && inquiryId != customerId) || (customerId == Guid.Empty && inquiryId == Guid.Parse(UtilConst.AdminFirmId)))
{
FastSetByFirmBLL _fastSetByFirmBLL = new FastSetByFirmBLL();
Inquiry_FastSetByFirm fastModel = _fastSetByFirmBLL.GetModel(firmId, customerId, model.PrintTypeId);
if (fastModel != null)
{
fastValue = (fastModel.FastValue / 100);
}
}
SysInquiry_PaperSizeDetail paperSize = null;
PaperSizeDetailBLL _paperSizeDetailBLL = new PaperSizeDetailBLL();
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(model.PrintTypeId, model.PrintSizeId);
if (model.PrintMode == 1)
{
paperPrice = GetReticuleFastPaperPrice(paperSize.Name, model.GramWeight, model.PaperId, model.PrintCount, inquiryId) * fastValue;
detail.PaperPriceStr = paperPrice.ToString("0.00");
}
else
{
paperPrice = GetPaperPrice(model, inquiryId, paperSize, detail, fastValue);
}
if (model.PrintMode != 1)
{
impressPrice = GetImpressionPrice(model, paperSize.Name, paperSize.Value.Value, "单面", model.PrintCount, model.PrintTypeId, false, inquiryId, ref versionCost, detail, fastValue, firmId, customerId);
}
string afterWorkPriceStr = string.Empty;
//计算后工序价格
afterWorkPrice = GetAfterWorkListPrice(model, inquiryId, paperSize, ref afterWorkPriceStr, fastValue);
detail.AfterWorkPriceStr = afterWorkPriceStr;
totalPrice = paperPrice + impressPrice + versionCost + afterWorkPrice;
if (model.DeliveryMode != 104)
cargagePrice = GetCargagePrice(totalPrice, inquiryId, model.DeliveryMode) * fastValue;
totalPrice = totalPrice + cargagePrice;
if (model.BillMode != 108)
{
decimal taxValue = GetTaxationValue(model.BillMode, inquiryId);
taxationPrice = (totalPrice * taxValue / 100) * fastValue;
}
totalPrice = totalPrice + taxationPrice;
detail.PrintCount = model.PrintCount;
detail.PaperPrice = paperPrice;
detail.ImpressPrice = impressPrice;
detail.VersionCost = versionCost;
detail.AfterWorkPrice = afterWorkPrice;
detail.CargagePrice = cargagePrice;
detail.TaxationPrice = taxationPrice;
detail.TotalPrice = totalPrice;
return detail;
}
///
/// 获取手提袋快速询价价格
///
///
public decimal GetReticuleFastPaperPrice(string paperSizeName, int gramWeight, int paperId, int printCount, Guid inquiryId)
{
ReticuleFastCostBLL _reticuleFastCostBLL = new ReticuleFastCostBLL();
return _reticuleFastCostBLL.GetReticuleFastPaperPrice(paperSizeName, gramWeight, paperId, printCount, inquiryId);
}
///
/// 获取封套价格
///
///
///
///
///
public InquiryDetail GetPacketInquiryDetail(InquiryCommonModel model, Guid inquiryId, Guid firmId, Guid customerId)
{
InquiryDetail detail = new InquiryDetail();
//总价
decimal totalPrice = 0;
//纸张价格
decimal paperPrice = 0;
//印工费
decimal impressPrice = 0;
//版费
decimal versionCost = 0;
decimal afterWorkPrice = 0;
//货运费
decimal cargagePrice = 0;
//税费
decimal taxationPrice = 0;
decimal fastValue = 1;
if ((customerId != Guid.Empty && inquiryId != customerId) || (customerId == Guid.Empty && inquiryId == Guid.Parse(UtilConst.AdminFirmId)))
{
FastSetByFirmBLL _fastSetByFirmBLL = new FastSetByFirmBLL();
Inquiry_FastSetByFirm fastModel = _fastSetByFirmBLL.GetModel(firmId, customerId, model.PrintTypeId);
if (fastModel != null)
{
fastValue = (fastModel.FastValue / 100);
}
}
SysInquiry_PaperSizeDetail paperSize = null;
PaperSizeDetailBLL _paperSizeDetailBLL = new PaperSizeDetailBLL();
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(model.PrintTypeId, model.PrintSizeId);
if (model.PrintMode == 1)
{
int coveredTypeId = 30;
if (model.AfterWorkList != null && model.AfterWorkList.Count > 0)
{
if (model.AfterWorkList.Contains(26))
{
coveredTypeId = 6;
}
else if (model.AfterWorkList.Contains(28))
{
coveredTypeId = 5;
}
}
paperPrice = GetPacketFastPaperPrice(model.PrintSizeId, coveredTypeId, model.PaperMP, model.PrintCount, inquiryId) * fastValue;
detail.PaperPriceStr = paperPrice.ToString("0.00");
}
else
{
model.PaperId = model.PaperMP.ToInt32().Value;
paperPrice = GetPaperPrice(model, inquiryId, paperSize, detail, fastValue);
}
if (model.PrintMode != 1)
{
impressPrice = GetImpressionPrice(model, paperSize.Name, paperSize.Value.Value, "单面", model.PrintCount, model.PrintTypeId, false, inquiryId, ref versionCost, detail, fastValue, firmId, customerId);
}
string afterWorkPriceStr = string.Empty;
//计算后工序价格
afterWorkPrice = GetAfterWorkListPrice(model, inquiryId, paperSize, ref afterWorkPriceStr, fastValue);
detail.AfterWorkPriceStr = afterWorkPriceStr;
totalPrice = paperPrice + impressPrice + versionCost + afterWorkPrice;
if (model.DeliveryMode != 104)
cargagePrice = GetCargagePrice(totalPrice, inquiryId, model.DeliveryMode) * fastValue;
totalPrice = totalPrice + cargagePrice;
if (model.BillMode != 108)
{
decimal taxValue = GetTaxationValue(model.BillMode, inquiryId);
taxationPrice = (totalPrice * taxValue / 100) * fastValue;
}
totalPrice = totalPrice + taxationPrice;
detail.PrintCount = model.PrintCount;
detail.PaperPrice = paperPrice;
detail.ImpressPrice = impressPrice;
detail.VersionCost = versionCost;
detail.AfterWorkPrice = afterWorkPrice;
detail.CargagePrice = cargagePrice;
detail.TaxationPrice = taxationPrice;
detail.TotalPrice = totalPrice;
return detail;
}
///
/// 获取封套快速询价价格
///
///
public decimal GetPacketFastPaperPrice(int packetSizeId, int coveredTypeId, string paperName, int printCount, Guid inquiryId)
{
PacketFastCostBLL _packetFastCostBLL = new PacketFastCostBLL();
return _packetFastCostBLL.GetPacketFastPaperPrice(packetSizeId, coveredTypeId, paperName, printCount, inquiryId);
}
///
/// 计算便签价格
///
///
///
///
///
public InquiryDetail GetNoteInquiryDetail(InquiryCommonModel model, Guid inquiryId, Guid firmId, Guid customerId)
{
InquiryDetail detail = new InquiryDetail();
//总价
decimal totalPrice = 0;
//纸张价格
decimal paperPrice = 0;
//印工费
decimal impressPrice = 0;
//版费
decimal versionCost = 0;
decimal afterWorkPrice = 0;
//货运费
decimal cargagePrice = 0;
//税费
decimal taxationPrice = 0;
decimal fastValue = 1;
if ((customerId != Guid.Empty && inquiryId != customerId) || (customerId == Guid.Empty && inquiryId == Guid.Parse(UtilConst.AdminFirmId)))
{
FastSetByFirmBLL _fastSetByFirmBLL = new FastSetByFirmBLL();
Inquiry_FastSetByFirm fastModel = _fastSetByFirmBLL.GetModel(firmId, customerId, model.PrintTypeId);
if (fastModel != null)
{
fastValue = (fastModel.FastValue / 100);
}
}
SysInquiry_PaperSizeDetail paperSize = null;
PaperSizeDetailBLL _paperSizeDetailBLL = new PaperSizeDetailBLL();
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(model.PrintTypeId, model.PrintSizeId);
if (model.PrintMode == 1)
{
paperPrice = GetNoteFastPaperPrice(model.PaperMP, model.PrintSizeId, model.PrintColor, model.PrintCount, inquiryId) * fastValue;
detail.PaperPriceStr = paperPrice.ToString("0.00");
}
else
{
model.PrintCount = model.PrintCount * model.PageNum;
model.PaperId = model.PaperMP.ToInt32().Value;
paperPrice = GetPaperPrice(model, inquiryId, paperSize, detail, fastValue);
}
if (model.PrintMode != 1)
{
if (model.PrintColor == "彩色")
{
impressPrice = GetImpressionPrice(model, paperSize.Name, paperSize.Value.Value, "单面", model.PrintCount, model.PrintTypeId, false, inquiryId, ref versionCost, detail, fastValue, firmId, customerId);
}
else
{
impressPrice = GetImpressionPrice(paperSize.Value.Value, "单面", model.PrintCount, model.PrintTypeId, inquiryId, ref versionCost, detail, fastValue);
}
}
string afterWorkPriceStr = string.Empty;
//计算后工序价格
afterWorkPrice = GetAfterWorkListPrice(model, inquiryId, paperSize, ref afterWorkPriceStr, fastValue);
detail.AfterWorkPriceStr = afterWorkPriceStr;
totalPrice = paperPrice + impressPrice + versionCost + afterWorkPrice;
if (model.DeliveryMode != 104)
cargagePrice = GetCargagePrice(totalPrice, inquiryId, model.DeliveryMode) * fastValue;
totalPrice = totalPrice + cargagePrice;
if (model.BillMode != 108)
{
decimal taxValue = GetTaxationValue(model.BillMode, inquiryId);
taxationPrice = (totalPrice * taxValue / 100) * fastValue;
}
totalPrice = totalPrice + taxationPrice;
if (model.PrintMode != 1)
{
model.PrintCount = model.PrintCount / model.PageNum;
}
detail.PrintCount = model.PrintCount;
detail.PaperPrice = paperPrice;
detail.ImpressPrice = impressPrice;
detail.VersionCost = versionCost;
detail.AfterWorkPrice = afterWorkPrice;
detail.CargagePrice = cargagePrice;
detail.TaxationPrice = taxationPrice;
detail.TotalPrice = totalPrice;
return detail;
}
///
/// 获取便签快速询价价格
///
///
///
///
///
///
///
public decimal GetNoteFastPaperPrice(string paperName, int paperSizeId, string printColor, int printCount, Guid inquiryId)
{
NoteFastCostBLL _noteFastCostBLL = new NoteFastCostBLL();
return _noteFastCostBLL.GetNoteFastPaperPrice(paperName, paperSizeId, printColor, printCount, inquiryId);
}
///
/// 计算黑白印件价格
///
///
///
///
///
public InquiryDetail GetBlackAndWhiteInquiryDetail(InquiryCommonModel model, Guid inquiryId, Guid firmId, Guid customerId)
{
InquiryDetail detail = new InquiryDetail();
//总价
decimal totalPrice = 0;
//纸张价格
decimal paperPrice = 0;
//印工费
decimal impressPrice = 0;
//版费
decimal versionCost = 0;
decimal afterWorkPrice = 0;
//货运费
decimal cargagePrice = 0;
//税费
decimal taxationPrice = 0;
decimal fastValue = 1;
if ((customerId != Guid.Empty && inquiryId != customerId) || (customerId == Guid.Empty && inquiryId == Guid.Parse(UtilConst.AdminFirmId)))
{
FastSetByFirmBLL _fastSetByFirmBLL = new FastSetByFirmBLL();
Inquiry_FastSetByFirm fastModel = _fastSetByFirmBLL.GetModel(firmId, customerId, model.PrintTypeId);
if (fastModel != null)
{
fastValue = (fastModel.FastValue / 100);
}
}
PaperSizeDetailBLL _paperSizeDetailBLL = new PaperSizeDetailBLL();
SysInquiry_PaperSizeDetail paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(model.PrintTypeId, model.PrintSizeId);
if (model.PrintMode == 1)
{
paperPrice = GetBlackAndWhiteFastPaperPrice(model.GramWeight, model.SingleOrdouble, paperSize, model.PrintCount, model.PrintColor, inquiryId) * fastValue;
detail.PaperPriceStr = paperPrice.ToString("0.00");
}
else
{
paperPrice = GetPaperPrice(model, inquiryId, paperSize, detail, fastValue);
}
if (model.PrintMode != 1)
{
impressPrice = GetImpressionPrice(paperSize.Value.Value, model.SingleOrdouble, model.PrintCount, model.PrintTypeId, model.PrintColor, inquiryId, ref versionCost, detail, fastValue);
}
string afterWorkPriceStr = string.Empty;
//计算后工序价格
afterWorkPrice = GetAfterWorkListPrice(model, inquiryId, paperSize, ref afterWorkPriceStr, fastValue);
detail.AfterWorkPriceStr = afterWorkPriceStr;
totalPrice = paperPrice + impressPrice + versionCost + afterWorkPrice;
if (model.DeliveryMode != 104)
cargagePrice = GetCargagePrice(totalPrice, inquiryId, model.DeliveryMode) * fastValue;
totalPrice = totalPrice + cargagePrice;
if (model.BillMode != 108)
{
decimal taxValue = GetTaxationValue(model.BillMode, inquiryId);
taxationPrice = (totalPrice * taxValue / 100) * fastValue;
}
totalPrice = totalPrice + taxationPrice;
detail.PrintCount = model.PrintCount;
detail.PaperPrice = paperPrice;
detail.ImpressPrice = impressPrice;
detail.VersionCost = versionCost;
detail.AfterWorkPrice = afterWorkPrice;
detail.CargagePrice = cargagePrice;
detail.TaxationPrice = taxationPrice;
detail.TotalPrice = totalPrice;
return detail;
}
///
/// 计算黑白画印快速询价价格
///
///
///
///
///
///
///
///
public decimal GetBlackAndWhiteFastPaperPrice(int gramWeight, string singleOrdouble, SysInquiry_PaperSizeDetail pageSize, int printCount, string printColor, Guid inquiryId)
{
BlackAndWhiteFastCostBLL _blackAndWhiteFastCostBLL = new BlackAndWhiteFastCostBLL();
string paperSizeName = pageSize.Name;
paperSizeName = paperSizeName.Substring(0, 1) + "度";
int pageSizeValue = pageSize.Value.Value;
decimal paperPrice = _blackAndWhiteFastCostBLL.GetBlackAndWhiteFastPrice(gramWeight, singleOrdouble, paperSizeName, printCount, inquiryId);
paperPrice = paperPrice * ((16).ToDouble2().Value / pageSizeValue.ToDouble2().Value).ToDecimal2().Value;
//获取16开500张的价格
decimal tempPaperPrice = _blackAndWhiteFastCostBLL.GetBlackAndWhiteFastPrice(gramWeight, singleOrdouble, paperSizeName, 500, inquiryId);
if (paperPrice < tempPaperPrice)
{
paperPrice = tempPaperPrice;
}
if (printColor == "双色")
{
paperPrice = paperPrice + printCount.ToDecimal2().Value * (0.01).ToDecimal2().Value;
}
else if (printColor == "三色")
{
paperPrice = paperPrice + printCount.ToDecimal2().Value * (0.02).ToDecimal2().Value;
}
return paperPrice;
}
///
/// 计算DM单价格
///
///
///
///
///
public InquiryDetail GetDMInquiryDetail(InquiryCommonModel model, Guid inquiryId, Guid firmId, Guid customerId)
{
InquiryDetail detail = new InquiryDetail();
///总价
decimal totalPrice = 0;
///纸张价格
decimal paperPrice = 0;
///印工费
decimal impressPrice = 0;
///版费
decimal versionCost = 0;
///后工费
decimal afterWorkPrice = 0;
///货运费
decimal cargagePrice = 0;
///税费
decimal taxationPrice = 0;
string afterWorkListStr = string.Empty;
decimal fastValue = 1;
if ((customerId != Guid.Empty && inquiryId != customerId) || (customerId == Guid.Empty && inquiryId == Guid.Parse(UtilConst.AdminFirmId)))
{
FastSetByFirmBLL _fastSetByFirmBLL = new FastSetByFirmBLL();
Inquiry_FastSetByFirm fastModel = _fastSetByFirmBLL.GetModel(firmId, customerId, model.PrintTypeId);
if (fastModel != null)
{
fastValue = (fastModel.FastValue / 100);
}
}
PaperSizeDetailBLL _paperSizeDetailBLL = new PaperSizeDetailBLL();
SysInquiry_PaperSizeDetail paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(model.PrintTypeId, model.PrintSizeId);
if (model.PrintMode == 1)
{
paperPrice = GetDMFastPaperPrice(model.GramWeight, model.SingleOrdouble, model.PrintCount, inquiryId, paperSize.Value.Value, paperSize.Name) * fastValue;
detail.PaperPriceStr = paperPrice.ToString("0.00");
}
else
{
paperPrice = GetPaperPrice(model, inquiryId, paperSize, detail, fastValue);
}
if (model.PrintMode != 1)
{
impressPrice = GetImpressionPrice(model, paperSize.Name, paperSize.Value.Value, model.SingleOrdouble, model.PrintCount, model.PrintTypeId, false, inquiryId, ref versionCost, detail, fastValue, firmId, customerId);
}
//计算后工序价格
afterWorkPrice = GetAfterWorkListPrice(model, inquiryId, paperSize, ref afterWorkListStr, fastValue);
detail.AfterWorkPriceStr = afterWorkListStr;
totalPrice = paperPrice + impressPrice + versionCost + afterWorkPrice;
if (model.DeliveryMode != 104)
cargagePrice = GetCargagePrice(totalPrice, inquiryId, model.DeliveryMode) * fastValue;
totalPrice = totalPrice + cargagePrice;
if (model.BillMode != 108)
{
decimal taxValue = GetTaxationValue(model.BillMode, inquiryId);
taxationPrice = (totalPrice * taxValue / 100) * fastValue;
}
totalPrice = totalPrice + taxationPrice;
detail.PrintCount = model.PrintCount;
detail.PaperPrice = paperPrice;
detail.ImpressPrice = impressPrice;
detail.VersionCost = versionCost;
detail.AfterWorkPrice = afterWorkPrice;
detail.CargagePrice = cargagePrice;
detail.TaxationPrice = taxationPrice;
detail.TotalPrice = totalPrice;
return detail;
}
///
/// 获取书刊询价结果
///
///
///
///
///
///
public InquiryDetail GetBookInquiryDetail(InquiryCommonModel model, Guid inquiryId, Guid firmId, Guid customerId)
{
InquiryDetail detail = new InquiryDetail();
//总价
decimal totalPrice = 0;
//纸张价格
decimal paperPrice = 0;
//印工费
decimal impressPrice = 0;
//版费
decimal versionCost = 0;
decimal afterWorkPrice = 0;
//货运费
decimal cargagePrice = 0;
//税费
decimal taxationPrice = 0;
string afterWorkListStr = string.Empty;
decimal fastValue = 1;
if ((customerId != Guid.Empty && inquiryId != customerId) || (customerId == Guid.Empty && inquiryId == Guid.Parse(UtilConst.AdminFirmId)))
{
FastSetByFirmBLL _fastSetByFirmBLL = new FastSetByFirmBLL();
Inquiry_FastSetByFirm fastModel = _fastSetByFirmBLL.GetModel(firmId, customerId, model.PrintTypeId);
if (fastModel != null)
{
fastValue = (fastModel.FastValue / 100);
}
}
PaperSizeDetailBLL _paperSizeDetailBLL = new PaperSizeDetailBLL();
SysInquiry_PaperSizeDetail paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(model.PrintTypeId, model.PrintSizeId);
if (model.BindingMode == 17)
{
if (paperSize.Value.Value == 32 || paperSize.Value.Value == 24)
{
if (paperSize.Name.Contains("正"))
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 10);
}
else
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 11);
}
}
else if (paperSize.Value.Value == 16)
{
if (paperSize.Name.Contains("正"))
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 13);
}
else
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 14);
}
}
else if (paperSize.Value.Value == 12)
{
if (paperSize.Name.Contains("正"))
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 15);
}
else
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 16);
}
}
else if (paperSize.Value.Value == 8)
{
if (paperSize.Name.Contains("正"))
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 16);
}
else
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 18);
}
}
}
else if (model.AfterWorkList.Contains(32))
{
if (model.LaFeng == "封面封底均拉封")
{
if (paperSize.Name.Contains("正"))
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 18);
}
else
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 19);
}
}
else
{
if (paperSize.Name.Contains("正"))
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 13);
}
else
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 14);
}
}
}
else if (model.AfterWorkList.Contains(18))
{
if (paperSize.Value.Value == 32)
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 11);
}
else if (paperSize.Value.Value == 24)
{
if (paperSize.Name.Contains("正"))
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 10);
}
else
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 11);
}
}
else if (paperSize.Value.Value == 16 && paperSize.Name.Contains("正"))
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 118);
}
else if ((paperSize.Value.Value == 16 && paperSize.Name.Contains("大")) || (paperSize.Value.Value == 12 && paperSize.Name.Contains("大")))
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 14);
}
else if (paperSize.Value.Value == 12 && paperSize.Name.Contains("正"))
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 3);
}
}
else
{
if (paperSize.Value.Value == 64)
{
if (paperSize.Name.Contains("正"))
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 4);
}
else
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 5);
}
}
else if (paperSize.Value.Value == 32)
{
if (paperSize.Name.Contains("正"))
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 7);
}
else
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 8);
}
}
else if (paperSize.Value.Value == 24)
{
if (paperSize.Name.Contains("正"))
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 10);
}
else
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 11);
}
}
else if (paperSize.Value.Value == 16)
{
if (paperSize.Name.Contains("正"))
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 10);
}
else
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 11);
}
}
else if (paperSize.Value.Value == 12)
{
if (paperSize.Name.Contains("正"))
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 118);
}
else
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 119);
}
}
else if (paperSize.Value.Value == 8)
{
if (paperSize.Name.Contains("正"))
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 13);
}
else
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 14);
}
}
}
SysInquiry_PaperSizeDetail paperSizeObj = _paperSizeDetailBLL.GetPaperSizeDetail(model.PrintTypeId, model.PrintSizeId);
bool IsCan = IsCanMerge(model);
decimal paperPriceByFM = 0;
if (!IsCan)
{
paperPriceByFM = GetPaperPriceByPA(model, inquiryId, paperSize, detail, fastValue);
}
else
{
detail.PaperPriceStr += "封面纸价:0元;";
}
decimal paperPriceByLY = GetPaperPriceByLY(model, inquiryId, paperSizeObj, detail, fastValue);
paperPrice = paperPriceByFM + paperPriceByLY;
detail.PaperPriceStr += ",共计:" + paperPrice.ToString("0.00") + "元";
decimal versionCostByFM = 0;
decimal versionCostByLY = 0;
decimal impressPriceByFM = 0;
decimal impressPriceByLY = 0;
if (!IsCan)
{
impressPriceByFM = GetImpressionPriceByBookFM(model, paperSize.Name, paperSize.Value.Value, model.SingleOrdouble, model.PrintCount, model.PrintTypeId, false, inquiryId, ref versionCostByFM, detail, fastValue, firmId, customerId);
}
else
{
detail.ImpressPriceStr += "封面印工:0元;";
}
impressPriceByLY = GetImpressionPriceByBookLY(model, paperSizeObj, inquiryId, ref versionCostByLY, detail, fastValue, firmId, customerId);
impressPrice = impressPriceByFM + impressPriceByLY;
versionCost = versionCostByFM + versionCostByLY;
detail.ImpressPriceStr += ",共计:" + impressPrice.ToString("0.00") + "元";
decimal afterWorkPriceByFM = 0;
decimal afterWorkPriceByLY = 0;
afterWorkPriceByFM = GetAfterWorkListPrice(model, inquiryId, paperSize, ref afterWorkListStr, fastValue);
afterWorkPriceByLY = GetAfterWorkListPriceByLY(model, inquiryId, paperSizeObj, ref afterWorkListStr, fastValue);
afterWorkPrice = afterWorkPriceByFM + afterWorkPriceByLY;
afterWorkListStr += ",共计:" + afterWorkPrice.ToString("0.00") + "元";
detail.AfterWorkPriceStr = afterWorkListStr;
totalPrice = paperPrice + impressPrice + versionCost + afterWorkPrice;
if (model.DeliveryMode != 104)
cargagePrice = GetCargagePrice(totalPrice, inquiryId, model.DeliveryMode) * fastValue;
totalPrice = totalPrice + cargagePrice;
if (model.BillMode != 108)
{
decimal taxValue = GetTaxationValue(model.BillMode, inquiryId);
taxationPrice = (totalPrice * taxValue / 100) * fastValue;
}
totalPrice = totalPrice + taxationPrice;
detail.PrintCount = model.PrintCount;
detail.PaperPrice = paperPrice;
detail.ImpressPrice = impressPrice;
detail.VersionCost = versionCost;
detail.AfterWorkPrice = afterWorkPrice;
detail.CargagePrice = cargagePrice;
detail.TaxationPrice = taxationPrice;
detail.TotalPrice = totalPrice;
return detail;
}
///
/// 获取画册询价结果
///
///
///
///
///
///
public InquiryDetail GetPictureAlbumInquiryDetail(InquiryCommonModel model, Guid inquiryId, Guid firmId, Guid customerId)
{
InquiryDetail detail = new InquiryDetail();
//总价
decimal totalPrice = 0;
//纸张价格
decimal paperPrice = 0;
//印工费
decimal impressPrice = 0;
//版费
decimal versionCost = 0;
decimal afterWorkPrice = 0;
//货运费
decimal cargagePrice = 0;
//税费
decimal taxationPrice = 0;
string afterWorkListStr = string.Empty;
decimal fastValue = 1;
if ((customerId != Guid.Empty && inquiryId != customerId) || (customerId == Guid.Empty && inquiryId == Guid.Parse(UtilConst.AdminFirmId)))
{
FastSetByFirmBLL _fastSetByFirmBLL = new FastSetByFirmBLL();
Inquiry_FastSetByFirm fastModel = _fastSetByFirmBLL.GetModel(firmId, customerId, model.PrintTypeId);
if (fastModel != null)
{
fastValue = (fastModel.FastValue / 100);
}
}
PaperSizeDetailBLL _paperSizeDetailBLL = new PaperSizeDetailBLL();
SysInquiry_PaperSizeDetail paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(model.PrintTypeId, model.PrintSizeId);
if (model.PrintMode == 1)
{
int pageNum = 0;
InquiryInsideModel insideModel = model.InquiryInsideList[0];
pageNum = insideModel.PageNum + 4;
paperPrice = GetPictureAlbumFastPaperPrice(model.GramWeight, insideModel.GramWeight, model.PrintCount, pageNum, inquiryId) * fastValue;
detail.PaperPriceStr = paperPrice.ToString("0.00");
//计算后工序价格
afterWorkPrice = GetAfterWorkListPrice(model, inquiryId, paperSize, ref afterWorkListStr, fastValue);
}
else
{
if (model.BindingMode == 17)
{
if (paperSize.Value.Value == 32 || paperSize.Value.Value == 24)
{
if (paperSize.Name.Contains("正"))
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 10);
}
else
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 11);
}
}
else if (paperSize.Value.Value == 16)
{
if (paperSize.Name.Contains("正"))
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 13);
}
else
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 14);
}
}
else if (paperSize.Value.Value == 12)
{
if (paperSize.Name.Contains("正"))
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 15);
}
else
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 16);
}
}
else if (paperSize.Value.Value == 8)
{
if (paperSize.Name.Contains("正"))
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 16);
}
else
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 18);
}
}
}
else if (model.AfterWorkList.Contains(32))
{
if (model.LaFeng == "封面封底均拉封")
{
if (paperSize.Name.Contains("正"))
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 18);
}
else
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 19);
}
}
else
{
if (paperSize.Name.Contains("正"))
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 13);
}
else
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 14);
}
}
}
else if (model.AfterWorkList.Contains(18))
{
if (paperSize.Value.Value == 32)
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 11);
}
else if (paperSize.Value.Value == 24)
{
if (paperSize.Name.Contains("正"))
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 10);
}
else
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 11);
}
}
else if (paperSize.Value.Value == 16 && paperSize.Name.Contains("正"))
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 118);
}
else if ((paperSize.Value.Value == 16 && paperSize.Name.Contains("大")) || (paperSize.Value.Value == 12 && paperSize.Name.Contains("大")))
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 14);
}
else if (paperSize.Value.Value == 12 && paperSize.Name.Contains("正"))
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 3);
}
}
else
{
if (paperSize.Value.Value == 64)
{
if (paperSize.Name.Contains("正"))
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 4);
}
else
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 5);
}
}
else if (paperSize.Value.Value == 32)
{
if (paperSize.Name.Contains("正"))
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 7);
}
else
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 8);
}
}
else if (paperSize.Value.Value == 24)
{
if (paperSize.Name.Contains("正"))
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 10);
}
else
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 11);
}
}
else if (paperSize.Value.Value == 16)
{
if (paperSize.Name.Contains("正"))
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 10);
}
else
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 11);
}
}
else if (paperSize.Value.Value == 12)
{
if (paperSize.Name.Contains("正"))
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 118);
}
else
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 119);
}
}
else if (paperSize.Value.Value == 8)
{
if (paperSize.Name.Contains("正"))
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 13);
}
else
{
paperSize = _paperSizeDetailBLL.GetPaperSizeDetail(14, 14);
}
}
}
SysInquiry_PaperSizeDetail paperSizeObj = _paperSizeDetailBLL.GetPaperSizeDetail(model.PrintTypeId, model.PrintSizeId);
bool IsCan = IsCanMerge(model);
decimal paperPriceByFM = 0;
if (!IsCan)
{
paperPriceByFM = GetPaperPriceByPA(model, inquiryId, paperSize, detail, fastValue);
}
else
{
detail.PaperPriceStr += "封面纸价:0元;";
}
decimal paperPriceByLY = GetPaperPriceByLY(model, inquiryId, paperSizeObj, detail, fastValue);
paperPrice = paperPriceByFM + paperPriceByLY;
detail.PaperPriceStr += ",共计:" + paperPrice.ToString("0.00") + "元";
decimal versionCostByFM = 0;
decimal versionCostByLY = 0;
decimal impressPriceByFM = 0;
decimal impressPriceByLY = 0;
if (!IsCan)
{
impressPriceByFM = GetImpressionPriceByFM(model, paperSize.Name, paperSize.Value.Value, model.SingleOrdouble, model.PrintCount, model.PrintTypeId, false, inquiryId, ref versionCostByFM, detail, fastValue, firmId, customerId);
}
else
{
detail.ImpressPriceStr += "封面印工:0元;";
}
impressPriceByLY = GetImpressionPriceByLY(model, paperSizeObj, inquiryId, ref versionCostByLY, detail, fastValue, firmId, customerId);
impressPrice = impressPriceByFM + impressPriceByLY;
versionCost = versionCostByFM + versionCostByLY;
detail.ImpressPriceStr += ",共计:" + impressPrice.ToString("0.00") + "元";
decimal afterWorkPriceByFM = 0;
decimal afterWorkPriceByLY = 0;
afterWorkPriceByFM = GetAfterWorkListPrice(model, inquiryId, paperSize, ref afterWorkListStr, fastValue);
afterWorkPriceByLY = GetAfterWorkListPriceByLY(model, inquiryId, paperSizeObj, ref afterWorkListStr, fastValue);
afterWorkPrice = afterWorkPriceByFM + afterWorkPriceByLY;
afterWorkListStr += ",共计:" + afterWorkPrice.ToString("0.00") + "元";
}
detail.AfterWorkPriceStr = afterWorkListStr;
totalPrice = paperPrice + impressPrice + versionCost + afterWorkPrice;
if (model.DeliveryMode != 104)
cargagePrice = GetCargagePrice(totalPrice, inquiryId, model.DeliveryMode) * fastValue;
totalPrice = totalPrice + cargagePrice;
if (model.BillMode != 108)
{
decimal taxValue = GetTaxationValue(model.BillMode, inquiryId);
taxationPrice = (totalPrice * taxValue / 100) * fastValue;
}
totalPrice = totalPrice + taxationPrice;
detail.PrintCount = model.PrintCount;
detail.PaperPrice = paperPrice;
detail.ImpressPrice = impressPrice;
detail.VersionCost = versionCost;
detail.AfterWorkPrice = afterWorkPrice;
detail.CargagePrice = cargagePrice;
detail.TaxationPrice = taxationPrice;
detail.TotalPrice = totalPrice;
return detail;
}
///
/// 是否可以合并封面和内页1
///
///
///
public bool IsCanMerge(InquiryCommonModel model)
{
bool isCan = false;
InquiryInsideModel insideModel = model.InquiryInsideList.SingleOrDefault(p => p.InsideIndex == 1);
if (insideModel != null)
{
if (model.BindingMode == 14 && model.PaperId == insideModel.PaperId && model.GramWeight == insideModel.GramWeight && model.BrandId == insideModel.BrandId)
{
isCan = true;
}
else
{
isCan = false;
}
}
return isCan;
}
///
/// 获取画册快速询价结果
///
///
public decimal GetPictureAlbumFastPaperPrice(int coverGramWeight, int insideGramWeight, int printCount, int pageNum, Guid inquiryId)
{
PictureAlbumFastCostBLL _pictureAlbumFastCostBLL = new PictureAlbumFastCostBLL();
return _pictureAlbumFastCostBLL.GetPictureAlbumFastCost(coverGramWeight, insideGramWeight, printCount, pageNum, inquiryId);
}
///
/// 获取实际计算的印刷数量
///
///
///
///
private int GetRelPrintCountList(int printCount, int[] countArry)
{
int relPrintCount = 0;
foreach (int i in countArry)
{
if (printCount <= i)
{
relPrintCount = i;
break;
}
}
return relPrintCount;
}
private List GetPrintCountList(int printCount, int[] countArry)
{
List resultList = new List();
resultList.Add(printCount);
int num = 1;
foreach (int i in countArry)
{
if (num == 3)
break;
if (printCount < i)
{
resultList.Add(i);
num++;
}
}
return resultList;
}
///
/// 获取纸张价格(画册封面)
///
///
///
///
public decimal GetPaperPriceByPA(InquiryCommonModel model, Guid inquiryId, SysInquiry_PaperSizeDetail paperSize, InquiryDetail detail, decimal fastValue)
{
detail.PaperPriceStr = "封面纸价:";
decimal toalPaperPrice = 0;
if (model.PaperId == 0)
{
detail.PaperPriceStr += "自带纸:0元;";
}
else
{
PaperSizeDetailBLL _paperSizeDetailBLL = new PaperSizeDetailBLL();
decimal priceBySingle = GetPaperPriceBySingle(model.PaperId, model.GramWeight, model.BrandId, inquiryId, paperSize.Name);
priceBySingle = priceBySingle * fastValue;
int defalutDriveNumber = 3;
if (model.PrintTypeId == 14)
{
defalutDriveNumber = 3;
}
else if (model.PrintTypeId == 29)
{
defalutDriveNumber = 4;
}
int toalConsumption = 0;
int allCount = 0;
int totalPaperCount = GetTotalPaperCount(model.PrintTypeId, model.PrintCount, paperSize.Value.Value, defalutDriveNumber, model.SingleOrdouble, model.AfterWorkList, inquiryId, model.LaFeng, ref toalConsumption, ref allCount);
toalPaperPrice = priceBySingle * totalPaperCount;
PaperInfoBLL _paperInfoBLL = new PaperInfoBLL();
SysInquiry_PaperInfo paperModel = _paperInfoBLL.GetPaperModel(model.PaperId);
detail.PaperPriceStr += model.GramWeight + "克" + paperModel.PaperName + totalPaperCount.ToString() + "张(正数" + allCount.ToString() + "+消耗" + toalConsumption.ToString() + ")×" + priceBySingle.ToString("0.00") + "元=" + toalPaperPrice.ToString("0.00") + "元;";
}
return toalPaperPrice;
}
///
/// 获取印工费和版费(2开机和4开机)(画册封面)
///
///
///
///
///
///
///
///
public decimal GetImpressionPriceByFM(InquiryCommonModel model, string sizeName, int driveNumber, string areaNumber, int printcount, int printTypeId, bool isLeMouth, Guid inquiryId, ref decimal versionCost, InquiryDetail detail, decimal fastValue, Guid firmId, Guid customerId)
{
detail.ImpressPriceStr = "封面印工:";
decimal impressPrice = 0;
int equipmentId = 0;
int impressionCount = 0;
if (model.PaperId == 18)
{
impressionCount = ((printcount.ToDouble2().Value / driveNumber.ToDouble2().Value) * 4 * 2).ToDecimal2().Value.JRoundInt();
equipmentId = 2;
if (impressionCount < 1000)
impressionCount = 1000;
}
else
{
impressionCount = InquiryHelpBLL.GetImpressionCount(sizeName, driveNumber, areaNumber, printcount, printTypeId, isLeMouth, ref equipmentId);
}
decimal addimpressionCount = 0;
impressionCount = GetRealImpressionCount(impressionCount, 10001, firmId, customerId);
PrintingWorksBLL _printingWorksBLL = new PrintingWorksBLL();
Inquiry_PrintingWorks printWork = _printingWorksBLL.GetModel(impressionCount, equipmentId, inquiryId);
if (printWork != null)
{
impressPrice = printWork.WorkPrice;
if (impressionCount > 10000)
{
//addimpressionCount = impressionCount - 10000;
//if (printWork.AddPrintCount.HasValue && printWork.AddPrintCount.Value > 0)
//{
// double f = (addimpressionCount.ToDouble2().Value / (1000).ToDouble2().Value / (printWork.AddPrintCount.Value).ToDouble2().Value);
// addimpressionCount = f.ToString("0.0").ToDecimal2().Value;
// impressPrice += addimpressionCount * printWork.AddPrice.Value;
//}
impressPrice = ((impressionCount.ToDouble2().Value / 1000).ToDecimal2().Value) * impressPrice;
impressPrice = impressPrice * 4;
}
versionCost = printWork.VersionCost;
}
impressPrice = impressPrice * fastValue;
versionCost = versionCost * fastValue;
PrintingMachineBLL _printingMachineBLL = new PrintingMachineBLL();
SysInquiry_PrintingMachine machineModel = _printingMachineBLL.GetModelByKeyId(equipmentId);
if (driveNumber == 1)
{
if (areaNumber == "双面")
{
impressPrice = impressPrice * 2;
versionCost = versionCost * 2;
}
detail.ImpressPriceStr = impressionCount.ToString() + "印次:" + impressPrice.ToString("0.00") + "元";
}
else
{
if (driveNumber == 2 || driveNumber == 3)
{
if (areaNumber == "双面")
{
impressPrice = impressPrice * 2;
versionCost = versionCost * 2;
}
}
detail.ImpressPriceStr += machineModel.MachineName + impressionCount.ToString() + "印次:" + impressPrice.ToString("0.00") + "元;";
}
model.EquipmentId = equipmentId;
return impressPrice;
}
///
/// 获取印工费和版费(报纸封面)
///
///
///
///
///
///
///
///
public decimal GetImpressionPriceByBookFM(InquiryCommonModel model, string sizeName, int driveNumber, string areaNumber, int printcount, int printTypeId, bool isLeMouth, Guid inquiryId, ref decimal versionCost, InquiryDetail detail, decimal fastValue, Guid firmId, Guid customerId)
{
detail.ImpressPriceStr = "封面印工:";
decimal impressPrice = 0;
if (model.PrintColor == "单色")
{
impressPrice = GetImpressionPrice(driveNumber, printcount, printTypeId, inquiryId, ref versionCost, detail, fastValue, firmId, customerId);
}
else if (model.PrintColor == "双色")
{
impressPrice = GetImpressionPrice(driveNumber, printcount, printTypeId, inquiryId, ref versionCost, detail, fastValue, firmId, customerId);
impressPrice = impressPrice * 2;
versionCost = versionCost * 2;
}
else
{
impressPrice = GetImpressionPrice(model, sizeName, driveNumber, areaNumber, printcount, printTypeId, false, inquiryId, ref versionCost, detail, fastValue, firmId, customerId);
}
detail.ImpressPriceStr += ";";
return impressPrice;
}
///
/// 获取印工费和版费(书刊内页)
///
///
///
///
///
///
///
///
public decimal GetImpressionPriceByBookLY(InquiryCommonModel model, SysInquiry_PaperSizeDetail paperSize, Guid inquiryId, ref decimal totalVersionCost, InquiryDetail detail, decimal fastValue, Guid firmId, Guid customerId)
{
detail.ImpressPriceStr += "内页印工:";
decimal totalImpressPrice = 0;
decimal impressPrice2 = 0;
decimal versionCost2 = 0;
decimal impressPrice4 = 0;
decimal versionCost4 = 0;
foreach (InquiryInsideModel insideModel in model.InquiryInsideList)
{
impressPrice2 = 0;
versionCost2 = 0;
impressPrice4 = 0;
versionCost4 = 0;
detail.ImpressPriceStr += "内页" + insideModel.InsideIndex + ":";
int realPageNum = GetRealPageNum(insideModel.PageNum, insideModel.PaperId, model.BindingMode);
int num = GetNumByBookLY(insideModel.PaperId, realPageNum, paperSize.Value.Value);
int equipmentId = 0;
int impressionCount = 0;
decimal addimpressionCount = 0;
impressionCount = model.PrintCount;
if (impressionCount < 1000)
{
impressionCount = 1000;
}
if (insideModel.PaperId == 18)
{
if (insideModel.PrintColor != "不印刷")
{
equipmentId = 2;
impressionCount = GetRealImpressionCount(impressionCount, 10001, firmId, customerId);
PrintingWorksBLL _printingWorksBLL = new PrintingWorksBLL();
Inquiry_PrintingWorks printWork = _printingWorksBLL.GetModel(impressionCount, equipmentId, inquiryId);
if (printWork != null)
{
impressPrice4 = printWork.WorkPrice;
if (impressionCount > 10000)
{
//addimpressionCount = impressionCount - 10000;
//if (printWork.AddPrintCount.HasValue && printWork.AddPrintCount.Value > 0)
//{
// double f = (addimpressionCount.ToDouble2().Value / (1000).ToDouble2().Value / (printWork.AddPrintCount.Value).ToDouble2().Value);
// addimpressionCount = f.ToString("0.0").ToDecimal2().Value;
// impressPrice4 += addimpressionCount * printWork.AddPrice.Value;
//}
impressPrice4 = ((impressionCount.ToDouble2().Value / 1000).ToDecimal2().Value) * impressPrice4;
impressPrice4 = impressPrice4 * 4;
}
versionCost4 = printWork.VersionCost;
}
impressPrice4 = impressPrice4 * fastValue * num;
versionCost4 = versionCost4 * fastValue * num;
PrintingMachineBLL _printingMachineBLL = new PrintingMachineBLL();
SysInquiry_PrintingMachine machineModel = _printingMachineBLL.GetModelByKeyId(equipmentId);
detail.ImpressPriceStr += machineModel.MachineName + impressionCount.ToString() + "印次:" + impressPrice4.ToString("0.00") + "元";
}
}
else
{
PrintingWorksBLL _printingWorksBLL = new PrintingWorksBLL();
Inquiry_PrintingWorks printWork = null;
PrintingMachineBLL _printingMachineBLL = new PrintingMachineBLL();
SysInquiry_PrintingMachine machineModel = null;
if (num != 0)
{
addimpressionCount = 0;
equipmentId = 1;
if (insideModel.PrintColor == "单色" || insideModel.PrintColor == "双色")
{
equipmentId = 3;
impressionCount = GetRealImpressionCount(impressionCount, 5001, firmId, customerId);
printWork = _printingWorksBLL.GetModel2(impressionCount, equipmentId, inquiryId);
if (printWork != null)
{
impressPrice2 = printWork.WorkPrice;
if (impressionCount > 5000)
{
impressPrice2 = ((impressionCount.ToDouble2().Value / 1000).ToDecimal2().Value) * impressPrice2;
}
//if (impressPrice2 < printWork.StartPrice.Value)
//{
// impressPrice2 = printWork.StartPrice.Value;
//}
versionCost2 = printWork.VersionCost;
}
if (insideModel.PrintColor == "双色")
{
impressPrice2 *= 2;
versionCost2 *= 2;
}
}
else
{
equipmentId = 1;
impressionCount = GetRealImpressionCount(impressionCount, 10001, firmId, customerId);
printWork = _printingWorksBLL.GetModel(impressionCount, equipmentId, inquiryId);
if (printWork != null)
{
impressPrice2 = printWork.WorkPrice;
if (impressionCount > 10000)
{
//addimpressionCount = impressionCount - 10000;
//if (printWork.AddPrintCount.HasValue && printWork.AddPrintCount.Value > 0)
//{
// double f = (addimpressionCount.ToDouble2().Value / (1000).ToDouble2().Value / (printWork.AddPrintCount.Value).ToDouble2().Value);
// addimpressionCount = f.ToString("0.0").ToDecimal2().Value;
// impressPrice2 += addimpressionCount * printWork.AddPrice.Value;
//}
impressPrice2 = ((impressionCount.ToDouble2().Value / 1000).ToDecimal2().Value) * impressPrice2;
impressPrice2 = impressPrice2 * 4;
}
versionCost2 = printWork.VersionCost;
}
}
impressPrice2 = impressPrice2 * fastValue * num;
versionCost2 = versionCost2 * fastValue * num;
machineModel = _printingMachineBLL.GetModelByKeyId(equipmentId);
detail.ImpressPriceStr += machineModel.MachineName + impressionCount.ToString() + "印次:" + impressPrice2.ToString("0.00") + "元";
}
}
totalImpressPrice += impressPrice2 + impressPrice4;
totalVersionCost += versionCost2 + versionCost4;
detail.ImpressPriceStr += ";";
}
detail.ImpressPriceStr += "合计:" + totalImpressPrice.ToString("0.00") + "元";
return totalImpressPrice;
}
///
/// 获取印工费和版费(2开机和4开机)(画册内页)
///
///
///
///
///
///
///
///
public decimal GetImpressionPriceByLY(InquiryCommonModel model, SysInquiry_PaperSizeDetail paperSize, Guid inquiryId, ref decimal totalVersionCost, InquiryDetail detail, decimal fastValue, Guid firmId, Guid customerId)
{
detail.ImpressPriceStr += "内页印工:";
decimal totalImpressPrice = 0;
decimal impressPrice2 = 0;
decimal versionCost2 = 0;
decimal impressPrice4 = 0;
decimal versionCost4 = 0;
foreach (InquiryInsideModel insideModel in model.InquiryInsideList)
{
impressPrice2 = 0;
versionCost2 = 0;
impressPrice4 = 0;
versionCost4 = 0;
detail.ImpressPriceStr += "内页" + insideModel.InsideIndex + ":";
bool isNeed4 = false;
int realPageNum = GetRealPageNum(insideModel.PageNum, insideModel.PaperId, model.BindingMode);
int num = GetNumByLY(insideModel.PaperId, realPageNum, paperSize.Value.Value, ref isNeed4);
int equipmentId = 0;
int impressionCount = 0;
decimal addimpressionCount = 0;
impressionCount = model.PrintCount;
if (impressionCount < 1000)
{
impressionCount = 1000;
}
impressionCount = GetRealImpressionCount(impressionCount, 10001, firmId, customerId);
if (insideModel.PaperId == 18)
{
if (insideModel.PrintColor != "不印刷")
{
equipmentId = 2;
PrintingWorksBLL _printingWorksBLL = new PrintingWorksBLL();
Inquiry_PrintingWorks printWork = _printingWorksBLL.GetModel(impressionCount, equipmentId, inquiryId);
if (printWork != null)
{
impressPrice4 = printWork.WorkPrice;
if (impressionCount > 10000)
{
//addimpressionCount = impressionCount - 10000;
//if (printWork.AddPrintCount.HasValue && printWork.AddPrintCount.Value > 0)
//{
// double f = (addimpressionCount.ToDouble2().Value / (1000).ToDouble2().Value / (printWork.AddPrintCount.Value).ToDouble2().Value);
// addimpressionCount = f.ToString("0.0").ToDecimal2().Value;
// impressPrice4 += addimpressionCount * printWork.AddPrice.Value;
//}
impressPrice4 = ((impressionCount.ToDouble2().Value / 1000).ToDecimal2().Value) * impressPrice4;
impressPrice4 = impressPrice4 * 4;
}
versionCost4 = printWork.VersionCost;
}
impressPrice4 = impressPrice4 * fastValue * num;
versionCost4 = versionCost4 * fastValue * num;
PrintingMachineBLL _printingMachineBLL = new PrintingMachineBLL();
SysInquiry_PrintingMachine machineModel = _printingMachineBLL.GetModelByKeyId(equipmentId);
detail.ImpressPriceStr += machineModel.MachineName + impressionCount.ToString() + "印次:" + impressPrice4.ToString("0.00") + "元";
}
}
else
{
PrintingWorksBLL _printingWorksBLL = new PrintingWorksBLL();
Inquiry_PrintingWorks printWork = null;
PrintingMachineBLL _printingMachineBLL = new PrintingMachineBLL();
SysInquiry_PrintingMachine machineModel = null;
if (num != 0)
{
addimpressionCount = 0;
equipmentId = 1;
printWork = _printingWorksBLL.GetModel(impressionCount, equipmentId, inquiryId);
if (printWork != null)
{
impressPrice2 = printWork.WorkPrice;
if (impressionCount > 10000)
{
//addimpressionCount = impressionCount - 10000;
//if (printWork.AddPrintCount.HasValue && printWork.AddPrintCount.Value > 0)
//{
// double f = (addimpressionCount.ToDouble2().Value / (1000).ToDouble2().Value / (printWork.AddPrintCount.Value).ToDouble2().Value);
// addimpressionCount = f.ToString("0.0").ToDecimal2().Value;
// impressPrice2 += addimpressionCount * printWork.AddPrice.Value;
//}
impressPrice2 = ((impressionCount.ToDouble2().Value / 1000).ToDecimal2().Value) * impressPrice2;
impressPrice2 = impressPrice2 * 4;
}
versionCost2 = printWork.VersionCost;
}
impressPrice2 = impressPrice2 * fastValue * num;
versionCost2 = versionCost2 * fastValue * num;
machineModel = _printingMachineBLL.GetModelByKeyId(equipmentId);
detail.ImpressPriceStr += machineModel.MachineName + impressionCount.ToString() + "印次:" + impressPrice2.ToString("0.00") + "元" + ",";
}
if (isNeed4)
{
equipmentId = 2;
printWork = _printingWorksBLL.GetModel(impressionCount, equipmentId, inquiryId);
if (printWork != null)
{
impressPrice4 = printWork.WorkPrice;
if (impressionCount > 10000)
{
//addimpressionCount = impressionCount - 10000;
//if (printWork.AddPrintCount.HasValue && printWork.AddPrintCount.Value > 0)
//{
// double f = (addimpressionCount.ToDouble2().Value / (1000).ToDouble2().Value / (printWork.AddPrintCount.Value).ToDouble2().Value);
// addimpressionCount = f.ToString("0.0").ToDecimal2().Value;
// impressPrice4 += addimpressionCount * printWork.AddPrice.Value;
//}
impressPrice4 = ((impressionCount.ToDouble2().Value / 1000).ToDecimal2().Value) * impressPrice4;
impressPrice4 = impressPrice4 * 4;
}
versionCost4 = printWork.VersionCost;
}
impressPrice4 = impressPrice4 * fastValue;
versionCost4 = versionCost4 * fastValue;
machineModel = _printingMachineBLL.GetModelByKeyId(equipmentId);
detail.ImpressPriceStr += machineModel.MachineName + impressionCount.ToString() + "印次:" + impressPrice4.ToString("0.00") + "元";
}
}
totalImpressPrice += impressPrice2 + impressPrice4;
totalVersionCost += versionCost2 + versionCost4;
if (detail.ImpressPriceStr.EndsWith(","))
{
detail.ImpressPriceStr = detail.ImpressPriceStr.Substring(0, detail.ImpressPriceStr.Length - 1);
}
detail.ImpressPriceStr += ";";
}
detail.ImpressPriceStr += "合计:" + totalImpressPrice.ToString("0.00") + "元";
return totalImpressPrice;
}
public int GetNumByBookLY(int paperId, int pageNum, int driveNumber)
{
int num = 0;
num = (pageNum.ToDouble2().Value / driveNumber * 2).ToDecimal2().Value.JRoundInt();
return num;
}
public int GetNumByLY(int paperId, int pageNum, int driveNumber, ref bool isNeed4)
{
isNeed4 = false;
int num = 0;
if (paperId != 18)
{
double tempNum = (pageNum.ToDouble2().Value / driveNumber * 2);
string tempNumStr = tempNum.ToString("0.00");
int index = tempNumStr.IndexOf('.');
string tempStr = tempNumStr.Substring(index + 1, tempNumStr.Length - index - 1);
string tempStr2 = tempNumStr.Substring(0, index);
if (tempStr == "75")
{
num = tempNum.ToDecimal2().Value.JRoundInt();
}
else if (tempStr == "25" || tempStr == "50")
{
num = tempStr2.ToInt32().Value;
isNeed4 = true;
}
else
{
num = (pageNum.ToDouble2().Value / driveNumber * 2).ToDecimal2().Value.JRoundInt();
}
}
else
{
num = (pageNum.ToDouble2().Value / driveNumber * 2).ToDecimal2().Value.JRoundInt();
}
return num;
}
///
/// 获取实际的内页页码,用于计算
///
///
///
///
///
public int GetRealPageNum(int pageNum, int paperId, int bindingMode)
{
int realPageNum = 0;
if (bindingMode == 15 || paperId == 18)
{
realPageNum = pageNum;
}
else
{
int i = pageNum % 4;
if (i != 0)
{
realPageNum = (pageNum / 4 + 1) * 4;
}
else
{
realPageNum = pageNum;
}
}
return realPageNum;
}
///
/// 获取纸张价格(画册内页)
///
///
///
///
public decimal GetPaperPriceByLY(InquiryCommonModel model, Guid inquiryId, SysInquiry_PaperSizeDetail paperSize, InquiryDetail detail, decimal fastValue)
{
detail.PaperPriceStr += "内页纸价:";
decimal toalPaperPrice = 0;
decimal paperPrice = 0;
foreach (InquiryInsideModel insideModel in model.InquiryInsideList)
{
paperPrice = 0;
detail.PaperPriceStr += "内页" + insideModel.InsideIndex.ToString() + ":";
if (insideModel.PaperId == 0)
{
detail.PaperPriceStr += "自带纸:0元;";
}
else
{
decimal priceBySingle = GetPaperPriceBySingle(insideModel.PaperId, insideModel.GramWeight, insideModel.BrandId, inquiryId, paperSize.Name);
priceBySingle = priceBySingle * fastValue;
int toalConsumption = 0;
int allCount = 0;
int realPageNum = GetRealPageNum(insideModel.PageNum, insideModel.PaperId, model.BindingMode);
int totalPaperCount = GetTotalPaperCountByLY(model.PrintTypeId, model.PrintCount, realPageNum, paperSize.Value.Value, insideModel.AfterWorkList, inquiryId, ref toalConsumption, ref allCount);
paperPrice = priceBySingle * totalPaperCount;
toalPaperPrice += paperPrice;
PaperInfoBLL _paperInfoBLL = new PaperInfoBLL();
SysInquiry_PaperInfo paperModel = _paperInfoBLL.GetPaperModel(insideModel.PaperId);
detail.PaperPriceStr += insideModel.GramWeight + "克" + paperModel.PaperName + totalPaperCount.ToString() + "张(正数" + allCount.ToString() + "+消耗" + toalConsumption.ToString() + ")×" + priceBySingle.ToString("0.00") + "元=" + paperPrice.ToString("0.00") + "元";
}
detail.PaperPriceStr += ";";
}
detail.PaperPriceStr += "合计:" + toalPaperPrice.ToString("0.00") + "元";
return toalPaperPrice;
}
///
/// 获取纸张总数量(画册内页)
///
///
///
///
///
///
///
///
public int GetTotalPaperCountByLY(int printTypeId, int printCount, int pageNum, int driveNumber, IList afterWorkList, Guid inquiryId, ref int toalConsumption, ref int allCount)
{
int totalPaperCount = 0;
int basicConsumption = 0;
int afterWorkConsumption = 0;
BasicConsumptionBLL _basicConsumptionBLL = new BasicConsumptionBLL();
Inquiry_BasicConsumption basicConsumptionModel = _basicConsumptionBLL.GetModel(inquiryId, printTypeId);
basicConsumption = ((pageNum.ToDouble2().Value / driveNumber / 2).ToDecimal2().Value * printCount * (basicConsumptionModel.basicRatio / 100)).JRoundInt();
if (basicConsumption < basicConsumptionModel.minNumber)
basicConsumption = basicConsumptionModel.minNumber;
if (afterWorkList != null && afterWorkList.Count > 0)
{
AfterConsumptionBLL _afterConsumptionBLL = new AfterConsumptionBLL();
foreach (int afterId in afterWorkList)
{
int workId = afterId;
int afterConsum = 0;
if (afterId == 26 || afterId == 27 || afterId == 28 || afterId == 29)
{
workId = 1;
}
Inquiry_AfterConsumption afterConsumption = _afterConsumptionBLL.GetModel(inquiryId, printTypeId, workId);
afterConsum = ((pageNum.ToDouble2().Value / driveNumber / 2).ToDecimal2().Value * afterConsumption.BasicRatio / 100).JRoundInt() * printCount;
if (afterConsum < afterConsumption.MinNumber)
afterConsum = afterConsumption.MinNumber;
afterWorkConsumption += afterConsum;
}
}
toalConsumption = basicConsumption + afterWorkConsumption;
allCount = ((pageNum.ToDouble2().Value / driveNumber / 2).ToDecimal2().Value * printCount).JRoundInt();
totalPaperCount = allCount + toalConsumption;
return totalPaperCount;
}
///
/// 获取纸张价格
///
///
///
///
public decimal GetPaperPrice(InquiryCommonModel model, Guid inquiryId, SysInquiry_PaperSizeDetail paperSize, InquiryDetail detail, decimal fastValue)
{
decimal toalPaperPrice = 0;
if (model.PaperId == 0)
{
detail.PaperPriceStr = "自带纸:0元";
}
else
{
PaperSizeDetailBLL _paperSizeDetailBLL = new PaperSizeDetailBLL();
decimal priceBySingle = GetPaperPriceBySingle(model.PaperId, model.GramWeight, model.BrandId, inquiryId, paperSize.Name);
priceBySingle = priceBySingle * fastValue;
int defalutDriveNumber = 3;
if (model.PrintTypeId == 14)
{
defalutDriveNumber = 3;
}
else if (model.PrintTypeId == 29)
{
defalutDriveNumber = 4;
}
int toalConsumption = 0;
int allCount = 0;
int totalPaperCount = GetTotalPaperCount(model.PrintTypeId, model.PrintCount, paperSize.Value.Value, defalutDriveNumber, model.SingleOrdouble, model.AfterWorkList, inquiryId, model.LaFeng, ref toalConsumption, ref allCount);
toalPaperPrice = priceBySingle * totalPaperCount;
PaperInfoBLL _paperInfoBLL = new PaperInfoBLL();
SysInquiry_PaperInfo paperModel = _paperInfoBLL.GetPaperModel(model.PaperId);
if (model.PrintTypeId == 7)
{
int num = model.PageNum / 4;
toalPaperPrice = toalPaperPrice * num;
detail.PaperPriceStr = model.GramWeight + "克" + paperModel.PaperName + totalPaperCount.ToString() + "张(正数" + allCount.ToString() + "+消耗" + toalConsumption.ToString() + ")×" + priceBySingle.ToString("0.00") + "元×" + num.ToString() + "张,共" + toalPaperPrice.ToString("0.00") + "元";
}
else
{
detail.PaperPriceStr = model.GramWeight + "克" + paperModel.PaperName + totalPaperCount.ToString() + "张(正数" + allCount.ToString() + "+消耗" + toalConsumption.ToString() + ")×" + priceBySingle.ToString("0.00") + "元,共" + toalPaperPrice.ToString("0.00") + "元";
}
}
return toalPaperPrice;
}
///
/// 获取纸张总数量
///
///
///
///
///
///
///
///
public int GetTotalPaperCount(int printTypeId, int printCount, int driveNumber, int defalutDriveNumber, string singleOrdouble, IList afterWorkList, Guid inquiryId, string laFeng, ref int toalConsumption, ref int allCount)
{
int totalPaperCount = 0;
int basicConsumption = 0;
int afterWorkConsumption = 0;
BasicConsumptionBLL _basicConsumptionBLL = new BasicConsumptionBLL();
Inquiry_BasicConsumption basicConsumptionModel = _basicConsumptionBLL.GetModel(inquiryId, printTypeId);
basicConsumption = ((printCount.ToDouble2().Value / driveNumber).ToDecimal2().Value.JRoundInt() * (basicConsumptionModel.basicRatio / 100)).JRoundInt();
if (basicConsumption < basicConsumptionModel.minNumber)
basicConsumption = basicConsumptionModel.minNumber;
if (driveNumber <= defalutDriveNumber && singleOrdouble == "双面")
basicConsumption = basicConsumption * 2;
if (afterWorkList != null && afterWorkList.Count > 0)
{
AfterConsumptionBLL _afterConsumptionBLL = new AfterConsumptionBLL();
foreach (int afterId in afterWorkList)
{
int workId = afterId;
int afterConsum = 0;
if (afterId == 26 || afterId == 27 || afterId == 28 || afterId == 29)
{
workId = 1;
}
if (afterId == 32)
{
if (laFeng == "封面封底均拉封")
{
workId = 51;
}
else
{
workId = 50;
}
}
Inquiry_AfterConsumption afterConsumption = _afterConsumptionBLL.GetModel(inquiryId, printTypeId, workId);
afterConsum = ((printCount.ToDouble2().Value / driveNumber).ToDecimal2().Value * afterConsumption.BasicRatio / 100).JRoundInt();
if (afterConsum < afterConsumption.MinNumber)
afterConsum = afterConsumption.MinNumber;
afterWorkConsumption += afterConsum;
}
}
toalConsumption = basicConsumption + afterWorkConsumption;
allCount = (printCount.ToDouble2().Value / driveNumber).ToDecimal2().Value.JRoundInt();
totalPaperCount = allCount + toalConsumption;
return totalPaperCount;
}
///
/// 获取纸张单价
///
///
public decimal GetPaperPriceBySingle(int paperId, int gramWeight, int brandId, Guid inquiryId, string sizename)
{
decimal tonsOfPrice = GetTonsOfPrice(paperId, gramWeight, brandId, inquiryId);
return InquiryHelpBLL.GetPaperPriceBySingle(sizename, gramWeight, tonsOfPrice);
}
///
/// 获取纸张的吨价
///
///
///
///
///
public decimal GetTonsOfPrice(int paperId, int gramWeight, int brandId, Guid inquiryId)
{
PaperInfoBLL _paperInfoBLL = new PaperInfoBLL();
return _paperInfoBLL.GetTonsOfPrice(paperId, gramWeight, brandId, inquiryId);
}
///
/// 计算DM单快速询价的纸张价格
///
///
///
///
///
///
private decimal GetDMFastPaperPrice(int gramWeight, string singleOrdouble, int printCount, Guid inquiryId, int pageSizeValue, string sizeName)
{
DMFastCostBLL _dMFastCostBLL = new DMFastCostBLL();
decimal paperPrice = 0;
//16开的快速价格
paperPrice = _dMFastCostBLL.GetDMFastPrice(gramWeight, singleOrdouble, printCount, inquiryId);
if (pageSizeValue == 32 && sizeName.Contains("条"))
{
paperPrice = paperPrice * 1;
}
else if (pageSizeValue == 16 && sizeName.Contains("条"))
{
printCount = printCount / 2;
if (printCount < 500)
{
printCount = 500;
}
if (printCount == 2500)
{
paperPrice = _dMFastCostBLL.GetDMFastPrice(gramWeight, singleOrdouble, 3000, inquiryId) * 2;
}
else if (printCount == 1500)
{
paperPrice = _dMFastCostBLL.GetDMFastPrice(gramWeight, singleOrdouble, 2000, inquiryId) * 2;
}
else if (printCount == 25000)
{
paperPrice = _dMFastCostBLL.GetDMFastPrice(gramWeight, singleOrdouble, 10000, inquiryId) * 3;
}
else
{
paperPrice = _dMFastCostBLL.GetDMFastPrice(gramWeight, singleOrdouble, printCount, inquiryId) * 2;
}
}
else if (pageSizeValue == 8 && sizeName.Contains("条"))
{
printCount = printCount / 2;
if (printCount < 500)
{
printCount = 500;
}
if (printCount == 2500)
{
paperPrice = _dMFastCostBLL.GetDMFastPrice(gramWeight, singleOrdouble, 3000, inquiryId) * 2 * 2;
}
else if (printCount == 1500)
{
paperPrice = _dMFastCostBLL.GetDMFastPrice(gramWeight, singleOrdouble, 2000, inquiryId) * 2 * 2;
}
else if (printCount == 25000)
{
paperPrice = _dMFastCostBLL.GetDMFastPrice(gramWeight, singleOrdouble, 10000, inquiryId) * 3 * 2;
}
else
{
paperPrice = _dMFastCostBLL.GetDMFastPrice(gramWeight, singleOrdouble, printCount, inquiryId) * 2 * 2;
}
}
else if (pageSizeValue == 32 && printCount == 50000)
{
paperPrice = _dMFastCostBLL.GetDMFastPrice(gramWeight, singleOrdouble, 10000, inquiryId) * 3;
}
else if (pageSizeValue == 64 && printCount == 50000)
{
paperPrice = _dMFastCostBLL.GetDMFastPrice(gramWeight, singleOrdouble, 5000, inquiryId) * 3;
}
else if (pageSizeValue == 64 && printCount == 100000)
{
paperPrice = _dMFastCostBLL.GetDMFastPrice(gramWeight, singleOrdouble, 10000, inquiryId) * 3;
}
else if (pageSizeValue == 48 && printCount == 100000)
{
paperPrice = _dMFastCostBLL.GetDMFastPrice(gramWeight, singleOrdouble, 10000, inquiryId) * 4;
}
else if (pageSizeValue == 64 || pageSizeValue == 48 || pageSizeValue == 32)
{
int[] countArry = GetPrintCountArry(14);
printCount = (printCount.ToDouble2().Value / (pageSizeValue / 16).ToDouble2().Value).ToDecimal2().Value.JRoundInt();
int relPrintCount = GetRelPrintCountList(printCount, countArry);
paperPrice = _dMFastCostBLL.GetDMFastPrice(gramWeight, singleOrdouble, relPrintCount, inquiryId);
}
else if (pageSizeValue == 8)
{
paperPrice = paperPrice * 2;
}
else if (pageSizeValue == 6 || pageSizeValue == 4)
{
paperPrice = paperPrice * 4;
}
else if (pageSizeValue == 3 || pageSizeValue == 2)
{
paperPrice = paperPrice * 8;
}
else if (pageSizeValue == 1)
{
paperPrice = paperPrice * 12;
}
//获取16开500张的价格
decimal tempPaperPrice = _dMFastCostBLL.GetDMFastPrice(gramWeight, singleOrdouble, 500, inquiryId);
if (paperPrice < tempPaperPrice)
{
paperPrice = tempPaperPrice;
}
return paperPrice;
}
///
/// 获取印工费和版费(2开双面机、双色机)
///
///
///
///
///
///
///
public decimal GetImpressionPrice(int driveNumber, int printcount, int printTypeId, Guid inquiryId, ref decimal versionCost, InquiryDetail detail, decimal fastValue, Guid firmId, Guid customerId)
{
decimal impressPrice = 0;
int equipmentId = 0;
int impressionCount = InquiryHelpBLL.GetImpressionCount4(driveNumber, printcount, printTypeId, ref equipmentId);
impressionCount = GetRealImpressionCount(impressionCount, 5001, firmId, customerId);
PrintingWorksBLL _printingWorksBLL = new PrintingWorksBLL();
Inquiry_PrintingWorks printWork = _printingWorksBLL.GetModel2(impressionCount, equipmentId, inquiryId);
if (printWork != null)
{
impressPrice = printWork.WorkPrice;
if (impressionCount > 5000)
{
impressPrice = ((impressionCount.ToDouble2().Value / 1000).ToDecimal2().Value) * impressPrice;
}
//if (impressPrice < printWork.StartPrice.Value)
//{
// impressPrice = printWork.StartPrice.Value;
//}
versionCost = printWork.VersionCost;
}
impressPrice = impressPrice * fastValue;
versionCost = versionCost * fastValue;
PrintingMachineBLL _printingMachineBLL = new PrintingMachineBLL();
SysInquiry_PrintingMachine machineModel = _printingMachineBLL.GetModelByKeyId(equipmentId);
detail.ImpressPriceStr += machineModel.MachineName + impressionCount.ToString() + "印次:" + impressPrice.ToString("0.00") + "元";
return impressPrice;
}
///
/// 获取印工费和版费(2开和4开单色机)
///
///
///
///
///
///
///
///
public decimal GetImpressionPrice(int driveNumber, string areaNumber, int printcount, int printTypeId, Guid inquiryId, ref decimal versionCost, InquiryDetail detail, decimal fastValue)
{
decimal impressPrice = 0;
int equipmentId = 0;
int impressionCount = InquiryHelpBLL.GetImpressionCount3(driveNumber, areaNumber, printcount, printTypeId, ref equipmentId);
PrintingWorksBLL _printingWorksBLL = new PrintingWorksBLL();
Inquiry_PrintingWorks printWork = _printingWorksBLL.GetModel(equipmentId, inquiryId);
if (printWork != null)
{
impressPrice = (impressionCount.ToDouble2().Value / 1000).ToDecimal2().Value * printWork.WorkPrice;
if (impressPrice < printWork.StartPrice.Value)
impressPrice = printWork.StartPrice.Value;
versionCost = printWork.VersionCost;
}
impressPrice = impressPrice * fastValue;
versionCost = versionCost * fastValue;
PrintingMachineBLL _printingMachineBLL = new PrintingMachineBLL();
SysInquiry_PrintingMachine machineModel = _printingMachineBLL.GetModelByKeyId(equipmentId);
detail.ImpressPriceStr = machineModel.MachineName + impressionCount.ToString() + "印次:" + impressPrice.ToString("0.00") + "元";
return impressPrice;
}
///
/// 获取印工费和版费(2开和8开单色机)
///
///
///
///
///
///
///
///
public decimal GetImpressionPrice(int driveNumber, string areaNumber, int printcount, int printTypeId, string printColor, Guid inquiryId, ref decimal versionCost, InquiryDetail detail, decimal fastValue)
{
decimal impressPrice = 0;
int equipmentId = 0;
int impressionCount = InquiryHelpBLL.GetImpressionCount2(driveNumber, areaNumber, printcount, printTypeId, ref equipmentId);
PrintingWorksBLL _printingWorksBLL = new PrintingWorksBLL();
Inquiry_PrintingWorks printWork = _printingWorksBLL.GetModel(equipmentId, inquiryId);
if (printWork != null)
{
impressPrice = (impressionCount.ToDouble2().Value / 1000).ToDecimal2().Value * printWork.WorkPrice;
if (impressPrice < printWork.StartPrice.Value)
impressPrice = printWork.StartPrice.Value;
versionCost = printWork.VersionCost;
}
if (printColor == "双色")
{
impressPrice = impressPrice * 2;
versionCost = versionCost * 2;
}
else if (printColor == "三色")
{
impressPrice = impressPrice * 3;
versionCost = versionCost * 3;
}
impressPrice = impressPrice * fastValue;
versionCost = versionCost * fastValue;
PrintingMachineBLL _printingMachineBLL = new PrintingMachineBLL();
SysInquiry_PrintingMachine machineModel = _printingMachineBLL.GetModelByKeyId(equipmentId);
detail.ImpressPriceStr = machineModel.MachineName + impressionCount.ToString() + "印次:" + impressPrice.ToString("0.00") + "元";
return impressPrice;
}
///
/// 获取印工费和版费(2开机和4开机)
///
///
///
///
///
///
///
///
public decimal GetImpressionPrice(InquiryCommonModel model, string sizeName, int driveNumber, string areaNumber, int printcount, int printTypeId, bool isLeMouth, Guid inquiryId, ref decimal versionCost, InquiryDetail detail, decimal fastValue, Guid firmId, Guid customerId)
{
decimal impressPrice = 0;
int equipmentId = 0;
int impressionCount = InquiryHelpBLL.GetImpressionCount(sizeName, driveNumber, areaNumber, printcount, printTypeId, isLeMouth, ref equipmentId);
impressionCount = GetRealImpressionCount(impressionCount, 10001, firmId, customerId);
decimal addimpressionCount = 0;
PrintingWorksBLL _printingWorksBLL = new PrintingWorksBLL();
Inquiry_PrintingWorks printWork = _printingWorksBLL.GetModel(impressionCount, equipmentId, inquiryId);
if (printWork != null)
{
impressPrice = printWork.WorkPrice;
if (impressionCount > 10000)
{
//addimpressionCount = impressionCount - 10000;
//if (printWork.AddPrintCount.HasValue && printWork.AddPrintCount.Value > 0)
//{
// double f = (addimpressionCount.ToDouble2().Value / (1000).ToDouble2().Value / (printWork.AddPrintCount.Value).ToDouble2().Value);
// addimpressionCount = f.ToString("0.0").ToDecimal2().Value;
// impressPrice += addimpressionCount * printWork.AddPrice.Value;
//}
impressPrice = ((impressionCount.ToDouble2().Value / 1000).ToDecimal2().Value) * impressPrice;
impressPrice = impressPrice * 4;
}
versionCost = printWork.VersionCost;
}
impressPrice = impressPrice * fastValue;
versionCost = versionCost * fastValue;
PrintingMachineBLL _printingMachineBLL = new PrintingMachineBLL();
SysInquiry_PrintingMachine machineModel = _printingMachineBLL.GetModelByKeyId(equipmentId);
if (driveNumber == 1)
{
if (areaNumber == "双面")
{
impressPrice = impressPrice * 2;
versionCost = versionCost * 2;
}
detail.ImpressPriceStr = impressionCount.ToString() + "印次:" + impressPrice.ToString("0.00") + "元";
}
else
{
if (driveNumber == 2 || driveNumber == 3)
{
if (areaNumber == "双面")
{
impressPrice = impressPrice * 2;
versionCost = versionCost * 2;
}
}
detail.ImpressPriceStr += machineModel.MachineName + impressionCount.ToString() + "印次:" + impressPrice.ToString("0.00") + "元";
}
model.EquipmentId = equipmentId;
return impressPrice;
}
///
/// 计算内页后道
///
///
///
///
///
///
///
public decimal GetAfterWorkListPriceByLY(InquiryCommonModel model, Guid inquiryId, SysInquiry_PaperSizeDetail paperSize, ref string afterWorkListStr, decimal fastValue)
{
decimal afterWorksPrice = 0;
decimal price = 0;
decimal bingPrice = 0;
IList tempList = model.InquiryInsideList.Where(p => p.AfterWorkList.Count > 0).ToList();
if (tempList != null && tempList.Count > 0)
{
afterWorkListStr += "内页后道:";
}
foreach (InquiryInsideModel insideModel in model.InquiryInsideList)
{
if (insideModel.AfterWorkList != null && insideModel.AfterWorkList.Count > 0)
{
afterWorkListStr += "内页" + insideModel.InsideIndex.ToString() + ":";
foreach (int workId in insideModel.AfterWorkList)
{
switch ((Inquiry_AfterWork)workId)
{
case Inquiry_AfterWork.Oil:
price = GetOilPriceByLY(model, insideModel, inquiryId, paperSize);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "过油:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.Polish:
price = GetPolishPriceByLY(model, insideModel, inquiryId, paperSize);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "上光:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.GoldStamp:
price = GetPriceByGoldStampOrUVBYLY(model.PrintCount, model.PrintTypeId, inquiryId, workId, insideModel.TJWith, insideModel.TJHight, insideModel.TJNum);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "烫金:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.UV:
price = GetPriceByGoldStampOrUVBYLY(model.PrintCount, model.PrintTypeId, inquiryId, workId, insideModel.UVWith, insideModel.UVHight, insideModel.UVNum);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "UV:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.LY:
price = GetLYPrice(model.PrintCount, model.PrintTypeId, inquiryId, workId, insideModel);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "UV:" + price.ToString("0.00") + ",";
break;
}
}
if (afterWorkListStr.EndsWith(","))
{
afterWorkListStr = afterWorkListStr.Substring(0, afterWorkListStr.Length - 1);
}
afterWorkListStr += ";";
}
bingPrice += GetBindingPrice(model, insideModel, paperSize, inquiryId);
}
if (model.BindingMode == 17)
{
bingPrice += GetHardcoverBindingCost(model, paperSize, inquiryId);
}
bingPrice = bingPrice * fastValue;
afterWorkListStr += "装订:" + bingPrice.ToString("0.00") + ",";
afterWorksPrice += bingPrice;
if (afterWorkListStr != string.Empty)
afterWorkListStr += "合计:" + afterWorksPrice.ToString("0.00") + "元";
return afterWorksPrice;
}
///
/// 获取精装封面的价格
///
///
///
///
///
public decimal GetHardcoverBindingCost(InquiryCommonModel model, SysInquiry_PaperSizeDetail paperSize, Guid inquiryId)
{
decimal price = 0;
HardcoverBindingBLL _hardcoverBindingBLL = new HardcoverBindingBLL();
Inquiry_HardcoverBinding hardcoverBinding = _hardcoverBindingBLL.GetModel(inquiryId, model.PrintTypeId, paperSize.PageSizeId.Value);
if (hardcoverBinding != null)
{
price = hardcoverBinding.Price * model.PrintCount;
if (price < hardcoverBinding.StartPrice)
price = hardcoverBinding.StartPrice;
}
return price;
}
///
/// 获取内页装订价格
///
///
public decimal GetBindingPrice(InquiryCommonModel model, InquiryInsideModel insideModel, SysInquiry_PaperSizeDetail paperSize, Guid inquiryId)
{
decimal price = 0;
int pageNum = GetRealPageNum(insideModel.PageNum, insideModel.PaperId, model.BindingMode);
Inquiry_MultipleAfterCost mModel = null;
int num = 0;
bool IsCan = IsCanMerge(model);
if (IsCan && model.AfterWorkList.Count > 0)
{
if (insideModel.InsideIndex == 1)
{
pageNum -= 4;
}
}
if (paperSize.Value.Value == 64)
{
num = (pageNum.ToDouble2().Value / 64 * 4).ToDecimal2().Value.JRoundInt();
}
else if (paperSize.Value.Value == 32)
{
num = (pageNum.ToDouble2().Value / 32 * 2).ToDecimal2().Value.JRoundInt();
}
else if (paperSize.Value.Value == 24)
{
num = (pageNum.ToDouble2().Value / 24 * 2).ToDecimal2().Value.JRoundInt();
}
else if (paperSize.Value.Value == 16)
{
num = (pageNum.ToDouble2().Value / 16).ToDecimal2().Value.JRoundInt();
}
else if (paperSize.Value.Value == 12)
{
num = (pageNum.ToDouble2().Value / 12).ToDecimal2().Value.JRoundInt();
}
else if (paperSize.Value.Value == 8)
{
num = (pageNum.ToDouble2().Value / 8).ToDecimal2().Value.JRoundInt();
}
if (model.BindingMode != 17)
{
if (model.BindingMode == 14 || model.BindingMode == 16)
{
mModel = GetMultipleAfterCost(inquiryId, model.PrintTypeId, model.BindingMode);
}
else if (model.BindingMode == 15)
{
if (insideModel.PaperId == 3)
{
mModel = GetMultipleAfterCost(inquiryId, model.PrintTypeId, 48);
}
else
{
mModel = GetMultipleAfterCost(inquiryId, model.PrintTypeId, model.BindingMode);
}
}
if (insideModel.GramWeight >= 200)
{
num = num * 2;
}
if (IsCan && model.AfterWorkList.Count > 0)
{
}
else
{
num = num + 1;
}
}
else if (model.BindingMode == 17)
{
mModel = GetMultipleAfterCost(inquiryId, model.PrintTypeId, 16);
if (insideModel.GramWeight >= 200)
{
num = num * 2;
}
}
price = num * mModel.Price * model.PrintCount;
if (price < mModel.TotalStartPrice)
{
price = mModel.TotalStartPrice;
}
return price;
}
///
/// 获取内页拉页的价格
///
///
///
///
///
///
///
public decimal GetLYPrice(int printCount, int printingTyId, Guid inquiryId, int afterParameterId, InquiryInsideModel insideModel)
{
decimal price = 0;
Inquiry_MultipleAfterCost model = GetMultipleAfterCost(inquiryId, printingTyId, afterParameterId);
if (model != null)
{
price = model.Price * printCount * insideModel.LYNum;
if (price < model.TotalStartPrice)
price = model.TotalStartPrice;
}
return price;
}
///
/// 获取烫金,烫银或者UV,凹凸的价格(内页)
///
///
///
///
///
///
///
public decimal GetPriceByGoldStampOrUVBYLY(int printCount, int printingTyId, Guid inquiryId, int afterParameterId, decimal with, decimal hight, int num)
{
decimal price = 0;
Inquiry_MultipleAfterCost model = GetMultipleAfterCost(inquiryId, printingTyId, afterParameterId);
if (model != null)
{
if (with != 0 && hight != 0)
{
price = (with * hight) * model.Price;
if (model.StartPriceBySingle.HasValue)
{
if (price < model.StartPriceBySingle)
price = model.StartPriceBySingle.Value;
}
price = price * printCount * num;
if (price < model.TotalStartPrice)
price = model.TotalStartPrice;
if (afterParameterId == 11)
{
if (model.PlatemakPrice.HasValue)
price += model.PlatemakPrice.Value * num;
}
else
{
decimal platemarkPrice = 0;
if (model.PlatemakPrice.HasValue)
platemarkPrice = (with * hight) * model.PlatemakPrice.Value;
if (model.StartPlatemakPrice.HasValue)
{
if (platemarkPrice < model.StartPlatemakPrice)
platemarkPrice = model.StartPlatemakPrice.Value;
}
platemarkPrice = platemarkPrice * num;
price += platemarkPrice;
}
}
}
return price;
}
///
/// 获取内页过油费价格
///
///
///
///
///
public decimal GetOilPriceByLY(InquiryCommonModel model, InquiryInsideModel insideModel, Guid inquiryId, SysInquiry_PaperSizeDetail paperSize)
{
decimal price = 0;
OilCostBLL oilCostBLL = new OilCostBLL();
Inquiry_OilCost oilModel = null;
int realPageNum = GetRealPageNum(insideModel.PageNum, insideModel.PaperId, model.BindingMode);
bool isNeed4 = false;
int num = GetNumByLY(insideModel.PaperId, realPageNum, paperSize.Value.Value, ref isNeed4);
if (num != 0)
{
oilModel = oilCostBLL.GetModel(inquiryId, model.PrintTypeId, 2);
price = num * model.PrintCount * oilModel.Price;
if (price < oilModel.StartPrice)
price = oilModel.StartPrice;
}
decimal tempPrice = 0;
if (isNeed4)
{
oilModel = oilCostBLL.GetModel(inquiryId, model.PrintTypeId, 5);
tempPrice = model.PrintCount * oilModel.Price;
if (tempPrice < oilModel.StartPrice)
tempPrice = oilModel.StartPrice;
}
price = price + tempPrice;
return price;
}
///
/// 获取内页上光费价格
///
///
///
///
///
public decimal GetPolishPriceByLY(InquiryCommonModel model, InquiryInsideModel insideModel, Guid inquiryId, SysInquiry_PaperSizeDetail paperSize)
{
decimal price = 0;
PolishCostBLL polishCostBLL = new PolishCostBLL();
Inquiry_PolishCost polishModel = null;
bool isNeed4 = false;
int realPageNum = GetRealPageNum(insideModel.PageNum, insideModel.PaperId, model.BindingMode);
int num = GetNumByLY(insideModel.PaperId, realPageNum, paperSize.Value.Value, ref isNeed4);
if (num != 0)
{
polishModel = polishCostBLL.GetModel(inquiryId, model.PrintTypeId, 2);
price = num * model.PrintCount * polishModel.Price;
if (price < polishModel.StartPrice)
price = polishModel.StartPrice;
}
decimal tempPrice = 0;
if (isNeed4)
{
polishModel = polishCostBLL.GetModel(inquiryId, model.PrintTypeId, 5);
tempPrice = model.PrintCount * polishModel.Price;
if (tempPrice < polishModel.StartPrice)
tempPrice = polishModel.StartPrice;
}
price = price + tempPrice;
return price;
}
///
/// 计算后工序费用
///
///
public decimal GetAfterWorkListPrice(InquiryCommonModel model, Guid inquiryId, SysInquiry_PaperSizeDetail paperSize, ref string afterWorkListStr, decimal fastValue)
{
decimal afterWorksPrice = 0;
decimal price = 0;
if (model.PrintTypeId == 15 || model.PrintTypeId == 6)
{
afterWorkListStr += "封面后道:";
}
if (model.PrintTypeId == 23)
{
afterWorkListStr += "装订工艺:";
}
if (model.AfterWorkList != null && model.AfterWorkList.Count > 0)
{
if (model.PrintTypeId == 25)
{
afterWorkListStr += "封面工艺:";
}
foreach (int workId in model.AfterWorkList)
{
switch ((Inquiry_AfterWork)workId)
{
case Inquiry_AfterWork.Fold:
price = GetMultipleAfterPrice(model.PrintCount, model.PrintTypeId, inquiryId, workId);
if (model.PrintTypeId == 7)
{
int num = model.PageNum / 4;
price = price * num;
}
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "折页:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.GoldStamp:
price = GetPriceByGoldStampOrUV(model.PrintCount, model.PrintTypeId, inquiryId, workId, model.TJWith, model.TJHight);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "烫金:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.UV:
price = GetPriceByGoldStampOrUV(model.PrintCount, model.PrintTypeId, inquiryId, workId, model.UVWith, model.UVHight);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "UV:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.DottedLine:
price = GetDottedLinePrice(model.PrintMode, model.PrintCount, model.PrintTypeId, paperSize.Value.Value, paperSize.PageSizeId.Value, inquiryId);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "打点线:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.Cutting:
price = GetCuttingPrice(model.PrintMode, model.PrintCount, model.PrintTypeId, paperSize.Value.Value, paperSize.PageSizeId, paperSize.KeyId, model.PrintTypeId, inquiryId);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "模切:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.Emboss:
price = GetEmbossedPrice(model.PrintMode, model.PrintCount, model.PrintTypeId, paperSize.Value.Value, paperSize.PageSizeId.Value, inquiryId);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "压纹:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.Indentation:
price = GetIndentationPrice(model.PrintMode, model.PrintCount, model.PrintTypeId, paperSize.Value.Value, paperSize.PageSizeId.Value, inquiryId);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "压痕:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.DumbFilmBySingle:
price = GetCoveredPriceBySingle(model.PrintMode, model.PrintCount, model.PrintTypeId, paperSize.Value.Value, paperSize.Name, paperSize.PageSizeId.Value, workId, inquiryId);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "单面覆哑膜:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.DumbFilmByDouble:
price = GetCoveredPriceByDouble(model.PrintMode, model.PrintCount, model.PrintTypeId, paperSize.Value.Value, paperSize.Name, paperSize.PageSizeId.Value, workId, inquiryId);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "双面覆哑膜:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.OpticalFilmBySingle:
price = GetCoveredPriceBySingle(model.PrintMode, model.PrintCount, model.PrintTypeId, paperSize.Value.Value, paperSize.Name, paperSize.PageSizeId.Value, workId, inquiryId);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "单面覆光膜:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.OpticalFilmByDouble:
price = GetCoveredPriceByDouble(model.PrintMode, model.PrintCount, model.PrintTypeId, paperSize.Value.Value, paperSize.Name, paperSize.PageSizeId.Value, workId, inquiryId);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "双面覆光膜:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.SetNumber:
price = GetSetNumberPrice(model.PrintCount, model.PrintTypeId, inquiryId);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "套号:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.Shock:
price = GetPriceByGoldStampOrUV(model.PrintCount, model.PrintTypeId, inquiryId, workId, model.ATWith, model.ATHight);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "击凹凸:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.RubberHead:
if (model.PrintTypeId != 27)
{
price = GetRubberHead(model.PrintCount, model.PageNum, model.PrintTypeId, inquiryId);
}
else
{
price = GetRubberHeadByRep(model, paperSize, inquiryId);
}
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "胶头:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.Binding:
price = GetBinding(model.PrintCount, model.PageNum, model.PrintTypeId, inquiryId);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "装订:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.Oil:
price = GetOilPrice(model, inquiryId, paperSize);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "过油:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.Polish:
price = GetPolishPrice(model, inquiryId, paperSize);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "上光:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.AddRivet:
price = GetMultipleAfterPrice(model.PrintCount, model.PrintTypeId, inquiryId, 45);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "加柳钉:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.StickyHandbag:
price = GetStickyHandbag(model.PrintTypeId, paperSize.PageSizeId.Value, model.PrintCount, inquiryId);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "粘手提袋:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.StickEnvelope:
price = GetStickEnvelopePrice(model.PrintTypeId, paperSize.KeyId, model.PrintCount, workId, inquiryId);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "粘信封:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.StickPvc:
price = GetStickEnvelopePrice(model.PrintTypeId, paperSize.KeyId, model.PrintCount, workId, inquiryId);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "开天窗:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.StickSelf:
price = GetStickEnvelopePrice(model.PrintTypeId, paperSize.KeyId, model.PrintCount, workId, inquiryId);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "带自粘:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.LF:
if (model.LaFeng == "封面封底均拉封")
{
price = GetLF(model, inquiryId, 52);
}
else if (model.LaFeng == "封面拉封")
{
price = GetLF(model, inquiryId, 50);
}
else
{
price = GetLF(model, inquiryId, 51);
}
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "拉封:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.LK:
price = GetLK(model, inquiryId);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "勒口:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.TQ:
price = GetBindingProcessCost(model.PageNum, workId, paperSize.KeyId, inquiryId, model.PrintTypeId, model.PrintCount);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "铁圈:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.YTP:
price = GetBindingProcessCost(model.PageNum, workId, paperSize.KeyId, inquiryId, model.PrintTypeId, model.PrintCount);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "压铁片:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.FMYH:
price = GetMultipleAfterPrice(model.PrintCount, model.PrintTypeId, inquiryId, workId);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "封面压纹:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.FMLM:
price = GetMultipleAfterPrice(model.PrintCount, model.PrintTypeId, inquiryId, workId);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "封面亮膜:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.FMYM:
price = GetMultipleAfterPrice(model.PrintCount, model.PrintTypeId, inquiryId, workId);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "封面哑膜:" + price.ToString("0.00") + ",";
break;
}
}
}
if (model.PrintTypeId == 25)
{
if (afterWorkListStr.EndsWith(","))
{
afterWorkListStr = afterWorkListStr.Substring(0, afterWorkListStr.Length - 1);
}
InquiryInsideModel insideModel = model.InquiryInsideList[0];
if (insideModel.AfterWorkList != null && insideModel.AfterWorkList.Count > 0)
{
if (afterWorkListStr != "")
{
afterWorkListStr += ";";
}
afterWorkListStr += "底座工艺:";
foreach (int workId in insideModel.AfterWorkList)
{
switch ((Inquiry_AfterWork)workId)
{
case Inquiry_AfterWork.GoldStamp:
price = GetPriceByGoldStampOrUV(model.PrintCount, model.PrintTypeId, inquiryId, workId, insideModel.TJWith, insideModel.TJHight);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "烫金:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.UV:
price = GetPriceByGoldStampOrUV(model.PrintCount, model.PrintTypeId, inquiryId, workId, insideModel.UVWith, insideModel.UVHight);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "UV:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.DZYH:
price = GetMultipleAfterPrice(model.PrintCount, model.PrintTypeId, inquiryId, workId);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "底座压纹:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.DZLM:
price = GetMultipleAfterPrice(model.PrintCount, model.PrintTypeId, inquiryId, workId);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "底座亮膜:" + price.ToString("0.00") + ",";
break;
case Inquiry_AfterWork.DZYM:
price = GetMultipleAfterPrice(model.PrintCount, model.PrintTypeId, inquiryId, workId);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "底座哑膜:" + price.ToString("0.00") + ",";
break;
}
}
}
if (afterWorkListStr.EndsWith(","))
{
afterWorkListStr = afterWorkListStr.Substring(0, afterWorkListStr.Length - 1);
}
price = GetDeskCalendarBindingFee(model, inquiryId, paperSize);
price = price * fastValue;
afterWorksPrice += price;
if (afterWorkListStr != "")
afterWorkListStr += ";";
afterWorkListStr += "装订费:" + price.ToString("0.00") + ",";
}
if (model.PrintTypeId == 15 || model.PrintTypeId == 6)
{
if (model.GramWeight >= 300)
{
price = GetFMYH(model, inquiryId);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "封面压痕:" + price.ToString("0.00") + ",";
}
}
if (model.PrintTypeId == 16)
{
price = GetRopePrice(model.RopeTypeId, model.PrintTypeId, model.PrintCount, inquiryId);
price = price * fastValue;
afterWorksPrice += price;
afterWorkListStr += "绳子:" + price.ToString("0.00") + ",";
}
if (model.PrintTypeId == 27)
{
if (model.FrontType != "无封面")
{
price = GetFrontPrice(model, paperSize, inquiryId, null, fastValue);
afterWorksPrice += price;
afterWorkListStr += "封面费:" + price.ToString("0.00") + ",";
}
}
afterWorkListStr += "合计:" + afterWorksPrice.ToString("0.00") + "元;";
return afterWorksPrice;
}
///
/// 获取台历装订费
///
///
///
///
///
public decimal GetDeskCalendarBindingFee(InquiryCommonModel model, Guid inquiryId, SysInquiry_PaperSizeDetail paperSize)
{
decimal price = 0;
DeskCalendarBindingFeeBLL bindBll = new DeskCalendarBindingFeeBLL();
Inquiry_DeskCalendarBindingFee bindModel = bindBll.GetModel(model.PageNum, paperSize.Value.Value, inquiryId, model.PrintTypeId);
if (bindModel != null)
{
price = bindModel.Price * model.PrintCount;
if (price < bindModel.StartPrice)
{
price = bindModel.StartPrice;
}
}
return price;
}
public decimal GetBindingProcessCost(int pageNum, int workId, int sizeKeyId, Guid inquiryId, int printingTyId, int printCount)
{
decimal price = 0;
BindingProcessCostBLL _bindingProcessCostBLL = new BindingProcessCostBLL();
Inquiry_BindingProcessCost bindingProcessCost = _bindingProcessCostBLL.GetModel(pageNum, workId, sizeKeyId, inquiryId, printingTyId);
if (bindingProcessCost != null)
{
if (bindingProcessCost.Price.HasValue)
price = bindingProcessCost.Price.Value * printCount;
}
return price;
}
///
/// 获取封面勒口的价格
///
///
///
///
public decimal GetLK(InquiryCommonModel model, Guid inquiryId)
{
decimal price = 0;
Inquiry_MultipleAfterCost mModel = GetMultipleAfterCost(inquiryId, model.PrintTypeId, 18);
if (mModel != null)
{
price = model.PrintCount * mModel.Price;
if (price < mModel.TotalStartPrice)
price = mModel.TotalStartPrice;
}
return price;
}
///
/// 获取拉封价格
///
///
///
///
///
public decimal GetLF(InquiryCommonModel model, Guid inquiryId, int workId)
{
decimal price = 0;
Inquiry_MultipleAfterCost mModel = GetMultipleAfterCost(inquiryId, model.PrintTypeId, workId);
if (mModel != null)
{
price = model.PrintCount * mModel.Price;
if (price < mModel.TotalStartPrice)
price = mModel.TotalStartPrice;
}
return price;
}
///
/// 获取封面压痕的价格
///
///
///
///
public decimal GetFMYH(InquiryCommonModel model, Guid inquiryId)
{
decimal price = 0;
Inquiry_MultipleAfterCost mModel = GetMultipleAfterCost(inquiryId, model.PrintTypeId, 49);
if (mModel != null)
{
price = model.PrintCount * mModel.Price;
if (price < mModel.TotalStartPrice)
price = mModel.TotalStartPrice;
}
return price;
}
///
/// 获取封面过油费价格
///
///
///
///
///
public decimal GetOilPrice(InquiryCommonModel model, Guid inquiryId, SysInquiry_PaperSizeDetail paperSize)
{
decimal price = 0;
OilCostBLL oilCostBLL = new OilCostBLL();
Inquiry_OilCost oilModel = null;
int i = 0;
if (model.EquipmentId == 1)
{
i = 2;
oilModel = oilCostBLL.GetModel(inquiryId, model.PrintTypeId, 2);
}
else
{
i = 4;
oilModel = oilCostBLL.GetModel(inquiryId, model.PrintTypeId, 5);
}
price = (i / paperSize.Value.Value.ToDouble2().Value).ToDecimal2().Value * oilModel.Price * model.PrintCount;
if (price < oilModel.StartPrice)
{
price = oilModel.StartPrice;
}
return price;
}
///
/// 获取封面上光费价格
///
///
///
///
///
public decimal GetPolishPrice(InquiryCommonModel model, Guid inquiryId, SysInquiry_PaperSizeDetail paperSize)
{
decimal price = 0;
PolishCostBLL polishCostBLL = new PolishCostBLL();
Inquiry_PolishCost polishModel = null;
int i = 0;
if (model.EquipmentId == 1)
{
i = 2;
polishModel = polishCostBLL.GetModel(inquiryId, model.PrintTypeId, 2);
}
else
{
i = 4;
polishModel = polishCostBLL.GetModel(inquiryId, model.PrintTypeId, 5);
}
price = (i / paperSize.Value.Value.ToDouble2().Value).ToDecimal2().Value * polishModel.Price * model.PrintCount;
if (price < polishModel.StartPrice)
{
price = polishModel.StartPrice;
}
return price;
}
///
/// 获取粘信封,开天窗(贴pvc),带自粘的价格
///
///
///
///
///
///
///
public decimal GetStickEnvelopePrice(int printingTyId, int envelopeModeTypeId, int printCount, int afterParameterId, Guid inquiryId)
{
StickEnvelopeCostBLL _stickEnvelopeCostBLL = new StickEnvelopeCostBLL();
return _stickEnvelopeCostBLL.GetStickEnvelopePrice(printingTyId, envelopeModeTypeId, printCount, afterParameterId, inquiryId);
}
///
/// 获取绳子费价格
///
///
///
///
///
public decimal GetRopePrice(int ropeTypeId, int printingTyId, int printCount, Guid inquiryId)
{
RopeCostBLL _ropeCostBLL = new RopeCostBLL();
return _ropeCostBLL.GetRopePrice(ropeTypeId, printingTyId, printCount, inquiryId);
}
///
/// 获取粘手提袋费
///
///
public decimal GetStickyHandbag(int printingTyId, int pageSizeValue, int printCount, Guid inquiryId)
{
StickyHandBagCostBLL _stickyHandBagCostBLL = new StickyHandBagCostBLL();
return _stickyHandBagCostBLL.GetStickyHandBagPrice(printingTyId, pageSizeValue, printCount, inquiryId);
}
///
/// 获取装订的价格
///
///
///
///
///
public decimal GetBinding(int printCount, int pageNum, int printTypeId, Guid inquiryId)
{
decimal price = 0;
int bNum = printCount;
Inquiry_MultipleAfterCost model = GetMultipleAfterCost(inquiryId, printTypeId, 44);
if (model != null)
{
price = bNum.ToDecimal2().Value * model.Price;
if (price < model.TotalStartPrice)
price = model.TotalStartPrice;
}
return price;
}
///
/// 获取胶头的价格
///
///
///
///
///
///
public decimal GetRubberHead(int printCount, int pageNum, int printTypeId, Guid inquiryId)
{
decimal price = 0;
Inquiry_MultipleAfterCost model = GetMultipleAfterCost(inquiryId, printTypeId, 13);
int bNum = printCount / pageNum;
if (model != null)
{
price = bNum.ToDecimal2().Value * model.Price;
if (price < model.TotalStartPrice)
price = model.TotalStartPrice;
}
return price;
}
///
/// 获取胶头的价格(收据联单)
///
///
///
///
///
public decimal GetRubberHeadByRep(InquiryCommonModel model, SysInquiry_PaperSizeDetail paperSize, Guid inquiryId)
{
decimal price = 0;
decimal priceBysingle = 0;
RubberheadCostBLL _rubberheadCostBLL = new RubberheadCostBLL();
Inquiry_RubberheadCost rubModel = _rubberheadCostBLL.GetModel(model.PrintTypeId, paperSize.PageSizeId.Value, inquiryId);
if (rubModel != null)
{
priceBysingle = rubModel.Price;
price = priceBysingle * model.PrintCount;
if (price < rubModel.StartPrice)
{
price = rubModel.StartPrice;
}
}
return price;
}
///
/// 获取覆膜价格(单面)
///
///
///
///
///
///
///
public decimal GetCoveredPriceBySingle(int printModel, int printCount, int printingTyId, int pageSizeValue, string sizeName, int parentId, int coveredId, Guid inquiryId)
{
decimal price = 0;
if (coveredId == 26)
{
coveredId = 6;
}
else if (coveredId == 28)
{
coveredId = 5;
}
string sizeType = string.Empty;
if (parentId == 11) //小全开
{
sizeType = "正度";
}
else
{
if (sizeName.Contains("正"))
{
sizeType = "正度";
}
else
{
sizeType = "大度";
}
}
Inquiry_CoveredCost model = null;
if (printingTyId == 15 && printModel == 1)
{
model = GetCoveredModelByCommon(printingTyId, 6, sizeType, coveredId, inquiryId);
}
else
{
if (printModel == 1)
{
if (pageSizeValue == 64 || pageSizeValue == 48 || pageSizeValue == 32)
{
printCount = (printCount.ToDouble2().Value / (pageSizeValue / 16)).ToDecimal2().Value.JRoundInt();
model = GetCoveredModelByCommon(printingTyId, 1, sizeType, coveredId, inquiryId);
}
else if (pageSizeValue == 16)
{
if (printCount == 20000 || printCount == 100000)
{
model = GetCoveredModelByCommon(printingTyId, 6, sizeType, coveredId, inquiryId);
printCount = printCount / 2;
}
else
{
model = GetCoveredModelByCommon(printingTyId, 1, sizeType, coveredId, inquiryId);
}
}
else if (pageSizeValue == 8)
{
if (printCount == 20000 || printCount == 100000)
{
model = GetCoveredModelByCommon(printingTyId, 5, sizeType, coveredId, inquiryId);
printCount = printCount / 2;
}
else
{
model = GetCoveredModelByCommon(printingTyId, 6, sizeType, coveredId, inquiryId);
}
}
else if (pageSizeValue == 6)
{
if (printCount == 20000 || printCount == 100000)
{
model = GetCoveredModelByCommon(printingTyId, 4, sizeType, coveredId, inquiryId);
printCount = printCount / 2;
}
else
{
model = GetCoveredModelByCommon(printingTyId, 12, sizeType, coveredId, inquiryId);
}
}
else
{
model = GetCoveredModelByCommon(printingTyId, parentId, sizeType, coveredId, inquiryId);
}
}
else
{
if (pageSizeValue == 64)
{
if (printCount > 80000)
{
printCount = (printCount.ToDouble2().Value / 16).ToDecimal2().Value.JRoundInt();
model = GetCoveredModelByCommon(printingTyId, 5, sizeType, coveredId, inquiryId);
}
else if (printCount <= 10000)
{
printCount = (printCount.ToDouble2().Value / 4).ToDecimal2().Value.JRoundInt();
model = GetCoveredModelByCommon(printingTyId, 1, sizeType, coveredId, inquiryId);
}
else
{
printCount = (printCount.ToDouble2().Value / 8).ToDecimal2().Value.JRoundInt();
model = GetCoveredModelByCommon(printingTyId, 6, sizeType, coveredId, inquiryId);
}
}
else if (pageSizeValue == 48)
{
if (printCount > 30000)
{
printCount = (printCount.ToDouble2().Value / 12).ToDecimal2().Value.JRoundInt();
model = GetCoveredModelByCommon(printingTyId, 5, sizeType, coveredId, inquiryId);
}
else if (printCount <= 10000)
{
printCount = (printCount.ToDouble2().Value / 3).ToDecimal2().Value.JRoundInt();
model = GetCoveredModelByCommon(printingTyId, 1, sizeType, coveredId, inquiryId);
}
else
{
printCount = (printCount.ToDouble2().Value / 6).ToDecimal2().Value.JRoundInt();
model = GetCoveredModelByCommon(printingTyId, 6, sizeType, coveredId, inquiryId);
}
}
else if (pageSizeValue == 32)
{
if (printCount > 20000)
{
printCount = (printCount.ToDouble2().Value / 8).ToDecimal2().Value.JRoundInt();
model = GetCoveredModelByCommon(printingTyId, 5, sizeType, coveredId, inquiryId);
}
else if (printCount <= 5000)
{
printCount = (printCount.ToDouble2().Value / 2).ToDecimal2().Value.JRoundInt();
model = GetCoveredModelByCommon(printingTyId, 1, sizeType, coveredId, inquiryId);
}
else
{
printCount = (printCount.ToDouble2().Value / 4).ToDecimal2().Value.JRoundInt();
model = GetCoveredModelByCommon(printingTyId, 6, sizeType, coveredId, inquiryId);
}
}
else if (pageSizeValue == 16)
{
if (printCount > 5000)
{
printCount = (printCount.ToDouble2().Value / 4).ToDecimal2().Value.JRoundInt();
model = GetCoveredModelByCommon(printingTyId, 5, sizeType, coveredId, inquiryId);
}
else if (printCount <= 3000)
{
model = GetCoveredModelByCommon(printingTyId, 1, sizeType, coveredId, inquiryId);
}
else
{
printCount = (printCount.ToDouble2().Value / 2).ToDecimal2().Value.JRoundInt();
model = GetCoveredModelByCommon(printingTyId, 6, sizeType, coveredId, inquiryId);
}
}
else if (pageSizeValue == 8)
{
if (printCount > 5000)
{
printCount = (printCount.ToDouble2().Value / 2).ToDecimal2().Value.JRoundInt();
model = GetCoveredModelByCommon(printingTyId, 5, sizeType, coveredId, inquiryId);
}
else
{
model = GetCoveredModelByCommon(printingTyId, 6, sizeType, coveredId, inquiryId);
}
}
else if (pageSizeValue == 6)
{
if (printCount > 5000)
{
printCount = (printCount.ToDouble2().Value / 2).ToDecimal2().Value.JRoundInt();
model = GetCoveredModelByCommon(printingTyId, 4, sizeType, coveredId, inquiryId);
}
else
{
model = GetCoveredModelByCommon(printingTyId, 12, sizeType, coveredId, inquiryId);
}
}
else if (pageSizeValue == 4)
{
if (printCount > 5000)
{
printCount = (printCount.ToDouble2().Value / 2).ToDecimal2().Value.JRoundInt();
model = GetCoveredModelByCommon(printingTyId, 2, sizeType, coveredId, inquiryId);
}
else
{
model = GetCoveredModelByCommon(printingTyId, 5, sizeType, coveredId, inquiryId);
}
}
else
{
model = GetCoveredModelByCommon(printingTyId, parentId, sizeType, coveredId, inquiryId);
}
}
}
if (model != null)
{
price = model.Price * printCount;
if (price < model.StartPrice)
{
price = model.StartPrice;
}
}
return price;
}
///
/// 获取覆膜价格(双面)
///
///
///
///
///
///
///
public decimal GetCoveredPriceByDouble(int printModel, int printCount, int printingTyId, int pageSizeValue, string sizeName, int parentId, int coveredId, Guid inquiryId)
{
decimal price = 0;
if (coveredId == 27)
{
coveredId = 6;
}
else if (coveredId == 29)
{
coveredId = 5;
}
Inquiry_CoveredCost model = null;
string sizeType = string.Empty;
if (parentId == 11) //小全开
{
sizeType = "正度";
}
else
{
if (sizeName.Contains("正"))
{
sizeType = "正度";
}
else
{
sizeType = "大度";
}
}
if (printModel == 1)
{
if (pageSizeValue == 64 || pageSizeValue == 48 || pageSizeValue == 32)
{
printCount = (printCount / (pageSizeValue / 16));
model = GetCoveredModelByCommon(printingTyId, 6, sizeType, coveredId, inquiryId);
}
else if (pageSizeValue == 16)
{
model = GetCoveredModelByCommon(printingTyId, 6, sizeType, coveredId, inquiryId);
}
else if (pageSizeValue == 8)
{
if (printCount == 20000 || printCount == 100000)
{
model = GetCoveredModelByCommon(printingTyId, 2, sizeType, coveredId, inquiryId);
printCount = printCount / 2;
}
else
{
model = GetCoveredModelByCommon(printingTyId, 5, sizeType, coveredId, inquiryId);
}
}
else if (pageSizeValue == 6)
{
if (printCount == 20000 || printCount == 100000)
{
model = GetCoveredModelByCommon(printingTyId, 4, sizeType, coveredId, inquiryId);
printCount = printCount / 2;
}
else
{
model = GetCoveredModelByCommon(printingTyId, 12, sizeType, coveredId, inquiryId);
}
}
else if (pageSizeValue == 6)
{
model = GetCoveredModelByCommon(printingTyId, 2, sizeType, coveredId, inquiryId);
}
else
{
model = GetCoveredModelByCommon(printingTyId, parentId, sizeType, coveredId, inquiryId);
printCount = printCount * 2;
}
}
else
{
if (pageSizeValue == 64)
{
if (printCount > 80000)
{
printCount = (printCount.ToDouble2().Value / 16).ToDecimal2().Value.JRoundInt();
model = GetCoveredModelByCommon(printingTyId, 2, sizeType, coveredId, inquiryId);
}
else if (printCount <= 10000)
{
printCount = (printCount.ToDouble2().Value / 4).ToDecimal2().Value.JRoundInt();
model = GetCoveredModelByCommon(printingTyId, 6, sizeType, coveredId, inquiryId);
}
else
{
printCount = (printCount.ToDouble2().Value / 8).ToDecimal2().Value.JRoundInt();
model = GetCoveredModelByCommon(printingTyId, 5, sizeType, coveredId, inquiryId);
}
}
else if (pageSizeValue == 48)
{
if (printCount > 30000)
{
printCount = (printCount.ToDouble2().Value / 12).ToDecimal2().Value.JRoundInt();
model = GetCoveredModelByCommon(printingTyId, 2, sizeType, coveredId, inquiryId);
}
else if (printCount <= 10000)
{
printCount = (printCount.ToDouble2().Value / 3).ToDecimal2().Value.JRoundInt();
model = GetCoveredModelByCommon(printingTyId, 6, sizeType, coveredId, inquiryId);
}
else
{
printCount = (printCount.ToDouble2().Value / 6).ToDecimal2().Value.JRoundInt();
model = GetCoveredModelByCommon(printingTyId, 5, sizeType, coveredId, inquiryId);
}
}
else if (pageSizeValue == 32)
{
if (printCount > 20000)
{
printCount = (printCount.ToDouble2().Value / 8).ToDecimal2().Value.JRoundInt();
model = GetCoveredModelByCommon(printingTyId, 2, sizeType, coveredId, inquiryId);
}
else if (printCount <= 5000)
{
printCount = (printCount.ToDouble2().Value / 2).ToDecimal2().Value.JRoundInt();
model = GetCoveredModelByCommon(printingTyId, 6, sizeType, coveredId, inquiryId);
}
else
{
printCount = (printCount.ToDouble2().Value / 4).ToDecimal2().Value.JRoundInt();
model = GetCoveredModelByCommon(printingTyId, 5, sizeType, coveredId, inquiryId);
}
}
else if (pageSizeValue == 16)
{
if (printCount > 5000)
{
printCount = (printCount.ToDouble2().Value / 4).ToDecimal2().Value.JRoundInt();
model = GetCoveredModelByCommon(printingTyId, 2, sizeType, coveredId, inquiryId);
}
else if (printCount <= 3000)
{
model = GetCoveredModelByCommon(printingTyId, 6, sizeType, coveredId, inquiryId);
}
else
{
printCount = (printCount.ToDouble2().Value / 2).ToDecimal2().Value.JRoundInt();
model = GetCoveredModelByCommon(printingTyId, 5, sizeType, coveredId, inquiryId);
}
}
else if (pageSizeValue == 8)
{
if (printCount > 5000)
{
printCount = (printCount.ToDouble2().Value / 2).ToDecimal2().Value.JRoundInt();
model = GetCoveredModelByCommon(printingTyId, 2, sizeType, coveredId, inquiryId);
}
else
{
model = GetCoveredModelByCommon(printingTyId, 5, sizeType, coveredId, inquiryId);
}
}
else if (pageSizeValue == 6)
{
model = GetCoveredModelByCommon(printingTyId, 4, sizeType, coveredId, inquiryId);
}
else if (pageSizeValue == 4)
{
model = GetCoveredModelByCommon(printingTyId, 2, sizeType, coveredId, inquiryId);
}
else
{
printCount = printCount * 2;
model = GetCoveredModelByCommon(printingTyId, parentId, sizeType, coveredId, inquiryId);
}
}
if (model != null)
{
price = model.Price * printCount;
if (price < model.StartPrice)
{
price = model.StartPrice;
}
}
return price;
}
///
/// 获取公共的覆膜实体
///
///
///
///
///
///
private Inquiry_CoveredCost GetCoveredModelByCommon(int printingTyId, int pageSizeId, string sizeType, int coveredId, Guid inquiryId)
{
CoveredCostBLL _coveredCostBLL = new CoveredCostBLL();
Inquiry_CoveredCost model = _coveredCostBLL.GetModel(printingTyId, pageSizeId, sizeType, coveredId, inquiryId);
return model;
}
///
/// 获取打点线价格
///
///
///
///
///
public decimal GetDottedLinePrice(int printModel, int printCount, int printingTyId, int pageSizeValue, int parentId, Guid inquiryId)
{
decimal price = 0;
DottedLineCostBLL _dottedLineCostBLL = new DottedLineCostBLL();
//if (pageSizeValue >= 2 && pageSizeValue <= 16)
//{
// price= _dottedLineCostBLL.GetDottedLinePrice(printingTyId, parentId, printCount, inquiryId);
//}
//else if (pageSizeValue > 16)
//{
// price = ((16).ToDouble2().Value / pageSizeValue.ToDouble2().Value).ToDecimal2().Value * _dottedLineCostBLL.GetDottedLinePrice(printingTyId, 1, printCount, inquiryId);
//}
Inquiry_DottedLineCost model = null;
if (printModel == 1)
{
if (pageSizeValue == 64 || pageSizeValue == 48 || pageSizeValue == 32)
{
printCount = (printCount / (pageSizeValue / 16));
model = _dottedLineCostBLL.GetModel(printingTyId, 1, inquiryId);
}
else if (pageSizeValue == 16)
{
if (printCount == 20000 || printCount == 100000)
{
printCount = printCount / 2;
model = _dottedLineCostBLL.GetModel(printingTyId, 6, inquiryId);
}
else
{
model = _dottedLineCostBLL.GetModel(printingTyId, 1, inquiryId);
}
}
else if (pageSizeValue == 6 || pageSizeValue == 8)
{
if (printCount == 20000 || printCount == 100000)
{
printCount = printCount / 2;
model = _dottedLineCostBLL.GetModel(printingTyId, 5, inquiryId);
}
else
{
model = _dottedLineCostBLL.GetModel(printingTyId, 6, inquiryId);
}
}
else
{
model = _dottedLineCostBLL.GetModel(printingTyId, parentId, inquiryId);
}
}
else
{
if (pageSizeValue == 64)
{
if (printCount > 80000)
{
printCount = (printCount.ToDouble2().Value / 16).ToDecimal2().Value.JRoundInt();
model = _dottedLineCostBLL.GetModel(printingTyId, 5, inquiryId);
}
else if (printCount <= 10000)
{
printCount = (printCount.ToDouble2().Value / 4).ToDecimal2().Value.JRoundInt();
model = _dottedLineCostBLL.GetModel(printingTyId, 1, inquiryId);
}
else
{
printCount = (printCount.ToDouble2().Value / 8).ToDecimal2().Value.JRoundInt();
model = _dottedLineCostBLL.GetModel(printingTyId, 6, inquiryId);
}
}
else if (pageSizeValue == 48)
{
if (printCount > 30000)
{
printCount = (printCount.ToDouble2().Value / 12).ToDecimal2().Value.JRoundInt();
model = _dottedLineCostBLL.GetModel(printingTyId, 5, inquiryId);
}
else if (printCount <= 10000)
{
printCount = (printCount.ToDouble2().Value / 3).ToDecimal2().Value.JRoundInt();
model = _dottedLineCostBLL.GetModel(printingTyId, 1, inquiryId);
}
else
{
printCount = (printCount.ToDouble2().Value / 6).ToDecimal2().Value.JRoundInt();
model = _dottedLineCostBLL.GetModel(printingTyId, 6, inquiryId);
}
}
else if (pageSizeValue == 32)
{
if (printCount > 20000)
{
printCount = (printCount.ToDouble2().Value / 8).ToDecimal2().Value.JRoundInt();
model = _dottedLineCostBLL.GetModel(printingTyId, 5, inquiryId);
}
else if (printCount <= 5000)
{
printCount = (printCount.ToDouble2().Value / 2).ToDecimal2().Value.JRoundInt();
model = _dottedLineCostBLL.GetModel(printingTyId, 1, inquiryId);
}
else
{
printCount = (printCount.ToDouble2().Value / 4).ToDecimal2().Value.JRoundInt();
model = _dottedLineCostBLL.GetModel(printingTyId, 6, inquiryId);
}
}
else if (pageSizeValue == 16)
{
if (printCount > 5000)
{
printCount = (printCount.ToDouble2().Value / 4).ToDecimal2().Value.JRoundInt();
model = _dottedLineCostBLL.GetModel(printingTyId, 5, inquiryId);
}
else if (printCount <= 3000)
{
model = _dottedLineCostBLL.GetModel(printingTyId, 1, inquiryId);
}
else
{
printCount = (printCount.ToDouble2().Value / 2).ToDecimal2().Value.JRoundInt();
model = _dottedLineCostBLL.GetModel(printingTyId, 6, inquiryId);
}
}
else if (pageSizeValue == 8)
{
if (printCount > 5000)
{
printCount = (printCount.ToDouble2().Value / 2).ToDecimal2().Value.JRoundInt();
model = _dottedLineCostBLL.GetModel(printingTyId, 5, inquiryId);
}
else
{
model = _dottedLineCostBLL.GetModel(printingTyId, 6, inquiryId);
}
}
else if (pageSizeValue == 6)
{
if (printCount > 5000)
{
printCount = (printCount.ToDouble2().Value / 2).ToDecimal2().Value.JRoundInt();
model = _dottedLineCostBLL.GetModel(printingTyId, 4, inquiryId);
}
else
{
model = _dottedLineCostBLL.GetModel(printingTyId, 12, inquiryId);
}
}
else if (pageSizeValue == 4)
{
if (printCount > 5000)
{
printCount = (printCount.ToDouble2().Value / 2).ToDecimal2().Value.JRoundInt();
model = _dottedLineCostBLL.GetModel(printingTyId, 2, inquiryId);
}
else
{
model = _dottedLineCostBLL.GetModel(printingTyId, 5, inquiryId);
}
}
else
{
model = _dottedLineCostBLL.GetModel(printingTyId, parentId, inquiryId);
}
}
if (model != null)
{
price = model.Price * printCount;
if (price < model.StartPrice)
{
price = model.StartPrice;
}
if (model.PlatemakPrice.HasValue)
price += model.PlatemakPrice.Value;
}
return price;
}
///
/// 获取模切费价格
///
///
///
///
///
public decimal GetCuttingPrice(int printModel, int printCount, int printingTyId, int pageSizeValue, int? parentId, int pageSizeKeyId, int printTypeId, Guid inquiryId)
{
decimal price = 0;
CuttingCostBLL _cuttingCostBLL = new CuttingCostBLL();
if (printTypeId != 21)
{
Inquiry_CuttingCost model = null;
//if (pageSizeValue >= 1 && pageSizeValue <= 16)
//{
// price = _cuttingCostBLL.GetCuttingPrice(printingTyId, parentId.Value, printCount, inquiryId);
//}
//else if (pageSizeValue > 16)
//{
// price = ((16).ToDouble2().Value / pageSizeValue.ToDouble2().Value).ToDecimal2().Value * _cuttingCostBLL.GetCuttingPrice(printingTyId, 1, printCount, inquiryId);
//}
if (printTypeId == 15 && printModel == 1)
{
model = _cuttingCostBLL.GetModel(printingTyId, 6, inquiryId);
}
else
{
if (printModel == 1)
{
if (pageSizeValue == 64 || pageSizeValue == 48 || pageSizeValue == 32)
{
printCount = (printCount / (pageSizeValue / 16));
model = _cuttingCostBLL.GetModel(printingTyId, 1, inquiryId);
}
else if (pageSizeValue == 16)
{
if (printCount == 20000 || printCount == 100000)
{
printCount = printCount / 2;
model = _cuttingCostBLL.GetModel(printingTyId, 6, inquiryId);
}
else
{
model = _cuttingCostBLL.GetModel(printingTyId, 1, inquiryId);
}
}
else if (pageSizeValue == 6 || pageSizeValue == 8)
{
if (printCount == 20000 || printCount == 100000)
{
printCount = printCount / 2;
model = _cuttingCostBLL.GetModel(printingTyId, 5, inquiryId);
}
else
{
model = _cuttingCostBLL.GetModel(printingTyId, 6, inquiryId);
}
}
else
{
model = _cuttingCostBLL.GetModel(printingTyId, parentId.Value, inquiryId);
}
}
else
{
if (pageSizeValue == 64)
{
if (printCount > 80000)
{
printCount = (printCount.ToDouble2().Value / 16).ToDecimal2().Value.JRoundInt();
model = _cuttingCostBLL.GetModel(printingTyId, 5, inquiryId);
}
else if (printCount <= 10000)
{
printCount = (printCount.ToDouble2().Value / 4).ToDecimal2().Value.JRoundInt();
model = _cuttingCostBLL.GetModel(printingTyId, 1, inquiryId);
}
else
{
printCount = (printCount.ToDouble2().Value / 8).ToDecimal2().Value.JRoundInt();
model = _cuttingCostBLL.GetModel(printingTyId, 6, inquiryId);
}
}
else if (pageSizeValue == 48)
{
if (printCount > 30000)
{
printCount = (printCount.ToDouble2().Value / 12).ToDecimal2().Value.JRoundInt();
model = _cuttingCostBLL.GetModel(printingTyId, 5, inquiryId);
}
else if (printCount <= 10000)
{
printCount = (printCount.ToDouble2().Value / 3).ToDecimal2().Value.JRoundInt();
model = _cuttingCostBLL.GetModel(printingTyId, 1, inquiryId);
}
else
{
printCount = (printCount.ToDouble2().Value / 6).ToDecimal2().Value.JRoundInt();
model = _cuttingCostBLL.GetModel(printingTyId, 6, inquiryId);
}
}
else if (pageSizeValue == 32)
{
if (printCount > 20000)
{
printCount = (printCount.ToDouble2().Value / 8).ToDecimal2().Value.JRoundInt();
model = _cuttingCostBLL.GetModel(printingTyId, 5, inquiryId);
}
else if (printCount <= 5000)
{
printCount = (printCount.ToDouble2().Value / 2).ToDecimal2().Value.JRoundInt();
model = _cuttingCostBLL.GetModel(printingTyId, 1, inquiryId);
}
else
{
printCount = (printCount.ToDouble2().Value / 4).ToDecimal2().Value.JRoundInt();
model = _cuttingCostBLL.GetModel(printingTyId, 6, inquiryId);
}
}
else if (pageSizeValue == 16)
{
if (printCount > 5000)
{
printCount = (printCount.ToDouble2().Value / 4).ToDecimal2().Value.JRoundInt();
model = _cuttingCostBLL.GetModel(printingTyId, 5, inquiryId);
}
else if (printCount <= 3000)
{
model = _cuttingCostBLL.GetModel(printingTyId, 1, inquiryId);
}
else
{
printCount = (printCount.ToDouble2().Value / 2).ToDecimal2().Value.JRoundInt();
model = _cuttingCostBLL.GetModel(printingTyId, 6, inquiryId);
}
}
else if (pageSizeValue == 8)
{
if (printCount > 5000)
{
printCount = (printCount.ToDouble2().Value / 2).ToDecimal2().Value.JRoundInt();
model = _cuttingCostBLL.GetModel(printingTyId, 5, inquiryId);
}
else
{
model = _cuttingCostBLL.GetModel(printingTyId, 6, inquiryId);
}
}
else if (pageSizeValue == 6)
{
if (printCount > 5000)
{
printCount = (printCount.ToDouble2().Value / 2).ToDecimal2().Value.JRoundInt();
model = _cuttingCostBLL.GetModel(printingTyId, 4, inquiryId);
}
else
{
model = _cuttingCostBLL.GetModel(printingTyId, 12, inquiryId);
}
}
else if (pageSizeValue == 4)
{
if (printCount > 5000)
{
printCount = (printCount.ToDouble2().Value / 2).ToDecimal2().Value.JRoundInt();
model = _cuttingCostBLL.GetModel(printingTyId, 2, inquiryId);
}
else
{
model = _cuttingCostBLL.GetModel(printingTyId, 5, inquiryId);
}
}
else
{
model = _cuttingCostBLL.GetModel(printingTyId, parentId.Value, inquiryId);
}
}
}
if (model != null)
{
price = model.Price * printCount;
if (price < model.StartPrice)
{
price = model.StartPrice;
}
price += model.PlatemakPrice;
}
}
else
{
price = _cuttingCostBLL.GetCuttingPriceByEnvelope(printingTyId, pageSizeKeyId, printCount, inquiryId);
}
return price;
}
///
/// 获取压痕费价格
///
///
///
///
///
public decimal GetIndentationPrice(int printModel, int printCount, int printingTyId, int pageSizeValue, int parentId, Guid inquiryId)
{
decimal price = 0;
IndentationCostBLL _indentationCostBLL = new IndentationCostBLL();
Inquiry_IndentationCost model = null;
//if (pageSizeValue >= 1 && pageSizeValue <= 16)
//{
// price = _indentationCostBLL.GetIndentationPrice(printingTyId, parentId, printCount, inquiryId);
//}
//else if (pageSizeValue > 16)
//{
// price = ((16).ToDouble2().Value / pageSizeValue.ToDouble2().Value).ToDecimal2().Value * _indentationCostBLL.GetIndentationPrice(printingTyId, 1, printCount, inquiryId);
//}
if (printModel == 1)
{
if (pageSizeValue == 64 || pageSizeValue == 48 || pageSizeValue == 32)
{
printCount = (printCount / (pageSizeValue / 16));
model = _indentationCostBLL.GetModel(printingTyId, 1, inquiryId);
}
else if (pageSizeValue == 16)
{
if (printCount == 20000 || printCount == 100000)
{
printCount = printCount / 2;
model = _indentationCostBLL.GetModel(printingTyId, 6, inquiryId);
}
else
{
model = _indentationCostBLL.GetModel(printingTyId, 1, inquiryId);
}
}
else if (pageSizeValue == 6 || pageSizeValue == 8)
{
if (printCount == 20000 || printCount == 100000)
{
printCount = printCount / 2;
model = _indentationCostBLL.GetModel(printingTyId, 5, inquiryId);
}
else
{
model = _indentationCostBLL.GetModel(printingTyId, 6, inquiryId);
}
}
else
{
model = _indentationCostBLL.GetModel(printingTyId, parentId, inquiryId);
}
}
else
{
if (pageSizeValue == 64)
{
if (printCount > 80000)
{
printCount = (printCount.ToDouble2().Value / 16).ToDecimal2().Value.JRoundInt();
model = _indentationCostBLL.GetModel(printingTyId, 5, inquiryId);
}
else if (printCount <= 10000)
{
printCount = (printCount.ToDouble2().Value / 4).ToDecimal2().Value.JRoundInt();
model = _indentationCostBLL.GetModel(printingTyId, 1, inquiryId);
}
else
{
printCount = (printCount.ToDouble2().Value / 8).ToDecimal2().Value.JRoundInt();
model = _indentationCostBLL.GetModel(printingTyId, 6, inquiryId);
}
}
else if (pageSizeValue == 48)
{
if (printCount > 30000)
{
printCount = (printCount.ToDouble2().Value / 12).ToDecimal2().Value.JRoundInt();
model = _indentationCostBLL.GetModel(printingTyId, 5, inquiryId);
}
else if (printCount <= 10000)
{
printCount = (printCount.ToDouble2().Value / 3).ToDecimal2().Value.JRoundInt();
model = _indentationCostBLL.GetModel(printingTyId, 1, inquiryId);
}
else
{
printCount = (printCount.ToDouble2().Value / 6).ToDecimal2().Value.JRoundInt();
model = _indentationCostBLL.GetModel(printingTyId, 6, inquiryId);
}
}
else if (pageSizeValue == 32)
{
if (printCount > 20000)
{
printCount = (printCount.ToDouble2().Value / 8).ToDecimal2().Value.JRoundInt();
model = _indentationCostBLL.GetModel(printingTyId, 5, inquiryId);
}
else if (printCount <= 5000)
{
printCount = (printCount.ToDouble2().Value / 2).ToDecimal2().Value.JRoundInt();
model = _indentationCostBLL.GetModel(printingTyId, 1, inquiryId);
}
else
{
printCount = (printCount.ToDouble2().Value / 4).ToDecimal2().Value.JRoundInt();
model = _indentationCostBLL.GetModel(printingTyId, 6, inquiryId);
}
}
else if (pageSizeValue == 16)
{
if (printCount > 5000)
{
printCount = (printCount.ToDouble2().Value / 4).ToDecimal2().Value.JRoundInt();
model = _indentationCostBLL.GetModel(printingTyId, 5, inquiryId);
}
else if (printCount <= 3000)
{
model = _indentationCostBLL.GetModel(printingTyId, 1, inquiryId);
}
else
{
printCount = (printCount.ToDouble2().Value / 2).ToDecimal2().Value.JRoundInt();
model = _indentationCostBLL.GetModel(printingTyId, 6, inquiryId);
}
}
else if (pageSizeValue == 8)
{
if (printCount > 5000)
{
printCount = (printCount.ToDouble2().Value / 2).ToDecimal2().Value.JRoundInt();
model = _indentationCostBLL.GetModel(printingTyId, 5, inquiryId);
}
else
{
model = _indentationCostBLL.GetModel(printingTyId, 6, inquiryId);
}
}
else if (pageSizeValue == 6)
{
if (printCount > 5000)
{
printCount = (printCount.ToDouble2().Value / 2).ToDecimal2().Value.JRoundInt();
model = _indentationCostBLL.GetModel(printingTyId, 4, inquiryId);
}
else
{
model = _indentationCostBLL.GetModel(printingTyId, 12, inquiryId);
}
}
else if (pageSizeValue == 4)
{
if (printCount > 5000)
{
printCount = (printCount.ToDouble2().Value / 2).ToDecimal2().Value.JRoundInt();
model = _indentationCostBLL.GetModel(printingTyId, 2, inquiryId);
}
else
{
model = _indentationCostBLL.GetModel(printingTyId, 5, inquiryId);
}
}
else
{
model = _indentationCostBLL.GetModel(printingTyId, parentId, inquiryId);
}
}
if (model != null)
{
price = model.Price * printCount;
if (price < model.StartPrice)
{
price = model.StartPrice;
}
price += model.PlatemakPrice;
}
return price;
}
///
/// 获取压纹费价格
///
///
///
///
///
public decimal GetEmbossedPrice(int printModel, int printCount, int printingTyId, int pageSizeValue, int parentId, Guid inquiryId)
{
decimal price = 0;
EmbossedCostBLL _embossedCostBLL = new EmbossedCostBLL();
Inquiry_EmbossedCost model = null;
//if (pageSizeValue >= 1 && pageSizeValue <= 16)
//{
// price = _embossedCostBLL.GetEmbossedPrice(printingTyId, parentId, printCount, inquiryId);
//}
//else if (pageSizeValue > 16)
//{
// price = ((16).ToDouble2().Value / pageSizeValue.ToDouble2().Value).ToDecimal2().Value * _embossedCostBLL.GetEmbossedPrice(printingTyId, 1, printCount, inquiryId);
//}
if (printingTyId == 15 && printModel == 1)
{
model = _embossedCostBLL.GetModel(printingTyId, 6, inquiryId);
}
else
{
if (printModel == 1)
{
if (pageSizeValue == 64 || pageSizeValue == 48 || pageSizeValue == 32)
{
printCount = (printCount / (pageSizeValue / 16));
model = _embossedCostBLL.GetModel(printingTyId, 1, inquiryId);
}
else if (pageSizeValue == 16)
{
if (printCount == 20000 || printCount == 100000)
{
printCount = printCount / 2;
model = _embossedCostBLL.GetModel(printingTyId, 6, inquiryId);
}
else
{
model = _embossedCostBLL.GetModel(printingTyId, 1, inquiryId);
}
}
else if (pageSizeValue == 6 || pageSizeValue == 8)
{
if (printCount == 20000 || printCount == 100000)
{
printCount = printCount / 2;
model = _embossedCostBLL.GetModel(printingTyId, 5, inquiryId);
}
else
{
model = _embossedCostBLL.GetModel(printingTyId, 6, inquiryId);
}
}
else
{
model = _embossedCostBLL.GetModel(printingTyId, parentId, inquiryId);
}
}
else
{
if (pageSizeValue == 64)
{
if (printCount > 80000)
{
printCount = (printCount.ToDouble2().Value / 16).ToDecimal2().Value.JRoundInt();
model = _embossedCostBLL.GetModel(printingTyId, 5, inquiryId);
}
else if (printCount <= 10000)
{
printCount = (printCount.ToDouble2().Value / 4).ToDecimal2().Value.JRoundInt();
model = _embossedCostBLL.GetModel(printingTyId, 1, inquiryId);
}
else
{
printCount = (printCount.ToDouble2().Value / 8).ToDecimal2().Value.JRoundInt();
model = _embossedCostBLL.GetModel(printingTyId, 6, inquiryId);
}
}
else if (pageSizeValue == 48)
{
if (printCount > 30000)
{
printCount = (printCount.ToDouble2().Value / 12).ToDecimal2().Value.JRoundInt();
model = _embossedCostBLL.GetModel(printingTyId, 5, inquiryId);
}
else if (printCount <= 10000)
{
printCount = (printCount.ToDouble2().Value / 3).ToDecimal2().Value.JRoundInt();
model = _embossedCostBLL.GetModel(printingTyId, 1, inquiryId);
}
else
{
printCount = (printCount.ToDouble2().Value / 6).ToDecimal2().Value.JRoundInt();
model = _embossedCostBLL.GetModel(printingTyId, 6, inquiryId);
}
}
else if (pageSizeValue == 32)
{
if (printCount > 20000)
{
printCount = (printCount.ToDouble2().Value / 8).ToDecimal2().Value.JRoundInt();
model = _embossedCostBLL.GetModel(printingTyId, 5, inquiryId);
}
else if (printCount <= 5000)
{
printCount = (printCount.ToDouble2().Value / 2).ToDecimal2().Value.JRoundInt();
model = _embossedCostBLL.GetModel(printingTyId, 1, inquiryId);
}
else
{
printCount = (printCount.ToDouble2().Value / 4).ToDecimal2().Value.JRoundInt();
model = _embossedCostBLL.GetModel(printingTyId, 6, inquiryId);
}
}
else if (pageSizeValue == 16)
{
if (printCount > 5000)
{
printCount = (printCount.ToDouble2().Value / 4).ToDecimal2().Value.JRoundInt();
model = _embossedCostBLL.GetModel(printingTyId, 5, inquiryId);
}
else if (printCount <= 3000)
{
model = _embossedCostBLL.GetModel(printingTyId, 1, inquiryId);
}
else
{
printCount = (printCount.ToDouble2().Value / 2).ToDecimal2().Value.JRoundInt();
model = _embossedCostBLL.GetModel(printingTyId, 6, inquiryId);
}
}
else if (pageSizeValue == 8)
{
if (printCount > 5000)
{
printCount = (printCount.ToDouble2().Value / 2).ToDecimal2().Value.JRoundInt();
model = _embossedCostBLL.GetModel(printingTyId, 5, inquiryId);
}
else
{
model = _embossedCostBLL.GetModel(printingTyId, 6, inquiryId);
}
}
else if (pageSizeValue == 6)
{
if (printCount > 5000)
{
printCount = (printCount.ToDouble2().Value / 2).ToDecimal2().Value.JRoundInt();
model = _embossedCostBLL.GetModel(printingTyId, 4, inquiryId);
}
else
{
model = _embossedCostBLL.GetModel(printingTyId, 12, inquiryId);
}
}
else if (pageSizeValue == 4)
{
if (printCount > 5000)
{
printCount = (printCount.ToDouble2().Value / 2).ToDecimal2().Value.JRoundInt();
model = _embossedCostBLL.GetModel(printingTyId, 2, inquiryId);
}
else
{
model = _embossedCostBLL.GetModel(printingTyId, 5, inquiryId);
}
}
else
{
model = _embossedCostBLL.GetModel(printingTyId, parentId, inquiryId);
}
}
}
if (model != null)
{
price = model.Price * printCount;
if (price < model.StartPrice)
{
price = model.StartPrice;
}
}
return price;
}
///
/// 获取套号的价格
///
///
///
///
public decimal GetSetNumberPrice(int printCount, int printTypeId, Guid inquiryId)
{
decimal price = 0;
Inquiry_MultipleAfterCost model = GetMultipleAfterCost(inquiryId, printTypeId, 24);
if (model != null)
{
price = model.Price * printCount;
if (price < model.TotalStartPrice)
price = model.TotalStartPrice;
}
return price;
}
///
/// 获取烫金,烫银或者UV,凹凸的价格
///
///
///
///
///
///
///
public decimal GetPriceByGoldStampOrUV(int printCount, int printingTyId, Guid inquiryId, int afterParameterId, decimal with, decimal hight)
{
decimal price = 0;
Inquiry_MultipleAfterCost model = GetMultipleAfterCost(inquiryId, printingTyId, afterParameterId);
if (model != null)
{
if (with != 0 && hight != 0)
{
price = (with * hight) * model.Price;
if (model.StartPriceBySingle.HasValue)
{
if (price < model.StartPriceBySingle)
price = model.StartPriceBySingle.Value;
}
price = price * printCount;
if (price < model.TotalStartPrice)
price = model.TotalStartPrice;
if (afterParameterId == 11)
{
if (model.PlatemakPrice.HasValue)
price += model.PlatemakPrice.Value;
}
else
{
decimal platemarkPrice = 0;
if (model.PlatemakPrice.HasValue)
platemarkPrice = (with * hight) * model.PlatemakPrice.Value;
if (model.StartPlatemakPrice.HasValue)
{
if (platemarkPrice < model.StartPlatemakPrice)
platemarkPrice = model.StartPlatemakPrice.Value;
}
price += platemarkPrice;
}
}
}
return price;
}
///
/// 获取综合后道价格
///
///
public decimal GetMultipleAfterPrice(int printCount, int printingTyId, Guid inquiryId, int afterParameterId)
{
decimal price = 0;
Inquiry_MultipleAfterCost model = GetMultipleAfterCost(inquiryId, printingTyId, afterParameterId);
if (model != null)
{
price = model.Price * printCount;
if (price < model.TotalStartPrice)
price = model.TotalStartPrice;
if (afterParameterId == 54) //印字挂绳
{
if (model.PlatemakPrice.HasValue)
price += model.PlatemakPrice.Value;
}
}
return price;
}
///
/// 获取综合后道参数
///
///
///
///
///
public Inquiry_MultipleAfterCost GetMultipleAfterCost(Guid inquiryId, int printingTyId, int afterParameterId)
{
MultipleAfterCostBLL _multipleAfterCostBLL = new MultipleAfterCostBLL();
return _multipleAfterCostBLL.GetModel(inquiryId, printingTyId, afterParameterId);
}
///
/// 计算货运费
///
///
///
public decimal GetCargagePrice(decimal totalPrice, Guid inquiryId, int cargateTypeId)
{
decimal cargagePrice = 0;
CargageBLL _cargageBLL = new CargageBLL();
if (cargateTypeId == 107)
{
cargateTypeId = 105;
}
Inquiry_Cargage cargageMode = _cargageBLL.GetModel(inquiryId, cargateTypeId);
if (totalPrice != 0)
{
if (cargageMode != null)
{
decimal cargageValue = cargageMode.CargageValue;
cargagePrice = totalPrice * (cargageValue / 100);
if (cargagePrice < cargageMode.StartPrice)
cargagePrice = cargageMode.StartPrice;
}
}
return cargagePrice;
}
///
/// 获取税费设置
///
///
///
///
public decimal GetTaxationValue(int taxType, Guid inquiryId)
{
decimal taxationValue = 0;
TaxationCostBLL _taxationCostBLL = new TaxationCostBLL();
if (taxType == 109)
{
taxType = 2;
}
else if (taxType == 110)
{
taxType = 3;
}
Inquiry_TaxationCost taxMode = _taxationCostBLL.GetTaxationCost(taxType, inquiryId);
if (taxMode != null)
taxationValue = taxMode.TaxVale;
return taxationValue;
}
#endregion
}
}