From eb07d0be014b11568d4263b470d46b5cd427fe9b Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期四, 17 七月 2025 08:49:45 +0800
Subject: [PATCH] 送货费用

---
 CY_ECommercePlatform/CY.SQLDAL/EC/EC_OrderBasicDAL.cs |  154 +++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 148 insertions(+), 6 deletions(-)

diff --git a/CY_ECommercePlatform/CY.SQLDAL/EC/EC_OrderBasicDAL.cs b/CY_ECommercePlatform/CY.SQLDAL/EC/EC_OrderBasicDAL.cs
index 2f41745..7ce51d2 100644
--- a/CY_ECommercePlatform/CY.SQLDAL/EC/EC_OrderBasicDAL.cs
+++ b/CY_ECommercePlatform/CY.SQLDAL/EC/EC_OrderBasicDAL.cs
@@ -714,6 +714,8 @@
                      new SqlParameter("@buyerId",DBNull.Value){SqlDbType=SqlDbType.UniqueIdentifier},
                      new SqlParameter("@DocumentName",DBNull.Value){SqlDbType=SqlDbType.VarChar,Size=50},
                      new SqlParameter("@Orderids",DBNull.Value){SqlDbType=SqlDbType.VarChar,Size=500},
+                       new SqlParameter("@WorkStates",DBNull.Value){SqlDbType=SqlDbType.VarChar,Size=500},
+                         new SqlParameter("@DeleverStates",DBNull.Value){SqlDbType=SqlDbType.VarChar,Size=500},
 
             };
 
@@ -798,9 +800,9 @@
                 }
             }
             /*鑾峰彇椤垫暟涓庤繑鍥炴暟鎹潯鏁�*/
-            int? resultValue = CY.Infrastructure.Common.MyConvert.ConvertToInt32(sqlParms[32].Value);
+            int? resultValue = CY.Infrastructure.Common.MyConvert.ConvertToInt32(sqlParms[34].Value);
             pagination.PageCount = resultValue.HasValue ? resultValue.Value : 0;
-            resultValue = CY.Infrastructure.Common.MyConvert.ConvertToInt32(sqlParms[33].Value);
+            resultValue = CY.Infrastructure.Common.MyConvert.ConvertToInt32(sqlParms[35].Value);
             pagination.RecordCount = resultValue.HasValue ? resultValue.Value : 0;
 
             return result;
@@ -1759,6 +1761,44 @@
             }
         }
 
+
+
+
+        /// <summary>
+        /// 淇敼璁㈠崟閫佽揣閲戦
+        /// </summary>
+        /// <param name="orderOperate">璁㈠崟鎿嶄綔</param>
+        /// <returns></returns>
+        internal bool UpdateOrderSonghuoJine(int OrderId,decimal? SonghuoJine)
+        {
+           
+            
+            _eC_OrderOperateDAL = null == _eC_OrderOperateDAL ? new EC_OrderOperateDAL(_dataBase) : _eC_OrderOperateDAL;
+            try
+            {
+
+                bool isWin = false;
+               
+
+                IList<SqlParameter> sqlParms = new List<SqlParameter>()
+                    {
+                            new SqlParameter("@orderId",OrderId),
+                            new SqlParameter("@SonghuoJine",SonghuoJine.HasValue?SonghuoJine.Value:0),
+                            
+                    };
+                string sql = "Update [EC_OrderExtend] Set [SonghuoJine]=@SonghuoJine  where [Keyid] =@orderId ";
+
+               
+                    _dataBase.ExecuteSql(sql, sqlParms.ToArray<SqlParameter>());
+   
+                return true;
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+        }
+
         /// <summary>
         /// 鏍规嵁鏂板璁㈠崟鎿嶄綔锛屽苟淇敼璁㈠崟鐘舵��
         /// </summary>
@@ -2075,7 +2115,7 @@
                 if (string.IsNullOrEmpty(Keyids))
                     return null;//閿欒鏁版嵁杩斾細绌� 
 
-                IList<EC_OrderBasic> result = _dataBase.SelectModel<EC_OrderBasic>("*", "EC_OrderBasic", string.Format(" Keyid in ({0}) and SellerId ='{1}' order by SellerOrderId DESC ", Keyids, FirmId)) as IList<EC_OrderBasic>;//鎵ц鏌ヨ
+                IList<EC_OrderBasic> result = _dataBase.SelectModel<EC_OrderBasic>("*", "EC_OrderBasic", string.Format(" Keyid in ({0})  order by SellerOrderId DESC ", Keyids)) as IList<EC_OrderBasic>;//鎵ц鏌ヨ and SellerId ='{1}' , FirmId
 
                 return result;//杩斿洖缁撴灉
             }
