/// <summary> /// 审核表单 /// </summary> /// <param name="TransferBillId"></param> /// <returns></returns> public string Examine(Guid OtherInputId, string UserName) { OtherInput bill = CurrentDal.LoadEntities(a => a.Id == OtherInputId).FirstOrDefault(); List <Record> list = bill.Record.ToList(); List <InWarehouse> listAdd = new List <InWarehouse>();//新增列表 foreach (Record item in list) { item.State = 2; item.ExamineDate = DateTime.Now; InWarehouse inWarehouse = CurrentDBSession.InWarehouseDal.LoadEntities(i => i.ItemCode == item.ItemCode && i.ItemLocationId == item.ItemLocationId && i.ItemBatch == item.ItemBatch).FirstOrDefault(); //查暂存 InWarehouse temp = listAdd.Where(p => p.ItemCode == item.ItemCode && p.ItemLocationId == item.ItemLocationId && p.ItemBatch == item.ItemBatch).FirstOrDefault(); if (inWarehouse == null && temp == null)//如果都没有库存 新建一条记录 { inWarehouse = new InWarehouse() { Id = Guid.NewGuid(), ItemBatch = item.ItemBatch, ItemCode = item.ItemCode, ItemLine = item.ItemLine, ItemLocation = item.ItemLocation, ItemLocationId = item.ItemLocationId, Warehouse = item.Warehouse, WarehouseId = item.WarehouseId, ItemName = item.ItemName, ItemSpecifications = item.ItemSpecifications, ItemUnit = item.ItemUnit, Count = item.Count, Company = bill.Company, CompanyId = bill.CompanyId, Department = bill.Department, DepartmentId = bill.DepartmentId }; item.CurrentCount = item.Count; listAdd.Add(inWarehouse); //添加到暂存区 } else if (inWarehouse == null && temp != null) //只有暂存区有库存 { temp.Count += item.Count; item.CurrentCount = temp.Count; } else //数据库有库存 { inWarehouse.Count += item.Count; CurrentDBSession.InWarehouseDal.EditEntity(inWarehouse); item.CurrentCount = inWarehouse.Count; } } //最后添加新增列表中数据 foreach (var item in listAdd) { CurrentDBSession.InWarehouseDal.AddEntity(item); } bill.BillState = 2; //改成已审核状态 bill.ExaminePerson = UserName; //审核人 bill.ExamineDate = DateTime.Now; CurrentDal.EditEntity(bill); return(CurrentDBSession.SaveChanges() ? "操作成功" : "操作失败"); }
/// <summary> /// 审核表单 /// </summary> /// <param name="TransferBillId"></param> /// <returns></returns> public string Examine(Guid BackInputId, string UserName) { string result = ""; BackInput bill = CurrentDal.LoadEntities(a => a.Id == BackInputId).FirstOrDefault(); List <Record> list = bill.Record.ToList(); foreach (Record item in list) { item.State = 2; item.ExamineDate = DateTime.Now; InWarehouse inWarehouse = CurrentDBSession.InWarehouseDal.LoadEntities(i => i.ItemCode == item.ItemCode && i.ItemLocationId == item.ItemLocationId && i.ItemBatch == item.ItemBatch).FirstOrDefault(); if (inWarehouse == null || inWarehouse.Count < item.Count) //当前库存不够 ,不允许做弃审操作 { result = "物料编号:" + item.ItemCode + "物料名称:" + item.ItemName + "库存不足,审核失败"; return(result); } else if (inWarehouse.Count == item.Count) { CurrentDBSession.InWarehouseDal.DeleteEntity(inWarehouse); } else //有库存 { inWarehouse.Count -= item.Count; CurrentDBSession.InWarehouseDal.EditEntity(inWarehouse); } } bill.BillState = 2; //改成已审核状态 bill.ExaminePerson = UserName; //审核人 bill.ExamineDate = DateTime.Now; CurrentDal.EditEntity(bill); result = CurrentDBSession.SaveChanges() ? "审核成功!" : "审核失败!"; return(result); }
/// <summary> /// 3- 修改实体 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool Update(T model) { //同删除 CurrentDAL.Update(model); //return idal.SaveChange(); return(CurrentDBSession.SaveChanges()); }
/// <summary> /// 保存权限 /// </summary> /// <param name="RoleId">要修改的角色</param> /// <param name="checkListId">选中的ID</param> /// <param name="indeterminateListId">半选中的Id</param> /// <returns></returns> public string SaveRoleMenu(int RoleId, int[] checkListId, int[] indeterminateListId) { //删除旧数据 var oldList = CurrentDBSession.RoleMenuRelationDal.LoadEntities(a => a.RoleId == RoleId); foreach (var item in oldList) { CurrentDBSession.RoleMenuRelationDal.DeleteEntity(item); } //插入新数据 if (checkListId != null) { foreach (var item in checkListId) { CurrentDBSession.RoleMenuRelationDal.AddEntity(new RoleMenuRelation() { RoleId = RoleId, MenuId = item, CheckState = "checked" }); } } if (indeterminateListId != null) { foreach (var item in indeterminateListId) { CurrentDBSession.RoleMenuRelationDal.AddEntity(new RoleMenuRelation() { RoleId = RoleId, MenuId = item, CheckState = "indeterminate" }); } } return(CurrentDBSession.SaveChanges() ? "保存成功" : "保存失败"); }
/// <summary> /// 审核表单 /// </summary> /// <param name="TransferBillId"></param> /// <returns></returns> public string Examine(Guid GiveBillId, string UserName) { string result = ""; GiveBill bill = CurrentDal.LoadEntities(a => a.Id == GiveBillId).FirstOrDefault(); List <Record> list = bill.Record.ToList(); foreach (Record item in list) { InWarehouse inWarehouse = CurrentDBSession.InWarehouseDal.LoadEntities(i => i.ItemCode == item.ItemCode && i.ItemLocationId == item.ItemLocationId && i.ItemBatch == item.ItemBatch).FirstOrDefault(); if (inWarehouse == null || inWarehouse.Count < item.Count)//如果没有库存 新建一条记录 { result = "物料编号:" + item.ItemCode + "物料名称:" + item.ItemName + "库存不足,弃审失败"; return(result); } else if (inWarehouse.Count == item.Count) // 库存正好相等 删除这条记录 { CurrentDBSession.InWarehouseDal.DeleteEntity(inWarehouse); item.State = 2; } else if (inWarehouse.Count > item.Count)//库存大于记录 相减 { inWarehouse.Count = inWarehouse.Count - item.Count; CurrentDBSession.InWarehouseDal.EditEntity(inWarehouse); item.State = 2; } } bill.BillState = 2; //改成已审核状态 bill.ExaminePerson = UserName; //审核人 bill.ExamineDate = DateTime.Now; CurrentDal.EditEntity(bill); result = CurrentDBSession.SaveChanges() ? "审核成功!" : "审核失败!"; return(result); }
/// <summary> /// 保存某人角色 /// </summary> /// <param name="UserCode"></param> /// <param name="Roles"></param> /// <returns></returns> public string SaveRoles(string UserCode, int[] Roles) { try { //删除原有的 var temp = CurrentDBSession.UserRoleRelationDal.LoadEntities(a => a.UserCode == UserCode); foreach (var item in temp) { CurrentDBSession.UserRoleRelationDal.DeleteEntity(item); } //添加新的 foreach (int item in Roles) { CurrentDBSession.UserRoleRelationDal.AddEntity(new UserRoleRelation() { RoleId = item, UserCode = UserCode }); } return(CurrentDBSession.SaveChanges() ? "保存成功!" : "保存失败!"); } catch (Exception e) { return(e.ToString()); } }
public bool SetUserActionInfo(int actionId, int userId, bool isPass) { R_UserInfo_ActionInfo rUserInfoActionInfo = CurrentDBSession.R_UserInfo_ActionInfoDal .LoadEntites(a => a.ActionInfoID == actionId && a.UserInfoID == userId).FirstOrDefault(); if (rUserInfoActionInfo == null) { var newRUserInfoActionInfo = new R_UserInfo_ActionInfo() { ActionInfoID = actionId, UserInfoID = userId, IsPass = isPass }; CurrentDBSession.R_UserInfo_ActionInfoDal.AddEntity(newRUserInfoActionInfo); CurrentDBSession.SaveChanges(); } else { rUserInfoActionInfo.IsPass = isPass; CurrentDBSession.R_UserInfo_ActionInfoDal.EditEntity(rUserInfoActionInfo); CurrentDBSession.SaveChanges(); } return(true); }
/// <summary> /// 2- 根据用户id删除数据库中记录 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool Del(T model) { //2.1 调用数据访问层的Del方法,只是向EF上下文中添加了要删除的实体对象的修改标记,需要执行保存方法 CurrentDAL.Del(model); // return(CurrentDBSession.SaveChanges()); }
/// <summary> /// 保存导入的数据(仅限LH.武汉站) /// </summary> /// <param name="bill"></param> /// <returns></returns> public string SaveImport(GiveBill bill) { try { //查询数据库中有没有重复项 if (CurrentDal.LoadEntities(a => a.LBBillCode == bill.LBBillCode).Count() > 0) { return(bill.LBBillCode + "导入失败!客户单号重复!\r\n"); } ; //主表 bill.Id = Guid.NewGuid(); //生成一个id bill.BillCode = GetBillCode("JH"); //生成单号 if (bill.BillCode == "no") { bill.BillCode = GetBillCode("JH"); //再次生成单号 } bill.BillState = 1; //保存状态 bill.CreateDate = DateTime.Now; bill.MakePerson = HttpContext.Current.Session["UserName"].ToString(); bill.LoadGoodsType = "武汉-配送客户出库装货"; bill.BackLoadGoodsType = "武汉-客户现场卸货"; bill.OutputType = "配送交货出库"; bill.OutputTypeId = 20; bill.BusinessType = "武汉-二次配送"; bill.Department = "LH.武汉站"; bill.DepartmentId = "LH7011"; bill.Company = "联合运输"; bill.CompanyId = "LH0000"; bill.Remark = "批量导入"; //子表 foreach (var item in bill.Record)//生成子表id { item.Id = Guid.NewGuid(); item.Department = bill.Department; item.DepartmentId = bill.DepartmentId; item.State = bill.BillState; item.CreateDate = bill.CreateDate; item.InOrOut = 0; item.MainTableType = "GiveBill"; item.InOutTypeId = bill.OutputTypeId; item.InOutTypeName = bill.OutputType; var goodItem = CurrentDBSession.GoodItemDal.LoadEntities(a => a.ItemCode == item.ItemCode).FirstOrDefault(); item.ItemLine = goodItem.ItemLine; item.ItemName = goodItem.ItemName; item.ItemSpecifications = goodItem.ItemSpecifications; item.ItemUnit = goodItem.ItemUnit; item.UnitWeight = goodItem.UnitWeight; item.Remark = bill.Remark; } CurrentDal.AddEntity(bill); return(CurrentDBSession.SaveChanges() ? "" : bill.LBBillCode + "导入失败!\r\n"); } catch (Exception) { return(bill.LBBillCode + "导入失败!\r\n"); } }
/// <summary> /// 1- 新增实体 /// </summary> /// <param name="model"></param> public bool CreateByList(List <T> list) { //1.1 执行添加操作只是将要修改的对象标记为添加标记 //UserInfoDAL.Create(model); CurrentDAL.CreateByList(list); //1.2 执行保存操作 return(CurrentDBSession.SaveChanges()); }
public bool DeleteRoleById(int id) { var roleInfos = CurrentDBSession.RoleInfoDal.LoadEntites(r => r.ID == id); RoleInfo roleInfo = roleInfos.FirstOrDefault(); CurrentDBSession.RoleInfoDal.DeleteEntity(roleInfo); return(CurrentDBSession.SaveChanges()); }
public bool DeleteUserById(int id) { var userInfos = CurrentDBSession.UserInfoDal.LoadEntites(r => r.ID == id); UserInfo userInfo = userInfos.FirstOrDefault(); CurrentDBSession.UserInfoDal.DeleteEntity(userInfo); return(CurrentDBSession.SaveChanges()); }
public bool DeleteActionById(int id) { var actionInfos = CurrentDBSession.ActionInfoDal.LoadEntites(a => a.ID == id); ActionInfo actionInfo = actionInfos.FirstOrDefault(); CurrentDBSession.ActionInfoDal.DeleteEntity(actionInfo); return(CurrentDBSession.SaveChanges()); }
/// <summary> /// 审核表单 /// </summary> /// <param name="TransferBillId"></param> /// <returns></returns> public string Examine(Guid BackInputId, string UserName) { string res = ""; BackInput bill = CurrentDal.LoadEntities(a => a.Id == BackInputId).FirstOrDefault(); List <Record> list = bill.Record.ToList(); List <InWarehouse> listDel = new List <InWarehouse>();//暂存区 foreach (Record item in list) { item.State = 2; item.ExamineDate = DateTime.Now; InWarehouse inWarehouse = CurrentDBSession.InWarehouseDal.LoadEntities(i => i.ItemCode == item.ItemCode && i.ItemLocationId == item.ItemLocationId && i.ItemBatch == item.ItemBatch).FirstOrDefault(); InWarehouse temp = listDel.Where(i => i.ItemCode == item.ItemCode && i.ItemLocationId == item.ItemLocationId && i.ItemBatch == item.ItemBatch).FirstOrDefault(); //缓存区 if (temp != null) //缓存区有 说明数量不足 { res += "物料编号:" + item.ItemCode + ",物料名称:" + item.ItemName + ",批次:" + item.ItemBatch + ",库存不足,审核失败"; continue; } if (inWarehouse == null || inWarehouse.Count < item.Count)//缓存区没有 数量为空或者小于 { res += "物料编号:" + item.ItemCode + ",物料名称:" + item.ItemName + ",批次:" + item.ItemBatch + ",库存不足,审核失败"; continue; } //缓存区没有 数量相等 应该删除 加入缓存区 if (inWarehouse.Count == item.Count) // 暂存区中没有 库存正好相等 删除这条记录 { listDel.Add(inWarehouse); //添加到删除暂存区 item.CurrentCount = 0; //当前库存量 continue; } if (inWarehouse.Count > item.Count)//库存大于记录 暂存区中没有 则相减 { inWarehouse.Count = inWarehouse.Count - item.Count; item.CurrentCount = inWarehouse.Count;//当前库存量 CurrentDBSession.InWarehouseDal.EditEntity(inWarehouse); } else //数据异常了 应该进不来 记录错误 { res += "物料编号:" + item.ItemCode + ",数量:" + item.Count + "数据异常!请记下物料编号联系管理员检查!"; } } if (res != "") { return(res); } //删除缓存区数据 foreach (var item in listDel) { CurrentDBSession.InWarehouseDal.DeleteEntity(item); } bill.BillState = 2; //改成已审核状态 bill.ExaminePerson = UserName; //审核人 bill.ExamineDate = DateTime.Now; CurrentDal.EditEntity(bill); res = CurrentDBSession.SaveChanges() ? "审核成功!" : "审核失败!"; return(res); }
public T AddEntity(T model) { CurrentDAL.AddEntity(model); if (CurrentDBSession.SaveChanges()) { return(model); } return(null); }
/// <summary> /// 保存表单数据 /// </summary> /// <returns></returns> public string SaveData(OtherOutput bill) { //主表id为0 新增一条记录 此时子表数据会自动插入 if (bill.Id == Guid.Parse("00000000-0000-0000-0000-000000000000")) { bill.Id = Guid.NewGuid(); //生成一个id bill.BillState = 1; //保存状态 foreach (var item in bill.Record) //生成子表id { if (item.Id == Guid.Parse("00000000-0000-0000-0000-000000000000")) { item.Id = Guid.NewGuid(); item.Department = bill.Department; item.DepartmentId = bill.DepartmentId; item.WarehouseId = bill.WarehouseId; item.Warehouse = bill.Warehouse; item.State = bill.BillState; item.CreateDate = DateTime.Now; item.InOrOut = 0; } } CurrentDal.AddEntity(bill); } //主表有id 说明是修改的 else { //删除原子表数据 List <Record> list = CurrentDBSession.RecordDal.LoadEntities(a => a.MainTableId == bill.Id).ToList(); foreach (Record item in list) { CurrentDBSession.RecordDal.DeleteEntity(item); //RecordService.DeleteEntity(item); } //添加子表数据 foreach (Record record in bill.Record) { if (record.Id == Guid.Parse("00000000-0000-0000-0000-000000000000") || record.Id == Guid.Empty) { record.Id = Guid.NewGuid(); //设置子表id record.MainTableId = bill.Id; //设置主表id record.Department = bill.Department; record.DepartmentId = bill.DepartmentId; record.WarehouseId = bill.WarehouseId; record.Warehouse = bill.Warehouse; record.State = bill.BillState; record.CreateDate = DateTime.Now; record.InOrOut = 0; } CurrentDBSession.RecordDal.AddEntity(record); //RecordService.AddEntity(record); } //修改主表数据 CurrentDal.EditEntity(bill); } return(CurrentDBSession.SaveChanges() ? bill.Id.ToString() : "no"); }
public bool EditUser(UserInfo userInfo) { UserInfo dbUser = CurrentDal.LoadEntites(u => u.ID == userInfo.ID).FirstOrDefault(); dbUser.UName = userInfo.UName; dbUser.Remark = userInfo.Remark == null ? "" : userInfo.Remark; dbUser.ModifiedOn = DateTime.Now; return(CurrentDBSession.SaveChanges()); }
public string SaveData(TaskBill bill, string[] records) { //主表id为0 新增一条记录 此时子表数据会自动插入 if (bill.Id == Guid.Parse("00000000-0000-0000-0000-000000000000")) { bill.Id = Guid.NewGuid();//生成一个id //bill.BillCode = GetBillCode("RW");//生成单号 //if (bill.BillCode == "no") //{ // bill.BillCode = GetBillCode("RW");//再次生成单号 //} bill.BillState = 1;//保存状态 if (records != null) { //修改对应交货单的任务单字段 List <GiveBill> list = CurrentDBSession.GiveBillDal.LoadEntities(a => records.Contains(a.BillCode)).ToList(); foreach (GiveBill item in list) { item.TaskBillCode = bill.BillCode; CurrentDBSession.GiveBillDal.EditEntity(item);//设置交货单的任务单号 } } CurrentDal.AddEntity(bill); } else //主表有id 说明是修改的 { List <GiveBill> list; //把原来属于但是现在不属于这张任务单的交货单清空 if (records != null) //修改后子表有记录 { list = CurrentDBSession.GiveBillDal.LoadEntities(a => (a.TaskBillCode == bill.BillCode) && (!records.Contains(a.BillCode))).ToList(); } else //修改后子表全删除了 { list = CurrentDBSession.GiveBillDal.LoadEntities(a => a.TaskBillCode == bill.BillCode).ToList(); } foreach (var item in list) { item.TaskBillCode = null; CurrentDBSession.GiveBillDal.EditEntity(item); } if (records != null) { //设置交货单的任务单号 var list1 = CurrentDBSession.GiveBillDal.LoadEntities(a => records.Contains(a.BillCode)); foreach (var item in list1) { item.TaskBillCode = bill.BillCode; CurrentDBSession.GiveBillDal.EditEntity(item); } } //修改主表数据 CurrentDal.EditEntity(bill); } //保存成功返回单据Id return(CurrentDBSession.SaveChanges() ? bill.Id.ToString() : "no"); }
public bool DeleteEntities(List <int> list) { var temp = CurrentDBSession.UserInfoDal.LoadEntities(c => list.Contains(c.Id)); foreach (var userInfo in temp) { CurrentDal.DeleteEntity(userInfo); } return(CurrentDBSession.SaveChanges()); }
public bool DeleteEntities(IEnumerable <int> ids) { var roleInfos = LoadEntites(o => o.DelFlag == (short)DeleteEnumType.Normal).Where(x => ids.Contains(x.ID)).ToList(); // 多表关联删除 roleInfos.ForEach(o => o.UserInfo.Clear()); // 先删除关联表 CurrentDBSession.SaveChanges(); roleInfos.ForEach(o => this.CurrentDAL.DeleteEntity(o)); // 在把本表打上删除标志 return(CurrentDBSession.SaveChanges()); }
public bool DeleteEntitys(List <int> list) { var userInfoList = CurrentDal.LoadEntities(u => list.Contains(u.ID)); foreach (var userInfo in userInfoList) { CurrentDal.DeleteEntity(userInfo); } return(CurrentDBSession.SaveChanges()); }
public bool DeleteMails(int[] idList) { foreach (int id in idList) { MailInfo mailInfo = CurrentDal.LoadEntites(m => m.Id == id).FirstOrDefault(); bool b = CurrentDal.DeleteEntity(mailInfo); } CurrentDBSession.SaveChanges(); return(true); }
public bool EditRole(RoleInfo role) { RoleInfo dbRole = CurrentDal.LoadEntites(r => r.ID == role.ID).FirstOrDefault(); dbRole.RoleName = role.RoleName; dbRole.Remark = role.Remark == null?"":role.Remark; dbRole.Sort = role.Sort; dbRole.ModifiedOn = DateTime.Now; return(CurrentDBSession.SaveChanges()); }
public bool DeleteEntitys(string MID) { var TBL_GZMXB_LOGList = CurrentDal.LoadEntities(u => u.MID.Equals(MID)); foreach (var TBL_GZMXB_LOG in TBL_GZMXB_LOGList) { CurrentDal.DeleteEntity(TBL_GZMXB_LOG); } return(CurrentDBSession.SaveChanges()); }
//批量删除 public bool DleteuserInfo(List <int> arry) { var userinfoentity = this.CurrentDBSession.UserInfoDal.LoadEnity(u => arry.Contains(u.ID)); foreach (var item in userinfoentity) { this.CurrentDBSession.UserInfoDal.Deleteeneity(item); } return(CurrentDBSession.SaveChanges()); }
//public override void SetCurrentDAL() //{ // this.CurrentDAL = this.CurrentDBSession.UserInfoDAL; //} public bool DeleteEntities(List <int> IDList) { var entities = CurrentDBSession.UserInfoDAL.LoadEntities(u => IDList.Contains(u.ID)); foreach (var entity in entities) { CurrentDBSession.UserInfoDAL.DeleteEntity(entity); } return(CurrentDBSession.SaveChanges()); }
/// <summary> /// 批量删除 /// </summary> /// <param name="ids"></param> /// <returns></returns> public bool BatchDeleteEntities(List <int> ids) { var entitis = LoadEntities(x => ids.Contains(x.Id)); foreach (var item in entitis) { CurrentDal.DeleteEntity(item); } return(CurrentDBSession.SaveChanges()); }
public bool SetRole4Action(int actionID, List<int> roleIDList) { var actionInfo = CurrentDBSession.ActionInfoDAL.LoadEntities(u => u.ID == actionID).FirstOrDefault(); actionInfo.RoleInfo.Clear(); foreach (var item in roleIDList) { var roleInfo = CurrentDBSession.RoleInfoDAL.LoadEntities(u => u.ID == item).FirstOrDefault(); actionInfo.RoleInfo.Add(roleInfo); } return CurrentDBSession.SaveChanges(); }
public int AddEntityAndGetNewNotepaperId(Model.Notepaper entity) { CurrentDBSession.NotepaperDal.AddEntity(entity); if (CurrentDBSession.SaveChanges()) { return(entity.Id); } else { return(0); } }
/// <summary> /// 弃审 /// </summary> /// <param name="TransferBillId">单据Id</param> /// <param name="UserName">用户名</param> /// <returns></returns> public string GiveupExamine(Guid BackInputId, string UserName) { BackInput bill = CurrentDal.LoadEntities(a => a.Id == BackInputId).FirstOrDefault(); List <Record> list = bill.Record.ToList(); string res = ""; if (bill.BillState != 2) { res = "单据状态不对,无法弃审!"; return(res); } //对每一条记录做逆操作 foreach (Record item in list) { item.State = 1; //修改记录状态 item.ExamineDate = null; //清空审核时间 InWarehouse inWarehouse = CurrentDBSession.InWarehouseDal.LoadEntities(i => i.ItemCode == item.ItemCode && i.ItemLocationId == item.ItemLocationId && i.ItemBatch == item.ItemBatch).FirstOrDefault(); if (inWarehouse == null) //如果没有库存 新建一条记录 { inWarehouse = new InWarehouse() { Id = Guid.NewGuid(), ItemBatch = item.ItemBatch, ItemCode = item.ItemCode, ItemLine = item.ItemLine, ItemLocation = item.ItemLocation, ItemLocationId = item.ItemLocationId, Warehouse = item.Warehouse, WarehouseId = item.WarehouseId, ItemName = item.ItemName, ItemSpecifications = item.ItemSpecifications, ItemUnit = item.ItemUnit, Count = item.Count, Department = item.Department, DepartmentId = item.DepartmentId, Company = bill.Company, CompanyId = bill.CompanyId }; CurrentDBSession.InWarehouseDal.AddEntity(inWarehouse); } else//库存有记录 相加 { inWarehouse.Count = inWarehouse.Count + item.Count; CurrentDBSession.InWarehouseDal.EditEntity(inWarehouse); } } bill.BillState = 1; //改成编辑状态 bill.ExaminePerson = null; //清除审核人 bill.ExamineDate = null; //清除审核时间 CurrentDal.EditEntity(bill); return(CurrentDBSession.SaveChanges() ? "操作成功" : "操作失败"); }