コード例 #1
0
        private void MenuItem_Click_1(object sender, RoutedEventArgs e)
        {
            MenuItem item = sender as MenuItem;
            DependencyObject obj = item.GetParentObject();
            switch (item.Header.ToString())
            {
                case "Send To Store":
                    ReceiptStatu recievedStatus = DBResources.Instance.Context.ReceiptStatus.Find(10);
                    selectedGRNReciept.ReceiptStatu = recievedStatus;
                    DBResources.Instance.Save();
                    break;
                case "Knitting":
                    CreateJoWindow knittWindow = new CreateJoWindow();
                    knittWindow.Order = this.selectedGRNReciept.OrderedItem.PurchaseOrder.Order;
                    knittWindow.PurchaseOrder = this.selectedGRNReciept.OrderedItem.PurchaseOrder;
                    knittWindow.Quantity = this.selectedGRNReciept.QualityPassedQuantity.Value;
                    knittWindow.GRNRefNo = this.selectedGRNReciept.GRNReciptID.ToString();
                    knittWindow.GRNReciept = this.selectedGRNReciept;
                    knittWindow.InitializeForKnitting();
                    knittWindow.ShowDialog();
                    break;
                case "Dyeing":
                    CreateJoWindow dyeWindow = new CreateJoWindow();
                    dyeWindow.Order = this.selectedGRNReciept.OrderedItem.PurchaseOrder.Order;
                    dyeWindow.PurchaseOrder = this.selectedGRNReciept.OrderedItem.PurchaseOrder;
                    dyeWindow.Quantity = this.selectedGRNReciept.QualityPassedQuantity.Value;
                    dyeWindow.GRNRefNo = this.selectedGRNReciept.GRNReciptID.ToString();
                    dyeWindow.GRNReciept = this.selectedGRNReciept;
                    dyeWindow.InitializeForDyeing();
                    dyeWindow.ShowDialog();
                    break;
                case "Compacting":
                    CreateJoWindow compactingWindow = new CreateJoWindow();
                    compactingWindow.Order = this.selectedGRNReciept.OrderedItem.PurchaseOrder.Order;
                    compactingWindow.PurchaseOrder = this.selectedGRNReciept.OrderedItem.PurchaseOrder;
                    compactingWindow.Quantity = this.selectedGRNReciept.QualityPassedQuantity.Value;
                    compactingWindow.GRNRefNo = this.selectedGRNReciept.GRNReciptID.ToString();
                    compactingWindow.GRNReciept = this.selectedGRNReciept;
                    compactingWindow.InitializeForCompacting();
                    compactingWindow.ShowDialog();
                    break;
                case "Printing":
                case "Washing":
                case "Other":
                case "Stock":
                    if (selectedGRNReciept != null)
                    {
                        GRNReciept receipt = selectedGRNReciept;
                        IssueToPopupBox issuePopupBox = new IssueToPopupBox(DBResources.Instance.AllJobsTypes, item.Header.ToString());
                        issuePopupBox.Receipt = receipt;
                        issuePopupBox.JobQuantity = issuePopupBox.Receipt.QualityPassedQuantityWrapper;

                        if (issuePopupBox.ShowDialog() == true)
                        {
                            if (issuePopupBox.JobOrder.JobOrderType.Type.ToLower() == "stock")
                            {
                                MaterialStock stock = new MaterialStock();
                                stock.Order = ViewModel.Order;
                                stock.SubMaterial = ViewModel.OrderedItem.ProductMaterialItem.SubMaterial;
                                stock.InStockDateTime = DBResources.Instance.GetServerTime();
                                stock.StockQuantity = receipt.QualityPassedQuantityWrapper;
                                stock.UnitsOfMeasurement = ViewModel.OrderedItem.ProductMaterialItem.UnitsOfMeasurementWrapper;
                                ViewModel.OrderedItem.ProductMaterialItem.SubMaterial.MaterialStocks.Add(stock);
                                receipt.ReceiptStatusID = (byte)RecieptStatus.IssuedToStock;
                            }
                            else
                            {
                                receipt.JobOrders.Add(issuePopupBox.JobOrder);
                            }

                            DBResources.Instance.Save();
                            ViewModel.SelectedGRNReceipt.RefreshUIEnablers();
                        }
                    }
                    break;
            }

            ViewModel.SelectedGRNReceipt.RefreshUIEnablers();
        }
