Просмотр исходного кода

新增配件领单,新增报价接口

zhuyiyi 1 неделя назад
Родитель
Сommit
22701a0735
4 измененных файлов с 283 добавлено и 47 удалено
  1. 1 1
      BizCom/Dao/CeErpTradeCell.cs
  2. 1 0
      SiteCore/Handler/sync.order.cs
  3. 66 43
      SiteCore/taobao/dataHelper.cs
  4. 215 3
      SiteCore/taobao/tmcHelper.cs

+ 1 - 1
BizCom/Dao/CeErpTradeCell.cs

@@ -415,7 +415,7 @@ namespace BizCom
 
 
         private int _isSample = 0;
         private int _isSample = 0;
         /// <summary>
         /// <summary>
-        ///是否为拿样订单
+        ///是否为拿样订单 1 物料 2 补差订单 3那样订单 4 配件
         /// </summary>
         /// </summary>
         [Property]
         [Property]
         public int IsSample
         public int IsSample

Разница между файлами не показана из-за своего большого размера
+ 1 - 0
SiteCore/Handler/sync.order.cs


+ 66 - 43
SiteCore/taobao/dataHelper.cs

@@ -31,6 +31,7 @@ using System.Text;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using System.Web;
 using System.Web;
 using System.Web.Routing;
 using System.Web.Routing;
+using System.Web.UI.WebControls;
 using Utils.Serialization;
 using Utils.Serialization;
 using static SiteCore.taoObj.dataShopResponseVo;
 using static SiteCore.taoObj.dataShopResponseVo;
 using static SiteCore.taoObj.dataSpuInfoResponseVo;
 using static SiteCore.taoObj.dataSpuInfoResponseVo;
@@ -391,61 +392,83 @@ namespace SiteCore.Handler
             if (!string.IsNullOrEmpty(data))
             if (!string.IsNullOrEmpty(data))
             {
             {
                 List<SysPriceResponseVo> list = JsonConvert.DeserializeObject<List<SysPriceResponseVo>>(data);
                 List<SysPriceResponseVo> list = JsonConvert.DeserializeObject<List<SysPriceResponseVo>>(data);
+                List<Dictionary<string, string>> message = new List<Dictionary<string, string>>();
                 foreach (SysPriceResponseVo item in list)
                 foreach (SysPriceResponseVo item in list)
                 {
                 {
-                    string ordersn = item.ordersn;
-                    double price = item.price;
-                    string sysPriceContent = item.sysContent;
-
-
-                    CeErpTradeCell ceErpTradeCell = CeErpTradeCell.GetByCode(ordersn);
-                    if (ceErpTradeCell == null)
-                    {
-                        ceErpTradeCell = CeErpTradeCell.GetByCtid(ordersn);
-                    }
-                    if (ceErpTradeCell == null)
+                    Dictionary<string, string> map = new Dictionary<string, string>();
+                    try
                     {
                     {
-                        returnErrorMsg("查无订单");
-                        return;
-                    }
-                    CeErpTradeCellExtend ce = CeErpTradeCellExtend.getByTid(ceErpTradeCell.ctid);
-                    if (ce == null)
-                    {
-                        ce = new CeErpTradeCellExtend();
-                        ce.ctid = ceErpTradeCell.ctid;
-                    }
-                    ce.sysPrice = price;
-                    ce.sysPriceContent = sysPriceContent;
+                        string ordersn = item.ordersn;
+                        double price = item.price;
+                        string sysPriceContent = item.sysContent;
+                        map.Add("ordersn", item.ordersn);
 
 
-                    string sql = string.Format("select ptid,payment from CE_ErpTradeCell where ptid ='{0}' and  IsSample = 2", ceErpTradeCell.tid);
-                    DataTable dt_price = DbHelper.DbConn.ExecuteDataset(sql).Tables[0];
-                    if (dt_price != null && dt_price.Rows.Count > 0)
-                    {
-                        double diffPirce = 0;
-                        foreach (DataRow dr in dt_price.Rows)
+                        CeErpTradeCell ceErpTradeCell = CeErpTradeCell.GetByCode(ordersn);
+                        if (ceErpTradeCell == null)
                         {
                         {
-                            if (Convert.IsDBNull(dr["payment"]))
+                            ceErpTradeCell = CeErpTradeCell.GetByCtid(ordersn);
+                        }
+                        if (ceErpTradeCell == null)
+                        {
+                            map.Add("message", "查无订单");
+                            message.Add(map);
+                            continue;
+                        }
+                        CeErpTradeCellExtend ce = CeErpTradeCellExtend.getByTid(ceErpTradeCell.ctid);
+                        if (ce == null)
+                        {
+                            ce = new CeErpTradeCellExtend();
+                            ce.ctid = ceErpTradeCell.ctid;
+                        }
+                        ce.sysPrice = price;
+                        ce.sysPriceContent = sysPriceContent;
+
+                        string sql = string.Format("select ptid,payment from CE_ErpTradeCell where ptid ='{0}' and  IsSample = 2", ceErpTradeCell.tid);
+                        DataTable dt_price = DbHelper.DbConn.ExecuteDataset(sql).Tables[0];
+                        if (dt_price != null && dt_price.Rows.Count > 0)
+                        {
+                            double diffPirce = 0;
+                            foreach (DataRow dr in dt_price.Rows)
                             {
                             {
-                                diffPirce += Convert.ToDouble(dr["payment"]);
+                                if (Convert.IsDBNull(dr["payment"]))
+                                {
+                                    diffPirce += Convert.ToDouble(dr["payment"]);
+                                }
                             }
                             }
+                            ce.differentAmount = diffPirce;
+                        }
+                        ce.sysDiffPrice = ce.differentAmount + ceErpTradeCell.payment - price;
+                        if (price != 0)
+                        {
+                            ce.sysPriceRate = Math.Round((ce.differentAmount + ceErpTradeCell.payment) / price * 100, 2);
+                        }
+                        if (ce.ID != 0)
+                        {
+                            ce.Update();
+                        }
+                        else
+                        {
+                            ce.Create();
                         }
                         }
-                        ce.differentAmount = diffPirce;
-                    }
-                    ce.sysDiffPrice = ce.differentAmount + ceErpTradeCell.payment - price;
-                    if (price != 0)
-                    {
-                        ce.sysPriceRate = Math.Round((ce.differentAmount + ceErpTradeCell.payment) / price * 100, 2);
-                    }
-                    if (ce.ID != 0)
-                    {
-                        ce.Update();
                     }
                     }
-                    else
+                    catch (Exception ex)
                     {
                     {
-                        ce.Create();
+                        map.Add("message", "系统错误");
+                        message.Add(map);
+                        XLog.SaveLog(0, "set_sys_price:" + JsonConvert.SerializeObject(map) + ":" + ex.Message);
+                        continue;
                     }
                     }
+
+
+                }
+                if (message.Count > 0)
+                {
+                    ReturnSuccess(JsonConvert.SerializeObject(message));
+                }
+                else
+                {
+                    returnSuccessMsg("修改成功!");
                 }
                 }
-                returnSuccessMsg("修改成功!");
                 return;
                 return;
             }
             }
 
 

