Browse Source

修改vip老客户

zhuyiyi 5 months ago
parent
commit
dfaf748aba

+ 11 - 0
BizCom/Dao/CeErpTradeCell.cs

@@ -1056,6 +1056,17 @@ namespace BizCom
         [Property]
         public DateTime? CheckedOrderTime { get; set; }
 
+        private int _vipCustomer;
+        /// <summary>
+        /// vip老客户
+        /// </summary>
+        [Property]
+        public int VipCustomer
+        {
+            get { return _vipCustomer; }
+            set { _vipCustomer = value; }
+        }
+
         public static CeErpTradeCell GetByTid(string tid)
         {
             return FindFirst(Expression.Sql(string.Format("this_.tid='{0}'", tid)));

File diff suppressed because it is too large
+ 1 - 1
SiteCore/Handler/sync.order.cs


+ 37 - 14
SiteCore/taobao/commonHelper.cs

@@ -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;
+        }
     }
 }

+ 3 - 1
SiteCore/taobao/preSalesHelper.cs

@@ -808,7 +808,7 @@ namespace SiteCore.Handler
                         returnErrorMsg("找不到订单");
                         return;
                     }
-                    if (ceErpTradeCell.OrderState > 5)
+                    if (ceErpTradeCell.OrderState > 5 || ceErpTradeCell.IsVerifyToSupplier)
                     {
                         returnErrorMsg("订单状态不正确");
                         return;
@@ -1617,6 +1617,8 @@ namespace SiteCore.Handler
                 List<Api_trade_info.bizOrderSplit> bizOrderSplit = bizOrder.bizOrderSplits;
                 callResult = createCellOrder(bizOrderSplit, trade, isCreate);
 
+                commonHelper.checkIsVipOld(trade);
+
                 if (!string.IsNullOrEmpty(bizOrder.weChatId) && !string.IsNullOrEmpty(bizOrder.phone))
                 {
                     string content = "[{\"title\":\"logo文件上传/模板截图/设计素材上传等等~\",\"type\":\"upload\",\"content\":" + bizOrder.designPics + "},{\"title\":\"需要设计的内容\",\"type\":\"input\",\"content\":\"" + bizOrder.designContent + "\"},{\"title\":\"手机号\",\"type\":\"input\",\"content\":\"" + bizOrder.phone + "\"},{\"title\":\"微信号\",\"type\":\"input\",\"content\":\"" + bizOrder.weChatId + "\"},{\"title\":\"请上传微信二维码\",\"type\":\"upload\",\"content\":" + bizOrder.weChatQrPics + "}]";

+ 5 - 3
SiteCore/taobao/tmcHelper.cs

@@ -1694,20 +1694,21 @@ namespace SiteCore
                     orderIdx = orderIdx + 1;
                 }
 
+
                 if (orderIdx > 2)
                 {
                     try
                     {
 
                         string sql_del = "delete from CE_ErpTradeCell where ctid='" + tid + "';";
-                        CeErpTradeCell.ExecuteNonQuery(sql_del.ToString());
                         LogHelper.addLog(tid, 0, "delete ctid=tid orderidx=" + orderIdx, 0);
                         if (System.Math.Abs(hePrice) > Convert.ToDecimal(0.01) && hePrice != Convert.ToDecimal(father.payment) && isHaveHebaoOrder == false)
                         {
-                            string sql_pay = "update CE_ErpTradeCell with(rowlock) set orderstate=0 where tid='" + tid + "';";
-                            CeErpTradeCell.ExecuteNonQuery(sql_pay.ToString());
+                            sql_del += "update CE_ErpTradeCell with(rowlock) set orderstate=0 where tid='" + tid + "';";
                             LogHelper.addLog(tid, 0, "拆分金额相加与总金额不等", 0);
                         }
+                        CeErpTradeCell.ExecuteNonQuery(sql_del);
+
                     }
                     catch (Exception ex)
                     {
@@ -1717,6 +1718,7 @@ namespace SiteCore
                     }
 
                 }
+                commonHelper.checkIsVipOld(father);
                 commonHelper.setSpuData(father);
                 //autoCell(tid);
             }

+ 1 - 0
Web/EOrder/OrderList.aspx

@@ -116,6 +116,7 @@
                 <div field="payment" width="40" align="center" headeralign="center">付款金额</div>
                 <div field="urgentCharge" width="40" align="center" headeralign="center">加急金额</div>
                 <div field="IsOldCustomer" visible="false" width="30" align="center" headeralign="center" renderer="oldRenderer">老客户</div>
+                <div field="VipCustomer" visible="false" width="30" align="center" headeralign="center" renderer="oldRenderer">VIP老客户</div>
                 <div field="seller_memo" width="150" align="center" headeralign="center" renderer="memoRenderer">备注</div>
                 <div field="OtherMemo" width="60" align="center" headeralign="center">额外备注</div>
                 <div field="OrderState" width="50" align="center" headeralign="center" renderer="orderStatusRenderer">状态</div>

+ 1 - 0
Web/MasterPage/ErpView.master

@@ -397,6 +397,7 @@
                 <label>老客户</label>
                 <select class="mini-combobox inp_middle" name="isoldcus" id="txtSearchOldCus">
                     <option value="">全部</option>
+                    <option value="2">VIP老客户</option>
                     <option value="1">老客户</option>
                     <option value="0">非老客户</option>
                 </select>

Some files were not shown because too many files changed in this diff