From f47da9571d16108fcab2bf6d55279a08ce2e7cbf Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期五, 15 十一月 2024 14:29:14 +0800
Subject: [PATCH] 计划订单相关功能

---
 CY_ECommercePlatform/CY.BLL/EC/EC_OrderBasicBLL.cs |   87 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 86 insertions(+), 1 deletions(-)

diff --git a/CY_ECommercePlatform/CY.BLL/EC/EC_OrderBasicBLL.cs b/CY_ECommercePlatform/CY.BLL/EC/EC_OrderBasicBLL.cs
index c6c67a2..6686e61 100644
--- a/CY_ECommercePlatform/CY.BLL/EC/EC_OrderBasicBLL.cs
+++ b/CY_ECommercePlatform/CY.BLL/EC/EC_OrderBasicBLL.cs
@@ -29,6 +29,9 @@
 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
 {
@@ -38,10 +41,11 @@
     public class EC_OrderBasicBLL
     {
         IEC_OrderBasicDAL _eC_OrderBasicDAL = null;
-
+        IEC_OrderPrintParameterDAL _eC_OrderPrintParameterDAL = 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;
         }
 
         /// <summary>
@@ -64,6 +68,17 @@
         public IEnumerable<EC_OrderBasic> SelectModelPage_Seller(Infrastructure.Query.Pagination pagination, Dictionary<int, object> searchParam)
         {
             return _eC_OrderBasicDAL.SelectModelPage_Seller(pagination, searchParam);
+        }
+
+
+        /// <summary>
+        /// 浣滀笟鏈�佽揣鍒嗛〉鏌ヨ
+        /// </summary>
+        /// <param name="pagination"></param>
+        /// <returns></returns>
+        public IEnumerable<EC_OrderBasic> 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);
         }
 
         /// <summary>
@@ -645,5 +660,75 @@
         {
             return _eC_OrderBasicDAL.GetEC_OrderBasicListBydeliverorderId(deliverorderId, FirmId);
         }
+
+
+        /// <summary>
+        /// 閲嶆柊璁$畻璁㈠崟鐨勯噾棰�
+        /// </summary>
+        /// <param name="orderOperate"></param>
+        /// <returns></returns>
+        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<CoreCmsPlanOrderItem>();
+
+            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);    
+
+            eC_OrderPrintParameter.PrintParameter = SerializationHelper.Serialize(model);
+            isWin = _eC_OrderPrintParameterDAL.UpdateModel(eC_OrderPrintParameter);
+
+
+
+            return isWin;
+        }
+
     }
 }

--
Gitblit v1.9.1