예제 #1
0
        public ActionResult SearchBills(string billType, int pageIndex, int pageSize, string timestart, string timeend, string BillState, string DepartmentId, int?WarehouseId, string BillCode, string LBBillCode)
        {
            int totalCount = 0; //总记录数

            switch (billType)
            {
            case "TransferBill":
                Expression <Func <TransferBill, bool> > exp1 = TransferBillSearchCondition(timestart, timeend, BillState, DepartmentId, WarehouseId, BillCode, LBBillCode);
                List <TransferBill> res1 = TransferBillService.LoadPageEntities(exp1.Expand(), a => a.BillCode, pageIndex, pageSize, false, out totalCount).ToList();
                return(Json(new
                {
                    data = res1,
                    totalCount = totalCount
                }));

            case "BackInput":
                Expression <Func <BackInput, bool> > exp2 = BackInputSearchCondition(timestart, timeend, BillState, DepartmentId, WarehouseId, BillCode, LBBillCode);
                List <BackInput> res2 = BackInputService.LoadPageEntities(exp2.Expand(), a => a.BillCode, pageIndex, pageSize, false, out totalCount).ToList();
                return(Json(new
                {
                    data = res2,
                    totalCount = totalCount
                }));

            case "GiveBill":
            case "GiveBackBill":
                Expression <Func <GiveBill, bool> > exp3 = GiveBillSearchCondition(timestart, timeend, BillState, DepartmentId, WarehouseId, BillCode, LBBillCode);
                List <GiveBill> res3 = GiveBillService.LoadPageEntities(exp3.Expand(), a => a.BillCode, pageIndex, pageSize, false, out totalCount).ToList();
                return(Json(new
                {
                    data = res3,
                    totalCount = totalCount
                }));

            case "TaskBill":
                Expression <Func <TaskBill, bool> > exp4 = TaskBillSearchCondition(timestart, timeend, BillState, DepartmentId, WarehouseId, BillCode);
                List <TaskBill> res4 = TaskBillService.LoadPageEntities(exp4.Expand(), a => a.BillCode, pageIndex, pageSize, false, out totalCount).ToList();
                return(Json(new
                {
                    data = res4,
                    totalCount = totalCount
                }));

            case "BackOutput":
                Expression <Func <BackOutput, bool> > exp5 = BackOutputSearchCondition(timestart, timeend, BillState, DepartmentId, WarehouseId, BillCode, LBBillCode);
                List <BackOutput> res5 = BackOutputService.LoadPageEntities(exp5.Expand(), a => a.BillCode, pageIndex, pageSize, false, out totalCount).ToList();
                return(Json(new
                {
                    data = res5,
                    totalCount = totalCount
                }));

            case "OtherInput":
                Expression <Func <OtherInput, bool> > exp6 = OtherInputSearchCondition(timestart, timeend, BillState, DepartmentId, WarehouseId, BillCode);
                List <OtherInput> res6 = OtherInputService.LoadPageEntities(exp6.Expand(), a => a.BillCode, pageIndex, pageSize, false, out totalCount).ToList();
                return(Json(new
                {
                    data = res6,
                    totalCount = totalCount
                }));

            case "OtherOutput":
                Expression <Func <OtherOutput, bool> > exp7 = OtherOutputSearchCondition(timestart, timeend, BillState, DepartmentId, WarehouseId, BillCode);
                List <OtherOutput> res7 = OtherOutputService.LoadPageEntities(exp7.Expand(), a => a.BillCode, pageIndex, pageSize, false, out totalCount).ToList();
                return(Json(new
                {
                    data = res7,
                    totalCount = totalCount
                }));

            case "DIYBill":
                Expression <Func <DIYBill, bool> > exp8 = DIYBillSearchCondition(timestart, timeend, BillState, DepartmentId, WarehouseId, BillCode);
                List <DIYBill> res8 = DIYBillService.LoadPageEntities(exp8.Expand(), a => a.BillCode, pageIndex, pageSize, false, out totalCount).ToList();
                return(Json(new
                {
                    data = res8,
                    totalCount = totalCount
                }));

            case "CheckBill":
                Expression <Func <CheckBill, bool> > exp9 = CheckBillSearchCondition(timestart, timeend, BillState, DepartmentId, WarehouseId, BillCode);
                List <CheckBill> res9 = CheckBillService.LoadPageEntities(exp9.Expand(), a => a.BillCode, pageIndex, pageSize, false, out totalCount).ToList();
                return(Json(new
                {
                    data = res9,
                    totalCount = totalCount
                }));

            case "LocationChange":
                Expression <Func <LocationChange, bool> > exp10 = LocationChangeSearchCondition(timestart, timeend, BillState, DepartmentId, WarehouseId, BillCode);
                List <LocationChange> res10 = LocationChangeService.LoadPageEntities(exp10.Expand(), a => a.BillCode, pageIndex, pageSize, false, out totalCount).ToList();
                return(Json(new
                {
                    data = res10,
                    totalCount = totalCount
                }));
            }
            return(Content("参数错误"));
        }