abp(net core)+easyui+efcore实现仓储管理系统——入库管理之一(三十七)
abp(net core)+easyui+efcore实现仓储管理系统目录
abp(net core)+easyui+efcore实现仓储管理系统——EasyUI前端页面框架 (十八)
abp(net core)+easyui+efcore实现仓储管理系统——ABP WebAPI与EasyUI结合增删改查之八(三十四)
一.前言
通过前面的文章( abp(net core)+easyui+efcore实现仓储管理系统——ABP WebAPI与EasyUI结合增删改查之一(二十七)至abp(net core)+easyui+efcore实现仓储管理系统——ABP WebAPI与EasyUI结合增删改查之十(三十六))的学习,我们已经有实现了使用ABP提供的WebAPI方式+EasyUI来实现增删改查的功能。之前我们把一些基本的信息已经完成了,如货物信息,供应商信息。有了前面的基础信息,我们可以实现入库管理功能。从本章开始我们来学习一个入库单功能,这个将会涉及DataGrid的主从功能。
二、入库单的流程
1.一般情况下会有一个前置的OMS系统——即订单管理系统。主要功能之一是由供应商填写送货单。
如果公司有货代、仓储、运输等业务,或者是给某些大型客户(例如宜家、联想等)做第三方的物流服务,那么在做物流系统时入库单流程时,需要考虑入库单的前置流程——订单管理系统。
订单管理系统(OMS)是物流信息管理系统的一部分,通过对客户下达的订单进行管理及跟踪,动态掌握订单的进展和完成情况,提升物流过程中的作业效率,从而节省运作时间和作业成本,提高物流企业的市场竞争力。顾名思义,订单管理系统是物流企业用户、供应商用户、客户对于订单的管控、跟踪的系统,衔接着WMS、运输管理系统、订舱系统等,是物流信息管理系统的基础模块。
简单地说订单管理系统作为整个物流信息管理系统的基础核心,管理着所有的交易进出。一个好的订单管理系统需要有很好地扩展性和流畅性,在一个物流信息管理系统从0-1的过程,订单管理系统作为其基础模块需要提前考虑到各系统的扩展,订单管理系统如果在前期就能考虑到后面的扩展,相信对于物流企业的壮大会非常有帮助。
流畅性指的是整个交易链路需要很流畅,早期公司做订单系统时,想的很复杂,想做的很全面,最后做的非常庞大,但是却没有考虑到整个物流流程的通畅性,导致连基础的订单流程都没有办法正常走下去,所以,在从0到1地做一套订单管理系统时,需要有一些前瞻性,但落地时,需要先实现一个可以把整个流程走下去的简单的订单管理系统,然后不断的去试错->改进。
2.当运输公司把货物送到仓库时,仓库会有检验员进行抽检,并制作入库单,分配库位,然后打印标签,粘贴条码标签,分配托盘,核验条码标签,货物上架,并在系统中对入库单进行审核通过。整个流程如下图。

