public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; NFMT.Common.ResultModel result = new NFMT.Common.ResultModel(); int stockOutId = 0; int operateId = 0; if (!int.TryParse(context.Request.Form["si"], out stockOutId) || stockOutId <= 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; result = new NFMT.Common.ResultModel(); NFMT.WareHouse.BLL.StockOutBLL bll = new NFMT.WareHouse.BLL.StockOutBLL(); switch (operateEnum) { case NFMT.Common.OperateEnum.撤返: result = bll.GoBack(user, stockOutId); break; case NFMT.Common.OperateEnum.作废: result = bll.Invalid(user, stockOutId); break; case NFMT.Common.OperateEnum.执行完成: result = bll.Complete(user, stockOutId); break; case NFMT.Common.OperateEnum.执行完成撤销: result = bll.CompleteCancel(user, stockOutId); break; case NFMT.Common.OperateEnum.关闭: result = bll.Close(user, stockOutId); 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) { if (!IsPostBack) { Utility.VerificationUtility ver = new Utility.VerificationUtility(); ver.JudgeOperate(this.Page, 44, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.查询 }); user = Utility.UserUtility.CurrentUser; NFMT.Common.ResultModel result = new NFMT.Common.ResultModel(); string redirectUrl = string.Format("{0}WareHouse/StockOutList.aspx", NFMT.Common.DefaultValue.NftmSiteName); int stockOutId = 0; if (string.IsNullOrEmpty(Request.QueryString["id"]) || !int.TryParse(Request.QueryString["id"], out stockOutId) || stockOutId <= 0) this.Page.WarmAlert("参数错误", redirectUrl); //获取出库 NFMT.WareHouse.BLL.StockOutBLL stockOutBLL = new NFMT.WareHouse.BLL.StockOutBLL(); result = stockOutBLL.Get(user, stockOutId); if (result.ResultStatus != 0) this.Page.WarmAlert(result.Message, redirectUrl); stockOut = result.ReturnValue as NFMT.WareHouse.Model.StockOut; if (stockOut == null) this.Page.WarmAlert("获取出库失败", redirectUrl); //获取出库申请 NFMT.WareHouse.BLL.StockOutApplyBLL stockOutApplyBLL = new NFMT.WareHouse.BLL.StockOutApplyBLL(); result = stockOutApplyBLL.Get(user, stockOut.StockOutApplyId); if (result.ResultStatus != 0) this.Page.WarmAlert(result.Message, redirectUrl); stockOutApply = result.ReturnValue as NFMT.WareHouse.Model.StockOutApply; if (stockOutApply == null) this.Page.WarmAlert("获取出库申请失败", redirectUrl); //获取出库明细 NFMT.WareHouse.BLL.StockOutDetailBLL stockOutDetailBLL = new NFMT.WareHouse.BLL.StockOutDetailBLL(); result = stockOutDetailBLL.Load(user, stockOutId); if (result.ResultStatus != 0) this.Page.WarmAlert(result.Message, redirectUrl); details = result.ReturnValue as List<NFMT.WareHouse.Model.StockOutDetail>; if (details == null || !details.Any()) this.Page.WarmAlert("获取出库明细失败", redirectUrl); } }
public void ProcessRequest(HttpContext context) { NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser; System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer(); context.Response.ContentType = "text/plain"; NFMT.Common.ResultModel result = new NFMT.Common.ResultModel(); if (string.IsNullOrEmpty(context.Request.Form["source"])) { result.Message = "数据源为空"; result.ResultStatus = -1; context.Response.Write(serializer.Serialize(result)); context.Response.End(); } bool isPass = false; if (string.IsNullOrEmpty(context.Request.Form["ispass"]) || !bool.TryParse(context.Request.Form["ispass"], out isPass)) { result.Message = "审核结果错误"; result.ResultStatus = -1; context.Response.Write(serializer.Serialize(result)); context.Response.End(); } try { string jsonData = context.Request.Form["source"]; var obj = serializer.Deserialize<NFMT.WorkFlow.Model.DataSource>(jsonData); NFMT.WareHouse.BLL.StockOutBLL bll = new NFMT.WareHouse.BLL.StockOutBLL(); result = bll.Audit(user, obj, isPass); } catch (Exception ex) { result.Message = ex.Message; result.ResultStatus = -1; } context.Response.Write(serializer.Serialize(result)); context.Response.End(); }
protected void Page_Load(object sender, EventArgs e) { string redirectUrl = "StockOutList.aspx"; if (!IsPostBack) { Utility.VerificationUtility ver = new Utility.VerificationUtility(); ver.JudgeOperate(this.Page, 44, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.提交审核, NFMT.Common.OperateEnum.作废, NFMT.Common.OperateEnum.撤返, NFMT.Common.OperateEnum.执行完成, NFMT.Common.OperateEnum.执行完成撤销 }); this.navigation1.Routes.Add("出库列表", redirectUrl); this.navigation1.Routes.Add("出库明细", string.Empty); int stockOutId = 0; if (string.IsNullOrEmpty(Request.QueryString["id"]) || !int.TryParse(Request.QueryString["id"], out stockOutId)) Response.Redirect(redirectUrl); NFMT.Common.ResultModel result = new NFMT.Common.ResultModel(); //当前用户 NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser; //获取出库信息 NFMT.WareHouse.BLL.StockOutBLL stockOutBLL = new NFMT.WareHouse.BLL.StockOutBLL(); result = stockOutBLL.Get(user, stockOutId); if (result.ResultStatus != 0) Response.Redirect(redirectUrl); stockOut = result.ReturnValue as NFMT.WareHouse.Model.StockOut; if (stockOut == null || stockOut.StockOutId <= 0) Response.Redirect(redirectUrl); //出库信息赋值 this.txbMemo.Value = stockOut.Memo; //获取出库明细信息 NFMT.WareHouse.BLL.StockOutDetailBLL stockOutDetailBLL = new NFMT.WareHouse.BLL.StockOutDetailBLL(); result = stockOutDetailBLL.Load(user, stockOutId); if (result.ResultStatus != 0) Response.Redirect(redirectUrl); List<NFMT.WareHouse.Model.StockOutDetail> stockOutDetails = result.ReturnValue as List<NFMT.WareHouse.Model.StockOutDetail>; for (int i = 0; i < stockOutDetails.Count; i++) { NFMT.WareHouse.Model.StockOutDetail d = stockOutDetails[i]; DetailStr += d.StockOutApplyDetailId.ToString(); if (i != stockOutDetails.Count - 1) DetailStr += ","; } //获取出库申请信息 NFMT.WareHouse.BLL.StockOutApplyBLL outApplyBLL = new NFMT.WareHouse.BLL.StockOutApplyBLL(); NFMT.Operate.BLL.ApplyBLL applyBLL = new NFMT.Operate.BLL.ApplyBLL(); result = outApplyBLL.Get(user, stockOut.StockOutApplyId); if (result.ResultStatus != 0) Response.Redirect(redirectUrl); NFMT.WareHouse.Model.StockOutApply outApply = result.ReturnValue as NFMT.WareHouse.Model.StockOutApply; if (outApply == null || outApply.StockOutApplyId <= 0) Response.Redirect(redirectUrl); result = applyBLL.Get(user, outApply.ApplyId); if (result.ResultStatus != 0) Response.Redirect(redirectUrl); NFMT.Operate.Model.Apply apply = result.ReturnValue as NFMT.Operate.Model.Apply; if (apply == null || apply.ApplyId <= 0) Response.Redirect(redirectUrl); NFMT.User.Model.Department dept = NFMT.User.UserProvider.Departments.SingleOrDefault(a => a.DeptId == apply.ApplyDept); if (dept == null) Response.Redirect(redirectUrl); //出库申请信息赋值 this.spnApplyDept.InnerHtml = dept.DeptName; NFMT.User.Model.Employee emp = NFMT.User.UserProvider.Employees.FirstOrDefault(temp => temp.EmpId == apply.EmpId); this.spnApplier.InnerHtml = emp.Name; this.spnApplyDate.InnerHtml = apply.ApplyTime.ToShortDateString(); this.spnApplyMemo.InnerHtml = apply.ApplyDesc; //获取子合约信息 NFMT.Contract.BLL.ContractSubBLL subBLL = new NFMT.Contract.BLL.ContractSubBLL(); result = subBLL.Get(user, outApply.SubContractId); if (result.ResultStatus != 0) Response.Redirect(redirectUrl); NFMT.Contract.Model.ContractSub sub = result.ReturnValue as NFMT.Contract.Model.ContractSub; if (sub == null || sub.SubId <= 0) Response.Redirect(redirectUrl); NFMT.Contract.BLL.ContractBLL contractBLL = new NFMT.Contract.BLL.ContractBLL(); result = contractBLL.Get(user, sub.ContractId); if (result.ResultStatus != 0) Response.Redirect(redirectUrl); NFMT.Contract.Model.Contract contract = result.ReturnValue as NFMT.Contract.Model.Contract; if (contract == null || contract.ContractId <= 0) Response.Redirect(redirectUrl); this.contractExpander1.CurContract = contract; this.contractExpander1.CurContractSub = sub; this.contractExpander1.RedirectUrl = redirectUrl; //属性赋值 this.StockOutApplyId = outApply.StockOutApplyId; this.StockOutId = stockOut.StockOutId; System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer(); string json = serializer.Serialize(stockOut); this.hidModel.Value = json; //attach this.attach1.BusinessIdValue = this.StockOutId; } }
public void ProcessRequest(HttpContext context) { int pageIndex = 1, pageSize = 10; string orderStr = string.Empty, whereStr = string.Empty; int stockOutApplyId = 0; if (string.IsNullOrEmpty(context.Request.QueryString["aid"]) || !int.TryParse(context.Request.QueryString["aid"], out stockOutApplyId)) { context.Response.Write("出库申请信息错误"); context.Response.End(); } 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"])) { string sortDataField = context.Request.QueryString["sortdatafield"].Trim(); string sortOrder = context.Request.QueryString["sortorder"].Trim(); switch (sortDataField) { case "RefNo": sortDataField = "sn.RefNo"; break; case "StockWeight": sortDataField = "sto.GrossAmount"; break; case "StockStatusName": sortDataField = "sto.StockStatus"; break; case "CorpName": sortDataField = "cor.CorpName"; break; case "AssetName": sortDataField = "ass.AssetName "; break; case "BrandName": sortDataField = "bra.BrandName"; break; case "DetailId": sortDataField = "soad.DetailId"; break; case "ApplyWeight": sortDataField = "soad.ApplyWeight"; break; } orderStr = string.Format("{0} {1}", sortDataField, sortOrder); } string sids = context.Request.QueryString["sids"]; int stockOutId = 0; if (string.IsNullOrEmpty(context.Request.QueryString["oid"]) || !int.TryParse(context.Request.QueryString["oid"], out stockOutId)) { stockOutId = 0; } NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser; NFMT.WareHouse.BLL.StockOutBLL stockOutBLL = new NFMT.WareHouse.BLL.StockOutBLL(); NFMT.Common.SelectModel select = stockOutBLL.GetStockOutingSelect(pageIndex, pageSize, orderStr, stockOutApplyId,sids,stockOutId); NFMT.Common.ResultModel result = stockOutBLL.Load(user, select); context.Response.ContentType = "text/plain"; if (result.ResultStatus != 0) { context.Response.Write(result.Message); context.Response.End(); } int totalRows = result.AffectCount; System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable; Dictionary<string, object> dic = new Dictionary<string, object>(); dic.Add("count", totalRows); dic.Add("data", dt); string postData = Newtonsoft.Json.JsonConvert.SerializeObject(dic, new Newtonsoft.Json.Converters.DataTableConverter()); context.Response.Write(postData); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; NFMT.Common.ResultModel result = new NFMT.Common.ResultModel(); int stockOutId = 0; string sids = string.Empty; if (string.IsNullOrEmpty(context.Request.Form["stockOutId"])) { result.Message = "出库信息错误"; context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result)); context.Response.End(); } if (!int.TryParse(context.Request.Form["stockOutId"], out stockOutId)) { result.Message = "出库信息错误"; context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result)); context.Response.End(); } if (string.IsNullOrEmpty(context.Request.Form["sids"])) { result.Message = "未选中任务库存"; context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result)); context.Response.End(); } sids = context.Request.Form["sids"].Trim(); char[] cs = new char[1]; cs[0] = ','; string[] ids = sids.Split(cs, StringSplitOptions.RemoveEmptyEntries); List<int> detailIds = new List<int>(); foreach (string id in ids) { if (string.IsNullOrEmpty(id)) { result.Message = "库存信息错误"; context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result)); context.Response.End(); } int detailId = 0; if (!int.TryParse(id, out detailId)) { result.Message = "库存信息错误"; context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result)); context.Response.End(); } detailIds.Add(detailId); } string memo = context.Request.Form["memo"]; NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser; NFMT.WareHouse.BLL.StockOutBLL bll = new NFMT.WareHouse.BLL.StockOutBLL(); result = bll.UpdateStockOut(user, stockOutId, detailIds, memo); if (result.ResultStatus == 0) result.Message = "出库修改成功"; context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result)); }