public async Task GetAllWarehousesWhenOneIsRegistred() { //Arrange var GetAllWarehousesWhenOneIsRegistred = System.Reflection.MethodBase.GetCurrentMethod().Name; var options = Utils.GetOptions(GetAllWarehousesWhenOneIsRegistred); Utils.SeedDatabase(options); using (var arrangeContext = new StoreSystemDbContext(options)) { var warehousesList = arrangeContext.Warehouses.ToList(); int cnt = 0; foreach (var item in warehousesList) { if (0 != cnt) { arrangeContext.Warehouses.Remove(item); } else { cnt = 1; } } await arrangeContext.SaveChangesAsync(); } using (var context = new StoreSystemDbContext(options)) { var sut = new WarehouseService(context); //Act var warehousesList = await sut.GetAllWarehousesAsync(); //Assert Assert.AreEqual(1, warehousesList.Count); } }
/// <summary> /// 获取仓库列表 /// </summary> private string GetWarehouseData() { var warehouseService = new WarehouseService(new SessionManager().CurrentUserLoginInfo); IList <WarehouseInfo> list; string key = string.Empty; string content = string.Empty; if (Request("pid") != null && Request("pid") != string.Empty) { key = Request("pid").ToString().Trim(); } list = warehouseService.GetWarehouseByUnitID(key); var jsonData = new JsonData(); jsonData.totalCount = list.Count.ToString(); jsonData.data = list; content = jsonData.ToJSON(); return(content); }
public void ReserveProduct_ОдинТоварВНужномКоличестве_ТоварНаСкладеУдаляется() { // Arrange var товарНаСкладе = new ТоварНаСкладе { Количество = 4 }; товарНаСкладе.InitDataCopy(); var dataServiceMock = new Mock <IDataService>(); dataServiceMock.Setup(x => x.LoadObjects(It.Is <LoadingCustomizationStruct>(lcs => lcs.LoadingTypes.Contains(typeof(ТоварНаСкладе))))) .Returns(new[] { товарНаСкладе }); var whs = new WarehouseService(dataServiceMock.Object); // Act whs.ReserveProduct(new Товар(), 4); // Assert Assert.Equal(ObjectStatus.Deleted, товарНаСкладе.GetStatus()); }
public void ReserveProduct_ОдинТоварСБольшимОстатком_ОстатокУменьшается() { // Arrange var товарНаСкладе = new ТоварНаСкладе { Количество = 5 }; товарНаСкладе.InitDataCopy(); var dataServiceMock = new Mock <IDataService>(); dataServiceMock.Setup(x => x.LoadObjects(It.Is <LoadingCustomizationStruct>(lcs => lcs.LoadingTypes.Contains(typeof(ТоварНаСкладе))))) .Returns(new[] { товарНаСкладе }); var whs = new WarehouseService(dataServiceMock.Object); // Act whs.ReserveProduct(new Товар(), 4); // Assert Assert.Equal(1, товарНаСкладе.Количество); }
public ActionResult Login(UserLogin user) { if (!ModelState.IsValid) { return(View(user)); } var obj = UserInfoService.GetStoreUserBy(user.UserName, Pharos.Utility.Security.MD5_Encrypt(user.UserPwd), user.StoreId.Split('~')[0]); if (obj == null) { ViewBag.msg = "帐户或密码输入不正确!"; //ViewBag.stores = ListToSelect(WarehouseService.GetAdminList().Select(o => new SelectListItem() { Text = o.Title, Value = o.StoreId + "~" + o.Title }), emptyTitle: "请选择门店"); ViewBag.stores = ListToSelect(WarehouseService.GetAdminList(user.CID, user.StoreId.Split('~')[0]).Select(o => new SelectListItem() { Text = o.Title, Value = o.StoreId + "~" + o.Title, Selected = o.StoreId == user.StoreId.Split('~')[0] })); return(View(user)); } //obj.StoreId = user.StoreId; obj.RoleIds = "10"; new Sys.CurrentStoreUser().StoreLogin(obj, user.StoreId, user.RememberMe); //csID csid = ipLocalhost(); //if (csid.message == "禁止访问") //{ // Response.Redirect("/Account/noBusiness"); // return null; //} ////ip、localhost门店登录 //else if (csid.message == "localhost" || csid.message == "ip") //{ // Response.Redirect("/store"+csid.cid+"-"+csid.sid+"/Store/Index"); // return null; //} return(Redirect(Url.Action("Index"))); }
public ActionResult GetProductInput(string searchName, string supplierID, string zp, string storeId, string order, short?getStockNum) { if (searchName.IsNullOrEmpty()) { return(new EmptyResult()); } var express = DynamicallyLinqHelper.Empty <VwProduct>() .And(o => (o.Barcode != null && o.Barcode.StartsWith(searchName)) || o.Title.Contains(searchName) || (o.Barcodes != null && o.Barcodes.Contains(searchName))) .And(o => o.IsAcceptOrder == 1, order.IsNullOrEmpty()).And(o => o.CompanyId == CommonService.CompanyId); if (!supplierID.IsNullOrEmpty()) { var sp = supplierID.Split(',').ToList(); var bars = BaseService <ProductMultSupplier> .FindList(o => sp.Contains(o.SupplierId)).Select(o => o.Barcode).Distinct().ToList(); express = express.And(o => (sp.Contains(o.SupplierId) || bars.Contains(o.Barcode)), supplierID.IsNullOrEmpty()); } if (!storeId.IsNullOrEmpty()) { var ware = WarehouseService.Find(o => o.StoreId == storeId && o.CompanyId == CommonService.CompanyId); if (ware != null) { var categorySNs = ware.CategorySN.Split(',').Select(o => int.Parse(o)).ToList(); var childs = ProductCategoryService.GetChildSNs(categorySNs, true); express = express.And(o => childs.Contains(o.CategorySN)); } } var list = BaseService <VwProduct> .FindList(express, takeNum : 20); list = ProductService.SetAssistBarcode(list); ProductService.SetSysPrice <VwProduct>(storeId, list, supplierId: supplierID); if (getStockNum == 1) { ProductService.SetStockNum(storeId, list); } return(ToDataGrid(list, 20)); }
public async Task UpdateWarehouseWithWhiteSpaceNameWhenInvalidID(string warehouseName, int cityID, int countryID, int addressID, bool toSave) { //Arrange var UpdateWarehouseWithWhiteSpaceNameWhenInvalidID = System.Reflection.MethodBase.GetCurrentMethod().Name; var options = Utils.GetOptions(UpdateWarehouseWithWhiteSpaceNameWhenInvalidID); Utils.SeedDatabase(options); using (var arrangeContext = new StoreSystemDbContext(options)) { arrangeContext.Countries.Add(new Country() { CountryID = countryID }); arrangeContext.Cities.Add(new City() { CityID = cityID }); arrangeContext.Addresses.Add(new Address() { AddressID = addressID }); await arrangeContext.SaveChangesAsync(); } using (var context = new StoreSystemDbContext(options)) { var sut = new WarehouseService(context); //Act var actualWarehouse = await sut.CreateWarehouseAsync(warehouseName, countryID, cityID, addressID, toSave); //Assert await Assert.ThrowsExceptionAsync <ArgumentException>(async() => await sut.UpdateWarehouseAsync(-actualWarehouse.WarehouseID, " ", countryID, cityID, addressID, toSave)); } }
//public static void CloseStoreMarketing() //{ // RedisManager.UnSubscribe("RefreshHostedMarketing"); // RedisManager.UnSubscribe("MarketingRefresh"); //} public static void InitStoreMarketing() { #if Local var companyId = 0; try { companyId = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["CompanyId"]); } catch { companyId = 0; } var storeId = System.Configuration.ConfigurationManager.AppSettings["StoreId"]; if (string.IsNullOrEmpty(storeId) || companyId == 0) { Thread.CurrentThread.Abort(); return; } #endif Subscribe(); #if(Local!=true) var stores = WarehouseService.GetStores(); foreach (var item in stores) { var info = new MarketingRefreshInfo() { StoreId = item.StoreId, CompanyId = item.CompanyId }; RedisManager.Publish("MarketingRefresh", info); CreateSchedulerRefreshMarketing(JsonConvert.SerializeObject(info)); } #endif #if Local var info = new MarketingRefreshInfo() { StoreId = storeId, CompanyId = companyId }; StoreManager.PubEvent("MarketingRefresh", info); CreateSchedulerRefreshMarketing(JsonConvert.SerializeObject(info)); #endif }
public static async Task RunAsync([CosmosDBTrigger( "%CosmosDBDatabase%", "%CosmosDBContainer%", ConnectionStringSetting = "CosmosDBConnection", LeaseCollectionName = "orders-leases-container", LeaseCollectionPrefix = "warehouse")] IReadOnlyList <Document> input, [CosmosDB("%CosmosDBDatabase%", "%CosmosDBContainer%", ConnectionStringSetting = "CosmosDBConnection")] CosmosClient client, ILogger log) { var customerService = new WarehouseService(new WarehouseRepository(client.GetDatabase(DatabaseName))); if (input != null && input.Count > 0) { log.LogInformation("Documents modified " + input.Count); foreach (var document in input) { var orderInformation = JsonConvert.DeserializeObject <Order>(document.ToString()); await customerService.HandleWarehouseView(orderInformation); } } }
static void Main(string[] args) { var optionsBuilder = new DbContextOptionsBuilder <ApplicationDbContext>(); optionsBuilder.UseSqlServer(Parameter.ConnectionString); var context = new ApplicationDbContext(optionsBuilder.Options); var clientService = new ClientService(context); var productService = new ProductService(context); var warehouseService = new WarehouseService(context); using (context) { //PrintProductsByPagingTable(productService); //PrintWarehousesAndProductsComplex(warehouseService); //PrintClientTable(clientService, 3); //PrintProductsTable(productService); //ProductsExistsByName(productService, "Guitarra eléctrica Fender Squier"); PrintClientsTable(clientService); } Console.Read(); }
public PurchaseDataController(IWorkContext webWorkContext, PurchaseDataService purchaseDataService, LocalizationService localizationService, GoodsDataService goodsDataService, SupplierDataService supplierDataService, WarehouseService warehouseService, InventoryDataService inventoryDataService, GoodsSpecificationService goodsSpecificationService, ClientTypeService clientTypeService, SalesShipmentsDataService salesShipmentsDataService, GoodsTypeService goodsTypeService) { _webWorkContext = webWorkContext; _purchaseDataService = purchaseDataService; _localizationService = localizationService; _goodsDataService = goodsDataService; _supplierDataService = supplierDataService; _warehouseService = warehouseService; _inventoryDataService = inventoryDataService; _goodsSpecificationService = goodsSpecificationService; _clientTypeService = clientTypeService; _salesShipmentsDataService = salesShipmentsDataService; _goodsTypeService = goodsTypeService; }
public ActionResult MoveOutDelivery(int?id) //, string supplierId { var list = ListToSelect(WarehouseService.GetList().Select(o => new SelectListItem() { Value = o.StoreId, Text = o.Title }), emptyTitle: "请选择"); ViewBag.outshops = list.Where(o => o.Value == Sys.CurrentUser.StoreId).ToList(); ViewBag.inshops = list.Where(o => o.Value != Sys.CurrentUser.StoreId).ToList(); var obj = new Logic.Entity.HouseMove(); if (id.HasValue) { obj = STHouseMoveService.FindById(id); } int count = 0; object footer = null; var details = STHouseMoveService.LoadDetailList(obj.MoveId, out count, ref footer); ViewData["Updated"] = details.ToJson(); Session["orderdetails"] = details; return(View(obj.IsNullThrow())); }
public bool CanAcceptItem(IVoxel voxel, ItemType item) { return(WarehouseService.CanMoveToWarehouse(voxel, new[] { item })); }
public PageResult <InventoryResult> CheckedInventory(IEnumerable <int> categorySns, string keyword, decimal price, int pageSize, int pageIndex) { return(WarehouseService.CheckedInventory(StoreId, CompanyId, categorySns, keyword, price, pageSize, pageIndex)); }
public PaginationResult <WarehouseActivity> GetActivities(string warehouseId, int pageIndex = 1, int pageSize = 25) { return(Execute(session => WarehouseService.GetWarehouseActivity(warehouseId, pageIndex, pageSize))); }
private void ExcuteLoginCommand(object obj) { var values = (object[])obj; var psdBox = values[0] as PasswordBox; //Do Validation if not handled on the UI if (psdBox != null && psdBox.Password == "") { psdBox.Focus(); return; } if (psdBox != null) { var us = Membership.ValidateUser(User.UserName, psdBox.Password); if (!us) { MessageBox.Show("IncorrectUserId", "Error Logging", MessageBoxButton.OK, MessageBoxImage.Error); User.Password = ""; return; } int userId = WebSecurity.GetUserId(User.UserName); var user = new UserService().GetUser(userId); if (user == null) { MessageBox.Show("Incorrect UserId", "Error Logging", MessageBoxButton.OK, MessageBoxImage.Error); User.Password = ""; } else { //LockedVisibility = "Collapsed"; //UnLockedVisibility = "Visible"; //Thread.Sleep(1000); Singleton.User = user; Singleton.User.Password = psdBox.Password; Singleton.UserRoles = new UserRolesModel(); Singleton.Setting = _unitOfWork.Repository <SettingDTO>() .Query() .Get() .FirstOrDefault(); #region Warehouse Filter var warehouseList = new WarehouseService(true).GetWarehousesPrevilegedToUser(user.UserId).ToList(); if (warehouseList.Count > 1) { warehouseList.Insert(warehouseList.Count, new WarehouseDTO { DisplayName = "All", Id = -1 }); } Singleton.WarehousesList = warehouseList; #endregion switch (user.Status) { case UserTypes.Waiting: new ChangePassword(psdBox.Password).Show(); break; case UserTypes.Active: new MainWindow().Show(); break; default: MessageBox.Show("Login Failed"); break; } CloseWindow(values[1]); } } }
public WarehouseItem AddItem(WarehouseItem item) { return(Execute(session => WarehouseService.InsertWarehouseItem(item, session.User.Id))); }
public WarehouseItem GetItem(string id) { return(Execute(session => WarehouseService.GetItem(id))); }
public WarehouseController(WarehouseService service) { this.service = service; }
public ModelController(WarehouseService warehouseService) { this.warehouseService = warehouseService; }
public WarehouseController(WarehouseService warehouseService) { _warehouseService = warehouseService; }
public object GetStoreList(int cid) { //var cid = Request.GetRouteData().Values["CID"]; //var cid= Request.GetQueryNameValuePairs().FirstOrDefault(o => o.Key == "CC").Value; return(WarehouseService.GetList().Select(o => new{ o.StoreId, o.Title, o.Address, o.CategorySN }).ToList()); }
public BillControl(string docType, List <Products> products, List <Buyers> buyers) { this.docType = docType; this.products = products; InitializeComponent(); label_billNumber.Text = docType; button_previousBill.Enabled = false; button_nextBill.Enabled = false; bills = WarehouseService.GetAllBillsWithDocType(docType); InitBillItemsTable(); if (bills.Count > 0) { SelectBill(bills.Count - 1); } // enter kada se klikne za sifru proizvoda ili kolicinu da se doda u korpu quantity_textBox1.KeyUp += Kolicina_KeyUp; sifraProizvoda_textBox.KeyUp += SifraProizvoda_KeyUp; // za pretragu po PIB-u ili maticnom broju textBox_PIB.KeyUp += PIB_KeyUp; textBox_maticniBr.KeyUp += MaticniBroj_KeyUp; comboBoxOptions.Add("Sifra", "sifra"); comboBoxOptions.Add("Naziv", "naziv"); comboBoxOptions.Add("Barkod", "barkod"); uplata_textBox1.KeyUp += UplataKeyUp; this.buyers = buyers; foreach (var buyer in buyers) { comboBox_kupci.Items.Add(buyer.sifra); } comboBox_kupci.SelectedIndexChanged += ComboBoxKupci_SelectedIndexChanged; uplata_textBox1.LostFocus += new EventHandler(dataGridView1_LostFocus); sifraProizvoda_textBox.LostFocus += new EventHandler(dataGridView1_LostFocus); quantity_textBox1.LostFocus += new EventHandler(dataGridView1_LostFocus); textBox_cek.LostFocus += new EventHandler(dataGridView1_LostFocus); textBox_gotovina.LostFocus += new EventHandler(dataGridView1_LostFocus); textBox_kartica.LostFocus += new EventHandler(dataGridView1_LostFocus); textBox_virman.LostFocus += new EventHandler(dataGridView1_LostFocus); textBox_PIB.LostFocus += new EventHandler(dataGridView1_LostFocus); textBox_maticniBr.LostFocus += new EventHandler(dataGridView1_LostFocus); // focus za nacine placanja textBox_cek.Click += KeyEvent; textBox_gotovina.Click += KeyEvent; textBox_kartica.Click += KeyEvent; textBox_virman.Click += KeyEvent; textBox_cek.KeyPress += TextBoxPrices_KeyPress; textBox_gotovina.KeyPress += TextBoxPrices_KeyPress; textBox_kartica.KeyPress += TextBoxPrices_KeyPress; textBox_virman.KeyPress += TextBoxPrices_KeyPress; textBox_cek.TextChanged += TextBoxPrices_TextChanged; textBox_gotovina.TextChanged += TextBoxPrices_TextChanged; textBox_kartica.TextChanged += TextBoxPrices_TextChanged; textBox_virman.TextChanged += TextBoxPrices_TextChanged; }
public WarehouseController(WarehouseService warehouse, IUnitOfWorkManager unitOfWorkManager) { _warehouse = warehouse; _unitOfWorkManager = unitOfWorkManager; }
public ActionResult GetRemind(string type) { List <RemindModel> rmList = new List <RemindModel>(); switch (type.ToLower()) { case "stockout": //缺货提醒 var datas = CommodityService.GetStockout().GroupBy(o => o.Key); foreach (var item in datas) { rmList.Add(new RemindModel(item.Key + "缺货提醒", item.Key + "以下商品缺货:<br/>" + string.Join(",", item.Select(o => o.Value)))); } break; case "activity": //活动提醒 Dictionary <short, string> promotionTypeDict = new Dictionary <short, string>(); //1:单品折扣、 2:捆绑促销、 3:组合促销、4:买赠促销、 5:满元促销 promotionTypeDict.Add(1, "单品折扣"); promotionTypeDict.Add(2, "捆绑促销"); promotionTypeDict.Add(3, "组合促销"); promotionTypeDict.Add(4, "买赠促销"); promotionTypeDict.Add(5, "满元促销"); var promotions = CommodityPromotionService.GetNewestActivity(10); foreach (var item in promotions) { var storeids = item.StoreId.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); var stores = WarehouseService.FindList(o => storeids.Contains(o.StoreId)).Select(o => o.Title); rmList.Add( new RemindModel( string.Format( "{1}~{2} {0}", promotionTypeDict[item.PromotionType], (item.StartDate ?? new DateTime()).ToString("yyyy-MM-dd"), (item.EndDate ?? new DateTime()).ToString("yyyy-MM-dd")), item.Id)); } break; case "receive": //收货提醒 var orderDatas = OrderDistributionService.GetReceivedOrder(); foreach (var item in orderDatas) { rmList.Add(new RemindModel(string.Format("{0}有订单发货,请注意查收!", item.Store), string.Format("<br/>门店:{0}<br/>配送批次号:{1}<br/>订单编号:{2}<br/>", item.Store, item.DistributionBatch, item.IndentOrderId))); } break; case "expiration": //保质期到期提醒 var commodities = CommodityService.GetExpiresProduct(); foreach (var item in commodities) { rmList.Add(new RemindModel(string.Format("{0}已过期或将要过期", item.Key), string.Format("{0}将要过期<br/>过期时间:{1}", item.Key, item.Value.ExpirationDate))); } break; case "contract": //合同提醒 var contracts = ContractSerivce.GetContractRemind(); foreach (var item in contracts) { rmList.Add(new RemindModel(string.Format("<span style=\"width:120px;display:inline-block;\">{0}</span><span style=\"width:110px;display:inline-block;\">{1}</span><span style=\"width:110px;display:inline-block;\">{2}</span>", item.ContractSN, item.SupplierTitle, item.EndDate), string.Format("合同编号:{0}<br/>供应商:{1}<br/>结束日期:{2}", item.ContractSN, item.SupplierTitle, item.EndDate))); } break; } return(new JsonNetResult(rmList)); }
public ActionResult FindWarehouse(string parameter) { var warehouse = WarehouseService.FindWarehouse(parameter); return(Json(warehouse, "text", JsonRequestBehavior.AllowGet)); }
//#region IShipment //public IShippingService ShippingService //{ // get { return _serviceContext.ShippingService; } //} //#endregion #region IAppliedPayment #endregion #region IWarehouse public void DeleteWarehouseCatalogs() { var catalogs = WarehouseService.GetAllWarehouseCatalogs(); WarehouseService.Delete(catalogs); }
//获取生成的仓库编码 // GET: /Warehouse/GetWareCode/ public ActionResult GetWareCode() { var warehouseCode = WarehouseService.GetWareCode(); return(Json(warehouseCode, "text", JsonRequestBehavior.AllowGet)); }
private static void Main(string[] args) { var optionsBuilder = new DbContextOptionsBuilder <ApplicationDbContext>(); optionsBuilder.UseSqlServer(Parameter.ConnectionString); var context = new ApplicationDbContext(optionsBuilder.Options); var clientService = new ClientService(context); var productService = new ProductService(context); var warehouseService = new WarehouseService(context); var orderService = new OrderService(context); using (context) { //var clients = new List<Client> { // new Client { // ClientId = 5, // Name = "Alfa" // }, // new Client { // ClientId = 6, // Name = "Omega" // } //}; //clientService.Update(clients); //var client = new Client //{ // ClientId = 6, // ClientNumber = "123456789", // Country_Id = 1, // Name = "Papaya SRL" //}; //clientService.Update(client); // Remove //warehouseService.Remove(8); //warehouseService.Remove(new List<int> { 5,6,7 }); // Add order var newOrder = new Order { ClientId = 2, Items = new List <OrderDetail> { new OrderDetail { ProductId = 1, UnitPrice = 400, Quantity = 2, }, new OrderDetail { ProductId = 2, UnitPrice = 1300, Quantity = 4, } } }; //orderService.Create(newOrder); //PrintClientsTable(clientService); //PrintClientTable(clientService, 3); //PrintClientTable(clientService); //PrintProductsTable(productService); //ProductsExistsByName(productService, "Guitarra eléctrica Fender Squier"); //PrintWarehousesAndProducts(warehouseService); //PrintProductsByPagingTable(productService); //PrintWarehousesAndProductsComplex(warehouseService); //PrintOrders(orderService).Wait(); //warehouseService.Remove(4); //PrintWarehouses(warehouseService); } Console.Read(); }
public WarehouseController(HoneyStoreContext context) { warehouseService = new WarehouseService(context); }