예제 #1
0
        public ActionResult GetRtnStockCencusPage(RtnStockCensusShow condition)
        {
            string where = string.Empty;
            if (!string.IsNullOrWhiteSpace(condition.keyword))
            {
                where += string.Format(" and ( BigCode='{0}' or MiddleCode='{0}' or SmallCode='{0}')", Common.Filter(condition.keyword));
            }
            if (!string.IsNullOrWhiteSpace(condition.ProductNumber))
            {
                where += string.Format(" and ProducctNo='{0}'", Common.Filter(condition.ProductNumber));
            }
            if (!string.IsNullOrWhiteSpace(condition.OrderNo))
            {
                where += string.Format(" and OrderNo='{0}'", condition.OrderNo);
            }
            if (!string.IsNullOrWhiteSpace(condition.DatCreateB))
            {
                where += string.Format(" and ReturnTime >={0} ", CommonFunc.GetTimestamp(Convert.ToDateTime(condition.DatCreateB + " 00:00:00")));
            }
            if (!string.IsNullOrWhiteSpace(condition.DatCreateE))
            {
                where += string.Format(" and ReturnTime <={0} ", CommonFunc.GetTimestamp(Convert.ToDateTime(condition.DatCreateE + " 23:59:59")));
            }

            return(GetRtnStockCencusPages(condition, where));
        }
예제 #2
0
        private ActionResult GetRtnStockCencusPages(RtnStockCensusShow condition, string where)
        {
            string strForm = @"(select ReturnTime,BigCode,MiddleCode,ProductNumber,ProductName,ProductImg,COUNT(SmallCode) as SmallCount,OperaUser,PRealName,OrderNo from ( " +
                             "select (ReturnTime/86400*86400-28800) as ReturnTime,BigCode,MiddleCode,SmallCode,ProductNumber,ProductName,ProductImg,OperaUser,PRealName,OrderNo " +
                             "from ScaleRtnStoke as a left join Product as b on a.ProducctNo=b.ProductNumber left join PDAUser as d on a.OperaUser=d.PUserName " +
                             "where a.Shipper='总部' " + where + ") as def " +
                             "group by ReturnTime,BigCode,MiddleCode,ProductNumber,ProductName,ProductImg,OperaUser,PRealName,OrderNo) as RtnCountTB";

            PageJsonModel <RtnStockCensus> page = new PageJsonModel <RtnStockCensus>();

            page.pageIndex = condition.pageIndex;
            page.pageSize  = condition.pageSize;
            page.strSelect = " ReturnTime,BigCode,MiddleCode,ProductNumber,ProductName,ProductImg,OperaUser,PRealName,SmallCount,OrderNo ";
            page.strForm   = strForm;

            if (string.IsNullOrWhiteSpace(condition.orderby) == false)
            {
                page.strOrder = Common.FilteSQLStr(condition.orderby);
            }
            else
            {
                page.strOrder = "ReturnTime desc";
            }

            page.LoadList();
            if (page.pageResponse != null && page.pageResponse.RtnList != null && page.pageResponse.RtnList.Count > 0)
            {
                ScaleCodeCount OutCodeCount = RtnStockScale.GetRtnStockCount(where);
                page.pageResponse.BigCount    = OutCodeCount.BigCount;
                page.pageResponse.MiddleCount = OutCodeCount.MiddleCount;
                page.pageResponse.SmallCount  = OutCodeCount.SmallCount;

                return(Json(page.pageResponse, JsonRequestBehavior.AllowGet));
            }
            return(Json("", JsonRequestBehavior.AllowGet));
        }