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实现仓储管理系统——使用 WEBAPI实现CURD (十二)

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

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

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

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

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

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

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

通过上一篇文章(abp(net core)+easyui+efcore实现仓储管理系统——EasyUI之货物管理一 (十九))中,我们已经将创建了货物信息实体 与查询所用到的分页类。下面我们来实现货物信息管理功能所需要的服务类与控制器类,页面呈现。

六、定义ICargoAppService接口

6. 在Visual Studio 2017的“解决方案资源管理器”中,鼠标右键单击“Cargos”文件夹,然后选择“添加” > “新建项”,在弹出对话框中选择“接口”。为应用服务定义一个名为 ICargoAppService 的接口。代码如下。

using Abp.Application.Services;
using ABP.TPLMS.Cargos.Dto;
using System;
using System.Collections.Generic;
using System.Text; namespace ABP.TPLMS.Cargos
{ public interface ICargoAppService : IAsyncCrudAppService<//定义了CRUD方法
CargoDto, //用来展示货物信息
int, //Cargo实体的主键
PagedCargoResultRequestDto, //获取货物信息的时候用于分页
CreateUpdateCargoDto, //用于创建货物信息
CreateUpdateCargoDto> //用于更新货物信息
{ }
}

七、实现ICargoAppService

7.在Visual Studio 2017的“解决方案资源管理器”中,右键单击“Cargos”文件夹,然后选择“添加” > “新建项”,在弹出对话框中选择“类”。为应用服务定义一个名为 CargoAppService 的服务类。代码如下。

using Abp.Application.Services;
using Abp.Domain.Repositories;
using ABP.TPLMS.Entitys;
using ABP.TPLMS.Cargos.Dto;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks; namespace ABP.TPLMS.Cargos
{
public class CargoAppService :AsyncCrudAppService<Cargo, CargoDto, int, PagedCargoResultRequestDto,
CreateUpdateCargoDto, CreateUpdateCargoDto>,ICargoAppService {
public CargoAppService(IRepository<Cargo, int> repository)
: base(repository) { } }
}

八 创建CargoController继承自TPLMSControllerBase

1. 在Visual Studio 2017的“解决方案资源管理器”中,右键单击在领域层“ABP.TPLMS.Web.Core”项目中的Controller目录。 找到TPLMSControllerBase文件,添加一个新的方法JsonEasyUI。此方法的功能是实现对实体对象进行序列化为JSON字符串,并且JSON字符串的格式符合EasyUI的DataGrid要求的数据格式。代码如下。

protected dynamic JsonEasyUI(dynamic t,int total)
{ var obj= new
{
total = total,
rows = t
}; var json = Json(obj);
return json;
}

2. 在Visual Studio 2017的“解决方案资源管理器”中,右键单击在领域层“ABP.TPLMS.Web.Mvc”项目中的Controller目录。 选择“添加” > “新建项…”。如下图。

3. 在弹出对话框“添加新项-ABP.TPLMS.Web.Mvc”中选择“控制器类”,然后在名称输入框中输入“CargoController”,然后点击“添加”按钮。如下图。

4.在CargoController.cs文件中输入如下代码,通过构造函数注入对应用服务的依赖。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Abp.Application.Services.Dto;
using Abp.AspNetCore.Mvc.Authorization;
using Abp.Runtime.Validation;
using ABP.TPLMS.Controllers;
using ABP.TPLMS.Cargos;
using ABP.TPLMS.Cargos.Dto;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; namespace ABP.TPLMS.Web.Controllers
{ [AbpMvcAuthorize]
public class CargoController : TPLMSControllerBase
{
const int MaxNum= ;
// GET: /<controller>/
public IActionResult Index()
{ ViewData["SupplierId"] = "";
return View();
} private readonly ICargoAppService _cargoAppService; public CargoController(ICargoAppService cargoAppService)
{
_cargoAppService = cargoAppService; } public JsonResult List()
{ var page = Request.Form["page"].ToString();
var size = Request.Form["rows"].ToString(); int pageIndex = page == null ? : int.Parse(page); int pageSize = size == null ? : int.Parse(size); PagedCargoResultRequestDto paged = new PagedCargoResultRequestDto();
paged.MaxResultCount = pageSize;
paged.SkipCount = ((pageIndex-)<?: pageIndex - ) * pageSize;
var userList = _cargoAppService.GetAll(paged).GetAwaiter().GetResult().Items; int total = ;
var json = JsonEasyUI(userList,total); return json;
}
}
}

九、使用EasyUI创建货物管理页面

