using System; using System.Collections.Generic; using System.Linq; using System.Text; using CY.IDAL.Inquiry; using AbstractFactory; using CY.Model; using CY.Infrastructure.Common; namespace CY.BLL.Inquiry { /// /// 印刷类型范围设置业务逻辑类 /// public class RangeofBusinessBLL { IRangeofBusinessDAL _iRangeofBusinessDAL = null; PaperInfoBLL _paperInfoBLL = null; public RangeofBusinessBLL() { _iRangeofBusinessDAL = Factory.GetDALByInterfaceName(DALInterface.IRangeofBusinessDAL) as IRangeofBusinessDAL; _paperInfoBLL = new PaperInfoBLL(); } /// /// 根据printTypeId获取印刷类型范围设置列表 /// /// /// public IList GetModelList(int printTypeId) { return _iRangeofBusinessDAL.GetModelList(printTypeId); } /// /// 根据印刷类型获取其可用的纸张 /// /// /// public IList GetPaperInfo(int printTypeId) { PaperInfoBLL _paperInfoBLL = new PaperInfoBLL(); IList list=new List(); IList rList=GetModelList(printTypeId); foreach (SysInquiry_RangeofBusiness model in rList) { list.Add(_paperInfoBLL.GetPaperModel(model.PagerId.Value)); } return list; } /// /// 获取某个印刷类型的某个纸张的克重 /// /// /// /// public List GramWeightByPrintTypeId(int printTypeId, int paperId) { IList list = GetModelList(printTypeId); if (list.Count > 0) { List gramWeightList = new List(); try { SysInquiry_RangeofBusiness model = list.Single(p => p.PagerId == paperId) as SysInquiry_RangeofBusiness; string gramWeights = model.GramWeightRange; string[] arry = gramWeights.Split('|'); foreach (string s in arry) { gramWeightList.Add(s.ToInt32().Value); } } catch { } return gramWeightList; } else { return new List(); } } /// /// 获取某个印刷类型的某个纸张的克重(包含品牌) /// /// /// /// public List GramWeightByPrintTypeId(int printTypeId, int paperId, int brandId) { IList list = GetModelList(printTypeId); if (list.Count > 0) { List gramWeightList = new List(); try { SysInquiry_RangeofBusiness model = list.Single(p => p.PagerId == paperId) as SysInquiry_RangeofBusiness; string gramWeights = model.GramWeightRange; string[] arry = gramWeights.Split('|'); foreach (string s in arry) { if (!IsNoPrice(paperId, s.ToInt32().Value, brandId)) gramWeightList.Add(s.ToInt32().Value); } } catch { } return gramWeightList; } else { return new List(); } } /// /// 保存印刷类型范围设置列表 /// /// /// /// public bool SaveModelList(IList list, int printTypeId) { return _iRangeofBusinessDAL.SaveModelList(list,printTypeId); } /// /// 判断纸张的吨价是否为0 /// /// /// public bool IsNoPrice(int paperId, int gramWeight, int brandId) { decimal tonsOfPrice = _paperInfoBLL.GetTonsOfPrice(paperId, gramWeight, brandId, UtilConst.AdminFirmId.ToGuid2()); if (tonsOfPrice == (0).ToDecimal2().Value) { return true; } else { return false; } } } }