Browse Source

大众备件0-90天数据调整发货(无采购订单号)

FoShanPG
44673626 3 years ago
parent
commit
330518ac9f
  1. 119
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/VWSparePart/SparePartAppService.cs
  2. 92
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePart90AppService.cs
  3. 7
      src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml
  4. 118
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs
  5. 49
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs
  6. 2
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleKBWithCodeDapperReportRepository.cs
  7. 148
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePart90DapperReportRepository.cs
  8. 31
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs
  9. 43
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleSparePart90ExportService.cs

119
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/VWSparePart/SparePartAppService.cs

@ -30,7 +30,7 @@ namespace Win.Sfs.SettleAccount.Entities.VWSparePart
/// 大众备件服务 /// 大众备件服务
/// </summary> /// </summary>
[Route("api/settleaccount/SparePart")] [Route("api/settleaccount/SparePart")]
[Authorize(SettleAccountPermissions.SparePart.Default)] //[Authorize(SettleAccountPermissions.SparePart.Default)]
public class SparePartAppService : SettleAccountApplicationBase<SparePart>, ISparePartAppService public class SparePartAppService : SettleAccountApplicationBase<SparePart>, ISparePartAppService
{ {
private readonly IGuidGenerator _guidGenerator; private readonly IGuidGenerator _guidGenerator;
@ -84,7 +84,7 @@ namespace Win.Sfs.SettleAccount.Entities.VWSparePart
var _versionQuery = _versionRepository.Where(p => p.Version == version); var _versionQuery = _versionRepository.Where(p => p.Version == version);
await _versionQuery.BatchDeleteAsync(); await _versionQuery.BatchDeleteAsync();
//删除明细 //删除明细
var _query = _repository.Where(p => p.Version == version); var _query = _repository.Where(p => p.Version == version && p.Extend != "is90");
await _query.BatchDeleteAsync(); await _query.BatchDeleteAsync();
//插入数据前检验 //插入数据前检验
var checkList = new List<ErrorExportDto>(); var checkList = new List<ErrorExportDto>();
@ -115,7 +115,7 @@ namespace Win.Sfs.SettleAccount.Entities.VWSparePart
[HttpPost] [HttpPost]
[Route("ExcelImport90")] [Route("ExcelImport90")]
[DisableRequestSizeLimit] [DisableRequestSizeLimit]
[Authorize(SettleAccountPermissions.SettleAccounts.Create)] //[Authorize(SettleAccountPermissions.SettleAccounts.Create)]
public async Task<string> SparePartUploadExcelImport90([FromForm] IFormFileCollection files, Guid branchId, string year, string period, string version, string customerCode) public async Task<string> SparePartUploadExcelImport90([FromForm] IFormFileCollection files, Guid branchId, string year, string period, string version, string customerCode)
{ {
if (string.IsNullOrEmpty(version)) if (string.IsNullOrEmpty(version))
@ -129,7 +129,7 @@ namespace Win.Sfs.SettleAccount.Entities.VWSparePart
var _versionQuery = _versionRepository.Where(p => p.Version == version); var _versionQuery = _versionRepository.Where(p => p.Version == version);
await _versionQuery.BatchDeleteAsync(); await _versionQuery.BatchDeleteAsync();
//删除明细 //删除明细
var _query = _repository.Where(p => p.Version == version); var _query = _repository.Where(p => p.Version == version && p.Extend == "is90");
await _query.BatchDeleteAsync(); await _query.BatchDeleteAsync();
//插入数据前检验 //插入数据前检验
var checkList = new List<ErrorExportDto>(); var checkList = new List<ErrorExportDto>();
@ -217,7 +217,56 @@ namespace Win.Sfs.SettleAccount.Entities.VWSparePart
var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, int.MaxValue, var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, int.MaxValue,
0, true); 0, true);
var dtoDetails = ObjectMapper.Map<List<SparePart>, List<SparePartExportDto>>(entities); var dtoDetails = ObjectMapper.Map<List<SparePart>, List<SparePartExportDto>>(entities.Where(p => p.Extend == "not90").ToList());
string _fileName = string.Empty;
//声明导出容器
byte[] result = null;
switch (input.FileType)
{
case 0:
_fileName = string.Format("大众备件结算明细_{0}.csv", input.UserId.ToString());
result = await _csv.ExportAsByteArray(dtoDetails);
break;
case 1:
_fileName = string.Format("大众备件结算明细_{0}.xlsx", input.UserId.ToString());
result = await _excel.ExportAsByteArray(dtoDetails);
break;
}
result.ShouldNotBeNull();
//保存导出文件到服务器存成二进制
await _excelImportService.SaveBlobAsync(
new SaveExcelImportInputDto
{
Name = _fileName,
Content = result
}
);
return _fileName;
}
[HttpPost]
[Route("Export90")]
//[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
virtual public async Task<string> Export90Async(SparePartRequestDto input)
{
if (string.IsNullOrEmpty(input.Version))
{
throw new BusinessException("版本不能空,必须传入!");
}
IExporter _csv = new CsvExporter();
IExporter _excel = new ExcelExporter();
if (!string.IsNullOrEmpty(input.Version))
{
input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Version", Logic = EnumFilterLogic.And, Value = input.Version });
}
var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, int.MaxValue,
0, true);
var dtoDetails = ObjectMapper.Map<List<SparePart>, List<SparePartExportDto>>(entities.Where(p => p.Extend == "is90").ToList());
string _fileName = string.Empty; string _fileName = string.Empty;
//声明导出容器 //声明导出容器
@ -256,6 +305,36 @@ namespace Win.Sfs.SettleAccount.Entities.VWSparePart
/// </remarks> /// </remarks>
/// <param name="input">请求条件</param> /// <param name="input">请求条件</param>
/// <returns>实体DTO列表</returns> /// <returns>实体DTO列表</returns>
//[HttpPost]
//[Route("list")]
////[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
//virtual public async Task<PagedResultDto<SparePartDto>> GetListAsync(SparePartRequestDto input)
//{
// if (!string.IsNullOrEmpty(input.Version))
// {
// input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Version", Logic = EnumFilterLogic.And, Value = input.Version });
// }
// else
// {
// return new PagedResultDto<SparePartDto>(0, new List<SparePartDto>());
// }
// var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, input.MaxResultCount,
// input.SkipCount, true);
// if (entities == null || entities.Count == 0)
// {
// return new PagedResultDto<SparePartDto>(0, null);
// }
// else
// {
// input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Extend", Logic = EnumFilterLogic.And, Value = "not90"});
// }
// var totalCount = await GetCountAsync(input);
// var dtos = ObjectMapper.Map<List<SparePart>, List<SparePartDto>>(entities.Where(p => p.Extend == "not90").ToList());
// return new PagedResultDto<SparePartDto>(totalCount, dtos);
//}
[HttpPost] [HttpPost]
[Route("list")] [Route("list")]
//[Authorize(SettleAccountPermissions.SettleAccounts.Default)] //[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
@ -279,6 +358,36 @@ namespace Win.Sfs.SettleAccount.Entities.VWSparePart
return new PagedResultDto<SparePartDto>(totalCount, dtos); return new PagedResultDto<SparePartDto>(totalCount, dtos);
} }
[HttpPost]
[Route("list90")]
//[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
virtual public async Task<PagedResultDto<SparePartDto>> GetList90Async(SparePartRequestDto input)
{
if (!string.IsNullOrEmpty(input.Version))
{
input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Version", Logic = EnumFilterLogic.And, Value = input.Version });
}
else
{
return new PagedResultDto<SparePartDto>(0, new List<SparePartDto>());
}
var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, input.MaxResultCount,
input.SkipCount, true);
if (entities == null || entities.Count==0)
{
return new PagedResultDto<SparePartDto>(0, null);
}
else
{
input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Extend", Logic = EnumFilterLogic.And, Value = "is90" });
}
var totalCount = await GetCountAsync(input);
var dtos = ObjectMapper.Map<List<SparePart>, List<SparePartDto>>(entities.Where(p=>p.Extend=="is90").ToList());
return new PagedResultDto<SparePartDto>(totalCount, dtos);
}
/// <summary> /// <summary>
/// 获取实体总数 /// 获取实体总数

