public WizardMaster(GoodsReceiptAPIs goodsReceiptAPIs, GoodsReceiptViewModel goodsReceiptViewModel) { InitializeComponent(); this.customTabMain = new CustomTabControl(); this.customTabMain.Font = this.fastPendingPickups.Font; this.customTabMain.DisplayStyle = TabStyle.VisualStudio; this.customTabMain.DisplayStyleProvider.ImageAlign = ContentAlignment.MiddleLeft; this.customTabMain.TabPages.Add("tabPendingPickups", "Receipt by every pickup "); this.customTabMain.TabPages.Add("tabPendingPickupWarehouses", "Cumulate pickups per warehouse "); this.customTabMain.TabPages.Add("tabPendingGoodsIssueTransfers", "Receipt by every transfer "); this.customTabMain.TabPages.Add("tabPendingGoodsIssueTransferWarehouses", "Cumulate transfers per warehouse "); //this.customTabMain.TabPages.Add("tabPendingPurchases", "Purchase Invoice "); //this.customTabMain.TabPages.Add("tabPendingPurchases", "Sales Return "); this.customTabMain.TabPages[0].Controls.Add(this.fastPendingPickups); this.customTabMain.TabPages[1].Controls.Add(this.fastPendingPickupWarehouses); this.customTabMain.TabPages[2].Controls.Add(this.fastPendingGoodsIssueTransfers); this.customTabMain.TabPages[3].Controls.Add(this.fastPendingGoodsIssueTransferWarehouses); this.customTabMain.Dock = DockStyle.Fill; this.fastPendingPickups.Dock = DockStyle.Fill; this.fastPendingPickupWarehouses.Dock = DockStyle.Fill; this.fastPendingGoodsIssueTransfers.Dock = DockStyle.Fill; this.fastPendingGoodsIssueTransferWarehouses.Dock = DockStyle.Fill; this.panelMaster.Controls.Add(this.customTabMain); this.goodsReceiptAPIs = goodsReceiptAPIs; this.goodsReceiptViewModel = goodsReceiptViewModel; }
public WizardDetail(GoodsReceiptAPIs goodsReceiptAPIs, GoodsReceiptViewModel goodsReceiptViewModel) { InitializeComponent(); this.customTabBatch = new CustomTabControl(); this.customTabBatch.Font = this.fastPendingPallets.Font; this.customTabBatch.DisplayStyle = TabStyle.VisualStudio; this.customTabBatch.DisplayStyleProvider.ImageAlign = ContentAlignment.MiddleLeft; this.customTabBatch.TabPages.Add("tabPendingPallets", "Pending pallets"); this.customTabBatch.TabPages.Add("tabPendingCartons", "Pending cartons"); this.customTabBatch.TabPages[0].Controls.Add(this.fastPendingPallets); this.customTabBatch.TabPages[1].Controls.Add(this.fastPendingCartons); this.customTabBatch.Dock = DockStyle.Fill; this.fastPendingPallets.Dock = DockStyle.Fill; this.fastPendingCartons.Dock = DockStyle.Fill; this.panelMaster.Controls.Add(this.customTabBatch); this.goodsReceiptAPIs = goodsReceiptAPIs; this.goodsReceiptViewModel = goodsReceiptViewModel; this.olvCartonSelected.HeaderCheckState = this.goodsReceiptViewModel.GoodsReceiptTypeID == (int)GlobalEnums.GoodsReceiptTypeID.Pickup ? CheckState.Checked : CheckState.Unchecked; this.olvPalletSelected.HeaderCheckState = this.goodsReceiptViewModel.GoodsReceiptTypeID == (int)GlobalEnums.GoodsReceiptTypeID.Pickup ? CheckState.Checked : CheckState.Unchecked; this.menuOptionBinLocations.Visible = this.goodsReceiptViewModel.GoodsReceiptTypeID == (int)GlobalEnums.GoodsReceiptTypeID.GoodsIssueTransfer; }
public GoodsReceiptDetailAvailables() : base() { InitializeComponent(); this.toolstripChild = this.toolStripChildForm; this.goodsReceiptAPIs = new GoodsReceiptAPIs(CommonNinject.Kernel.Get <IGoodsReceiptAPIRepository>()); this.baseDTO = new GoodsReceiptDetailAvailableViewModel();; }
public GoodsReceipts() : base() { InitializeComponent(); this.toolstripChild = this.toolStripChildForm; this.fastListIndex = this.fastGoodsReceiptIndex; this.goodsReceiptAPIs = new GoodsReceiptAPIs(CommonNinject.Kernel.Get <IGoodsReceiptAPIRepository>()); this.goodsReceiptViewModel = CommonNinject.Kernel.Get <GoodsReceiptViewModel>(); this.goodsReceiptViewModel.PropertyChanged += new PropertyChangedEventHandler(ModelDTO_PropertyChanged); this.baseDTO = this.goodsReceiptViewModel; }
private void WizardDetail_Load(object sender, EventArgs e) { try { GoodsReceiptAPIs goodsReceiptAPIs = new GoodsReceiptAPIs(CommonNinject.Kernel.Get <IGoodsReceiptAPIRepository>()); this.goodsReceiptDetailAvailables = goodsReceiptAPIs.GetGoodsReceiptDetailAvailables(this.warehouseAdjustmentViewModel.LocationID, this.warehouseAdjustmentViewModel.WarehouseID, null, null, null, string.Join(",", this.warehouseAdjustmentViewModel.ViewDetails.Select(d => d.GoodsReceiptDetailID)), true, false); this.fastPendingPallets.SetObjects(goodsReceiptDetailAvailables.Where(w => w.PalletID != null)); this.fastPendingCartons.SetObjects(goodsReceiptDetailAvailables.Where(w => w.CartonID != null)); this.ShowRowCount(true, true); } catch (Exception exception) { ExceptionHandlers.ShowExceptionMessageBox(this, exception); } }
private void WizardDetail_Load(object sender, EventArgs e) { try { string commodityIDs = ""; Dictionary <int, int> filterBatchPerCommodity = new Dictionary <int, int>(); //Dictionary with pair: [CommodityID, BatchID] if (this.fileName != null) { foreach (IPendingPrimaryDetail ipendingPrimaryDetail in this.pendingPrimaryDetails) { if (commodityIDs.IndexOf(ipendingPrimaryDetail.CommodityID.ToString()) < 0) { commodityIDs = commodityIDs + (commodityIDs != "" ? "," : "") + ipendingPrimaryDetail.CommodityID.ToString(); } if (ipendingPrimaryDetail.BatchID != null) { filterBatchPerCommodity[ipendingPrimaryDetail.CommodityID] = (int)ipendingPrimaryDetail.BatchID; } } } GoodsReceiptAPIs goodsReceiptAPIs = new GoodsReceiptAPIs(CommonNinject.Kernel.Get <IGoodsReceiptAPIRepository>()); List <GoodsReceiptDetailAvailable> goodsReceiptDetailAvailables = goodsReceiptAPIs.GetGoodsReceiptDetailAvailables(this.goodsIssueViewModel.LocationID, this.goodsIssueViewModel.WarehouseID, this.fileName == null ? this.pendingPrimaryDetail.CommodityID : (int?)null, this.fileName == null ? null : commodityIDs, this.fileName == null ? this.pendingPrimaryDetail.BatchID : (int?)null, string.Join(",", this.goodsIssueViewModel.ViewDetails.Select(d => d.GoodsReceiptDetailID)), true); IEnumerable <GoodsReceiptDetailAvailable> goodsReceiptPalletAvailables = null; IEnumerable <GoodsReceiptDetailAvailable> goodsReceiptCartonAvailables = null; IEnumerable <GoodsReceiptDetailAvailable> goodsReceiptPackAvailables = null; List <MismatchedBarcode> mismatchedBarcodes = new List <MismatchedBarcode>(); if (this.fileName == null) { goodsReceiptDetailAvailables.Each(goodsReceiptDetailAvailable => { goodsReceiptDetailAvailable.DeliveryAdviceID = this.pendingPrimaryDetail.DeliveryAdviceID; goodsReceiptDetailAvailable.DeliveryAdviceDetailID = this.pendingPrimaryDetail.DeliveryAdviceDetailID; goodsReceiptDetailAvailable.TransferOrderID = this.pendingPrimaryDetail.TransferOrderID; goodsReceiptDetailAvailable.TransferOrderDetailID = this.pendingPrimaryDetail.TransferOrderDetailID; goodsReceiptDetailAvailable.PrimaryReference = this.pendingPrimaryDetail.PrimaryReference; goodsReceiptDetailAvailable.PrimaryEntryDate = this.pendingPrimaryDetail.PrimaryEntryDate; goodsReceiptDetailAvailable.QuantityRemains = (decimal)this.pendingPrimaryDetail.QuantityRemains; goodsReceiptDetailAvailable.LineVolumeRemains = (decimal)this.pendingPrimaryDetail.LineVolumeRemains; }); goodsReceiptPalletAvailables = goodsReceiptDetailAvailables.Where(w => w.PalletID != null); goodsReceiptCartonAvailables = goodsReceiptDetailAvailables.Where(w => w.CartonID != null); if (this.UsingPack) { goodsReceiptPackAvailables = goodsReceiptDetailAvailables.Where(w => w.PackID != null); } } else { string[] barcodes = System.IO.File.ReadAllLines(fileName); if (barcodes.Count() > 0) { if (filterBatchPerCommodity.Count > 0) //Remove row that does not match pair: [CommodityID, BatchID] { foreach (KeyValuePair <int, int> change in filterBatchPerCommodity) { //LƯU Ý: CÂU LỆNH SAU ĐÂY SẼ REMOVE TẤT CẢ CommodityID NOT MATCH WITH BatchID => DO ĐÓ: NẾU 1 D.A/ T.O: VỪA CÓ CHỈ ĐỊNH BATCH, VỪA KHÔNG CHỈ ĐỊNH BATCH => THÌ PHẢI IMPORT BATCH TRƯỚC, SAU ĐÓ IMPORT NON-BATCH SAU (HOẶC ĐƠN GIẢN HƠN LÀ TÁCH THÀNH 2 GOODSISSUE) goodsReceiptDetailAvailables.RemoveAll(w => w.CommodityID == change.Key && w.BatchID != change.Value); } } foreach (string barcode in barcodes) { GoodsReceiptDetailAvailable goodsReceiptDetailAvailable = goodsReceiptDetailAvailables.Find(w => (w.PalletCode == barcode || w.CartonCode == barcode || w.PackCode == barcode)); if (goodsReceiptDetailAvailable != null) { if (goodsReceiptDetailAvailable.IsSelected == false) { IPendingPrimaryDetail pendingPrimaryDetail = this.pendingPrimaryDetails.ToList().Find(w => w.CommodityID == goodsReceiptDetailAvailable.CommodityID && (w.BatchID == null || w.BatchID == goodsReceiptDetailAvailable.BatchID) && (w.QuantityRemains - w.QuantityIssue) >= goodsReceiptDetailAvailable.QuantityAvailable && (w.LineVolumeRemains - w.LineVolumeIssue) >= goodsReceiptDetailAvailable.LineVolumeAvailable); if (pendingPrimaryDetail != null) { //WHEN THIS FORM IS LOADED, pendingPrimaryDetail.QuantityIssue AND pendingPrimaryDetail.LineVolumeIssue IS ALWAYS = 0. THESE PROPERTIES (QuantityIssue, LineVolumeIssue) ARE USED TO CHECK (w.QuantityRemains - w.QuantityIssue) > goodsReceiptDetailAvailable.QuantityAvailable && (w.LineVolumeRemains - w.LineVolumeIssue) > goodsReceiptDetailAvailable.LineVolumeAvailable. THESE PROPERTIES ARE USED FOR THIS PURPOSE ONLY pendingPrimaryDetail.QuantityIssue = Math.Round(pendingPrimaryDetail.QuantityIssue + (decimal)goodsReceiptDetailAvailable.QuantityAvailable, GlobalEnums.rndQuantity, MidpointRounding.AwayFromZero); pendingPrimaryDetail.LineVolumeIssue = Math.Round(pendingPrimaryDetail.LineVolumeIssue + (decimal)goodsReceiptDetailAvailable.LineVolumeAvailable, GlobalEnums.rndVolume, MidpointRounding.AwayFromZero); goodsReceiptDetailAvailable.DeliveryAdviceID = pendingPrimaryDetail.DeliveryAdviceID; goodsReceiptDetailAvailable.DeliveryAdviceDetailID = pendingPrimaryDetail.DeliveryAdviceDetailID; goodsReceiptDetailAvailable.TransferOrderID = pendingPrimaryDetail.TransferOrderID; goodsReceiptDetailAvailable.TransferOrderDetailID = pendingPrimaryDetail.TransferOrderDetailID; goodsReceiptDetailAvailable.PrimaryReference = pendingPrimaryDetail.PrimaryReference; goodsReceiptDetailAvailable.PrimaryEntryDate = pendingPrimaryDetail.PrimaryEntryDate; goodsReceiptDetailAvailable.QuantityRemains = (decimal)pendingPrimaryDetail.QuantityRemains; goodsReceiptDetailAvailable.LineVolumeRemains = (decimal)pendingPrimaryDetail.LineVolumeRemains; goodsReceiptDetailAvailable.IsSelected = true; } else { mismatchedBarcodes.Add(new MismatchedBarcode() { Barcode = barcode, Description = "Số lượng xuất vượt quá yêu cầu. Vui lòng kiểm tra lại.", QuantityAvailable = goodsReceiptDetailAvailable.QuantityAvailable, LineVolumeAvailable = goodsReceiptDetailAvailable.LineVolumeAvailable }); } } else { mismatchedBarcodes.Add(new MismatchedBarcode() { Barcode = barcode, Description = "Trùng mã vạch. Bạn đã quét mã vạch này nhiều lần?", QuantityAvailable = goodsReceiptDetailAvailable.QuantityAvailable, LineVolumeAvailable = goodsReceiptDetailAvailable.LineVolumeAvailable }); } } else { mismatchedBarcodes.Add(new MismatchedBarcode() { Barcode = barcode, Description = "Không tìm thấy. Bạn đã xả pallet ra chưa?" }); } } } goodsReceiptPalletAvailables = goodsReceiptDetailAvailables.Where(w => w.PalletID != null && w.IsSelected == true); goodsReceiptCartonAvailables = goodsReceiptDetailAvailables.Where(w => w.CartonID != null && w.IsSelected == true); if (this.UsingPack) { goodsReceiptPackAvailables = goodsReceiptDetailAvailables.Where(w => w.PackID != null && w.IsSelected == true); } } this.fastAvailablePallets.SetObjects(goodsReceiptPalletAvailables); this.fastAvailableCartons.SetObjects(goodsReceiptCartonAvailables); if (this.UsingPack) { this.fastAvailablePacks.SetObjects(goodsReceiptPackAvailables); } if (this.fileName != null) { this.fastMismatchedBarcodes.SetObjects(mismatchedBarcodes); } this.ShowRowCount(); } catch (Exception exception) { ExceptionHandlers.ShowExceptionMessageBox(this, exception); } finally { this.pendingPrimaryDetails.Each(p => { p.QuantityIssue = 0; p.LineVolumeIssue = 0; }); } }