@@ -2624,7 +2664,8 @@
                         new SqlParameter(){ParameterName="@AppointCourierCompany",Value=awbInfo.AppointCourierCompany,SqlDbType=SqlDbType.VarChar,Size=50},
                         new SqlParameter(){ParameterName="@FetchAddress",Value=awbInfo.FetchAddress,SqlDbType=SqlDbType.VarChar,Size=200},
                         new SqlParameter(){ParameterName="@FetchContacts",Value=awbInfo.FetchContacts,SqlDbType=SqlDbType.VarChar,Size=50},
-                        new SqlParameter(){ParameterName="@FetchPhoneNum",Value=awbInfo.FetchPhoneNum,SqlDbType=SqlDbType.VarChar,Size=20}
+                        new SqlParameter(){ParameterName="@FetchPhoneNum",Value=awbInfo.FetchPhoneNum,SqlDbType=SqlDbType.VarChar,Size=20},
+                         new SqlParameter(){ParameterName="@SonghuoJine",Value=awbInfo.SonghuoJine.HasValue?awbInfo.SonghuoJine.Value:0,SqlDbType=SqlDbType.Money}
                     };
                     _dataBase.Query("sp_EC_AwbInfo_DeliverPresswork", CommandType.StoredProcedure, sqlParms.ToArray<SqlParameter>());
                     isWin = 1.Equals(sqlParms[0].Value);
@@ -2641,6 +2682,17 @@
                         else
                             ;
                         isWin = this.UpdateOrderStateUnit(awbInfo.Operate);//淇敼璁㈠崟鐘舵��
+                        if (!isWin)
+                            return false;
+                        else
+                            ;
+
+                        if(awbInfo.Operate.OperateType == 5)
+                            isWin = this.UpdateOrderSonghuoJine(awbInfo.Keyid.Value, awbInfo.SonghuoJine);//淇敼璁㈠崟鐘舵��
+                        else
+                        {
+                            isWin = this.UpdateOrderSonghuoJine(awbInfo.Keyid.Value, 0);//淇敼璁㈠崟鐘舵��
+                        }
                         if (!isWin)
                             return false;
                         else
@@ -2901,8 +2953,9 @@
         /// <param name="WorkStates"></param>
         /// <param name="OutOrderId"></param>
         /// <param name="RelationType"></param>
+        /// <param name="PayState"></param>
         /// <returns></returns>
