|
|
@@ -278,21 +278,24 @@ namespace SiteCore
|
|
|
{
|
|
|
//用昵称找之前的订单
|
|
|
string name = ceErpTrade.buyer_nick;
|
|
|
- StringBuilder CeErpTradeSql = new StringBuilder();
|
|
|
- CeErpTradeSql.AppendFormat("select top 1 * from ce_erptrade o left join CE_ErpTradeCell c on c.tid=o.tid where o.buyer_nick='{0}' and o.tid <> '{1}' and c.SupplierId <> 35 AND c.SupplierId <> 33 and c.SupplierId > 0 order by created desc;", name, trade.tid);
|
|
|
- DataSet data = DbHelper.DbConn.ExecuteDataset(CeErpTradeSql.ToString());
|
|
|
- DataTable datatable = data.Tables[0];
|
|
|
-
|
|
|
- if (datatable.Rows.Count > 0)
|
|
|
+ if (!string.IsNullOrEmpty(name))
|
|
|
{
|
|
|
- CeErpTradeCell oldOrder = CeErpTradeCell.GetByTid(datatable.Rows[0]["tid"].ToString());
|
|
|
+ StringBuilder CeErpTradeSql = new StringBuilder();
|
|
|
+ CeErpTradeSql.AppendFormat("select top 1 * from ce_erptrade o left join CE_ErpTradeCell c on c.tid=o.tid where o.buyer_nick='{0}' and o.tid <> '{1}' and c.SupplierId <> 35 AND c.SupplierId <> 33 and c.SupplierId > 0 order by created desc;", name, trade.tid);
|
|
|
+ DataSet data = DbHelper.DbConn.ExecuteDataset(CeErpTradeSql.ToString());
|
|
|
+ DataTable datatable = data.Tables[0];
|
|
|
|
|
|
- if (oldOrder != null)
|
|
|
+ if (datatable.Rows.Count > 0)
|
|
|
{
|
|
|
- CeErpSupplier ceErpSupplier = CeErpSupplier.Get(oldOrder.SupplierId);
|
|
|
- if (ceErpSupplier != null && ceErpSupplier.IsClose == 0)
|
|
|
+ CeErpTradeCell oldOrder = CeErpTradeCell.GetByTid(datatable.Rows[0]["tid"].ToString());
|
|
|
+
|
|
|
+ if (oldOrder != null)
|
|
|
{
|
|
|
- return oldOrder.SupplierId;
|
|
|
+ CeErpSupplier ceErpSupplier = CeErpSupplier.Get(oldOrder.SupplierId);
|
|
|
+ if (ceErpSupplier != null && ceErpSupplier.IsClose == 0)
|
|
|
+ {
|
|
|
+ return oldOrder.SupplierId;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -3103,7 +3106,7 @@ namespace SiteCore
|
|
|
|
|
|
}
|
|
|
//判断能不能推送
|
|
|
- designApiResponseVo result = commonHelper.checkOrderListDesignInfo(entity.tid, entity.ctid);
|
|
|
+ designApiResponseVo result = checkOrderListDesignInfo(entity.tid, entity.ctid);
|
|
|
if (result != null && result.code == 200)
|
|
|
{
|
|
|
designApiResponseVo response = designHelper.API_GetPrintData_CreateOrder(entity, "SysAdmin");
|
|
|
@@ -3114,9 +3117,9 @@ namespace SiteCore
|
|
|
{
|
|
|
if (entity.ctid.IndexOf("S_") == -1)
|
|
|
{
|
|
|
- int suid = commonHelper.autoDistributeToSupplier(entity); //自动分配供应商
|
|
|
+ int suid = autoDistributeToSupplier(entity); //自动分配供应商
|
|
|
entity.SupplierId = suid;
|
|
|
- string suname = commonHelper.getSupplierNameById(entity.SupplierId);
|
|
|
+ string suname = getSupplierNameById(entity.SupplierId);
|
|
|
LogHelper.addLog(entity.ctid, 0, "匹配供应商:" + suname, entity.OrderState);
|
|
|
}
|
|
|
|
|
|
@@ -3146,5 +3149,25 @@ namespace SiteCore
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
+
|
|
|
+ public static void checkIsVipOld(CeErpTrade ceErpTrade)
|
|
|
+ {
|
|
|
+ if (ceErpTrade == null)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ string sql = string.Format("SELECT count(*) as number FROM [dbo].[Ce_ErpTrade] WHERE (buyer_nick = '{0}' or buyer_id = '{1}' ) and status = 'COMPLETE' and seller_nick = '{2}'", ceErpTrade.buyer_nick, ceErpTrade.buyer_id, ceErpTrade.seller_nick);
|
|
|
+ DataTable dataTable = DbHelper.DbConn.ExecuteDataset(sql).Tables[0];
|
|
|
+ if (dataTable == null && dataTable.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ int count = Convert.ToInt16(dataTable.Rows[0]["number"]);
|
|
|
+ if (count > 0)
|
|
|
+ {
|
|
|
+ DbHelper.DbConn.ExecuteNonQuery(string.Format("UPDATE [dbo].[CE_ErpTradeCell] set VipCustomer = 1 WHERE tid='{0}';", ceErpTrade.tid));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
}
|