Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            string redirectUrl = string.Format("{0}WareHouse/CanRepoApplyList.aspx", NFMT.Common.DefaultValue.NftmSiteName);

            if (!IsPostBack)
            {
                Utility.VerificationUtility ver = new Utility.VerificationUtility();
                ver.JudgeOperate(this.Page, 50, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.录入 });

                this.navigation1.Routes.Add("回购", string.Format("{0}WareHouse/RepoList.aspx", NFMT.Common.DefaultValue.NftmSiteName));
                this.navigation1.Routes.Add("可回购申请列表", redirectUrl);
                this.navigation1.Routes.Add("回购新增", string.Empty);

                repoApplyId = 0;
                if (string.IsNullOrEmpty(Request.QueryString["id"]) || !int.TryParse(Request.QueryString["id"], out repoApplyId) || repoApplyId <= 0)
                    Response.Redirect(redirectUrl);

                this.hidid.Value = repoApplyId.ToString();

                NFMT.WareHouse.BLL.RepoApplyBLL repoApplyBLL = new NFMT.WareHouse.BLL.RepoApplyBLL();
                NFMT.Common.ResultModel result = repoApplyBLL.GetPledgeStockId(user, repoApplyId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                this.hidsids.Value = result.ReturnValue != null ? result.ReturnValue.ToString() : "";
            }
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            if (!IsPostBack)
            {
                Utility.VerificationUtility ver = new Utility.VerificationUtility();
                ver.JudgeOperate(this.Page, 49, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.修改 });

                this.navigation1.Routes.Add("回购申请", redirectURL);
                this.navigation1.Routes.Add("回购申请修改", string.Empty);

                if (string.IsNullOrEmpty(Request.QueryString["id"]))
                    Response.Redirect(redirectURL);

                repoApplyId = 0;
                if (!int.TryParse(Request.QueryString["id"], out repoApplyId))
                    Response.Redirect(redirectURL);

                this.hidrepoApplyId.Value = repoApplyId.ToString();

                NFMT.WareHouse.BLL.RepoApplyDetailBLL repoApplyDetailBLL = new NFMT.WareHouse.BLL.RepoApplyDetailBLL();
                NFMT.Common.ResultModel result = repoApplyDetailBLL.Load(user, repoApplyId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectURL);

                List<NFMT.WareHouse.Model.RepoApplyDetail> details = result.ReturnValue as List<NFMT.WareHouse.Model.RepoApplyDetail>;
                if(details== null)
                    Response.Redirect(redirectURL);

                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                foreach (NFMT.WareHouse.Model.RepoApplyDetail detail in details)
                {
                    sb.Append(detail.StockId);
                    if (details.IndexOf(detail) < details.Count - 1)
                        sb.Append(",");
                }
                this.hidsids.Value = sb.ToString();

                NFMT.WareHouse.BLL.RepoApplyBLL repoApplyBLL = new NFMT.WareHouse.BLL.RepoApplyBLL();
                result = repoApplyBLL.Get(user, repoApplyId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectURL);

                NFMT.WareHouse.Model.RepoApply repoApply = result.ReturnValue as NFMT.WareHouse.Model.RepoApply;
                if (repoApply == null)
                    Response.Redirect(redirectURL);

                NFMT.Operate.BLL.ApplyBLL applyBLL = new NFMT.Operate.BLL.ApplyBLL();
                result = applyBLL.Get(user, repoApply.ApplyId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectURL);

                apply = result.ReturnValue as NFMT.Operate.Model.Apply;

                this.hidDeptId.Value = apply.ApplyDept.ToString();
                this.txbMemo.Value = apply.ApplyDesc;

            }
        }
        public void ProcessRequest(HttpContext context)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            int pageIndex = 1, pageSize = 10;
            string orderStr = string.Empty, whereStr = string.Empty;

            int applyDept = 0;
            if (!string.IsNullOrEmpty(context.Request.QueryString["a"]))
            {
                if (!int.TryParse(context.Request.QueryString["a"], out applyDept))
                    applyDept = 0;
            }

            DateTime fromDate = NFMT.Common.DefaultValue.DefaultTime;
            if (!string.IsNullOrEmpty(context.Request.QueryString["f"]))
            {
                if (!DateTime.TryParse(context.Request.QueryString["f"], out fromDate))
                    fromDate = NFMT.Common.DefaultValue.DefaultTime;
            }

            DateTime toDate = NFMT.Common.DefaultValue.DefaultTime;
            if (!string.IsNullOrEmpty(context.Request.QueryString["t"]))
            {
                if (!DateTime.TryParse(context.Request.QueryString["t"], out toDate))
                    toDate = NFMT.Common.DefaultValue.DefaultTime;
            }

            if (!string.IsNullOrEmpty(context.Request.QueryString["pagenum"]))
                int.TryParse(context.Request.QueryString["pagenum"], out pageIndex);
            pageIndex++;
            if (!string.IsNullOrEmpty(context.Request.QueryString["pagesize"]))
                int.TryParse(context.Request.QueryString["pagesize"], out pageSize);

            if (!string.IsNullOrEmpty(context.Request.QueryString["sortdatafield"]) && !string.IsNullOrEmpty(context.Request.QueryString["sortorder"]))
                orderStr = string.Format("{0} {1}", context.Request.QueryString["sortdatafield"].Trim(), context.Request.QueryString["sortorder"].Trim());

            NFMT.WareHouse.BLL.RepoApplyBLL bll = new NFMT.WareHouse.BLL.RepoApplyBLL();
            NFMT.Common.SelectModel select = bll.GetCanRepoApplySelectModel(pageIndex, pageSize, orderStr, applyDept, fromDate, toDate);
            NFMT.Common.ResultModel result = bll.Load(user, select);

            context.Response.ContentType = "application/json; charset=utf-8";
            if (result.ResultStatus != 0)
            {
                context.Response.Write(result.Message);
                context.Response.End();
            }

            System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable;
            System.Collections.Generic.Dictionary<string, object> dic = new System.Collections.Generic.Dictionary<string, object>();

            dic.Add("count", result.AffectCount);
            dic.Add("data", dt);

            string postData = Newtonsoft.Json.JsonConvert.SerializeObject(dic);

            context.Response.Write(postData);
        }
        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();
            }

            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.ApplyType = NFMT.Operate.ApplyType.RepoApply;
                apply.EmpId = user.EmpId;
                apply.ApplyTime = DateTime.Now;

                NFMT.WareHouse.BLL.RepoApplyBLL bll = new NFMT.WareHouse.BLL.RepoApplyBLL();
                result = bll.RepoApplyCreateHandle(user, apply, new NFMT.WareHouse.Model.RepoApply(), 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)
        {
            context.Response.ContentType = "text/plain";
            NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();

            int repoApplyId = 0;
            int operateId = 0;

            if (!int.TryParse(context.Request.Form["ri"], out repoApplyId) || repoApplyId <= 0)
            {
                result.Message = "出库申请序号错误";
                context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
                context.Response.End();
            }

            if (!int.TryParse(context.Request.Form["oi"], out operateId) || operateId <= 0)
            {
                result.Message = "操作错误";
                context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
                context.Response.End();
            }

            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            NFMT.Common.OperateEnum operateEnum = (NFMT.Common.OperateEnum)operateId;

            NFMT.WareHouse.BLL.RepoApplyBLL bll = new NFMT.WareHouse.BLL.RepoApplyBLL();

            switch (operateEnum)
            {
                case NFMT.Common.OperateEnum.撤返:
                    result = bll.Goback(user, repoApplyId);
                    break;
                case NFMT.Common.OperateEnum.作废:
                    result = bll.Invalid(user, repoApplyId);
                    break;
                case NFMT.Common.OperateEnum.确认完成:
                    result = bll.Confirm(user, repoApplyId);
                    break;
                case NFMT.Common.OperateEnum.确认完成撤销:
                    result = bll.ConfirmCancel(user, repoApplyId);
                    break;
            }

            if (result.ResultStatus == 0)
                result.Message = string.Format("{0}成功", operateEnum.ToString());

            context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
        }
        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();

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

            NFMT.WareHouse.BLL.RepoApplyBLL repoApplyBLL = new NFMT.WareHouse.BLL.RepoApplyBLL();
            result = repoApplyBLL.RepoApplyInvalid(user, repoApplyId);

            context.Response.Write(result.Message);
        }
        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();
                }
            }

            NFMT.Operate.Model.Apply apply = new NFMT.Operate.Model.Apply()
            {
                EmpId = user.EmpId,
                ApplyDesc = memo,
                ApplyDept = deptId,
                ApplyTime = DateTime.Now,
                ApplyType = NFMT.Operate.ApplyType.回购申请
            };

            List<NFMT.WareHouse.Model.RepoApplyDetail> details = new List<NFMT.WareHouse.Model.RepoApplyDetail>();

            string[] splitItem = sids.Split(',');
            for (int i = 0; i < splitItem.Length; i++)
            {
                NFMT.WareHouse.Model.RepoApplyDetail detail = new NFMT.WareHouse.Model.RepoApplyDetail()
                {
                    StockId = Convert.ToInt32(splitItem[i])
                };
                details.Add(detail);
            }

            NFMT.WareHouse.BLL.RepoApplyBLL bll = new NFMT.WareHouse.BLL.RepoApplyBLL();
            var result = bll.RepoApplyCreateHandle(user, apply, new NFMT.WareHouse.Model.RepoApply(), details);

            context.Response.Write(result.Message);
        }
        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);
        }
