public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            string action = context.Request.Params["action"];

            try
            {
                DriveMgr.Model.User userFromCookie = DriveMgr.Common.UserHelper.GetUser(context);   //获取cookie里的用户对象
                userOperateLog          = new Model.UserOperateLog();
                userOperateLog.UserIp   = context.Request.UserHostAddress;
                userOperateLog.UserName = userFromCookie.UserId;
                switch (action)
                {
                case "search":
                    SearchEnterStoreHouseDetails(context);
                    break;

                case "searchEnterStoreHouseDetails":
                    SearchEnterDetailsByID(context);
                    break;

                case "delete":
                    DelEnterStoreHouseDetails(userFromCookie, context);
                    break;

                case "getEnterStoreHouseDT":
                    EnterStoreHouseBLL enterStoreHouseBLL = new EnterStoreHouseBLL();
                    context.Response.Write(enterStoreHouseBLL.GetEnterStoreHouseDT());
                    break;

                case "getGoodsCategoryDT":
                    GoodsCategoryBLL goodsCategoryBLL = new GoodsCategoryBLL();
                    context.Response.Write(goodsCategoryBLL.GetGoodsCategoryDT());
                    break;

                case "getGoodsDT":
                    GoodsBLL goodsBLL = new GoodsBLL();
                    context.Response.Write(goodsBLL.GetGoodsDT());
                    break;

                case "add":
                    AddEnterStoreHouseDetails(userFromCookie, context);
                    break;

                default:
                    context.Response.Write("{\"msg\":\"参数错误!\",\"success\":false}");
                    break;
                }
            }
            catch (Exception ex)
            {
                context.Response.Write("{\"msg\":\"" + DriveMgr.Common.JsonHelper.StringFilter(ex.Message) + "\",\"success\":false}");
                userOperateLog.OperateInfo = "用户功能异常";
                userOperateLog.IfSuccess   = false;
                userOperateLog.Description = DriveMgr.Common.JsonHelper.StringFilter(ex.Message);
                DriveMgr.BLL.UserOperateLog.InsertOperateInfo(userOperateLog);
            }
        }
        private void AddEnterStoreHouseDetails(DriveMgr.Model.User userFromCookie, HttpContext context)
        {
            GoodsBLL           goodsBll           = new GoodsBLL();
            EnterStoreHouseBLL enterStoreHouseBLL = new EnterStoreHouseBLL();

            string enterDetail = "[" + context.Request.Params["enterDetailStr"].Trim(',') + "]";
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            List <EnterStoreHouseDetailsModel> enterStoreHouseDetailsModelList = serializer.Deserialize <List <EnterStoreHouseDetailsModel> >(enterDetail);

            EnterStoreHouseModel enterStoreHouseAdd = new EnterStoreHouseModel();

            enterStoreHouseAdd.EnterDate    = DateTime.Now;
            enterStoreHouseAdd.HandlePerson = userFromCookie.UserId;
            enterStoreHouseAdd.CreateDate   = DateTime.Now;
            enterStoreHouseAdd.CreatePerson = userFromCookie.UserId;
            enterStoreHouseAdd.UpdatePerson = userFromCookie.UserId;
            enterStoreHouseAdd.UpdateDate   = DateTime.Now;
            enterStoreHouseAdd.DeleteMark   = false;

            int enterStoreHouseID = enterStoreHouseBLL.AddEnterStoreHouse(enterStoreHouseAdd);

            foreach (EnterStoreHouseDetailsModel model in enterStoreHouseDetailsModelList)
            {
                EnterStoreHouseDetailsModel newEnterStoreHouseDetailsModel = new EnterStoreHouseDetailsModel();
                newEnterStoreHouseDetailsModel.GoodsID           = model.GoodsID;
                newEnterStoreHouseDetailsModel.EnterQuantity     = model.EnterQuantity;
                newEnterStoreHouseDetailsModel.EnterStoreHouseID = enterStoreHouseID;
                newEnterStoreHouseDetailsModel.DeleteMark        = false;
                if (enterStoreHouseDetailsBll.AddEnterStoreHouseDetails(newEnterStoreHouseDetailsModel))    //添加入库明细
                {
                    GoodsModel goodsModel = goodsBll.GetGoodsModel(newEnterStoreHouseDetailsModel.GoodsID.Value);
                    goodsModel.RealQuantity += newEnterStoreHouseDetailsModel.EnterQuantity;
                    goodsBll.UpdateGoods(goodsModel);    //更新物品数量
                }
            }

            context.Response.Write("{\"msg\":\"入库成功!\",\"success\":true}");
        }