public void MainTest002() { LiveEntities dbEntity = new LiveEntities(ConfigHelper.LiveConnection.Connection); MemberOrganization org = (from o in dbEntity.MemberOrganizations where o.Code == "Zhuchao" select o).FirstOrDefault(); MemberChannel chl = (from c in dbEntity.MemberChannels where c.Code == "Taobao01" select c).FirstOrDefault(); OrderBLL oOrderBLL = new OrderBLL(dbEntity); oOrderBLL.GenerateOrderFromTaobao(org, chl); }
/// <summary> /// 淘宝进程主程序 /// </summary> public void Main() { string sTaobaoConfig = Utility.ConfigHelper.GlobalConst.GetSetting("SynchroTaobao"); string[] sConfigs = sTaobaoConfig.Split(';'); foreach (string sOrganChannel in sConfigs) { string[] sChannelSet = sOrganChannel.Split(':'); var oOrgan = (from o in dbEntity.MemberOrganizations where o.Deleted == false && o.Otype == (byte)ModelEnum.OrganizationType.CORPORATION && o.Code == sChannelSet[0] select o).FirstOrDefault(); var oChannel = (from c in dbEntity.MemberOrgChannels.Include("Organization").Include("Channel") where c.Deleted == false && c.Organization.Code == sChannelSet[0] && c.Channel.Code == sChannelSet[1] select c).FirstOrDefault(); // 下载淘宝订单 LiveAzure.BLL.Taobao.TranscationAPI oTranscation = new BLL.Taobao.TranscationAPI(dbEntity, oChannel); oTranscation.DownloadOrders(DateTime.Now.AddDays(-1), DateTime.Now); // 同步淘宝价格和库存 var oOnSales = (from s in dbEntity.ProductOnSales where s.Deleted == false && s.Ostatus == (byte)ModelEnum.OnSaleStatus.ONSALE && s.Organization.Code == sChannelSet[0] && s.Channel.Code == sChannelSet[1] select s).ToList(); LiveAzure.BLL.Taobao.ProductAPI oProductAPI = new BLL.Taobao.ProductAPI(dbEntity, oChannel); foreach (var oOnSale in oOnSales) oProductAPI.ProductUpdate(oOnSale); // 转换成Stage订单 OrderBLL oOrderBLL = new OrderBLL(dbEntity); oOrderBLL.GenerateOrderFromTaobao(oOrgan, oChannel.Channel); // 下载淘宝评论 // 下载旺旺记录 } }
private static Guid WarehouseGuidSelected; //选中的仓库 #endregion Fields #region Constructors // // GET: /Order/ public OrderController() { warehouseBll = new WarehouseBLL(dbEntity); orderBll = new OrderBLL(dbEntity); }
//public ActionResult OrderSupportShippingList() //{ // return View(); //} ///// <summary> ///// 编辑订单时候显示的承运商列表 ///// </summary> ///// <param name="searchModel"></param> ///// <returns></returns> //public ActionResult ListOrderSupportShipping(SearchModel searchModel) //{ // //需要对应全局的订单Guid // Guid orderGid = oNewOrder.Gid; // IQueryable<OrderShipping> oOrderShipping = dbEntity.OrderShippings.Include("Order").Include("Shipper").Where(p => p.Deleted == false && p.OrderID == orderGid).AsQueryable(); // GridColumnModelList<OrderShipping> columns = new GridColumnModelList<OrderShipping>(); // columns.Add(p => p.Gid).SetAsPrimaryKey(); // columns.Add(p => p.Shipper.FullName.GetResource(CurrentSession.Culture)).SetName("ShipperName"); // columns.Add(p => p.ShipWeight); // columns.Add(p => p.ShippingCheckName).SetName("ShipStatus"); // columns.Add(p => p.Candidate); // columns.Add(p => p.Remark); // GridData gridData = oOrderShipping.ToGridData(searchModel, columns); // return Json(gridData, JsonRequestBehavior.AllowGet); //} /// <summary> /// 添加订单时列出支持的承运商 /// </summary> /// <returns></returns> public ActionResult ShippingListShow() { OrderBLL oOrderBLL = new OrderBLL(this.dbEntity);//新建oOrderBLL对象 List<ShippingInformation> oShippingList = new List<ShippingInformation>(); List<SelectListItem> shippinglist = new List<SelectListItem>(); if (oNewOrder.WhID != null && oNewOrder.aLocation != null && listNewOrderItem.Count>=1) { //-----------edit by 2011/10/24 需求:手动编辑订单是可以选择所有组织支持的承运商 //获取支持的承运商列表 //oShippingList = oOrderBLL.GetSupportShippings(listNewOrderItem, (Guid)oNewOrder.WhID, (Guid)oNewOrder.aLocation); //获取组织支持的所有承运商 oShippingList = dbEntity.ShippingInformations.Where(s => s.aParent == oNewOrder.OrgID && s.Deleted == false).ToList(); //------------------------------------------------------------------------------ listNewOrderShipping.Clear();//每次都清除之前的承运商列表,以保证该列表永远是最新的-----BUG修改09.25 if (oShippingList.Count > 0) { for (int i = 0; i < oShippingList.Count; i++) { OrderShipping oNewOrderShipping = new OrderShipping { ShipID = oShippingList.ElementAt(i).Gid, Order = oNewOrder }; listNewOrderShipping.Add(oNewOrderShipping); shippinglist.Add(new SelectListItem { Text = oShippingList.ElementAt(i).FullName.GetResource(CurrentSession.Culture), Value = oShippingList.ElementAt(i).Gid.ToString() }); } oNewShipper = oShippingList.ElementAt(0);//默认选中权重最大的,即通过排序查找出的列表的第一个 foreach (var reg in oOrderBLL.GetFullRegions((Guid)oNewOrder.aLocation)) { if (oNewShipper.Areas != null)//支持区域不为空 { foreach (var area in oNewShipper.Areas) { if (area.RegionID == reg.Gid) { oNewOrder.ResidenceFee = area.Residential == null? 0:area.Residential.GetResource((Guid)oNewOrder.aCurrency);//收取的到门费 oNewOrder.LiftGateFee = area.LiftGate == null? 0:area.LiftGate.GetResource((Guid)oNewOrder.aCurrency);//收取的上楼费 oNewOrder.InstallFee = area.Installation == null? 0:area.Installation.GetResource((Guid)oNewOrder.aCurrency);//收取的安装费 } } } } } else//未找到符合的承运商 { oNewShipper = new ShippingInformation(); } } ViewBag.shippinglist = shippinglist; return View(); }
/// <summary> /// 编辑订单时列出支持的承运商 /// </summary> /// <returns></returns> public void EditShippingListShow() { OrderBLL oOrderBLL = new OrderBLL(this.dbEntity);//新建oOrderBLL对象 oNewShipper = dbEntity.ShippingInformations.Find(oNewShipper.Gid); List<ShippingInformation> oShippingList = new List<ShippingInformation>(); List<SelectListItem> shippinglist = new List<SelectListItem>(); if (oNewOrder.WhID != null && oNewOrder.aLocation != null && listNewOrderItem.Count >= 1) { //-----------edit by 2011/10/24 需求:手动编辑订单是可以选择所有组织支持的承运商 //获取支持的承运商列表 //oShippingList = oOrderBLL.GetSupportShippings(listNewOrderItem, (Guid)oNewOrder.WhID, (Guid)oNewOrder.aLocation); //获取组织支持的所有承运商 oShippingList = dbEntity.ShippingInformations.Where(s => s.aParent == oNewOrder.OrgID && s.Deleted == false).ToList(); //------------------------------------------------------------------------------ listNewOrderShipping.Clear();//每次都清除之前的承运商列表,以保证该列表永远是最新的-----BUG修改09.25 if (oShippingList.Count >= 1)//如果查出承运商 { for (int i = 0; i < oShippingList.Count; i++) { OrderShipping oNewOrderShipping = new OrderShipping { ShipID = oShippingList.ElementAt(i).Gid, Order = oNewOrder }; listNewOrderShipping.Add(oNewOrderShipping); } if (oNewShipper == null)//如果之前没有承运商的 { oNewShipper = oShippingList.ElementAt(0); } foreach (var reg in oOrderBLL.GetFullRegions((Guid)oNewOrder.aLocation)) { if (oNewShipper.Areas != null)//地区不为空 { foreach (var area in oNewShipper.Areas) { if (area.RegionID == reg.Gid) { oNewOrder.ResidenceFee = area.Residential == null ? 0 : area.Residential.GetResource((Guid)oNewOrder.aCurrency);//收取的到门费 oNewOrder.LiftGateFee = area.LiftGate == null ? 0 : area.LiftGate.GetResource((Guid)oNewOrder.aCurrency);//收取的上楼费 oNewOrder.InstallFee = area.Installation == null ? 0 : area.Installation.GetResource((Guid)oNewOrder.aCurrency);//收取的安装费 } } } } } else//未找到符合的承运商 { oNewShipper = new ShippingInformation(); } } else//错误:仓库ID 地区ID 不能为空 且 订单商品列表不为空 { } }
/// <summary> /// 实例化OrderBLL对象 /// </summary> public OrderController() { orderBll = new OrderBLL(dbEntity); }