public void ProcessRequest(HttpContext context) { NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser; int pageIndex = 1, pageSize = 10; string orderStr = string.Empty, whereStr = string.Empty; string sids = context.Request.QueryString["sids"]; string refNo = context.Request.QueryString["refNo"]; int corpId = 0; if (string.IsNullOrEmpty(context.Request.QueryString["corpId"]) || !int.TryParse(context.Request.QueryString["corpId"], out corpId) || corpId <= 0) corpId = 0; int assetId = 0; if (string.IsNullOrEmpty(context.Request.QueryString["assetId"]) || !int.TryParse(context.Request.QueryString["assetId"], out assetId) || assetId <= 0) assetId = 0; int unitId = 0; if (string.IsNullOrEmpty(context.Request.QueryString["unitId"]) || !int.TryParse(context.Request.QueryString["unitId"], out unitId) || unitId <= 0) unitId = 0; 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.CustomsClearanceApplyBLL bll = new NFMT.WareHouse.BLL.CustomsClearanceApplyBLL(); NFMT.Common.SelectModel select = bll.GetCanCustomStockListSelect(pageIndex, pageSize, orderStr, refNo, corpId, assetId,unitId, sids); 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) { NFMT.Common.ResultModel result = new NFMT.Common.ResultModel(); context.Response.ContentType = "text/plain"; int pledgeApplyId = 0; int operateId = 0; if (!int.TryParse(context.Request.Form["id"], out pledgeApplyId) || pledgeApplyId <= 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.CustomsClearanceApplyBLL bll = new NFMT.WareHouse.BLL.CustomsClearanceApplyBLL(); switch (operateEnum) { case NFMT.Common.OperateEnum.撤返: result = bll.Goback(user, pledgeApplyId); break; case NFMT.Common.OperateEnum.作废: result = bll.Invalid(user, pledgeApplyId); break; case NFMT.Common.OperateEnum.确认完成: result = bll.Confirm(user, pledgeApplyId); break; case NFMT.Common.OperateEnum.确认完成撤销: result = bll.ConfirmCancel(user, pledgeApplyId); break; } if (result.ResultStatus == 0) result.Message = string.Format("{0}成功", operateEnum.ToString()); context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result)); }
protected void Page_Load(object sender, EventArgs e) { string redirectURL = string.Format("{0}WareHouse/CustomsClearanceApplyList.aspx", NFMT.Common.DefaultValue.NftmSiteName); NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser; NFMT.Common.ResultModel result = new NFMT.Common.ResultModel(); if (!IsPostBack) { Utility.VerificationUtility ver = new Utility.VerificationUtility(); ver.JudgeOperate(this.Page, 95, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.修改 }); this.navigation1.Routes.Add("报关申请", redirectURL); this.navigation1.Routes.Add("报关申请修改", string.Empty); int customsApplyId = 0; if (string.IsNullOrEmpty(Request.QueryString["id"]) || !int.TryParse(Request.QueryString["id"], out customsApplyId)) Response.Redirect(redirectURL); NFMT.WareHouse.BLL.CustomsClearanceApplyBLL customsClearanceApplyBLL = new NFMT.WareHouse.BLL.CustomsClearanceApplyBLL(); result = customsClearanceApplyBLL.Get(user, customsApplyId); if (result.ResultStatus != 0) Response.Redirect(redirectURL); customsClearanceApply = result.ReturnValue as NFMT.WareHouse.Model.CustomsClearanceApply; if (customsClearanceApply == null) Response.Redirect(redirectURL); NFMT.Operate.BLL.ApplyBLL applyBLL =new NFMT.Operate.BLL.ApplyBLL(); result = applyBLL.Get(user, customsClearanceApply.ApplyId); if (result.ResultStatus != 0) Response.Redirect(redirectURL); apply = result.ReturnValue as NFMT.Operate.Model.Apply; if (apply == null) Response.Redirect(redirectURL); NFMT.WareHouse.BLL.CustomsApplyDetailBLL customsApplyDetailBLL = new NFMT.WareHouse.BLL.CustomsApplyDetailBLL(); result = customsApplyDetailBLL.GetStockIdById(user, customsApplyId); if (result.ResultStatus != 0) Response.Redirect(redirectURL); this.hidsids.Value = result.ReturnValue.ToString(); //attach this.attach1.BusinessIdValue = this.customsClearanceApply.ApplyId; } }
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 applyStr = context.Request.Form["apply"]; if (string.IsNullOrEmpty(applyStr)) { context.Response.Write("申请内容不能为空"); context.Response.End(); } string customApplyStr = context.Request.Form["customApply"]; if (string.IsNullOrEmpty(customApplyStr)) { context.Response.Write("报关申请内容不能为空"); context.Response.End(); } string rowsStr = context.Request.Form["rows"]; if (string.IsNullOrEmpty(rowsStr)) { context.Response.Write("明细内容不能为空"); context.Response.End(); } try { System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer(); NFMT.Operate.Model.Apply apply = serializer.Deserialize<NFMT.Operate.Model.Apply>(applyStr); NFMT.WareHouse.Model.CustomsClearanceApply customsClearanceApply = serializer.Deserialize<NFMT.WareHouse.Model.CustomsClearanceApply>(customApplyStr); List<CustomsApplyDetail> details = serializer.Deserialize<List<CustomsApplyDetail>>(rowsStr); if (apply == null || customsClearanceApply == null || details == null) { context.Response.Write("数据错误"); context.Response.End(); } apply.ApplyType = NFMT.Operate.ApplyType.CustomApply; apply.EmpId = user.EmpId; apply.ApplyTime = DateTime.Now; decimal GrossWeight = 0; decimal NetWeight = 0; List<NFMT.WareHouse.Model.CustomsApplyDetail> customsApplyDetails = new List<NFMT.WareHouse.Model.CustomsApplyDetail>(); foreach (CustomsApplyDetail detail in details) { customsApplyDetails.Add(new NFMT.WareHouse.Model.CustomsApplyDetail() { StockId = detail.StockId, GrossWeight = detail.CurGrossAmount, NetWeight = detail.CurNetAmount, CustomsPrice = customsClearanceApply.CustomsPrice, DetailStatus = NFMT.Common.StatusEnum.已生效 }); GrossWeight += detail.CurGrossAmount; NetWeight += detail.CurNetAmount; } customsClearanceApply.GrossWeight = GrossWeight; customsClearanceApply.NetWeight = NetWeight; NFMT.WareHouse.BLL.CustomsClearanceApplyBLL bll = new NFMT.WareHouse.BLL.CustomsClearanceApplyBLL(); result = bll.Create(user, apply, customsClearanceApply, customsApplyDetails); 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; int pageIndex = 1, pageSize = 10; string orderStr = string.Empty, whereStr = string.Empty; int applyPerson = 0; if (!string.IsNullOrEmpty(context.Request.QueryString["a"])) { if (!int.TryParse(context.Request.QueryString["a"], out applyPerson)) applyPerson = 0; } int status = 0; if (!string.IsNullOrEmpty(context.Request.QueryString["s"])) { if (!int.TryParse(context.Request.QueryString["s"], out status)) status = 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; } int corpId = 0; if (!string.IsNullOrEmpty(context.Request.QueryString["c"])) { if (!int.TryParse(context.Request.QueryString["c"], out corpId)) corpId = 0; } int assetId = 0; if (!string.IsNullOrEmpty(context.Request.QueryString["ass"])) { if (!int.TryParse(context.Request.QueryString["ass"], out assetId)) assetId = 0; } 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.CustomsClearanceApplyBLL bll = new NFMT.WareHouse.BLL.CustomsClearanceApplyBLL(); NFMT.Common.SelectModel select = bll.GetSelectModel(pageIndex, pageSize, orderStr, applyPerson, status, fromDate, toDate,corpId,assetId); 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); }