当然我们接下来要实现的入库单功能,没有这么复杂。 我们没有实现订单管理系统,这个有时间后面补上。
三、创建入库单实体
1. 做为一个入库单,在数据库中一般存在三张表,表头InStockOrder,表体InStockDetail、库位表InStockDetailLoc。
2.在Visual Studio 2017的“解决方案资源管理器”中,右键单击“ABP.TPLMS.Core”项目的“Entitys”文件夹,在弹出菜单中选择“添加” >
> “类”。 将类命名为 InStockOrder,然后选择“添加”。
3.创建InStockOrder类继承自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 InStockOrder : Entity<int>, IHasCreationTime
{ public const int MaxLength = ;
public InStockOrder() { No = string.Empty;
CustomerCode = string.Empty;
CustomerName = string.Empty;
WarehouseNo = string.Empty;
WarehouseType = string.Empty;
DeliveryNo = string.Empty;
Receiver = string.Empty;
ReceiveTime = string.Empty;
CreationTime = DateTime.Now; Oper = string.Empty;
Checker = string.Empty; CheckTime = string.Empty;
Gwt = ;
Nwt = ;
PackageNum = ;
OwnerCode = string.Empty;
OwnerName = string.Empty; Remark = string.Empty;
Status = ;
PreDeliveryTime = string.Empty; } [StringLength()]
[Required]
public string No { get; set; } /// <summary>
/// 客户名称
/// </summary>
[StringLength(MaxLength)]
[Required]
public string CustomerName { get; set; }
public string WarehouseType { get; set; } /// <summary>
/// 客户代码
/// </summary>
[StringLength()]
[Required]
public string CustomerCode { get; set; } /// <summary>
/// 送货单号
/// </summary>
public string DeliveryNo { get; set; } /// <summary>
/// 仓库号
/// </summary>
public string WarehouseNo { get; set; } /// <summary>
/// 货主
/// </summary>
[StringLength(MaxLength)] [Required]
public string OwnerName { get; set; } public decimal Gwt { get; set; }
public decimal Nwt { get; set; }
public int PackageNum { get; set; } /// <summary>
/// 接收时间
/// </summary>
[StringLength()]
public string ReceiveTime { get; set; }
/// <summary>
/// 接收人
/// </summary>
[StringLength()]
public string Receiver { get; set; } [StringLength()]
public string Oper { get; set; }
public int Status { get; set; } [StringLength()]
public string OwnerCode { get; set; } /// <summary>
/// 预计送货时间
/// </summary>
[StringLength()]
public string PreDeliveryTime { get; set; } /// <summary>
/// 审核人
/// </summary>
[StringLength()]
public string Checker { get; set; } [StringLength()]
public string CheckTime { get; set; } [StringLength()]
public string Remark { get; set; }
public DateTime CreationTime { get; set; } [StringLength()]
public string LastUpdateTime { get; set; } [StringLength()]
public string LastOper { get; set; } [NotMapped]
public List<InStockOrderDetail> InStockOrderDetail { get; set; }
}
}
4.重得第2,3步,我们在“ABP.TPLMS.Core”项目的“Entitys”文件夹,依次创建InStockOrderDetail与InStockOrderDetailLoc两个类。代码如下:
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 InStockOrderDetail : Entity<int>, IHasCreationTime
{ public const int MaxLength = ;
public InStockOrderDetail()
{ this.Qty = ;
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.SecdLawfQty = ;
this.LawfQty = ;
this.NetWt = ;
this.Package = string.Empty; this.Price = ;
this.Spcf = string.Empty;
this.Unit = string.Empty; this.InStockNo = string.Empty;
this.LawfUnit = string.Empty; this.Vol = ;
this.Width = ;
this.LawfUnit = string.Empty;
this.SecdLawfUnit = string.Empty;
this.SeqNo = ; this.Batch = string.Empty;
this.DeliveryOrderDetailId = ; } public int SupplierId { get; set; }
[MaxLength()]
public string CargoCode { get; set; }
[MaxLength()]
public string HSCode { get; set; }
[MaxLength(MaxLength)] public string CargoName { get; set; }
[MaxLength(MaxLength)]
public string Spcf { get; set; }
[MaxLength()]
public string Unit { get; set; }
[MaxLength()] public string Country { get; set; }
[MaxLength()]
public string Brand { get; set; }
[MaxLength()]
public string Curr { get; set; }
[MaxLength()]
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 Price { get; set; }
public decimal TotalAmt { get; set; }
public decimal GrossWt { get; set; } public decimal NetWt { get; set; } public DateTime CreationTime { get; set; } [MaxLength()]
public string InStockNo { get; set; }
public int SeqNo { get; set; }
public decimal Qty { get; set; }
public decimal LawfQty { get; set; } public decimal SecdLawfQty { get; set; } [MaxLength()] public string LawfUnit { get; set; }
[MaxLength()]
public string SecdLawfUnit { get; set; }
[MaxLength()]
public string Batch { get; set; }
public int DeliveryOrderDetailId { get; set; } [NotMapped]
public List<InStockOrderDetailLoc> InStockOrderDetailLoc { get; set; } }
}
using Abp.Domain.Entities;
using Abp.Domain.Entities.Auditing;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text; namespace ABP.TPLMS.Entitys
{ public class InStockOrderDetailLoc : Entity<int>, IHasCreationTime
{ public InStockOrderDetailLoc()
{ this.Qty = ;
this.SeqNo = ;
this.Loc = string.Empty;
this.CreationTime = DateTime.Now;
this.InStockOrderDetailId = ;
}
public int InStockOrderDetailId { get; set; }
public int SeqNo { get; set; }
[StringLength()] public string Loc { get; set; }
public decimal Qty { get; set; }
public DateTime CreationTime { get; set; }
}
}
5.定义入库单的实体之后,我们去“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; }
public DbSet<Org> Orgs { get; set; } public virtual DbSet<InStockOrder> InStockOrder { get; set; }
public virtual DbSet<InStockOrderDetail> InStockOrderDetail { get; set; }
public virtual DbSet<InStockOrderDetailLoc> InStockOrderDetailLoc { get; set; }
}
}
6.从菜单中选择“工具->NuGet包管理器器—>程序包管理器控制台”菜单。
7. 在PMC中,默认项目选择EntityframeworkCore对应的项目后。输入以下命令:Add-Migration AddEntityInStock,创建迁移。如下图。

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

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