1. 在Visual Studio 2017的“解决方案资源管理器”中,右键单击在领域层“ABP.TPLMS.Web.Mvc”项目中的Views目录。 选择“添加” > “新建文件夹”。并重命名为“Cargo”。

2. 在Visual Studio 2017的“解决方案资源管理器”中,鼠标右键单击“Cargo”文件夹,然后选择“添加” > “新建项…”。 在“添加新项-ABP.TPLMS.Web.Mvc”对话框中,选择“Razor视图”,并将名称命名为Index.cshmtl。

3. 在我们刚才创建的Index.cshmtl文件中,编写如下代码:

@using ABP.TPLMS.Web.Startup
@{ ViewData["Title"] = PageNames.Cargo;
} @section scripts
{
<script src="~/view-resources/Views/Cargo/cargomgr.js" asp-append-version="true"></script>
<script type="text/javascript">
$(function () {
initable();
init();
reloaded();
updCargoInfo();
showCargoDialog();
deleteCargo();
});
</script>
}
<div data-options="region:'center'" style="overflow: hidden;">
<div id="containter" style="width: 1000px; height: auto; margin: 0px auto;">
<!--toolbar-->
<div style="margin-bottom:1px;font-weight:bold;">
<a href="#" id="add" class="easyui-linkbutton" data-options="iconCls:'icon-add'"
style="width:100px; height:30px; ">添加</a>
<a href="#" id="del" class="easyui-linkbutton" data-options="iconCls:'icon-remove'"
style="width:100px; height:30px; ">删除</a>
<a href="#" id="edit" class="easyui-linkbutton" data-options="iconCls:'icon-edit'"
style="width:100px; height:30px; ">修改</a>
<a href="#" id="reload" class="easyui-linkbutton" data-options="iconCls:'icon-reload'"
style="width:100px; height:30px; ">刷新</a>
</div>
<!--panel-->
<div data-options="region:'center',split:false" style="height:500px;">
<!--表格--> <table id="dgCargo"></table> </div> </div>
</div>
<!---------------------------新增修改货物信息----------------------------> <div id="divAddUpdCargo" class="easyui-dialog" closed="true" data-options="buttons: '#dlg-buttons'"> <table>
<tr>
<td><input type="hidden" name="ID" id="IDUpdate" /></td> </tr>
<tr>
<td>供应商:</td>
<td>
<input type="text" id="SupplierIdUpdate" name="USupplierId"
class="form-control input-sm" value=@ViewData["SupplierId"].ToString() /> </td>
<td> 货物代码:</td>
<td><input type="text" id="UpdCargoCode" name="UCargoCode"
class="form-control input-sm" /></td>
<td>货物名称:</td>
<td>
<input type="text" id="CargoNameUpdate" name="UCargoName" class="form-control input-sm" />
</td>
</tr>
<tr>
<td>品牌:</td>
<td>
<input type="text" id="BrandUpdate" name="UBrand" class="form-control input-sm" /> </td>
<td> 规格型号:</td>
<td colspan=""><input type="text" id="SpcfUpdate" name="USpcf"
class="form-control input-sm" /></td>
</tr>
<tr>
<td>HSCode:</td>
<td>
<input type="text" id="HSCodeUpdate" name="UHSCode" class="form-control input-sm" /> </td>
<td>单价:</td>
<td>
<input type="number" id="PriceUpdate" name="UPrice" class="form-control input-sm" /> </td>
<td> 计量单位:</td>
<td><input type="text" id="UnitUpdate" name="UUnit" class="form-control input-sm" /></td> </tr>
<tr>
<td>货币:</td>
<td>
<input type="text" id="CurrUpdate" name="UCurr" class="form-control input-sm" />
</td>
<td>包装:</td>
<td>
<input type="text" id="PackageUpdate" name="UPackage" class="form-control input-sm" />
</td>
<td>体积:</td>
<td>
<div class="input-group">
<input type="text" id="VolUpdate" name="UVol" class="form-control input-sm" readonly />
<span class="input-group-addon" id="basic-addon2">立方米</span> </div>
</td>
</tr>
<tr>
<td> 长:</td>
<td> <div class="input-group">
<input type="number" id="LengthUpdate" name="ULength"
class="form-control input-sm" aria-describedby="basic-addon2">
<span class="input-group-addon" id="basic-addon2">cm *</span>
</div>
</td>
<td>宽:</td>
<td>
<div class="input-group"> <input type="number" id="WidthUpdate" name="UWidth"
class="form-control input-sm" aria-describedby="basic-addon2">
<span class="input-group-addon" id="basic-addon2">cm * </span> </div>
</td>
<td>高:</td>
<td>
<div class="input-group">
<input type="number" id="HeightUpdate" name="UHeight"
class="form-control input-sm" aria-describedby="basic-addon2">
<span class="input-group-addon" id="basic-addon2">cm</span>
</div>
</td>
</tr>
<tr>
<td>毛重:</td>
<td>
<input type="number" id="GrossWtUpdate" name="UGrossWt" class="form-control input-sm" />
</td>
<td> 净重:</td>
<td><input type="number" id="NetWtUpdate" name="UNetWt" class="form-control input-sm" /></td> <td>国家:</td>
<td>
<input type="text" id="CountryUpdate" name="UCountry" class="form-control input-sm" /> </td>
</tr>
<tr>
<td>安全库存:</td> <td>
<input type="number" id="MinNumUpdate" name="UMinNum" class="form-control input-sm" /> </td>
<td> 最大库存:</td> <td><input type="number" id="MaxNumUpdate" name="UMaxNum" class="form-control input-sm" /></td> <td>创建时间:</td>
<td>
<input type="text" id="CreateTimeUpdate" name="UCreateTimey" class="form-control input-sm" /> </td>
</tr>
<tr>
<td>备注:</td> <td colspan="">
<input type="text" id="RemarkUpdate" name="URemark" class="form-control input-sm" /> </td>
</tr>
</table>
</div> <div id="dlg-buttons">
<input type="submit" id="btnSave" value="保存" class="btn btn-primary" />
<input type="submit" id="btnCancle" value="取消" class="btn btn-info" />
</div>

