Exemplo n.º 1
0
        /// <summary>
        /// 查询客户关联的所有仓库
        /// </summary>
        /// <param name="customerid">客户Id</param>
        /// <param name="tenantId">租户Id</param>
        /// <returns></returns>
        public async Task <Customer_Warehouse_AppOutputDto> GetCustomerWarehouseAsync(string customerid, string tenantId)
        {
            try
            {
                var dataOutputDto = new Customer_Warehouse_AppOutputDto();
                var result        = await _dataRepository.GetAllListAsync(d => d.Customerid == customerid);

                var dataOutputList = Mapper.Map <List <Desc_Customer_Warehouse_AppOutputDto> >(result);

                var dataOutputDtoList = new List <Desc_Customer_Warehouse_AppOutputDto>();

                var client           = new HttpApiClient(_options.Value?.FacilitiesUri);
                var warehouseService = client.Create <IFacilitiesInterface>();
                var response         = await warehouseService.GetWarehouseSelectedItemList(tenantId, true);

                var warehosueList = JsonUtils.DeserializeNezadaJsonDto <List <SelectedItem> >(response);

                warehosueList = warehosueList.FindAll(d => d.Enabled == true);
                foreach (var warehosue in warehosueList)
                {
                    var dataOutput = dataOutputList.Find(d => d.Warehouseid == warehosue.Id);
                    if (dataOutput != null)
                    {
                        warehosue.Selected       = true;
                        dataOutput.WarehouseName = warehosue.Text;
                        dataOutputDtoList.Add(dataOutput);
                    }
                }
                dataOutputDto.CustomerWarehouseList = dataOutputDtoList;
                dataOutputDto.WarehouseList         = warehosueList;

                return(dataOutputDto);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 构造
 /// </summary>
 public Ppt_Customer_AppOutputDto()
 {
     SexList           = ConsigneeList = new List <SelectedItem>();
     CustomerWarehouse = new Customer_Warehouse_AppOutputDto();
     AllAddress        = new NezadaAddress();
 }