|
|
@@ -30,6 +30,7 @@ using NPOI.SS.Formula.Functions;
|
|
|
using System.Security.Cryptography;
|
|
|
using NHibernate.Hql.Ast;
|
|
|
using System.Security.Principal;
|
|
|
+using Microsoft.SqlServer.Server;
|
|
|
|
|
|
namespace SiteCore
|
|
|
{
|
|
|
@@ -3190,10 +3191,10 @@ namespace SiteCore
|
|
|
return;
|
|
|
}
|
|
|
int VipCustomer = 2;
|
|
|
-
|
|
|
+ string last_tid = "";
|
|
|
if (ceErpTrade.payment > 20)
|
|
|
{
|
|
|
- string sql = string.Format("SELECT count(*) as number FROM [dbo].[view_ErpTradeCell] WITH(NOLOCK) WHERE (buyer_nick = '{0}' or buyer_id = '{1}' ) and status = 'COMPLETE' and seller_nick = '{2}' and tid <> '{3}' AND end_time < '{4}' and IsSample = 0 and payment >= 20", ceErpTrade.buyer_nick, ceErpTrade.buyer_id, ceErpTrade.seller_nick, ceErpTrade.tid, ceErpTrade.pay_time);
|
|
|
+ string sql = string.Format("SELECT top 1 tid FROM [dbo].[view_ErpTradeCell] WITH(NOLOCK) WHERE (buyer_nick = '{0}' or buyer_id = '{1}' ) and status = 'COMPLETE' and seller_nick = '{2}' and tid <> '{3}' AND end_time < '{4}' and IsSample = 0 and payment >= 20 order by pay_time desc;", ceErpTrade.buyer_nick, ceErpTrade.buyer_id, ceErpTrade.seller_nick, ceErpTrade.tid, ceErpTrade.pay_time);
|
|
|
if (string.IsNullOrEmpty(ceErpTrade.buyer_nick))
|
|
|
{
|
|
|
sql = string.Format("SELECT tid FROM [dbo].[CE_ErpTrade] WITH(NOLOCK) WHERE (buyer_id = '{1}' ) and status = 'COMPLETE' and seller_nick = '{2}' and tid <> '{3}' AND end_time < '{4}' and payment >= 20", ceErpTrade.buyer_nick, ceErpTrade.buyer_id, ceErpTrade.seller_nick, ceErpTrade.tid, ceErpTrade.pay_time);
|
|
|
@@ -3201,15 +3202,18 @@ namespace SiteCore
|
|
|
DataTable dataTable = DbHelper.DbConn.ExecuteDataset(sql).Tables[0];
|
|
|
if (dataTable != null && dataTable.Rows.Count > 0)
|
|
|
{
|
|
|
- int count = Convert.ToInt32(dataTable.Rows[0]["number"]);
|
|
|
+ last_tid = dataTable.Rows[0]["tid"].ToString();
|
|
|
|
|
|
- if (count > 0)
|
|
|
+ if (!string.IsNullOrEmpty(last_tid))
|
|
|
{
|
|
|
VipCustomer = 1;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ if (VipCustomer == 1)
|
|
|
+ {
|
|
|
+ LogHelper.addLog(ceErpTrade.tid, 0, "老客户订单号:" + last_tid, Convert.ToInt32(OrderState.待设计));
|
|
|
+ }
|
|
|
DbHelper.DbConn.ExecuteNonQuery(string.Format("UPDATE [dbo].[CE_ErpTradeCell] set VipCustomer = {1} WHERE tid='{0}';", ceErpTrade.tid, VipCustomer));
|
|
|
|
|
|
return;
|