bp(net core)+easyui+efcore实现仓储管理系统——入库管理之二(三十八)

栏目: IT技术 · 发布时间: 4年前

在上一篇文章 abp(net core)+easyui+efcore实现仓储管理系统——入库管理之一(三十七) 中我们 创建了入库单的实体类,并使用 CodeFirst功能创建了数据库表, 接下我们来创建一些有关 与入库单有关的 DTO 与查询分页类

四、定义应用服务接口需要用到的 DTO类

为了在进行查询 入库单表头,我们需要创建 , PagedInStockResultRequestDto 类, 用来将 查询条件 数据传递到基础设施层 .

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

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

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

using Abp.Application.Services.Dto;
using System;
using System.Collections.Generic;
using System.Text; 


namespace ABP.TPLMS.InStocks.Dto
{

    public class PagedInStockResultRequestDto : PagedResultRequestDto
    {

        public string Keyword { get; set; }
        public string InStockNo { get; set; }
        public DateTime BeginTime { get; set; }
        DateTime m_EndTime;
        /// <summary>
        /// 查询截止日期,如果当前时间小于100年前,就给一个默认日期(明天)
        /// </summary>

        public DateTime EndTime { get
            {

                if (m_EndTime < DateTime.Now.AddYears(-100))
                    return DateTime.Now.AddDays(1);
                else
                    return m_EndTime;
                    }            

            set
            {
                m_EndTime = value;
            }
                }

        public string OwnerName { get; set; }
        public string No { get; set; }
    }
}

4 .右键单击 “Dto”文件夹,然后选择“添加” > “类”。 将类命名为 PagedInStockDetailResultRequestDto ,然后选择 “添加”。 此类根据入库单单号查询入库单的明细数据。 代码如下。

using Abp.Application.Services.Dto;
using System;
using System.Collections.Generic;
using System.Text;
 

namespace ABP.TPLMS.InStocks.Dto
{

    public class PagedInStockDetailResultRequestDto : PagedResultRequestDto
    {

        public string Keyword { get; set; }
        public string InStockNo { get; set; }  

    }
}
      5 .右键单击 “Dto”文件夹,然后选择“添加” > “类”。 将类命名为 PagedInStockDetailLocResultRequestDto ,然后选择 “添加”。 此类根据入库单明细的 ID 查询入库单某条明细数据的库位信息。 代码如下。

using Abp.Application.Services.Dto;
using System;
using System.Collections.Generic;
using System.Text;
 

namespace ABP.TPLMS.InStocks.Dto
{

    public class PagedInStockDetailLocResultRequestDto : PagedResultRequestDto
    {

        public string Keyword { get; set; }
        public int InStockOrderDetailId { get; set; }  

    }
}

 

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

using Abp.Application.Services.Dto;
using Abp.AutoMapper;
using ABP.TPLMS.Entitys;
using System;
using System.Collections.Generic;
using System.Text;
 

namespace ABP.TPLMS.InStocks.Dto
{

    [AutoMapFrom(typeof(InStockOrder))]
    public class InStockOrderDto : EntityDto<int>
    {

        public string No { get; set; }
        /// <summary>
        /// 客户名称
        /// </summary>
        public string CustomerName { get; set; }

        public string WarehouseType { get; set; }

        /// <summary>
        /// 客户代码
        /// </summary>
        public string CustomerCode { get; set; }

        /// <summary>
        /// 送货单号
        /// </summary>
        public string DeliveryNo { get; set; }
        /// <summary>
        /// 仓库号
        /// </summary>
        public string WarehouseNo { get; set; }

        /// <summary>
        /// 货主
        /// </summary>
        public string OwnerName { get; set; }

        /// <summary>
        /// 毛重
        /// </summary>
        public decimal Gwt { get; set; }
        public decimal Nwt { get; set; }
        public int PackageQty { get; set; }

        /// <summary>
        /// 接收时间
        /// </summary>
        public string ReceiveTime { get; set; }

        /// <summary>
        /// 接收人
        /// </summary>

        public string Receiver { get; set; } 
        public string Oper { get; set; }
        public int Status { get; set; }
        public string OwnerCode { get; set; }

        /// <summary>
        /// 预计送货时间
        /// </summary>

        public string PreDeliveryTime { get; set; }

        /// <summary>
        /// 审核人
        /// </summary>

        public string Checker { get; set; }
        public string CheckTime { get; set; }

        public string Remark { get; set; }
        public DateTime CreationTime { get; set; }

        public string LastUpdateTime { get; set; }
        public string LastOper { get; set; }

