/** * IEC_OrderBasicDAL.cs * * 功 能: 订单主信息业务类 * 类 名: IEC_OrderBasicBLL * * Ver 变更日期 负责人 变更内容 * ─────────────────────────────────── * V0.01 2013-4-23 10:55:24 吴崎均 初版 * V0.02 2013-5-6 9:08 吴崎均 增加分页方法(调用订单专用分页存储) * V0.03 2013-5-10 16:33 吴崎均 增加方法:发起订单属性改变请求、执行订单属性改变请求 * V0.04 2013-5-11 13:21 吴崎均 增加方法:根据接手人查询属性变更请求集合 * V0.05 2013-5-11 14:13 吴崎均 增加方法:答复订单属性改变请求 * V0.06 2013-5-14 11:38 吴崎均 增加方法:根据卖家编号加载下一订单编号方法 * V0.07 2013-5-15 15:19 吴崎均 增加方法:根据编号获取订单信息 * V0.08 2013-5-17 11:07 吴崎均 增加方法:送货(含送货订单操作) * V0.09 2013-5-17 14:21 吴崎均 增加方法:根据编号获取货运信息,根据订单编号获取订单操作信息集合 * V0.10 2013-5-20 9:47 吴崎均 增加方法:根据订单编号获取收货地址信息 * V0.11 2013-5-28 13:50 吴崎均 修改批量删除方法定义及实现 * V0.12 2013-5-30 10:28 吴崎均 增加方法:预付款收/付款 * V0.13 2013-5-31 19:01 吴崎均 增加方法:根据订单编号确认收货 * * */ using System; using System.Collections.Generic; using System.Linq; using System.Text; using CY.Model; using CY.IDAL; using CY.Infrastructure.Query; using CY.Model.Inquiry; using CY.Infrastructure.Common; using CY.IDAL.EC; namespace CY.BLL.EC { /// /// 订单主信息业务类 /// public class EC_OrderBasicBLL { IEC_OrderBasicDAL _eC_OrderBasicDAL = null; IEC_OrderPrintParameterDAL _eC_OrderPrintParameterDAL = null; IEC_OrderExtendDAL _eC_OrderExtendDAL = null; IPay_TradingSingleDAL _pay_TradingSingleDAL = null; public EC_OrderBasicBLL() { _eC_OrderBasicDAL = AbstractFactory.Factory.GetDALByInterfaceName(AbstractFactory.DALInterface.IEC_OrderBasicDAL) as IEC_OrderBasicDAL; _eC_OrderPrintParameterDAL = AbstractFactory.Factory.GetDALByInterfaceName(AbstractFactory.DALInterface.IEC_OrderPrintParameterDAL) as IEC_OrderPrintParameterDAL; _eC_OrderExtendDAL = AbstractFactory.Factory.GetDALByInterfaceName(AbstractFactory.DALInterface.IEC_OrderExtendDAL) as IEC_OrderExtendDAL; _pay_TradingSingleDAL = AbstractFactory.Factory.GetDALByInterfaceName(AbstractFactory.DALInterface.IPay_TradingSingleDAL) as IPay_TradingSingleDAL; } /// /// 分页查询(根据联系人和结束状态) /// /// 分页对象 /// 查询参数 /// 查询结果 传入参数错误时结果为空 public IEnumerable SelectModelPage(Infrastructure.Query.Pagination pagination, Dictionary searchParam) { return _eC_OrderBasicDAL.SelectModelPage(pagination, searchParam); } /// /// 分页查询(根据联系人和结束状态)厂商订单,根据区域以及客户、业务经理查询 /// /// 分页对象 /// 查询参数 /// 查询结果 传入参数错误时结果为空 public IEnumerable SelectModelPage_Seller(Infrastructure.Query.Pagination pagination, Dictionary searchParam) { return _eC_OrderBasicDAL.SelectModelPage_Seller(pagination, searchParam); } /// /// 分页查询 /// /// /// /// public IEnumerable SelectModelPageSheji(Infrastructure.Query.Pagination pagination, Guid MemberId, string BeginCreateTime, string EndCreateTime, string SellerOrderId, string PrintTypeId, string BusinessManagerId, string Shejirenyuan, string BuyerName, string DocumentName, string ShejiStatus) { return _eC_OrderBasicDAL.SelectModelPageSheji(pagination, MemberId, BeginCreateTime, EndCreateTime, SellerOrderId, PrintTypeId, BusinessManagerId, Shejirenyuan, BuyerName, DocumentName, ShejiStatus); } /// /// 作业本送货分页查询 /// /// /// public IEnumerable SelectModelPageWorkBook(Infrastructure.Query.Pagination pagination, Guid _MemberID, string txtBeginDate, string txtEndDate, string txtOrderId, string txtSearchyjname, string selCustormerManager, string selBusinessManager, string selOrderStates) { return _eC_OrderBasicDAL.SelectModelPageWorkBook(pagination, _MemberID, txtBeginDate, txtEndDate, txtOrderId, txtSearchyjname, selCustormerManager, selBusinessManager, selOrderStates); } /// /// 统计订单金额 /// /// 分页对象 /// 查询参数 /// 查询结果 传入参数错误时结果为空 public EC_OrderBasic SumOrderMoney(Infrastructure.Query.Pagination pagination, Dictionary searchParam) { return _eC_OrderBasicDAL.SumOrderMoney(pagination, searchParam); } /// /// 统计订单金额 /// /// 分页对象 /// 查询参数 /// 查询结果 传入参数错误时结果为空 public EC_OrderBasic SumOrderMoney_receive(Infrastructure.Query.Pagination pagination, Dictionary searchParam) { return _eC_OrderBasicDAL.SumOrderMoney_receive(pagination, searchParam); } /// /// 生产安排分页查询 /// /// 分页对象 /// 查询参数 /// 查询结果 传入参数错误时结果为空 public IEnumerable SelectModelPageAg(Infrastructure.Query.Pagination pagination, Dictionary searchParam) { return _eC_OrderBasicDAL.SelectModelPageAg(pagination, searchParam); } /// /// 生产安排分页查询 /// /// 分页对象 /// 查询参数 /// 查询结果 传入参数错误时结果为空 public IEnumerable SelectModelPageSeal(Infrastructure.Query.Pagination pagination, Dictionary searchParam) { return _eC_OrderBasicDAL.SelectModelPageSeal(pagination, searchParam); } /// /// 受理订单 /// /// 订单编号 /// 受理佣金(受理订单时站方收取的服务费) /// public bool AcceptOrder(int orderId, double commission) { return _eC_OrderBasicDAL.AcceptOrder(orderId, commission); } /// /// 锁定订单 /// /// 订单编号 /// 操作人 /// public bool SuodingOrder(int orderId, string operater) { return _eC_OrderBasicDAL.SuodingOrder(orderId, operater); } /// /// 批量受理订单 /// /// /// /// public bool AcceptOrderAll(string orderIds, double commission) { return _eC_OrderBasicDAL.AcceptOrderAll(orderIds, commission); } /// /// 修改订单状态(非支付状态且不可修改为未受理和已受理) /// /// 订单操作 /// public bool UpdateOrderState(params EC_OrderOperate[] orderOperates) { return _eC_OrderBasicDAL.UpdateOrderState(orderOperates); } /// /// 修改订单状态(非支付状态且不可修改为未受理和已受理) /// /// 订单操作 /// public bool UpSurplusPrintNum(int? Keyid, int? SurplusPrintNum, string Operator) { return _eC_OrderExtendDAL.UpSurplusPrintNumsql(Keyid, SurplusPrintNum, Operator); } /// /// 根据编号批量删除数据 /// /// 当前操作人 /// 编号集合 /// public bool DeleteDataByIds(string currentOperator, params int[] ids) { return _eC_OrderBasicDAL.DeleteDataByIds(currentOperator, ids); } /// /// 根据卖家编号加载下一订单编号方法 /// /// 卖家编号 /// public string LoadOrderIdBySellerId(Guid memberId) { return _eC_OrderBasicDAL.LoadOrderIdBySellerId(memberId); } /// /// 根据编号获取订单信息 /// /// 订单唯一编号 /// public EC_OrderBasic SelectModelById(int orderId) { return _eC_OrderBasicDAL.SelectModelById(orderId); } /// /// 根据编号获取订单信息 /// /// 订单唯一编号 /// public Pay_TradingSingle GetPayTradingById(int orderId) { return _pay_TradingSingleDAL.GetOrderByIds(orderId).FirstOrDefault(); } /// /// 根据编号获取订单信息 /// /// 订单唯一编号 /// public EC_OrderExtend GetModelByKeyid(int orderId) { return _eC_OrderExtendDAL.GetModelByKeyid(orderId); } /// /// 根据订单编号获取订单 /// /// 订单编号 /// public IEnumerable GetOrderByIds(string orderIds) { return _eC_OrderBasicDAL.GetOrderByIds(orderIds); } /// /// 根据订单编号获取自动外协订单 /// /// 订单编号 /// public EC_OrderBasic SelectOutOrderById(int orderId) { return _eC_OrderBasicDAL.SelectOutOrderById(orderId); } /// /// 根据自动外协订单编号获取来源订单 /// /// 订单编号 /// public EC_OrderBasic SelectFromOutOrderById(int orderId) { return _eC_OrderBasicDAL.SelectFromOutOrderById(orderId); } /// /// 发起订单属性改变请求 /// /// 请求 /// public int OrderPropertyChangeRequest(EC_OrderDialogue dialogue) { return _eC_OrderBasicDAL.OrderPropertyChangeRequest(dialogue); } /// /// 执行订单属性改变请求 /// /// 要执行的目标数据 /// 执行者 /// public int OrderPropertyChangeExecute(Guid requestId, Guid memberId) { return _eC_OrderBasicDAL.OrderPropertyChangeExecute(requestId, memberId); } /// /// 根据接手人查询属性变更请求集合 /// /// 接手用户 /// public IEnumerable SelectPropertyChangeRequest(Guid memberId) { return _eC_OrderBasicDAL.SelectPropertyChangeRequest(memberId); } /// /// 答复订单属性改变请求 /// /// 要答复的目标数据 /// 答复人 /// 是否同意 /// public int OrderPropertyChangeReply(Guid requestId, Guid memberId, bool isAllow) { return _eC_OrderBasicDAL.OrderPropertyChangeReply(requestId, memberId, isAllow); } /// /// 收款(线下转账、现金) /// /// 订单编号 /// 操作记录 /// public bool ReceiveMoneyToAccount(int orderId, OA_FirmAccountRecord firmAccountRecord) { return _eC_OrderBasicDAL.ReceiveMoneyToAccount(orderId, firmAccountRecord); } /// /// 收款(线下转账、现金) /// /// 订单编号 /// 操作记录 /// public bool ReceiveMoneyToQueren(int orderId, OA_FirmAccountRecord firmAccountRecord) { return _eC_OrderBasicDAL.ReceiveMoneyToQueren(orderId, firmAccountRecord); } /// /// 送货 /// /// 货运信息 /// public bool DeliverPresswork(EC_AwbInfo awbInfo) { return _eC_OrderBasicDAL.DeliverPresswork(awbInfo); } /// /// 根据编号获取货运信息 /// /// 订单编号 /// public EC_AwbInfo SelectAwbInfoById(int orderId) { return _eC_OrderBasicDAL.SelectAwbInfoById(orderId); } /// /// 根据订单编号获取订单操作信息 /// /// 订单编号 /// public IEnumerable SelectOrderOperates(int orderId) { return _eC_OrderBasicDAL.SelectOrderOperates(orderId); } /// /// 获取倒数第二个的操作 /// /// /// public EC_OrderOperate GetSecondOrderOperateByDEC(int orderId) { EC_OrderOperate mode = null; IEnumerable list = SelectOrderOperates(orderId); if (list != null && list.Count() > 0) { if (list.Count() == 1) { mode = list.ToList()[0]; } else { mode = list.ToList()[1]; } } return mode; } /// /// 根据订单编号获取收货地址信息 /// /// 订单编号集合 /// public IEnumerable SelectOrderAddress(string orderIds) { return _eC_OrderBasicDAL.SelectOrderAddress(orderIds); } /// /// 收款(外协预付款、客户预付款) /// /// 卖家 /// 买家 /// 订单编号 /// 金额 /// 操作类型编号(2:预付款,3普通付款) /// 支付科目(订单付款,外协付款) /// 操作人 /// public bool ReceiveMoney(Guid sellerId, Guid buyerId, int orderId, decimal money, int operatTypeId, string subjectName, string currentOperator) { return _eC_OrderBasicDAL.ReceiveMoney(sellerId, buyerId, orderId, money, operatTypeId, subjectName, currentOperator); } /// /// 根据订单编号确认收货 /// /// 订单编号 /// 买家编号 /// public bool ConfirmAcceptById(int orderId, Guid memberId) { return _eC_OrderBasicDAL.ConfirmAcceptById(orderId, memberId); } /// /// 根据编号获取订单列表 /// /// /// /// public IEnumerable GetEC_OrderBasicListByKeyid(string Keyids, Guid FirmId) { return _eC_OrderBasicDAL.GetEC_OrderBasicListByKeyid(Keyids, FirmId); } /// /// 订单完工 /// /// /// /// public bool CompletedOrderList(List m_EC_OrderOperateList, List m_EC_OrderBasicList) { return _eC_OrderBasicDAL.CompletedOrderList(m_EC_OrderOperateList, m_EC_OrderBasicList); } /// /// 卖家退单操作 /// /// /// /// /// public int RetireOrderBySeller(int orderId, decimal retireMony, string operatorName) { return _eC_OrderBasicDAL.RetireOrderBySeller(orderId, retireMony, operatorName); } /// /// 判断是否已经操作 /// /// /// /// /// public bool IsOpearted(int keyid, int orderState, string opType) { return _eC_OrderBasicDAL.IsOpearted(keyid, orderState, opType); } /// /// 查询后道(3)整单(4) /// /// /// /// /// /// /// /// /// /// /// /// /// public IEnumerable SelectAferOfOutOrder(Infrastructure.Query.Pagination pagination, Guid MemberId, DateTime? StartCreatTime, DateTime? EndCreatTime, DateTime? StartReturnTime, DateTime? EndReturnTime, string Creater, string OutFirm, string WorkStates, string OutOrderId, int? RelationType, string PayState = null) { return _eC_OrderBasicDAL.SelectAferOfOutOrder(pagination, MemberId, StartCreatTime, EndCreatTime, StartReturnTime, EndReturnTime, Creater, OutFirm, WorkStates, OutOrderId, RelationType, PayState); } /// /// 修改打印状态 /// /// public void UpdatePrintState(int orderId) { _eC_OrderBasicDAL.UpdatePrintState(orderId); } /// /// 修改打印状态 /// /// public void UpdatePrintfengqianState(int orderId) { _eC_OrderBasicDAL.UpdatePrintfengqianState(orderId); } /// /// 修改标签打印状态 /// /// public void UpdatePrintBiaoqianState(int orderId) { _eC_OrderBasicDAL.UpdatePrintBiaoqianState(orderId); } /// /// 分页查询外协订单(根据联系人和结束状态) /// /// 分页对象 /// 查询参数 /// 查询结果 传入参数错误时结果为空 public IEnumerable SelectModelPage_Outsource(Infrastructure.Query.Pagination pagination, Dictionary searchParam) { return _eC_OrderBasicDAL.SelectModelPage_Outsource(pagination, searchParam); } /// /// 更新 /// /// /// public bool UpdateModel(Model.EC_OrderBasic model) { return _eC_OrderBasicDAL.UpdateModel(model); } /// /// 判断某订单是否是另一订单的自动外协订单 /// /// /// public bool IsOutOrder(int orderId) { return _eC_OrderBasicDAL.IsOutOrder(orderId); } /// /// 判断某订单是否是另一订单的自动外协订单 /// /// /// public bool UpShejiStatus(int Keyid, int ShejiStatus, string Operator) { return _eC_OrderExtendDAL.UpShejiStatus(Keyid, ShejiStatus, Operator); } /// /// WEB服务自动完成订单 /// public void AutoCompleteOrderByWebService() { _eC_OrderBasicDAL.AutoCompleteOrderByWebService(); } /// /// 删除外协订单 /// /// /// public bool DeleteOutOrder(int OrderId) { return _eC_OrderBasicDAL.DeleteOutOrder(OrderId); } /// /// 删除外协订单 /// /// /// public bool UpdateOldOrderSurplusPrintNum(int outOrderId) { return _eC_OrderBasicDAL.UpdateOldOrderSurplusPrintNum(outOrderId); } /// /// 根据新增订单操作,并修改订单状态 /// /// /// public bool UpdateOrderState(EC_OrderOperate orderOperate) { return _eC_OrderBasicDAL.UpdateOrderState(orderOperate); } /// /// 分页查询(根据联系人和结束状态)-订单收款去除已冻结订单 /// /// 分页对象 /// 查询参数 /// 查询结果 传入参数错误时结果为空 public IEnumerable SelectModelPage_Financial(Infrastructure.Query.Pagination pagination, Dictionary searchParam) { return _eC_OrderBasicDAL.SelectModelPage_Financial(pagination, searchParam); } /// /// 查询客户预付款列表 /// /// /// public IEnumerable GetModelPageListForPrepayments(Pagination pa, string DeliveryTime, string Province, string City, string County, string BuyerName, string BusinessManagerId, string SellerOrderId, string DocumentName, Guid SellerId) { string Condition = " and ( ob.[OrderState] ='1' or ob.[OrderState] ='2' or ob.[OrderState] ='3' ) and SellerId='" + SellerId + "' "; if (!string.IsNullOrEmpty(DeliveryTime)) { if (DeliveryTime == "明天") { Condition += " and ( DATEDIFF(DAY,GETDATE(),ob.[DeliveryTime])=1 or DATEDIFF(DAY,GETDATE(),oe.[DelayTime])=1 )"; } else if (DeliveryTime == "后天") { Condition += " and ( DATEDIFF(DAY,GETDATE(),ob.[DeliveryTime])=2 or DATEDIFF(DAY,GETDATE(),oe.[DelayTime])=2 )"; } else if (DeliveryTime == "3天") { Condition += " and ( DATEDIFF(DAY,GETDATE(),ob.[DeliveryTime])=3 or DATEDIFF(DAY,GETDATE(),oe.[DelayTime])=3 )"; } else if (DeliveryTime == "4天") { Condition += " and ( DATEDIFF(DAY,GETDATE(),ob.[DeliveryTime])=4 or DATEDIFF(DAY,GETDATE(),oe.[DelayTime])=4 )"; } else if (DeliveryTime == "5天") { Condition += " and ( DATEDIFF(DAY,GETDATE(),ob.[DeliveryTime])=5 or DATEDIFF(DAY,GETDATE(),oe.[DelayTime])=5) "; } else if (DeliveryTime == "6天") { Condition += " and ( DATEDIFF(DAY,GETDATE(),ob.[DeliveryTime])=6 or DATEDIFF(DAY,GETDATE(),oe.[DelayTime])=6) "; } else if (DeliveryTime == "7天") { Condition += " and ( DATEDIFF(DAY,GETDATE(),ob.[DeliveryTime])=7 or DATEDIFF(DAY,GETDATE(),oe.[DelayTime])=7 )"; } else if (DeliveryTime == "一周后") { Condition += " and ( DATEDIFF(DAY,GETDATE(),ob.[DeliveryTime]) >7 or DATEDIFF(DAY,GETDATE(),oe.[DelayTime])>7 )"; } else if (DeliveryTime == "逾期") { Condition += " and ( DATEDIFF(DAY,GETDATE(),ob.[DeliveryTime])<=0 or DATEDIFF(DAY,GETDATE(),oe.[DelayTime])<=0 )"; } } if (!string.IsNullOrEmpty(Province)) Condition += string.Format(" and CustomerCommunications.Province='{0}'", Province); if (!string.IsNullOrEmpty(City)) Condition += string.Format(" and CustomerCommunications.City='{0}'", City); if (!string.IsNullOrEmpty(County)) Condition += string.Format(" and CustomerCommunications.County='{0}'", County); if (!string.IsNullOrEmpty(BuyerName)) { Condition += " and ob.BuyerName like '%" + BuyerName + "%'"; } if (!string.IsNullOrEmpty(BusinessManagerId)) { Condition += string.Format(" and oe.BusinessManagerId='{0}'", BusinessManagerId); } if (!string.IsNullOrEmpty(SellerOrderId)) { Condition += " and ob.SellerOrderId like '%" + SellerOrderId + "%'"; ; } if (!string.IsNullOrEmpty(DocumentName)) { Condition += " and ob.DocumentName like '%" + DocumentName + "%'"; ; } Query query = new Query(); IList criterias = new List() { new Criterion("", Condition), new Criterion("orderBy"," [DeliveryTime] DESC ") }; query.Criteria = criterias; return _eC_OrderBasicDAL.SelectModelPage_weiwangong(query, pa); } /// /// 查询客户预付款列表 /// /// /// public IEnumerable GetModelPageListForSonghuoyanchis(Pagination pa, string DeliveryTime, string Province, string City, string County, string BuyerName, string BusinessManagerId, string SellerOrderId, string DocumentName, Guid SellerId) { string Condition = " and ( ob.[OrderState] ='1' or ob.[OrderState] ='2' or ob.[OrderState] ='3' or ob.[OrderState] ='4' ) and SellerId='" + SellerId + "' "; if (!string.IsNullOrEmpty(DeliveryTime)) { if (DeliveryTime == "明天") { Condition += " and ( DATEDIFF(DAY,GETDATE(),ob.[DeliveryTime])=1 or DATEDIFF(DAY,GETDATE(),oe.[DelayTime])=1 )"; } else if (DeliveryTime == "后天") { Condition += " and ( DATEDIFF(DAY,GETDATE(),ob.[DeliveryTime])=2 or DATEDIFF(DAY,GETDATE(),oe.[DelayTime])=2 )"; } else if (DeliveryTime == "3天") { Condition += " and ( DATEDIFF(DAY,GETDATE(),ob.[DeliveryTime])=3 or DATEDIFF(DAY,GETDATE(),oe.[DelayTime])=3 )"; } else if (DeliveryTime == "4天") { Condition += " and ( DATEDIFF(DAY,GETDATE(),ob.[DeliveryTime])=4 or DATEDIFF(DAY,GETDATE(),oe.[DelayTime])=4 )"; } else if (DeliveryTime == "5天") { Condition += " and ( DATEDIFF(DAY,GETDATE(),ob.[DeliveryTime])=5 or DATEDIFF(DAY,GETDATE(),oe.[DelayTime])=5) "; } else if (DeliveryTime == "6天") { Condition += " and ( DATEDIFF(DAY,GETDATE(),ob.[DeliveryTime])=6 or DATEDIFF(DAY,GETDATE(),oe.[DelayTime])=6) "; } else if (DeliveryTime == "7天") { Condition += " and ( DATEDIFF(DAY,GETDATE(),ob.[DeliveryTime])=7 or DATEDIFF(DAY,GETDATE(),oe.[DelayTime])=7 )"; } else if (DeliveryTime == "一周后") { Condition += " and ( DATEDIFF(DAY,GETDATE(),ob.[DeliveryTime]) >7 or DATEDIFF(DAY,GETDATE(),oe.[DelayTime])>7 )"; } else if (DeliveryTime == "逾期") { Condition += " and ( DATEDIFF(DAY,GETDATE(),ob.[DeliveryTime])<=0 or DATEDIFF(DAY,GETDATE(),oe.[DelayTime])<=0 )"; } } if (!string.IsNullOrEmpty(Province)) Condition += string.Format(" and CustomerCommunications.Province='{0}'", Province); if (!string.IsNullOrEmpty(City)) Condition += string.Format(" and CustomerCommunications.City='{0}'", City); if (!string.IsNullOrEmpty(County)) Condition += string.Format(" and CustomerCommunications.County='{0}'", County); if (!string.IsNullOrEmpty(BuyerName)) { Condition += " and ob.BuyerName like '%" + BuyerName + "%'"; } if (!string.IsNullOrEmpty(BusinessManagerId)) { Condition += string.Format(" and oe.BusinessManagerId='{0}'", BusinessManagerId); } if (!string.IsNullOrEmpty(SellerOrderId)) { Condition += " and ob.SellerOrderId like '%" + SellerOrderId + "%'"; ; } if (!string.IsNullOrEmpty(DocumentName)) { Condition += " and ob.DocumentName like '%" + DocumentName + "%'"; ; } Query query = new Query(); IList criterias = new List() { new Criterion("", Condition), new Criterion("orderBy"," [DeliveryTime] DESC ") }; query.Criteria = criterias; return _eC_OrderBasicDAL.SelectModelPage_weiwangong(query, pa); } /// /// 根据新增订单操作,并修改订单状态 /// /// /// public void UpdateDeliveryOrderId(int orderId, Guid DeliveryOrderId) { _eC_OrderBasicDAL.UpdateDeliveryOrderId(orderId, DeliveryOrderId); } /// /// 根据发货单id查询 /// /// /// /// public IEnumerable GetEC_OrderBasicListBydeliverorderId(Guid deliverorderId, Guid FirmId) { return _eC_OrderBasicDAL.GetEC_OrderBasicListBydeliverorderId(deliverorderId, FirmId); } /// /// 重新计算订单的金额 /// /// /// public bool UpdateorderJine(int orderId) { CoreCmsPlanOrderBLL _PlanOrderBLL = new CoreCmsPlanOrderBLL(); CoreCmsPlanOrderItemBLL _coreCmsPlanOrderItemBLL = new CoreCmsPlanOrderItemBLL(); var eC_OrderBasic = this.SelectModelById(orderId); EC_OrderPrintParameterBLL _OrderPrintParameterBLL = new EC_OrderPrintParameterBLL(); var eC_OrderPrintParameter = _OrderPrintParameterBLL.GetModel(orderId); InquiryCommonModel model = SerializationHelper.DeSerialize(typeof(InquiryCommonModel), eC_OrderPrintParameter.PrintParameter) as InquiryCommonModel; //eC_OrderBasic.SumPrice =12 ; //eC_OrderBasic.UnitPrice = 12; var sss = model.InquiryWorkBookList; var coreCmsPlanOrders = _PlanOrderBLL.GetModelByorderid(orderId).ToList(); decimal SumPrice = 0; int num = 0; var coreCmsPlanOrders2 = new List(); foreach (var coreCmsPlanOrder in coreCmsPlanOrders) { var coreCmsPlanOrders1 = _coreCmsPlanOrderItemBLL.GetModelsByOrderid(coreCmsPlanOrder.id).ToList(); coreCmsPlanOrders2.AddRange(coreCmsPlanOrders1); num += coreCmsPlanOrders1.Sum(x=>x.nums); SumPrice += coreCmsPlanOrders1.Sum(x => x.amount); } eC_OrderBasic.SumPrice = SumPrice; if (num > 0) { eC_OrderBasic.UnitPrice = Math.Round(SumPrice / new decimal(num), 4); } else { eC_OrderBasic.UnitPrice = 0; } model.PrintCount = num; foreach ( var inquiryWorkBookModel in model.InquiryWorkBookList) { var sssssss = coreCmsPlanOrders2.Where(x => x.name == inquiryWorkBookModel.WorkBookNameTxt && x.specification == inquiryWorkBookModel.WorkBookSizeTxt).ToList(); inquiryWorkBookModel.WorkBookCount = sssssss.Sum(x=>x.nums).ToString2(); inquiryWorkBookModel.WorkBookMoney = sssssss.Sum(x=>x.amount).ToString2(); } var isWin = _eC_OrderBasicDAL.Updatejinedanjia(eC_OrderBasic.Keyid.Value, eC_OrderBasic.SumPrice.Value, eC_OrderBasic.UnitPrice.Value, num); eC_OrderPrintParameter.PrintParameter = SerializationHelper.Serialize(model); isWin = _eC_OrderPrintParameterDAL.UpdateModel(eC_OrderPrintParameter); var pay_TradingSingles = _pay_TradingSingleDAL.GetOrderByIds(eC_OrderBasic.Keyid.Value).FirstOrDefault() ; if (pay_TradingSingles != null) { pay_TradingSingles.TradingMoney = eC_OrderBasic.SumPrice.Value; pay_TradingSingles.PayableMoney = eC_OrderBasic.SumPrice.Value; isWin = _pay_TradingSingleDAL.UpdateModel(pay_TradingSingles); } return isWin; } } }