コード例 #1
0
        public async Task <PrintMaterialNameItem> SearchRecordsForPrintingAll()
        {
            // Find all tx31
            var materialShelfStatuss = _unitOfWork.MaterialShelfStatusRepository.GetAll();

            // Find all tx33
            var materialShelfStocks = _unitOfWork.MaterialShelfStockRepository.GetAll();

            // Find all materials.
            var materials = _unitOfWork.MaterialRepository.GetAll();

            // Record which should be printed.
            var printMaterialNameItem = new PrintMaterialNameItem();

            var condition1 = Constants.F31_ShelfStatus.Material.ToString("D");


            // Find Material Name item.
            var materialNameItems = from material in materials
                                    join materialShelfStock in materialShelfStocks on material.F01_MaterialCode equals materialShelfStock.F33_MaterialCode
                                    join materialShelfStatus in materialShelfStatuss on materialShelfStock.F33_PalletNo equals materialShelfStatus.F31_PalletNo
                                    where materialShelfStatus.F31_ShelfStatus.Trim().Equals(condition1) &&
                                    (material.F01_EntrustedClass.Equals("0") || material.F01_EntrustedClass.Equals("1"))
                                    orderby new
            {
                //materialShelfStock.F33_MaterialCode,
                //materialShelfStock.F33_MaterialLotNo

                materialShelfStatus.F31_ShelfRow,
                materialShelfStatus.F31_ShelfBay,
                materialShelfStatus.F31_ShelfLevel
                //materialShelfStock.F33_MaterialCode,
                //materialShelfStock.F33_MaterialLotNo
            }
            select new FindPrintMaterialNameItem
            {
                MaterialCode = materialShelfStock.F33_MaterialCode,
                MaterialName = material.F01_MaterialDsp,
                LotNo        = materialShelfStock.F33_PalletNo,
                PalletNo     = materialShelfStock.F33_MaterialLotNo,
                RBL          = materialShelfStatus.F31_ShelfRow + "-" + materialShelfStatus.F31_ShelfBay + "-" + materialShelfStatus.F31_ShelfLevel,
                Quantity     = materialShelfStock.F33_Amount,
                //Total = materialShelfStocks.Sum(i => i.F33_Amount)
            };

            //•	o	Show “PAGE: “ + current page with format as ###
            printMaterialNameItem.Page = "1";

            // Get Total quantity
            if (materialNameItems.Any())
            {
                printMaterialNameItem.Total = materialNameItems.Sum(i => i.Quantity).ToString("###,###,###,##0.00");
            }
            // o	Show {current date/time} with format: dd-mm-yyyy hh:ss
            printMaterialNameItem.Datetime = DateTime.Now.ToString("dd/MM/yyyy HH:mm");

            /*
             * o	Show {Company Name} = value from profile:
             * ProfileString("toshiba.ini","server","companyname","")
             */
            printMaterialNameItem.CompanyName = WebConfigurationManager.AppSettings["CompanyName"];


            await _unitOfWork.CommitAsync();

            printMaterialNameItem.FindPrintMaterialNameItem = await materialNameItems.ToListAsync();

            var groupby =
                printMaterialNameItem.FindPrintMaterialNameItem.Select(m => new FindPrintMaterialNameItem()
            {
                MaterialCode = m.MaterialCode,
                MaterialName = m.MaterialName,
                LotNo        = m.LotNo,
                PalletNo     = m.PalletNo,
                RBL          = m.RBL,
                Quantity     = m.Quantity,
                Quantityst   = m.Quantity.ToString("###,###,###,##0.00"),
            }).ToList().GroupBy(m => m.RBL);

            var groupitems = new List <FindPrintMaterialNameGroupItem>();

            foreach (var items in groupby)
            {
                var groupitem = new FindPrintMaterialNameGroupItem();
                groupitem.FindPrintMaterialNameItem = items.ToList();
                groupitem.Total = groupitem.FindPrintMaterialNameItem.Sum(i => i.Quantity).ToString("###,###,###,##0.00");
                groupitems.Add(groupitem);
            }
            printMaterialNameItem.groupitems = groupitems;
            return(printMaterialNameItem);
        }
