Cargo abp (net core) + easyui + efcore implement Warehouse Management System --EasyUI of a management (XIX)

abp (net core) + easyui + efcore implement warehouse management system directory

abp (net core) + easyui + efcore implement warehouse management system --ABP general introduction (a)

abp (net core) + easyui + efcore implement Warehouse Management System - Solutions Introduction (b)

abp (net core) + easyui + efcore implement warehouse management system - the domain layer created entity (c)

 abp (net core) + easyui + efcore implement warehouse management system - Define and implement storage (IV)

abp (net core) + easyui + efcore implement Warehouse Management System - Create application services (five)

abp (net core) + easyui + efcore implemented warehouse management system - to achieve the presentation layer of the CRUD controller (vi)

abp (net core) + easyui + efcore implement Warehouse Management System - the presentation layer to achieve CRUD the list view (seven)

abp (net core) + easyui + efcore implement Warehouse Management System - the presentation layer to achieve the CRUD CRUD view (eight)

abp (net core) + easyui + efcore implement Warehouse Management System - the presentation layer to achieve CRUD and test the menu (IX)

abp (net core) + easyui + efcore implement Warehouse Management System - Multilingual (X)

abp (net core) + easyui + efcore implemented Warehouse Management System - WEBAPI implemented CURD (XI)

 abp (net core) + easyui + efcore implement Warehouse Management System - WEBAPI achieve CURD (XII)

 abp (net core) + easyui + efcore implement Warehouse Management System - WEBAPI achieve CURD (XIII)

abp (net core) + easyui + efcore implement Warehouse Management System - WEBAPI achieve CURD (xiv)

 abp (net core) + easyui + efcore implement Warehouse Management System - WEBAPI achieve CURD (XV)

abp (net core) + easyui + efcore implement Warehouse Management System - menu - on (XVI)

 abp (net core) + easyui + efcore implement Warehouse Management System - menu - under (17) 

abp (net core) + easyui + efcore implement warehouse management system --EasyUI front page frame (XVIII)

 

 

      By Previous ( ABP (NET Core) + easyui + efcore implement warehouse management system --EasyUI front page frame (xviii) ) article, we have added to our EasyUI the project. Let's show the front end of a cargo information management functions, and create the appropriate use of entity classes, classes and other services to achieve back-office functions as the front page of UI controls by EasyUI.

Fourth, the entity created Cargo

    1. In Visual Studio 2017's "Solution Explorer", right-click "ABP.TPLMS.Core" project "Entitys" folder, the pop-up menu, select "Add">

 > "Class." Name the class Cargo, then select "Add."

    2. Create Cargo class inherits from Entity <int>, save to achieve by implementing the audit module IHasCreationTime created. code show as below:

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 = 0;
            this.SupplierId = 0;
            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 = 0;
            this.Height = 0;
            this.HSCode = string.Empty;
            this.Length = 0;

            this.MaxNum = 100;
            this.MinNum = 0;
            this.NetWt = 0;

            this.Package = string.Empty;
            this.Price = 0;
            this.Remark = string.Empty;

            this.Spcf = string.Empty;
            this.Unit = string.Empty;
            this.UpdateTime = DateTime.Now;

            this.UpdOper = string.Empty;
            this.Vol = 0;
            this.Width = 0;

        }

 

        public int SupplierId { get; set; }
        [StringLength(50)]
        public string CargoCode { get; set; }
        [StringLength(10)]
        public string HSCode { get; set; }

        [StringLength(250)]
        public string CargoName { get; set; }

        [StringLength(512)]
        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. Define the entity after good, we went to "ABP.TPLMS.EntityFrameworkCore" project "TPLMSDbContext" class definition entities corresponding DbSet, to apply the Code First Data Migration. Add the following code

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. From the menu "Tools -> Package Manager is the NuGet -> Package Manager console" menu.

    5. in the PMC, by default the item corresponding to item selection EntityframeworkCore. Enter the following command: Add-Migration AddEntityCargo, create a migration.

     6. After the above command completes, Once created, it creates the class file format at the time _AddEntityCargo Migrations folder, these codes are based on DbContext specified model. As shown below.

 

    7. Package Manager console, input Update-Database, Enter perform the migration. After successful execution, as shown below.

 

    8. View the database in SQL Server Management Studio, Cargos table created successfully.

 

 

Fifth, the definition of application service interface class being paged used

      In order to use during query, PagedCargoResultRequestDto goods is used to pass data to the query to the application layer.

     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(50)]
        public string CargoCode { get; set; }

        [StringLength(10)]
        public string HSCode { get; set; }

        [StringLength(250)]
        public string CargoName { get; set; }

        [StringLength(512)]
        public string Spcf { get; set; }

        [StringLength(20)]
        public string Unit { get; set; }
        [StringLength(20)]
        public string Country { get; set; }

        [StringLength(50)]
        public string Brand { get; set; }

        [StringLength(20)]
        public string Curr { get; set; }

        [StringLength(50)]
        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(2048)]
        public string Remark { get; set; } 
        public DateTime CreationTime { get; set; }

        public DateTime UpdateTime { get; set; }
        [StringLength(50)]
        public string UpdOper { get; set; }
    }
}

 

 

Guess you like

Origin www.cnblogs.com/chillsrc/p/11573043.html