/// <summary> /// 根据主键删除物资出库管理 /// </summary> /// <param name="goodsOutId"></param> public static void DeleteGoodsOutById(string goodsOutId) { Model.SUBHSSEDB db = Funs.DB; Model.CostGoods_GoodsOut goodsOut = db.CostGoods_GoodsOut.FirstOrDefault(e => e.GoodsOutId == goodsOutId); if (goodsOut != null) { CodeRecordsService.DeleteCodeRecordsByDataId(goodsOutId); //删除编号 ProjectDataFlowSetService.DeleteFlowSetByDataId(goodsOutId); //删除流程 ////删除审核流程表 BLL.CommonService.DeleteFlowOperateByID(goodsOutId); db.CostGoods_GoodsOut.DeleteOnSubmit(goodsOut); db.SubmitChanges(); } }
/// <summary> /// 修改物资出库管理 /// </summary> /// <param name="goodsOut"></param> public static void UpdateGoodsOut(Model.CostGoods_GoodsOut goodsOut) { Model.SUBHSSEDB db = Funs.DB; Model.CostGoods_GoodsOut newGoodsOut = db.CostGoods_GoodsOut.FirstOrDefault(e => e.GoodsOutId == goodsOut.GoodsOutId); if (newGoodsOut != null) { //newGoodsOut.ProjectId = goodsOut.ProjectId; newGoodsOut.GoodsOutCode = goodsOut.GoodsOutCode; newGoodsOut.GoodsDefId = goodsOut.GoodsDefId; newGoodsOut.GoodsNum = goodsOut.GoodsNum; newGoodsOut.OutPerson = goodsOut.OutPerson; newGoodsOut.OutDate = goodsOut.OutDate; newGoodsOut.States = goodsOut.States; newGoodsOut.CompileMan = goodsOut.CompileMan; newGoodsOut.CompileDate = goodsOut.CompileDate; db.SubmitChanges(); } }
/// <summary> /// 加载页面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.ProjectId = this.CurrUser.LoginProjectId; this.btnClose.OnClientClick = ActiveWindow.GetHideReference(); this.GoodsOutId = Request.Params["GoodsOutId"]; if (!string.IsNullOrEmpty(this.GoodsOutId)) { Model.CostGoods_GoodsOut goodsOut = BLL.GoodsOut2Service.GetGoodsOutById(this.GoodsOutId); if (goodsOut != null) { this.ProjectId = goodsOut.ProjectId; this.txtGoodsOutCode.Text = BLL.CodeRecordsService.ReturnCodeByDataId(this.GoodsOutId); if (!string.IsNullOrEmpty(goodsOut.GoodsDefId)) { this.hdGoodsDefId.Text = goodsOut.GoodsDefId; var goodsDef = BLL.GoodsDefService.GetGoodsDefById(this.hdGoodsDefId.Text.Trim()); if (goodsDef != null) { this.txtGoodsDefId.Text = goodsDef.GoodsDefName; } } if (goodsOut.GoodsNum.HasValue) { this.txtCounts.Text = Convert.ToString(goodsOut.GoodsNum); } this.txtOutPerson.Text = goodsOut.OutPerson; this.txtOutDate.Text = string.Format("{0:yyyy-MM-dd}", goodsOut.OutDate); } } else { this.txtOutDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now); ////自动生成编码 this.txtGoodsOutCode.Text = BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.GoodsOut2MenuId, this.ProjectId, this.CurrUser.UnitId); } ///初始化审核菜单 this.ctlAuditFlow.MenuId = BLL.Const.GoodsOut2MenuId; this.ctlAuditFlow.DataId = this.GoodsOutId; this.ctlAuditFlow.ProjectId = this.ProjectId; this.ctlAuditFlow.UnitId = this.CurrUser.UnitId; } }
/// <summary> /// 添加物资出库管理 /// </summary> /// <param name="goodsOut"></param> public static void AddGoodsOut(Model.CostGoods_GoodsOut goodsOut) { Model.SUBHSSEDB db = Funs.DB; Model.CostGoods_GoodsOut newGoodsOut = new Model.CostGoods_GoodsOut { GoodsOutId = goodsOut.GoodsOutId, ProjectId = goodsOut.ProjectId, GoodsOutCode = goodsOut.GoodsOutCode, GoodsDefId = goodsOut.GoodsDefId, GoodsNum = goodsOut.GoodsNum, OutPerson = goodsOut.OutPerson, OutDate = goodsOut.OutDate, States = goodsOut.States, CompileMan = goodsOut.CompileMan, CompileDate = goodsOut.CompileDate }; db.CostGoods_GoodsOut.InsertOnSubmit(newGoodsOut); db.SubmitChanges(); CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.GoodsOut2MenuId, goodsOut.ProjectId, null, goodsOut.GoodsOutId, goodsOut.CompileDate); }
/// <summary> /// 保存数据 /// </summary> /// <param name="type"></param> private void SaveData(string type) { Model.CostGoods_GoodsOut goodsOut = new Model.CostGoods_GoodsOut { ProjectId = this.ProjectId, GoodsOutCode = this.txtGoodsOutCode.Text.Trim() }; if (!string.IsNullOrEmpty(this.hdGoodsDefId.Text.Trim())) { goodsOut.GoodsDefId = this.hdGoodsDefId.Text.Trim(); } goodsOut.GoodsNum = Funs.GetNewInt(this.txtCounts.Text.Trim()); goodsOut.OutPerson = this.txtOutPerson.Text.Trim(); goodsOut.OutDate = Funs.GetNewDateTime(this.txtOutDate.Text.Trim()); goodsOut.States = BLL.Const.State_0; if (type == BLL.Const.BtnSubmit) { goodsOut.States = this.ctlAuditFlow.NextStep; } goodsOut.CompileMan = this.CurrUser.UserId; goodsOut.CompileDate = DateTime.Now; if (!string.IsNullOrEmpty(this.GoodsOutId)) { goodsOut.GoodsOutId = this.GoodsOutId; BLL.GoodsOut2Service.UpdateGoodsOut(goodsOut); BLL.LogService.AddSys_Log(this.CurrUser, goodsOut.GoodsOutCode, goodsOut.GoodsOutId, BLL.Const.GoodsOut2MenuId, BLL.Const.BtnModify); } else { this.GoodsOutId = SQLHelper.GetNewID(typeof(Model.CostGoods_GoodsOut)); goodsOut.GoodsOutId = this.GoodsOutId; BLL.GoodsOut2Service.AddGoodsOut(goodsOut); BLL.LogService.AddSys_Log(this.CurrUser, goodsOut.GoodsOutCode, goodsOut.GoodsOutId, BLL.Const.GoodsOut2MenuId, BLL.Const.BtnAdd); } ////保存流程审核数据 this.ctlAuditFlow.btnSaveData(this.ProjectId, BLL.Const.GoodsOut2MenuId, this.GoodsOutId, (type == BLL.Const.BtnSubmit ? true : false), goodsOut.GoodsOutCode, "../CostGoods/GoodsOutView.aspx?GoodsOutId={0}"); }