-        public IEnumerable<EC_OrderBasic> 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)
+        public IEnumerable<EC_OrderBasic> 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)
         {
             try
             {
@@ -2913,6 +2966,9 @@
 
                 if (RelationType > 0)
                     condition += " and  b.RelationTypeId = '" + RelationType + "' ";
+                if (!string.IsNullOrEmpty(PayState))
+                    condition += " and  a.PayState = " + PayState + " ";
+                
 
                 if (StartCreatTime != null)
                     condition += " and  a.CreateTime >= '" + StartCreatTime.Value + "' ";
@@ -3181,7 +3237,7 @@
                 if (deliverorderId==null || deliverorderId.Equals(Guid.Empty))
                     return null;//閿欒鏁版嵁杩斾細绌� 
 
-                IList<EC_OrderBasic> result = _dataBase.SelectModel<EC_OrderBasic>(" ob.*,oe.shifouDelivery,oe.DeliveryOrderId,oe.Kaipiaoshenqing,oe.KaipiaoshenqingCreater,oe.KaipiaoshenqingTime,oe.KaipiaoquerenCreater,oe.KaipiaoquerenTime,oe.Kehuqianshou,oe.KehuqianshouCreater,oe.KehuqianshouTime   ,oe.Quchudingdan,oe.QuchudingdanCreater,oe.QuchudingdanTime,oe.PrintPackDeliveryRequir,oe.PrintNum,oe.ExigencyCaseId,pt.PrintName as PrintTypeName ", "EC_OrderBasic ob   Inner Join EC_OrderExtend as oe On ob.Keyid=oe.Keyid   Left Join SysInquiry_PrintingType as pt On(ob.PrintTypeId=pt.Keyid) ", string.Format(" oe.DeliveryOrderId = '{0}' and ob.SellerId ='{1}' order by SellerOrderId DESC ", deliverorderId, FirmId)) as IList<EC_OrderBasic>;//鎵ц鏌ヨ
+                IList<EC_OrderBasic> result = _dataBase.SelectModel<EC_OrderBasic>(" ob.*,oe.printunit,oe.shifouDelivery,oe.DeliveryOrderId,oe.Kaipiaoshenqing,oe.KaipiaoshenqingCreater,oe.KaipiaoshenqingTime,oe.KaipiaoquerenCreater,oe.KaipiaoquerenTime,oe.Kehuqianshou,oe.KehuqianshouCreater,oe.KehuqianshouTime   ,oe.Quchudingdan,oe.QuchudingdanCreater,oe.QuchudingdanTime,oe.PrintPackDeliveryRequir,oe.PrintNum,oe.ExigencyCaseId,pt.PrintName as PrintTypeName ", "EC_OrderBasic ob   Inner Join EC_OrderExtend as oe On ob.Keyid=oe.Keyid   Left Join SysInquiry_PrintingType as pt On(ob.PrintTypeId=pt.Keyid) ", string.Format(" oe.DeliveryOrderId = '{0}' and ob.SellerId ='{1}' order by SellerOrderId DESC ", deliverorderId, FirmId)) as IList<EC_OrderBasic>;//鎵ц鏌ヨ
 
                 return result;//杩斿洖缁撴灉
             }
@@ -3191,5 +3247,91 @@
             }
         }
 
