protected void BtnDelete_Click(object sender, EventArgs e) { try { int DeleteId = 0; if (ViewState["EditID"] != null) { DeleteId = Convert.ToInt32(ViewState["EditID"]); } if (DeleteId != 0) { Entity_SL.StockLocationID = DeleteId; Entity_SL.UserId = Convert.ToInt32(Session["UserID"]); Entity_SL.LoginDate = DateTime.Now; Entity_SL.IsDeleted = true; int iDelete = Obj_SL.DeleteRecord(ref Entity_SL, out StrError); if (iDelete != 0) { obj_Comm.ShowPopUpMsg("Record Deleted Successfully..!", this.Page); MakeEmptyForm(); } } Entity_SL = null; obj_Comm = null; } catch (Exception ex) { throw new Exception(ex.Message); } }
public int InsertRecord(ref StockLocation Entity_call, out string strError) { int iInsert = 0; strError = string.Empty; try { SqlParameter pAction = new SqlParameter(StockLocation._Action, SqlDbType.BigInt); SqlParameter pLocation = new SqlParameter(StockLocation._Location, SqlDbType.NVarChar); SqlParameter pSiteId = new SqlParameter(StockLocation._SiteId, SqlDbType.BigInt); SqlParameter pTowerId = new SqlParameter(StockLocation._TowerId, SqlDbType.BigInt); SqlParameter pCompanyId = new SqlParameter(StockLocation._CompanyId, SqlDbType.BigInt); SqlParameter pSiteAddr = new SqlParameter(StockLocation._SiteAddr, SqlDbType.NVarChar); SqlParameter pabbreviation = new SqlParameter(StockLocation._abbreviation, SqlDbType.NVarChar); SqlParameter pCreatedBy = new SqlParameter(StockLocation._UserId, SqlDbType.BigInt); SqlParameter PCreatedDate = new SqlParameter(StockLocation._LoginDate, SqlDbType.DateTime); SqlParameter pIsDeleted = new SqlParameter(StockLocation._IsDeleted, SqlDbType.Bit); SqlParameter pIsCental = new SqlParameter(StockLocation._IsCental, SqlDbType.Bit); pAction.Value = 1; pLocation.Value = Entity_call.Location; pSiteId.Value = Entity_call.SiteId; pTowerId.Value = Entity_call.TowerId; pCompanyId.Value = Entity_call.CompanyId; pSiteAddr.Value = Entity_call.SiteAddr; pabbreviation.Value = Entity_call.abbreviation; pCreatedBy.Value = Entity_call.UserId; PCreatedDate.Value = Entity_call.LoginDate; pIsDeleted.Value = Entity_call.IsDeleted; pIsCental.Value = Entity_call.IsCental; SqlParameter[] param = new SqlParameter[] { pAction, pLocation, pSiteId, pTowerId, pCompanyId, pSiteAddr, pCreatedBy, PCreatedDate, pIsDeleted, pIsCental, pabbreviation }; Open(CONNECTION_STRING); BeginTransaction(); iInsert = SQLHelper.ExecuteScalar(_Connection, _Transaction, CommandType.StoredProcedure, StockLocation.SP_StockLocation, param); if (iInsert > 0) { CommitTransaction(); } else { RollBackTransaction(); } } catch (Exception ex) { RollBackTransaction(); strError = ex.Message; } finally { Close(); } return(iInsert); }
private bool add() { bool b = false; try { if (isValidForm()) { StockLocation stockLocation = new StockLocation(); stockLocation.Name = textBox_name.TrimedText; stockLocation.Status = Convert.ToInt32(comboBox_status.SelectedValue); CommonMethods.setCDMDForAdd(stockLocation); int id = stockManagerImpl.addStockLocation(stockLocation); if (id > 0) { String query = "INSERT INTO stock_item (stock_location_id, item_id, quantity, created_by, created_date, modified_by, modified_date) " + "(SELECT " + id + ", item.id, 0, " + Session.User.Id + ", NOW(), " + Session.User.Id + ", NOW() " + "FROM item )"; DBConnector.getInstance().setData(query); b = true; } } } catch (Exception) { } return(b); }
public async Task <IActionResult> Edit(int id, StockLocation stockLocation) { if (id != stockLocation.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(stockLocation); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StockLocationExists(stockLocation.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(stockLocation)); }
protected void BtnSave_Click(object sender, EventArgs e) { int InsertRow = 0, InsertRowDtls = 0; try { DS = Obj_SL.ChkDuplicate(TxtStockLocation.Text.Trim(), out StrError); if (DS.Tables[0].Rows.Count > 0) { obj_Comm.ShowPopUpMsg("Location Name Already Exist..!", this.Page); TxtStockLocation.Focus(); } else { Entity_SL.Location = TxtStockLocation.Text.Trim(); Entity_SL.abbreviation = Txtabbreviations.Text.Trim(); Entity_SL.SiteId = 0; Entity_SL.TowerId = 0; Entity_SL.CompanyId = Convert.ToInt32(ddlcompany.SelectedValue); Entity_SL.SiteAddr = TxtSiteAddr.Text; Entity_SL.UserId = Convert.ToInt32(Session["UserId"]); Entity_SL.LoginDate = DateTime.Now; Entity_SL.IsDeleted = false; Entity_SL.IsCental = chkCenLoc.Checked ? true : false; InsertRow = Obj_SL.InsertRecord(ref Entity_SL, out StrError); if (InsertRow > 0) { if (ViewState["CurrentTable"] != null) { DataTable dtInsert = new DataTable(); dtInsert = (DataTable)ViewState["CurrentTable"]; for (int i = 0; i < dtInsert.Rows.Count; i++) { Entity_SL.StockLocationID = InsertRow; Entity_SL.EmployeeId = Convert.ToInt32(dtInsert.Rows[i]["EmployeeId"].ToString()); Entity_SL.CpersonName = dtInsert.Rows[i]["PersonName"].ToString(); Entity_SL.ContactNo = dtInsert.Rows[i]["ContactNo"].ToString(); Entity_SL.MailId = dtInsert.Rows[i]["EmailId"].ToString(); Entity_SL.PersonAddress = dtInsert.Rows[i]["Address"].ToString(); InsertRowDtls = Obj_SL.InsertDetailsRecord(ref Entity_SL, out StrError); } } if (InsertRow != 0) { obj_Comm.ShowPopUpMsg("Record Saved Successfully", this.Page); MakeControlEmpty(); MakeEmptyForm(); Entity_SL = null; obj_Comm = null; } } } } catch (Exception ex) { throw new Exception(ex.Message); } }
public ActionResult DeleteConfirmed(int id) { StockLocation stockLocation = Mapper.Map <StockLocation>(stockLocationService.Get(id)); stockLocation.IsDeleted = true; stockLocationService.Update(stockLocation); return(RedirectToAction("Index")); }
private void GetStockLocationList(HttpContext context, int pageIndex, int pageSize, string keyword) { var bll = new StockLocation(); IList <StockLocationInfo> list; int totalRecord = 0; StringBuilder sqlWhere = null; ParamsHelper parms = null; var zoneId = Guid.Empty; if (!string.IsNullOrWhiteSpace(context.Request.Form["ZoneId"])) { Guid.TryParse(context.Request.Form["ZoneId"], out zoneId); } if (!zoneId.Equals(Guid.Empty)) { if (sqlWhere == null) { sqlWhere = new StringBuilder(300); } if (parms == null) { parms = new ParamsHelper(); } sqlWhere.Append("and (ZoneId = @ZoneId) "); var parm = new SqlParameter("@ZoneId", SqlDbType.UniqueIdentifier); parm.Value = parm.Value = zoneId; parms.Add(parm); } if (!string.IsNullOrWhiteSpace(keyword)) { if (sqlWhere == null) { sqlWhere = new StringBuilder(200); } if (parms == null) { parms = new ParamsHelper(); } sqlWhere.Append("and (sl.Code like @Keyword or sl.Named like @Keyword) "); var parm = new SqlParameter("@Keyword", SqlDbType.NVarChar, 50); parm.Value = parm.Value = "%" + keyword + "%"; parms.Add(parm); } if (!zoneId.Equals(Guid.Empty)) { list = bll.GetList(sqlWhere == null ? null : sqlWhere.ToString(), parms == null ? null : parms.ToArray()); } else { list = bll.GetListByJoin(pageIndex, pageSize, out totalRecord, sqlWhere == null ? null : sqlWhere.ToString(), parms == null ? null : parms.ToArray()); } context.Response.Write(ResResult.ResJsonString(true, "", "{\"total\":" + totalRecord + ",\"rows\":" + JsonConvert.SerializeObject(list) + "}")); }
public async Task <StockItem> GetStock(string productCode) { ChannelResponse <StockLocation> stockLocation = await _stockClient.GetStockLocations(); StockLocation location = stockLocation?.Content.First(); var response = await _stockClient.GetStock(productCode, location.Id); return(response?.Content?.First()); }
//////////////////////////////////////////////////////////////////////////////////////////////////// public List <StockLocation> getActivedStockLocations() { try { StockLocation sl = new StockLocation(); sl.Status = 1; return(getStockLocation(sl)); } catch (Exception) { return(null); } }
private void resetAddForm() { try { isUpdateMode = false; selectedStockLocation = null; comboBox_status.SelectedIndex = -1; textBox_name.Clear(); button_save.Content = "Save"; } catch (Exception) { } }
public ActionResult Edit([Bind(Include = "Id,Name,CompanyId,FacilityId,Warehouse,Description,CreatedBy,CreatedAt,UpdatedBy,UpdatedAt,IsDeleted,DeletedBy,DeletedAt,IsActive,IpAddress,UserAgent,Location")] StockLocation stockLocation) { if (ModelState.IsValid) { var entity = Mapper.Map <StockLocation>(stockLocation); stockLocationService.Update(entity); return(RedirectToAction("Index")); } ViewBag.CompanyId = new SelectList(companyService.GetAll(), "Id", "Name", stockLocation.CompanyId); ViewBag.FacilityId = new SelectList(facilityService.GetAll(), "Id", "Name", stockLocation.FacilityId); return(View(stockLocation)); }
public String getStockLocationNameById(int id) { String name = null; try { StockLocation i = new StockLocation(); i.Id = id; name = getStockLocation(i)[0].Name; } catch (Exception) { } return(name); }
public static void CreateBookInventoryItems(IInventoryRepository inventory, IArticleRepository articleRepo) { var book1 = articleRepo.FindArticleById(1); var book2 = articleRepo.FindArticleById(2); var book3 = articleRepo.FindArticleById(3); var book4 = articleRepo.FindArticleById(4); var book5 = articleRepo.FindArticleById(5); var book6 = articleRepo.FindArticleById(6); var book7 = articleRepo.FindArticleById(7); var sl1 = new StockLocation { Hall = "1", Corridor = "1", Rack = "1", Level = "1", Position = "1", }; var sl2 = new StockLocation { Hall = "1", Corridor = "1", Rack = "1", Level = "1", Position = "2", }; var inv1 = new InventoryItem { Id = 1, Barcode = "DDC8C0EC7E0B4EB094A058762AC38FE7", Article = book1, PurchasedAt = new DateTime(2016, 3, 20), Condition = Condition.LikeNew, StockLocation = sl1 }; var inv2 = new InventoryItem { Id = 2, Barcode = "DC71308FA060404C847B87A1C9D18533", Article = book1, PurchasedAt = new DateTime(2016, 3, 20), Condition = Condition.VeryGood, StockLocation = sl1 }; var inv3 = new InventoryItem { Id = 3, Barcode = "185CCEB1353E4C2A95894C540C756722", Article = book2, PurchasedAt = new DateTime(2016, 3, 20), Condition = Condition.LikeNew, StockLocation = sl2 }; inventory.AddInventoryItems(new [] { inv1, inv2, inv3, }); }
private void switchToUpdateMode() { try { isUpdateMode = true; int id = dataGrid_stockLocations.SelectedItemID; StockLocation stockLocation = stockManagerImpl.getStockLocationById(id); selectedStockLocation = stockLocation; comboBox_status.SelectedValue = stockLocation.Status; textBox_name.Text = stockLocation.Name; button_save.Content = "Update"; } catch (Exception) { } }
public int InsertDetailsRecord(ref StockLocation Entity_Call, out string strError) { int iInsert = 0; strError = string.Empty; try { SqlParameter pAction = new SqlParameter(StockLocation._Action, SqlDbType.BigInt); SqlParameter pStockLocationID = new SqlParameter(StockLocation._StockLocationID, SqlDbType.BigInt); SqlParameter pEmployeeId = new SqlParameter(StockLocation._EmployeeId, SqlDbType.BigInt); SqlParameter pCpersonName = new SqlParameter(StockLocation._CpersonName, SqlDbType.NVarChar); SqlParameter pContactNo = new SqlParameter(StockLocation._ContactNo, SqlDbType.NVarChar); SqlParameter pMailId = new SqlParameter(StockLocation._MailId, SqlDbType.NVarChar); SqlParameter pPersonAddress = new SqlParameter(StockLocation._PersonAddress, SqlDbType.NVarChar); pAction.Value = 7; pStockLocationID.Value = Entity_Call.StockLocationID; pEmployeeId.Value = Entity_Call.EmployeeId; pCpersonName.Value = Entity_Call.CpersonName; pContactNo.Value = Entity_Call.ContactNo; pMailId.Value = Entity_Call.MailId; pPersonAddress.Value = Entity_Call.PersonAddress; SqlParameter[] Param = new SqlParameter[] { pAction, pStockLocationID, pEmployeeId, pCpersonName, pContactNo, pMailId, pPersonAddress }; Open(CONNECTION_STRING); BeginTransaction(); iInsert = SQLHelper.ExecuteNonQuery(_Connection, _Transaction, CommandType.StoredProcedure, StockLocation.SP_StockLocation, Param); if (iInsert > 0) { CommitTransaction(); } else { RollBackTransaction(); } } catch (Exception ex) { RollBackTransaction(); strError = ex.Message; } finally { Close(); } return(iInsert); }
public StockLocation getStockLocationById(int id) { StockLocation stockLocation = null; try { StockLocation sl = new StockLocation(); sl.Id = id; List <StockLocation> list = getStockLocation(sl); if (list.Count == 1) { stockLocation = list[0]; } } catch (Exception) { } return(stockLocation); }
public int DeleteRecord(ref StockLocation EntityCall, out string StrError) { int iDelete = 0; StrError = string.Empty; try { SqlParameter pAction = new SqlParameter(StockLocation._Action, SqlDbType.BigInt); SqlParameter pStockLocationId = new SqlParameter(StockLocation._StockLocationID, SqlDbType.BigInt); SqlParameter pDeletedBy = new SqlParameter(StockLocation._UserId, SqlDbType.BigInt); SqlParameter pDeletedDate = new SqlParameter(StockLocation._LoginDate, SqlDbType.DateTime); SqlParameter pIsDeleted = new SqlParameter(StockLocation._IsDeleted, SqlDbType.Bit); pAction.Value = 3; pStockLocationId.Value = EntityCall.StockLocationID; pDeletedBy.Value = EntityCall.UserId; pDeletedDate.Value = EntityCall.LoginDate; pIsDeleted.Value = EntityCall.IsDeleted; SqlParameter[] param = new SqlParameter[] { pAction, pStockLocationId, pDeletedBy, pDeletedDate, pIsDeleted }; Open(CONNECTION_STRING); BeginTransaction(); iDelete = SQLHelper.ExecuteNonQuery(_Connection, _Transaction, CommandType.StoredProcedure, StockLocation.SP_StockLocation, param); if (iDelete > 0) { CommitTransaction(); } else { RollBackTransaction(); } } catch (Exception ex) { RollBackTransaction(); StrError = ex.Message; } finally { Close(); } return(iDelete); }
public void ProcessStockLocationInfoRequest(StockLocationInfoRequest stockLocationInfoRequest) { StockLocationInfoResponse stockLocationInfoResponse = new StockLocationInfoResponse(); stockLocationInfoResponse.AdoptHeader(stockLocationInfoRequest); foreach (StockLocationInfo stockLocationInfo in this.stockLocationList) { StockLocation stockLocation = new StockLocation(); stockLocation.ID = stockLocationInfo.ID; stockLocation.Description = stockLocationInfo.Description; stockLocationInfoResponse.StockLocations.Add(stockLocation); } stockLocationInfoResponse.ConverterStream.Write(stockLocationInfoResponse); }
public ResResultModel GetSkuModel(object orderId, string productCode) { Guid gId = Guid.Empty; if (orderId != null) { Guid.TryParse(orderId.ToString(), out gId); } if (gId.Equals(Guid.Empty)) { return(ResResult.Response(false, "参数值不正确", "")); } if (string.IsNullOrWhiteSpace(productCode)) { return(ResResult.Response(false, "参数值不正确", "")); } var orpBll = new OrderReceiptProduct(); var model = orpBll.GetModelByProductcode(gId, productCode); if (model == null) { return(ResResult.Response(false, "数据不存在或已被删除", "")); } var stlBll = new StockLocation(); var stlModel = stlBll.GetList(1, 1, "", null).FirstOrDefault(); if (stlModel == null) { return(ResResult.Response(false, "未找到任何库位", "")); } var skuModel = new PdaSkuModel(); skuModel.ExpectedAmount = model.ExpectedQty; skuModel.ReceiptAmount = model.ReceiptQty; skuModel.ProductId = model.ProductId; skuModel.PackageId = model.PackageId; skuModel.Unit = model.Unit; skuModel.StockLocationId = stlModel.Id; skuModel.StockLocationCode = stlModel.Code; skuModel.StockLocationName = stlModel.Named; return(ResResult.Response(true, "调用成功", JsonConvert.SerializeObject(skuModel))); }
private bool update() { bool b = false; try { if (isValidForm()) { StockLocation stockLocation = selectedStockLocation; stockLocation.Name = textBox_name.TrimedText; stockLocation.Status = Convert.ToInt32(comboBox_status.SelectedValue); CommonMethods.setCDMDForUpdate(stockLocation); stockManagerImpl.updStockLocation(stockLocation); b = true; } } catch (Exception) { } return(b); }
public async Task <IActionResult> Create(StockLocation stockLocation) { if (ModelState.IsValid) { ICollection <Stock> newStocks = new List <Stock>(); var Products = _context.Products.ToList(); foreach (var Product in Products) { newStocks.Add(new Stock { ProductId = Product.Id, Quantity = 0 }); } stockLocation.Stock = newStocks; _context.Add(stockLocation); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(stockLocation)); }
public ActionResult Stock(int id) { var locationsList = db.Locations .Include(l => l.Stocks) .ToList(); var locations = new List <StockLocation>(); foreach (var location in locationsList) { var stock = location .Stocks .FirstOrDefault(s => s.LocationId == location.Id && s.ProductId == id); var sl = new StockLocation() { Location = location, Stock = stock == null ? 0 : stock.StockQuantity }; locations.Add(sl); } var model = new ProductStockViewModel() { Product = db.Products.FirstOrDefault(p => p.Id == id), Location = db.Locations.FirstOrDefault(), Locations = locations, Stock = 0 }; if (db.Stocks.Any(s => s.ProductId == model.Product.Id && s.LocationId == model.Location.Id)) { model.Stock = db.Stocks .FirstOrDefault(s => s.ProductId == model.Product.Id && s.LocationId == model.Location.Id) .StockQuantity; } return(View(model)); }
private void Bind() { Guid Id = Guid.Empty; if (!string.IsNullOrWhiteSpace(Request.QueryString["Id"])) { Guid.TryParse(Request.QueryString["Id"], out Id); } if (!Id.Equals(Guid.Empty)) { Page.Title = "编辑库位"; var bll = new StockLocation(); var model = bll.GetModelByJoin(Id); if (model != null) { hId.Value = model.Id.ToString(); hZoneId.Value = model.ZoneId.ToString(); txtCode.Value = model.Code; txtName.Value = model.Named; txtZone.Value = model.ZoneCode; txtRow.Value = model.Row.ToString(); txtLayer.Value = model.Layer.ToString(); txtCol.Value = model.Col.ToString(); txtPassway.Value = model.Passway.ToString(); txtWidth.Value = model.Width.ToString(); txtWide.Value = model.Wide.ToString(); txtHigh.Value = model.High.ToString(); txtVolume.Value = model.Volume.ToString(); txtCubage.Value = model.Cubage.ToString(); txtStackLimit.Value = model.StackLimit.ToString(); txtCarryWeight.Value = model.CarryWeight.ToString(); txtX.Value = model.Xc.ToString(); txtY.Value = model.Yc.ToString(); txtZ.Value = model.Zc.ToString(); txtOrientation.Value = model.Orientation.ToString(); txtGroundTrayQty.Value = model.GroundTrayQty.ToString(); txtRouteSeq.Value = model.RouteSeq; txtInsertTaskSeq.Value = model.InsertTaskSeq.ToString(); txtStatus.Value = model.Status; txtWarehouse.Value = model.Warehouse; txtLevelNum.Value = model.LevelNum.ToString(); txtPickArea.Value = model.PickArea; txtInventoryGroupId.Value = model.InventoryGroupId.ToString(); txtPickMethod.Value = model.PickMethod; BindControl bc = new BindControl(); bc.BindDdl(ddlIsMixPlace, typeof(EnumData.EnumIsOk), model.IsMixPlace.ToString()); bc.BindDdl(ddlIsBatchNum, typeof(EnumData.EnumIsOk), model.IsBatchNum.ToString()); bc.BindDdl(ddlIsLoseId, typeof(EnumData.EnumIsOk), model.IsLoseId.ToString()); bc.BindDdl(ddlStockLocationType, typeof(EnumData.EnumStockLocationType), model.StockLocationType); bc.BindDdl(ddlCtrType, typeof(EnumData.EnumStockLocationCtrType), model.CtrType); bc.BindDdl(ddlABC, typeof(EnumData.EnumAbc), model.ABC); bc.BindDdl(ddlStockLocationDeal, typeof(EnumData.EnumStockLocationDeal), model.StockLocationDeal); bc.BindDdl(ddlUseStatus, typeof(EnumData.EnumStockLocationUseStatus), model.UseStatus); } } else { txtWidth.Value = "0.00000"; txtWide.Value = "0.00000"; txtHigh.Value = "0.00000"; txtVolume.Value = "0.00000"; txtCubage.Value = "0.00000"; txtRow.Value = "0.00000"; txtLayer.Value = "0.00000"; txtCol.Value = "0.00000"; txtPassway.Value = "0.00000"; txtX.Value = "0.00000"; txtY.Value = "0.00000"; txtZ.Value = "0.00000"; txtOrientation.Value = "0.00000"; txtStackLimit.Value = "0.00000"; txtGroundTrayQty.Value = "0.00000"; txtCarryWeight.Value = "0.00000"; txtLevelNum.Value = "0.00000"; txtInsertTaskSeq.Value = "0.00000"; txtInventoryGroupId.Value = "0.00000"; BindControl bc = new BindControl(); bc.BindDdl(ddlIsMixPlace, typeof(EnumData.EnumIsOk), ""); bc.BindDdl(ddlIsBatchNum, typeof(EnumData.EnumIsOk), ""); bc.BindDdl(ddlIsLoseId, typeof(EnumData.EnumIsOk), ""); bc.BindDdl(ddlStockLocationType, typeof(EnumData.EnumStockLocationType), "", ""); bc.BindDdl(ddlCtrType, typeof(EnumData.EnumStockLocationCtrType), "", EnumData.EnumStockLocationCtrType.常规存储.ToString()); bc.BindDdl(ddlABC, typeof(EnumData.EnumAbc), "", ""); bc.BindDdl(ddlStockLocationDeal, typeof(EnumData.EnumStockLocationDeal), "", ""); bc.BindDdl(ddlUseStatus, typeof(EnumData.EnumStockLocationUseStatus), "", ""); } }
public void Insert(StockLocation stockLocation) { stockLocationRepository.Insert(stockLocation); unitOfWork.SaveChanges(); }
public void Update(StockLocation stockLocation) { stockLocationRepository.Update(stockLocation); unitOfWork.SaveChanges(); }