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前端页面框架 (十八))文章,我们已经将EasyUI添加到我们的项目中了。下面我们通过EasyUI做为前端页面的UI控件来展现一个货物信息管理的前端功能,并使用创建相应的实体类,服务类等来实现后台功能。

四、创建Cargo实体

1. 在Visual Studio 2017的“解决方案资源管理器”中,右键单击“ABP.TPLMS.Core”项目的“Entitys”文件夹,在弹出菜单中选择“添加” >

> “类”。 将类命名为 Cargo,然后选择“添加”。

2.创建Cargo类继承自Entity<int>,通过实现审计模块中的IHasCreationTime来实现保存创建时间。代码如下:

using Abp.Domain.Entities;
using Abp.Domain.Entities.Auditing;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text; namespace ABP.TPLMS.Entitys
{ public class Cargo : Entity<int>, IHasCreationTime
{ public Cargo()
{ this.Id = ;
this.SupplierId = ;
this.CargoCode = string.Empty;
this.CargoName = string.Empty;
this.Brand = string.Empty;
this.Country = string.Empty;
this.CreationTime = DateTime.Now;
this.Curr = string.Empty; this.GrossWt = ;
this.Height = ;
this.HSCode = string.Empty;
this.Length = ; this.MaxNum = ;
this.MinNum = ;
this.NetWt = ; this.Package = string.Empty;
this.Price = ;
this.Remark = string.Empty; this.Spcf = string.Empty;
this.Unit = string.Empty;
this.UpdateTime = DateTime.Now; this.UpdOper = string.Empty;
this.Vol = ;
this.Width = ; } public int SupplierId { get; set; }
[StringLength()]
public string CargoCode { get; set; }
[StringLength()]
public string HSCode { get; set; } [StringLength()]
public string CargoName { get; set; } [StringLength()]
public string Spcf { get; set; }
public string Unit { get; set; } public string Country { get; set; }
public string Brand { get; set; } public string Curr { get; set; }
public string Package { get; set; }
public decimal Length { get; set; } public decimal Width { get; set; }
public decimal Height { get; set; }
public decimal Vol { get; set; } public decimal MinNum { get; set; }
public decimal MaxNum { get; set; } public decimal Price { get; set; }
public decimal GrossWt { get; set; } public decimal NetWt { get; set; }
public string Remark { get; set; } public DateTime CreationTime { get; set; }
public DateTime UpdateTime { get; set; }
public string UpdOper { get; set; } } }

3.定义好实体之后,我们去“ABP.TPLMS.EntityFrameworkCore”项目中的“TPLMSDbContext”类中定义实体对应的DbSet,以应用Code First 数据迁移。添加以下代码

using Microsoft.EntityFrameworkCore;
using Abp.Zero.EntityFrameworkCore;
using ABP.TPLMS.Authorization.Roles;
using ABP.TPLMS.Authorization.Users;
using ABP.TPLMS.MultiTenancy; using ABP.TPLMS.Entitys; namespace ABP.TPLMS.EntityFrameworkCore
{
public class TPLMSDbContext : AbpZeroDbContext<Tenant, Role, User, TPLMSDbContext>
{ /* Define a DbSet for each entity of the application */ public TPLMSDbContext(DbContextOptions<TPLMSDbContext> options)
: base(options)
{
} public DbSet<Module> Modules { get; set; }
public DbSet<Supplier> Suppliers { get; set; }
public DbSet<Cargo> Cargos { get; set; } }
}

4.从菜单中选择“工具->NuGet包管理器器—>程序包管理器控制台”菜单。

5. 在PMC中,默认项目选择EntityframeworkCore对应的项目后。输入以下命令:Add-Migration AddEntityCargo,创建迁移。

6. 在上面的命令执行完毕之后,创建成功后,会在Migrations文件夹下创建时间_AddEntityCargo格式的类文件,这些代码是基于DbContext指定的模型。如下图。

7.在程序包管理器控制台,输入Update-Database,回车执行迁移。执行成功后,如下图。

8. 在SQL Server Management Studio中查看数据库,Cargos表创建成功。

五、定义应用服务接口需要用到的分页类

为了在进行查询时使用, PagedCargoResultRequestDto被用来将货物查询条件的数据传递到给应用层.

1. 在Visual Studio 2017的“解决方案资源管理器”中,右键单击“ABP.TPLMS.Application”项目,在弹出菜单中选择“添加” > “新建文件夹”,并重命名为“Cargos”

2. 使用鼠标右键单击我们刚才创建的“Cargos”文件夹,在弹出菜单中选择“添加” > “新建文件夹”,并重命名为“Dto”。

3.右键单击“Dto”文件夹,然后选择“添加” > “类”。 将类命名为 Paged CargoResultRequestDto,然后选择“添加”。代码如下。

using Abp.Application.Services.Dto;
using System;
using System.Collections.Generic;
using System.Text; namespace ABP.TPLMS.Cargos.Dto
{
public class PagedCargoResultRequestDto : PagedResultRequestDto
{ public string Keyword { get; set; }
}
}

4.右键单击“Dto”文件夹,然后选择“添加” > “类”。 将类命名为 CargoDto,然后选择“添加”。代码如下。

