Browse Source

更新版本

FoShanPG
Administrator 3 years ago
parent
commit
50bc45397d
  1. 2
      src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Reports/ReportRequestDto/ReportRequestDto.cs
  2. 4
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSJitAppService.cs
  3. 25
      src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs
  4. 7
      src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml
  5. 180
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/WmsOutputSumDapperRepository.cs
  6. 2
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleFisDiffExportService.cs
  7. 237
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/WmsOutputSumExportService.cs
  8. 10
      src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobModule.cs

2
src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Reports/ReportRequestDto/ReportRequestDto.cs

@ -35,6 +35,7 @@ namespace Win.Sfs.SettleAccount.Reports.ReportRequestDto
}
public class BaseRequestDto
{
public string Version { set; get; }
@ -47,6 +48,7 @@ namespace Win.Sfs.SettleAccount.Reports.ReportRequestDto
public string ChassisNumber { set; get; }
public string MaterialGroup { set; get; }
public string SapCode { set; get; }
public string State { set; get; }
}
public class BaseKanbanReqestDto
{

4
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSJitAppService.cs

@ -383,9 +383,9 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
itm.BillNum,
GuidGenerator.Create()
,string.Empty
, itm.Qty
,itm.Qty
,itm.Price
,itm.Amt
,Math.Round(itm.Qty*itm.Price,2)
);
_lsCopy.Add(_detail);
}

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

@ -556,6 +556,31 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
return _taskid;
}
/// <summary>
///准时化未结差异比对表
/// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns>
[HttpPost]
[Route("WmsOutputSumExport-Make")]
[DisableRequestSizeLimit]
public async Task<string> WmsOutputSumExport(
BaseRequestDto input
)
{
List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version });
customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode });
customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup });
customConditionList.Add(new CustomCondition() { Name = "State", Value = string.IsNullOrEmpty(input.State) ? string.Empty : input.State });
var _taskid = await _service.ExportEnqueueAsync("出库单合计汇总输出", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(WmsOutputSumExportService), customConditionList, (rs) =>
{
});
return _taskid;
}
///// <summary>
///// 结算总成和ERP总成价格对比
///// </summary>

7
src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml

@ -3824,6 +3824,13 @@
<param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.WmsOutputSumExport(Win.Sfs.SettleAccount.Reports.ReportRequestDto.BaseRequestDto)">
<summary>
准时化未结差异比对表
</summary>
<param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.HQCarSettledDetailDiffExportServiceMake(Win.Sfs.SettleAccount.Reports.ReportRequestDto.HQKanbanRequestDto)">
<summary>
一汽轿车明细

180
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/WmsOutputSumDapperRepository.cs