10. 在SQL Server Management Studio中查看数据库,InStockOrder、InStockOrderDetail、InStockOrderDetailLoc三张表创建成功。

abp(net core)+easyui+efcore实现仓储管理系统——入库管理之一(三十七)的更多相关文章
- abp(net core)+easyui+efcore实现仓储管理系统——入库管理之四(四十)
abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...
- abp(net core)+easyui+efcore实现仓储管理系统——入库管理之五(四十一)
abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...
- abp(net core)+easyui+efcore实现仓储管理系统——入库管理之六(四十二)
abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...
- abp(net core)+easyui+efcore实现仓储管理系统——入库管理之七(四十三)
abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...
- abp(net core)+easyui+efcore实现仓储管理系统——入库管理之八(四十四)
abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...
- abp(net core)+easyui+efcore实现仓储管理系统——入库管理之九(四十五)
abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...
- abp(net core)+easyui+efcore实现仓储管理系统——入库管理之十(四十六)
abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...
- abp(net core)+easyui+efcore实现仓储管理系统——入库管理之十一(四十七)
abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...
- abp(net core)+easyui+efcore实现仓储管理系统——入库管理之十二(四十八)
abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...
随机推荐
- OpenStack Identity API v3 extensions (CURRENT)
Table Of Contents Identity API v3 extensions (CURRENT) OS-ENDPOINT-POLICY API Associate policy and e ...
- BFC 是什么东西?
以下是本人理解的 BFC 和 官方文档BFC资料 . BFC 是页面元素的隐藏属性,全称 : Block Formatting Context 作用: 可以清除子元素浮动后不良效果在线效果地址:ht ...
- 序言vue.js介绍
vue.js :渐进式JavaScript框架 vue.js 优点 1.体积小 例如:压缩后 33k; 2.更高的运行效率 基于虚拟dom,一种可以预先通过JavaScript进行各种计算,把最终的D ...
- 质数的判定 Miller_Rabin
----------- 10^18 #include <bits/stdc++.h> #define min(a,b) ((a)<(b)?(a):(b)) #define max(a ...
- mysql复习2
-- 1. 创建和管理表 CREATE TABLE -- 方式一:CREATE TABLE emp1( id INT(10), `name` VARCHAR(20), salary DOUBLE(10 ...
- 安全检测检查清单(Web)网站
(一) 检查项:弱锁定机制 优先级:高 检查要点:检查系统帐号锁定机制健壮性 检查方法: 1.尝试使用错误的密码登录5次,查看账户是否被锁定2.等待10分钟再次测试,确认该用户是否还处于锁定状态 (二 ...
- spring boot的日常配置
配置篇 #数据库连接配置msql spring.datasource.url:jdbc:mysql://127.0.0.1:3306/test spring.datasource.username: ...
- elasticsearch为什么比mysql快
mysql关系型数据库索引原理 数据库的索引是B+tree结构 主键是聚合索引 其他索引是非聚合索引,先从非聚合索引找,见下图 elasticsearch倒排索引原理 两者对比 对于倒排索引,要分两种 ...
- ls命名 | Linux统计文件夹内的文件个数
ls命名 man ls -R 递归列出全部的目录内容 recusive -a 列出所有的文件(包括以 . 开头的隐藏文件) all -r 逆序排列 reverse -t 按照时间信息排序 time - ...
- Python通过win32 com接口实现offic自动化
最近几天通过Python做一些自动生成office报表的东东,比如解析.xml文件,导出.html/WORD/PPT等格式,html不足一提,只需要简单的html静态网页知识即可,这儿要说的是怎么生成 ...