Beispiel #1
0
        private void butKartyTechn_click(object sender, EventArgs e)
        {
            if (DataStorage.currentOrder.orderNo == "")
            {
                MessageBox.Show("Wczytaj lub utwórz zlecenie");
                return;
            }

            bool ledCheck = true;
            var  dtModels = DataStorage.devToolsDb.Where(nc => nc.nc12 == DataStorage.currentOrder.modelId + "00").ToList();

            if (dtModels.Count() == 0)
            {
                MessageBox.Show("Brak danych w DevTools - wpisz ilości LED ręcznie");
                ledCheck = false;
                //........
            }

            Dictionary <string, LedStructForTechnologicSpec> ledForTechCard = DataPreparation.LedForTechCard(ref ledCheck);
            bool nonStandardOrder = false; //false

            if (!ledCheck)
            {
                if (!superuserList.Contains(currentUser))
                {
                    MessageBox.Show("Błąd danych - dioda LED nie neleży do struktury danych." + Environment.NewLine + Environment.NewLine + "Brak uprawnień do stworzenia niestandardowego - tylko Mistrz i Pierwszy Operator");
                    return;
                }

                if (superuserList.Contains(currentUser))
                {
                    MessageBox.Show("Błąd danych - dioda LED nie neleży do struktury danych." + Environment.NewLine + "Należy ręcznie wpisać nazwę, 12NC i ilość diody");
                    nonStandardOrder = true;
                }
            }

            var excPkg = ExcelOperations.GetExcelPackage(DataStorage.currentOrder.modelId);// currentOrder.modelId);

            if (excPkg != null)
            {
                string additionalComment = lProdWerehouseStock.Text != "..." ? $"Wyrób znajduje się na regale: {lProdWerehouseStock.Text}" : "";

                ExcelOperations.FillOutExcelData(DataStorage.currentOrder, ref excPkg, ledForTechCard, nonStandardOrder, additionalComment);
                string tempFile = ExcelOperations.SaveExcelAndReturnPath(excPkg);
                Process.Start(tempFile);
            }
        }