Exemplo n.º 1
0
        public void ComparePrice()
        {
            ReadPlatFormWebPageValue flatform = new ReadPlatFormWebPageValue();
            BaseReadWebPage          res      = new BaseReadWebPage();
            BaseReadWebPage          target   = new BaseReadWebPage();

            target.ReadBaseItemInfo("YaoTu/YaoTu636500822100643979.csv", true);
            res.ReadBaseItemInfo("YaoTu/Plateform636500822100643979.csv", true);

            foreach (BaseItemInfo item in target.ShopAllItems.Values)
            {
                foreach (BaseItemInfo platformItem in res.ShopAllItems.Values)
                {
                    if ((item.Name == platformItem.Name && item.Created == platformItem.Created))
                    {
                        if (CommonFun.IsSameFormat(platformItem.Format, item.Format, platformItem.Name, item.Name))
                        {
                            //浏览量对比
                            //if (!string.IsNullOrEmpty(platformItem.ViewCount) && Convert.ToInt32(platformItem.ViewCount) >= 500)
                            //{

                            if (platformItem.ShopSelaPrice * (decimal)0.75 >= item.ShopPrice)
                            {
                                item.ID            = platformItem.ID;
                                item.ShopSelaPrice = platformItem.ShopSelaPrice;
                                item.Type          = platformItem.Type;
                                item.ViewCount     = platformItem.ViewCount;

                                CommonFun.WriteCSV("YaoTu/25%_" + ticks + ".csv", item);
                            }
                            else if (platformItem.ShopSelaPrice * (decimal)0.8 >= item.ShopPrice)
                            {
                                item.ID            = platformItem.ID;
                                item.ShopSelaPrice = platformItem.ShopSelaPrice;
                                item.Type          = platformItem.Type;
                                item.ViewCount     = platformItem.ViewCount;

                                CommonFun.WriteCSV("YaoTu/20%_" + ticks + ".csv", item);
                            }
                            else if (platformItem.ShopSelaPrice * (decimal)0.85 >= item.ShopPrice)
                            {
                                item.ID            = platformItem.ID;
                                item.ShopSelaPrice = platformItem.ShopSelaPrice;
                                item.Type          = platformItem.Type;
                                item.ViewCount     = platformItem.ViewCount;

                                CommonFun.WriteCSV("YaoTu/15%_" + ticks + ".csv", item);
                            }
                            //}
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        public override void Start()
        {
            try
            {
                ticks = DateTime.Now.Ticks;

                base.Start();

                //对比数据
                ReadPlatFormWebPageValue flatform = new ReadPlatFormWebPageValue();

                int totalCount = ShopAllItems.Count, curCount = 0;
                foreach (KeyValuePair <string, BaseItemInfo> info in ShopAllItems)
                {
                    try
                    {
                        Console.WriteLine("{0},totalCount:{1}, curCount:{2}", DateTime.Now.ToString(), totalCount, ++curCount);

                        if ((DateTime.Now - startTime).TotalMinutes > 30)
                        {
                            //Login();
                            flatform.Login();
                            startTime = DateTime.Now;
                        }


                        BaseItemInfo item = info.Value;

                        string key = item.Name + item.Format + item.Created;

                        string seachInfo = item.ID;

                        //查找该商品
                        if (!seachedItemID.ContainsKey(seachInfo))
                        {
                            seachedItemID.Add(seachInfo, item.Name);

                            List <BaseItemInfo> item_list = flatform.SeachInfoByID(seachInfo);

                            if (item_list.Count > 0)
                            {
                                //seachItemList[seachInfo] = item_list;
                                seachItemList.Add(seachInfo, item_list);
                            }
                            else
                            {
                                Console.WriteLine("not seach items id:{0}", seachInfo);
                            }
                        }

                        if (seachItemList.ContainsKey(seachInfo))
                        {
                            List <BaseItemInfo> compareItems = seachItemList[seachInfo];
                            bool isExist = false;
                            foreach (BaseItemInfo compareItem in compareItems)
                            {
                                if (CommonFun.IsSameFormat(item.Format, compareItem.Format, item.Name, compareItem.Name))
                                {
                                    ComparePrice(compareItem, item);
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 数据对比
        /// </summary>
        public void Compare()
        {
            ReadPlatFormWebPageValue flatform = new ReadPlatFormWebPageValue();
            BaseReadWebPage          platform = new BaseReadWebPage();
            BaseReadWebPage          shop     = new BaseReadWebPage();

            platform.ReadBaseItemInfo("Platform/Platform636488666326049889.csv", true);
            shop.ReadBaseItemInfo("TYaoFang/NotIsEixst636493584245833259.csv", true);

            foreach (BaseItemInfo item in shop.ShopAllItems.Values)
            {
                bool   isEixst  = false;
                string itemName = item.Name;

                if (item.Name.Contains("】"))
                {
                    int itemNameIndex = item.Name.LastIndexOf("】") + 1;
                    itemName = item.Name.Substring(itemNameIndex, item.Name.Length - itemNameIndex);
                }

                if (itemName.Contains("("))
                {
                    int itemNameIndex = itemName.IndexOf('(');

                    itemName = itemName.Substring(0, itemNameIndex);
                }

                foreach (BaseItemInfo platformItem in platform.ShopAllItems.Values)
                {
                    bool isSame = false;
                    if (!string.IsNullOrEmpty(item.ID) && !string.IsNullOrEmpty(platformItem.ID))
                    {
                        if (item.ID.Trim() == platformItem.ID.Trim())
                        {
                            isSame = true;
                        }
                    }


                    if (isSame || (itemName == platformItem.Name && item.Created == platformItem.Created))
                    {
                        if (CommonFun.IsSameFormat(platformItem.Format, item.Format, platformItem.Name, item.Name))
                        {
                            isEixst = true;
                            if (ComparePrice(platformItem, item))
                            {
                                break;
                            }
                        }
                    }
                }

                //if (!isEixst)
                //{
                //    List<BaseItemInfo> seachItems = flatform.SeachInfoByID(item.ID);

                //    Dictionary<string, BaseItemInfo> saveInfos = new Dictionary<string, BaseItemInfo>();

                //    foreach (BaseItemInfo info in seachItems)
                //    {
                //        string key = info.Name + info.Format + info.Created;

                //        if (!platform.ShopAllItems.ContainsKey(key))
                //        {
                //            if (item.ID == info.ID || (itemName == info.Name && item.Created == info.Created))
                //            {
                //                if (CommonFun.IsSameFormat(info.Format, item.Format, info.Name, item.Name))
                //                {
                //                    isEixst = true;
                //                    ComparePrice(info, item);
                //                }
                //            }

                //            platform.ShopAllItems.Add(key, info);
                //            saveInfos.Add(key, info);
                //        }
                //        else if (platform.ShopAllItems[key].ShopSelaPrice > info.ShopSelaPrice)
                //        {
                //            if (item.ID == info.ID || (itemName == info.Name && item.Created == info.Created))
                //            {
                //                if (CommonFun.IsSameFormat(info.Format, item.Format, info.Name, item.Name))
                //                {
                //                    isEixst = true;
                //                    ComparePrice(info, item);
                //                }
                //            }

                //            platform.ShopAllItems[key] = info;
                //            saveInfos[key] = info;
                //        }
                //    }

                //    foreach (BaseItemInfo saveInfo in saveInfos.Values)
                //    {
                //        CommonFun.WriteCSV("Platform/Platform636488666326049889.csv", saveInfo);
                //    }
                //}

                if (!isEixst)
                {
                    CommonFun.WriteCSV("TYaoFang/NotIsEixst" + tick + ".csv", item);
                }
            }
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            try
            {
                #region 填充表格
                //FillFiled();
                #endregion
                #region 药途网
                ReadYaoTuWebPage yaoTuRead = new ReadYaoTuWebPage();
                //yaoTuRead.Start();
                //yaoTuRead.ComparePrice();
                #endregion

                #region 药房网数据提取操作
                ReadPlatFormWebPageValue readPlatform = new ReadPlatFormWebPageValue();
                //readPlatform.Test();
                //readPlatform.Start();
                readPlatform.UpdatePrice();
                //readPlatform.OptOrder();
                //readPlatform.OptWaitingSend();
                //readPlatform.GetGoodsSales();
                //readPlatform.GetStateInfoToXLS();
                #endregion

                #region tk上架操作
                ReadTKWebPageValue tkRead = new ReadTKWebPageValue();
                //tkRead.ReUpItems("TK/reup636663235433244307.csv");
                //tkRead.UpdatePriceAndDown();
                //tkRead.Test();
                //tkRead.ReadAllMenuURL();
                //tkRead.StartAutoGetOrder();
                //tkRead.Start();
                //tkRead.DownNoMoneyItem();
                //tkRead.UpNewByCSV();
                //tkRead.UpAllItem();
                //tkRead.Compare("Platform/Platform636523829470669326.csv", "TK/NotIsEixst636525934878630989.csv", "TK", true);
                //tkRead.ReadAllItem();
                //tkRead.ProcessOrder();
                //tkRead.GetOrderDetail();
                //TKUpdate update = new TKUpdate();
                //update.UpdateInventory();
                //update.UpAllNewItme();
                //update.ReUpItemByCSV("TKAdmin/down_reUp.csv");
                //update.StartAutoGetOrder();
                //update.GetDownListItem();
                //update.DownItem();
                //update.ReadeAllSellingItme();
                //update.Login();
                //CommonFun.Compare("Platform/Platform636488666326049889.csv", "TKAdmin/NotEixst.csv", "TKAdmin");
                //update.CarepareAndUpItem();
                #endregion

                #region 12药房数据提取操作
                T12YaoReadWebPage _12YaoRead = new T12YaoReadWebPage();
                // _12YaoRead.Compare();
                // _12YaoRead.Start();
                //_12YaoRead.UpNewItem();
                #endregion

                #region 鸿安数据提取操作
                HAReadWebPage haRead = new HAReadWebPage();
                //haRead.Compare(null, "HA/HA636510181846753529.csv", "HA");
                //haRead.GetAllItem();
                #endregion

                #region 1药网
                //string menuIndex = Console.ReadLine();
                YiYaoWebRead yiYaoread = new YiYaoWebRead();
                //yiYaoread.DownDoubleItems();
                //yiYaoread.SyncYFItems();
                //yiYaoread.GetSellingItem("1601910842", DateTime.Now);
                //yiYaoread.Start();
                //yiYaoread.GetOrderDetail();
                //yiYaoread.UpdatePrice();
                //yiYaoread.Test();
                //yiYaoread.MenuIndex = Convert.ToInt32(menuIndex);
                //yiYaoread.Start();
                //yiYaoread.Compare("Platform/Platform636523829470669326.csv", "YiYao/YiYao636519686372752317_0.csv", "YiYao");
                #endregion

                #region 八百方
                EightHundredF eHFRead = new EightHundredF();
                //eHFRead.Test();
                //eHFRead.Start();
                //eHFRead.Compare();
                #endregion

                # region 七乐
                QLReadWebPage qlRead = new QLReadWebPage();
                //qlRead.Start();
                //qlRead.Login();
                //qlRead.Test();
                #endregion

                #region 315
                T315ReadWebPage threeOneFive = new T315ReadWebPage();
                //threeOneFive.GetItemInfo();
                //threeOneFive.Start();
                //threeOneFive.Test();
                //threeOneFive.NoticeUserPay();
                #endregion

                #region 库存同步
                //CommonFun.UpdateXLS("KTUnUpdate.xlsx", new string[] { "出售方式(零或整)", "库存" }, new string[] { DateTime.Now.ToString(), "5" }, "剂型", "1601916959,1601912112");
                SyncItemStock sync = new SyncItemStock();
                //sync.Start();
                #endregion
                //CommonFun.ReadXLS("YaoTu/YaoTu636500822100643979.csv");
            }
Exemplo n.º 5
0
        /// <summary>
        /// 对比价格(在线数据)
        /// </summary>
        public void OnlineComparePrice()
        {
            ReadPlatFormWebPageValue flatform = new ReadPlatFormWebPageValue();

            Dictionary <string, BaseItemInfo> platItems = new Dictionary <string, BaseItemInfo>();

            Dictionary <string, List <BaseItemInfo> > seachItems = new Dictionary <string, List <BaseItemInfo> >();

            Dictionary <string, string> seachedItemName = new Dictionary <string, string>();

            foreach (BaseItemInfo item in ShopAllItems.Values)
            {
                string key = item.Name + item.Format + item.Created;

                //查找该商品
                if (!seachedItemName.ContainsKey(item.Name))
                {
                    seachedItemName.Add(item.Name, item.Name);

                    List <BaseItemInfo> item_list = flatform.SeachInfoByID(item.Name);

                    Dictionary <string, BaseItemInfo> minPricItems = new Dictionary <string, BaseItemInfo>();


                    foreach (BaseItemInfo sItem in item_list)
                    {
                        string sItemKey = sItem.Name + sItem.Format + sItem.Created;

                        if (!platItems.ContainsKey(sItemKey))
                        {
                            platItems.Add(sItemKey, sItem);
                            minPricItems.Add(sItemKey, sItem);
                        }
                        else if (platItems[sItemKey].ShopSelaPrice > sItem.ShopSelaPrice)
                        {
                            platItems[sItemKey]    = sItem;
                            minPricItems[sItemKey] = sItem;
                        }
                    }

                    seachItems.Add(item.Name, minPricItems.Values.ToList());
                }

                //对比价格
                if (seachItems.ContainsKey(item.Name))
                {
                    List <BaseItemInfo> compareItems = seachItems[item.Name];
                    bool isExist = false;
                    foreach (BaseItemInfo compareItem in compareItems)
                    {
                        if (item.Created == compareItem.Created)
                        {
                            if (CommonFun.IsSameFormat(item.Format, compareItem.Format, item.Name, compareItem.Name))
                            {
                                isExist = true;
                                //价格对比
                                if (item.ShopPrice > 0 && item.ShopPrice * (decimal)0.75 >= compareItem.ShopSelaPrice)
                                {
                                    //浏览量对比
                                    if (!string.IsNullOrEmpty(compareItem.ViewCount) && Convert.ToInt32(compareItem.ViewCount) >= 500)
                                    {
                                        item.ID            = compareItem.ID;
                                        item.ShopSelaPrice = compareItem.ShopSelaPrice;
                                        item.Type          = compareItem.Type;
                                        item.ViewCount     = compareItem.ViewCount;

                                        CommonFun.WriteCSV("25%" + ticks + ".csv", item);
                                    }
                                }
                                break;
                            }
                        }
                    }
                    if (!isExist)
                    {
                        CommonFun.WriteCSV("YaoTu/NoFormat" + ticks + ".csv", item);
                    }
                }
                else
                {
                    CommonFun.WriteCSV("YaoTu/NotExist" + ticks + ".csv", item);
                }
            }

            foreach (BaseItemInfo item in platItems.Values)
            {
                CommonFun.WriteCSV("YaoTu/Plateform" + ticks + ".csv", item);
            }
        }