+ 215 - 3
SiteCore/taobao/tmcHelper.cs

@@ -508,7 +508,15 @@ namespace SiteCore
 
 
                     List<string> list = new List<string>(acclist);
                     List<string> list = new List<string>(acclist);
                     string buyer_nick = "";
                     string buyer_nick = "";
-                    if ((trade.seller_memo.IndexOf("logo") != -1 || trade.seller_memo.IndexOf("LOGO") != -1))
+                    //配件-80x80mm-200张-卡片-yxmrebekah-甘露
+                    if (trade.seller_memo.StartsWith("配件-"))
+                    {
+                        if (list.Count > 4)
+                        {
+                            buyer_nick = list[4];
+                        }
+                    }
+                    else if ((trade.seller_memo.IndexOf("logo") != -1 || trade.seller_memo.IndexOf("LOGO") != -1))
                     {
                     {
                         if (list.Count > 3)
                         if (list.Count > 3)
                         {
                         {
@@ -731,7 +739,7 @@ namespace SiteCore
                     {
                     {
                         order.spu_id = item.refSpuId;
                         order.spu_id = item.refSpuId;
                     }
                     }
-                    List<string> standards_list = new List<string>() { "现货", "封酒贴", "兔团团", "帆布", "手拉旗", "kt", "条幅", "臂贴","挂画" };
+                    List<string> standards_list = new List<string>() { "现货", "封酒贴", "兔团团", "帆布", "手拉旗", "kt", "条幅", "臂贴", "挂画" };
                     bool isInList = false;
                     bool isInList = false;
                     foreach (string text in standards_list)
                     foreach (string text in standards_list)
                     {
                     {
@@ -1685,7 +1693,11 @@ namespace SiteCore
                         //    createDianziCell(isMulity, orderIdx, item, father, ref hePrice, memoList.Length);
                         //    createDianziCell(isMulity, orderIdx, item, father, ref hePrice, memoList.Length);
                         //}
                         //}
                         //else
                         //else
-                        if (item.IndexOf("logo") != -1 || item.IndexOf("LOGO") != -1)
+                        if (item.StartsWith("配件-"))
+                        {
+                            createPJCell(isMulity, orderIdx, item, father, ref hePrice, memoList.Length);
+                        }
+                        else if (item.IndexOf("logo") != -1 || item.IndexOf("LOGO") != -1)
                         {
                         {
                             createLogoCell(isMulity, orderIdx, item, father, ref hePrice, memoList.Length);
                             createLogoCell(isMulity, orderIdx, item, father, ref hePrice, memoList.Length);
                         }
                         }
@@ -1698,7 +1710,9 @@ namespace SiteCore
                             createSmallGiftCell(isMulity, orderIdx, item, father, ref hePrice, memoList.Length);
                             createSmallGiftCell(isMulity, orderIdx, item, father, ref hePrice, memoList.Length);
                         }
                         }
                         else
                         else
+                        {
                             createNotHeBaoCell(isMulity, orderIdx, item, father, ref hePrice, memoList.Length);
                             createNotHeBaoCell(isMulity, orderIdx, item, father, ref hePrice, memoList.Length);
+                        }
                         orderIdx = orderIdx + 1;
                         orderIdx = orderIdx + 1;
                     }
                     }
                 }
                 }
