zhuyiyi 6 月之前
父节点
当前提交
e2b1deb77d
共有 4 个文件被更改,包括 108 次插入6 次删除
  1. 0 0
      SiteCore/Handler/sync.order.cs
  2. 100 0
      SiteCore/taobao/commonHelper.cs
  3. 1 1
      SiteCore/taobao/dataHelper.cs
  4. 7 5
      SiteCore/taobao/preSalesHelper.cs

文件差异内容过多而无法显示
+ 0 - 0
SiteCore/Handler/sync.order.cs


+ 100 - 0
SiteCore/taobao/commonHelper.cs

@@ -28,6 +28,7 @@ using NHibernate.Mapping;
 using System.Reflection.Emit;
 using NPOI.SS.Formula.Functions;
 using System.Security.Cryptography;
+using NHibernate.Hql.Ast;
 
 namespace SiteCore
 {
@@ -2937,5 +2938,104 @@ namespace SiteCore
             }
             return price;
         }
+
+        public static bool loginGetOrder(int userId)
+        {
+            DataTable dt = null;
+            try
+            {
+                dt = DbHelper.DbConn.ExecuteDataset(string.Format("select * from view_ErpUser where ID = {0}", userId)).Tables[0];
+            }
+            catch (Exception e)
+            {
+
+            }
+            if (dt == null || dt.Rows.Count == 0)
+            {
+                return false;
+            }
+
+            DataRow dr = dt.Rows[0];
+            int isOpen = Convert.ToInt32(dr["isOpen"]);
+            int dayOrderReceive = Convert.ToInt32(dr["DayOrderReceive"]);//已经派了多少
+            int dayOrderLimit = Convert.ToInt32(dr["DayOrderLimit"]);//总的能派多少
+            int orderAmountLimit = Convert.ToInt32(dr["OrderAmountLimit"]);//能派的金额多少
+            int oldOrder = Convert.ToInt32(dr["OldOrder"]);//能派的金额多少
+            string orgShop = dr["OrgShop"].ToString();
+            string pemShop = dr["pemShop"].ToString();
+            string pemDesign = dr["pemDesign"].ToString();
+
+            if (isOpen == 0)
+            {
+                return false;
+            }
+            if (string.IsNullOrEmpty(orgShop) || string.IsNullOrEmpty(pemShop) || string.IsNullOrEmpty(pemDesign))
+            {
+                return false;
+            }
+            string normolSql = string.Format("and payment <={0} and shopid in ({1}) and shopid in ({2}) and ProductId in ({3})", orderAmountLimit, orgShop, pemShop, pemDesign);
+            string orderSql = string.Format("select tid,ctid,IsOldCustomer,shopid,payment,ProductId from view_ErpTradeCell where orderstate=2 and productid<>0 and designuserid=0  and payment>0 and isrefund=0 and isDianziOrder = 0 {0} order by IsUrgency DESC, YEAR ( pay_time ), MONTH ( pay_time ), DAY ( pay_time ), payment DESC;", normolSql);
+            DataTable dataTable = DbHelper.DbConn.ExecuteDataset(orderSql).Tables[0];
+            if (dataTable == null || dataTable.Rows.Count == 0)
+            {
+                return true;
+            }
+            designApiResponseVo result = null;
+            List<string> list = new List<string>();
+            foreach (DataRow row in dataTable.Rows)
+            {
+                if (dayOrderReceive >= dayOrderLimit)
+                {
+                    break;
+                }
+                string IsOldCustomer = dr["IsOldCustomer"].ToString();
+                int ProductId = Convert.ToInt32(dr["ProductId"]);
+                CeErpShop ceErpShop = CeErpShop.Get(dr["shopid"]);
+                int shopUserId = 0;
+                if (ceErpShop != null)
+                {
+                    shopUserId = ceErpShop.UserID;
+                }
+                bool isIn = false;
+                if ((IsOldCustomer == "1" && shopUserId == 241) || (shopUserId == 241 && Convert.ToDouble(dr["payment"]) >= 500))
+                {
+                    if (oldOrder == 1)
+                    {
+                        //手绘   logo  画册 海报  宣传单
+                        if ((IsOldCustomer == "1" && (ProductId == 28 || ProductId == 57 || ProductId == 40 || ProductId == 4 || ProductId == 13)))
+                        {
+                            result = commonHelper.checkOrderListDesignInfo(dr["tid"].ToString(), dr["ctid"].ToString());
+                            if (result != null && result.code == 200)
+                            {
+                                continue;
+                            }
+                        }
+                        isIn = true;
+                    }
+                }
+                else
+                {
+                    if (oldOrder == 0)
+                    {
+                        if (shopUserId != 82)
+                        {
+                            result = commonHelper.checkOrderListDesignInfo(dr["tid"].ToString(), dr["ctid"].ToString());
+                            if (result != null && result.code == 200)
+                            {
+                                continue;
+                            }
+                        }
+                        isIn = true;
+                    }
+                }
+                if (isIn)
+                {
+                    DbHelper.DbConn.ExecuteNonQuery(string.Format("insert into CE_ErpTradeLog(tid,orderstate,userid,operatetime,con) select ctid,{1},{2},getdate(),'{3}' from ce_erptradecell where tid={0} and OrderState=2 and DesignUserId=0 ;", dr["tid"].ToString(), (int)OrderState.下单完成, userId, "3自动派单" + userId));
+                    int rowCount = DbHelper.DbConn.ExecuteNonQuery(string.Format("update CE_ErpTradeCell set OrderState=3,IsAutoDispatch=1,WaitDesignTime=getdate(),UpdateTime=getdate(),DesignUserId={0},DispatchSort=0 where tid={1} and OrderState=2 and DesignUserId=0", userId, dr["tid"].ToString()));
+                    dayOrderReceive += rowCount;
+                }
+            }
+            return true;
+        }
     }
 }

