abp(net core)+easyui+efcore实现仓储管理系统目录

abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一)

abp(net core)+easyui+efcore实现仓储管理系统——解决方案介绍(二)

abp(net core)+easyui+efcore实现仓储管理系统——领域层创建实体(三)

abp(net core)+easyui+efcore实现仓储管理系统——定义仓储并实现 (四)

abp(net core)+easyui+efcore实现仓储管理系统——创建应用服务(五)

abp(net core)+easyui+efcore实现仓储管理系统——展现层实现增删改查之控制器(六)

abp(net core)+easyui+efcore实现仓储管理系统——展现层实现增删改查之列表视图(七)

abp(net core)+easyui+efcore实现仓储管理系统——展现层实现增删改查之增删改视图(八)

abp(net core)+easyui+efcore实现仓储管理系统——展现层实现增删改查之菜单与测试(九)

abp(net core)+easyui+efcore实现仓储管理系统——多语言(十)

abp(net core)+easyui+efcore实现仓储管理系统——使用 WEBAPI实现CURD (十一)

abp(net core)+easyui+efcore实现仓储管理系统——菜单-上 (十六)

abp(net core)+easyui+efcore实现仓储管理系统——EasyUI前端页面框架 (十八)

abp(net core)+easyui+efcore实现仓储管理系统——EasyUI之货物管理一 (十九)

abp(net core)+easyui+efcore实现仓储管理系统——EasyUI之货物管理二 (二十)

 
 

在上一篇 abp(net core)+easyui+efcore实现仓储管理系统——EasyUI之货物管理五 (二十三)文章中,我们修正了一些BUG,让货物信息管理的前端与后台功能基本实现了我们所要。现在我们运行起应用程序看看新增功能。

十五、新增货物信息

继续来实现我们的货物信息管理功能,之前我们已经实现了列表功能,现在我们来实现货物信息的增加功能。

1. 在Visual Studio 2017的“解决方案资源管理器”中,右键单击在领域层“ABP.TPLMS.Web.Core”项目中的Controller目录。 找到TPLMSControllerBase文件,添加一个新的方法JsonEasyUIResult。此方法用来实现当我们完成了增加货物信息之后,返回给前端相关信息。代码如下。

protected dynamic JsonEasyUIResult(int id,string result)
{ string strId = string.Empty;
if (id>)
{
strId = id.ToString();
} var obj = new
{
result = result,
Id = strId
};
var json = ABP.TPLMS.Helpers.JsonHelper.Instance.Serialize(obj);
return json;
}

2. 在Visual Studio 2017的“解决方案资源管理器”中,右键单击在展示层“ABP.TPLMS.Web.Mvc”项目中的Controller目录。 找到CargoController文件,添加一个新增方法,代码如下。

 public ActionResult Add(CargoDto createDto)
{
var json = string.Empty;
string result = "NO";
if (createDto == null)
{
json = JsonEasyUIResult(, result);
return Content(json); }
try
{
var cargo = ObjectMapper.Map<CreateUpdateCargoDto>(createDto); // TODO: Add logic here
var obj = _cargoAppService.Create(cargo);
int id = obj.GetAwaiter().GetResult().Id;
if (obj != null)
{
json = JsonEasyUIResult(id, "OK"); }
else {
json = JsonEasyUIResult(,result); }
}
catch {
}
return Content(json); }

3.在Visual Studio 2017中按F5运行应用程序。

4.在浏览器中的地址栏中输入“http://localhost:5000/”,然后输入管理员用户名进行登录。

5.在主界面的菜单中,选择“Business->货物管理”菜单项,浏览器中呈现一个货物信息列表与四个按钮。如下图。关于菜单的生成可以参见文章(abp(net core)+easyui+efcore实现仓储管理系统——菜单-上 (十六)与 abp(net core)+easyui+efcore实现仓储管理系统——菜单-下(十七))。

6.新增货物:点击“添加”按钮,弹出一个“添加货物”的操作界面,如下图中所示。

7.在输入相应的货物信息之后,点击“保存”按钮 。在弹出的确认对话框中点击“确定”按钮。在弹出的“保存成功”确认对话框中点击“确定”按钮。

8.然后系统就没有任何反应,没有弹出任何提示信息,查询数据也没有发现添加新数据。我们在浏览器中按F12,然后发现原来报错了。如下图。

具体错误信息如下:

An unhandled exception occurred while processing the request.

