public void InformDepartmentStockInSuccess(Department department, DepartmentStockIn stockIn,long stockOutId) { ServerUtility.Log(logger, department.DepartmentId + " inform stock in back success. "); _callbackSubStockList.ForEach( delegate(IDepartmentStockOutCallback callback) { try { callback.NotifyStockInSuccess(department,stockIn,stockOutId); } catch (Exception) { } }); }
public void Sync(DepartmentStockIn data) { DepartmentStockIn DepartmentStockIn = DepartmentStockInDAO.FindById(data.DepartmentStockInPK); if (DepartmentStockIn == null) { DepartmentStockInDAO.Add(data); } else { ObjectCriteria criteria = new ObjectCriteria(); // currently we do not accept update stock in //return; // amend for debug DepartmentStockInDAO.Update(data); } IList productMasterIds = new ArrayList(); IList productIds = new ArrayList(); IList priceList = new ArrayList(); IList quantityList = new ArrayList(); // put master data first foreach (DepartmentStockInDetail detail in data.DepartmentStockInDetails) { if (detail.Product.ProductMaster.ProductColor != null) { ProductColor color = ProductColorDAO.FindById(detail.Product.ProductMaster.ProductColor.ColorId); if (color == null) { ProductColorDAO.Add(detail.Product.ProductMaster.ProductColor); } } if (detail.Product.ProductMaster.ProductSize != null) { ProductSize Size = ProductSizeDAO.FindById(detail.Product.ProductMaster.ProductSize.SizeId); if (Size == null) { ProductSizeDAO.Add(detail.Product.ProductMaster.ProductSize); } } if (detail.Product.ProductMaster.ProductType != null) { ProductType Type = ProductTypeDAO.FindById(detail.Product.ProductMaster.ProductType.TypeId); if (Type == null) { ProductTypeDAO.Add(detail.Product.ProductMaster.ProductType); } } if (detail.Product.ProductMaster.Country != null) { Country Country = CountryDAO.FindById(detail.Product.ProductMaster.Country.CountryId); if (Country == null) { CountryDAO.Add(detail.Product.ProductMaster.Country); } } if (detail.Product.ProductMaster.Distributor != null) { Distributor Distributor = DistributorDAO.FindById(detail.Product.ProductMaster.Distributor.DistributorId); if (Distributor == null) { DistributorDAO.Add(detail.Product.ProductMaster.Distributor); } } if (detail.Product.ProductMaster.Packager != null) { Packager Packager = PackagerDAO.FindById(detail.Product.ProductMaster.Packager.PackagerId); if (Packager == null) { PackagerDAO.Add(detail.Product.ProductMaster.Packager); } } if (detail.Product.ProductMaster.Manufacturer != null) { Manufacturer Manufacturer = ManufacturerDAO.FindById(detail.Product.ProductMaster.Manufacturer.ManufacturerId); if (Manufacturer == null) { ManufacturerDAO.Add(detail.Product.ProductMaster.Manufacturer); } } ProductMaster ProductMaster = ProductMasterDAO.FindById(detail.Product.ProductMaster.ProductMasterId); if (ProductMaster == null) { ProductMasterDAO.Add(detail.Product.ProductMaster); } else { ProductMaster.Country = detail.Product.ProductMaster.Country; ProductMaster.Packager = detail.Product.ProductMaster.Packager; ProductMaster.ProductColor = detail.Product.ProductMaster.ProductColor; ProductMaster.ProductFullName = detail.Product.ProductMaster.ProductFullName; ProductMaster.ProductName = detail.Product.ProductMaster.ProductName; ProductMaster.ProductSize = detail.Product.ProductMaster.ProductSize; ProductMaster.ProductType = detail.Product.ProductMaster.ProductType; ProductMaster.UpdateDate = detail.Product.ProductMaster.UpdateDate; ProductMaster.UpdateId = detail.Product.ProductMaster.UpdateId; ProductMaster.CreateDate = detail.Product.ProductMaster.CreateDate; ProductMaster.CreateId = detail.Product.ProductMaster.CreateId; ProductMaster.Distributor = detail.Product.ProductMaster.Distributor; ProductMaster.Manufacturer = detail.Product.ProductMaster.Manufacturer; ProductMaster.ImagePath = detail.Product.ProductMaster.ImagePath; ProductMaster.ExclusiveKey = detail.Product.ProductMaster.ExclusiveKey; ProductMasterDAO.Update(ProductMaster); } if (!productMasterIds.Contains(detail.Product.ProductMaster.ProductMasterId)) { productMasterIds.Add(detail.Product.ProductMaster.ProductMasterId); priceList.Add(detail.Price); } Product Product = ProductDAO.FindById(detail.Product.ProductId); if (Product == null) { ProductDAO.Add(detail.Product); } else { Product.UpdateDate = detail.Product.UpdateDate; Product.UpdateId = detail.Product.UpdateId; Product.CreateDate = detail.Product.CreateDate; Product.CreateId = detail.Product.CreateId; Product.ProductMaster = detail.Product.ProductMaster; Product.Quantity = detail.Product.Quantity; Product.Price = detail.Product.Price; ProductDAO.Update(Product); } if (!productIds.Contains(detail.Product.ProductId)) { productIds.Add(detail.Product.ProductId); quantityList.Add(detail.Quantity); } DepartmentStockInDetail DepartmentStockInDetail = DepartmentStockInDetailDAO.FindById(detail.DepartmentStockInDetailPK); if (DepartmentStockInDetail == null) { DepartmentStockInDetailDAO.Add(detail); } else { DepartmentStockInDetail.UpdateDate = detail.UpdateDate; DepartmentStockInDetail.UpdateId = detail.UpdateId; DepartmentStockInDetail.CreateDate = detail.CreateDate; DepartmentStockInDetail.CreateId = detail.CreateId; DepartmentStockInDetail.Quantity = DepartmentStockInDetail.Quantity; DepartmentStockInDetail.Price = DepartmentStockInDetail.Price; DepartmentStockInDetailDAO.Update(DepartmentStockInDetail); } } // update price if (productMasterIds.Count > 0) { var criteria = new ObjectCriteria(); criteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO); criteria.AddEqCriteria("DepartmentPricePK.DepartmentId", (long)0); criteria.AddSearchInCriteria("DepartmentPricePK.ProductMasterId", productMasterIds); IList deptPriceList = DepartmentPriceDAO.FindAll(criteria); int i = 0; foreach (string productMasterId in productMasterIds) { DepartmentPrice price = null; foreach (DepartmentPrice price1 in deptPriceList) { if (price1.DepartmentPricePK.ProductMasterId.Equals(productMasterId)) { price = price1; price.Price = (Int64)priceList[i]; break; } } if (price == null) { price = new DepartmentPrice { DepartmentPricePK = new DepartmentPricePK{DepartmentId = 0, ProductMasterId = productMasterId}, Price = (Int64)priceList[i], CreateDate = DateTime.Now, CreateId = ClientInfo.getInstance().LoggedUser.Name, UpdateDate = DateTime.Now, UpdateId = ClientInfo.getInstance().LoggedUser.Name }; DepartmentPriceDAO.Add(price); } else { price.UpdateDate = DateTime.Now; price.UpdateId = ClientInfo.getInstance().LoggedUser.Name; DepartmentPriceDAO.Update(price); } i++; } } if (productIds.Count > 0) { var criteria = new ObjectCriteria(); criteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO); criteria.AddEqCriteria("DepartmentStockPK.DepartmentId", data.DepartmentStockInPK.DepartmentId); criteria.AddSearchInCriteria("DepartmentStockPK.ProductId", productIds); IList stockList = DepartmentStockDAO.FindAll(criteria); int i = 0; foreach (string productId in productIds) { DepartmentStock stock = null; foreach (DepartmentStock price1 in stockList) { if (price1.DepartmentStockPK.ProductId.Equals(productId)) { stock = price1; //stock.Quantity += (Int64)quantityList[i]; stock.GoodQuantity += (Int64)quantityList[i]; stock.Quantity += (Int64) quantityList[i]; break; } } if (stock == null) { stock = new DepartmentStock { DepartmentStockPK = new DepartmentStockPK { DepartmentId = data.DepartmentStockInPK.DepartmentId, ProductId = productId }, Quantity = (Int64)quantityList[i], GoodQuantity = (Int64)quantityList[i], CreateDate = DateTime.Now, CreateId = ClientInfo.getInstance().LoggedUser.Name, UpdateDate = DateTime.Now, UpdateId = ClientInfo.getInstance().LoggedUser.Name }; DepartmentStockDAO.Add(stock); } else { stock.UpdateId = ClientInfo.getInstance().LoggedUser.Name; stock.UpdateDate = DateTime.Now; DepartmentStockDAO.Update(stock); } i++; } } if (data.Department != null) { Department dept = DepartmentDAO.FindById(data.Department.DepartmentId); if (dept == null) { DepartmentDAO.Add(data.Department); } else { //dept.Active = data.Department.Active; dept.Address = data.Department.Address; dept.DepartmentName = data.Department.DepartmentName; dept.ManagerId = data.Department.ManagerId; dept.StartDate = data.Department.StartDate; DepartmentDAO.Update(dept); } foreach (Employee employee in data.Department.Employees) { Employee emp = EmployeeDAO.FindById(employee.EmployeePK); if (emp == null) { EmployeeDAO.Add(employee); if (employee.EmployeeInfo != null) { EmployeeDetailDAO.Add(employee.EmployeeInfo); } } else { emp.DelFlg = employee.DelFlg; EmployeeDAO.Update(emp); if (employee.EmployeeInfo != null) { EmployeeDetailDAO.Update(employee.EmployeeInfo); } } } } }
private void btnAddProduct_Click(object sender, EventArgs e) { // create DepartmentStockIn if(deptSI==null) { deptSI = new DepartmentStockIn(); } deptSI.CreateDate = DateTime.Now; deptSI.UpdateDate = DateTime.Now; deptSI.CreateId = ClientInfo.getInstance().LoggedUser.Name; deptSI.UpdateId = ClientInfo.getInstance().LoggedUser.Name; deptSI.ExclusiveKey = 0; int maxAddedItemsCount = int.Parse(numericUpDown.Text); for (int i = 0; i < maxAddedItemsCount; i++) { DepartmentStockInDetail deptSIDet = CreateNewStockInDetail(); } deptSI.DepartmentStockInDetails = ObjectConverter.ConvertToNonGenericList<DepartmentStockInDetail>(deptSIDetailList); bdsDeptStockIn.EndEdit(); }
private void btnSave_Click(object sender, EventArgs e) { string deptName = ""; try { int index = cbbDept.SelectedIndex; if(index == 0 ) { MessageBox.Show("Bạn hãy chọn cửa hàng để xuất hàng", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } deptName = ((Department)bdsDept[index]).DepartmentName; } catch (Exception) { } DialogResult dResult = MessageBox.Show("Bạn muốn xuất hàng cho cửa hàng " + deptName + " ?", "Xác nhận",MessageBoxButtons.YesNo,MessageBoxIcon.Warning,MessageBoxDefaultButton.Button2); if(dResult != System.Windows.Forms.DialogResult.Yes) { return; } bool isNeedClearData = (deptSI == null || deptSI.DepartmentStockInPK == null || string.IsNullOrEmpty(deptSI.DepartmentStockInPK.StockInId)); DepartmentStockIn result = SaveDeptStockIn(true); if (isNeedClearData && result != null) { if (!chkKeepInputInfo.Checked) { deptSI = new DepartmentStockIn(); deptSIDetailList.Clear(); txtDexcription.Text = ""; txtSumProduct.Text = ""; txtSumValue.Text = ""; CreateNewStockInDetail(); } else { deptSI = new DepartmentStockIn(); RefrefshDeptSIDetailList(); txtDexcription.Text = ""; txtSumProduct.Text = ""; txtSumValue.Text = ""; } } }
public void Update(DepartmentStockIn data) { /*data.DepartmentId = CurrentDepartment.Get().DepartmentId; data.UpdateDate = DateTime.Now; data.UpdateId = ClientInfo.getInstance().LoggedUser.Name; int delFlg = 0; foreach (DepartmentStockInDetail stockInDetail in data.DepartmentStockInDetails) { // add product Product product = stockInDetail.Product; if (string.IsNullOrEmpty(product.ProductId)) { // TODO product.ProductId = productId++; product.CreateDate = DateTime.Now; product.UpdateDate = DateTime.Now; product.UpdateId = ClientInfo.getInstance().LoggedUser.Name; product.CreateId = ClientInfo.getInstance().LoggedUser.Name; ProductDAO.Add(product); // add dept stock in var detailPK = new DepartmentStockInDetailPK { DepartmentId = data.DepartmentId, ProductId = product.ProductId, StockInId = data.DepartmentStockInPK.StockInId }; stockInDetail.DepartmentStockInDetailPK = detailPK; stockInDetail.CreateDate = DateTime.Now; stockInDetail.UpdateDate = DateTime.Now; stockInDetail.UpdateId = ClientInfo.getInstance().LoggedUser.Name; stockInDetail.CreateId = ClientInfo.getInstance().LoggedUser.Name; DepartmentStockInDetailDAO.Add(stockInDetail); // dept stock var stockPk = new DepartmentStockPK { DepartmentId = data.DepartmentId, ProductId = product.ProductId }; var departmentStock = new DepartmentStock { DepartmentStockPK = stockPk, CreateDate = DateTime.Now, UpdateDate = DateTime.Now, Product = product, //Quantity = product.Quantity, GoodQuantity =product.Quantity, Quantity = stockInDetail.Quantity, GoodQuantity = stockInDetail.Quantity, OnStorePrice = stockInDetail.OnStorePrice }; departmentStock.UpdateId = ClientInfo.getInstance().LoggedUser.Name; departmentStock.CreateId = ClientInfo.getInstance().LoggedUser.Name; DepartmentStockDAO.Add(departmentStock); var pricePk = new DepartmentPricePK { DepartmentId = data.DepartmentId, ProductMasterId = product.ProductMaster.ProductMasterId }; var price = DepartmentPriceDAO.FindById(pricePk); if (price == null) { price = new DepartmentPrice { DepartmentPricePK = pricePk, Price = stockInDetail.OnStorePrice, UpdateDate = DateTime.Now, CreateDate = DateTime.Now }; price.UpdateId = ClientInfo.getInstance().LoggedUser.Name; price.CreateId = ClientInfo.getInstance().LoggedUser.Name; DepartmentPriceDAO.Add(price); } } else { var temProduct = ProductDAO.FindById(product.ProductId); if (stockInDetail.DelFlg == 0) { temProduct.Quantity = product.Quantity; temProduct.Price = product.Price; } else { temProduct.DelFlg = 1; delFlg++; } temProduct.UpdateDate = DateTime.Now; product.UpdateId = ClientInfo.getInstance().LoggedUser.Name; ProductDAO.Update(temProduct); // update dept stock in var detailPK = new DepartmentStockInDetailPK { DepartmentId = data.DepartmentId, ProductId = product.ProductId, StockInId = data.DepartmentStockInPK.StockInId }; stockInDetail.DepartmentStockInDetailPK = detailPK; stockInDetail.UpdateDate = DateTime.Now; stockInDetail.UpdateId = ClientInfo.getInstance().LoggedUser.Name; DepartmentStockInDetailDAO.Update(stockInDetail); // update stock var stockPk = new DepartmentStockPK { DepartmentId = data.DepartmentId, ProductId = product.ProductId }; var departmentStock = DepartmentStockDAO.FindById(stockPk); departmentStock.UpdateDate = DateTime.Now; if (stockInDetail.DelFlg == 0) { //departmentStock.Quantity = departmentStock.Quantity - // (stockInDetail.OldQuantity - stockInDetail.Quantity); departmentStock.GoodQuantity = departmentStock.GoodQuantity - (stockInDetail.OldQuantity - stockInDetail.Quantity); departmentStock.Quantity = departmentStock.GoodQuantity + departmentStock.ErrorQuantity + departmentStock.LostQuantity + departmentStock.DamageQuantity + departmentStock.UnconfirmQuantity; } else { departmentStock.DelFlg = 1; } departmentStock.UpdateId = ClientInfo.getInstance().LoggedUser.Name; departmentStock.CreateId = ClientInfo.getInstance().LoggedUser.Name; DepartmentStockDAO.Update(departmentStock); var pricePk = new DepartmentPricePK { DepartmentId = data.DepartmentId, ProductMasterId = product.ProductMaster.ProductMasterId }; var price = DepartmentPriceDAO.FindById(pricePk); if (price == null) { price = new DepartmentPrice { DepartmentPricePK = pricePk, Price = stockInDetail.OnStorePrice, UpdateDate = DateTime.Now, CreateDate = DateTime.Now }; price.UpdateId = ClientInfo.getInstance().LoggedUser.Name; price.CreateId = ClientInfo.getInstance().LoggedUser.Name; DepartmentPriceDAO.Add(price); } } } if (delFlg == data.DepartmentStockInDetails.Count) { data.DelFlg = 1; } DepartmentStockInDAO.Update(data); */ }
private void btnSave_Click(object sender, EventArgs e) { long cost = 0; if (!NumberUtility.CheckLongNullIsZero(txtCost.Text, out cost) || cost < 0) { MessageBox.Show("Chi phí phải là số dương"); return; } if (deptSIDetailList.Count == 0) { MessageBox.Show("Không có sản phẩm nào để nhập kho!!!!"); return; } // validate quantity StringBuilder errMsg = new StringBuilder(); int line = 1; foreach (DepartmentStockInDetail detail in deptSIDetailList) { if (detail.Quantity <= 0) { MessageBox.Show("Lỗi ở dòng " + line + " : Số lượng phải lớn hơn 0"); return; } long remainReStock = detail.StockOutQuantity - detail.ReStockQuantity; if (detail.Quantity > remainReStock) { MessageBox.Show("Lỗi ở dòng " + errMsg.ToString() + " : Số lượng còn tái nhập được là " + remainReStock.ToString()); return; } line++; } if (deptSI == null) { deptSI = new DepartmentStockIn(); deptSI.DepartmentStockInPK = new DepartmentStockInPK(); } bool isNeedClearData = string.IsNullOrEmpty(deptSI.DepartmentStockInPK.StockInId); deptSI.DepartmentId = CurrentDepartment.Get().DepartmentId; deptSI.StockInDate = dtpImportDate.Value; deptSI.DepartmentStockInDetails = deptSIDetailList; deptSI.Description = txtDexcription.Text; deptSI.StockInCost = cost; var eventArgs = new DepartmentStockInEventArgs(); eventArgs.DepartmentStockIn = deptSI; EventUtility.fireEvent(SaveReDepartmentStockInEvent, this, eventArgs); if (eventArgs.EventResult != null) { MessageBox.Show("Lưu thành công"); if (isNeedClearData) { deptSI = new DepartmentStockIn(); deptSIDetailList.Clear(); txtBarcode.Text = ""; txtQty.Text = ""; txtDexcription.Text = ""; txtSumProduct.Text = ""; txtSumValue.Text = ""; //CreateNewStockInDetail(); } } else { //MessageBox.Show("Có lỗi khi lưu"); } }
private bool DoStockIn(DataAccessLayer dal, Department department, DepartmentStockIn stockIn, bool NeedUpdateMasterData) { string deptStr = ""; string extraZero = ""; string startNum = ""; if (department.DepartmentId > 999) { deptStr = department.DepartmentId.ToString(); extraZero = "000"; startNum = "001"; } else { deptStr = string.Format("{0:000}", department.DepartmentId); extraZero = "00000"; startNum = "00001"; } string dateStr = DateTime.Now.ToString("yyMMdd"); var selectMaxIdSQL = " select max(stock_in_id) from department_stock_in where stock_in_id > '" + dateStr + deptStr + extraZero + "'"; ServerUtility.Log(logger, selectMaxIdSQL); var maxId = dal.GetSingleValue(selectMaxIdSQL); string stockInId = ""; if(maxId == null || maxId.ToString() == string.Empty) { stockInId = dateStr + deptStr + startNum; } else { stockInId = string.Format("{0:00000000000000}", (Int64.Parse(maxId.ToString()) + 1)); } string insertStockIn = " insert into department_stock_in(department_id,stock_in_id,stock_in_date,create_date,create_id,update_date,update_id,del_flg,exclusive_key) " + " values(" + department.DepartmentId + "," + "'" + stockInId + "'," + "'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'," + "'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'," + "'admin'," + "'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'," + "'admin'," + "0," + "1)"; // insert department-stock-in ServerUtility.Log(logger, insertStockIn); dal.ExecuteQuery(insertStockIn); // insert department-stock-in-details foreach (DepartmentStockInDetail inDetail in stockIn.DepartmentStockInDetails) { if(NeedUpdateMasterData) { ProcessStockInDetail(inDetail, dal); } // insert department-stock-in-detail string insertStockInDetail = "insert into department_stock_in_detail(department_id,stock_in_id,product_id,product_master_id,quantity, price, del_flg,create_id,create_date,update_id,update_date) " + " values(" + department.DepartmentId + ",'" + stockInId + "','" + inDetail.Product.ProductId + "','" + inDetail.Product.ProductMaster.ProductMasterId + "'," + inDetail.Quantity + "," + inDetail.Price + "," + "0," + "'admin'," + "'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'," + "'admin'," + "'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "')"; ServerUtility.Log(logger, insertStockInDetail); dal.ExecuteQuery(insertStockInDetail); // insert department-stock //string insertStock = "insert into stock(stock_id,product_id,product_master_id,quantity,create_date,good_quantity,create_id,del_flg) values(18854,'001419317H01','0000000014193',1,'2009-07-27 00:00:00',1,'admin',0)"; // stock string reqDeptStock = "Select product_id from department_stock where product_id ='" + inDetail.Product.ProductId + "'"; ServerUtility.Log(logger, reqDeptStock); var id = dal.GetSingleValue(reqDeptStock); if (id == null || id.ToString() == string.Empty) { string insertStock = "insert into department_stock(department_id, product_id, product_master_id, quantity, good_quantity, create_id,create_date,update_id,update_date) values (" + department.DepartmentId + ", '" + inDetail.Product.ProductId + "', '" + inDetail.Product.ProductMaster.ProductMasterId + "', " + inDetail.Quantity + ", " + inDetail.Quantity + ", " + "'admin'," + "'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'," + "'admin'," + "'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "')"; ServerUtility.Log(logger, insertStock); dal.ExecuteQuery(insertStock); } else { string updateStock = " update department_stock " + " set quantity = quantity + " + inDetail.Quantity + " , " + " good_quantity = good_quantity + " + inDetail.Quantity + " " + " where product_id = '" + inDetail.Product.ProductId + "' " + " and department_id = " + department.DepartmentId; ServerUtility.Log(logger, updateStock); dal.ExecuteQuery(updateStock); } } return true; }
public void MakeRawDepartmentStockIn(Department department, DepartmentStockIn stockIn) { DataAccessLayer dalSubStock = new DataAccessLayer(Properties.Settings.Default.SubStockDB); DataAccessLayer dalSalePoint = new DataAccessLayer(Properties.Settings.Default.SalePointDB); try { DepartmentStockOut stockOut = new FastDepartmentStockOutMapper().Convert(stockIn); stockOut.DepartmentStockOutPK = new DepartmentStockOutPK(); // cheat for stock in back to substock stockOut.DepartmentStockOutPK.DepartmentId = stockIn.DepartmentStockInPK.DepartmentId; Department subStockDept = new Department { DepartmentId = stockIn.DepartmentStockInPK.DepartmentId }; DoStockOut(dalSalePoint, department, stockOut, false); DoStockIn(dalSubStock, subStockDept, stockIn, false); InformMessage(subStockDept.DepartmentId, DEPTTOSUB, false, subStockDept.DepartmentId + " lấy hàng từ " + department.DepartmentId + " thành công !"); } catch (Exception exception) { ServerUtility.Log(logger,exception.Message); ServerUtility.Log(logger,exception.StackTrace); InformMessage(stockIn.DepartmentStockInPK.DepartmentId,DEPTTOSUB,true,exception.Message); } }
public void NotifyUpdateStockOutFlag(Department department, DepartmentStockIn stockIn,long stockOutId) { // dont need to implment }
public void NotifyStockInSuccess(Department department, DepartmentStockIn stockIn,long stockOutId) { GlobalMessage message = (GlobalMessage)GlobalUtility.GetObject("GlobalMessage"); message.PublishMessage(ChannelConstants.DEPT2SUBSTOCK_STOCKOUT, "Đã lấy hàng thành công!"); ClientUtility.Log(logger, department.DepartmentId + " Nhap lai hang THANH CONG." + stockIn.ToString()); }
public void NotifyStockInFail(Department department, DepartmentStockIn stockIn, long id) { GlobalMessage message = (GlobalMessage)GlobalUtility.GetObject("GlobalMessage"); ClientUtility.Log(logger, department.DepartmentId + " Nhap lai hang THAT BAI." + stockIn.ToString()); message.PublishError(ChannelConstants.DEPT2SUBSTOCK_STOCKOUT, "Đã lấy hàng thất bại!"); }
public void NotifyNewDepartmentStockIn(Department department, DepartmentStockIn stockOut) { // don't need to implement }
public void NotifyMultiStockInSuccess(Department department, DepartmentStockIn[] stockInList, long id) { GlobalMessage message = (GlobalMessage)GlobalUtility.GetObject("GlobalMessage"); try { foreach (DepartmentStockIn stockIn in stockInList) { if (stockIn != null) { if (stockIn.DepartmentStockInPK.DepartmentId != CurrentDepartment.Get().DepartmentId) { return; } ClientUtility.Log(logger, department.DepartmentId + " dang nhan thong tin nhap hang"); DepartmentStockInLogic.AddStockInBack(stockIn); ClientUtility.Log(logger, " Nhap lai hang thanh cong."); message.PublishMessage(ChannelConstants.DEPT2SUBSTOCK_STOCKOUT, "Đã lấy hàng thành công!"); serverService.UpdateStockInBackFlag(department, stockIn, id); } else { ClientUtility.Log(logger, department.DepartmentId + " nhap lai hang that bai."); message.PublishError(ChannelConstants.DEPT2SUBSTOCK_STOCKOUT, "Đã lấy hàng thất bại!"); } } } catch (Exception exception) { ClientUtility.Log(logger, exception.Message); } }
private DepartmentStockIn SaveDeptStockIn(bool isNeedSync) { // check for department var dept = cbbDept.SelectedItem as Department; if (dept == null) { MessageBox.Show("Không có cửa hàng nào để xuất hàng"); return null; } // first remove all blank row int count = 0; int length = deptSIDetailList.Count; for (int i = 0; i < length - count; i++) { DepartmentStockInDetail detail = deptSIDetailList[i]; if (string.IsNullOrEmpty(detail.Product.ProductMaster.ProductMasterId) && string.IsNullOrEmpty(detail.Product.ProductMaster.ProductName)) { deptSIDetailList.RemoveAt(i - count); count++; } } if (deptSIDetailList.Count == 0) { MessageBox.Show("Không có sản phẩm nào để xuất!!!!"); return null; } // validate quantity StringBuilder errMsg = new StringBuilder(); int line = 1; foreach (DepartmentStockInDetail detail in deptSIDetailList) { if (detail.Quantity == 0) { errMsg.Append(" " + line + " "); } line++; } if (errMsg.Length > 0) { MessageBox.Show("Lỗi ở dòng " + errMsg.ToString() + " : Số lượng phải lớn hơn 0"); return null; } foreach (DepartmentStockInDetail detail in deptSIDetailList) { count = 0; foreach (DepartmentStockInDetail detail2 in deptSIDetailList) { if (detail.DelFlg == CommonConstants.DEL_FLG_NO && detail.Product.ProductMaster.ProductMasterId.Equals(detail2.Product.ProductMaster.ProductMasterId)) { if (count == 0) { count++; } else { MessageBox.Show("Lỗi : Mã hàng " + detail.Product.ProductMaster.ProductMasterId + " nhập 2 lần"); return null; } } } } if (deptSI == null) { deptSI = new DepartmentStockIn(); } deptSI.StockInDate = dtpImportDate.Value; deptSI.DepartmentId = dept.DepartmentId; deptSI.Description = txtDexcription.Text; deptSI.DepartmentStockInDetails = deptSIDetailList; var eventArgs = new DepartmentStockInEventArgs(); eventArgs.IsForSync = isNeedSync; eventArgs.DepartmentStockIn = deptSI; eventArgs.ExportGoodsToDepartment = true; EventUtility.fireEvent(SaveDepartmentStockInEvent, this, eventArgs); if (eventArgs.EventResult != null) { MessageBox.Show("Lưu thành công"); txtDexcription.Text = ""; txtQuantity.Text = ""; txtSumValue.Text = ""; txtSumProduct.Text = ""; ClearSelectionOnListBox(lstColor); ClearSelectionOnListBox(lstSize); return eventArgs.DepartmentStockIn; } else { return null; } }
private void btnSaveAndExport_Click(object sender, EventArgs e) { // Create new SaveFileDialog object SaveFileDialog DialogSave = new SaveFileDialog(); // Default file extension DialogSave.DefaultExt = "xac"; // Available file extensions DialogSave.Filter = "POS file (*.xac)|*.xac"; // Adds a extension if the user does not DialogSave.AddExtension = true; // Restores the selected directory, next time DialogSave.RestoreDirectory = true; // Startup directory DialogSave.InitialDirectory = @"C:/"; bool isNeedClearData = (deptSI == null || deptSI.DepartmentStockInPK == null || string.IsNullOrEmpty(deptSI.DepartmentStockInPK.StockInId)); // Show the dialog and process the result if (DialogSave.ShowDialog() == DialogResult.OK) { DepartmentStockIn dept = SaveDeptStockIn(true); if (dept != null) { IList list = new ArrayList(); foreach (DepartmentStockInDetail detail in dept.DepartmentStockInDetails) { list.Add(detail); AppFrame.Model.Product p = detail.Product; } dept.DepartmentStockInDetails = list; Stream stream = File.Open(DialogSave.FileName, FileMode.Create); BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(stream, dept); stream.Close(); if (isNeedClearData) { deptSI = new DepartmentStockIn(); deptSIDetailList.Clear(); CreateNewStockInDetail(); } } } }
public void NotifyUpdateStockOutFlag(Department department, DepartmentStockIn stockIn, long stockOutId) { }
public void MakeDepartmentStockIn(Department department, DepartmentStockIn stockOut) { ServerUtility.Log(logger, " Stock-in dispatching from " + department.DepartmentId); _callbackList.ForEach( delegate(IDepartmentStockOutCallback callback) { try { callback.NotifyNewDepartmentStockIn(department, stockOut); } catch (Exception) { } }); }
private void btnAddProduct_Click(object sender, EventArgs e) { // create DepartmentStockIn if (deptSO == null) { deptSO = new DepartmentStockIn(); } deptSO.CreateDate = DateTime.Now; deptSO.UpdateDate = DateTime.Now; deptSO.CreateId = ClientInfo.getInstance().LoggedUser.Name; deptSO.UpdateId = ClientInfo.getInstance().LoggedUser.Name; deptSO.ExclusiveKey = 0; // int maxAddedItemsCount = int.Parse(numericUpDown.Text); // for (int i = 0; i < maxAddedItemsCount; i++) // { // StockInDetail deptSIDet = CreateNewStockInDetail(); // // } deptSO.DepartmentStockInDetails = ObjectConverter.ConvertToNonGenericList<DepartmentStockInDetail>(deptSODetailList); bdsStockIn.EndEdit(); // for (int j = 0; j < maxAddedItemsCount; j++) // { // for (int i = 0; i <= SELL_PRICE_POS; i++) // { // dgvDeptStockIn[i, deptSODetailList.Count - j - 1].ReadOnly = false; // } // } }
public void UpdateStockInBackFlag(Department department, DepartmentStockIn stockIn,long stockOutId) { ServerUtility.Log(logger, " Cap nhat co xuat hang o " + department.DepartmentId); _callbackList.ForEach( delegate(IDepartmentStockOutCallback callback) { try { // update stock out flag in department callback.NotifyUpdateStockOutFlag(department, stockIn,stockOutId); } catch (Exception) { } }); }
private void btnSave_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show( "Bạn hãy kiểm tra kỹ trước khi lưu số liệu bởi vì sau khi lưu sẽ không thay đổi được nữa. Bạn có chắc chắn muốn lưu ?","Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if(result == System.Windows.Forms.DialogResult.No) { return; } // first remove all blank row int count = 0; int length = deptSODetailList.Count; for (int i = 0; i < length - count; i++) { DepartmentStockInDetail detail = deptSODetailList[i]; if (string.IsNullOrEmpty(detail.Product.ProductMaster.ProductMasterId) && string.IsNullOrEmpty(detail.Product.ProductMaster.ProductName)) { deptSODetailList.RemoveAt(i - count); count++; } } if (deptSODetailList.Count == 0) { MessageBox.Show("Không có sản phẩm nào để nhập kho!!!!"); return; } // validate quantity int line = 1; foreach (DepartmentStockInDetail detail in deptSODetailList) { detail.CreateDate = DateTime.Now; detail.CreateId = ClientInfo.getInstance().LoggedUser.Name; detail.UpdateDate = DateTime.Now; detail.UpdateId = ClientInfo.getInstance().LoggedUser.Name; foreach (DepartmentStock stock in departmentStockList) { if (detail.Product.ProductId.Equals(stock.Product.ProductId)) { if (detail.Quantity < 0) { MessageBox.Show("Lỗi ở dòng " + line + " : Số lượng phải là số dương. "); return; } } } line++; } // confirm before save DialogResult isConfirmed = System.Windows.Forms.DialogResult.Cancel; if (!ClientSetting.ConfirmByEmployeeId) { LoginForm loginForm = GlobalUtility.GetFormObject<LoginForm>(FormConstants.CONFIRM_LOGIN_VIEW); loginForm.StartPosition = FormStartPosition.CenterScreen; isConfirmed = loginForm.ShowDialog(); } else { EmployeeCheckingForm employeeCheckingForm = GlobalUtility.GetFormObject<EmployeeCheckingForm>(FormConstants.EMPLOYEE_CHECKING_VIEW); employeeCheckingForm.StartPosition = FormStartPosition.CenterScreen; isConfirmed = employeeCheckingForm.ShowDialog(); } if (isConfirmed != System.Windows.Forms.DialogResult.OK) { return; } // continue stock in if(rdoFastStockIn.Checked) { ShowMessage("Đang yêu cầu trả hàng ...."); } if (deptSO == null) { deptSO = new DepartmentStockIn(); } deptSO.DepartmentStockInPK = new DepartmentStockInPK { DepartmentId = CurrentDepartment.Get().DepartmentId }; deptSO.StockInDate = DateTime.Now; deptSO.DepartmentStockInDetails = ObjectConverter.ConvertToNonGenericList(deptSODetailList); // deptSO.Description = txtDexcription.Text; var eventArgs = new DepartmentStockInEventArgs(); eventArgs.DepartmentStockIn = deptSO; eventArgs.Department = (Department)cboDepartment.SelectedItem; eventArgs.DepartmentStockList = departmentStockList; if(rdoFastStockIn.Checked) { try { EventUtility.fireEvent(DispatchDepartmentStockIn, this, eventArgs); } catch (Exception) { lblMessage.ForeColor = Color.Red; lblMessage.Text = " Không kết nối được với máy cửa hàng! "; deptSO = new DepartmentStockIn(); deptSODetailList.Clear(); // txtDexcription.Text = ""; // txtPriceIn.Text = ""; // txtPriceOut.Text = ""; txtSumProduct.Text = ""; txtSumValue.Text = ""; return; } } else { EventUtility.fireEvent(SaveStockInBackEvent, this, eventArgs); } if (eventArgs.EventResult != null) { if (!rdoFastStockIn.Checked) { lblMessage.ForeColor = Color.Blue; lblMessage.Text = "Lưu thành công !"; } deptSO = new DepartmentStockIn(); deptSODetailList.Clear(); // txtDexcription.Text = ""; // txtPriceIn.Text = ""; // txtPriceOut.Text = ""; txtSumProduct.Text = ""; txtSumValue.Text = ""; //CreateNewStockInDetail(); txtBarcode.Focus(); } else { if (rdoFastStockIn.Checked) { lblMessage.ForeColor = Color.Blue; lblMessage.Text = "Đã yêu cầu cửa hàng trả hàng ... "; return; } lblMessage.ForeColor = Color.Red; lblMessage.Text = "Có lỗi khi lưu !"; } }
private void button3_Click(object sender, EventArgs e) { deptSO = new DepartmentStockIn(); deptSODetailList.Clear(); // txtDexcription.Text = ""; // txtPriceIn.Text = ""; // txtPriceOut.Text = ""; txtSumProduct.Text = ""; txtSumValue.Text = ""; /*ClearSelectionOnListBox(lstColor); ClearSelectionOnListBox(lstSize); cboProductMasters.Text = "";*/ }
public void NotifyMultiStockInSuccess(Department department, DepartmentStockIn[] stockInList, long id) { }
public void Add(DepartmentStockIn data) { string deptStr = string.Format("{0:000}", data.DepartmentId); string dateStr = data.StockInDate.ToString("yyMMdd"); var criteria = new ObjectCriteria(); criteria.AddGreaterCriteria("StockoutId", (long)0); var maxId = StockOutDAO.SelectSpecificType(criteria, Projections.Max("StockoutId")); var stockOutId = maxId == null ? 1 : Int64.Parse(maxId.ToString()) + 1; //var stockInPk = new DepartmentStockInPK { DepartmentId = data.DepartmentId, StockInId = stockOutId + "" }; //data.DepartmentStockInPK = stockInPk; data.CreateDate = DateTime.Now; data.UpdateDate = DateTime.Now; data.UpdateId = ClientInfo.getInstance().LoggedUser.Name; data.CreateId = ClientInfo.getInstance().LoggedUser.Name; StockOut stockOut = new StockOut(); stockOut.StockoutId = stockOutId; stockOut.CreateDate = DateTime.Now; stockOut.UpdateDate = DateTime.Now; stockOut.StockOutDate = DateTime.Now; stockOut.UpdateId = ClientInfo.getInstance().LoggedUser.Name; stockOut.CreateId = ClientInfo.getInstance().LoggedUser.Name; stockOut.NotUpdateMainStock = false; stockOut.DefectStatus = new StockDefectStatus { DefectStatusId = 0}; stockOut.DelFlg = 0; stockOut.DepartmentId = data.DepartmentId; // we will get the stock to get the data IList productMasterIds = new ArrayList(); foreach (DepartmentStockInDetail stockInDetail in data.DepartmentStockInDetails) { productMasterIds.Add(stockInDetail.Product.ProductMaster.ProductMasterId); } IList productIds = new ArrayList(); foreach (DepartmentStockInDetail stockInDetail in data.DepartmentStockInDetails) { productIds.Add(stockInDetail.Product.ProductId); } criteria = new ObjectCriteria(); criteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO); criteria.AddGreaterCriteria("Quantity", (long)0); //criteria.AddSearchInCriteria("ProductMaster.ProductMasterId", productMasterIds); criteria.AddSearchInCriteria("Product.ProductId", productIds); //criteria.AddOrder("ProductMaster.ProductMasterId", true); criteria.AddOrder("Product.ProductId", true); IList stockList = StockDAO.FindAll(criteria); IList updateStockList = new ArrayList(); IList stockOutDetailList = new ArrayList(); var maxSODetailId = StockOutDetailDAO.SelectSpecificType(new ObjectCriteria(), Projections.Max("StockOutDetailId")); long stockOutDetailId = (maxSODetailId == null ? 1 : Int64.Parse(maxSODetailId.ToString()) + 1); foreach (DepartmentStockInDetail stockInDetail in data.DepartmentStockInDetails) { long quantity = stockInDetail.Quantity; foreach (Stock stock in stockList) { long stockInQty = 0; //if (stock.ProductMaster.ProductMasterId.Equals(stockInDetail.Product.ProductMaster.ProductMasterId) && stock.Quantity > 0) if (stock.Product.ProductId.Equals(stockInDetail.Product.ProductId) && stock.Quantity > 0) { if (quantity > stock.GoodQuantity) { throw new BusinessException("Mặt hàng: " + stock.ProductMaster.ProductName + " - mã vạch: " + stock.Product.ProductId + " không đủ hàng! Tồn: " + stockInDetail.StockQuantity + " , cần xuất: " + quantity); stockInQty = stock.GoodQuantity; quantity -= stock.GoodQuantity; stock.GoodQuantity = 0; } else { stockInQty = quantity; stock.GoodQuantity -= quantity; quantity = 0; } stock.Quantity = stock.GoodQuantity + stock.ErrorQuantity + stock.DamageQuantity + stock.LostQuantity + stock.UnconfirmQuantity; stock.UpdateDate = DateTime.Now; stock.UpdateId = ClientInfo.getInstance().LoggedUser.Name; updateStockList.Add(stock); /*var pk = new StockOutDetailPK { //DepartmentId = data.DepartmentId, ProductId = stock.Product.ProductId, StockOutId = stockOutId };*/ var detail = new StockOutDetail { //StockOutDetailPK = pk, StockOutDetailId = stockOutDetailId++, StockOutId = stockOutId, StockOut = stockOut, Product = stock.Product, ProductId = stock.Product.ProductId, Price = stockInDetail.Price, DelFlg = 0, ExclusiveKey = 1, Description = "Export goods", DefectStatus = new StockDefectStatus { DefectStatusId = 0}, Quantity = stockInQty, GoodQuantity = stockInQty, CreateDate = DateTime.Now, UpdateDate = DateTime.Now, UpdateId = ClientInfo.getInstance().LoggedUser.Name, CreateId = ClientInfo.getInstance().LoggedUser.Name, ProductMaster = stock.ProductMaster, }; /*var deptStock = new DepartmentStock { DepartmentStockPK = new DepartmentStockPK { DepartmentId = data.DepartmentId, ProductId = stock.Product.ProductId }, CreateDate = DateTime.Now, UpdateDate = DateTime.Now, UpdateId = ClientInfo.getInstance().LoggedUser.Name, CreateId = ClientInfo.getInstance().LoggedUser.Name, ProductMaster = stock.ProductMaster };*/ stockOutDetailList.Add(detail); if (quantity == 0) { break; } } } if (quantity > 0) { if (data.DepartmentStockInPK != null) { data.DepartmentStockInPK.StockInId = null; } throw new BusinessException("Số lượng xuất kho lớn hơn số lượng trong kho : " + stockInDetail.Product.ProductId); } } // insert stock out and stockout detail stockOut.StockOutDetails = stockOutDetailList; if(ClientSetting.ExportConfirmation) { stockOut.ConfirmFlg = 1; } StockOutDAO.Add(stockOut); // Remove duplicate rows int count = 0; while (count < (stockOutDetailList.Count - 1)) { StockOutDetail detail1 = (StockOutDetail)stockOutDetailList[count]; detail1.CreateDate = DateTime.Now; detail1.UpdateDate = DateTime.Now; int maxCount = stockOutDetailList.Count - 1; while (maxCount > count) { StockOutDetail detail2 = (StockOutDetail)stockOutDetailList[maxCount]; if (detail1.Product.ProductId.Equals(detail2.Product.ProductId)) { detail1.Quantity += detail2.Quantity; stockOutDetailList.RemoveAt(maxCount); } maxCount--; } count++; } foreach (StockOutDetail detail in stockOutDetailList) { StockOutDetailDAO.Add(detail); } if (!ClientSetting.ExportConfirmation) { // update stock foreach (Stock stock in updateStockList) { StockDAO.Update(stock); } } }
public void NotifyNewDepartmentStockIn(Department department, DepartmentStockIn stockOut) { // do nothing }
private DepartmentStockIn SaveDeptStockIn(bool isNeedSync) { // check for department var dept = cbbDept.SelectedItem as Department; if (dept == null) { MessageBox.Show("Không có cửa hàng nào để xuất hàng"); return null; } // first remove all blank row int count = 0; int length = deptSIDetailList.Count; for (int i = 0; i < length - count; i++) { DepartmentStockInDetail detail = deptSIDetailList[i]; if (string.IsNullOrEmpty(detail.Product.ProductMaster.ProductMasterId) && string.IsNullOrEmpty(detail.Product.ProductMaster.ProductName)) { deptSIDetailList.RemoveAt(i - count); count++; } } if (deptSIDetailList.Count == 0) { MessageBox.Show("Không có sản phẩm nào để xuất!!!!"); return null; } // validate quantity StringBuilder errMsg = new StringBuilder(); int line = 1; if(chkRemoveZero.Checked) { RemoveZeroLines(); } foreach (DepartmentStockInDetail detail in deptSIDetailList) { if (detail.Quantity == 0) { errMsg.Append(" " + line + " "); } line++; } if (errMsg.Length > 0) { MessageBox.Show("Lỗi ở dòng " + errMsg.ToString() + " : Số lượng phải lớn hơn 0"); return null; } /*count = 0; foreach (DepartmentStockInDetail detail in deptSIDetailList) { line = 0; foreach (DepartmentStockInDetail detail2 in deptSIDetailList) { if (detail.DelFlg == CommonConstants.DEL_FLG_NO && detail.Product.ProductId.Equals(detail2.Product.ProductId)) { if(count!=line) { MessageBox.Show("Lỗi : Mã vạch " + detail.Product.ProductId + " nhập 2 lần"); dgvDeptStockIn.CurrentCell = dgvDeptStockIn[3, line]; return null; } } line++; } count++; }*/ RemoveDuplicateRows(); if (deptSI == null) { deptSI = new DepartmentStockIn(); } deptSI.StockInDate = dtpImportDate.Value; deptSI.DepartmentId = dept.DepartmentId; deptSI.Description = txtDexcription.Text; deptSI.DepartmentStockInDetails = deptSIDetailList; var eventArgs = new DepartmentStockInEventArgs(); eventArgs.IsForSync = isNeedSync; eventArgs.DepartmentStockIn = deptSI; eventArgs.ExportGoodsToDepartment = true; // update stock out foreach (DepartmentStockInDetail detail in deptSIDetailList) { bool newRow = true; foreach (StockOutDetail outDetail in StockOut.StockOutDetails) { if(outDetail.Product.ProductId == detail.Product.ProductId) { newRow = false; outDetail.Quantity = detail.Quantity; outDetail.GoodQuantity = detail.Quantity; outDetail.DelFlg = detail.DelFlg; break; } } if(newRow) { StockOutDetail outDetail = new StockOutDetail(); outDetail.Product = detail.Product; outDetail.CreateDate = detail.CreateDate; outDetail.CreateId = detail.CreateId; outDetail.UpdateDate = detail.UpdateDate; outDetail.Price = detail.Price; outDetail.StockOutId = StockOut.StockoutId; outDetail.Quantity = detail.Quantity; outDetail.GoodQuantity = detail.Quantity; outDetail.ProductMaster = detail.Product.ProductMaster; outDetail.StockOut = StockOut; StockOut.StockOutDetails.Add(outDetail); } } eventArgs.UpdateStockOut = StockOut; EventUtility.fireEvent(UpdateStockOutEvent, this, eventArgs); if (eventArgs.EventResult != null) { MessageBox.Show("Lưu thành công"); txtDexcription.Text = ""; txtQuantity.Text = ""; txtSumValue.Text = ""; txtSumProduct.Text = ""; ClearSelectionOnListBox(lstColor); ClearSelectionOnListBox(lstSize); return eventArgs.DepartmentStockIn; } else { return null; } }
public void NotifyStockInFail(Department department, DepartmentStockIn stockIn, long id) { }
private void DepartmentStockInExtra_Load(object sender, EventArgs e) { var eventArgs = new DepartmentStockInEventArgs(); EventUtility.fireEvent(FillDepartmentEvent, this, eventArgs); IList departmentList = new ArrayList(); departmentList.Add(new Department { DepartmentId = 0, DepartmentName = "--- Hãy chọn cửa hàng xuất ---" }); foreach (Department department in eventArgs.DepartmentList) { departmentList.Add(department); } bdsDept.DataSource = departmentList; deptSIDetailList = new DepartmentStockInDetailCollection(bdsStockIn); bdsStockIn.DataSource = deptSIDetailList; dgvDeptStockIn.DataError += new DataGridViewDataErrorEventHandler(dgvDeptStockIn_DataError); deptSIDetailList = new DepartmentStockInDetailCollection(bdsStockIn); bdsStockIn.DataSource = deptSIDetailList; dgvDeptStockIn.DataError += new DataGridViewDataErrorEventHandler(dgvDeptStockIn_DataError); // create DepartmentStockIn if (deptSI == null) { deptSI = new DepartmentStockIn(); deptSI.CreateDate = DateTime.Now; deptSI.UpdateDate = DateTime.Now; deptSI.CreateId = ClientInfo.getInstance().LoggedUser.Name; deptSI.UpdateId = ClientInfo.getInstance().LoggedUser.Name; deptSI.ExclusiveKey = 0; CreateNewStockInDetail(); // load products to extra combo box LoadProductMasterToComboBox(); deptSIDetailList.RemoveAt(0); bdsStockIn.EndEdit(); } else { // btnBarcode.Visible = true; // numericUpDownBarcode.Visible = true; // btnPreview.Visible = true; IList deptStockInDetails = deptSI.DepartmentStockInDetails; foreach (DepartmentStockInDetail detail in deptStockInDetails) { if (detail.DelFlg == CommonConstants.DEL_FLG_NO) { deptSIDetailList.Add(detail); detail.OldQuantity = detail.Quantity; } } for (int i = 0; i < dgvDeptStockIn.Columns.Count; i++) { dgvDeptStockIn.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable; if (i != QUANTITY_POS && i != PRICE_POS && i != SELL_PRICE_POS) { dgvDeptStockIn.Columns[i].ReadOnly = true; } } txtDexcription.Text = deptSI.Description; } deptSI.DepartmentStockInDetails = ObjectConverter.ConvertToNonGenericList<DepartmentStockInDetail>(deptSIDetailList); }
public void NotifyStockInSuccess(Department department, DepartmentStockIn stockIn, long stockOutId) { }
private void DepartmentStockInExtra_Load(object sender, EventArgs e) { deptSIDetailList = new DepartmentStockInDetailCollection(bdsDeptStockIn); bdsDeptStockIn.DataSource = deptSIDetailList; dgvDeptStockIn.DataError += new DataGridViewDataErrorEventHandler(dgvDeptStockIn_DataError); // create DepartmentStockIn if (deptSI == null) { deptSI = new DepartmentStockIn(); } Department currentDepartment = CurrentDepartment.Get(); deptSI.CreateDate = DateTime.Now; deptSI.UpdateDate = DateTime.Now; deptSI.CreateId = ClientInfo.getInstance().LoggedUser.Name; deptSI.UpdateId = ClientInfo.getInstance().LoggedUser.Name; deptSI.ExclusiveKey = 0; CreateNewStockInDetail(); deptSI.DepartmentStockInDetails = ObjectConverter.ConvertToNonGenericList<DepartmentStockInDetail>(deptSIDetailList); }
public void Delete(DepartmentStockIn data) { DepartmentStockInDAO.Delete(data); }