コード例 #2
0
        public async Task <PrintMaterialNameItem> SearchProductForPrint()
        {
            //Get all record tx51
            var productShelfStatus = _unitOfWork.ProductShelfStatusRepository.GetAll();
            //Get all record tx40
            var productShelfStocks = _unitOfWork.ProductShelfStockRepository.GetAll();

            // Get all tm09.
            var products = _unitOfWork.ProductRepository.GetAll();

            var condition1 = Constants.F51_ShelfStatus.TX51_ShfSts_Pdt;
            var condition2 = Constants.F51_ShelfType.Normal;

            // Record which should be printed.
            var printPreProductNameItem = new PrintMaterialNameItem();

            // Find Pre Product Name item.
            var preProductNameItems = from productShelfStock in productShelfStocks
                                      join product in products on productShelfStock.F40_ProductCode equals product.F09_ProductCode
                                      join productShelfStatu in productShelfStatus on productShelfStock.F40_PalletNo equals productShelfStatu.F51_PalletNo
                                      where productShelfStatu.F51_ShelfStatus.Trim().Equals(condition1) &&
                                      productShelfStatu.F51_ShelfType.Trim().Equals("0")
                                      orderby new
            {
                productShelfStatu.F51_ShelfRow,
                productShelfStatu.F51_ShelfBay,
                productShelfStatu.F51_ShelfLevel
                //productShelfStock.F40_ProductCode,
                //productShelfStock.F40_ProductLotNo,
            }
            select new FindPrintMaterialNameItem()
            {
                PreProductCode = productShelfStock.F40_ProductCode,
                PreProductName = product.F09_ProductDesp,
                RBL            = productShelfStatu.F51_ShelfRow + "-" + productShelfStatu.F51_ShelfBay + "-" + productShelfStatu.F51_ShelfLevel,
                PalletNo       = productShelfStatu.F51_PalletNo,
                LotNo          = productShelfStock.F40_ProductLotNo,
                CF             = productShelfStock.F40_CertificationFlg,
                SDate1         = productShelfStatu.F51_StorageDate,
                Quantity       = productShelfStock.F40_Amount,
            };


            var totalFirstItems = 0;



            var totalSecondItems = 0;



            //•	o	Show “PAGE: “ + current page with format as ###
            printPreProductNameItem.Page = "1";

            // Get Total quantity
            //printPreProductNameItem.Total1 = totalFirstItems;
            //printPreProductNameItem.Total2 = totalSecondItems;
            //if (preProductNameItems.Any())
            //{
            //    printPreProductNameItem.Total = preProductNameItems.Sum(i => i.Amount);
            //}
            // o	Show {current date/time} with format: dd-mm-yyyy hh:ss
            printPreProductNameItem.Datetime = DateTime.Now.ToString("dd/MM/yyyy HH:mm");

            /*
             * o	Show {Company Name} = value from profile:
             * ProfileString("toshiba.ini","server","companyname","")
             */
            printPreProductNameItem.CompanyName = WebConfigurationManager.AppSettings["CompanyName"];


            await _unitOfWork.CommitAsync();

            printPreProductNameItem.FindPrintMaterialNameItem = await preProductNameItems.ToListAsync();

            var groupby =
                printPreProductNameItem.FindPrintMaterialNameItem.Select(m => new FindPrintMaterialNameItem()
            {
                PreProductCode = m.PreProductCode,
                PreProductName = m.PreProductName,
                LotNo          = m.LotNo,
                PalletNo       = m.PalletNo,
                RBL            = m.RBL,
                CF             = m.CF.Equals("1") ? "OK": m.CF.Equals("2") ? "NG":"",
                SDate          = m.SDate1.HasValue ? m.SDate1.Value.ToString("dd/MM/yyyy") : "",
                Stime          = m.SDate1.HasValue ? m.SDate1.Value.ToString("HH:mm") : "",
                Quantity       = m.Quantity,
                Quantityst     = m.Quantity.ToString("###,###,###,##0.00"),
            }).ToList().GroupBy(m => m.RBL);

            var groupitems = new List <FindPrintMaterialNameGroupItem>();

            foreach (var items in groupby)
            {
                var groupitem = new FindPrintMaterialNameGroupItem();
                groupitem.FindPrintMaterialNameItem = items.ToList();
                groupitem.Total = groupitem.FindPrintMaterialNameItem.Sum(i => i.Quantity).ToString("###,###,###,##0.00");
                groupitems.Add(groupitem);
            }
            printPreProductNameItem.groupitems = groupitems;
            return(printPreProductNameItem);
        }
