Exemplo n.º 1
0
        public ActionResult OverdueExport()
        {
            int userid = (int)Session["user_id"];
            var period = Request["period"] ?? "";

            if (string.IsNullOrEmpty(period))
            {
                period = "0";
            }
            var tempData = ob_base_shangpinzczservice.LoadEntities(p => p.IsDelete == false && p.ZhucezhengYXQ <= DateTime.Now.AddDays(int.Parse(period)));

            ViewBag.base_shangpinzcz = tempData;
            ViewData.Model           = tempData;
            string viewHtml = ExportNow.RenderPartialViewToString(this, "OverdueExport");

            return(File(System.Text.Encoding.UTF8.GetBytes(viewHtml), "application/ms-excel", string.Format("RegistOverdue_{0}.xls", DateTime.Now.ToShortDateString())));
        }
Exemplo n.º 2
0
        public ActionResult inHistoryExport()
        {
            int    userid  = (int)Session["user_id"];
            string pagetag = "cfda_inhistory_index";

            Expression <Func <cfda_inhistory, bool> > where = PredicateExtensionses.True <cfda_inhistory>();
            searchcondition sc = searchconditionService.GetInstance().GetEntityById(searchcondition => searchcondition.UserID == userid && searchcondition.PageBrief == pagetag);

            if (sc != null && sc.ConditionInfo != null)
            {
                string[] sclist = sc.ConditionInfo.Split(';');
                foreach (string scl in sclist)
                {
                    string[] scld = scl.Split(',');
                    switch (scld[0])
                    {
                    case "CPMC":
                        string CPMC      = scld[1];
                        string CPMCequal = scld[2];
                        string CPMCand   = scld[3];
                        if (!string.IsNullOrEmpty(CPMC))
                        {
                            if (CPMCequal.Equals("="))
                            {
                                if (CPMCand.Equals("and"))
                                {
                                    where = where.And(p => p.CPMC == CPMC.Trim());
                                }
                                else
                                {
                                    where = where.Or(p => p.CPMC == CPMC.Trim());
                                }
                            }
                            if (CPMCequal.Equals("like"))
                            {
                                if (CPMCand.Equals("and"))
                                {
                                    where = where.And(p => p.CPMC.Contains(CPMC.Trim()));
                                }
                                else
                                {
                                    where = where.Or(p => p.CPMC.Contains(CPMC.Trim()));
                                }
                            }
                        }
                        break;

                    case "GGXH":
                        string GGXH      = scld[1];
                        string GGXHequal = scld[2];
                        string GGXHand   = scld[3];
                        if (!string.IsNullOrEmpty(GGXH))
                        {
                            if (GGXHequal.Equals("="))
                            {
                                if (GGXHand.Equals("and"))
                                {
                                    where = where.And(p => p.GGXH == GGXH.Trim());
                                }
                                else
                                {
                                    where = where.Or(p => p.GGXH == GGXH.Trim());
                                }
                            }
                            if (GGXHequal.Equals("like"))
                            {
                                if (GGXHand.Equals("and"))
                                {
                                    where = where.And(p => p.GGXH.Contains(GGXH.Trim()));
                                }
                                else
                                {
                                    where = where.Or(p => p.GGXH.Contains(GGXH.Trim()));
                                }
                            }
                        }
                        break;

                    case "SCPH":
                        string SCPH      = scld[1];
                        string SCPHequal = scld[2];
                        string SCPHand   = scld[3];
                        if (!string.IsNullOrEmpty(SCPH))
                        {
                            if (SCPHequal.Equals("="))
                            {
                                if (SCPHand.Equals("and"))
                                {
                                    where = where.And(p => p.SCPH == SCPH.Trim());
                                }
                                else
                                {
                                    where = where.Or(p => p.SCPH == SCPH.Trim());
                                }
                            }
                            if (SCPHequal.Equals("like"))
                            {
                                if (SCPHand.Equals("and"))
                                {
                                    where = where.And(p => p.SCPH.Contains(SCPH.Trim()));
                                }
                                else
                                {
                                    where = where.Or(p => p.SCPH.Contains(SCPH.Trim()));
                                }
                            }
                        }
                        break;

                    default:
                        break;
                    }
                }
                ViewBag.SearchCondition = sc.ConditionInfo;
            }

            where = where.And(cfda_inhistory => cfda_inhistory.IsDelete == false);

            var tempData = ob_cfda_inhistoryservice.LoadSortEntities(where.Compile(), false, cfda_inhistory => cfda_inhistory.ID);

            ViewBag.cfda_inhistory = tempData;
            ViewData.Model         = tempData;
            string viewHtml = ExportNow.RenderPartialViewToString(this, "inHistoryExport");

            return(File(System.Text.Encoding.UTF8.GetBytes(viewHtml), "application/ms-excel", string.Format("inHistoryExport_{0}.xls", DateTime.Now.ToShortDateString())));
        }
        public ActionResult SupplierExport()
        {
            int    userid  = (int)Session["user_id"];
            string pagetag = "base_gongyingshang_index";

            Expression <Func <base_gongyingshang, bool> > where = PredicateExtensionses.True <base_gongyingshang>();
            searchcondition sc = searchconditionService.GetInstance().GetEntityById(searchcondition => searchcondition.UserID == userid && searchcondition.PageBrief == pagetag);

            if (sc != null)
            {
                string[] sclist = sc.ConditionInfo.Split(';');
                foreach (string scl in sclist)
                {
                    string[] scld = scl.Split(',');
                    switch (scld[0])
                    {
                    case "daima":
                        string daima      = scld[1];
                        string daimaequal = scld[2];
                        string daimaand   = scld[3];
                        if (!string.IsNullOrEmpty(daima))
                        {
                            if (daimaequal.Equals("="))
                            {
                                if (daimaand.Equals("and"))
                                {
                                    where = where.And(base_gongyingshang => base_gongyingshang.Daima == daima);
                                }
                                else
                                {
                                    where = where.Or(base_gongyingshang => base_gongyingshang.Daima == daima);
                                }
                            }
                            if (daimaequal.Equals("like"))
                            {
                                if (daimaand.Equals("and"))
                                {
                                    where = where.And(base_gongyingshang => base_gongyingshang.Daima.Contains(daima));
                                }
                                else
                                {
                                    where = where.Or(base_gongyingshang => base_gongyingshang.Daima.Contains(daima));
                                }
                            }
                        }
                        break;

                    case "mingcheng":
                        string mingcheng      = scld[1];
                        string mingchengequal = scld[2];
                        string mingchengand   = scld[3];
                        if (!string.IsNullOrEmpty(mingcheng))
                        {
                            if (mingchengequal.Equals("="))
                            {
                                if (mingchengand.Equals("and"))
                                {
                                    where = where.And(base_gongyingshang => base_gongyingshang.Mingcheng == mingcheng);
                                }
                                else
                                {
                                    where = where.Or(base_gongyingshang => base_gongyingshang.Mingcheng == mingcheng);
                                }
                            }
                            if (mingchengequal.Equals("like"))
                            {
                                if (mingchengand.Equals("and"))
                                {
                                    where = where.And(base_gongyingshang => base_gongyingshang.Mingcheng.Contains(mingcheng));
                                }
                                else
                                {
                                    where = where.Or(base_gongyingshang => base_gongyingshang.Mingcheng.Contains(mingcheng));
                                }
                            }
                        }
                        break;

                    default:
                        break;
                    }
                }
                ViewBag.SearchCondition = sc.ConditionInfo;
            }

            where = where.And(base_gongyingshang => base_gongyingshang.IsDelete == false);
            var tempData = ob_base_gongyingshangservice.LoadSortEntities(where.Compile(), false, base_gongyingshang => base_gongyingshang.ID);

            ViewBag.supplier = tempData;
            ViewData.Model   = tempData;
            string viewHtml = ExportNow.RenderPartialViewToString(this, "SupplierExport");

            return(File(System.Text.Encoding.UTF8.GetBytes(viewHtml), "application/ms-excel", string.Format("SupplierInformation_{0}.xls", DateTime.Now.ToShortDateString())));
        }
