Пример #1
0
        public static SelectList GetSupplierPlantList()
        {
            IPlantBLL plantBll = MvcApplication.GetInstance <PlantBLL>();
            var       data     = plantBll.GetAll();

            return(new SelectList(data, "WERKS", "DROPDOWNTEXTFIELD"));
        }
Пример #2
0
        private SLDocument CreateDataExcel(SLDocument slDocument, List <VirtualNppbckDetails> listData)
        {
            int iRow = 3; //starting row data

            var listPlants = _plantBll.GetAll();

            foreach (var data in listData)
            {
                string plantDesc = "";
                var    plant     = listPlants.Where(c => c.NPPBKC_ID == data.VirtualNppbckId);
                foreach (var plant1 in plant)
                {
                    plantDesc += plant1.WERKS + "-" + plant1.ORT01 + Environment.NewLine;
                }

                slDocument.SetCellValue(iRow, 1, data.VirtualNppbckId);
                slDocument.SetCellValue(iRow, 2, data.Address1);
                slDocument.SetCellValue(iRow, 3, data.Address2);
                slDocument.SetCellValue(iRow, 4, data.City);
                slDocument.SetCellValue(iRow, 5, data.CityAlias);
                slDocument.SetCellValue(iRow, 6, data.RegionOfficeOfDGCE);
                slDocument.SetCellValue(iRow, 7, data.TextTo);
                slDocument.SetCellValue(iRow, 8, data.KppbcId);
                slDocument.SetCellValue(iRow, 9, data.Region);
                slDocument.SetCellValue(iRow, 10, data.AcountNumber);
                slDocument.SetCellValue(iRow, 11, Utils.ConvertHelper.ConvertDateToStringddMMMyyyy(data.StartDate));
                slDocument.SetCellValue(iRow, 12, Utils.ConvertHelper.ConvertDateToStringddMMMyyyy(data.EndDate));
                slDocument.SetCellValue(iRow, 13, data.FlagForLack1 ? "Yes" : "No");
                slDocument.SetCellValue(iRow, 14, plantDesc);
                slDocument.SetCellValue(iRow, 15, data.Is_Deleted);


                iRow++;
            }

            //create style
            SLStyle valueStyle = slDocument.CreateStyle();

            valueStyle.Border.LeftBorder.BorderStyle   = BorderStyleValues.Thin;
            valueStyle.Border.RightBorder.BorderStyle  = BorderStyleValues.Thin;
            valueStyle.Border.TopBorder.BorderStyle    = BorderStyleValues.Thin;
            valueStyle.Border.BottomBorder.BorderStyle = BorderStyleValues.Thin;
            valueStyle.SetWrapText(true);

            slDocument.AutoFitColumn(1, 15);
            slDocument.SetCellStyle(3, 1, iRow - 1, 15, valueStyle);

            return(slDocument);
        }
Пример #3
0
        public List <ProductionDto> GetCompleteData(List <ProductionDto> listItem, GetOtherProductionByParamInput input)
        {
            List <ProductionDto> list    = new List <ProductionDto>();
            List <ProductionDto> newList = new List <ProductionDto>();

            //search editable other brand
            var prodCode = _repositoryProd.GetQuery().Where(x => x.CK4CEDITABLE == true).Select(x => x.PROD_CODE).ToList();

            var plantList = _plantBll.GetAll().Where(x => x.WERKS == input.Plant);

            var listBrand = _brandRegistrationBll.GetAllBrandsOnly();

            if (input.IsNppbkc)
            {
                plantList = _plantBll.GetPlantByNppbkc(input.Nppbkc).Distinct();
            }

            DateTime firstDay  = new DateTime(input.Year, input.Month, 1);
            DateTime startDate = firstDay;
            DateTime endDate   = new DateTime(input.Year, input.Month, 14);

            if (input.Period == 2)
            {
                startDate = new DateTime(input.Year, input.Month, 15);
                endDate   = firstDay.AddMonths(1).AddDays(-1);
            }

            for (var j = startDate.Day; j <= endDate.Day; j++)
            {
                foreach (var item in plantList)
                {
                    Int32 isInt;
                    var   activeBrand = listBrand.Where(x => x.WERKS == item.WERKS && Int32.TryParse(x.BRAND_CONTENT, out isInt) &&
                                                        (x.EXC_GOOD_TYP == "01" || x.EXC_GOOD_TYP == "02") && prodCode.Contains(x.PROD_CODE));

                    foreach (var data in activeBrand.Distinct())
                    {
                        var newItem = new ProductionDto();
                        newItem.CompanyCode        = input.Company;
                        newItem.ProductionDate     = startDate;
                        newItem.FaCode             = data.FA_CODE;
                        newItem.PlantWerks         = item.WERKS;
                        newItem.LevelPlant         = item.WERKS;
                        newItem.BrandDescription   = data.BRAND_CE;
                        newItem.PlantName          = item.NAME1;
                        newItem.TobaccoProductType = data.ZAIDM_EX_PRODTYP.PRODUCT_TYPE;
                        newItem.Hje            = data.HJE_IDR;
                        newItem.Tarif          = data.TARIFF;
                        newItem.QtyPacked      = 0;
                        newItem.QtyUnpacked    = 0;
                        newItem.QtyProduced    = 0;
                        newItem.Uom            = data.ZAIDM_EX_PRODTYP.PRODUCT_ALIAS == "TIS" ? "G" : "Btg";
                        newItem.ProdCode       = data.PROD_CODE;
                        newItem.ContentPerPack = Convert.ToInt32(data.BRAND_CONTENT);
                        newItem.PackedInPack   = 0;
                        newItem.PackedInPackZb = 0;
                        newItem.IsEditable     = true;
                        newItem.Zb             = 0;
                        newItem.PackedAdjusted = 0;

                        newList.Add(newItem);
                    }
                }

                startDate = startDate.AddDays(1);
            }

            var sameData = from a in newList
                           join b in listItem on new { a.ProductionDate, a.FaCode, a.PlantWerks } equals new { b.ProductionDate, b.FaCode, b.PlantWerks }
            select a;

            list = newList.Except(sameData).ToList();

            list.AddRange(listItem);

            return(list.OrderBy(x => x.FaCode).OrderBy(x => x.ProductionDate).ToList());
        }