Administrator
3 years ago
10 changed files with 469 additions and 53 deletions
@ -0,0 +1,115 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Win.Sfs.Shared.DtoBase; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.Wms.WmsSumOutput |
|||
{ |
|||
public class WmsRequestDetailReportDto: RequestDtoBase |
|||
{ |
|||
[Display(Name = "行号")] |
|||
public int LineNumber { set; get; } |
|||
[Display(Name = "客户")] |
|||
public string Client { set; get; } |
|||
[Display(Name = "出库类型")] |
|||
public string Type { set; get; } |
|||
[Display(Name = "结算编码")] |
|||
public string SettleCode { set; get; } |
|||
[Display(Name = "销售渠道")] |
|||
public string SaleCode { set; get; } |
|||
[Display(Name = "客户代码")] |
|||
public string ClientCode { set; get; } |
|||
[Display(Name = "结算单")] |
|||
public string BillNum { set; get; } |
|||
[Display(Name = "结算单")] |
|||
public string MaterialCode { set; get; } |
|||
[Display(Name = "寄售类别")] |
|||
public string SaleType { set; get; } |
|||
[Display(Name = "结算数量")] |
|||
public decimal Qty { set; get; } |
|||
[Display(Name = "实际出库数量")] |
|||
public decimal OutputQty { set; get; } |
|||
[Display(Name = "差异数量")] |
|||
public decimal DiffQty { set; get; } |
|||
[Display(Name = "开票单价")] |
|||
public decimal Price { set; get; } |
|||
[Display(Name = "结算金额")] |
|||
public decimal Amt { set; get; } |
|||
[Display(Name = "已出库金额")] |
|||
public decimal OutPutAmt { set; get; } |
|||
[Display(Name = "WMS待出库金额")] |
|||
public decimal DiffAmt { set; get; } |
|||
[Display(Name = "物料组编码")] |
|||
public string MaterialGroupCode { set; get; } |
|||
[Display(Name = "物料组(车型)")] |
|||
public string MaterialGroup { set; get; } |
|||
[Display(Name = "物料组描述")] |
|||
public string MaterialDesc { set; get; } |
|||
[Display(Name = "备注")] |
|||
public string Remark1 { set; get; } |
|||
|
|||
[Display(Name = "状态")] |
|||
public int State { set; get; } |
|||
} |
|||
|
|||
|
|||
|
|||
public class WmsDetailReportDto |
|||
{ |
|||
public WmsDetailReportDto() |
|||
{ |
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
[Display(Name = "行号")] |
|||
public int LineNumber { set; get; } |
|||
[Display(Name = "客户")] |
|||
public string Client { set; get; } |
|||
[Display(Name = "出库类型")] |
|||
public string Type { set; get; } |
|||
[Display(Name = "结算编码")] |
|||
public string SettleCode { set; get; } |
|||
[Display(Name = "销售渠道")] |
|||
public string SaleCode { set; get; } |
|||
[Display(Name = "客户代码")] |
|||
public string ClientCode { set; get; } |
|||
[Display(Name = "结算单")] |
|||
public string BillNum { set; get; } |
|||
[Display(Name = "结算单")] |
|||
public string MaterialCode { set; get; } |
|||
[Display(Name = "寄售类别")] |
|||
public string SaleType { set; get; } |
|||
[Display(Name = "结算数量")] |
|||
public decimal Qty { set; get; } |
|||
[Display(Name = "实际出库数量")] |
|||
public decimal OutputQty { set; get; } |
|||
[Display(Name = "差异数量")] |
|||
public decimal DiffQty { set; get; } |
|||
[Display(Name = "开票单价")] |
|||
public decimal Price { set; get; } |
|||
[Display(Name = "结算金额")] |
|||
public decimal Amt { set; get; } |
|||
[Display(Name = "已出库金额")] |
|||
public decimal OutPutAmt { set; get; } |
|||
[Display(Name = "WMS待出库金额")] |
|||
public decimal DiffAmt { set; get; } |
|||
[Display(Name = "物料组编码")] |
|||
public string MaterialGroupCode { set; get; } |
|||
[Display(Name = "物料组(车型)")] |
|||
public string MaterialGroup { set; get; } |
|||
[Display(Name = "物料组描述")] |
|||
public string MaterialDesc { set; get; } |
|||
[Display(Name = "备注")] |
|||
public string Remark1 { set; get; } |
|||
|
|||
[Display(Name = "状态")] |
|||
public int State { set; get; } |
|||
} |
|||
|
|||
} |
@ -1,17 +1,192 @@ |
|||
using System; |
|||
|
|||
using EFCore.BulkExtensions; |
|||
using Magicodes.ExporterAndImporter.Core; |
|||
using Magicodes.ExporterAndImporter.Excel; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Shouldly; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.Caching; |
|||
using Volo.Abp.Domain.Repositories; |
|||
using Win.Abp.Snowflakes; |
|||
using Win.Sfs.BaseData.ImportExcelCommon; |
|||
using Win.Sfs.SettleAccount.CommonManagers; |
|||
using Win.Sfs.SettleAccount.Constant; |
|||
using Win.Sfs.SettleAccount.Entities.Wms; |
|||
using Win.Sfs.SettleAccount.Entities.Wms.WmsSumOutput; |
|||
using Win.Sfs.SettleAccount.Reports; |
|||
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report; |
|||
using Win.Sfs.Shared.DomainBase; |
|||
using Win.Sfs.Shared.Filter; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.WMS |
|||
{ |
|||
public class WmsUnInterface |
|||
[Route("api/settleaccount/WMSOutputSumReport")] |
|||
public class WMSOutputSumReportAppService : |
|||
SettleAccountApplicationBase<WmsDetailReport> |
|||
{ |
|||
private readonly ISettleAccountBranchEfCoreRepository<WmsDetailReport, Guid> _wmsRepository; |
|||
private readonly WmsOutputSumDapperRepository _dapper; |
|||
private readonly IExcelImportAppService _excelImportService; |
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
/// <param name="wmsRepository"></param>
|
|||
/// <param name="job"></param>
|
|||
|
|||
public WMSOutputSumReportAppService( |
|||
WmsOutputSumDapperRepository dapper, |
|||
ISettleAccountBranchEfCoreRepository<WmsDetailReport, Guid> wmsRepository, |
|||
ISettleAccountBranchEfCoreRepository<TaskJob, Guid> job, |
|||
IExcelImportAppService excelImportService, |
|||
IDistributedCache<WmsDetailReport> cache, |
|||
ISnowflakeIdGenerator snowflakeIdGenerator, |
|||
ICommonManager commonManager |
|||
) : base(cache, excelImportService, snowflakeIdGenerator, commonManager) |
|||
{ |
|||
_wmsRepository = wmsRepository; |
|||
_dapper = dapper; |
|||
|
|||
} |
|||
|
|||
[HttpPost] |
|||
[Route("Make")] |
|||
public async Task<string> ReportMake(string version) |
|||
{ |
|||
var _ls= _dapper.GetWmsSumExtendList(version);//报表
|
|||
|
|||
var _count= _wmsRepository.Count(p => p.Version == version && p.State>0); |
|||
if (_count > 0) |
|||
{ |
|||
throw new BusinessException("8899", "不能重新生成此版本!"); |
|||
} |
|||
else |
|||
{ |
|||
var query = _wmsRepository.Where(p => p.Version == version); |
|||
await query.BatchDeleteAsync(); |
|||
} |
|||
List<WmsDetailReport> _lst = new List<WmsDetailReport>(); |
|||
if (_ls != null && _ls.Count() > 0) |
|||
{ |
|||
foreach (var itm in _ls) |
|||
{ |
|||
_lst.Add(new WmsDetailReport(Guid.NewGuid(), |
|||
int.Parse(itm.行号), |
|||
itm.客户, |
|||
itm.出库类型, |
|||
itm.结算编码, |
|||
itm.销售渠道, |
|||
itm.客户代码, |
|||
itm.结算单, |
|||
itm.物料号, |
|||
String.Empty, |
|||
itm.结算数量, |
|||
itm.实际出库数量, |
|||
itm.差异数量, |
|||
itm.开票单价, |
|||
itm.结算金额, |
|||
itm.已出库金额, |
|||
itm.WMS待出库金额, |
|||
itm.物料组编码, |
|||
itm.物料组车型, |
|||
itm.物料描述, |
|||
String.Empty, |
|||
0, |
|||
version |
|||
|
|||
)); |
|||
} |
|||
} |
|||
await _wmsRepository.GetDbContext().BulkInsertAsync(_lst); |
|||
|
|||
return ApplicationConsts.SuccessStr; |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
private async Task<long> GetCountAsync(WmsRequestDetailReportDto input) |
|||
{ |
|||
// input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "BillNum", Logic = EnumFilterLogic.And, Value = input.BillNum });
|
|||
return await _wmsRepository.GetCountByFilterAsync(GuidGenerator.Create(), input.Filters); |
|||
} |
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// Wms汇总合计明细
|
|||
/// </summary>
|
|||
/// <param name="input"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost] |
|||
[Route("WmsDetailReport")] |
|||
|
|||
virtual public async Task<PagedResultDto<WmsDetailReport>> GetListAsync(WmsRequestDetailReportDto input) |
|||
{ |
|||
var entities = await _wmsRepository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, input.MaxResultCount, |
|||
input.SkipCount, true); |
|||
var totalCount = await GetCountAsync(input); |
|||
return new PagedResultDto<WmsDetailReport>(totalCount, entities); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 导出
|
|||
/// </summary>
|
|||
/// <param name="input"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost] |
|||
[Route("Export")] |
|||
|
|||
virtual public async Task<string> ExportAsync(WmsRequestDetailReportDto input) |
|||
{ |
|||
|
|||
var entities = await _wmsRepository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, int.MaxValue, |
|||
0, true); |
|||
IExporter _excel = new ExcelExporter(); |
|||
byte[] result = null; |
|||
|
|||
var _fileName = string.Format("汇总合计报表_{0}.xlsx", Guid.NewGuid().ToString()); |
|||
result = await _excel.ExportAsByteArray(entities); |
|||
|
|||
|
|||
result.ShouldNotBeNull(); |
|||
|
|||
//保存导出文件到服务器存成二进制
|
|||
await _excelImportService.SaveBlobAsync( |
|||
new SaveExcelImportInputDto |
|||
{ |
|||
Name = _fileName, |
|||
Content = result |
|||
} |
|||
); |
|||
return _fileName; |
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
|
@ -0,0 +1,91 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Win.Sfs.Shared.DomainBase; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities |
|||
{ |
|||
public class WmsDetailReport : FullAuditedAggregateRootBase<Guid> |
|||
{ |
|||
public WmsDetailReport() |
|||
{ |
|||
} |
|||
|
|||
public WmsDetailReport(Guid id, int lineNumber, string client, string type, string settleCode, string saleCode, string clientCode, string billNum, string materialCode, string saleType, decimal qty, decimal outputQty, decimal diffQty, decimal price, decimal amt, decimal outPutAmt, decimal diffAmt, string materialGroupCode, string materialGroup, string materialDesc, string remark1, int state, string version) : base(id) |
|||
{ |
|||
LineNumber = lineNumber; |
|||
Client = client; |
|||
Type = type; |
|||
SettleCode = settleCode; |
|||
SaleCode = saleCode; |
|||
ClientCode = clientCode; |
|||
BillNum = billNum; |
|||
MaterialCode = materialCode; |
|||
//SaleType = saleType;
|
|||
Qty = qty; |
|||
OutputQty = outputQty; |
|||
DiffQty = diffQty; |
|||
Price = price; |
|||
Amt = amt; |
|||
OutPutAmt = outPutAmt; |
|||
DiffAmt = diffAmt; |
|||
MaterialGroupCode = materialGroupCode; |
|||
MaterialGroup = materialGroup; |
|||
MaterialDesc = materialDesc; |
|||
Remark1 = remark1; |
|||
State = state; |
|||
Version = version; |
|||
} |
|||
|
|||
[Display(Name = "行号")] |
|||
public int LineNumber { set; get; } |
|||
|
|||
[Display(Name = "版本号")] |
|||
public string Version { set; get; } |
|||
|
|||
|
|||
[Display(Name = "客户")] |
|||
public string Client { set; get; } |
|||
[Display(Name = "出库类型")] |
|||
public string Type { set; get; } |
|||
[Display(Name = "结算编码")] |
|||
public string SettleCode { set; get; } |
|||
[Display(Name = "销售渠道")] |
|||
public string SaleCode { set; get; } |
|||
[Display(Name = "客户代码")] |
|||
public string ClientCode { set; get; } |
|||
[Display(Name = "结算单")] |
|||
public string BillNum { set; get; } |
|||
[Display(Name = "物料号")] |
|||
public string MaterialCode { set; get; } |
|||
//[Display(Name = "寄售类别")]
|
|||
//public string SaleType { set; get; }
|
|||
[Display(Name = "结算数量")] |
|||
public decimal Qty { set; get; } |
|||
[Display(Name = "实际出库数量")] |
|||
public decimal OutputQty { set; get; } |
|||
[Display(Name = "差异数量")] |
|||
public decimal DiffQty { set; get; } |
|||
[Display(Name = "开票单价")] |
|||
public decimal Price { set; get; } |
|||
[Display(Name = "结算金额")] |
|||
public decimal Amt { set; get; } |
|||
[Display(Name = "已出库金额")] |
|||
public decimal OutPutAmt { set; get; } |
|||
[Display(Name = "WMS待出库金额")] |
|||
public decimal DiffAmt { set; get; } |
|||
[Display(Name = "物料组编码")] |
|||
public string MaterialGroupCode { set; get; } |
|||
[Display(Name = "物料组(车型)")] |
|||
public string MaterialGroup { set; get; } |
|||
[Display(Name = "物料组描述")] |
|||
public string MaterialDesc { set; get; } |
|||
[Display(Name = "备注")] |
|||
public string Remark1 { set; get; } |
|||
|
|||
public int State { set; get; } |
|||
} |
|||
} |
Loading…
Reference in new issue