AbpValidationException: Method arguments are not valid! See ValidationErrors for details.

Abp.Runtime.Validation.Interception.MethodInvocationValidator.ThrowValidationError() in MethodInvocationValidator.cs, line 118

9.原来是ABP的一个校验异常。ABP的两个特性EnableValidation和DisableValidation 用来控制validation。我们在Add方法上面添加两个特性[HttpPost]与[DisableValidation]。

[HttpPost]
[DisableValidation]
public ActionResult Add(CargoDto createDto) {… 代码见第2步。}

10.重新从第3步到第7步。这次保存成功。见下图。

abp(net core)+easyui+efcore实现仓储管理系统——EasyUI之货物管理六(二十四)的更多相关文章

  1. abp(net core)+easyui+efcore实现仓储管理系统——EasyUI之货物管理七(二十五)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...

  2. abp(net core)+easyui+efcore实现仓储管理系统——EasyUI之货物管理八(二十六)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...

  3. abp(net core)+easyui+efcore实现仓储管理系统——EasyUI之货物管理一 (十九)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...

  4. abp(net core)+easyui+efcore实现仓储管理系统——EasyUI之货物管理二 (二十)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...

  5. abp(net core)+easyui+efcore实现仓储管理系统——EasyUI之货物管理三 (二十一)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...

  6. abp(net core)+easyui+efcore实现仓储管理系统——EasyUI之货物管理四 (二十二)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...

  7. abp(net core)+easyui+efcore实现仓储管理系统——EasyUI之货物管理五 (二十三)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...

  8. abp(net core)+easyui+efcore实现仓储管理系统——EasyUI前端页面框架 (十八)

    目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+easyui+efcore实现仓储管理系统——解决方案介绍(二) ab ...

  9. abp(net core)+easyui+efcore实现仓储管理系统——ABP WebAPI与EasyUI结合增删改查之一(二十七)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...

随机推荐

  1. 【linux】【FastDFS】FastDFS数据迁移

    后来同步的时候发现有的没有同步过来,应该是没有同步完成我就停止服务了. 最后尝试直接把fastdfs storage的data文件迁移过去即可. 1.在新的storage server服务器上停止所有 ...

  2. centos使用android studio遇到的一些问题

    1.下载完成后进入bin目录启动 ./studio 2. 由于google被墙,SDK 下载不了, 照此教程添加下载源 http://jingyan.baidu.com/album/adc815137 ...

  3. 2018年蓝桥杯java b组第八题

    标题:日志统计 小明维护着一个程序员论坛.现在他收集了一份"点赞"日志,日志共有N行.其中每一行的格式是: ts id 表示在ts时刻编号id的帖子收到一个"赞" ...

  4. WinServer 2012 R2 安装python3.6时出现错误:0x80240017 导致安装失败

    解决方法: 依次检查并更新补丁:KB2919442,KB2919355,kb2999226 KB2919442:https://www.microsoft.com/zh-cn/download/det ...

  5. Spring 梳理-@Controller

    @Controller是一个构造性注解(stereotype),它基于@Component 在自动扫描中,组件扫描器会自动将@Controller申明的类注册为Spring应用上下文的一个bean 可 ...

  6. Unity - 存读档机制简析

    本文旨在于简要分析Unity中的两种存档机制,即:PlayerPrefs数据持久化方法及Serialization数据序列化方法 较比与源项目,我另加了JSON方法.XML方法等及一些Unity设置, ...

  7. Spring Cloud Config 配置中心实践过程中,你需要了解这些细节!

    本文导读: Spring Cloud Config 基本概念 Spring Cloud Config 客户端加载流程 Spring Cloud Config 基于消息总线配置 Spring Cloud ...

  8. Mybatis面试题吐血总结

    高强度训练第二十天总结:Mybatis面试题 什么是Mybatis? Mybatis 是一个半 ORM(对象关系映射)框架,它内部封装了 JDBC,开发时 只需要关注 SQL 语句本身,不需要花费精力 ...

  9. react redux 二次开发流程

    在一个大项目中如何引入redux及其相关技术栈(react-redux redux-thunk redux-immutable ),已经成为react前端工程师不可或缺的技能,下面通过实现一个简单的t ...

  10. Oracle 的 rownum 问题

    对于 Oracle 的 rownum 问题,很多资料都说不支持>,>=,=,between...and,只能用以上符号(<.<=.!=),并非说用>,>=,=,be ...