+ 1 - 1
SiteCore/taobao/dataHelper.cs

@@ -389,7 +389,7 @@ namespace SiteCore.Handler
         public static void api_orderBack(string orderNumber, string state, string content)
         {
             string post_url = "http://api.presales.lingtao8.com/open/order/orderProcessReturn";
-            //string post_url = "http://admin.lingtao.zmht888.com/prod-api/open/order/orderProcessReturn";
+           // string post_url = "http://admin.lingtao.zmht888.com/prod-api/open/order/orderProcessReturn";
             string remoteInfo = "";
             string param = JsonConvert.SerializeObject(new
             {

+ 7 - 5
SiteCore/taobao/preSalesHelper.cs

@@ -2382,9 +2382,11 @@ namespace SiteCore.Handler
             string spuId = GetPostString("spuId");
             string seller_memo = GetPostString("seller_memo");
             string otherMemo = GetPostString("otherMemo");
-            int shopId = GetPostInt("shopId");
-            int productId = GetPostInt("productId");
-            if (productId == 0 || shopId == 0)
+            string shopName = GetPostString("shopName");
+            string productId = GetPostString("productId");
+            CeErpProduct ceErpProduct = CeErpProduct.GetByName(productId);
+            CeErpShop ceErpShop = CeErpShop.GetShopIdByName(shopName);
+            if (ceErpProduct == null || ceErpShop == null)
             {
                 returnErrorMsg("商品id或者店铺id不全");
                 return;
@@ -2395,8 +2397,8 @@ namespace SiteCore.Handler
             ceErpTradeCell.ctid = orderNumber;
             ceErpTradeCell.seller_memo = seller_memo;
             ceErpTradeCell.OtherMemo = otherMemo;
-            ceErpTradeCell.ShopId = shopId;
-            ceErpTradeCell.ProductId = productId;
+            ceErpTradeCell.ShopId = ceErpShop.ID;
+            ceErpTradeCell.ProductId = ceErpProduct.ID;
             ceErpTradeCell.isDianziOrder = isDianziOrder;
             ceErpTradeCellExtend.spu_id = spuId;
             ceErpTradeCellExtend = commonHelper.sendSpuData(ceErpTradeCell, ceErpTradeCellExtend);

部分文件因为文件数量过多而无法显示