bp(net core)+easyui+efcore實現倉儲管理系統——入庫管理之二(三十八)

abp(net core)+easyui+efcore實現倉儲管理系統目錄

abp(net core)+easyui+efcore實現倉儲管理系統——EasyUI前端頁面框架 (十八) html

abp(net core)+easyui+efcore實現倉儲管理系統——ABP WebAPI與EasyUI結合增刪改查之八(三十四) 前端

 

    在上一篇文章abp(net core)+easyui+efcore實現倉儲管理系統——入庫管理之一(三十七) 中咱們建立了入庫單的實體類,並使用CodeFirst功能建立了數據庫表,接下咱們來建立一些有關與入庫單有關的DTO與查詢分頁類數據庫

 4、定義應用服務接口須要用到的DTO類app

    爲了在進行查詢入庫單表頭,咱們須要建立, PagedInStockResultRequestDto類,用來將查詢條件數據傳遞到基礎設施層.框架

     1. 在Visual Studio 2017的「解決方案資源管理器」中,右鍵單擊「ABP.TPLMS.Application」項目,在彈出菜單中選擇「添加」 > 「新建文件夾」,並重命名爲「InStocks」post

    2. 使用鼠標右鍵單擊咱們剛纔建立的「InStocks」文件夾,在彈出菜單中選擇「添加」 > 「新建文件夾」,並重命名爲「Dto」測試

    3.右鍵單擊「Dto」文件夾,而後選擇「添加」 > 「類」。 將類命名爲 Paged InStockResultRequestDto,而後選擇「添加」。代碼以下。ui

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,而後選擇「添加」。此類根據入庫單單號查詢入庫單的明細數據。代碼以下。this

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,而後選擇「添加」。代碼以下。spa

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

 
相關文章
相關標籤/搜索