コード例 #3
0
        public async Task <PrintMaterialNameItem> SearchMetarialShelftForPrintingAll()
        {
            // Find all 01
            var Materials = _unitOfWork.MaterialRepository.GetAll();

            // Find all tx33
            var SupmaterialStocks = _unitOfWork.MaterialShelfStockRepository.GetAll();
            // Find all tx32
            var MaterialShelfs = _unitOfWork.MaterialShelfRepository.GetAll();
            // Find all tx31
            var MaterialShelfStatuss = _unitOfWork.MaterialShelfStatusRepository.GetAll();
            // Find all tx30
            var Receptions = _unitOfWork.ReceptionRepository.GetAll();


            // Record which should be printed.
            var printMaterialNameItem = new PrintMaterialNameItem();

            var condition1 = Constants.F31_ShelfStatus.Material.ToString("D");


            // Find Material Name item.
            var materialNameItems = from material in Materials
                                    join supmaterialStock in SupmaterialStocks on material.F01_MaterialCode equals
                                    supmaterialStock.F33_MaterialCode
                                    join materialShelfStatus in MaterialShelfStatuss on supmaterialStock.F33_PalletNo equals
                                    materialShelfStatus.F31_PalletNo
                                    join materialShelf in MaterialShelfs on supmaterialStock.F33_PalletNo equals materialShelf.F32_PalletNo
                                    join reception in Receptions on
                                    new { test1 = materialShelf.F32_PrtDvrNo, test2 = materialShelf.F32_PrcOrdNo } equals
            new { test1 = reception.F30_PrtDvrNo, test2 = reception.F30_PrcOrdNo }
            where materialShelfStatus.F31_ShelfStatus.Equals("3")
            orderby new
            {
                materialShelfStatus.F31_ShelfRow,
                materialShelfStatus.F31_ShelfBay,
                materialShelfStatus.F31_ShelfLevel
                //supmaterialStock.F33_MaterialCode,
                //supmaterialStock.F33_MaterialLotNo,
            }
            select new FindPrintMaterialSheifItem
            {
                MaterialCode = supmaterialStock.F33_MaterialCode,
                MaterialName = material.F01_MaterialDsp,
                LotNo        = supmaterialStock.F33_MaterialLotNo,
                PalletNo     = materialShelfStatus.F31_PalletNo,
                Quantity     = supmaterialStock.F33_Amount,
                RBL          = materialShelfStatus.F31_ShelfRow + "-" + materialShelfStatus.F31_ShelfBay + "-" + materialShelfStatus.F31_ShelfLevel,
                PONo         = materialShelf.F32_PrcOrdNo,
                PD           = materialShelf.F32_PrtDvrNo,
                SDate1       = materialShelfStatus.F31_StorageDate,
                BF           = material.F01_EntrustedClass,
                AF           = reception.F30_AcceptClass,
                //Total = materialShelfStocks.Sum(i => i.F33_Amount)
            };

            //var lstItem = materialNameItems.ToList().Select(m => new FindPrintMaterialSheifItem
            //{
            //    MaterialCode = m.MaterialCode,
            //    MaterialName = m.MaterialName,
            //    LotNo = m.LotNo,
            //    PalletNo = m.PalletNo,
            //    Quantity = m.Quantity,
            //    RBL = m.RBL,
            //    PONo = m.PONo,
            //    PD = m.PD,
            //    SDate = m.SDate,
            //    BF = m.BF,
            //    AF = m.AF,
            //});

#if DEBUG
            var a = await materialNameItems.ToListAsync();
#endif
            //•	o	Show “PAGE: “ + current page with format as ###
            printMaterialNameItem.Page = "1";

            // Get Total quantity
            if (materialNameItems.Any())
            {
                printMaterialNameItem.Total = materialNameItems.Sum(i => i.Quantity).ToString("###,###,###,##0.00");
            }
            // o	Show {current date/time} with format: dd-mm-yyyy hh:ss
            printMaterialNameItem.Datetime = DateTime.Now.ToString("dd/MM/yyyy HH:mm");

            /*
             * o	Show {Company Name} = value from profile:
             * ProfileString("toshiba.ini","server","companyname","")
             */
            printMaterialNameItem.CompanyName = WebConfigurationManager.AppSettings["CompanyName"];


            await _unitOfWork.CommitAsync();

            printMaterialNameItem.FindPrintMaterialSheifItem = await materialNameItems.ToListAsync();

            var groupby = printMaterialNameItem.FindPrintMaterialSheifItem.Select(m => new FindPrintMaterialSheifItem
            {
                MaterialCode = m.MaterialCode,
                MaterialName = m.MaterialName,
                LotNo        = m.LotNo,
                PalletNo     = m.PalletNo,
                Quantity     = m.Quantity,
                Quantityst   = m.Quantity.ToString("###,###,###,##0.00"),
                RBL          = m.RBL,
                PONo         = m.PONo,
                PD           = m.PD,
                SDate        = m.SDate1.HasValue? m.SDate1.Value.ToString("dd/MM/yyyy") : "",
                Stime        = m.SDate1.HasValue ? m.SDate1.Value.ToString("HH:mm") : "",
                BF           = m.BF.Equals("0") ? "Norm" : (m.BF.Equals("1")? "Bail" : m.BF),
                AF           = m.AF.Equals("0")? "Yet" : m.AF.Equals("1") ? "Done": m.AF.Equals("2") ? "Reject" : m.AF,
            }).ToList().GroupBy(m => m.RBL);
            try
            {
                var groupitems = new List <FindPrintMaterialNameGroupItem>();

                foreach (var items in groupby)
                {
                    var groupitem = new FindPrintMaterialNameGroupItem();
                    groupitem.FindPrintMaterialSheifItem = items.ToList();
                    groupitem.Total = groupitem.FindPrintMaterialSheifItem.Sum(i => i.Quantity).ToString("###,###,###,##0.00");
                    groupitems.Add(groupitem);
                }
                printMaterialNameItem.groupitems = groupitems;
            }
            catch (Exception ex)
            {
            }


            return(printMaterialNameItem);
        }
