From a980cd04341d71216e0f59bd4b7327fe9fc50032 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期三, 21 五月 2025 11:41:46 +0800
Subject: [PATCH] 提交

---
 CY_ECommercePlatform/CY.SQLDAL/EC/EC_OrderBasicDAL.cs |  175 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 166 insertions(+), 9 deletions(-)

diff --git a/CY_ECommercePlatform/CY.SQLDAL/EC/EC_OrderBasicDAL.cs b/CY_ECommercePlatform/CY.SQLDAL/EC/EC_OrderBasicDAL.cs
index bbf428f..690d966 100644
--- a/CY_ECommercePlatform/CY.SQLDAL/EC/EC_OrderBasicDAL.cs
+++ b/CY_ECommercePlatform/CY.SQLDAL/EC/EC_OrderBasicDAL.cs
@@ -293,6 +293,31 @@
         }
 
         /// <summary>
+        /// 鍒犻櫎澶栧崗璁㈠崟
+        /// </summary>
+        /// <param name="OrderId"></param>
+        /// <returns></returns>
+        public bool UpdateOldOrderSurplusPrintNum(int OrderId)
+        {
+            IList<SqlParameter> sqlParms = new List<SqlParameter>()
+            {
+                new SqlParameter("@Keyid",OrderId)
+            };
+            string sql = " Update [EC_OrderExtend] Set [SurplusPrintNum]=[PrintNum]   where [Keyid] = (select [OrderId] from [OA_OrderWorkListRelation] where [RelationTargetId] = @Keyid and [RelationTypeId]=4 )  ;Update [EC_OrderBasic] Set [OrderState]=2   where [Keyid] = (select [OrderId] from [OA_OrderWorkListRelation] where [RelationTargetId] = @Keyid and [RelationTypeId]=4 )   ";
+
+            try
+            {
+                _dataBase.ExecuteSql(sql, sqlParms.ToArray<SqlParameter>());
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+            return true;
+        }
+       
+
+        /// <summary>
         /// 鍒嗛〉鏌ヨ
         /// </summary>
         /// <param name="query">鏌ヨ瀵硅薄</param>
@@ -688,7 +713,10 @@
                      new SqlParameter("@KaipiaoshenqingId",DBNull.Value){SqlDbType=SqlDbType.UniqueIdentifier},
                      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},
+
             };
 
             /*
@@ -772,9 +800,9 @@
                 }
             }
             /*鑾峰彇椤垫暟涓庤繑鍥炴暟鎹潯鏁�*/
-            int? resultValue = CY.Infrastructure.Common.MyConvert.ConvertToInt32(sqlParms[31].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[32].Value);
+            resultValue = CY.Infrastructure.Common.MyConvert.ConvertToInt32(sqlParms[35].Value);
             pagination.RecordCount = resultValue.HasValue ? resultValue.Value : 0;
 
             return result;
@@ -1027,7 +1055,9 @@
                 new SqlParameter("@businessManager",DBNull.Value){SqlDbType=SqlDbType.Int},
                 new SqlParameter("@payType",DBNull.Value){SqlDbType=SqlDbType.VarChar,Size=20},
                 new SqlParameter("@returnvisit",DBNull.Value){SqlDbType=SqlDbType.VarChar,Size=20},
-                 new SqlParameter("@appraise",DBNull.Value){SqlDbType=SqlDbType.VarChar,Size=20}
+                 new SqlParameter("@appraise",DBNull.Value){SqlDbType=SqlDbType.VarChar,Size=20},
+                  new SqlParameter("@Orderids",DBNull.Value){SqlDbType=SqlDbType.VarChar,Size=500}
+                 
             };
 
             /*
@@ -1094,9 +1124,9 @@
                 }
             }
             /*鑾峰彇椤垫暟涓庤繑鍥炴暟鎹潯鏁�*/
-            int? resultValue = CY.Infrastructure.Common.MyConvert.ConvertToInt32(sqlParms[19].Value);
+            int? resultValue = CY.Infrastructure.Common.MyConvert.ConvertToInt32(sqlParms[20].Value);
             pagination.PageCount = resultValue.HasValue ? resultValue.Value : 0;
-            resultValue = CY.Infrastructure.Common.MyConvert.ConvertToInt32(sqlParms[20].Value);
+            resultValue = CY.Infrastructure.Common.MyConvert.ConvertToInt32(sqlParms[21].Value);
             pagination.RecordCount = resultValue.HasValue ? resultValue.Value : 0;
 
             return result;
@@ -1920,6 +1950,59 @@
 
         }
 
+
+
+        /// <summary>
+        /// 鏀舵(绾夸笅杞处銆佺幇閲�)
+        /// </summary>
+        /// <param name="orderId">璁㈠崟缂栧彿</param>
+        /// <param name="firmAccountRecord">鎿嶄綔璁板綍</param>
+        /// <returns></returns>
+        public bool ReceiveMoneyToQueren(int orderId, OA_FirmAccountRecord firmAccountRecord)
+        {
+            bool isWin = false;
+            if (0 >= orderId  || !firmAccountRecord.Money.HasValue)
+                return false;
+            else
+                ;
+            if ( 0 > firmAccountRecord.Money.Value)
+                return false;
+            else
+                ;
+            try
+            {
+                OA_FirmAccountRecordDAL oA_FirmAccountRecordDAL = new OA_FirmAccountRecordDAL(_dataBase);
+                using (TransactionScope tran = new TransactionScope())
+                {
+                    
+
+                    //鏇存柊璁㈠崟鏀粯閲戦
+                    isWin = this.UpdateOrderPayedMoney(orderId, -1, firmAccountRecord.Money.Value);
+                    if (!isWin)
+                    {
+                        return isWin;
+                    }
+                    else
+                        ;
+                    //鏇存柊璁㈠崟鐘舵��
+                    isWin = this.UpdateOrderPayState(orderId);
+                    if (!isWin)
+                    {
+                        return isWin;
+                    }
+                    else
+                        ;
+                    tran.Complete();
+                }
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+            return isWin;
+
+        }
+
         /// <summary>
         /// 鏀舵(澶栧崗棰勪粯娆俱�佸鎴烽浠樻)
         /// </summary>
@@ -1994,7 +2077,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;//杩斿洖缁撴灉
             }
@@ -2820,8 +2903,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
             {
@@ -2832,6 +2916,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 + "' ";
@@ -3100,7 +3187,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;//杩斿洖缁撴灉
             }
@@ -3110,5 +3197,75 @@
             }
         }
 
+
+
+
+        /// <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 ";
+                    }
+                }
+
+                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