Exemplo n.º 4
0
        public ActionResult outReportExport()
        {
            int    userid  = (int)Session["user_id"];
            string pagetag = "wms_outreport_list";

            Expression <Func <wms_outdetaillist_v, bool> > where = PredicateExtensionses.True <wms_outdetaillist_v>();
            searchcondition sc = searchconditionService.GetInstance().GetEntityById(searchcondition => searchcondition.UserID == userid && searchcondition.PageBrief == pagetag);

            if (sc != null && sc.ConditionInfo != null)
            {
                string[] sclist = sc.ConditionInfo.Split(';');
                foreach (string scl in sclist)
                {
                    string[] scld = scl.Split(',');
                    switch (scld[0])
                    {
                    case "chukubh":
                        string chukubh      = scld[1];
                        string chukubhequal = scld[2];
                        string chukubhand   = scld[3];
                        if (!string.IsNullOrEmpty(chukubh))
                        {
                            if (chukubhequal.Equals("="))
                            {
                                if (chukubhand.Equals("and"))
                                {
                                    where = where.And(p => p.ChukudanBH == chukubh);
                                }
                                else
                                {
                                    where = where.Or(p => p.ChukudanBH == chukubh);
                                }
                            }
                            if (chukubhequal.Equals("like"))
                            {
                                if (chukubhand.Equals("and"))
                                {
                                    where = where.And(p => p.ChukudanBH.Contains(chukubh));
                                }
                                else
                                {
                                    where = where.Or(p => p.ChukudanBH.Contains(chukubh));
                                }
                            }
                        }
                        break;

                    case "ShangpinMC":
                        string ShangpinMC      = scld[1];
                        string ShangpinMCequal = scld[2];
                        string ShangpinMCand   = scld[3];
                        if (!string.IsNullOrEmpty(ShangpinMC))
                        {
                            if (ShangpinMCequal.Equals("="))
                            {
                                if (ShangpinMCand.Equals("and"))
                                {
                                    where = where.And(p => p.ShangpinMC == ShangpinMC);
                                }
                                else
                                {
                                    where = where.Or(p => p.ShangpinMC == ShangpinMC);
                                }
                            }
                            if (ShangpinMCequal.Equals("like"))
                            {
                                if (ShangpinMCand.Equals("and"))
                                {
                                    where = where.And(p => p.ShangpinMC.Contains(ShangpinMC));
                                }
                                else
                                {
                                    where = where.Or(p => p.ShangpinMC.Contains(ShangpinMC));
                                }
                            }
                        }
                        break;

                    case "Guige":
                        string Guige      = scld[1];
                        string Guigeequal = scld[2];
                        string Guigeand   = scld[3];
                        if (!string.IsNullOrEmpty(Guige))
                        {
                            if (Guigeequal.Equals("="))
                            {
                                if (Guigeand.Equals("and"))
                                {
                                    where = where.And(p => p.Guige == Guige);
                                }
                                else
                                {
                                    where = where.Or(p => p.Guige == Guige);
                                }
                            }
                            if (Guigeequal.Equals("like"))
                            {
                                if (Guigeand.Equals("and"))
                                {
                                    where = where.And(p => p.Guige.Contains(Guige));
                                }
                                else
                                {
                                    where = where.Or(p => p.Guige.Contains(Guige));
                                }
                            }
                        }
                        break;

                    case "Pihao":
                        string Pihao      = scld[1];
                        string Pihaoequal = scld[2];
                        string Pihaoand   = scld[3];
                        if (!string.IsNullOrEmpty(Pihao))
                        {
                            if (Pihaoequal.Equals("="))
                            {
                                if (Pihaoand.Equals("and"))
                                {
                                    where = where.And(p => p.Pihao == Pihao);
                                }
                                else
                                {
                                    where = where.Or(p => p.Pihao == Pihao);
                                }
                            }
                            if (Pihaoequal.Equals("like"))
                            {
                                if (Pihaoand.Equals("and"))
                                {
                                    where = where.And(p => p.Pihao.Contains(Pihao));
                                }
                                else
                                {
                                    where = where.Or(p => p.Pihao.Contains(Pihao));
                                }
                            }
                        }
                        break;

                    case "ChukuRQ":
                        string ChukuRQ      = scld[1];
                        string ChukuRQequal = scld[2];
                        string ChukuRQand   = scld[3];
                        if (!string.IsNullOrEmpty(ChukuRQ))
                        {
                            if (ChukuRQequal.Equals("="))
                            {
                                if (ChukuRQand.Equals("and"))
                                {
                                    where = where.And(p => p.ChukuRQ == DateTime.Parse(ChukuRQ));
                                }
                                else
                                {
                                    where = where.Or(p => p.ChukuRQ == DateTime.Parse(ChukuRQ));
                                }
                            }
                            if (ChukuRQequal.Equals(">"))
                            {
                                if (ChukuRQand.Equals("and"))
                                {
                                    where = where.And(p => p.ChukuRQ > DateTime.Parse(ChukuRQ));
                                }
                                else
                                {
                                    where = where.Or(p => p.ChukuRQ > DateTime.Parse(ChukuRQ));
                                }
                            }
                            if (ChukuRQequal.Equals("<"))
                            {
                                if (ChukuRQand.Equals("and"))
                                {
                                    where = where.And(p => p.ChukuRQ < DateTime.Parse(ChukuRQ));
                                }
                                else
                                {
                                    where = where.Or(p => p.ChukuRQ < DateTime.Parse(ChukuRQ));
                                }
                            }
                        }
                        break;

                    default:
                        break;
                    }
                }
                ViewBag.SearchCondition = sc.ConditionInfo;
            }

            var tempData = ServiceFactory.wms_chukudanservice.GetOutList(where.Compile());

            ViewBag.outReport = tempData;
            ViewData.Model    = tempData;
            string viewHtml = ExportNow.RenderPartialViewToString(this, "outReportExport");

            return(File(System.Text.Encoding.UTF8.GetBytes(viewHtml), "application/ms-excel", string.Format("outReportExport_{0}.xls", DateTime.Now.ToShortDateString())));
        }