コード例 #4
0
        public async Task <PrintMaterialNameItem> SearchSupplementaryRecordsForPrintingAll()
        {
            // Find all 15
            var SubmaterialShelfStatuss = _unitOfWork.SubMaterialRepository.GetAll();

            // Find all tx33
            var SupmaterialStocks = _unitOfWork.SupMaterialStockRepository.GetAll();

            // Find all materials.
            var materials = _unitOfWork.MaterialRepository.GetAll();

            // Record which should be printed.
            var printMaterialNameItem = new PrintMaterialNameItem();

            var condition1 = Constants.F31_ShelfStatus.Material.ToString("D");


            // Find Material Name item.
            var materialNameItems = from submaterial in SubmaterialShelfStatuss
                                    join materialShelfStock in SupmaterialStocks on submaterial.F15_SubMaterialCode equals materialShelfStock.F46_SubMaterialCode
                                    where true
                                    orderby new
            {
                materialShelfStock.F46_SubMaterialCode
            }
            select new SubFindPrintMaterialNameItem
            {
                SupplementaryMaterialCode = materialShelfStock.F46_SubMaterialCode,
                SupplementaryMaterialName = submaterial.F15_MaterialDsp,
                PackingUnit = submaterial.F15_PackingUnit,
                Unit        = submaterial.F15_Unit,
                Quantity    = materialShelfStock.F46_Amount,
                //Total = materialShelfStocks.Sum(i => i.F33_Amount)
            };

#if DEBUG
            var a = await materialNameItems.ToListAsync();
#endif
            //•	o	Show “PAGE: “ + current page with format as ###
            printMaterialNameItem.Page = "1";

            // Get Total quantity
            if (materialNameItems.Any())
            {
                printMaterialNameItem.Total = materialNameItems.Sum(i => i.Quantity).ToString("###,###,###,##0.00");
            }
            // o	Show {current date/time} with format: dd-mm-yyyy hh:ss
            printMaterialNameItem.Datetime = DateTime.Now.ToString("dd/MM/yyyy HH:mm");

            /*
             * o	Show {Company Name} = value from profile:
             * ProfileString("toshiba.ini","server","companyname","")
             */
            printMaterialNameItem.CompanyName = WebConfigurationManager.AppSettings["CompanyName"];


            await _unitOfWork.CommitAsync();

            printMaterialNameItem.FindPrintSubMaterialNameItem = await materialNameItems.ToListAsync();

            printMaterialNameItem.FindPrintSubMaterialNameItem =
                printMaterialNameItem.FindPrintSubMaterialNameItem.Select(m => new SubFindPrintMaterialNameItem()
            {
                SupplementaryMaterialCode = m.SupplementaryMaterialCode,
                SupplementaryMaterialName = m.SupplementaryMaterialName,
                PackingUnitst             = m.PackingUnit.ToString("###,###,###,##0.00"),
                Unit       = m.Unit,
                Quantityst = m.Quantity.ToString("###,###,###,##0.00"),
            }).ToList();
            return(printMaterialNameItem);
        }
