/// <summary> /// 加载界面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SelledReturnIn_Load(object sender, EventArgs e) { try { inoutHelper = new InOutHelper(); dTable = new DataTable(); skuOuterIDList = new List <string>(); //显示当前入库日期 dateEditInTime.Text = DateTime.Now.ToShortDateString(); //加载展示信息 AddColumns(dTable); //从数据库获取并展示数据 List <Alading.Entity.View_RefundTradeStock> tradeRefundList = TradeRefundService.GetTradeRefundByView(c => c.LocalStatus == LocalTradeStatus.SentNotRate && c.IsRecieved == false); LoadTradeRefund(tradeRefundList); /*加载所有仓库*/ inoutHelper.LoadAllHouse(repositoryItemComboBoxStockHouse); gvReturnInProduct.BestFitColumns(); } catch (Exception ex) { XtraMessageBox.Show(ex.Message, Constants.SYSTEM_PROMPT, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// 点击刷新按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void barBtnRefresh_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { WaitDialogForm waitFrm = new WaitDialogForm(Constants.WAIT_LOAD_DATA); try { //从数据库获取并展示数据 List <Alading.Entity.View_RefundTradeStock> tradeRefundList = TradeRefundService.GetTradeRefundByView(c => c.LocalStatus == LocalTradeStatus.SentNotRate && c.IsRecieved == false); LoadTradeRefund(tradeRefundList); waitFrm.Close(); } catch (Exception ex) { waitFrm.Close(); XtraMessageBox.Show(ex.Message, Constants.SYSTEM_PROMPT, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// 点击更新按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void barBtnDownLoad_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { WaitDialogForm waitFrm = new WaitDialogForm(Constants.WAIT_LOAD_DATA); try { #region 获取全部淘宝店铺的淘宝会员号 List <Alading.Entity.Shop> shopBList = ShopService.GetShop(c => c.ShopType == (int)ShopType.TaobaoBShop); List <Alading.Entity.Shop> shopCList = ShopService.GetShop(c => c.ShopType == (int)ShopType.TaobaoCShop); List <string> sessionKeyList = new List <string>(); foreach (Alading.Entity.Shop shop in shopBList) { sessionKeyList.Add(Alading.Utils.SystemHelper.GetSessionKey(shop.nick)); } foreach (Alading.Entity.Shop shop in shopCList) { sessionKeyList.Add(Alading.Utils.SystemHelper.GetSessionKey(shop.nick)); } #endregion foreach (string sessionKey in sessionKeyList)//获取全部淘宝店铺的数据 { /*获取未评价数据*/ int totalResults = 0; int pageSize = 100; int totalPageNo = 0; /*用于存放从淘宝上获取回的数据*/ List <Alading.Entity.TradeRefund> tradeRefundList = new List <Alading.Entity.TradeRefund>(); //存放退货单编号 List <string> refundIDList = new List <string>(); GetNewTradeRefund(sessionKey, 1, pageSize, out totalResults, tradeRefundList, refundIDList); if (totalResults % totalResults == 0)//能除尽 { totalPageNo = totalResults / totalResults; } else//不能除尽 { totalPageNo = totalResults / totalResults + 1; } /*超过两页的循环调取数据*/ for (int pageno = 2; pageno <= totalPageNo; pageno++) { GetNewTradeRefund(sessionKey, pageno, pageSize, out totalResults, tradeRefundList, refundIDList); } //以消除数据库中已存在的数据 GetNewRefundDetail(sessionKey, tradeRefundList, refundIDList); } //从数据库获取并展示数据 List <Alading.Entity.View_RefundTradeStock> refundList = TradeRefundService.GetTradeRefundByView(c => c.LocalStatus == LocalTradeStatus.SentNotRate && c.IsRecieved == false); LoadTradeRefund(refundList); waitFrm.Close(); XtraMessageBox.Show("从淘宝网获取数据成功", Constants.SYSTEM_PROMPT, MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { waitFrm.Close(); XtraMessageBox.Show(ex.Message, Constants.SYSTEM_PROMPT, MessageBoxButtons.OK, MessageBoxIcon.Information); } }