Exemplo n.º 5
0
        public ActionResult CargoExport()
        {
            int userid = (int)Session["user_id"];
            var custid = Request["customer_id"] ?? "";

            if (custid.Length == 0)
            {
                custid = "0";
            }
            string pagetag = "cfda_zizhi_cargochecklist";

            Expression <Func <cfda_cargos_v, bool> > where = PredicateExtensionses.True <cfda_cargos_v>();
            searchcondition sc = searchconditionService.GetInstance().GetEntityById(searchcondition => searchcondition.UserID == userid && searchcondition.PageBrief == pagetag);

            if (sc != null)
            {
                string[] sclist = sc.ConditionInfo.Split(';');
                foreach (string scl in sclist)
                {
                    string[] scld = scl.Split(',');
                    switch (scld[0])
                    {
                    case "Kehumingcheng":
                        string Kehumingcheng      = scld[1];
                        string Kehumingchengequal = scld[2];
                        string Kehumingchengand   = scld[3];
                        if (!string.IsNullOrEmpty(Kehumingcheng))
                        {
                            if (Kehumingchengequal.Equals("="))
                            {
                                if (Kehumingchengand.Equals("and"))
                                {
                                    where = where.And(p => p.Kehumingcheng == Kehumingcheng);
                                }
                                else
                                {
                                    where = where.Or(p => p.Kehumingcheng == Kehumingcheng);
                                }
                            }
                            if (Kehumingchengequal.Equals("like"))
                            {
                                if (Kehumingchengand.Equals("and"))
                                {
                                    where = where.And(p => p.Kehumingcheng.Contains(Kehumingcheng));
                                }
                                else
                                {
                                    where = where.Or(p => p.Kehumingcheng.Contains(Kehumingcheng));
                                }
                            }
                        }
                        break;

                    case "mingcheng":
                        string mingcheng      = scld[1];
                        string mingchengequal = scld[2];
                        string mingchengand   = scld[3];
                        if (!string.IsNullOrEmpty(mingcheng))
                        {
                            if (mingchengequal.Equals("="))
                            {
                                if (mingchengand.Equals("and"))
                                {
                                    where = where.And(p => p.Mingcheng == mingcheng);
                                }
                                else
                                {
                                    where = where.Or(p => p.Mingcheng == mingcheng);
                                }
                            }
                            if (mingchengequal.Equals("like"))
                            {
                                if (mingchengand.Equals("and"))
                                {
                                    where = where.And(p => p.Mingcheng.Contains(mingcheng));
                                }
                                else
                                {
                                    where = where.Or(p => p.Mingcheng.Contains(mingcheng));
                                }
                            }
                        }
                        break;

                    case "guige":
                        string guige      = scld[1];
                        string guigeequal = scld[2];
                        string guigeand   = scld[3];
                        if (!string.IsNullOrEmpty(guige))
                        {
                            if (guigeequal.Equals("="))
                            {
                                if (guigeand.Equals("and"))
                                {
                                    where = where.And(p => p.guige == guige);
                                }
                                else
                                {
                                    where = where.Or(p => p.guige == guige);
                                }
                            }
                            if (guigeequal.Equals("like"))
                            {
                                if (guigeand.Equals("and"))
                                {
                                    where = where.And(p => p.guige.Contains(guige));
                                }
                                else
                                {
                                    where = where.Or(p => p.guige.Contains(guige));
                                }
                            }
                        }
                        break;

                    default:
                        break;
                    }
                }
                ViewBag.SearchCondition = sc.ConditionInfo;
            }

            var tempData = ServiceFactory.base_shangpinxxservice.CFDALoadCargos(int.Parse(custid)).Where(where.Compile()).ToList <cfda_cargos_v>();

            ViewBag.cfda_cargo = tempData;
            ViewData.Model     = tempData;
            string viewHtml = ExportNow.RenderPartialViewToString(this, "CargoExport");

            return(File(System.Text.Encoding.UTF8.GetBytes(viewHtml), "application/ms-excel", string.Format("cfda_cargos_{0}.xls", DateTime.Now.ToShortDateString())));
        }