コード例 #5
0
        public async Task <PrintMaterialNameItem> SearchRecordsForPrintingBailment()
        {
            // Find all tx31
            var materialShelfStatuss = _unitOfWork.MaterialShelfStatusRepository.GetAll();

            // Find all tx33
            var materialShelfStocks = _unitOfWork.MaterialShelfStockRepository.GetAll();

            // Find all materials.
            var materials = _unitOfWork.MaterialRepository.GetAll();

            // Record which should be printed.
            var printMaterialNameItem = new PrintMaterialNameItem();

            var condition1 = Constants.F31_ShelfStatus.Material.ToString("D");
            var condition2 = Constants.TM01_Material_EntrustedClass.Bailment.ToString("D");

            // Find Material Name item.
            var materialNameItems = from material in materials
                                    join materialShelfStock in materialShelfStocks on material.F01_MaterialCode equals materialShelfStock.F33_MaterialCode
                                    join materialShelfStatus in materialShelfStatuss on materialShelfStock.F33_PalletNo equals materialShelfStatus.F31_PalletNo
                                    where materialShelfStatus.F31_ShelfStatus.Trim().Equals(condition1) &&
                                    material.F01_EntrustedClass.Equals(condition2)
                                    orderby new
            {
                materialShelfStock.F33_MaterialCode,
                materialShelfStock.F33_MaterialLotNo
            }
            select new FindPrintMaterialNameItem
            {
                MaterialCode = materialShelfStock.F33_MaterialCode,
                MaterialName = material.F01_MaterialDsp,
                PalletNo     = materialShelfStock.F33_PalletNo,
                LotNo        = materialShelfStock.F33_MaterialLotNo,
                RBL          = materialShelfStatus.F31_ShelfRow + "-" + materialShelfStatus.F31_ShelfBay + "-" + materialShelfStatus.F31_ShelfLevel,
                Quantity     = materialShelfStock.F33_Amount,
                //Total = materialShelfStocks.Sum(i => i.F33_Amount)
            };

            var groupItems =
                materialNameItems.GroupBy(x => new { x.MaterialCode })
                .Select(y => new GroupValueItem()
            {
                MaterialCode = y.Key.MaterialCode,
                Total        = y.Sum(c => c.Quantity)
            });

            foreach (var groupitem in groupItems.ToList())
            {
                var printMaterialNameGroupItem = new PrintMaterialNameGroupItem()
                {
                    MaterialCode   = groupitem.MaterialCode,
                    LotTotal       = groupitem.Total,
                    LotTotalString = String.Format("{0:#,##0.00}", groupitem.Total)
                };
                foreach (var item in materialNameItems.ToList())
                {
                    if (item.MaterialCode == groupitem.MaterialCode)
                    {
                        printMaterialNameGroupItem.FindPrintMaterialNameItem.Add(item);
                    }
                }
                printMaterialNameItem.PrintMaterialNameGroupItem.Add(printMaterialNameGroupItem);
            }


            await _unitOfWork.CommitAsync();

            //printMaterialNameItem.FindPrintMaterialNameItem = await materialNameItems.ToListAsync();

            return(printMaterialNameItem);
        }
