// GET: Common
 public ActionResult ModelQuery(string modelCode)
 {
     /*List<Series> seriesList = productService.doFindAllSeries();
      * ViewData["seriesList"] = seriesList;*/
     ViewData["modelCode"]  = modelCode;
     ViewData["seriesList"] = ProductCache.GetSeriesDic();
     return(View("ModelQuery"));
 }
Exemple #2
0
        public byte[] ExportRetailOrderList(NameValueCollection queryString)
        {
            List <RetailOrderQueryExportVo> list = doFindRetailOrderByCondition(queryString);

            foreach (var item in list)
            {
                IDictionary <string, string> regionDic = CommonCache.GetRegionDic();
                if (item.Region != null && regionDic.ContainsKey(item.Region))
                {
                    item.Region = regionDic[item.Region];
                }
                IDictionary <string, Dealer> dealerDic = SystemCache.GetDealerDic();
                if (item.DealerCode != null && dealerDic.ContainsKey(item.DealerCode))
                {
                    item.DealerName = dealerDic[item.DealerCode].DealerName;
                    item.NetCode    = dealerDic[item.DealerCode].NetCode;
                }
                IDictionary <string, string> seriesDic = ProductCache.GetSeriesDic();
                if (item.Series != null && seriesDic.ContainsKey(item.Series))
                {
                    item.Series = seriesDic[item.Series];
                }
                IDictionary <string, ModelGroup> modelGroupDic = ProductCache.GetModelGroupDic();
                string key = item.ModelCode + item.InteriorCode + item.PrList;
                if (modelGroupDic.ContainsKey(key))
                {
                    item.ModelYear    = modelGroupDic[key].ModelYear.ToString();
                    item.ModelVersion = modelGroupDic[key].ModelVersion;
                    item.PrList       = modelGroupDic[key].PrList;
                }
                IDictionary <string, Model> modelDic = ProductCache.GetModelDic();
                if (item.ModelCode != null && modelDic.ContainsKey(item.ModelCode))
                {
                    item.ModelName = modelDic[item.ModelCode].ModelName;
                }
                IDictionary <string, string> colorDic = ProductCache.GetColorDic();
                if (item.ColorCode != null && colorDic.ContainsKey(item.ColorCode))
                {
                    item.ColorName = colorDic[item.ColorCode];
                }
                IDictionary <string, string> interiorDic = ProductCache.GetInteriorDic();
                if (item.InteriorCode != null && interiorDic.ContainsKey(item.InteriorCode))
                {
                    item.InteriorName = interiorDic[item.InteriorCode];
                }
                IDictionary <string, County> countyDic = CommonCache.GetCountyDic();
                if (item.County != null && countyDic.ContainsKey(item.County))
                {
                    item.Provice = countyDic[item.County].ProvinceName;
                    item.City    = countyDic[item.County].CityName;
                    item.County  = countyDic[item.County].CountyName;
                }
                IDictionary <string, string> salesPersonDic = RetailCache.GetSalesPersonDic();
                if (item.SalesPerson != null && salesPersonDic.ContainsKey(item.SalesPerson))
                {
                    item.SalesPerson = salesPersonDic[item.SalesPerson];
                }
                IDictionary <string, string> insuranceCompanyDic = RetailCache.GetInsuranceCompanyDic();
                if (item.InsuranceCompany != null && insuranceCompanyDic.ContainsKey(item.InsuranceCompany))
                {
                    item.InsuranceCompany = insuranceCompanyDic[item.InsuranceCompany];
                }
                item.Gender          = RetailCache.GetGender(item.Gender);
                item.InvoiceType     = RetailCache.GetInvoiceType(item.InvoiceType);
                item.CustomerType    = RetailCache.GetCustomerType(item.CustomerType);
                item.VehiclePurpose  = RetailCache.GetVehiclePurpose(item.VehiclePurpose);
                item.CertificateType = RetailCache.GetVehiclePurpose(item.CertificateType);
                item.Duty            = RetailCache.GetVehiclePurpose(item.Duty);
                item.CompanyProperty = RetailCache.GetVehiclePurpose(item.CompanyProperty);
                item.CompanyIndustry = RetailCache.GetVehiclePurpose(item.CompanyIndustry);
                item.SalesType       = RetailCache.GetVehiclePurpose(item.SalesType);
                item.SalesSource     = RetailCache.GetSalesSource(item.SalesSource);
                item.OutStockStatus  = RetailCache.GetOutStockStatus(item.OutStockStatus);
                item.OrderStatus     = RetailCache.GetOrderStatus(item.OrderStatus);
                item.Accessory       = RetailCache.GetYesNo(item.Accessory);
                item.PaymentType     = RetailCache.GetPaymentType(item.PaymentType);
                item.UsedCar         = RetailCache.GetYesNo(item.UsedCar);
                item.LongStorage     = RetailCache.GetYesNo(item.LongStorage);
                item.Club            = RetailCache.GetYesNo(item.Club);
                item.ThreeGuarantees = RetailCache.GetYesNo(item.ThreeGuarantees);
            }

            StringBuilder sb = new StringBuilder();

            sb.Append("零售订单号码,分销中心,经销商代码,经销商名称,网络代码,登记日期,登记时间,零售日期,零售时间,发票号码,车辆代码,车辆名称,");
            sb.Append("颜色代码,颜色名称,内饰,内饰名称,车型年,版本号,选装包,销售类型,车型分类,零售单价,用户名称,联系人,性别,省市,地极市,县,");
            sb.Append("联系地址,邮政编码,车辆用途,发票类型,客户类别,公司性质,职务,电话号码,手机号码,电子邮件,证件类型,证件号码,从事行业,");
            sb.Append("销售员,销售来源,配车处理,操作日期,订单状态,发动机号,VIN,零售数量,作废日期,出库日期,备注,礼品类型,发票日期,");
            sb.Append("是否装配原装附件包,车主,被保险人,保险公司,保险单,保险起始日期,保险终止日期,支付方式,金融机构,贷款类型,支付备注,");
            sb.Append("二手车置换,长库龄车,加入会员俱乐部,三包车辆,网外二网名称");
            sb.AppendLine();
            foreach (var item in list)
            {
                sb.Append(item.OrderNo + ",");
                sb.Append(item.Region + ",");
                sb.Append(item.DealerCode + ",");
                sb.Append(item.DealerName + ",");
                sb.Append(item.NetCode + ",");
                sb.Append(item.CreateDate + ",");
                sb.Append(item.CreateTime + ",");
                sb.Append(item.RetailDate + ",");
                sb.Append(item.RetailTime + ",");
                sb.Append(item.InvoiceNo + ",");
                sb.Append(item.ModelCode + ",");
                sb.Append(item.ModelName + ",");
                sb.Append(item.ColorCode + ",");
                sb.Append(item.ColorName + ",");
                sb.Append(item.InteriorCode + ",");
                sb.Append(item.InteriorName + ",");
                sb.Append(item.ModelYear + ",");
                sb.Append(item.ModelVersion + ",");
                sb.Append(item.PrList + ",");
                sb.Append(item.SalesType + ",");
                sb.Append(item.Series + ",");
                sb.Append(item.Price + ",");
                sb.Append(FileHelper.FilterSpecialChar(item.CustomerName) + ",");
                sb.Append(FileHelper.FilterSpecialChar(item.Contact) + ",");
                sb.Append(item.Gender + ",");
                sb.Append(item.Provice + ",");
                sb.Append(item.City + ",");
                sb.Append(item.County + ",");
                sb.Append(FileHelper.FilterSpecialChar(item.Address) + ",");
                sb.Append(FileHelper.FilterSpecialChar(item.ZipCode) + ",");
                sb.Append(item.VehiclePurpose + ",");
                sb.Append(item.InvoiceType + ",");
                sb.Append(item.CustomerType + ",");
                sb.Append(item.CompanyProperty + ",");
                sb.Append(item.Duty + ",");
                sb.Append(FileHelper.FilterSpecialChar(item.Telephone) + ",");
                sb.Append(FileHelper.FilterSpecialChar(item.Mobile) + ",");
                sb.Append(FileHelper.FilterSpecialChar(item.Email) + ",");
                sb.Append(item.CertificateType + ",");
                sb.Append(FileHelper.FilterSpecialChar(item.CertificateNo) + ",");
                sb.Append(item.CompanyIndustry + ",");
                sb.Append(FileHelper.FilterSpecialChar(item.SalesPerson) + ",");
                sb.Append(item.SalesSource + ",");
                sb.Append(item.OutStockStatus + ",");
                sb.Append(item.MatchedDate + ",");
                sb.Append(item.OrderStatus + ",");
                sb.Append(item.EngineNo + ",");
                sb.Append(item.Vin + ",");
                sb.Append(item.Quantity + ",");
                sb.Append(item.DeleteDate + ",");
                sb.Append(item.OutStockDate + ",");
                sb.Append(FileHelper.FilterSpecialChar(item.Remark) + ",");
                sb.Append(item.Prize + ",");
                sb.Append(item.InvoiceDate + ",");
                sb.Append(item.Accessory + ",");
                sb.Append(FileHelper.FilterSpecialChar(item.Owner) + ",");
                sb.Append(FileHelper.FilterSpecialChar(item.Insured) + ",");
                sb.Append(item.InsuranceCompany + ",");
                sb.Append(item.InsuranceBillNo + ",");
                sb.Append(item.InsuranceBeginDate + ",");
                sb.Append(item.InsuranceEndDate + ",");
                sb.Append(item.PaymentType + ",");
                sb.Append(item.FinancialInstitution + ",");
                sb.Append(item.LoanType + ",");
                sb.Append(FileHelper.FilterSpecialChar(item.PaymentRemark) + ",");
                sb.Append(item.UsedCar + ",");
                sb.Append(item.LongStorage + ",");
                sb.Append(item.Club + ",");
                sb.Append(item.ThreeGuarantees + ",");
                sb.Append(item.OutSource + ",");
                sb.AppendLine();
            }
            return(FileHelper.CsvFormat(sb));
        }