@ -0,0 +1,180 @@
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 WmsOutputSum
{
[ExporterHeader(DisplayName = "物料号" )]
//物料号
public string MaterialCode { set; get; }
[ExporterHeader(DisplayName = "物料描述")]
//物料描述
public string MaterialDesc { set; get; }
[ExporterHeader(DisplayName = "物料组(车型)")]
//物料组(车型)
public string MaterialGroup { set; get; }
[ExporterHeader(DisplayName = "结算数量")]
public decimal Qty { set; get; }
[ExporterHeader(DisplayName = "单价")]
public decimal Price { set; get; }
[ExporterHeader(DisplayName = "金额")]
public decimal Amt { set; get; }
}
public class WmsOutputSumDapperRepository: DapperRepository<SettleAccountDbContext>, ITransientDependency
{
public WmsOutputSumDapperRepository(IDbContextProvider<SettleAccountDbContext> dbContextProvider)
: base(dbContextProvider)
{
}
public virtual List<WmsOutputSum> GetWmsSumReportList(string version,string state)
{
var str = "SELECT\n" +
" temp.MaterialCode,\n" +
" temp2.MaterialDesc,\n" +
" temp.Qty,\n" +
" temp.Price,\n" +
" Round( temp.Qty * temp.Price, 2 ) Amt,\n" +
" EstimateTypeDesc MaterialGroup ,\n" +
" EstimateType \n" +
"FROM\n" +
" (\n" +
" SELECT\n" +
" MaterialCode,\n" +
" SUM( Qty ) Qty,\n" +
" Price \n" +
" FROM\n" +
" Set_WmsJitOutPutDetial \n" +
" WHERE\n" +
" State = {1} \n" +
" AND VERSION = '{0}' \n" +
" GROUP BY\n" +
" MaterialCode,\n" +
" Price UNION ALL\n" +
" SELECT\n" +
" MaterialCode,\n" +
" SUM( Qty ) Qty,\n" +
" Price \n" +
" FROM\n" +
" Set_WmsKanbanOutPutDetial \n" +
" WHERE\n" +
" State = {1} \n" +
" AND VERSION = '{0}' \n" +
" GROUP BY\n" +
" MaterialCode,\n" +
" Price UNION ALL\n" +
" SELECT\n" +
" SapMaterialCode MaterialCode,\n" +
" SUM( Qty ) Qty,\n" +
" Price \n" +
" FROM\n" +
" Set_WmsWithOutKanbanOutPutDetial \n" +
" WHERE\n" +
" State = 2 \n" +
" AND VERSION = '{0}' \n" +
" GROUP BY\n" +
" SapMaterialCode,\n" +
" Price UNION ALL\n" +
" SELECT\n" +
" MaterialCode,\n" +
" SUM( Qty ) Qty,\n" +
" Price \n" +
" FROM\n" +
" Set_WmsSharePartOutPutDetial \n" +
" WHERE\n" +
" State = {1} \n" +
" AND VERSION = '{0}' \n" +
" GROUP BY\n" +
" MaterialCode,\n" +
" Price UNION ALL\n" +
" SELECT\n" +
" MaterialCode,\n" +
" SUM( Qty ) Qty,\n" +
" Price \n" +
" FROM\n" +
" Set_WmsSharePart90OutPutDetial \n" +
" WHERE\n" +
" State = {1} \n" +
" AND VERSION = '{0}' \n" +
" GROUP BY\n" +
" MaterialCode,\n" +
" Price UNION ALL\n" +
" SELECT\n" +
" MaterialCode,\n" +
" SUM( Qty ) Qty,\n" +
" Price \n" +
" FROM\n" +
" Set_WmsHQHKanbanOutPutDetial \n" +
" WHERE\n" +
" State = {1} \n" +
" AND VERSION = '{0}' \n" +
" GROUP BY\n" +
" MaterialCode,\n" +
" Price UNION ALL\n" +
" SELECT\n" +
" MaterialCode,\n" +
" SUM( Qty ) Qty,\n" +
" Price \n" +
" FROM\n" +
" Set_WmsHQFKanbanOutPutDetial \n" +
" WHERE\n" +
" State = {1} \n" +
" AND VERSION = '{0}' \n" +
" GROUP BY\n" +
" MaterialCode,\n" +
" Price UNION ALL\n" +
" SELECT\n" +
" MaterialCode,\n" +
" SUM( Qty ) Qty,\n" +
" Price \n" +
" FROM\n" +
" Set_WmsHQMKanbanOutPutDetial \n" +
" WHERE\n" +
" State = {1} \n" +
" AND VERSION = '{0}' \n" +
" GROUP BY\n" +
" MaterialCode,\n" +
" Price \n" +
" ) temp\n" +
" LEFT JOIN ( SELECT max( Id ) Id, MaterialCode, MaterialDesc, EstimateType, EstimateTypeDesc FROM Set_material GROUP BY MaterialCode, MaterialDesc, EstimateTypeDesc, EstimateType ) temp2 ON temp.MaterialCode = temp2.MaterialCode \n" +
"ORDER BY\n" +
" MaterialCode";
string _sql = string.Format(str, version,state);
var _query = DbConnection.Query<WmsOutputSum>(_sql,null,null,true,1200,null);
return _query.ToList();
}
}
}

2
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleFisDiffExportService.cs

@ -44,7 +44,6 @@ namespace SettleAccount.Job.Services.Report
var _ls= _list.GroupBy(p => new { p.MaterialCode,p.SapCode }).Select(p =>new SettleFisDiffSum
{
MaterialCode= p.Key.MaterialCode,
SapCode= p.Key.SapCode,
DiffPrice=p.Sum(p=>p.DiffPrice),
@ -53,7 +52,6 @@ namespace SettleAccount.Job.Services.Report
SettleQty=p.Sum(p=>p.SettleQty),
Price=p.Sum(p=>p.Price)
});
//_outputService.Export(id, string.Format("大众准时化结算数量差异比对表_{0}.xlsx", Guid.NewGuid().ToString()),_list.ToList(),_ls.ToList());
_outputService.Export<SettleFisDiffSum>(id, string.Format("大众准时化结算数量合计_{0}.xlsx", Guid.NewGuid().ToString()), _ls.ToList());