コード例 #2
0
        void mItem_Click(object sender, RoutedEventArgs e)
        {
            MenuItem item = sender as MenuItem;
            JobOrder jOrder = jobOrderDetails.SelectedItem as JobOrder;

            switch (item.Header.ToString())
            {
                case "Knitting":
                    CreateJoWindow knittWindow = new CreateJoWindow();
                    knittWindow.Order = jOrder.GRNReciept.OrderedItem.PurchaseOrder.Order;
                    knittWindow.PurchaseOrder = jOrder.GRNReciept.OrderedItem.PurchaseOrder;
                    knittWindow.Quantity = jOrder.QualityPassed.Value;
                    knittWindow.GRNRefNo = jOrder.GRNReciept.GRNReciptID.ToString();
                    knittWindow.GRNReciept = jOrder.GRNReciept;
                    knittWindow.ParentJobOrder = jOrder;
                    jOrder.IsIssued = true;
                    knittWindow.InitializeForKnitting();
                    knittWindow.ShowDialog();
                    break;
                case "Dyeing":
                    CreateJoWindow dyeWindow = new CreateJoWindow();
                    dyeWindow.Order = jOrder.GRNReciept.OrderedItem.PurchaseOrder.Order;
                    dyeWindow.PurchaseOrder = jOrder.GRNReciept.OrderedItem.PurchaseOrder;
                    dyeWindow.ParentJobOrder = jOrder;
                    dyeWindow.Quantity = jOrder.QualityPassed.Value;
                    dyeWindow.GRNRefNo = jOrder.GRNReciept.GRNReciptID.ToString();
                    dyeWindow.GRNReciept = jOrder.GRNReciept;
                    jOrder.IsIssued = true;
                    dyeWindow.InitializeForDyeing();
                    dyeWindow.ShowDialog();
                    break;
                case "Compacting":
                    CreateJoWindow compactingWindow = new CreateJoWindow();
                    compactingWindow.Order = jOrder.GRNReciept.OrderedItem.PurchaseOrder.Order;
                    compactingWindow.PurchaseOrder = jOrder.GRNReciept.OrderedItem.PurchaseOrder;
                    compactingWindow.ParentJobOrder = jOrder;
                    compactingWindow.Quantity = jOrder.QualityPassed.Value;
                    compactingWindow.GRNRefNo = jOrder.GRNReciept.GRNReciptID.ToString();
                    compactingWindow.GRNReciept = jOrder.GRNReciept;
                    jOrder.IsIssued = true;
                    compactingWindow.InitializeForCompacting();
                    compactingWindow.ShowDialog();
                    break;
                case "Printing":
                case "Washing":
                case "Other":
                case "Stock":
                    JobOrder newJob = new JobOrder();
                    newJob.JobQuantity = jOrder.QualityPassed.GetValueOrDefault(0);
                    newJob.GRNReciept = jOrder.GRNReciept;
                    newJob.JobOrder2 = jOrder;
                    IssueToPopupBox issuePopup = new IssueToPopupBox(newJob, GetNextJobOrderTypes(jOrder), item.Header.ToString());
                    issuePopup.MaterialName = jOrder.RecievedAsWrapper;
                    if (issuePopup.ShowDialog() == true)
                    {
                        jOrder.IsIssued = true;
                        if (ViewModel.IssueNewJob(issuePopup.JobOrder))
                            jOrder.Refresh();
                    }
                    break;
            }

            jOrder.Refresh();
            jOrder.RefreshAllProperties();
        }
コード例 #3
0
        private void MenuItem_Click_1(object sender, RoutedEventArgs e)
        {
            MenuItem item = sender as MenuItem;
            switch (item.Header.ToString())
            {
                case "Knitting":
                case "Dyeing":
                case "Compacting":
                    CreateJoWindow newJobOrder = new CreateJoWindow();
                    newJobOrder.Order = ViewModel.Order;
                    newJobOrder.Quantity = ViewModel.SelectedItem.SelectedQuantity;
                    newJobOrder.GRNRefNo = ViewModel.SelectedItem.GRNreceiptNumbers;
                    newJobOrder.Initialize(item.Header.ToString());
                    if (newJobOrder.ShowDialog() == true)
                    {
                        byte receiptStatus = 1;
                        string headerString = item.Header.ToString();
                        if (headerString == "Knitting")
                            receiptStatus = (byte)RecieptStatus.IssuedToKnittting;
                        else if (headerString == "Dyeing")
                            receiptStatus = (byte)RecieptStatus.IssuedToDyeing;
                        else if (headerString == "Compacting")
                            receiptStatus = (byte)RecieptStatus.IssuedToCompacting;
                        foreach (var receipt in ViewModel.SelectedItem.GRNReceipts)
                            receipt.ReceiptStatusID = receiptStatus;

                        DBResources.Instance.Save();
                        ViewModel.ResetData();
                    }
                    break;
                case "Printing":
                case "Washing":
                case "Other":
                case "Stock":
                        
                        IssueToPopupBox issuePopupBox = new IssueToPopupBox(DBResources.Instance.AllJobsTypes, item.Header.ToString());
                        issuePopupBox.JobQuantity = issuePopupBox.Receipt.QualityPassedQuantityWrapper;

                        if (issuePopupBox.ShowDialog() == true)
                        {
                            if (issuePopupBox.JobOrder.JobOrderType.Type.ToLower() == "stock")
                            {
                                OrderedItem firstOrderedItem = ViewModel.SelectedItem.GRNReceipts.First().OrderedItem;
                                SubMaterial subMaterial = firstOrderedItem.SubMaterial;
                                MaterialStock stock = new MaterialStock();
                                stock.Order = ViewModel.Order;
                                stock.SubMaterial = subMaterial;
                                stock.InStockDateTime = DBResources.Instance.GetServerTime();
                                stock.StockQuantity = ViewModel.SelectedItem.SelectedQuantity;
                                stock.UnitsOfMeasurement = firstOrderedItem.ProductMaterialItem.UnitsOfMeasurementWrapper;
                                subMaterial.MaterialStocks.Add(stock);
                                foreach (var receipt in ViewModel.SelectedItem.GRNReceipts)
                                    receipt.ReceiptStatusID = (byte)RecieptStatus.IssuedToStock;
                            }
                            else
                            {
                                foreach(var receipt in ViewModel.SelectedItem.GRNReceipts)
                                    receipt.JobOrders.Add(issuePopupBox.JobOrder);
                            }

                            DBResources.Instance.Save();
                            ViewModel.ResetData();
                            foreach (var receipt in ViewModel.SelectedItem.GRNReceipts)
                                receipt.RefreshUIEnablers();
                        }
                    break;
            }

            foreach (var receipt in ViewModel.SelectedItem.GRNReceipts)
                receipt.RefreshUIEnablers();

            
        }