@@ -2277,6 +2291,204 @@ namespace SiteCore
 
 
         }
         }
 
 
+        public static void createPJCell(bool isMulty, int orderIndex, string itemMemo, CeErpTrade father, ref decimal hePrice, int totalCount)
+        {
+            if (itemMemo.Length <= 0) return;
+
+            string ctid = "";
+            string splitTag = "";
+            if (isMulty && itemMemo.Length > 2)
+            {
+                string preStr = "C" + orderIndex + "_";
+                ctid = preStr + father.tid;
+                splitTag = "C" + orderIndex;
+            }
+            else if (itemMemo.Length > 2)
+            {
+                ctid = father.tid;
+            }
+            CeErpTradeCell entity = null;
+            entity = CeErpTradeCell.GetByCtid(ctid);
+            bool isNull = false;
+            if (entity == null)
+            {
+                entity = new CeErpTradeCell();
+                isNull = true;
+                entity.ctid = ctid;
+                //唯一标识
+                entity.OrderSn = ctid;
+                string orderSn = commonHelper.generateDateTimeRandomNos();
+                if (orderSn != "")
+                {
+                    entity.OrderSn = orderSn;
+                }
+            }
+            entity.UpdateTime = DateTime.Now;
+            entity.tid = father.tid;
+            entity.SplitTag = splitTag;
+            if (entity.ShopId == 0)
+            {
+                CeErpShop nShop = CeErpShop.GetShopIdByName(father.seller_nick);
+                int shopId = 0;
+                if (nShop != null)
+                {
+                    shopId = nShop.ID;
+                }
+                entity.ShopId = shopId;
+            }
+
+            entity.IsSample = 4;
+            entity.SupplierId = Convert.ToInt32(webConfig.SampleOrderSupplier);
+
+            entity.isDianziOrder = 0;
+
+            string[] acclist = itemMemo.Split('-');
+            //配件-80x80mm-200张-卡片-甘露
+            if (acclist.Length <= 4) return;
+            //string count = acclist[0];
+            string product = acclist[3];
+            string account = acclist[4];
+            DataRow cusInfo = getUserInfoByAccount(account);
+            if (cusInfo != null)
+            {
+                entity.CustomerUserId = Convert.ToInt32(cusInfo["ID"]);
+                if (entity.OrderState > 6)
+                {
+
+                }
+                else
+                {
+                    entity.OrderState = Convert.ToInt32(OrderState.设计完成);
+                }
+            }
+            entity.ProductId = getProductIdByName(product);
+            if (entity.ProductId == 0)
+            {
+                return;
+            }
+
+            if (isMulty)
+            {
+                try
+                {
+                    
+                    string strPrice = acclist[5];
+                    if (strPrice.IndexOf("元") != -1)
+                    {
+                        strPrice = strPrice.Replace("元", "");
+                    }
+                    entity.payment = Convert.ToDouble(strPrice);
+                    hePrice = hePrice - Convert.ToDecimal(strPrice);
+                }
+                catch (Exception ex)
+                {
+                    //XLog.SaveLog(0, "createDianziCell,payment=acclist[4]" + "|" + ex.Message);
+                }
+            }
+            else
+            {
+                entity.payment = Convert.ToDouble(father.payment);
+                entity.AfterSalePayment = Convert.ToDouble(father.payment);
+            }
+            string newmemo = "(" + entity.OrderSn + ")-";
+            string newOtherMemo = "";
+            List<string> list = new List<string>();
+            for (int i = 0; i < acclist.Length; i++)
+            {
+                //配件-80x80mm-200张-卡片-甘露
+                if (i == 4) continue;
+                if (isMulty)
+                {
+                    if (i == 5) continue;
+                }
+                list.Add(acclist[i]);
+            }
+            newmemo += string.Join("-", list);
+            string sName = getShopSNameByName(father.seller_nick);//获取店铺简称
+            newmemo += ("-" + sName);
+            if (father.buyer_nick.IndexOf("*") < 0)
+            {
+                newmemo += ("-" + father.buyer_nick);
+            }
+            newmemo += ("-" + father.receiver_state);
+            if (cusInfo != null)
+            {
+                newmemo += ("-" + Convert.ToString(cusInfo["Tb"]));
+            }
+            if (isMulty)
+            {
+                newmemo += "-[C" + totalCount + "+" + orderIndex + "]";
+            }
+            if (itemMemo.IndexOf("顺丰到付") != -1)
+            {
+                if (newmemo.IndexOf("顺丰到付") == -1)
+                    newmemo += ("-顺丰到付");
+                entity.IsSF = 2;
+                LogHelper.addLog(entity.ctid, entity.CustomerUserId, "顺丰到付", entity.OrderState);
+            }
+            else if (itemMemo.IndexOf("顺丰寄付") != -1)
+            {
+                if (newmemo.IndexOf("顺丰寄付") == -1)
+                    newmemo += ("-顺丰寄付");
+                entity.IsSF = 1;
+                LogHelper.addLog(entity.ctid, entity.CustomerUserId, "顺丰寄付", entity.OrderState);
+            }
+            if (itemMemo.IndexOf("加急") != -1)
+            {
+                if (newmemo.IndexOf("加急") == -1)
+                    newmemo += ("-加急");
+                entity.IsUrgency = true;
+                LogHelper.addLog(entity.ctid, entity.CustomerUserId, "加急", entity.OrderState);
+            }
+            entity.seller_memo = newmemo;
+            entity.OtherMemo = newOtherMemo;
+            entity.pay_time = father.pay_time;
+            entity.DesignUserId = Convert.ToInt32(webConfig.PlaceDesigner_id); //下单员
+            LogHelper.addLog(entity.ctid, 0, "配件单指派到下单部" + entity.DesignUserId, entity.OrderState);
+            entity.FinishDesignTime = DateTime.Now;
+            entity.StartDesignTime = DateTime.Now;
+            entity.WaitDesignTime = DateTime.Now;
+            entity.IsOldCustomer = 0;
+            int oldRes = isOldAndInsertCustomerInfo(father, entity);
+            if (oldRes > 0)
+            {
+                entity.IsOldCustomer = 1;
+                if (oldRes == 2)
+                {
+                    entity.IsOldCustomer = 1;
+                    entity.IsOldCustomerMore = 1;
+                }
+            }
+            if ((father.receiver_state.Contains("台湾") && string.IsNullOrEmpty(father.receiver_zip)) || entity.seller_memo.IndexOf("不要切单个") > -1 || commonHelper.isFarAddress(father.receiver_state))
+            {
+                entity.OrderState = -1;
+                entity.DesignUserId = 0;
+                entity.WaitDesignTime = null;
+            }
+            if (entity.ProductId > 0)
+            {
+                CeErpProduct ceErpProduct = CeErpProduct.GetById(entity.ProductId);
+                if (ceErpProduct.CreateTime != null && DateTime.Compare(ceErpProduct.CreateTime, DateTime.Now.AddDays(-90)) > 0)
+                {
+                    entity.NewProduct = 1;
+                }
+            }
+            if (isNull)
+            {
+                father.create_time = DateTime.Now;
+                father.Update();
+                entity.Create();
+                CeErpTradeCellExtend.createInfo(entity.ctid, 10, 10);
+            }
+            else
+            {
+                entity.Update();
+            }
+            //dataHelper.sendErpTradeCellInfo(new dataSendTradeCellBean(entity, father));
+            CeErpSukuraData.createInfo(entity.ctid, 1);
+            LogHelper.addLog(entity.ctid, entity.CustomerUserId, "配件推送生成" + entity.seller_memo, entity.OrderState);
+
+        }
         public static void createDemoCell(bool isMulty, int orderIndex, string itemMemo, CeErpTrade father, ref decimal hePrice, int totalCount)
         public static void createDemoCell(bool isMulty, int orderIndex, string itemMemo, CeErpTrade father, ref decimal hePrice, int totalCount)
         {
         {
             if (itemMemo.Length <= 0) return;
             if (itemMemo.Length <= 0) return;

Некоторые файлы не были показаны из-за большого количества измененных файлов