Browse Source

大众备件报表代码

branch_ccpg_220107
44673626 3 years ago
parent
commit
484dd589d3
  1. 175
      src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Migrations/SettleAccountHttpApiHostMigrationsDbContextModelSnapshot.cs
  2. 42
      src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs
  3. 15
      src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml
  4. 8
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS-SparePart/WMSSparePart.cs
  5. 1
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleKBWithCodeDapperReportRepository.cs
  6. 116
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs
  7. 43
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleSparePartExportService.cs

175
src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Migrations/SettleAccountHttpApiHostMigrationsDbContextModelSnapshot.cs

@ -6689,7 +6689,7 @@ namespace Win.Sfs.SettleAccount.Migrations
.IsUnique() .IsUnique()
.HasFilter("IsDeleted=0"); .HasFilter("IsDeleted=0");
b.ToTable("Set_WMSSparePart"); b.ToTable("Set_SparePart");
}); });
modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.VWSparePart.SparePartVersion", b => modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.VWSparePart.SparePartVersion", b =>
@ -7001,6 +7001,179 @@ namespace Win.Sfs.SettleAccount.Migrations
b.ToTable("Set_WMSKanBanSettle_Version"); b.ToTable("Set_WMSKanBanSettle_Version");
}); });
modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.WMS_SparePart.WMSSparePart", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("AccountNum")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<decimal>("AmountNoTax")
.HasColumnType("decimal(18,2)");
b.Property<string>("BatchNo")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<Guid>("BranchId")
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<string>("DeliveryLineNum")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("DeliveryOrderNo")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<bool>("Enabled")
.HasColumnType("bit");
b.Property<string>("Extend")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("Factory")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("FactoryName")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("GermanInvoiceNo")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<decimal>("InvoicedQty")
.HasColumnType("decimal(18,2)");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<string>("LineNumber")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("MaterialCode")
.IsRequired()
.HasMaxLength(150)
.HasColumnType("nvarchar(150)");
b.Property<string>("MaterialDesc")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Period")
.HasMaxLength(36)
.HasColumnType("nvarchar(36)");
b.Property<string>("PurchaseOrderNo")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("PurchaseOrderNoItem")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("PurchaseOrderNoText")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<decimal>("PurchasePriceNoTax")
.HasColumnType("decimal(18,2)");
b.Property<string>("PurchaseType")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<decimal>("ReceiptQty")
.HasColumnType("decimal(18,2)");
b.Property<string>("Remark")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("SpareDate")
.HasColumnType("datetime2");
b.Property<string>("TaxCode")
.HasColumnType("nvarchar(max)");
b.Property<decimal>("TaxRate")
.HasColumnType("decimal(18,2)");
b.Property<string>("Unit")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Version")
.HasMaxLength(36)
.HasColumnType("nvarchar(36)");
b.Property<string>("WMSDeliverGoodsState")
.HasColumnType("nvarchar(max)");
b.Property<string>("WMSDeliveryNote")
.HasColumnType("nvarchar(max)");
b.Property<string>("WMSKanBanState")
.HasColumnType("nvarchar(max)");
b.Property<string>("Year")
.HasMaxLength(36)
.HasColumnType("nvarchar(36)");
b.HasKey("Id");
b.HasIndex("Version", "PurchaseOrderNo", "MaterialCode")
.IsUnique()
.HasFilter("IsDeleted=0");
b.ToTable("Set_WMSSparePart");
});
modelBuilder.Entity("Win.Sfs.SettleAccount.EstimatedInventories.EstimatedInventoryDetail", b => modelBuilder.Entity("Win.Sfs.SettleAccount.EstimatedInventories.EstimatedInventoryDetail", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")

42
src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs

@ -73,7 +73,7 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
_service = service; _service = service;
} }
#region 派格结算报表 #region 派格大众看板-备件结算报表
/// <summary> /// <summary>
/// 有条码看板结算核对 /// 有条码看板结算核对
/// </summary> /// </summary>
@ -106,7 +106,45 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
customConditionList.Add(new CustomCondition() { Name = "BegingTime", Value = begin.ToString() }); customConditionList.Add(new CustomCondition() { Name = "BegingTime", Value = begin.ToString() });
customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = end.ToString() }); customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = end.ToString() });
var _taskid = await _service.ExportEnqueueAsync("未结算对比", ExportExtentsion.Excel, CurrentUser, typeof(UnSettledExportService), customConditionList, (rs) => var _taskid = await _service.ExportEnqueueAsync("大众看板结算与交货核对明细表", ExportExtentsion.Excel, CurrentUser, typeof(SettleKBWithCodeExportService), customConditionList, (rs) =>
{
});
return _taskid;
}
/// <summary>
/// 大众备件结算核对明细表
/// </summary>
/// <param name="year"></param>
/// <param name="period"></param>
/// <param name="version"></param>
/// <param name="customerCode"></param>
/// <param name="factory"></param>
/// <param name="matialCode"></param>
/// <param name="state"></param>
/// <param name="begin"></param>
/// <param name="end"></param>
/// <returns></returns>
[HttpGet]
[Route("SettlSparePartExport")]
[DisableRequestSizeLimit]
public async Task<string> SettledSparePart(string year, string period, string version, string customerCode, string factory, string matialCode,
string state, DateTime begin, DateTime end)
{
List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty });
customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = customerCode ?? string.Empty });
customConditionList.Add(new CustomCondition() { Name = "Factory", Value = factory ?? string.Empty });
customConditionList.Add(new CustomCondition() { Name = "State", Value = state ?? "0" });
customConditionList.Add(new CustomCondition() { Name = "MatialCode", Value = matialCode ?? "0" });
customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "大众备件结算核对" });
customConditionList.Add(new CustomCondition() { Name = "Year", Value = year ?? string.Empty });
customConditionList.Add(new CustomCondition() { Name = "BegingTime", Value = begin.ToString() });
customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = end.ToString() });
var _taskid = await _service.ExportEnqueueAsync("大众备件结算核对明细表", ExportExtentsion.Excel, CurrentUser, typeof(SettleSparePartExportService), customConditionList, (rs) =>
{ {
}); });
return _taskid; return _taskid;