92
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePart90AppService.cs

@ -21,6 +21,7 @@ using Win.Sfs.SettleAccount.Entities.Wms;
using Win.Sfs.SettleAccount.ExcelImporter; using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.SettleAccount.ExportReports; using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.SettleAccount.Repository; using Win.Sfs.SettleAccount.Repository;
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report;
using Win.Sfs.Shared.Filter; using Win.Sfs.Shared.Filter;
using WY.NewJit.Extends.PaiGe.WMS; using WY.NewJit.Extends.PaiGe.WMS;
@ -29,11 +30,12 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
[Route("api/settleaccount/wmsSharePart90output")] [Route("api/settleaccount/wmsSharePart90output")]
[Authorize(SettleAccountPermissions.WMSJIT.Default)] [Authorize(SettleAccountPermissions.WMSJIT.Default)]
public class WMSSharePart90AppService : public class WMSSharePart90AppService :
SettleAccountApplicationBase<WmsSharePartOutPutDetial> SettleAccountApplicationBase<WmsSharePart90OutPutDetial>
{ {
private readonly ISettleAccountBranchEfCoreRepository<WmsSharePartOutPutDetial, Guid> _wmsRepository; private readonly ISettleAccountBranchEfCoreRepository<WmsSharePart90OutPutDetial, Guid> _wmsRepository;
private readonly ISettleAccountBranchEfCoreRepository<WmsSharePartOutPut, Guid> _wmsVersionRepository; private readonly ISettleAccountBranchEfCoreRepository<WmsSharePart90OutPut, Guid> _wmsVersionRepository;
private readonly WMSEfCoreRepository<WmsSharePartOutPutDetial> _wmsefRespository; private readonly WMSEfCoreRepository<WmsSharePart90OutPutDetial> _wmsefRespository;
private readonly WmsDapperRepository _wmsDapper;
private readonly WMSEfCoreRepository<TB_BILL> _wmstbRespository; private readonly WMSEfCoreRepository<TB_BILL> _wmstbRespository;
private readonly ISettleAccountBranchEfCoreRepository<TaskJob, Guid> _job; private readonly ISettleAccountBranchEfCoreRepository<TaskJob, Guid> _job;
@ -48,16 +50,22 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
/// <param name="wmsVersionRepository"></param> /// <param name="wmsVersionRepository"></param>
/// <param name="wmsefRespository"></param> /// <param name="wmsefRespository"></param>
/// <param name="wmstbRespository"></param> /// <param name="wmstbRespository"></param>
/// <param name="excelImportService"></param>
/// <param name="cache"></param>
/// <param name="snowflakeIdGenerator"></param>
/// <param name="wmsDapper"></param>
/// <param name="commonManager"></param>
public WMSSharePart90AppService( public WMSSharePart90AppService(
ISettleAccountBranchEfCoreRepository<WmsSharePartOutPutDetial, Guid> wmsRepository, ISettleAccountBranchEfCoreRepository<WmsSharePart90OutPutDetial, Guid> wmsRepository,
ISettleAccountBranchEfCoreRepository<TaskJob, Guid> job, ISettleAccountBranchEfCoreRepository<TaskJob, Guid> job,
ISettleAccountBranchEfCoreRepository<WmsSharePartOutPut, Guid> wmsVersionRepository, ISettleAccountBranchEfCoreRepository<WmsSharePart90OutPut, Guid> wmsVersionRepository,
WMSEfCoreRepository<WmsSharePartOutPutDetial> wmsefRespository, WMSEfCoreRepository<WmsSharePart90OutPutDetial> wmsefRespository,
WMSEfCoreRepository<TB_BILL> wmstbRespository, WMSEfCoreRepository<TB_BILL> wmstbRespository,
IExcelImportAppService excelImportService, IExcelImportAppService excelImportService,
IDistributedCache<WmsSharePartOutPutDetial> cache, IDistributedCache<WmsSharePart90OutPutDetial> cache,
ISnowflakeIdGenerator snowflakeIdGenerator, ISnowflakeIdGenerator snowflakeIdGenerator,
WmsDapperRepository wmsDapper,
ICommonManager commonManager ICommonManager commonManager
) : base(cache, excelImportService, snowflakeIdGenerator, commonManager) ) : base(cache, excelImportService, snowflakeIdGenerator, commonManager)
{ {
@ -67,6 +75,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
_wmsRepository = wmsRepository; _wmsRepository = wmsRepository;
_wmsVersionRepository = wmsVersionRepository; _wmsVersionRepository = wmsVersionRepository;
_wmsefRespository = wmsefRespository; _wmsefRespository = wmsefRespository;
_wmsDapper = wmsDapper;
} }
private async Task<long> GetCountAsync(WmsSharePartOutPutDetialRequestDto input) private async Task<long> GetCountAsync(WmsSharePartOutPutDetialRequestDto input)
@ -88,7 +97,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
[HttpPost] [HttpPost]
[Route("WmsSharePartList")] [Route("WmsSharePartList")]
//[Authorize(SettleAccountPermissions.SettleAccounts.Default)] //[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
virtual public async Task<PagedResultDto<WmsSharePartOutPut>> GetListAsync(WmsSharePartOutPutRequestDto input) virtual public async Task<PagedResultDto<WmsSharePart90OutPut>> GetListAsync(WmsSharePartOutPutRequestDto input)
{ {
var entities = await _wmsVersionRepository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, input.MaxResultCount, var entities = await _wmsVersionRepository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, input.MaxResultCount,
@ -97,7 +106,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
var totalCount = await GetCountAsync(input); var totalCount = await GetCountAsync(input);
return new PagedResultDto<WmsSharePartOutPut>(totalCount, entities); return new PagedResultDto<WmsSharePart90OutPut>(totalCount, entities);
} }
/// <summary> /// <summary>
@ -108,14 +117,45 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
[HttpPost] [HttpPost]
[Route("WmsSharePartDetailList")] [Route("WmsSharePartDetailList")]
//[Authorize(SettleAccountPermissions.SettleAccounts.Default)] //[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
virtual public async Task<PagedResultDto<WmsSharePartOutPutDetial>> GetListAsync(WmsSharePartOutPutDetialRequestDto input) virtual public async Task<PagedResultDto<WmsSharePart90OutPutDetial>> GetListAsync(WmsSharePartOutPutDetialRequestDto input)
{ {
input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "BillNum", Logic = EnumFilterLogic.And, Value = input.BillNum }); input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "BillNum", Logic = EnumFilterLogic.And, Value = input.BillNum });
var entities = await _wmsRepository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, input.MaxResultCount, var entities = await _wmsRepository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, input.MaxResultCount,
input.SkipCount, true); input.SkipCount, true);
var totalCount = await GetCountAsync(input); var totalCount = await GetCountAsync(input);
return new PagedResultDto<WmsSharePartOutPutDetial>(totalCount, entities);
var stockList = _wmsDapper.GetSalesStock();
var query = from itm in entities
join itm1 in stockList on itm.MaterialCode equals itm1.SapCode
into temp1
from tm1 in temp1.DefaultIfEmpty()
select new WmsSharePart90OutPutDetial(//少加个发货,由于零件有重复
itm.Id,
itm.WmsBillNum,
itm.OrderBillNum,
itm.MaterialCode,
itm.MaterialDesc,
itm.MaterialGroup,
itm.OutPut,
itm.InPut,
itm.State,
itm.Extend1,
itm.Extend2,
itm.Version,
itm.ParentMaterialCode,
itm.BillNum,
itm.TaskId,
itm.Remark,
itm.Qty,
tm1 == null ? 0 : tm1.Qty,
itm.OutPutQty
);
return new PagedResultDto<WmsSharePart90OutPutDetial>(totalCount, entities);
} }
/// <summary> /// <summary>
/// 任务明细标记已确认 /// 任务明细标记已确认
@ -151,16 +191,16 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
if (_joblist.Count() > 0) if (_joblist.Count() > 0)
{ {
var fileList = _joblist.Select(p => p.RealDownFileName).ToList(); var fileList = _joblist.Select(p => p.RealDownFileName).ToList();
List<WmsSharePartOutPutDetial> _lst = new List<WmsSharePartOutPutDetial>(); List<WmsSharePart90OutPutDetial> _lst = new List<WmsSharePart90OutPutDetial>();
foreach (var filename in fileList) foreach (var filename in fileList)
{ {
string fileSavePath = Environment.CurrentDirectory + @"\wwwroot\files\host\my-file-container\" + filename; string fileSavePath = Environment.CurrentDirectory + @"\wwwroot\files\host\my-file-container\" + filename;
ExcelHelper _excelHelper = new ExcelHelper(fileSavePath); ExcelHelper _excelHelper = new ExcelHelper(fileSavePath);
var _list = _excelHelper.ExcelToList<WmsSharePartOutPutDetial>(); var _list = _excelHelper.ExcelToList<WmsSharePart90OutPutDetial>();
if (_list.Count() > 0) if (_list.Count() > 0)
{ {
var _lsAry = _list.Select(p => new var _lsAry = _list.Select(p => new
WmsSharePartOutPutDetial( WmsSharePart90OutPutDetial(
GuidGenerator.Create(), GuidGenerator.Create(),
p.WmsBillNum, p.WmsBillNum,
p.OrderBillNum, p.OrderBillNum,
@ -178,6 +218,8 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
_billNum, _billNum,
GuidGenerator.Create(), GuidGenerator.Create(),
string.Empty, string.Empty,
p.Qty,
p.StockQty,
p.Qty p.Qty
)); ));
_lst.AddRange(_list.ToArray()); _lst.AddRange(_list.ToArray());
@ -206,7 +248,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
select itm1; select itm1;
var _wmslst = query.ToList(); var _wmslst = query.ToList();
_wmslst = _wmslst.Select(p => new _wmslst = _wmslst.Select(p => new
WmsSharePartOutPutDetial( WmsSharePart90OutPutDetial(
GuidGenerator.Create(), GuidGenerator.Create(),
p.WmsBillNum, p.WmsBillNum,
p.OrderBillNum, p.OrderBillNum,
@ -223,13 +265,15 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
_billNum, _billNum,
GuidGenerator.Create(), GuidGenerator.Create(),
string.Empty, string.Empty,
p.Qty,
p.StockQty,
p.Qty p.Qty
)).ToList(); )).ToList();
await _wmsRepository.GetDbContext().BulkInsertAsync(_wmslst, new BulkConfig() { BulkCopyTimeout = 0, BatchSize = 10000 }); await _wmsRepository.GetDbContext().BulkInsertAsync(_wmslst, new BulkConfig() { BulkCopyTimeout = 0, BatchSize = 10000 });
int _count = _wmsVersionRepository.Count(p => p.Version == input.Version && p.BillNum == _billNum); int _count = _wmsVersionRepository.Count(p => p.Version == input.Version && p.BillNum == _billNum);
if (_wmslst.Count() > 0 && _count == 0) if (_wmslst.Count() > 0 && _count == 0)
{ {
var _version = new WmsSharePartOutPut(GuidGenerator.Create(), input.Version, _billNum, CurrentUser.Email); var _version = new WmsSharePart90OutPut(GuidGenerator.Create(), input.Version, _billNum, CurrentUser.Email);
await _wmsVersionRepository.InsertAsync(_version, true); await _wmsVersionRepository.InsertAsync(_version, true);
} }
foreach (var job in _joblist) foreach (var job in _joblist)
@ -273,7 +317,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
{ {
if (input.Guids != null) if (input.Guids != null)
{ {
List<WmsSharePartOutPutDetial> _ls = new List<WmsSharePartOutPutDetial>(); List<WmsSharePart90OutPutDetial> _ls = new List<WmsSharePart90OutPutDetial>();
if (input.Guids.Count() > 0) if (input.Guids.Count() > 0)
{ {
_ls = await _wmsRepository.Where(p => input.Guids.Contains(p.Id) && p.Version == input.Version && p.BillNum == input.BillNum && p.State != 2).ToListAsync(); _ls = await _wmsRepository.Where(p => input.Guids.Contains(p.Id) && p.Version == input.Version && p.BillNum == input.BillNum && p.State != 2).ToListAsync();
@ -375,13 +419,13 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
{ {
var _billNum = "B" + DateTime.Now.ToString("yyyyMMddhhmmss"); var _billNum = "B" + DateTime.Now.ToString("yyyyMMddhhmmss");
ExportImporter _exportImporter = new ExportImporter(); ExportImporter _exportImporter = new ExportImporter();
var result = await _exportImporter.ExtendExcelImport<WmsSharePartOutPutDetial>(files, _excelImportService); var result = await _exportImporter.ExtendExcelImport<WmsSharePart90OutPutDetial>(files, _excelImportService);
List<WmsSharePartOutPutDetial> _lst = new List<WmsSharePartOutPutDetial>(); List<WmsSharePart90OutPutDetial> _lst = new List<WmsSharePart90OutPutDetial>();
var _lsCopy = new List<WmsSharePartOutPutDetial>(); var _lsCopy = new List<WmsSharePart90OutPutDetial>();
foreach (var itm in result) foreach (var itm in result)
{ {
WmsSharePartOutPutDetial _detail = new WmsSharePartOutPutDetial( WmsSharePart90OutPutDetial _detail = new WmsSharePart90OutPutDetial(
GuidGenerator.Create(), GuidGenerator.Create(),
itm.WmsBillNum, itm.WmsBillNum,
itm.OrderBillNum, itm.OrderBillNum,
@ -400,6 +444,8 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
GuidGenerator.Create() GuidGenerator.Create()
, string.Empty , string.Empty
, itm.Qty , itm.Qty
, 0
, itm.Qty
); );
_lsCopy.Add(_detail); _lsCopy.Add(_detail);
} }
@ -444,7 +490,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
int _count = _wmsVersionRepository.Count(p => p.Version == version && p.BillNum == _billNum); int _count = _wmsVersionRepository.Count(p => p.Version == version && p.BillNum == _billNum);
if (_count == 0 && _wmslst.Count() > 0) if (_count == 0 && _wmslst.Count() > 0)
{ {
var _version = new WmsSharePartOutPut(GuidGenerator.Create(), version, _billNum, CurrentUser.Email); var _version = new WmsSharePart90OutPut(GuidGenerator.Create(), version, _billNum, CurrentUser.Email);
await _wmsVersionRepository.InsertAsync(_version, true); await _wmsVersionRepository.InsertAsync(_version, true);
} }
return ApplicationConsts.SuccessStr; return ApplicationConsts.SuccessStr;

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

@ -3043,7 +3043,7 @@
<param name="p_list"></param> <param name="p_list"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Win.Sfs.SettleAccount.Entities.WMS.WMSSharePart90AppService.#ctor(Win.Sfs.SettleAccount.ISettleAccountBranchEfCoreRepository{Win.Sfs.SettleAccount.Entities.WMS.WmsSharePartOutPutDetial,System.Guid},Win.Sfs.SettleAccount.ISettleAccountBranchEfCoreRepository{Win.Sfs.SettleAccount.Entities.TaskJob,System.Guid},Win.Sfs.SettleAccount.ISettleAccountBranchEfCoreRepository{Win.Sfs.SettleAccount.Entities.WMS.WmsSharePartOutPut,System.Guid},Win.Sfs.SettleAccount.Repository.WMSEfCoreRepository{Win.Sfs.SettleAccount.Entities.WMS.WmsSharePartOutPutDetial},Win.Sfs.SettleAccount.Repository.WMSEfCoreRepository{WY.NewJit.Extends.PaiGe.WMS.TB_BILL},Win.Sfs.BaseData.ImportExcelCommon.IExcelImportAppService,Volo.Abp.Caching.IDistributedCache{Win.Sfs.SettleAccount.Entities.WMS.WmsSharePartOutPutDetial},Win.Abp.Snowflakes.ISnowflakeIdGenerator,Win.Sfs.SettleAccount.CommonManagers.ICommonManager)"> <member name="M:Win.Sfs.SettleAccount.Entities.WMS.WMSSharePart90AppService.#ctor(Win.Sfs.SettleAccount.ISettleAccountBranchEfCoreRepository{Win.Sfs.SettleAccount.Entities.WMS.WmsSharePart90OutPutDetial,System.Guid},Win.Sfs.SettleAccount.ISettleAccountBranchEfCoreRepository{Win.Sfs.SettleAccount.Entities.TaskJob,System.Guid},Win.Sfs.SettleAccount.ISettleAccountBranchEfCoreRepository{Win.Sfs.SettleAccount.Entities.WMS.WmsSharePart90OutPut,System.Guid},Win.Sfs.SettleAccount.Repository.WMSEfCoreRepository{Win.Sfs.SettleAccount.Entities.WMS.WmsSharePart90OutPutDetial},Win.Sfs.SettleAccount.Repository.WMSEfCoreRepository{WY.NewJit.Extends.PaiGe.WMS.TB_BILL},Win.Sfs.BaseData.ImportExcelCommon.IExcelImportAppService,Volo.Abp.Caching.IDistributedCache{Win.Sfs.SettleAccount.Entities.WMS.WmsSharePart90OutPutDetial},Win.Abp.Snowflakes.ISnowflakeIdGenerator,Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report.WmsDapperRepository,Win.Sfs.SettleAccount.CommonManagers.ICommonManager)">
<summary> <summary>
</summary> </summary>
@ -3052,6 +3052,11 @@
<param name="wmsVersionRepository"></param> <param name="wmsVersionRepository"></param>
<param name="wmsefRespository"></param> <param name="wmsefRespository"></param>
<param name="wmstbRespository"></param> <param name="wmstbRespository"></param>
<param name="excelImportService"></param>
<param name="cache"></param>
<param name="snowflakeIdGenerator"></param>
<param name="wmsDapper"></param>
<param name="commonManager"></param>
</member> </member>
<member name="M:Win.Sfs.SettleAccount.Entities.WMS.WMSSharePart90AppService.GetListAsync(Win.Sfs.SettleAccount.Entities.Wms.WmsSharePartOutPutRequestDto)"> <member name="M:Win.Sfs.SettleAccount.Entities.WMS.WMSSharePart90AppService.GetListAsync(Win.Sfs.SettleAccount.Entities.Wms.WmsSharePartOutPutRequestDto)">
<summary> <summary>

118
src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs

@ -1499,7 +1499,125 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
} }
public class WmsSharePart90OutPut : FullAuditedAggregateRootBase<Guid>
{
public WmsSharePart90OutPut()
{
}
public WmsSharePart90OutPut(Guid id, string version, string billNum, string creator) : base(id)
{
Id = id;
Version = version;
BillNum = billNum;
Creator = creator;
}
public string Version { set; get; }
public string BillNum { set; get; }
public string Creator { set; get; }
}
public class WmsSharePart90OutPutDetial : FullAuditedAggregateRootBase<Guid>
{
public WmsSharePart90OutPutDetial()
{
}
public WmsSharePart90OutPutDetial(Guid id, string wmsBillNum, string orderBillNum, string materialCode, string materialDesc, string materialGroup, string outPut, string inPut, int state, string extend1, string extend2, string extend3, string parentMaterialCode, string billNum, Guid taskId, string remark, decimal qty, decimal stockQty, decimal outputQty)
{
Id = id;
WmsBillNum = wmsBillNum;
OrderBillNum = orderBillNum;
MaterialCode = materialCode;
MaterialDesc = materialDesc;
MaterialGroup = materialGroup;
OutPut = outPut;
InPut = inPut;
State = state;
Extend1 = extend1;
Extend2 = extend2;
Version = extend3;
ParentMaterialCode = parentMaterialCode;
BillNum = billNum;
TaskId = taskId;
Remark = remark;
Qty = qty;
}
public void SetId(Guid id)
{
Id = id;
}
// 期间 交货单号 发货日期 采购订单号 SAP编码 物料代码 物料描述 物料组 开票单价 数量差异 发货数量 开票数量 定价 单价差异
[ImporterHeader(Name = "寄销库数量", IsIgnore = true)]
public decimal StockQty { set; get; }
[ImporterHeader(Name = "出库数量", IsIgnore = true)]
public decimal OutPutQty { set; get; }
[ImporterHeader(Name = "组件组物料", IsIgnore = true)]
public string ParentMaterialCode { set; get; }
[ImporterHeader(Name = "交货单号")]
public string WmsBillNum { set; get; }
[ImporterHeader(Name = "采购订单号")]
//KENN号
public string OrderBillNum { set; get; }
[ImporterHeader(Name = "SAP编码")]
//物料号
public string MaterialCode { set; get; }
[ImporterHeader(Name = "物料描述")]
//物料描述
public string MaterialDesc { set; get; }
[ImporterHeader(Name = "物料组(车型)")]
//物料组(车型)
public string MaterialGroup { set; get; }
[ImporterHeader(Name = "出库库位", IsIgnore = true)]
//出库库位
public string OutPut { set; get; }
[ImporterHeader(Name = "入库库位", IsIgnore = true)]
//入库库位
public string InPut { set; get; }
[ImporterHeader(Name = "状态", IsIgnore = true)]
public int State { get; set; }
[ImporterHeader(Name = "物料代码")]
/// <summary>
/// 扩展字段1
/// </summary>
public string Extend1 { set; get; }
/// <summary>
/// 扩展字段2
/// </summary>
[ImporterHeader(Name = "扩展字段2", IsIgnore = true)]
public string Extend2 { set; get; }
/// <summary>
/// 扩展字段3
/// </summary>
[ImporterHeader(Name = "版本号", IsIgnore = true)]
public string Version { set; get; }
[ImporterHeader(Name = "开票数量")]
public decimal Qty { set; get; }
[ImporterHeader(Name = "数量", IsIgnore = true)]
public string BillNum { set; get; }
[ImporterHeader(Name = "任务代码", IsIgnore = true)]
public Guid TaskId { set; get; }
}

49
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs

@ -332,11 +332,15 @@ namespace Win.Sfs.SettleAccount
builder.ConfigureWmsKanbanOutPutVersion(options); builder.ConfigureWmsKanbanOutPutVersion(options);
builder.ConfigureWmsKanbanOutPutDetail(options); builder.ConfigureWmsKanbanOutPutDetail(options);
//大众看板
builder.ConfigureWmsWithOutKanbanOutPutVersion(options); builder.ConfigureWmsWithOutKanbanOutPutVersion(options);
builder.ConfigureWmsWithOutKanbanOutPutDetail(options); builder.ConfigureWmsWithOutKanbanOutPutDetail(options);
//大众备件-正常出库(有采购订单号)
builder.ConfigureWmsSharePartOutPutDetail(options); builder.ConfigureWmsSharePartOutPutDetail(options);
builder.ConfigureWmsSharePartOutPutVersion(options); builder.ConfigureWmsSharePartOutPutVersion(options);
//大众备件-数据调整(无采购订单号)
builder.ConfigureWmsSharePart90OutPutDetail(options);
builder.ConfigureWmsSharePart90OutPutVersion(options);
builder.ConfigureHQFKanban(options); builder.ConfigureHQFKanban(options);
builder.ConfigureHQMKanban(options); builder.ConfigureHQMKanban(options);
@ -1437,6 +1441,49 @@ namespace Win.Sfs.SettleAccount
} }
/// <summary>
/// 大众备件0-90数据调整(无采购订单号)
/// </summary>
/// <param name="builder"></param>
/// <param name="options"></param>
private static void ConfigureWmsSharePart90OutPutDetail(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<WmsSharePart90OutPutDetial>(b =>
{
b.ToTable($"{options.TablePrefix}_WmsSharePart90OutPutDetial", options.Schema);
b.ConfigureByConvention();
b.Property(x => x.BillNum).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.WmsBillNum).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.Version).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.OutPut).HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.InPut).HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.OrderBillNum).HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.ParentMaterialCode).HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.Extend1).HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.Extend2).HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.MaterialCode).HasMaxLength(CommonConsts.MaxCodeLength);
b.HasIndex(x => new { x.BillNum });
});
}
private static void ConfigureWmsSharePart90OutPutVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<WmsSharePart90OutPut>(b =>
{
b.ToTable($"{options.TablePrefix}_WmsSharePart90OutPut", options.Schema);
b.ConfigureByConvention();
b.Property(x => x.BillNum).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.Version).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
b.HasIndex(x => new { x.BillNum });
});
}
private static void ConfigureWmsHQFKanbanOutPutVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureWmsHQFKanbanOutPutVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {

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

@ -64,7 +64,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" FROM\n" + " FROM\n" +
" Set_KanBanSettle AS a\n" + " Set_KanBanSettle AS a\n" +
" LEFT JOIN Set_material AS b ON a.MaterialCode= b.CustomerPartCode\n" + " LEFT JOIN Set_material AS b ON a.MaterialCode= b.CustomerPartCode\n" +
" INNER JOIN Set_WMSKanBanSettle c ON a.Kanban= c.Kanban \n" + " LEFT JOIN Set_WMSKanBanSettle c ON a.Kanban= c.Kanban \n" +
" AND a.MaterialCode= c.MaterialCode\n" + " AND a.MaterialCode= c.MaterialCode\n" +
" LEFT JOIN ( SELECT SUM ( amt ) / SUM ( Qty ) InvoicePrice, MaterialCode FROM set_invoice WHERE version = '{0}' GROUP BY materialcode ) d ON a.MaterialCode= d.MaterialCode where a.VERSION='{0}'\n" + " LEFT JOIN ( SELECT SUM ( amt ) / SUM ( Qty ) InvoicePrice, MaterialCode FROM set_invoice WHERE version = '{0}' GROUP BY materialcode ) d ON a.MaterialCode= d.MaterialCode where a.VERSION='{0}'\n" +
" ) TEMP1\n" + " ) TEMP1\n" +

148
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePart90DapperReportRepository.cs

@ -47,7 +47,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" b.WMSDeliveryNote AS 交货单号,\n" + " b.WMSDeliveryNote AS 交货单号,\n" +
" b.SpareDate AS 发货日期,\n" + " b.SpareDate AS 发货日期,\n" +
" b.PurchaseOrderNo AS 采购订单号,\n" + " b.PurchaseOrderNo AS 采购订单号,\n" +
" c.MaterialCode AS SAP编码,\n" + " b.SapCode AS SAP编码,\n" +
" b.MaterialCode AS 物料代码,\n" + " b.MaterialCode AS 物料代码,\n" +
" c.MaterialDesc AS 物料描述,\n" + " c.MaterialDesc AS 物料描述,\n" +
" c.EstimateTypeDesc AS 物料组,\n" + " c.EstimateTypeDesc AS 物料组,\n" +
@ -57,6 +57,14 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" ISNULL( b.ReceiptQty, 0 ) AS 开票数量 \n" + " ISNULL( b.ReceiptQty, 0 ) AS 开票数量 \n" +
" FROM\n" + " FROM\n" +
" (\n" + " (\n" +
" SELECT\n" +
" t.ReceiptQty,\n" +
" t.PurchaseOrderNo,\n" +
" t.Version,\n" +
" t.PurchasePriceNoTax,\n" +
" ( SELECT MaterialCode FROM Set_material WHERE CustomerPartCode = t.MaterialCode ) AS SapCode \n" +
" FROM\n" +
" (\n" +
" SELECT SUM\n" + " SELECT SUM\n" +
" ( ReceiptQty ) AS ReceiptQty,\n" + " ( ReceiptQty ) AS ReceiptQty,\n" +
" PurchaseOrderNo,\n" + " PurchaseOrderNo,\n" +
@ -72,14 +80,16 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" MaterialCode,\n" + " MaterialCode,\n" +
" Version,\n" + " Version,\n" +
" PurchasePriceNoTax \n" + " PurchasePriceNoTax \n" +
" ) t \n" +
" ) AS a\n" + " ) AS a\n" +
" LEFT OUTER JOIN (\n" + " INNER JOIN (\n" +
" SELECT\n" + " SELECT\n" +
" WMSDeliveryNote,\n" + " WMSDeliveryNote,\n" +
" SpareDate,\n" + " SpareDate,\n" +
" MaterialCode,\n" + " MaterialCode,\n" +
" ReceiptQty,\n" + " ReceiptQty,\n" +
" PurchaseOrderNo \n" + " PurchaseOrderNo,\n" +
" SapCode \n" +
" FROM\n" + " FROM\n" +
" Set_WMSSparePart \n" + " Set_WMSSparePart \n" +
" WHERE\n" + " WHERE\n" +
@ -87,12 +97,82 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" AND PurchaseOrderNo LIKE '%D30%' \n" + " AND PurchaseOrderNo LIKE '%D30%' \n" +
" OR PurchaseOrderNo LIKE '%D60%' \n" + " OR PurchaseOrderNo LIKE '%D60%' \n" +
" OR PurchaseOrderNo LIKE '%D90%' \n" + " OR PurchaseOrderNo LIKE '%D90%' \n" +
" ) AS b ON a.MaterialCode = b.MaterialCode\n" + " ) AS b ON a.SapCode = b.SapCode\n" +
" LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" + " LEFT OUTER JOIN ( SELECT MAX ( Id ) Id, MaterialCode, MaterialDesc, EstimateTypeDesc FROM Set_material GROUP BY MaterialCode, MaterialDesc, EstimateTypeDesc ) AS c ON b.SapCode = c.MaterialCode \n" +
" WHERE\n" + " WHERE\n" +
" ( a.Version = '{0}' ) \n" + " ( a.Version = '202112' ) \n" +
" ) AS temp1\n" + " ) AS temp1\n" +
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode"; " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode \n" +
"ORDER BY\n" +
" temp1.采购订单号";
//"SELECT\n" +
//" temp1.期间,\n" +
//" temp1.交货单号,\n" +
//" temp1.发货日期,\n" +
//" temp1.采购订单号,\n" +
//" temp1.SAP编码,\n" +
//" temp1.物料代码,\n" +
//" temp1.物料描述,\n" +
//" temp1.物料组,\n" +
//" temp1.开票单价,\n" +
//" temp1.数量差异,\n" +
//" temp1.发货数量,\n" +
//" temp1.开票数量,\n" +
//" ISNULL( TEMP2.Price, 0 ) AS 定价,\n" +
//" temp1.开票单价 - ISNULL( TEMP2.Price, 0 ) AS 单价差异 \n" +
//"FROM\n" +
//" (\n" +
//" SELECT\n" +
//" a.Version AS 期间,\n" +
//" b.WMSDeliveryNote AS 交货单号,\n" +
//" b.SpareDate AS 发货日期,\n" +
//" b.PurchaseOrderNo AS 采购订单号,\n" +
//" c.MaterialCode AS SAP编码,\n" +
//" b.MaterialCode AS 物料代码,\n" +
//" c.MaterialDesc AS 物料描述,\n" +
//" c.EstimateTypeDesc AS 物料组,\n" +
//" a.PurchasePriceNoTax AS 开票单价,\n" +
//" 0 AS 数量差异,\n" +
//" ISNULL( b.ReceiptQty, 0 ) AS 发货数量,\n" +
//" ISNULL( b.ReceiptQty, 0 ) AS 开票数量 \n" +
//" FROM\n" +
//" (\n" +
//" SELECT SUM\n" +
//" ( ReceiptQty ) AS ReceiptQty,\n" +
//" PurchaseOrderNo,\n" +
//" MaterialCode,\n" +
//" Version,\n" +
//" PurchasePriceNoTax \n" +
//" FROM\n" +
//" Set_SparePart \n" +
//" WHERE\n" +
//" Extend = 'is90' \n" +
//" GROUP BY\n" +
//" PurchaseOrderNo,\n" +
//" MaterialCode,\n" +
//" Version,\n" +
//" PurchasePriceNoTax \n" +
//" ) AS a\n" +
//" LEFT OUTER JOIN (\n" +
//" SELECT\n" +
//" WMSDeliveryNote,\n" +
//" SpareDate,\n" +
//" MaterialCode,\n" +
//" ReceiptQty,\n" +
//" PurchaseOrderNo \n" +
//" FROM\n" +
//" Set_WMSSparePart \n" +
//" WHERE\n" +
//" PurchaseOrderNo != 'BM' \n" +
//" AND PurchaseOrderNo LIKE '%D30%' \n" +
//" OR PurchaseOrderNo LIKE '%D60%' \n" +
//" OR PurchaseOrderNo LIKE '%D90%' \n" +
//" ) AS b ON a.MaterialCode = b.MaterialCode\n" +
//" LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
//" WHERE\n" +
//" ( a.Version = '{0}' ) \n" +
//" ) AS temp1\n" +
//" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode ORDER BY temp1.采购订单号";
string addwhere = string.Empty; string addwhere = string.Empty;
string addSqlStr = string.Format(sqlString, version); string addSqlStr = string.Format(sqlString, version);
@ -109,10 +189,50 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
string sqlString = "SELECT\n" + string sqlString = "SELECT\n" +
" ISNULL( A.ReceiptQty - ISNULL( B.ReceiptQty, 0 ), 0 ) 数量差异,\n" + " ISNULL( A.ReceiptQty - ISNULL( B.ReceiptQty, 0 ), 0 ) 数量差异,\n" +
" a.PurchaseOrderNo 订单号,\n" + " a.PurchaseOrderNo 订单号,\n" +
" a.MaterialCode 物料号 \n" + " a.SapCode 厂内物料号 \n" +
"FROM\n" +
" (\n" +
" SELECT\n" +
" t.ReceiptQty,\n" +
" t.PurchaseOrderNo,\n" +
" t.Version,\n" +
" t.PurchasePriceNoTax,\n" +
" ( SELECT MaterialCode FROM Set_material WHERE CustomerPartCode = t.MaterialCode ) AS SapCode \n" +
" FROM\n" +
" (\n" +
" SELECT SUM\n" +
" ( ReceiptQty ) AS ReceiptQty,\n" +
" PurchaseOrderNo,\n" +
" MaterialCode,\n" +
" Version,\n" +
" PurchasePriceNoTax \n" +
" FROM\n" +
" Set_SparePart \n" +
" WHERE\n" +
" Extend = 'is90' \n" +
" GROUP BY\n" +
" PurchaseOrderNo,\n" +
" MaterialCode,\n" +
" Version,\n" +
" PurchasePriceNoTax \n" +
" ) t \n" +
" ) A\n" +
" LEFT JOIN (\n" +
" SELECT\n" +
" WMSDeliveryNote,\n" +
" SpareDate,\n" +
" MaterialCode,\n" +
" ReceiptQty,\n" +
" PurchaseOrderNo,\n" +
" SapCode \n" +
" FROM\n" + " FROM\n" +
" ( SELECT SUM ( ReceiptQty ) ReceiptQty, PurchaseOrderNo, MaterialCode FROM Set_SparePart WHERE Version = '{0}' GROUP BY PurchaseOrderNo, MaterialCode ) A\n" + " Set_WMSSparePart \n" +
" LEFT JOIN ( SELECT SUM ( ReceiptQty ) ReceiptQty, PurchaseOrderNo, MaterialCode FROM Set_WMSSparePart GROUP BY PurchaseOrderNo, MaterialCode ) B ON A.MaterialCode = B.MaterialCode"; " WHERE\n" +
" PurchaseOrderNo != 'BM' \n" +
" AND PurchaseOrderNo LIKE '%D30%' \n" +
" OR PurchaseOrderNo LIKE '%D60%' \n" +
" OR PurchaseOrderNo LIKE '%D90%' \n" +
" ) B ON A.SapCode = B.SapCode WHERE (A.ReceiptQty - ISNULL( B.ReceiptQty, 0 )) <> 0";
string addwhere = string.Empty; string addwhere = string.Empty;
string addSqlStr = string.Format(sqlString, version); string addSqlStr = string.Format(sqlString, version);
@ -143,7 +263,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{ {
public decimal { set; get; } public decimal { set; get; }
public string { set; get; } public string { set; get; }
public string { set; get; } public string { set; get; }
} }
@ -188,5 +308,11 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
[ExporterHeader(DisplayName = "单价差异")] [ExporterHeader(DisplayName = "单价差异")]
public decimal { set; get; } public decimal { set; get; }
[ExporterHeader(DisplayName = "寄售库数量")]
public decimal { set; get; }
[ExporterHeader(DisplayName = "出库数量")]
public decimal { set; get; }
} }
} }

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

