public ActionResult Search(int pageSize, int pageIndex)
        {
            WaferQuery query = WaferQueryUtility.GetWaferQuery(base.Request);

            if (StringHelper.isNullOrEmpty(query.OrderBy))
            {
                query.OrderBy   = "CreateDate";
                query.OrderDesc = true;
            }
            if (CurrentUserInfo.Role == UserRoles.Fab || CurrentUserInfo.Role == UserRoles.FabAdmin)
            {
                query.Osat   = CurrentUserInfo.BUName;
                query.Status = (int)WaferStatus.WaitVendor;
            }
            int           recordCount = 0;
            IList <Wafer> list        = service.GetAllWaferBy(query, pageSize, pageIndex, out recordCount);

            if (list != null && list.Count > 0)
            {
                foreach (Wafer item in list)
                {
                    item.StatusText       = WaferHelper.waferStatusDes(item.Status);
                    item.PEDisposeText    = WaferHelper.WaferSelectionDes(item.PEDispose);
                    item.QADisposeText    = WaferHelper.WaferSelectionDes(item.QADispose);
                    item.SPRDDecisionText = WaferHelper.WaferSelectionDes(item.SPRDDecision);
                    Boolean            IsTriggered = false;
                    IList <Wafer_Sbin> ListSbin    = sbinService.GetWaferSbin(item.TransformID, item.ID);
                    foreach (Wafer_Sbin sbin in ListSbin)
                    {
                        if (sbin.IsTriggered)
                        {
                            IsTriggered = true;
                        }
                    }
                    item.IsTriggered = IsTriggered;
                }
            }
            var json = JsonConvert.SerializeObject(new
            {
                currentPage = pageIndex,
                totalPages  = PagerUtility.GetPageCount(recordCount, pageSize),
                rows        = list,
            });

            base.Response.Write(json);
            return(null);
        }
        public ActionResult ExportData()
        {
            WaferQuery query       = WaferQueryUtility.GetWaferQuery(base.Request);
            int        recordCount = 0;
            string     xlsName     = string.Format("Wafer_{0}", DateTime.Now.ToString("yyyyMMdd_hhmmss"));

            if (StringHelper.isNullOrEmpty(query.OrderBy))
            {
                query.OrderBy   = "CreateDate";
                query.OrderDesc = true;
            }
            if (CurrentUserInfo.Role == UserRoles.Fab || CurrentUserInfo.Role == UserRoles.FabAdmin)
            {
                query.Osat   = CurrentUserInfo.BUName;
                query.Status = (int)WaferStatus.WaitVendor;
            }
            IList <Wafer> list = service.GetAllWaferBy(query, 0xf423f, 0, out recordCount);

            if (list != null && list.Count > 0)
            {
                foreach (Wafer item in list)
                {
                    item.StatusText       = WaferHelper.waferStatusDes(item.Status);
                    item.PEDisposeText    = WaferHelper.WaferSelectionDes(item.PEDispose);
                    item.QADisposeText    = WaferHelper.WaferSelectionDes(item.QADispose);
                    item.SPRDDecisionText = WaferHelper.WaferSelectionDes(item.SPRDDecision);
                }
            }
            string path = "/Export/Excels/Wafer/";
            string mp   = Server.MapPath("~") + path;

            if (!Directory.Exists(mp))
            {
                Directory.CreateDirectory(mp);
            }
            string        nextUrl     = Exporthelper.GetExport <Wafer>("LOTS", list, "/Export/Excels/Wafer/", "/Content/Exports/ExportWafer.xml", xlsName, 0, 0);
            ResponseTypes redirect    = ResponseTypes.Redirect;
            TipTypes      information = TipTypes.Information;

            base.Response.Write(new HandlerResponse("0", "导出Excel文件", redirect.ToString(), information.ToString(), nextUrl, "", "").GenerateJsonResponse());
            return(null);
        }