wangxinhui
5 天以前 9ec715d2deb18a269dd49c48da91a36632d08c81
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Core;
using WIDESEA_Core.BaseServices;
using WIDESEA_Core.Helper;
using WIDESEA_Core.HostedService;
using WIDESEA_DTO.System;
using WIDESEA_IBasicRepository;
using WIDESEA_IBasicService;
using WIDESEA_Model.Models;
 
namespace WIDESEA_BasicService
{
    public partial class WarehouseService
    {
        public WebResponseContent GetWarehouseDicByUser()
        {
            try
            {
                List<int> warehouseIds = Db.Queryable<Sys_RoleDataPermission>().Where(x => x.RoleId == App.User.RoleId).Select(x => x.WarehouseId).ToList();
                List<DictionaryDTO> dic = Repository.QueryData(x => new DictionaryDTO { Key = x.WarehouseId, Value = x.WarehouseName + $"({x.WarehouseCode})" }, x => warehouseIds.Contains(x.WarehouseId)).ToList();
                List<Dt_PalletTypeInfo> palletTypeInfos = _palletTypeInfoRepository.QueryData();//x => x.TypeName + $"({x.CodeStartStr})", x => true
                dic.ForEach(x =>
                {
                    x.Extra = palletTypeInfos.Where(v => v.WarehouseId == x.Key.ObjToInt()).Select(x => new DictionaryDTO { Key = x.Id, Value = x.TypeName + $"({x.CodeStartStr})" }).ToList();
                });
 
                return WebResponseContent.Instance.OK(data: dic);
            }
            catch (Exception ex)
            {
                return WebResponseContent.Instance.Error(ex.Message);
            }
        }
    }
}