        public List<InStockOrderDetailDto> InStockOrderDetail { get; set; }

    } 

}

 

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

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.InStocks.Dto
{

    [AutoMapTo(typeof(InStockOrder))]
    public  class CreateUpdateInStockOrderDto : EntityDto<int>
    {

        public const int MaxLength = 255;

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

        /// <summary>
        /// 客户名称
        /// </summary>

        [StringLength(MaxLength)]
        [Required]
        public string CustomerName { get; set; } 

        public string WarehouseType { get; set; }

        /// <summary>
        /// 客户代码
        /// </summary>
         

        [StringLength(50)]
        [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 PackageQty { get; set; }

        /// <summary>
        /// 接收时间
        /// </summary>
        [StringLength(20)]
        public string ReceiveTime { get; set; }

        /// <summary>
        /// 接收人
        /// </summary>
        [StringLength(50)]
        public string Receiver { get; set; }
 

        [StringLength(50)]

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

        /// <summary>
        /// 预计送货时间
        /// </summary>
        [StringLength(20)]
        public string PreDeliveryTime { get; set; }

        /// <summary>
        /// 审核人
        /// </summary>
        [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; }
        public List<CreateUpdateInStockOrderDetailDto> InStockOrderDetail { get; set; }
    }
}

8. 重复上面的第6 -7步,我们来创建InStockDetailDto与CreateUpdateInStockDetailDto、InStockDetailLocDto与CreateUpdateInStockDetailLocDto。

8.1 InStockDetailDto

using Abp.Application.Services.Dto;
using Abp.AutoMapper;
using Abp.Domain.Entities;
using Abp.Domain.Entities.Auditing;
using ABP.TPLMS.Entitys;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
 

namespace ABP.TPLMS.InStocks.Dto
{

    [AutoMapFrom(typeof(InStockOrderDetail))]
    public class InStockOrderDetailDto : 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 Price { get; set; }
        public decimal TotalAmt { get; set; }

        public decimal GrossWt { get; set; }
        public decimal NetWt { get; set; }
        public DateTime CreationTime { get; set; }      

        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; }      

        public string LawfUnit { get; set; }        
        public string SecdLawfUnit { get; set; }        

        public string Batch { get; set; }
        public int DeliveryOrderDetailId { get; set; }
        [NotMapped]
        public List<InStockOrderDetailLoc> InStockOrderDetailLoc { get; set; }
    }
}

8.2 CreateUpdateInStockDetailDto

using Abp.Application.Services.Dto;
using Abp.AutoMapper;
using Abp.Domain.Entities;
using Abp.Domain.Entities.Auditing;
using ABP.TPLMS.Entitys;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
 
namespace ABP.TPLMS.InStocks.Dto
{

    [AutoMapTo(typeof(InStockOrderDetail))]
    public class CreateUpdateInStockOrderDetailDto : EntityDto<int>
    {

        public const int MaxLength = 255;       
        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 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 SeqNo { 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 int DeliveryOrderDetailId { get; set; }

         [NotMapped]
        public List<InStockOrderDetailLoc> InStockOrderDetailLoc { get; set; }

     }
}

 
     8.3  InStockDetailLocDto

using Abp.Application.Services.Dto;
using Abp.AutoMapper;
using Abp.Domain.Entities;
using Abp.Domain.Entities.Auditing;
using ABP.TPLMS.Entitys;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;


namespace ABP.TPLMS.InStocks.Dto
{

   public class InStockOrderDetailLocDto :  EntityDto<int>
    {
         [AutoMapFrom(typeof(InStockOrderDetailLoc))]
        public InStockOrderDetailLocDto()
        {           
            this.Qty = 0;
            this.SeqNo = 0;
            this.Loc = string.Empty;
            this.CreationTime = DateTime.Now;
            this.InStockOrderDetailId = 0;

        }     

        public int InStockOrderDetailId { get; set; }
        public int SeqNo { get; set; }
        public string Loc { get; set; }
        public decimal Qty { get; set; }
        public DateTime CreationTime { get; set; }
    }
}

8.4  CreateUpdateInStockDetailLocDto。

using Abp.Application.Services.Dto;
using Abp.AutoMapper;
using Abp.Domain.Entities;
using Abp.Domain.Entities.Auditing;
using ABP.TPLMS.Entitys;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;
 

namespace ABP.TPLMS.InStocks.Dto
{

   public class CreateUpdateInStockOrderDetailLocDto : EntityDto<int>
    {

        [AutoMapTo(typeof(InStockOrderDetailLoc))]
        public CreateUpdateInStockOrderDetailLocDto()
        {
           

            this.Qty = 0;
            this.SeqNo = 0;
            this.Loc = string.Empty;
            this.CreationTime = DateTime.Now;
            this.InStockOrderDetailId = 0;
        }
       public int InStockOrderDetailId { get; set; }
        public int SeqNo { get; set; }
        [StringLength(50)]
        public string Loc { get; set; }    
        public decimal Qty { get; set; }
        public DateTime CreationTime { get; set; }
    }
}

 

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Perl语言入门 第六版(中文版)

Perl语言入门 第六版(中文版)

Randal L.Schwartz、brian d foy、Tom Phoenix / 盛春 / 东南大学出版社 / 2012-3 / 62.00元

《Perl语言入门(第6版)(中文版)》根据作者施瓦茨、福瓦、菲尼克斯从1991年开始的教学经验积累汇聚而成,多年来十分畅销。此次第六版涵盖了最新的Perl5.14版本的变化。《Perl语言入门(第6版)(中文版)》每章都包含若干习题,帮助你巩固消化刚学到的知识。也许其他书籍只是想着灌输Perl编程的条条框框,但《Perl语言入门(第6版)(中文版)》不同,我们希望把你培养成一名真正的Perl程序......一起来看看 《Perl语言入门 第六版(中文版)》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

SHA 加密
SHA 加密

SHA 加密工具