15
src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml

@ -2421,6 +2421,21 @@
<param name="end"></param> <param name="end"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.SettledSparePart(System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.DateTime,System.DateTime)">
<summary>
大众备件结算核对明细表
</summary>
<param name="year"></param>
<param name="period"></param>
<param name="version"></param>
<param name="customerCode"></param>
<param name="factory"></param>
<param name="matialCode"></param>
<param name="state"></param>
<param name="begin"></param>
<param name="end"></param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.UnSettledMake(System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.DateTime,System.DateTime)"> <member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.UnSettledMake(System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.DateTime,System.DateTime)">
<summary> <summary>
未结算对比 未结算对比

8
src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS-SparePart/WMSSparePart.cs

@ -66,7 +66,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS_SparePart
/// <summary> /// <summary>
/// 期间 /// 期间
/// </summary> /// </summary>
[Display(Name = "期")] [Display(Name = "交货日期")]
public string Period { set; get; } public string Period { set; get; }
/// <summary> /// <summary>
/// 版本号 /// 版本号
@ -105,7 +105,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS_SparePart
/// <summary> /// <summary>
/// 收货数量 /// 收货数量
/// </summary> /// </summary>
[Display(Name = "货数量")] [Display(Name = "货数量")]
public decimal ReceiptQty { get; set; } public decimal ReceiptQty { get; set; }
/// <summary> /// <summary>
@ -141,7 +141,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS_SparePart
/// <summary> /// <summary>
/// 日期 /// 日期
/// </summary> /// </summary>
[Display(Name = "日期")] [Display(Name = "订单日期")]
public DateTime SpareDate { get; set; } public DateTime SpareDate { get; set; }
/// <summary> /// <summary>
/// 交货单号 /// 交货单号
@ -195,7 +195,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS_SparePart
public string Extend { set; get; } public string Extend { set; get; }
/// <summary> /// <summary>
/// WMS交货单 /// WMS采购订单号
/// </summary> /// </summary>
public string WMSDeliveryNote { set; get; } public string WMSDeliveryNote { set; get; }

1
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleKBWithCodeDapperReportRepository.cs

@ -30,6 +30,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" SELECT\n" + " SELECT\n" +
" c.WMSDeliveryNote,--交货单号\n" + " c.WMSDeliveryNote,--交货单号\n" +
" c.WMSActualGoodsDate,--实际发货日期\n" + " c.WMSActualGoodsDate,--实际发货日期\n" +
" a.Kanban,--条码号\n" + " a.Kanban,--条码号\n" +
" b.MaterialCode SapMaterialCode,--厂内物料号\n" + " b.MaterialCode SapMaterialCode,--厂内物料号\n" +
" b.MaterialDesc,--物料描述\n" + " b.MaterialDesc,--物料描述\n" +

116
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs

@ -0,0 +1,116 @@
using Dapper;
using Magicodes.ExporterAndImporter.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories.Dapper;
using Volo.Abp.EntityFrameworkCore;
namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{
public class SettleSparePartDapperReportRepository : DapperRepository<SettleAccountDbContext>, ITransientDependency
{
public SettleSparePartDapperReportRepository(IDbContextProvider<SettleAccountDbContext> dbContextProvider)
: base(dbContextProvider)
{ }
public virtual List<SettleSparePartExport> GetSettleSparePartReportList(string state, string version, string year, string customcode,
string begintime, string endtime)
{
string sqlString = "SELECT\n" +
" * ,\n" +
" (Price-InvoicePrice) as InvoiceDiffPrice, --单价差异\n" +
" ISNULL( Price * ReceiptQty-InvoiceMoney, 0 ) AS SumDiffMoney --总金额差异\n" +
"FROM\n" +
" (\n" +
" SELECT\n" +
" c.Period as WMSDeliveryDate,--交货日期\n" +
" c.DeliveryOrderNo,--交货单号\n" +
" c.SpareDate as OrderDate,--订单日期\n" +
" a.PurchaseOrderNo,--采购订单号\n" +
" b.MaterialCode as SAPCode,--SAP编码,即厂内物料号\n" +
" a.MaterialCode,--物料代码\n" +
" b.MaterialDesc,--物料描述\n" +
" a.PurchaseOrderNoText,--采购订单文本\n" +
" c.ReceiptQty,-- 发货数量\n" +
" d.Amt as InvoicedQty,--开票数量\n" +
" (c.ReceiptQty-d.Amt) as SettleInvoiceDiffQty,--发货与开票差异\n" +
" d.InvoicePrice,--开票单价\n" +
" (a.ReceiptQty * d.InvoicePrice) as InvoiceMoney --开票金额\n" +
" \n" +
" FROM\n" +
" Set_SparePart AS a\n" +
" LEFT JOIN Set_material AS b ON a.MaterialCode= b.CustomerPartCode\n" +
" LEFT JOIN Set_WMSSparePart c ON a.PurchaseOrderNo= c.WMSDeliveryNote \n" +
" AND a.MaterialCode= c.MaterialCode\n" +
" LEFT JOIN ( SELECT SUM ( amt ) / SUM ( Qty ) InvoicePrice, MaterialCode,Amt FROM set_invoice WHERE version = '202109' GROUP BY materialcode,Amt ) d ON a.MaterialCode= d.MaterialCode \n" +
" ) TEMP1\n" +
" LEFT JOIN ( SELECT Price, --定价\n" +
" MaterialCode --厂内物料号\n" +
" FROM Set_PriceList WHERE version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) TEMP2 ON TEMP1.SAPCode= TEMP2.MaterialCode";
string _sql = string.Format(sqlString, version);
var _query = DbConnection.Query<SettleSparePartExport>(_sql, null, null, true, 1200, null);
return _query.ToList();
}
}
/// <summary>
/// 大众看板有条码报表
/// </summary>
//[ExcelExporter(Name = "未结明细", AutoFitAllColumn = true, MaxRowNumberOnASheet = 500000)]
public class SettleSparePartExport
{
[ExporterHeader(DisplayName = "交货日期")]
public string WMSDeliveryDate { set; get; }
[ExporterHeader(DisplayName = "交货单号")]
public string DeliveryOrderNo { set; get; }
[ExporterHeader(DisplayName = "订单日期")]
public DateTime OrderDate{ set; get; }
[ExporterHeader(DisplayName = "采购订单号")]
public string PurchaseOrderNo { set; get; }
[ExporterHeader(DisplayName = "SAP编码")]
public string SAPCode { set; get; }
[ExporterHeader(DisplayName = "物料代码")]
public string MaterialCode { set; get; }
[ExporterHeader(DisplayName = "物料描述")]
public string MaterialDesc { set; get; }
[ExporterHeader(DisplayName = "采购订单文本")]
public string PurchaseOrderNoText { set; get; }
[ExporterHeader(DisplayName = "发货数量")]
public decimal ReceiptQty { set; get; }
[ExporterHeader(DisplayName = "开票数量")]
public decimal InvoicedQty { set; get; }
[ExporterHeader(DisplayName = "发货与开票差异")]
public decimal SettleInvoiceDiffQty { set; get; }
[ExporterHeader(DisplayName = "开票单价")]
public decimal InvoicePrice { set; get; }
[ExporterHeader(DisplayName = "开票金额")]
public decimal InvoiceMoney { set; get; }
[ExporterHeader(DisplayName = "定价")]
public decimal Price { set; get; }
[ExporterHeader(DisplayName = "单价差异")]
public decimal InvoiceDiffPrice { set; get; }
[ExporterHeader(DisplayName = "总金额差异")]
public decimal SumDiffMoney { set; get; }
}
}

43
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleSparePartExportService.cs

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TaskJob.EventArgs;
using TaskJob.Interfaces;
using Volo.Abp.DependencyInjection;
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report;
namespace SettleAccount.Job.Services.Report
{
public class SettleSparePartExportService : ITransientDependency, IExportJob
{
private readonly SettleSparePartDapperReportRepository _dapper;
private readonly OutputService _outputService;
public SettleSparePartExportService(SettleSparePartDapperReportRepository dapper, OutputService outputService)
{
_dapper = dapper;
_outputService = outputService;
}
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> p_list)
{
var year = p_list.Where(p => p.Name == "Year").FirstOrDefault().Value;
var state = p_list.Where(p => p.Name == "State").FirstOrDefault().Value;
var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value;
var customerCode = p_list.Where(p => p.Name == "CustomerCode").FirstOrDefault().Value;
var beginTime = p_list.Where(p => p.Name == "BegingTime").FirstOrDefault().Value;
var endTime = p_list.Where(p => p.Name == "EndTime").FirstOrDefault().Value;
var _list = _dapper.GetSettleSparePartReportList(state, version, year, customerCode, beginTime, endTime);
_outputService.Export<SettleSparePartExport>(id, string.Format("大众备件结算核对明细表_{0}.xlsx", Guid.NewGuid().ToString()), _list);
return id.ToString();
}
}
}
Loading…
Cancel
Save