@ -57,21 +57,30 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" ISNULL( b.ReceiptQty, 0 ) AS 发货数量,\n" + " ISNULL( b.ReceiptQty, 0 ) AS 发货数量,\n" +
" ISNULL( b.ReceiptQty, 0 ) AS 开票数量 \n" + " ISNULL( b.ReceiptQty, 0 ) AS 开票数量 \n" +
" FROM\n" + " FROM\n" +
" (SELECT SUM( ReceiptQty ) AS ReceiptQty, PurchaseOrderNo, MaterialCode, Version, PurchasePriceNoTax FROM Set_SparePart GROUP BY PurchaseOrderNo, MaterialCode, Version, PurchasePriceNoTax ) AS a\n" + " (\n" +
" SELECT SUM\n" +
" ( ReceiptQty ) AS ReceiptQty,\n" +
" PurchaseOrderNo,\n" +
" MaterialCode,\n" +
" Version,\n" +
" PurchasePriceNoTax \n" +
" FROM\n" +
" Set_SparePart \n" +
" WHERE\n" +
" Extend = 'not90' \n" +
" GROUP BY\n" +
" PurchaseOrderNo,\n" +
" MaterialCode,\n" +
" Version,\n" +
" PurchasePriceNoTax \n" +
" ) AS a\n" +
" LEFT OUTER JOIN Set_WMSSparePart AS b ON a.PurchaseOrderNo = b.PurchaseOrderNo \n" + " LEFT OUTER JOIN Set_WMSSparePart AS b ON a.PurchaseOrderNo = b.PurchaseOrderNo \n" +
" AND a.MaterialCode = b.MaterialCode\n" + " AND a.MaterialCode = b.MaterialCode\n" +
" LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" + " LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
" WHERE\n" + " WHERE\n" +
" ( a.Version = '{0}' )) AS temp1\n" + " ( a.Version = '{0}' ) \n" +
" LEFT OUTER JOIN (\n" + " ) AS temp1\n" +
" SELECT\n" + " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode ORDER BY temp1.采购订单号";
" Price,\n" +
" MaterialCode \n" +
" FROM\n" +
" Set_PriceList \n" +
" WHERE\n" +
" (\n" +
" Version = ( SELECT MAX(Version) AS Expr1 FROM Set_PriceList ))) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode";
string addwhere = string.Empty; string addwhere = string.Empty;
string addSqlStr = string.Format(sqlString, version); string addSqlStr = string.Format(sqlString, version);
//if (!string.IsNullOrEmpty(purchaseOrderNo)) //if (!string.IsNullOrEmpty(purchaseOrderNo))

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

