Beispiel #1
0
        public ActionResult QueryScanData(AdidasScanDataViewModel ASDViewModel, int?PageIndex, string Action)
        {
            ///by tim 2015.12.16 增加判断,若角色为“承运商扫描数据查询”,则默认给指定承运商查询
            if (UserInfo.ProjectRoleID == 50)
            {
                ASDViewModel.SearchCondition.Shipper = "ShipperID:" + UserInfo.CustomerOrShipperID.ToString(); //关键字标识,表示筛选的条件为承运商ID
            }
            var response = new AdidasService().GetQueryScanDatas(new QuerySearchConditionRequest
            {
                SearchCondition = ASDViewModel.SearchCondition,
                PageIndex       = PageIndex ?? 0,
                PageSize        = UtilConstants.PAGESIZE ///每页的数据
            });



            if (response.IsSuccess)
            {
                ASDViewModel.ScanInfoCollection = response.Result.ScanDataCollection;
                ASDViewModel.PageCount          = response.Result.PageCount / UtilConstants.PAGESIZE + ((response.Result.PageCount % UtilConstants.PAGESIZE) == 0 ? 0 : 1);;
                ASDViewModel.PageIndex          = response.Result.PageIndex;
            }

            if (response.IsSuccess && Action == "导出")
            {
                DataTable dt = new DataTable();
                dt = EnumerableExtension.ToDataTable <ScanInfo>(ASDViewModel.ScanInfoCollection.ToList());        //List转化为Datatable

                ///对查询出来的列进行处理
                dt.Columns.Remove("ID");
                dt.Columns.Remove("ShipperID");
                dt.Columns.Remove("Creater");
                dt.Columns.Remove("CreateTime");
                dt.Columns.Remove("Modifier");
                dt.Columns.Remove("ModifyTime");


                dt.Columns["CustomerOrderNumber"].ColumnName = "运单号";
                dt.Columns["BoxNumber"].ColumnName           = "运单箱数";
                dt.Columns["ScanBoxNumber"].ColumnName       = "实际扫描箱数";
                dt.Columns["TrailerNo"].ColumnName           = "拖号";
                dt.Columns["PlateNumber"].ColumnName         = "车牌号";
                dt.Columns["Shipper"].ColumnName             = "物流公司";
                dt.Columns["CloseFlag"].ColumnName           = "关闭状态(1为关闭)";
                dt.Columns["CompleteFlag"].ColumnName        = "确认完成次数(0为未完成)";
                dt.Columns["Operator"].ColumnName            = "操作人";
                dt.Columns["OperateTime"].ColumnName         = "操作时间";
                dt.Columns["Remark"].ColumnName = "备注";


                this.WriteExcel(dt, "Shipper_" + UserInfo.Name + "_" + DateTime.Now.ToString("yyyyMMdd") + ".xls");  //生成Excel
                return(new EmptyResult());
            }
            return(View(ASDViewModel));
        }
Beispiel #2
0
        public ActionResult Index(QueryContractViewModel vm, int?PageIndex, string Action)
        {
            BindDropDownList(ref vm);   //重新绑定下拉


            ///合同的查询功能
            ///定义表数据,作为参数传给存储过程
            GetContractByConditionRequest request = new GetContractByConditionRequest();

            request.PageIndex       = PageIndex ?? 0;
            request.SearchType1     = vm.SearchType1 ?? 0;    //合同类型
            request.SearchType2     = vm.SearchType2 ?? 0;    //保单类型
            request.PageSize        = UtilConstants.PAGESIZE; //页数量
            request.SearchCondition = vm.SearchCondition;
            var response = new ContractService().GetContractByCondition(request);

            vm.ContractCollection = response.Result.ContractCollection;
            vm.PageCount          = response.Result.PageCount / UtilConstants.PAGESIZE + ((response.Result.PageCount % UtilConstants.PAGESIZE) == 0 ? 0 : 1);
            vm.PageIndex          = response.Result.PageIndex;


            if (response.IsSuccess && Action == "导出")
            {
                DataTable dt = new DataTable();
                dt = EnumerableExtension.ToDataTable <Contract>(response.Result.ContractCollection.ToList());             //List转化为Datatable

                ///对查询出来的列进行处理
                dt.Columns.Remove("ID");
                dt.Columns.Remove("CompanyCode");
                dt.Columns.Remove("BusinessCode");
                dt.Columns.Remove("DepartmentCode");
                dt.Columns.Remove("ContractTypeCode");
                dt.Columns.Remove("AttachmentGroupID");
                dt.Columns.Remove("IsPolExpired");
                dt.Columns.Remove("IsContractExpired");
                dt.Columns.Remove("Creator");
                dt.Columns.Remove("CreateTime");
                dt.Columns.Remove("Updator");
                dt.Columns.Remove("UpdateTime");


                dt.Columns["CompanyName"].ColumnName         = "公司名称";
                dt.Columns["BusinessName"].ColumnName        = "业务大类";
                dt.Columns["DepartmentName"].ColumnName      = "部门名称";
                dt.Columns["ContractTypeName"].ColumnName    = "合同种类";
                dt.Columns["ContractStartDate"].ColumnName   = "合同起始日期";
                dt.Columns["ContractNumber"].ColumnName      = "合同编号";
                dt.Columns["ContractContent"].ColumnName     = "合同内容";
                dt.Columns["BusinessPartnerName"].ColumnName = "业务对方名称";
                dt.Columns["IsContractExtension"].ColumnName = "是否顺延";
                dt.Columns["ContractExpireDate"].ColumnName  = "实际到期日期";
                dt.Columns["StampTax"].ColumnName            = "是否含印花税";
                dt.Columns["OldContractNumber"].ColumnName   = "老合同编号";
                dt.Columns["PolStartDate"].ColumnName        = "保单起始日期";
                dt.Columns["PolEndDate"].ColumnName          = "保单到期日期";
                dt.Columns["Remark"].ColumnName = "备注";
                dt.Columns["QualificationCertificate"].ColumnName = "证书";



                this.WriteExcel(dt, "Contract_" + UserInfo.Name + "_" + DateTime.Now.ToString("yyyyMMdd") + ".xls");  //生成Excel
                return(new EmptyResult());
            }
            return(View(vm));
        }