public void WriteToBarcodeCSVFile()
        {
            BarcodeCSVParams b = new BarcodeCSVParams();

            b.FirstBarcodeAssigned = "100";
            b.LastBarcodeAssigned  = "104";
            b.TimeStamp            = DateTime.Now.ToString("yyyy_MM_dd_hh_mm_ss");
            b.AssociatedOutputXml  = "Output1";

            BarcodeCSVParams c = new BarcodeCSVParams();

            c.FirstBarcodeAssigned = "105";
            c.LastBarcodeAssigned  = "110";
            c.TimeStamp            = DateTime.Now.ToString("yyyy_MM_dd_hh_mm_ss");
            c.AssociatedOutputXml  = "Output2";

            WriteToCSVFiles.InitiateBarcodesLogging();
            WriteToCSVFiles.WriteBarcodesDataToFile(b);
            WriteToCSVFiles.WriteBarcodesDataToFile(c);
            WriteToCSVFiles.CloseBarcodesLogging();
        }
Пример #2
0
        private void CreateTallyXmlsUsingItemsParams(string outputXmlFileName)
        {
            List <string> assignedBarcodesList = new List <string>();

            foreach (ItemsCSVParams itemParams in itemsCSVParams)
            {
                //Create and add Parent+Child Godown xmls
                if (!Godown.IsAlreadyCreated(itemParams.GodownParent, tallyXml))
                {
                    Godown.CreateGodownXml(tallyXml, "", itemParams.GodownParent);
                }

                if (!Godown.IsAlreadyCreated(itemParams.GodownChild, tallyXml))
                {
                    Godown.CreateGodownXml(tallyXml, itemParams.GodownParent, itemParams.GodownChild);
                }

                //Create and add Parent+Child StockGroup xmls
                if (!StockGroup.IsAlreadyCreated(itemParams.StockGroupParent, tallyXml))
                {
                    StockGroup.CreateStockGroupXml(tallyXml, "", itemParams.StockGroupParent);
                }

                if (!StockGroup.IsAlreadyCreated(itemParams.StockGroupChild, tallyXml))
                {
                    StockGroup.CreateStockGroupXml(tallyXml, itemParams.StockGroupParent,
                                                   itemParams.StockGroupChild);
                }

                //Create and add Parent+Child StockCategory xmls
                if (!StockCategory.IsAlreadyCreated(itemParams.StockCategoryParent, tallyXml))
                {
                    StockCategory.CreateStockCategoryXml(tallyXml, "", itemParams.StockCategoryParent);
                }

                if (!StockCategory.IsAlreadyCreated(itemParams.StockCategoryChild, tallyXml))
                {
                    StockCategory.CreateStockCategoryXml(tallyXml, itemParams.StockCategoryParent,
                                                         itemParams.StockCategoryChild);
                }

                //Create and add StockItem xml
                if (!StockItem.IsAlreadyCreated(itemParams.ItemName, tallyXml))
                {
                    //Get the next available barcode and assign it
                    itemParams.Barcode = BarcodeValueGen.Instance.GetMeNewBarcode().ToString();
                    assignedBarcodesList.Add(itemParams.Barcode);

                    StockItem.CreateStockItemXml(tallyXml, itemParams.ItemName, itemParams.PartNo,
                                                 itemParams.StockGroupChild, itemParams.StockCategoryChild, itemParams.Barcode,
                                                 itemParams.CP, itemParams.SP, itemParams.ImgPath, itemParams.Desc1,
                                                 itemParams.Desc2, itemParams.Desc3);
                }

                //Check if AllInventoryEntriesList has already been created for a stock item
                //and if not, create it (note that xml is being filled with {0} for values
                //that need to be computed during post-processing)
                if (!AllInventoryEntriesList.IsAlreadyCreated(itemParams.ItemName, voucherXmlElement))
                {
                    AllInventoryEntriesList.CreateAllInventoryEntriesListXml(voucherXmlElement, itemParams.Desc1,
                                                                             itemParams.Desc2, itemParams.Desc3, itemParams.ItemName, itemParams.CP, "{0}",
                                                                             headerCSVParams.PurchLedger);
                }

                //Create and add BatchAllocationsList xml
                float batchCP = -ComputationHelper.CalculateAmount(itemParams.CP, itemParams.BilledQty);
                BatchAllocationsList.CreateBatchAllocationsListXml(voucherXmlElement, itemParams.ItemName, itemParams.GodownChild,
                                                                   Math.Round(batchCP, 2).ToString("0.00"), itemParams.ActualQty, itemParams.BilledQty);
            }

            BarcodeCSVParams barcodesLogData = new BarcodeCSVParams();

            barcodesLogData.FirstBarcodeAssigned = assignedBarcodesList.First();
            barcodesLogData.LastBarcodeAssigned  = assignedBarcodesList.Last();
            barcodesLogData.AssociatedOutputXml  = outputXmlFileName;
            barcodesLogData.TimeStamp            = DateTime.Now.ToString();

            WriteToCSVFiles.WriteBarcodesDataToFile(barcodesLogData);
        }