using Abp.Application.Services.Dto;
using Abp.AutoMapper;
using ABP.TPLMS.Entitys;
using System;
using System.Collections.Generic;
using System.Text; namespace ABP.TPLMS.Cargos.Dto
{ [AutoMapFrom(typeof(Cargo))]
public class CargoDto:EntityDto<int>
{ public int SupplierId { get; set; }
public string CargoCode { get; set; }
public string HSCode { get; set; } public string CargoName { get; set; } public string Spcf { get; set; }
public string Unit { get; set; }
public string Country { get; set; } public string Brand { get; set; } public string Curr { get; set; }
public string Package { get; set; }
public decimal Length { get; set; }
public decimal Width { get; set; } public decimal Height { get; set; }
public decimal Vol { get; set; } public decimal MinNum { get; set; }
public decimal MaxNum { get; set; }
public decimal Price { get; set; }
public decimal GrossWt { get; set; } public decimal NetWt { get; set; } public string Remark { get; set; }
public DateTime CreationTime { get; set; } public DateTime UpdateTime { get; set; }
public string UpdOper { get; set; } }
}

5.右键单击“Dto”文件夹,然后选择“添加” > “类”。 将类命名为 CreateUpdateCargoDto,然后选择“添加”。代码如下。

using Abp.Application.Services.Dto;
using Abp.AutoMapper;
using ABP.TPLMS.Entitys;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text; namespace ABP.TPLMS.Cargos.Dto
{ [AutoMapTo(typeof(Cargo))]
public class CreateUpdateCargoDto : EntityDto<int>
{ public int SupplierId { get; set; }
[StringLength()]
public string CargoCode { get; set; } [StringLength()]
public string HSCode { get; set; } [StringLength()]
public string CargoName { get; set; } [StringLength()]
public string Spcf { get; set; } [StringLength()]
public string Unit { get; set; }
[StringLength()]
public string Country { get; set; } [StringLength()]
public string Brand { get; set; } [StringLength()]
public string Curr { get; set; } [StringLength()]
public string Package { get; set; } public decimal Length { get; set; }
public decimal Width { get; set; }
public decimal Height { get; set; }
public decimal Vol { get; set; } public decimal MinNum { get; set; }
public decimal MaxNum { get; set; }
public decimal Price { get; set; }
public decimal GrossWt { get; set; }
public decimal NetWt { get; set; }
[StringLength()]
public string Remark { get; set; }
public DateTime CreationTime { get; set; } public DateTime UpdateTime { get; set; }
[StringLength()]
public string UpdOper { get; set; }
}
}

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实现仓储管理系统——出库管理之二(五十)

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

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

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

随机推荐

  1. 建立apk定时自动打包系统第三篇——代码自动更新、APP自动打包系统

    我们的思路是每天下班后团队各成员在指定的时间(例如下午18:30)之前把各自的代码上传到SVN,然后服务器在指定的时间(例如下午18:30)更新代码.执行ant 打包命令.最后将apk包存放在指定目录 ...

  2. helm安装kafka集群并测试其高可用性

    介绍 Kafka是由Apache软件基金会开发的一个开源流处理平台,由Scala和Java编写.Kafka是一种高吞吐量的分布式发布订阅消息系统,它可以处理消费者在网站中的所有动作流数据. 这种动作( ...

  3. Windows上快捷登陆应用程序

    在Windows上有些程序双击后,还需要输入用户名密码等,填写很多信息后才开始使用. 有些程序本身实现了保存信息,或者可以自动登陆. 但也有些程序无信息保存和自动登陆功能,如果经常使用,每次都填写觉得 ...

  4. 存储型XSS的发现经历和一点绕过思路

    再次骚扰 某SRC提现额度竟然最低是两千,而已经有750的我不甘心呐,这不得把这2000拿出来嘛. 之后我就疯狂的挖这个站,偶然发现了一个之前没挖出来的点,还有个存储型XSS! 刚开始来到这个之前挖过 ...

  5. vector function trmplate

    /* vector function template programmer:qpz */ #include <iostream> #include <vector> #def ...

  6. unity编辑器扩展_06(给选项添加快捷键,控制菜单是否启用)

    代码: [MenuItem("Tools/Delete ", true, 1)]    static bool DeleteVadidate()    {        if (S ...

  7. 《Java 编写基于 Netty 的 RPC 框架》

    一 简单概念 RPC: ( Remote Procedure Call),远程调用过程,是通过网络调用远程计算机的进程中某个方法,从而获取到想要的数据,过程如同调用本地的方法一样. 阻塞IO :当阻塞 ...

  8. [翻译] .NET Core 3.0 Preview 9 发布

    原文: Announcing .NET Core 3.0 Preview 9 今天,我们宣布推出 .NET Core 3.0 Preview 9.就像 Preview 8 一样,我们专注于打磨 .NE ...

  9. [python]多元赋值

    1. 简介 将多个变量同时赋值的方法,称为多元赋值. 2. 示例一: x, y, z = 1, 2, 'a string' print x, y, z 运行结果: 1 2 a string

  10. 2018CCPC 吉林现场赛 赛后总结

    一直以来都没有比赛完写总结的习惯,导致前面几次比赛都没有写过总结. 这是我写的第一场总结把,有时间有想法还记得细节的话再把前面几次比赛的总结给补上把. 热身赛: 热身赛的时候,写的比较急想着快点做出题 ...