+
+
+
+        /// <summary>
+        /// 鍒嗛〉鏌ヨ
+        /// </summary>
+        /// <param name="pagination"></param>
+        /// <param name="MemberId"></param>
+        /// <returns></returns>
+        public IEnumerable<Model.EC_OrderBasic> 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)
+        {
+            try
+            {
+                string condition = " 1=1 ";
+                if (MemberId != Guid.Empty)
+                {
+                    var originalGuid = MemberId;
+                    Guid reversedGuid = new Guid(originalGuid.ToByteArray().Reverse().ToArray());
+                    condition += " and ob.SellerId = '" + reversedGuid + "'";
+                }
+                  
+
+
+                if (!string.IsNullOrEmpty(BeginCreateTime))
+                    condition += string.Format(" and CAST(ob.CreateTime AS DATE) >='{0}'", BeginCreateTime);
+
+                if (!string.IsNullOrEmpty(EndCreateTime))
+                    condition += string.Format(" and CAST(ob.CreateTime AS DATE) <='{0}'", EndCreateTime);
+
+                if (!string.IsNullOrEmpty(SellerOrderId))
+                    condition += " and ob.SellerOrderId like '%" + SellerOrderId + "%'";
+
+                if (!string.IsNullOrEmpty(PrintTypeId))
+                {
+                    condition += " and ob.PrintTypeId = " + PrintTypeId + "";
+                }
+                if (!string.IsNullOrEmpty(BusinessManagerId))
+                {
+                    condition += " and oe.BusinessManagerId = " + BusinessManagerId + "";
+                }
+                if (!string.IsNullOrEmpty(Shejirenyuan))
+                {
+                    condition += " and ( oe.Shejirenyuan = " + Shejirenyuan + " or oe.Shejirenyuanneiye = " + Shejirenyuan + " )";
+                }
+                if (!string.IsNullOrEmpty(BuyerName))
+                    condition += " and ob.BuyerName like '%" + BuyerName + "%'";
+
+                if (!string.IsNullOrEmpty(DocumentName))
+                    condition += " and ob.DocumentName like '%" + DocumentName + "%'";
+
+                if (!string.IsNullOrEmpty(ShejiStatus))
+                {
+                    if(ShejiStatus == "1")
+                    {
+                        condition += " and oe.ShejiStatus = " + ShejiStatus + "";
+                    }
+                    else
+                    {
+                        condition += " and oe.ShejiStatus != 1 ";
+                    }
+                }
+
+                /// <summary>
+                /// 鏌ヨ鏉ユ簮
+                /// </summary>
+                string fromss = "  EC_OrderBasic as ob Inner Join [EC_OrderExtend]  as oe On ob.Keyid=oe.Keyid   Left Join SysInquiry_PrintingType as pt On(ob.PrintTypeId=pt.Keyid) " +
+
+
+                " where  " + condition;
+                var ssss = _dataBase.SelectModel<Model.EC_OrderBasic>("  sum(oe.[ShejiSumPrice]) as ShejiSumPrice,sum(oe.ShejiSumPriceneiye) as ShejiSumPriceneiye  ", fromss);
+                if (ssss.Count > 0)
+                {
+                    var aaaaa = ssss.First();
+                    pagination.heji1 = (aaaaa.ShejiSumPrice + aaaaa.ShejiSumPriceneiye)??0;
+                    
+                }
+
+
+                return _dataBase.SelectModelPage<Model.EC_OrderBasic>(pagination, " ob.*,oe.BusinessManagerId,oe.shifouDelivery,oe.IsPrintfengqian,oe.DeliveryOrderId,oe.KaipiaoshenqingCreater,oe.KaipiaoshenqingTime,oe.KaipiaoquerenCreater,oe.KaipiaoquerenTime,oe.Kehuqianshou,oe.KehuqianshouCreater,oe.KehuqianshouTime  ,oe.Quchudingdan,oe.QuchudingdanCreater,oe.QuchudingdanTime,oe.PrintPackDeliveryRequir,oe.PrintNum,oe.ExigencyCaseId,oe.Duiyinghetongbianhao,oe.[Shejirenyuan],oe.[Shejileixing] ,oe.[Danshuangmian],oe.[Shejirenyuanneiye],oe.[Shejileixingneiye],oe.[Danshuangmianneiye],oe.[Shejiyaoqiu],oe.[Shejiyaoqiuneiye],oe.[ShejirenyuanName],oe.[ShejirenyuanNameneiye],oe.[ShejiStatus],oe.[ShejileixingName],oe.[ShejileixingNameneiye],oe.[ShejiUnitPrice] ,oe.[ShejiSumPrice],oe.[ShejiUnitPriceneiye],oe.[ShejiSumPriceneiye] ,oe.[Shejicount],oe.[Shejicountneiye] ,pt.PrintName as PrintTypeName ", "  EC_OrderBasic as ob Inner Join [EC_OrderExtend]  as oe On ob.Keyid=oe.Keyid   Left Join SysInquiry_PrintingType as pt On(ob.PrintTypeId=pt.Keyid) ", " ob.CreateTime desc", " CreateTime desc ", condition);
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+        }
+
     }
 }

--
Gitblit v1.9.1