出库单的功能。能学习了出库单管理之后,WMS的 最基本的功能算是完成了。当然一个成熟的WMS还包括了盘点,报表,策略规则,移库功能及与其他系统(ERP、TMS等)的接口,实现无缝集成,打破信息孤岛,让数据实时、准确和同步。

二、出库单的流程

    1.一般情况下会有一个前置的OMS系统——即订单管理系统。主要功能之一是由客户填写订单。

      2.客户把订单下第三方物流公司时,第三方物流公司会生成出货单推送到仓库时,系统会自动生成拣货单,理货员根据拣货单拣货,并制作出库单,然后打印标签,粘贴条码标签,分配托盘,核验条码标签,货物装箱,订舱出库,并在系统中对出库单进行审核通过。整个流程如下图。

 abp(net core)+easyui+efcore实现仓储管理系统——出库管理之一(四十九)_easyui

     当然我们接下来要实现的出库单功能,没有这么复杂。

 

三、创建出库单实体

    1. 做为一个出库单,在数据库中一般存在两张表,表头OutStockOrder,表体OutStockDetail

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

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

    3.创建OutStockOrder类继承自Entity

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 OutStockOrder: Entity<int>, IHasCreationTime
    {        public const int MaxLength = 255;        public OutStockOrder()
        {

            No = string.Empty;
            CustomerCode = string.Empty;
            CustomerName = string.Empty;
            WarehouseNo = string.Empty;

            
            DeliveryNo = string.Empty;
            TallyClerk = string.Empty;
            TallyTime = string.Empty;
            CreationTime = DateTime.Now;
            Oper = string.Empty;
            Checker = string.Empty;
            CheckTime = string.Empty;
            Gwt = 0;
            Nwt = 0;
            PackageQty = 0;
            OwnerCode = string.Empty;
            OwnerName = string.Empty;
            Remark = string.Empty;
            Status = 0;
            PreOutStockTime = string.Empty;
        }

 

        [StringLength(50)]
        [Required]        public string No { get; set; }        /// 
        /// 客户名称        ///         [StringLength(MaxLength)]
        [Required]        public string CustomerName { get; set; } 

        /// 
        /// 车牌号        /// 
        public string VehicleNo { get; set; }        /// 
        /// 客户代码        /// 
        [StringLength(50)]
        [Required]        public string CustomerCode { get; set; }        /// 
        /// 收货人代码        /// 
        public string ConsigneeCode { get; set; }        /// 
        /// 收货人        /// 
        public string Consignee{get ;set;}        /// 
        /// 收货人社会信用代码        /// 
        public string ConsigneeSCCD { get; set; }        /// 
        /// 托运人,发货人        /// 
        public string Shipper { get; set; } 
        /// 
        /// 托运人,发货人代码        /// 
        public string ShipperCode { get; set; }    

        /// 
        /// 托运人,发货人社会信用代码        /// 
        public string ShipperSCCD { get; set; }        /// 
        /// 通知人        /// 
        public string Notify { get; set; }        /// 
        /// 通知人代码        /// 
        public string NotifyCode { get; set; }        /// 
        /// 通知人社会信用代码        /// 
        public string NotifySCCD { get; set; }        /// 
        /// 出货单号        /// 
        public string DeliveryNo { get; set; }        /// 
        /// 仓库号        /// 
        public string WarehouseNo { get; set; }        /// 
        /// 货主        ///         [StringLength(MaxLength)]
        [Required]        public string OwnerName { get; set; } 

        public decimal Gwt { get; set; }        public decimal Nwt { get; set; }        public int PackageQty { get; set; }        /// 
        /// 理货时间        /// 
        [StringLength(20)]        public string TallyTime { get; set; }        /// 
        /// 理货员        /// 
        [StringLength(50)]        public string TallyClerk { get; set; }

        [StringLength(50)]        public string Oper { get; set; }        public int Status { get; set; }

        [StringLength(50)]        public string OwnerCode { get; set; }        /// 
        /// 预计出库时间        /// 
        [StringLength(20)]        public string PreOutStockTime { get; set; }        /// 
        /// 审核人        /// 
        [StringLength(50)]        public string Checker { get; set; }
        [StringLength(20)]        public string CheckTime { get; set; }
        [StringLength(1000)]        public string Remark { get; set; }        public DateTime CreationTime { get; set; }

        [StringLength(20)]        public string LastUpdateTime { get; set; }
        [StringLength(50)]        public string LastOper { get; set; } 

    }
}

    4. 重得第2,3步,我们在“ABP.TPLMS.Core”项目的“Entitys”文件夹,创建OutStockOrderDetail类。代码如下:

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 OutStockOrderDetail : Entity<int>, IHasCreationTime
    {        public const int MaxLength = 255;        public OutStockOrderDetail()
        {            this.Qty = 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.SecdLawfQty = 0;            this.LawfQty = 0;            this.NetWt = 0;            this.Package = string.Empty;            this.Price = 0;            this.Spcf = string.Empty;            this.Unit = string.Empty;            this.InStockNo = string.Empty;            this.LawfUnit = string.Empty;            this.Vol = 0;            this.Width = 0;            this.LawfUnit = string.Empty;            this.SecdLawfUnit = string.Empty;            

            this.Batch = string.Empty; 

            this.InStockOrderDetailId = 0;

        } 

        public int SupplierId { get; set; }

        [MaxLength(50)]        public string CargoCode { get; set; }

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

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

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

        [MaxLength(20)]        public string Unit { get; set; }        /// 
        /// 目的国        /// 
        [MaxLength(20)]        public string DestCountry { get; set; }        /// 
        /// 原产国        /// 
        [MaxLength(20)]        public string Country { get; set; }

        [MaxLength(50)]        public string Brand { get; set; }
        [MaxLength(20)]        public string Curr { get; set; }
        [MaxLength(20)]        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(20)]        public string InStockNo { get; set; }        public int InStockOrderDetailId { get; set; }        public decimal Qty { get; set; }        public decimal LawfQty { get; set; }        public decimal SecdLawfQty { get; set; }
        [MaxLength(20)]        public string LawfUnit { get; set; }
        [MaxLength(20)]        public string SecdLawfUnit { get; set; }

        [MaxLength(20)]        public string Batch { get; set; }        public string  Loc { 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
    {        /* Define a DbSet for each entity of the application */
      

        public TPLMSDbContext(DbContextOptions options)
            : base(options)
        {

        }        public DbSetModules { get; set; }        public DbSetSuppliers { get; set; }        public DbSetCargos { get; set; }        public DbSetOrgs { get; set; } 

        public virtual DbSetInStockOrder { get; set; }        public virtual DbSetInStockOrderDetail { get; set; }        public virtual DbSetInStockOrderDetailLoc { get; set; } 

        public virtual DbSetOutStockOrder { get; set; }        public virtual DbSetOutStockOrderDetail { get; set; }

    }

}


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

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

 abp(net core)+easyui+efcore实现仓储管理系统——出库管理之一(四十九)_abp_02

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

 abp(net core)+easyui+efcore实现仓储管理系统——出库管理之一(四十九)_efcore_03

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

 abp(net core)+easyui+efcore实现仓储管理系统——出库管理之一(四十九)_easyui_04

    10. 在SQL Server Management Studio中查看数据库,OutStockOrder、OutStockOrderDetail两张表创建成功。

 abp(net core)+easyui+efcore实现仓储管理系统——出库管理之一(四十九)_efcore_05