Пример #1
0
        public async Task <object> GetChemicalBySupplier(int id)
        {
            // throw new NotImplementedException();
            var list     = new List <InkChemicalDto>();
            var inkmodel = await _repoInk.FindAll().Where(x => x.SupplierID == id).Select(x => new InkChemicalDto {
                ID         = x.ID,
                Name       = x.Name,
                Subname    = "Ink",
                percentage = x.percentage,
                modify     = true,
                Code       = x.Code
            }).ToListAsync();

            foreach (var item in inkmodel)
            {
                list.Add(item);
            }
            // list.Add(inkmodel);
            var chemicalmodel = await _repoChemical.FindAll().Where(x => x.SupplierID == id).Select(x => new InkChemicalDto {
                ID         = x.ID,
                Name       = x.Name,
                Subname    = "Chemical",
                percentage = x.Percentage,
                modify     = x.Modify,
                Code       = x.Code
            }).ToListAsync();

            foreach (var item in chemicalmodel)
            {
                list.Add(item);
            }
            return(list);
        }
Пример #2
0
        public async Task <object> GetInkChemicalByGlueID(int id)
        {
            var list = new List <InkChemicalDto>();
            var data = await _repoPartInkChemical.FindAll().Where(x => x.GlueID == id).ToListAsync();

            foreach (var item in data)
            {
                if (item.InkID != 0)
                {
                    var inkmodel = await _repoInk.FindAll().Where(x => x.ID == item.InkID).Select(x => new InkChemicalDto
                    {
                        ID         = x.ID,
                        Name       = x.Name,
                        Subname    = "Ink",
                        modify     = true,
                        Code       = x.Code,
                        percentage = _repoPartInkChemical.FindAll().FirstOrDefault(x => x.InkID == item.InkID && x.GlueID == id).Percentage
                    }).ToListAsync();

                    foreach (var item2 in inkmodel)
                    {
                        list.Add(item2);
                    }
                }
                else
                {
                    var chemicalmodel = await _repoChemical.FindAll().Where(x => x.ID == item.ChemicalID).Select(x => new InkChemicalDto
                    {
                        ID         = x.ID,
                        Name       = x.Name,
                        Code       = x.Code,
                        Subname    = "Chemical",
                        modify     = x.Modify,
                        percentage = _repoPartInkChemical.FindAll().FirstOrDefault(x => x.ChemicalID == item.ChemicalID && x.GlueID == id).Percentage
                    }).ToListAsync();

                    foreach (var item2 in chemicalmodel)
                    {
                        list.Add(item2);
                    }
                }
            }
            return(list);
        }
Пример #3
0
 private async Task <bool> CheckExistInk(InkForImportExcelDto ink)
 {
     return(await _repoInk.FindAll().AnyAsync(x => x.Name == ink.Name && x.ProcessID == ink.ProcessID));
 }