コード例 #6
0
        /// <summary>
        ///     This function is for exporting data from kneading command database to list.
        /// </summary>
        /// <returns></returns>
        public async Task <PrintMaterialNameItem> SearchRecordsForPrinting()
        {
            // Find all tx31
            var materialShelfStatuss = _unitOfWork.MaterialShelfStatusRepository.GetAll();

            // Find all tx33
            var materialShelfStocks = _unitOfWork.MaterialShelfStockRepository.GetAll();

            // Find all materials.
            var materials = _unitOfWork.MaterialRepository.GetAll();

            // Record which should be printed.
            var printMaterialNameItem = new PrintMaterialNameItem();

            var condition1 = Constants.F31_ShelfStatus.Material.ToString("D");
            var condition2 = Constants.TM01_Material_EntrustedClass.Normal.ToString("D");

            // Find Material Name item.
            var materialNameItems = from material in materials
                                    join materialShelfStock in materialShelfStocks on material.F01_MaterialCode equals materialShelfStock.F33_MaterialCode
                                    join materialShelfStatus in materialShelfStatuss on materialShelfStock.F33_PalletNo equals materialShelfStatus.F31_PalletNo
                                    where materialShelfStatus.F31_ShelfStatus.Trim().Equals(condition1) &&
                                    material.F01_EntrustedClass.Equals(condition2)
                                    orderby new
            {
                materialShelfStock.F33_MaterialCode,
                materialShelfStock.F33_MaterialLotNo
            }
            select new FindPrintMaterialNameItem
            {
                MaterialCode = materialShelfStock.F33_MaterialCode,
                MaterialName = material.F01_MaterialDsp,
                LotNo        = materialShelfStock.F33_MaterialLotNo,
                PalletNo     = materialShelfStock.F33_PalletNo,
                RBL          = materialShelfStatus.F31_ShelfRow + "-" + materialShelfStatus.F31_ShelfBay + "-" + materialShelfStatus.F31_ShelfLevel,
                Quantity     = materialShelfStock.F33_Amount,
                //Total = materialShelfStocks.Sum(i => i.F33_Amount)
            };

            var a = materialNameItems.GroupBy(item => item.MaterialCode)
                    .Select(group => group.Sum(item => item.Quantity));

            var groupItems =
                materialNameItems.GroupBy(x => new { x.MaterialCode })
                .Select(y => new GroupValueItem()
            {
                MaterialCode = y.Key.MaterialCode,
                Total        = y.Sum(c => c.Quantity)
            });

            foreach (var groupitem in groupItems.ToList())
            {
                var printMaterialNameGroupItem = new PrintMaterialNameGroupItem()
                {
                    MaterialCode   = groupitem.MaterialCode,
                    LotTotal       = groupitem.Total,
                    LotTotalString = String.Format("{0:#,##0.00}", groupitem.Total)
                };
                foreach (var item in materialNameItems.ToList())
                {
                    if (item.MaterialCode == groupitem.MaterialCode)
                    {
                        printMaterialNameGroupItem.FindPrintMaterialNameItem.Add(item);
                    }
                }
                printMaterialNameItem.PrintMaterialNameGroupItem.Add(printMaterialNameGroupItem);
            }

            //var totalSecondItems = (await secondResult.SumAsync(x => (double?)x.Key.Amount)) ?? 0;

            //•	o	Show “PAGE: “ + current page with format as ###
            //printExternalPreProductNameItem.Page = "1";

            //// Get Total quantity
            //printPreProductNameItem.PreproductTotal = printPreProductNameItem.PrintPreProductNameGroupItem.Sum(c => c.LotTotal);
            //printPreProductNameItem.PreproductTotalString = String.Format("{0:#,##0.00}", printPreProductNameItem.PreproductTotal);


            await _unitOfWork.CommitAsync();

            //printMaterialNameItem.FindPrintMaterialNameItem = await materialNameItems.ToListAsync();

            return(printMaterialNameItem);
        }