wangxinhui
2024-09-23 a3eb67538c4716aef9967f1e6301720cce095e3c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
 
 
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using WIDESEA_Core.EFDbContext;
using WIDESEA_Core.Utilities;
using WIDESEA_Entity.DomainModels;
using WIDESEA_Entity.materielinfo;
using WIDESEA_Services.IRepositories;
using WIDESEA_Services.Repositories;
 
namespace WIDESEA_Services.Services
{
    public partial class dt_materielinfoService
    {
        private readonly IHttpContextAccessor _httpContextAccessor;
        private readonly Idt_materielinfoRepository _repository;//访问数据库
 
        [ActivatorUtilitiesConstructor]
        public dt_materielinfoService(
            Idt_materielinfoRepository dbRepository,
            IHttpContextAccessor httpContextAccessor
            )
        : base(dbRepository)
        {
            _httpContextAccessor = httpContextAccessor;
            _repository = dbRepository;
            //多租户会用到这init代码,其他情况可以不用
            //base.Init(dbRepository);
        }
 
        public static WebResponseContent materielinfoPagemessg(SaveModel saveModel)
        {
            
            WebResponseContent content=new WebResponseContent();
            VOLContext context = new VOLContext();
            Idt_materielinfoRepository materielinfoRepository=new dt_materielinfoRepository(context);
 
            List<dt_materielinfo> materielinfo = materielinfoRepository.Find(d => d.materiel_text == saveModel.MainData["materiel_text"].ToString());
            
            Dictionary<string, object> MainData = new Dictionary<string, object>();
            
            List<materielinfoinformation> materielinfoinformationlist = new List<materielinfoinformation>();
            foreach (var item in materielinfo)
            {
                materielinfoinformation materielinfoinformation = new materielinfoinformation()
                {
                    value=item.materiel_id,
                    text=item.materiel_name,
                };
                materielinfoinformationlist.Add(materielinfoinformation);
            }
            return content.OK("OK", materielinfoinformationlist);
        }
        public class materielinfoinformation {
            public string value { get; set; }
            public string text { get; set; }
        } 
       
    }
}