public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();

            string repoStr = context.Request.Form["repo"];
            if (string.IsNullOrEmpty(repoStr))
            {
                result.Message = "回购信息不能为空";
                result.ResultStatus = -1;
                context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
                context.Response.End();
            }

            string applyStr = context.Request.Form["apply"];
            if (string.IsNullOrEmpty(applyStr))
            {
                result.Message = "申请信息不能为空";
                result.ResultStatus = -1;
                context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
                context.Response.End();
            }

            int repoApplyId = 0;
            if (string.IsNullOrEmpty(context.Request.Form["rid"]) || !int.TryParse(context.Request.Form["rid"], out repoApplyId) || repoApplyId <= 0)
            {
                result.Message = "回购申请序号错误";
                result.ResultStatus = -1;
                context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
                context.Response.End();
            }

            try
            {
                System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                List<NFMT.WareHouse.Model.RepoApplyDetail> repoApplyDetails = serializer.Deserialize<List<NFMT.WareHouse.Model.RepoApplyDetail>>(repoStr);
                NFMT.Operate.Model.Apply apply = serializer.Deserialize<NFMT.Operate.Model.Apply>(applyStr);
                if (apply == null || repoApplyDetails == null || !repoApplyDetails.Any())
                {
                    result.Message = "数据错误";
                    result.ResultStatus = -1;
                    context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
                    context.Response.End();
                }

                apply.EmpId = user.EmpId;
                apply.ApplyTime = DateTime.Now;

                NFMT.WareHouse.BLL.RepoApplyBLL bll = new NFMT.WareHouse.BLL.RepoApplyBLL();
                result = bll.RepoApplyUpdateHandle(user, apply, repoApplyId, repoApplyDetails);
                if (result.ResultStatus == 0)
                    result.Message = "更新成功";
            }
            catch (Exception ex)
            {
                result.ResultStatus = -1;
                result.Message = ex.Message;
            }

            context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
        }
        public void ProcessRequest(HttpContext context)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            context.Response.ContentType = "text/plain";
            string resultStr = "添加失败";

            string sids = context.Request.Form["sids"];
            if (string.IsNullOrEmpty(sids))
            {
                resultStr = "请选择回购库存";
                context.Response.Write(resultStr);
                context.Response.End();
            }

            if (sids.Split(',').Length < 1)
            {
                resultStr = "请选择回购库存";
                context.Response.Write(resultStr);
                context.Response.End();
            }

            string memo = context.Request.Form["memo"];

            int deptId = 0;
            if (!string.IsNullOrEmpty(context.Request.Form["deptId"]))
            {
                if (!int.TryParse(context.Request.Form["deptId"], out deptId))
                {
                    resultStr = "部门错误";
                    context.Response.Write(resultStr);
                    context.Response.End();
                }
            }

            int repurApplyId = 0;
            if (!string.IsNullOrEmpty(context.Request.Form["aid"]))
            {
                if (!int.TryParse(context.Request.Form["aid"], out repurApplyId))
                {
                    resultStr = "参数错误";
                    context.Response.Write(resultStr);
                    context.Response.End();
                }
            }

            NFMT.WareHouse.BLL.RepoApplyBLL repoApplyBLL = new NFMT.WareHouse.BLL.RepoApplyBLL();
            NFMT.Common.ResultModel result = repoApplyBLL.Get(user, repurApplyId);
            if (result.ResultStatus != 0)
            {
                context.Response.Write(result.Message);
                context.Response.End();
            }

            NFMT.WareHouse.Model.RepoApply repoApply = result.ReturnValue as NFMT.WareHouse.Model.RepoApply;

            NFMT.Operate.BLL.ApplyBLL applyBLL = new NFMT.Operate.BLL.ApplyBLL();
            result = applyBLL.Get(user, repoApply.ApplyId);
            if (result.ResultStatus != 0)
            {
                context.Response.Write(string.Format("申请内容有误,{0}", result.Message));
                context.Response.End();
            }

            NFMT.Operate.Model.Apply apply = result.ReturnValue as NFMT.Operate.Model.Apply;
            apply.ApplyDesc = memo;
            apply.ApplyDept = deptId;

            result = applyBLL.Update(user, apply);
            if (result.ResultStatus != 0)
            {
                context.Response.Write(result.Message);
                context.Response.End();
            }

            result = repoApplyBLL.RepoApplyUpdateHandle(user, apply, new NFMT.WareHouse.Model.RepoApply() { RepoApplyId = repurApplyId }, sids);
            context.Response.Write(result.Message);
        }