/// <summary> /// 根据主键删除物资入库管理 /// </summary> /// <param name="goodsInId"></param> public static void DeleteGoodsInById(string goodsInId) { Model.SUBHSSEDB db = Funs.DB; Model.CostGoods_GoodsIn goodsIn = db.CostGoods_GoodsIn.FirstOrDefault(e => e.GoodsInId == goodsInId); if (goodsIn != null) { CodeRecordsService.DeleteCodeRecordsByDataId(goodsInId); //删除编号 ProjectDataFlowSetService.DeleteFlowSetByDataId(goodsInId); //删除流程 ////删除审核流程表 BLL.CommonService.DeleteFlowOperateByID(goodsInId); db.CostGoods_GoodsIn.DeleteOnSubmit(goodsIn); db.SubmitChanges(); } }
/// <summary> /// 修改物资入库管理 /// </summary> /// <param name="goodsIn"></param> public static void UpdateGoodsIn(Model.CostGoods_GoodsIn goodsIn) { Model.SUBHSSEDB db = Funs.DB; Model.CostGoods_GoodsIn newGoodsIn = db.CostGoods_GoodsIn.FirstOrDefault(e => e.GoodsInId == goodsIn.GoodsInId); if (newGoodsIn != null) { //newGoodsIn.ProjectId = goodsIn.ProjectId; newGoodsIn.GoodsInCode = goodsIn.GoodsInCode; newGoodsIn.GoodsDefId = goodsIn.GoodsDefId; newGoodsIn.GoodsNum = goodsIn.GoodsNum; newGoodsIn.InPerson = goodsIn.InPerson; newGoodsIn.InDate = goodsIn.InDate; newGoodsIn.States = goodsIn.States; newGoodsIn.CompileMan = goodsIn.CompileMan; newGoodsIn.CompileDate = goodsIn.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.GoodsInId = Request.Params["GoodsInId"]; if (!string.IsNullOrEmpty(this.GoodsInId)) { Model.CostGoods_GoodsIn goodsIn = BLL.GoodsIn2Service.GetGoodsInById(this.GoodsInId); if (goodsIn != null) { this.ProjectId = goodsIn.ProjectId; this.txtGoodsInCode.Text = BLL.CodeRecordsService.ReturnCodeByDataId(this.GoodsInId); if (!string.IsNullOrEmpty(goodsIn.GoodsDefId)) { this.hdGoodsDefId.Text = goodsIn.GoodsDefId; var goodsDef = BLL.GoodsDefService.GetGoodsDefById(this.hdGoodsDefId.Text.Trim()); if (goodsDef != null) { this.txtGoodsDefId.Text = goodsDef.GoodsDefName; } } if (goodsIn.GoodsNum != null) { this.txtCounts.Text = Convert.ToString(goodsIn.GoodsNum); } this.txtInPerson.Text = goodsIn.InPerson; this.txtInDate.Text = string.Format("{0:yyyy-MM-dd}", goodsIn.InDate); } } else { this.txtInDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now); ////自动生成编码 this.txtGoodsInCode.Text = BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.GoodsIn2MenuId, this.ProjectId, this.CurrUser.UnitId); } ///初始化审核菜单 this.ctlAuditFlow.MenuId = BLL.Const.GoodsIn2MenuId; this.ctlAuditFlow.DataId = this.GoodsInId; this.ctlAuditFlow.ProjectId = this.ProjectId; this.ctlAuditFlow.UnitId = this.CurrUser.UnitId; } }
/// <summary> /// 添加物资入库管理 /// </summary> /// <param name="goodsIn"></param> public static void AddGoodsIn(Model.CostGoods_GoodsIn goodsIn) { Model.SUBHSSEDB db = Funs.DB; Model.CostGoods_GoodsIn newGoodsIn = new Model.CostGoods_GoodsIn { GoodsInId = goodsIn.GoodsInId, ProjectId = goodsIn.ProjectId, GoodsInCode = goodsIn.GoodsInCode, GoodsDefId = goodsIn.GoodsDefId, GoodsNum = goodsIn.GoodsNum, InPerson = goodsIn.InPerson, InDate = goodsIn.InDate, States = goodsIn.States, CompileMan = goodsIn.CompileMan, CompileDate = goodsIn.CompileDate }; db.CostGoods_GoodsIn.InsertOnSubmit(newGoodsIn); db.SubmitChanges(); CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.GoodsIn2MenuId, goodsIn.ProjectId, null, goodsIn.GoodsInId, goodsIn.CompileDate); }
/// <summary> /// 保存数据 /// </summary> /// <param name="type"></param> private void SaveData(string type) { Model.CostGoods_GoodsIn goodsIn = new Model.CostGoods_GoodsIn { ProjectId = this.ProjectId, GoodsInCode = this.txtGoodsInCode.Text.Trim() }; if (!string.IsNullOrEmpty(this.hdGoodsDefId.Text.Trim())) { goodsIn.GoodsDefId = this.hdGoodsDefId.Text.Trim(); } goodsIn.GoodsNum = Funs.GetNewInt(this.txtCounts.Text.Trim()); goodsIn.InPerson = this.txtInPerson.Text.Trim(); goodsIn.InDate = Funs.GetNewDateTime(this.txtInDate.Text.Trim()); goodsIn.States = BLL.Const.State_0; if (type == BLL.Const.BtnSubmit) { goodsIn.States = this.ctlAuditFlow.NextStep; } goodsIn.CompileMan = this.CurrUser.UserId; goodsIn.CompileDate = DateTime.Now; if (!string.IsNullOrEmpty(this.GoodsInId)) { goodsIn.GoodsInId = this.GoodsInId; BLL.GoodsIn2Service.UpdateGoodsIn(goodsIn); BLL.LogService.AddSys_Log(this.CurrUser, goodsIn.GoodsInCode, goodsIn.GoodsInId, BLL.Const.GoodsIn2MenuId, BLL.Const.BtnModify); } else { this.GoodsInId = SQLHelper.GetNewID(typeof(Model.CostGoods_GoodsIn)); goodsIn.GoodsInId = this.GoodsInId; BLL.GoodsIn2Service.AddGoodsIn(goodsIn); BLL.LogService.AddSys_Log(this.CurrUser, goodsIn.GoodsInCode, goodsIn.GoodsInId, BLL.Const.GoodsIn2MenuId, BLL.Const.BtnAdd); } ////保存流程审核数据 this.ctlAuditFlow.btnSaveData(this.ProjectId, BLL.Const.GoodsIn2MenuId, this.GoodsInId, (type == BLL.Const.BtnSubmit ? true : false), goodsIn.GoodsInCode, "../CostGoods/GoodsInView.aspx?GoodsInId={0}"); }