private void btnMassExport_Click(object sender, EventArgs e) { ProductMasterChoosingForm pmChoosingForm = new ProductMasterChoosingForm(); pmChoosingForm.ShowDialog(); if (pmChoosingForm.SelectedProductMasterList == null) return; var eventArgs = new DepartmentStockOutEventArgs(); eventArgs.SelectedProductMasterList = pmChoosingForm.SelectedProductMasterList; EventUtility.fireEvent(LoadStockStatusEvent, this, eventArgs); if (eventArgs.FoundDepartmentStockOutDetailList != null && eventArgs.FoundDepartmentStockOutDetailList.Count > 0) { foreach (DepartmentStockOutDetail detail in eventArgs.FoundDepartmentStockOutDetailList) { bool found = false; foreach (DepartmentStockOutDetail detail1 in deptSODetailList) { if (detail.Product.ProductId.Equals(detail1.Product.ProductId)) { found = true; break; } } if (found) { // MessageBox.Show("Mã vạch đã được nhập"); // return; continue; } // DefectStatusId = 4, DefectStatusName = "Xuất tạm để sửa hàng" }); // DefectStatusId = 6, DefectStatusName = "Xuất trả về kho chính" }); // DefectStatusId = 7, DefectStatusName = "Xuất đi cửa hàng khác" }); StockDefectStatus defectStatus = (StockDefectStatus)cbbStockOutType.SelectedItem; if (defectStatus.DefectStatusId == 4) { // if xuattam, so we check error quantity and good quantity ( for shoes ) if (detail.GoodQuantity == 0 && detail.ErrorQuantity == 0) // = 0 , so we don't need to show it { continue; } } if (defectStatus.DefectStatusId == 7) { // if xuatdicuahangkhac, so we check good quantity if (detail.GoodQuantity == 0) // = 0 , so we don't need to show it { continue; } } detail.DefectStatus = defectStatus; deptSODetailList.Add(detail); deptSODetailList.EndNew(deptSODetailList.Count - 1); LockField(deptSODetailList.Count - 1, detail); } foreach (DepartmentStock def in eventArgs.DepartmentStockList) { bool found = false; foreach (DepartmentStock detail in departmentStockList) { if (def.Product.ProductId.Equals(detail.Product.ProductId)) { found = true; break; } } if (!found) { departmentStockList.Add(def); } } CalculateTotalStorePrice(); } }
private void btnPMChoosing_Click(object sender, EventArgs e) { ProductMasterChoosingForm pmChoosingForm = new ProductMasterChoosingForm(); pmChoosingForm.ShowDialog(); if (pmChoosingForm.SelectedProductMasterList == null) return; var eventArgs = new MainStockOutEventArgs(); eventArgs.DefectStatusId = ((StockDefectStatus)cbbStockOutType.SelectedItem).DefectStatusId; eventArgs.SelectedProductMasterList = pmChoosingForm.SelectedProductMasterList; EventUtility.fireEvent(LoadStockStatusEvent, this, eventArgs); if (eventArgs.FoundStockOutDetailList != null && eventArgs.FoundStockOutDetailList.Count > 0) { foreach (StockOutDetail detail in eventArgs.FoundStockOutDetailList) { bool found = false; foreach (StockOutDetail detail1 in stockOutDetailList) { if (detail.Product.ProductId.Equals(detail1.Product.ProductId)) { found = true; break; } } if (found) { continue; } StockDefectStatus defectStatus = (StockDefectStatus) cbbStockOutType.SelectedItem; if (defectStatus.DefectStatusId == 4) { // if xuattam, so we check error quantity & good quantity ( for shoes ) if (detail.GoodQuantity == 0 && detail.ErrorQuantity == 0) // = 0 , so we don't need to show it { continue; } } if (defectStatus.DefectStatusId == 5) { // if travenhasanxuat, so we check good && error quantity if (detail.GoodQuantity == 0 /*&& detail.ErrorQuantity == 0*/) // = 0 , so we don't need to show it { continue; } } if (defectStatus.DefectStatusId == 7) { // if xuatdicuahangkhac, so we check good quantity if (detail.GoodQuantity == 0) // = 0 , so we don't need to show it { continue; } } detail.DefectStatus = defectStatus; stockOutDetailList.Add(detail); stockOutDetailList.EndNew(stockOutDetailList.Count - 1); LockField(stockOutDetailList.Count - 1, detail); } foreach (Stock def in eventArgs.StockList) { bool found = false; foreach (Stock detail in stockList) { if (def.Product.ProductId.Equals(detail.Product.ProductId)) { found = true; break; } } if (!found) { stockList.Add(def); } } } CalculateTotalStorePrice(); }
private void btnMassChoosing_Click(object sender, EventArgs e) { ProductMasterChoosingForm pmChoosingForm = new ProductMasterChoosingForm(); pmChoosingForm.ShowDialog(); if (pmChoosingForm.SelectedProductMasterList == null) return; var eventArgs = new DepartmentStockInEventArgs(); eventArgs.DepartmentStockInDetailList = new ArrayList(); eventArgs.ProductMasterList = pmChoosingForm.SelectedProductMasterList; EventUtility.fireEvent(LoadStockInByProductMaster, this, eventArgs); // remove 0 quanity int count = 0; int length = deptSIDetailList.Count; bool isMessage = false; for (int i = 0; i < length; i++) { if (deptSIDetailList[i - count].StockQuantity == 0) { //isMessage = true; deptSIDetailList.RemoveAt(i - count); count++; } } if (eventArgs.SelectedStockOutDetails != null && eventArgs.SelectedStockOutDetails.Count > 0) { foreach (DepartmentStockInDetail inDetail in eventArgs.SelectedStockOutDetails) { if (!IsInList(deptSIDetailList, inDetail)) deptSIDetailList.Add(inDetail); } } RemoveDuplicateRows(); bdsStockIn.ResetBindings(false); dgvStockIn.Refresh(); dgvStockIn.Invalidate(); /*if (isMessage) { MessageBox.Show("Sản phẩm có tồn kho 0 sẽ không đựoc xuất"); }*/ CalculateTotalStorePrice(); pmChoosingForm.Dispose(); }