237
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/WmsOutputSumExportService.cs

@ -13,220 +13,71 @@ using Win.Sfs.SettleAccount.Repository.SettleAccountJob;
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report;
namespace SettleAccount.Job.Services.Report
{
public class WmsOutputSum
{
[ImporterHeader(Name = "物料号", AutoTrim = true)]
//物料号
public string MaterialCode { set; get; }
[ImporterHeader(Name = "物料描述", AutoTrim = true)]
//物料描述
public string MaterialDesc { set; get; }
[ImporterHeader(Name = "物料组(车型)", AutoTrim = true)]
//物料组(车型)
public string MaterialGroup { set; get; }
[ImporterHeader(Name = "结算数量")]
public decimal Qty { set; get; }
[ImporterHeader(Name = "单价")]
public decimal Price { set; get; }
[ImporterHeader(Name = "金额")]
public decimal Amt { set; get; }
}
//public class WmsOutputSum
//{
// [ImporterHeader(Name = "物料号", AutoTrim = true)]
// //物料号
// public string MaterialCode { set; get; }
// [ImporterHeader(Name = "物料描述", AutoTrim = true)]
// //物料描述
// public string MaterialDesc { set; get; }
// [ImporterHeader(Name = "物料组(车型)", AutoTrim = true)]
// //物料组(车型)
// public string MaterialGroup { set; get; }
// [ImporterHeader(Name = "结算数量")]
// public decimal Qty { set; get; }
// [ImporterHeader(Name = "单价")]
// public decimal Price { set; get; }
// [ImporterHeader(Name = "金额")]
// public decimal Amt { set; get; }
//}
public class WmsOutputSumExportService
: ITransientDependency, IExportJob
{
private readonly InvoiceSettledDetailDiffDapperRepository _dapperRepository;
private readonly ErpPartDapperRepository _erpdapperRepository;
private readonly WmsOutputSumDapperRepository _dapperRepository;
private readonly OutputService _outputService;
private readonly InputService _inputService;
public WmsOutputSumExportService(
ErpPartDapperRepository erpdapperRepository,
InvoiceSettledDetailDiffDapperRepository dapperRepository,
WmsOutputSumDapperRepository dapperRepository,
OutputService outputService,
InputService inputService
)
{
_inputService = inputService;
_outputService = outputService;
_erpdapperRepository = erpdapperRepository;
//_repository = repository;
//_versionRepository = versionRepository;
_dapperRepository = dapperRepository;
}
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> p_list)
{
return id.ToString();
var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value;
var materialCode = p_list.Where(p => p.Name == "MaterialCode").FirstOrDefault().Value;
var materialGroup = p_list.Where(p => p.Name == "MaterialGroup").FirstOrDefault().Value;
var state = p_list.Where(p => p.Name == "State").FirstOrDefault().Value;
var _ls= _dapperRepository.GetWmsSumReportList(version, state);
if (!string.IsNullOrEmpty(materialGroup))
{
var _groupList = materialGroup.Split(new char[] { ',' }).Distinct().ToList();
if (_groupList.Count() > 0)
{
_ls = _ls.Where(p => _groupList.Contains(p.MaterialGroup)).ToList();
}
}
if (!string.IsNullOrEmpty(materialCode))
{
var _groupList = materialCode.Split(new char[] { ',' }).Distinct().ToList();
if (_groupList.Count() > 0)
{
_ls = _ls.Where(p => _groupList.Contains(p.MaterialCode)).ToList();
}
}
var _first = exportName.FirstOrDefault();
_outputService.Export<WmsOutputSum>(id,_first, _ls);
return id.ToString(); ;
}
//public List<WmsOutputSum> InvoiceSettledDetailExportFile(Guid id, List<string> exportName, List<CustomCondition> p_list)
//{
// //var _filename = exportName.FirstOrDefault();
// //var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value;
// //var materialCode = p_list.Where(p => p.Name == "MaterialCode").FirstOrDefault().Value;
// //var begin = p_list.Where(p => p.Name == "BeginTime").FirstOrDefault().Value;
// //var end = p_list.Where(p => p.Name == "EndTime").FirstOrDefault().Value;
// //var cp7begin = p_list.Where(p => p.Name == "Cp7BeginTime").FirstOrDefault().Value;
// //var cp7end = p_list.Where(p => p.Name == "Cp7EndTime").FirstOrDefault().Value;
// //var kenncode = p_list.Where(p => p.Name == "KennCode").FirstOrDefault().Value;
// //var chassisNumber = p_list.Where(p => p.Name == "ChassisNumber").FirstOrDefault().Value;
// //var materialGroup = p_list.Where(p => p.Name == "MaterialGroup").FirstOrDefault().Value;
// //var sapCode = p_list.Where(p => p.Name == "SapCode").FirstOrDefault().Value;
// //var _ls = _dapperRepository.GetInvoiceSettledDetailDiffReportList(version, materialCode, begin, end, cp7begin, cp7end, kenncode, chassisNumber, materialGroup);
// //var _list = _ls.Where(p => p.ParentSapMaterialCode != p.SapMaterialCode).GroupBy(p => new { p.ParentSapMaterialCode, p.ChassisNumber, p.KENNCode })
// //.Select(p => p.FirstOrDefault()).ToList();
// //var rangeList = _erpdapperRepository.GetSapList<InvoiceSettledDetailDiff>(_list, version, true);
// //var diffList = _erpdapperRepository.GetSettleInvoiceDiff(version);
// //if (_ls.Count > 0)
// //{
// // var erpPriceList = _ls.Where(p => p.ParentSapMaterialCode != p.SapMaterialCode)
// // .GroupBy(p => new { p.ParentSapMaterialCode, p.ChassisNumber, p.KENNCode })
// // .Select(p => new { ParentSapMaterialCode = p.Key.ParentSapMaterialCode, ChassisNumber = p.Key.ChassisNumber, KENNCode = p.Key.KENNCode, Price = p.Sum(itm => itm.InvoiceAmt) }).ToList();
// // var rangList = from itm1 in rangeList
// // join itm2 in erpPriceList
// // on new { itm1.ParentSapMaterialCode, itm1.KENNCode, itm1.ChassisNumber }
// // equals new { itm2.ParentSapMaterialCode, itm2.KENNCode, itm2.ChassisNumber }
// // into temp1
// // from tm1 in temp1.DefaultIfEmpty()
// // select new InvoiceSettledDetailDiff
// // {
// // WmsBillNum = itm1.WmsBillNum,
// // CP5Time = itm1.CP5Time,
// // KENNCode = itm1.KENNCode,
// // ChassisNumber = itm1.ChassisNumber,
// // WmsState = itm1.WmsState,
// // SapMaterialCode = itm1.SapMaterialCode,
// // MaterialDesc = itm1.MaterialDesc,
// // MaterialCode = itm1.MaterialCode,
// // ParentSapMaterialCode = itm1.ParentSapMaterialCode,
// // ParentMaterialDesc = itm1.ParentMaterialDesc,
// // MaterialGroup = itm1.MaterialGroup,
// // Price = itm1.Price,
// // Amt = itm1.Amt,
// // Qty = 1,
// // SettledQty = 1,
// // CP7Time = itm1.CP7Time,
// // DiffSettleFisQty = 0,
// // DiffSettleInvQty = 0,
// // InvoiceQty = 1,
// // InvoicePrice = itm1 == null ? 0 : tm1.Price,
// // InvoiceAmt = itm1 == null ? 0 : tm1.Price,
// // SettleAmt = itm1 == null ? 0 : tm1.Price,
// // DiffPrice = itm1 == null ? 0 - itm1.Price : tm1.Price - itm1.Price
// // };
// // rangeList = rangList.ToList();
// // foreach (var itm in diffList)
// // {
// // var _first = _ls.FirstOrDefault(p => p.MaterialCode == itm.MaterialCode);
// // if (_first != null)
// // {
// // _first.InvoiceQty = _first.SettledQty + itm.DiffQty;
// // _first.DiffSettleInvQty = itm.DiffQty;
// // }
// // }
// // foreach (var itm in _ls)
// // {
// // itm.InvoiceAmt = Math.Round(itm.InvoiceQty * itm.InvoicePrice, 2);
// // itm.DiffPrice = itm.Price - itm.InvoicePrice;
// // }
// // _ls.AddRange(rangeList);
// // //var list1 = _ls.GroupBy(p => new { p.ChassisNumber, p.MaterialCode, p.SettleReadyQty }).Select(p => new { SettleQty = p.Key.SettleReadyQty, MaterialCode = p.Key.MaterialCode, ChassisNumber = p.Key.ChassisNumber, Qty = p.Sum(itm => itm.Qty) }).Where(p => p.Qty > 1).ToList();
// // //foreach (var itm in list1)
// // //{
// // // var _first = _ls.FirstOrDefault(p => p.ChassisNumber == itm.ChassisNumber && p.MaterialCode == itm.MaterialCode && p.SettleReadyQty == itm.SettleQty);
// // // if (_first != null)
// // // {
// // // _first.DiffSettleFisQty = itm.Qty - itm.SettleQty;
// // // }
// // //}
// // if (!string.IsNullOrEmpty(materialGroup))
// // {
// // var _groupList = materialGroup.Split(new char[] { ',' }).Distinct().ToList();
// // if (_groupList.Count() > 0)
// // {
// // _ls = _ls.Where(p => _groupList.Contains(p.MaterialGroup)).ToList();
// // }
// // }
// // if (!string.IsNullOrEmpty(kenncode))
// // {
// // var _groupList = kenncode.Split("\n").ToList();
// // if (_groupList.Count() > 0)
// // {
// // _ls = _ls.Where(p => _groupList.Contains(p.KENNCode)).ToList();
// // }
// // }
// // if (!string.IsNullOrEmpty(chassisNumber))
// // {
// // var _groupList = chassisNumber.Split("\n").ToList();
// // if (_groupList.Count() > 0)
// // {
// // _ls = _ls.Where(p => _groupList.Contains(p.ChassisNumber)).ToList();
// // }
// // }
// // if (!string.IsNullOrEmpty(materialCode))
// // {
// // var _groupList = materialCode.Split(new char[] { '\n' }).Distinct().ToList();
// // if (_groupList.Count() > 0)
// // {
// // _ls = _ls.Where(p => _groupList.Contains(p.MaterialCode)).ToList();
// // }
// // }
// // if (!string.IsNullOrEmpty(sapCode))
// // {
// // var _groupList = sapCode.Split(new char[] { '\n' }).Distinct().ToList();
// // if (_groupList.Count() > 0)
// // {
// // _ls = _ls.Where(p => _groupList.Contains(p.SapMaterialCode)).ToList();
// // }
// // }
// // //.Select(p => p.FirstOrDefault());
// // _ls = _ls.OrderBy(p => p.ChassisNumber).ThenBy(p => p.KENNCode).ThenBy(p => p.SapMaterialCode).ToList();
// //}
// //_ls=_ls.Where(p => p.SapMaterialCode == p.MaterialCode).ToList();
// //var _lstSum= _ls.GroupBy(p => new { p.MaterialGroup, p.MaterialCode, p.InvoicePrice, p.InvoiceAmt,p.MaterialDesc })
// // .Select(p => new WmsOutputSum
// // {
// // MaterialCode=p.Key.MaterialCode,
// // MaterialGroup=p.Key.MaterialGroup,
// // Price=p.Key.InvoicePrice,
// // Amt=p.Sum(p=>p.InvoiceAmt),
// // MaterialDesc=p.Key.MaterialDesc,
// // Qty=p.Sum(p=>p.Qty)
// // });
// //return _lstSum;
//}
}

10
src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobModule.cs

@ -196,14 +196,12 @@ namespace Win.Sfs.SettleAccount
{
return implementationFactory.GetService<HQFShippingExportService>();
}
if (key.Equals(typeof(WmsOutputSumExportService).FullName))
{
return implementationFactory.GetService<WmsOutputSumExportService>();
}
else
{
throw new ArgumentException($"Not Support key:{key}");
}
}; return accesor;

Loading…
Cancel
Save