4. 在Visual Studio 2017的“解决方案资源管理器”中,找到“ABP.TPLMS.Web.Mvc”项目中的Startup目录。 选择“PageNames.cs”文件,并双击打开。写入以下代码。

        public const string Cargo = "Cargo";

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. 利用ShardingSphere-JDBC实现分库分表--配置中心的实现

    在之前的文章中我详细描述了如何利用ShardingSphere-JDBC进行分库分表,同时也实现了简单的精确分库算法接口,详情见下面的链接: 利用ShardingSphere-JDBC实现分库分表 但 ...

  2. 人员考勤,MySQLl数据库一个表自动生成3表筛选人员迟到早退缺勤

    前言:漂亮的人事小姐姐找我帮忙弄考勤:由于人员考勤和门禁一起,打卡记录太多,打卡机只能导出一个打卡Excel总表,不容易人工筛选. Excel表的格式是这样的:(这里101代替真实人名) 实现目标: ...

  3. Immutable Object模式 - 多线程

    Immutable Object模式 - 多线程 前言 在多线程编程中,我们常会碰到修改一个对象的值,如果在不加锁的情况下 ,就会出现值不一致的问题,那么有没有一种方式可以不通过加锁的方式也可以保证数 ...

  4. spring-cloud-kubernetes的服务发现和轮询实战(含熔断)

    本文是<spring-cloud-kubernetes实战系列>的第四篇,主要内容是在kubernetes上部署两个应用:Web-Service和Account-Service,通过spr ...

  5. 怎样用QT在windows环境通过编程卸载installShield打包的程序

    通常情况下,如果是一个完备的软件,我们可以通过启动软件的uninstaller.exe之类的程序来完成卸载.但是使用installShield打包的程序,本身可能并不含有这类卸载程序.此时,我们可以通 ...

  6. 体验SpringCloud Gateway

    Spring Cloud Gateway是Spring Cloud技术栈中的网关服务,本文实战构建一个SpringCloud环境,并开发一个SpringCloud Gateway应用,快速体验网关服务 ...

  7. 【Jmeter】- 使用 jmeter 进行 dubbo 接口测试

    大家都知道 dubbo 是一个优秀 rpc 框架,它一般(dubbox 除外)通过对外提供 tcp协议的接口进行外部调用.而我们日常使用的测试工具 jmeter 并不支持 dubbo 协议的请求.所以 ...

  8. java Spring-Boot框架学习视频-百度云盘

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明.本文链接:https://blog.csdn.net/lk142500/article/deta ...

  9. Java入门指南-02 变量

    一.回顾上一篇讲到了常用的DOS命令.如何创建第一个程序.打印.注释与空白. 那么我们已经学会了使用System.out.println() 可以来输出一个值.进一步的,我们可以用它来显示简单的算术运 ...

  10. Treap + 无旋转Treap 学习笔记

    普通的Treap模板 今天自己实现成功 /* * @Author: chenkexing * @Date: 2019-08-02 20:30:39 * @Last Modified by: chenk ...