public async Task <TData <string> > SaveForm(OrderMaterielDetailEntity entity) { TData <string> obj = new TData <string>(); await orderMaterielDetailService.SaveForm(entity); obj.Data = entity.Id.ParseToString(); obj.Tag = 1; return(obj); }
public async Task SaveForm(OrderMaterielDetailEntity entity) { if (entity.Id.IsNullOrZero()) { await entity.Create(); await this.BaseRepository().Insert(entity); } else { await entity.Modify(); await this.BaseRepository().Update(entity); } }
/// <summary> /// 修改库存数量 /// </summary> /// <param name="id">物料id</param> /// <param name="isChangeNum">true 表示num是变化数量,false:表示变化后的数量</param> /// <param name="num">变更后的数量</param> /// <param name="remark">备注</param> /// <param name="buniss_id">业务id</param> /// <param name="busin_table">业务表</param> /// <returns></returns> public async Task <TData <string> > ModifyMaterielTotal(long id, bool isChangeNum, int num, string remark, long?buniss_id, string busin_table) { OrderMaterielEntity ter = await orderMaterielService.GetEntity(id); //变化数量 int?src_num = ter.MaterielTotal; //变化量 int?chanageNum = num - src_num; if (isChangeNum) { chanageNum = num; } if (chanageNum != 0) { ter.MaterielTotal = src_num + chanageNum; ter.BaseModifyTime = DateTime.Now; var result = await SaveForm(ter); if (result.Tag == 1) { OrderMaterielDetailEntity detail = new OrderMaterielDetailEntity(); detail.SrcNum = src_num; detail.ChangeNum = chanageNum; detail.Remark = remark; detail.MaterielId = ter.Id; detail.BusyniessId = buniss_id; detail.BusyniessTable = busin_table; result = await orderMaterielDetailBLL.SaveForm(detail); } return(result); } else { TData <string> obj = new TData <string>(); obj.Tag = 0; return(obj); } }
public async Task <ActionResult> SaveFormJson(OrderMaterielDetailEntity entity) { TData <string> obj = await orderMaterielDetailBLL.SaveForm(entity); return(Json(obj)); }