public async Task <ActionResult> ProcessedBack([FromBody] BackInput input) { var entity = await context.EleDuplicates.FindAsync(input.Id); if (entity == null) { return(NotFound()); } //if (entity.ProcessedCompanyId != Session.CompanyId) //{ // return Ok(new ApiResult("无效操作")); //} entity.State = Model.Enums.EleDuplicateState.Backed; entity.BackReason = input.Reason; context.EleDuplicates.Update(entity); // 保存提交记录 await context.Records.AddAsync(new Model.Record.RecordInfo() { Event = EleDuplicateRecordTypes.ProcessedCompanyBacked.ToString(), OccurredTime = DateTime.Now, RelationshipId = entity.Id, Operator = Session.Username }); await context.SaveChangesAsync(); return(Ok(input.Id)); }
//保存表单数据 public ActionResult SaveData(BackInput BackInput) { //参数对象可以对应接受数据 BackInput.MakePerson = Session["UserName"].ToString(); //保存制单人 string result = BackInputService.SaveData(BackInput); //保存数据 return(Content(result.ToString())); }
private string AddBackInput(DataTable dt) { BackInput bill = DataTableToEntites.GetEntity <BackInput>(dt.Rows[0]); bill.Record = HandleRecords(dt); BackInputService Service = new BackInputService(); Service.SaveData(bill); return(bill.BillCode); }
//获取表单数据 public ActionResult GetData() { string str = Request.Params["BackInputId"];//单号 //如果新单据 没有数据 if (string.IsNullOrEmpty(str)) { return(Json(new BackInput()));//返回一个新建的空对象 } //如果有数据 Guid BackInputId = new Guid(Request["BackInputId"]); //单据编号 BackInput bill = BackInputService.LoadEntities(t => t.Id == BackInputId).FirstOrDefault(); //获取表单 return(Json(bill)); }
/// <summary> /// 导出退仓单 /// </summary> /// <param name="billId"></param> /// <param name="TemplateUrl"></param> /// <returns></returns> private MemoryStream ExportBackInput(Guid billId, string TemplateUrl) { BackInput bill = CurrentDBSession.BackInputDal.LoadEntities(a => a.Id == billId).FirstOrDefault(); if (bill == null) { return(null); } DataTable dt = ExcelHelp.ExcelToDT(TemplateUrl); foreach (var record in bill.Record) { DataRow dr = dt.NewRow(); dr["LBBillCode"] = bill.LBBillCode; dr["LBBillDate"] = bill.LBBillDate; dr["LBBackWarehouse"] = bill.LBBackWarehouse; dr["LBMoveType"] = bill.LBMoveType; dr["LBBackAddress"] = bill.LBBackAddress; dr["LBContacts"] = bill.LBContacts; dr["LBPhone"] = bill.LBPhone; dr["LBRemark"] = bill.LBRemark; dr["CreateDate"] = bill.CreateDate; dr["ChargePerson"] = bill.ChargePerson; dr["Warehouse"] = bill.Warehouse; dr["WarehouseId"] = bill.WarehouseId; dr["LoadGoodsType"] = bill.LoadGoodsType; dr["OutputType"] = bill.OutputType; dr["OutputTypeId"] = bill.OutputTypeId; dr["BusinessType"] = bill.BusinessType; dr["LineWay"] = bill.LineWay; dr["MakePerson"] = bill.MakePerson; dr["Remark"] = bill.Remark; dr["Department"] = bill.Department; dr["DepartmentId"] = bill.DepartmentId; dr["Company"] = bill.Company; dr["CompanyId"] = bill.CompanyId; //子表 dr["ItemCode"] = record.ItemCode; dr["ItemLocationId"] = record.ItemLocationId; dr["ItemBatch"] = record.ItemBatch; dr["Count"] = record.Count; dt.Rows.Add(dr); } return(NPIOHelper.RenderToMemory(dt, "sheet1")); }
public virtual void Action(BackInput message) { OnBack(); }