@ -34,20 +34,21 @@ namespace SettleAccount.Job.Services.Report
var beginTime = p_list.Where(p => p.Name == "BegingTime").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 endTime = p_list.Where(p => p.Name == "EndTime").FirstOrDefault().Value;
var _ls = _dapper.GetSettleSparePart90ReportList(purchaseOrderNo, version, sapCode, matialCode, beginTime, endTime); var _ls = _dapper.GetSettleSparePart90ReportList(purchaseOrderNo, version, sapCode, matialCode, beginTime, endTime);
//var diffList = _dapper.GetSettleSparePart90SumQtyDiff(version);
//if (diffList != null)
//{
// foreach (var itm in diffList)
// {
// var _first = _ls.FirstOrDefault(p => p.物料代码 == itm.物料号);
// if (_first != null)
// {
// _first.开票数量 = _first.发货数量 + itm.数量差异;//开票数量(结算数量+差异)
// _first.数量差异 = itm.数量差异;
// } var diffList = _dapper.GetSettleSparePart90SumQtyDiff(version);
// } if (diffList != null)
//} {
foreach (var itm in diffList)
{
var _first = _ls.FirstOrDefault(p => p.SAP编码 == itm.);
if (_first != null)
{
_first. = _first. + itm.;//开票数量(结算数量+差异)
_first. = itm.;
}
}
}
//if (!string.IsNullOrEmpty(materialGroup)) //if (!string.IsNullOrEmpty(materialGroup))
//{ //{
@ -65,14 +66,14 @@ namespace SettleAccount.Job.Services.Report
_ls = _ls.Where(p => _groupList.Contains(p.SAP编码)).ToList(); _ls = _ls.Where(p => _groupList.Contains(p.SAP编码)).ToList();
} }
} }
if (!string.IsNullOrEmpty(matialCode)) //if (!string.IsNullOrEmpty(matialCode))
{ //{
var _groupList = matialCode.Split(new char[] { '\n' }).Distinct().ToList(); // var _groupList = matialCode.Split(new char[] { '\n' }).Distinct().ToList();
if (_groupList.Count() > 0) // if (_groupList.Count() > 0)
{ // {
_ls = _ls.Where(p => _groupList.Contains(p.)).ToList(); // _ls = _ls.Where(p => _groupList.Contains(p.物料代码)).ToList();
} // }
} //}
//if (!string.IsNullOrEmpty(purchaseOrderNo)) //if (!string.IsNullOrEmpty(purchaseOrderNo))
//{ //{
// var _groupList = purchaseOrderNo.Split(new char[] { '\n' }).Distinct().ToList(); // var _groupList = purchaseOrderNo.Split(new char[] { '\n' }).Distinct().ToList();

Loading…
Cancel
Save