Exemple #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
            string redirectURL = string.Format("{0}WareHouse/RepoApplyList.aspx", NFMT.Common.DefaultValue.NftmSiteName);

            if (!IsPostBack)
            {
                Utility.VerificationUtility ver = new Utility.VerificationUtility();
                ver.JudgeOperate(this.Page, 49, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.提交审核, NFMT.Common.OperateEnum.作废, NFMT.Common.OperateEnum.撤返, NFMT.Common.OperateEnum.确认完成, NFMT.Common.OperateEnum.确认完成撤销 });

                NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

                this.navigation1.Routes.Add("回购申请", redirectURL);
                this.navigation1.Routes.Add("回购申请明细", string.Empty);

                int aid = 0;
                if (!string.IsNullOrEmpty(Request.QueryString["aid"]))
                    int.TryParse(Request.QueryString["aid"], out aid);

                int id = 0;
                if (aid <= 0)
                {
                    if (string.IsNullOrEmpty(Request.QueryString["id"]))
                        Response.Redirect(redirectURL);
                    if (!int.TryParse(Request.QueryString["id"], out id))
                        Response.Redirect(redirectURL);
                }

                NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();

                NFMT.WareHouse.BLL.RepoApplyBLL repoApplyBLL = new NFMT.WareHouse.BLL.RepoApplyBLL();
                if (aid > 0)
                    result = repoApplyBLL.GetByApplyId(user, aid);
                else
                    result = repoApplyBLL.Get(user, id);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectURL);

                this.hidid.Value = id.ToString();

                NFMT.WareHouse.Model.RepoApply repoApply = result.ReturnValue as NFMT.WareHouse.Model.RepoApply;
                if (repoApply == null)
                    Response.Redirect(redirectURL);

                this.repoId = repoApply.RepoApplyId;

                NFMT.WareHouse.BLL.RepoApplyDetailBLL repoApplyDetailBLL = new NFMT.WareHouse.BLL.RepoApplyDetailBLL();
                result = repoApplyDetailBLL.Load(user, repoApply.RepoApplyId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectURL);

                List<NFMT.WareHouse.Model.RepoApplyDetail> details = result.ReturnValue as List<NFMT.WareHouse.Model.RepoApplyDetail>;
                if (details == null)
                    Response.Redirect(redirectURL);

                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                foreach (NFMT.WareHouse.Model.RepoApplyDetail detail in details)
                {
                    sb.Append(detail.StockId);
                    if (details.IndexOf(detail) < details.Count - 1)
                        sb.Append(",");
                }
                this.stockIds = sb.ToString();

                NFMT.Operate.BLL.ApplyBLL applyBLL = new NFMT.Operate.BLL.ApplyBLL();
                result = applyBLL.Get(user, repoApply.ApplyId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectURL);

                apply = result.ReturnValue as NFMT.Operate.Model.Apply;
                if (apply == null)
                    Response.Redirect(redirectURL);

                NFMT.User.Model.Department dept = NFMT.User.UserProvider.Departments.SingleOrDefault(a => a.DeptId == apply.ApplyDept);
                if (dept == null)
                    Response.Redirect(redirectURL);

                NFMT.User.Model.Corporation corp = NFMT.User.UserProvider.Corporations.SingleOrDefault(a => a.CorpId == apply.ApplyCorp);
                if (corp == null)
                    Response.Redirect(redirectURL);

                this.txbApplyDept.InnerText = dept.DeptName;
                this.txbApplyCorp.InnerText = corp.CorpName;
                this.txbMemo.InnerText = apply.ApplyDesc;

                string json = serializer.Serialize(apply);
                this.hidmodel.Value = json;
            }
        }