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":
                    SearchOutStoreHouseDetails(context);
                    break;

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

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

                case "getOutStoreHouseDT":
                    OutStoreHouseBLL outStoreHouseBLL = new OutStoreHouseBLL();
                    context.Response.Write(outStoreHouseBLL.GetOutStoreHouseDT());
                    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":
                    AddOutStoreHouseDetails(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 AddOutStoreHouseDetails(DriveMgr.Model.User userFromCookie, HttpContext context)
        {
            GoodsBLL         goodsBll         = new GoodsBLL();
            OutStoreHouseBLL outStoreHouseBLL = new OutStoreHouseBLL();

            string outDetailStr = "[" + context.Request.Params["outDetailStr"].Trim(',') + "]";
            JavaScriptSerializer             serializer = new JavaScriptSerializer();
            List <OutStoreHouseDetailsModel> outStoreHouseDetailsModelList = serializer.Deserialize <List <OutStoreHouseDetailsModel> >(outDetailStr);

            OutStoreHouseModel outStoreHouseAdd = new OutStoreHouseModel();

            outStoreHouseAdd.OutDate      = DateTime.Now;
            outStoreHouseAdd.HandlePerson = userFromCookie.UserId;
            outStoreHouseAdd.CreateDate   = DateTime.Now;
            outStoreHouseAdd.CreatePerson = userFromCookie.UserId;
            outStoreHouseAdd.UpdatePerson = userFromCookie.UserId;
            outStoreHouseAdd.UpdateDate   = DateTime.Now;
            outStoreHouseAdd.DeleteMark   = false;

            int outStoreHouseID = outStoreHouseBLL.AddOutStoreHouse(outStoreHouseAdd);

            foreach (OutStoreHouseDetailsModel model in outStoreHouseDetailsModelList)
            {
                OutStoreHouseDetailsModel newOutStoreHouseDetailsModel = new OutStoreHouseDetailsModel();
                newOutStoreHouseDetailsModel.GoodsID         = model.GoodsID;
                newOutStoreHouseDetailsModel.OutQuantity     = model.OutQuantity;
                newOutStoreHouseDetailsModel.OutStoreHouseID = outStoreHouseID;
                newOutStoreHouseDetailsModel.DeleteMark      = false;
                if (outStoreHouseDetailsBll.AddOutStoreHouseDetails(newOutStoreHouseDetailsModel))    //添加入库明细
                {
                    GoodsModel goodsModel = goodsBll.GetGoodsModel(newOutStoreHouseDetailsModel.GoodsID.Value);
                    goodsModel.RealQuantity -= newOutStoreHouseDetailsModel.OutQuantity;
                    goodsBll.UpdateGoods(goodsModel);    //更新物品数量
                }
            }

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