diff --git a/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccount.HttpApi.Host.csproj b/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccount.HttpApi.Host.csproj index c09813b6..47366b8f 100644 --- a/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccount.HttpApi.Host.csproj +++ b/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccount.HttpApi.Host.csproj @@ -54,6 +54,7 @@ + diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePart90AppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePart90AppService.cs new file mode 100644 index 00000000..f8b296e4 --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePart90AppService.cs @@ -0,0 +1,455 @@ +using EFCore.BulkExtensions; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Caching; +using Volo.Abp.Domain.Repositories; +using Volo.Abp.Uow; +using Win.Abp.Snowflakes; +using Win.Sfs.BaseData.ImportExcelCommon; +using Win.Sfs.SettleAccount.CommonManagers; +using Win.Sfs.SettleAccount.Constant; +using Win.Sfs.SettleAccount.Entities.TaskJobs; +using Win.Sfs.SettleAccount.Entities.Wms; +using Win.Sfs.SettleAccount.ExcelImporter; +using Win.Sfs.SettleAccount.ExportReports; +using Win.Sfs.SettleAccount.Repository; +using Win.Sfs.Shared.Filter; +using WY.NewJit.Extends.PaiGe.WMS; + +namespace Win.Sfs.SettleAccount.Entities.WMS +{ + [Route("api/settleaccount/wmsSharePart90output")] + [Authorize(SettleAccountPermissions.WMSJIT.Default)] + public class WMSSharePart90AppService : + SettleAccountApplicationBase + { + private readonly ISettleAccountBranchEfCoreRepository _wmsRepository; + private readonly ISettleAccountBranchEfCoreRepository _wmsVersionRepository; + private readonly WMSEfCoreRepository _wmsefRespository; + + private readonly WMSEfCoreRepository _wmstbRespository; + private readonly ISettleAccountBranchEfCoreRepository _job; + private readonly IExcelImportAppService _excelImportService; + + private readonly TaskJobService _service; + /// + /// + /// + /// + /// + /// + /// + /// + public WMSSharePart90AppService( + + ISettleAccountBranchEfCoreRepository wmsRepository, + ISettleAccountBranchEfCoreRepository job, + ISettleAccountBranchEfCoreRepository wmsVersionRepository, + WMSEfCoreRepository wmsefRespository, + WMSEfCoreRepository wmstbRespository, + IExcelImportAppService excelImportService, + IDistributedCache cache, + ISnowflakeIdGenerator snowflakeIdGenerator, + ICommonManager commonManager + ) : base(cache, excelImportService, snowflakeIdGenerator, commonManager) + { + _excelImportService = excelImportService; + _job = job; + _wmstbRespository = wmstbRespository; + _wmsRepository = wmsRepository; + _wmsVersionRepository = wmsVersionRepository; + _wmsefRespository = wmsefRespository; + } + + private async Task GetCountAsync(WmsSharePartOutPutDetialRequestDto 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); + } + + private async Task GetCountAsync(WmsSharePartOutPutRequestDto input) + { + return await _wmsVersionRepository.GetCountByFilterAsync(GuidGenerator.Create(), input.Filters); + } + + /// + /// 准时化出库主表 + /// + /// + /// + [HttpPost] + [Route("WmsSharePartList")] + //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] + virtual public async Task> GetListAsync(WmsSharePartOutPutRequestDto input) + { + + var entities = await _wmsVersionRepository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, input.MaxResultCount, + input.SkipCount, true); + + var totalCount = await GetCountAsync(input); + + + return new PagedResultDto(totalCount, entities); + } + + /// + /// 准时化出库明细 + /// + /// + /// + [HttpPost] + [Route("WmsSharePartDetailList")] + //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] + virtual public async Task> GetListAsync(WmsSharePartOutPutDetialRequestDto input) + { + 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, + input.SkipCount, true); + + var totalCount = await GetCountAsync(input); + return new PagedResultDto(totalCount, entities); + } + /// + /// 任务明细标记已确认 + /// + /// 上传的文件(前端已经限制只能上传一个附件) + /// + [HttpPost] + [Route("WmsSharePartOutPutAudit")] + [DisableRequestSizeLimit] + + public async Task WmsSharePartAudit(List ids) + { + var _joblist = await _job.Where(p => ids.Contains(p.Id)).ToListAsync(); + foreach (var itm in _joblist) + { + itm.FileName = "已确认"; + await _job.UpdateAsync(itm); + } + return false; + } + /// + /// 选择任务,生成出库单,只包含已确认的单据 + /// + /// + /// + /// + [HttpPost] + [Route("WmsSharePartOutPut")] + public async Task WmsSharePartOutPut(WmsJitRequestDto input) + { + var _billNum = "B" + DateTime.Now.ToString("yyyyMMddhhmmss"); + var _joblist = _job.Where(p => input.Guids.Contains(p.Id) && p.FileName == "已确认").ToList(); + if (_joblist.Count() > 0) + { + var fileList = _joblist.Select(p => p.RealDownFileName).ToList(); + List _lst = new List(); + foreach (var filename in fileList) + { + string fileSavePath = Environment.CurrentDirectory + @"\wwwroot\files\host\my-file-container\" + filename; + ExcelHelper _excelHelper = new ExcelHelper(fileSavePath); + var _list = _excelHelper.ExcelToList(); + if (_list.Count() > 0) + { + var _lsAry = _list.Select(p => new + WmsSharePartOutPutDetial( + GuidGenerator.Create(), + p.WmsBillNum, + p.OrderBillNum, + p.MaterialCode, + p.MaterialDesc, + p.MaterialGroup, + string.Empty, + string.Empty, + 0, + !string.IsNullOrEmpty(p.Extend1) ? p.Extend1 : string.Empty, + + string.Empty, + string.Empty, + p.MaterialCode, + _billNum, + GuidGenerator.Create(), + string.Empty, + p.Qty + )); + _lst.AddRange(_list.ToArray()); + } + } + + var outPutDetail = await _wmsRepository.Where(p => p.Version == input.Version).ToListAsync(); + + var error = from itm1 in outPutDetail + join itm2 in _lst on + new { itm1.MaterialCode, itm1.OrderBillNum, itm1.WmsBillNum } + equals + new { itm2.MaterialCode, itm2.OrderBillNum, itm2.WmsBillNum } + select itm1; + + var errList = error.GroupBy(p => new { p.BillNum }).Select(p => new { BillNum = p.Key.BillNum, Number = p.Sum(itm => itm.Qty) }); + if (errList.Count() == 0) + { + var query = from itm1 in _lst + join itm2 in outPutDetail on + new { itm1.MaterialCode, itm1.OrderBillNum, itm1.WmsBillNum } + equals + new { itm2.MaterialCode, itm2.OrderBillNum, itm2.WmsBillNum } into temp1 + from tm1 in temp1.DefaultIfEmpty() + where tm1 == null + select itm1; + var _wmslst = query.ToList(); + _wmslst = _wmslst.Select(p => new + WmsSharePartOutPutDetial( + GuidGenerator.Create(), + p.WmsBillNum, + p.OrderBillNum, + p.MaterialCode, + p.MaterialDesc, + p.MaterialGroup, + string.Empty, + string.Empty, + 0, + string.Empty, + input.Version, + string.Empty, + p.MaterialCode, + _billNum, + GuidGenerator.Create(), + string.Empty, + p.Qty + )).ToList(); + await _wmsRepository.GetDbContext().BulkInsertAsync(_wmslst, new BulkConfig() { BulkCopyTimeout = 0, BatchSize = 10000 }); + int _count = _wmsVersionRepository.Count(p => p.Version == input.Version && p.BillNum == _billNum); + if (_wmslst.Count() > 0 && _count == 0) + { + var _version = new WmsSharePartOutPut(GuidGenerator.Create(), input.Version, _billNum, CurrentUser.Email); + await _wmsVersionRepository.InsertAsync(_version, true); + } + foreach (var job in _joblist) + { + job.FileName = _billNum; + await _job.UpdateAsync(job); + } + } + else + { + StringBuilder _buffer = new StringBuilder(); + foreach (var itm in errList) + { + _buffer.AppendFormat("出库单号:{0}重复记录数:{1}条", itm.BillNum, itm.Number); + } + var _errinfo = _buffer.ToString(); + + foreach (var job in _joblist) + { + job.FileName = _errinfo; + await _job.UpdateAsync(job); + } + } + } + else + { + _billNum = string.Empty; + } + return ApplicationConsts.SuccessStr; + } + /// + /// 出库界面功能,核准出库功能 + /// + /// + /// + /// + [HttpPost] + [Route("WmsSharePartOutPut-Pass")] + [UnitOfWork(false)] + public async Task WmsSharePartOutPutPass(WmsJitRequestDto input) + { + if (input.Guids != null) + { + List _ls = new List(); + 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(); + } + else + { + _ls = await _wmsRepository.Where(p => p.Version == input.Version && p.BillNum == input.BillNum && p.State != 2).ToListAsync(); + } + if (_ls.Count() > 0) + { + var sql = "DECLARE @return_value int\n" + + "EXEC @return_value = [dbo].[p_wms_output]\n" + + " @billnum = N'{0}',\n" + + " @type = 2,\n" + + " @date = N'{1}'\n" + + "SELECT 'Return Value' = @return_value"; + await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync( + string.Format(sql, input.BillNum, input.AccountDate.ToShortDateString())); + + } + } + return true; + } + /// + ///出库界面功能, 撤销核准出库 + /// + /// + /// + /// + [HttpPost] + [Route("WmsSharePartOutPut-Cancel")] + public async Task WmsSharePartOutPutCancel(WmsJitRequestDto input) + { + if (input.Guids != null && input.Guids.Count() > 0) + { + List _ls = new List(); + foreach (var itm in input.Guids) + { + _ls.Add(string.Format("{0}", itm)); + } + + string str = string.Join(",", _ls.ToArray()); + + var sql = "DECLARE @return_value int\n" + + "EXEC @return_value = [dbo].[p_wms_output_cancel]\n" + + " @Guids ='{0}', \n" + + " @billnum = N'{1}',\n" + + " @type = 2,\n" + + " @accountdate = N'{2}'\n" + + "SELECT 'Return Value' = @return_value"; + + sql = string.Format(sql, str, input.BillNum, input.AccountDate.ToShortDateString()); + + await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync( + sql + ); + + } + return true; + } + + /// + /// 出库界面功能删除 + /// + /// + /// + /// + [HttpPost] + [Route("WmsOutPutDelete")] + [UnitOfWork(false)] + public async Task WmsOutPutDelete(WmsJitRequestDto input) + { + var count = _wmsRepository.Count(p => p.BillNum == input.BillNum && p.State != 0); + + if (count > 0) + { + return false; + } + var sql = "DECLARE @return_value int\n" + + "EXEC @return_value = [dbo].[p_wms_output_cancel_all]\n" + + " @billnum = N'{0}',\n" + + " @type = 2\n" + + "SELECT 'Return Value' = @return_value"; + await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync( + string.Format(sql, input.BillNum) + ); + + + + return true; + } + + + [HttpPost] + [Route("ExcelImport")] + [DisableRequestSizeLimit] + //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] + public async Task ExcelImport([FromForm] IFormFileCollection files, string version) + { + var _billNum = "B" + DateTime.Now.ToString("yyyyMMddhhmmss"); + ExportImporter _exportImporter = new ExportImporter(); + var result = await _exportImporter.ExtendExcelImport(files, _excelImportService); + List _lst = new List(); + + var _lsCopy = new List(); + foreach (var itm in result) + { + WmsSharePartOutPutDetial _detail = new WmsSharePartOutPutDetial( + GuidGenerator.Create(), + itm.WmsBillNum, + itm.OrderBillNum, + + itm.MaterialCode, + itm.MaterialDesc, + itm.MaterialGroup, + string.Empty, + string.Empty, + 0, + string.Empty, + string.Empty, + version, + itm.ParentMaterialCode, + itm.BillNum, + GuidGenerator.Create() + , string.Empty + , itm.Qty + ); + _lsCopy.Add(_detail); + } + _lst.AddRange(_lsCopy.ToArray()); + + var _ls1 = _lst.Where(p => p.ParentMaterialCode == p.MaterialCode).ToList(); + var outPutDetail = await _wmsRepository.Where(p => p.Version == version).ToListAsync(); + + var error = from itm1 in outPutDetail + join itm2 in _ls1 on + new { itm1.MaterialCode, itm1.OrderBillNum, itm1.WmsBillNum } + equals + new { itm2.MaterialCode, itm2.OrderBillNum, itm2.WmsBillNum } + select itm1; + var errList = error.GroupBy(p => new { p.BillNum }).Select(p => new { BillNum = p.Key.BillNum, Number = p.Sum(itm => itm.Qty) }); + + var checkList = new List(); + foreach (var itm in errList) + { + checkList.Add(new ErrorExportDto() { Message = string.Format("出库单号:{0}重复记录数:{1}条", itm.BillNum, itm.Number) }); + } + if (checkList.Count > 0) + { + + return await ExportErrorReportAsync(checkList); + } + + var query = from itm1 in _ls1 + join itm2 in outPutDetail on + new { itm1.MaterialCode, itm1.OrderBillNum } + equals + new { itm2.MaterialCode, itm2.OrderBillNum } into temp1 + from tm1 in temp1.DefaultIfEmpty() + where tm1 == null + select itm1; + var _wmslst = query.ToList(); + foreach (var itm in _wmslst) + { + itm.BillNum = _billNum; + } + await _wmsRepository.GetDbContext().BulkInsertAsync(_wmslst, new BulkConfig() { BulkCopyTimeout = 0, BatchSize = 10000 }); + int _count = _wmsVersionRepository.Count(p => p.Version == version && p.BillNum == _billNum); + if (_count == 0 && _wmslst.Count() > 0) + { + var _version = new WmsSharePartOutPut(GuidGenerator.Create(), version, _billNum, CurrentUser.Email); + await _wmsVersionRepository.InsertAsync(_version, true); + } + return ApplicationConsts.SuccessStr; + } + + + } +} diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs index b899e503..10a39ca3 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs @@ -172,25 +172,29 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices return _taskid; } + + + #region 大众备件0-90天和90天以上输出 + /// - /// 大众备件结算核对明细表 + /// 大众备件0-90天报表输出 /// - /// 采购订单号 - /// 厂内物料号 - /// 版本 + /// + /// + /// /// /// - /// 物料代码 + /// /// /// /// /// [HttpGet] - [Route("SettleSparePartExport")] + [Route("SettleSparePart90Export")] [DisableRequestSizeLimit] - public async Task SettledSparePart(string purchaseOrderNo, string sapCode, string version, string customerCode, string factory, string matialCode, - string state, DateTime begin, DateTime end) + public async Task SettledSparePart90(string purchaseOrderNo, string sapCode, string version, string customerCode, string factory, string matialCode, + string state, DateTime begin, DateTime end) { List customConditionList = new List(); @@ -204,34 +208,32 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices 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,version,string.Empty ,CurrentUser, typeof(SettleSparePartExportService), customConditionList, (rs) => + var _taskid = await _service.ExportEnqueueAsync("(0-90天)大众备件结算输出", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(SettleSparePart90ExportService), customConditionList, (rs) => { }); return _taskid; } - #region 大众备件0-90天和90天以上输出 - /// - /// 大众备件0-90天报表输出 + /// 大众备件结算核对明细表 /// - /// - /// - /// + /// 采购订单号 + /// 厂内物料号 + /// 版本 /// /// - /// + /// 物料代码 /// /// /// /// [HttpGet] - [Route("SettleSparePart90Export")] + [Route("SettleSparePartExport")] [DisableRequestSizeLimit] - public async Task SettledSparePart90(string purchaseOrderNo, string sapCode, string version, string customerCode, string factory, string matialCode, - string state, DateTime begin, DateTime end) + public async Task SettledSparePart(string purchaseOrderNo, string sapCode, string version, string customerCode, string factory, string matialCode, + string state, DateTime begin, DateTime end) { List customConditionList = new List(); @@ -245,13 +247,12 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices customConditionList.Add(new CustomCondition() { Name = "BegingTime", Value = begin.ToString() }); customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = end.ToString() }); - var _taskid = await _service.ExportEnqueueAsync("(0-90天)大众备件结算输出", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(SettleSparePart90ExportService), customConditionList, (rs) => + var _taskid = await _service.ExportEnqueueAsync("备件结算输出", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(SettleSparePartExportService), customConditionList, (rs) => { }); return _taskid; } - #endregion /// /// 无订单备件结算输出 diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml index 8b309cd4..40f6f87f 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml @@ -3043,6 +3043,69 @@ + + + + + + + + + + + + + 准时化出库主表 + + + + + + + 准时化出库明细 + + + + + + + 任务明细标记已确认 + + 上传的文件(前端已经限制只能上传一个附件) + + + + + 选择任务,生成出库单,只包含已确认的单据 + + + + + + + + 出库界面功能,核准出库功能 + + + + + + + + 出库界面功能, 撤销核准出库 + + + + + + + + 出库界面功能删除 + + + + + 区域相关应用服务 @@ -3576,31 +3639,31 @@ - + - 大众备件结算核对明细表 + 大众备件0-90天报表输出 - 采购订单号 - 厂内物料号 - 版本 + + + - 物料代码 + - + - 大众备件0-90天报表输出 + 大众备件结算核对明细表 - - - + 采购订单号 + 厂内物料号 + 版本 - + 物料代码 diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs index 17861bb4..a2ff2ef3 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs @@ -211,6 +211,7 @@ namespace Win.Sfs.SettleAccount CreateMapVWKanBanVersion(); CreateMapScrapClaims(); CreateMapScrapClaimsVersion(); + CreateMapSparePart(); CreateMapSparePartVersion(); @@ -221,12 +222,12 @@ namespace Win.Sfs.SettleAccount CreateMapUnSettleAccountVersion(); //大众看板发货 - CreateMapWMSVWKanBan(); - CreateMapWMSVWKanBanVersion(); + //CreateMapWMSVWKanBan(); + //CreateMapWMSVWKanBanVersion(); - //大众备件发货 - CreateMapWMSSparePart(); - CreateMapWMSSparePartVersion(); + ////大众备件发货 + //CreateMapWMSSparePart(); + //CreateMapWMSSparePartVersion(); //红旗H平台 CreateMapHQ_H_Platform(); @@ -503,6 +504,7 @@ namespace Win.Sfs.SettleAccount { CreateMap().ReverseMap(); + CreateMap(); CreateMap(); CreateMap(); CreateMap(); diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs index 9745c0fb..7d2e346f 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs @@ -306,7 +306,7 @@ namespace Win.Sfs.SettleAccount //大众备件发货 builder.ConfigureWMSSparePart(options); - builder.ConfigureWMSSparePartVersion(options); + //builder.ConfigureWMSSparePartVersion(options); //红旗H平台 builder.ConfigureHQH(options); @@ -905,21 +905,21 @@ namespace Win.Sfs.SettleAccount /// /// /// - private static void ConfigureWMSSparePartVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) - { + //private static void ConfigureWMSSparePartVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) + //{ - builder.Entity(b => - { - b.ToTable($"{options.TablePrefix}_WMSSparePart_Version", options.Schema); - b.ConfigureByConvention(); - b.Property(x => x.Year).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); - b.Property(x => x.Period).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); - b.Property(x => x.Version).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); - b.Property(x => x.CustomerCode).HasMaxLength(CommonConsts.MaxCodeLength); - b.HasIndex(x => new { x.Version }).IsUnique().HasFilter(IsDeletedFilter); - }); + // builder.Entity(b => + // { + // b.ToTable($"{options.TablePrefix}_WMSSparePart_Version", options.Schema); + // b.ConfigureByConvention(); + // b.Property(x => x.Year).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); + // b.Property(x => x.Period).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); + // b.Property(x => x.Version).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); + // b.Property(x => x.CustomerCode).HasMaxLength(CommonConsts.MaxCodeLength); + // b.HasIndex(x => new { x.Version }).IsUnique().HasFilter(IsDeletedFilter); + // }); - } + //} /// /// 大众看板发货 @@ -1131,20 +1131,20 @@ namespace Win.Sfs.SettleAccount b.Property(x => x.LineNumber).HasMaxLength(50); b.Property(x => x.PurchaseType).HasMaxLength(50); - b.Property(x => x.PurchaseOrderNo).IsRequired().HasMaxLength(50); + b.Property(x => x.PurchaseOrderNo).IsRequired().HasMaxLength(50);//采购订单号 b.Property(x => x.PurchaseOrderNoItem).HasMaxLength(50); b.Property(x => x.PurchaseOrderNoText).HasMaxLength(50); - b.Property(x => x.ReceiptQty).IsRequired(); - b.Property(x => x.InvoicedQty).IsRequired(); - b.Property(x => x.AmountNoTax).IsRequired(); - b.Property(x => x.PurchasePriceNoTax).IsRequired(); + b.Property(x => x.ReceiptQty).IsRequired();//收货数量 + b.Property(x => x.InvoicedQty); + b.Property(x => x.AmountNoTax); + b.Property(x => x.PurchasePriceNoTax).IsRequired();//采购价格不含税 b.Property(x => x.AccountNum).HasMaxLength(50); - b.Property(x => x.MaterialCode).IsRequired().HasMaxLength(150); + b.Property(x => x.MaterialCode).IsRequired().HasMaxLength(150);//物料号 b.Property(x => x.MaterialDesc).HasMaxLength(50); b.Property(x => x.SpareDate); - b.Property(x => x.DeliveryOrderNo).IsRequired().HasMaxLength(50); + b.Property(x => x.DeliveryOrderNo).HasMaxLength(50); b.Property(x => x.DeliveryLineNum).HasMaxLength(50); b.Property(x => x.BatchNo).HasMaxLength(50); b.Property(x => x.Unit).HasMaxLength(50); @@ -1361,7 +1361,8 @@ namespace Win.Sfs.SettleAccount builder.Entity(b => { - b.ToTable($"{options.TablePrefix}_WmsKanbanOutPutExtend", options.Schema); + //b.ToTable($"{options.TablePrefix}_WmsKanbanOutPutExtend", options.Schema); + b.ToTable($"{options.TablePrefix}_WmsKanbanOutPut", options.Schema); b.ConfigureByConvention(); b.Property(x => x.BillNum).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); b.Property(x => x.Version).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); @@ -1375,7 +1376,8 @@ namespace Win.Sfs.SettleAccount builder.Entity(b => { - b.ToTable($"{options.TablePrefix}_WmsKanbanOutPutDetialExtend", options.Schema); + //b.ToTable($"{options.TablePrefix}_WmsKanbanOutPutDetialExtend", options.Schema); + b.ToTable($"{options.TablePrefix}_WmsKanbanOutPutDetial", options.Schema); b.ConfigureByConvention(); b.Property(x => x.BillNum).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); b.Property(x => x.WmsBillNum).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePart90DapperReportRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePart90DapperReportRepository.cs index 3d46d1b4..7ef28488 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePart90DapperReportRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePart90DapperReportRepository.cs @@ -25,7 +25,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report string begintime, string endtime) { string sqlString = - "SELECT\n" + + "SELECT\n" + " temp1.期间,\n" + " temp1.交货单号,\n" + " temp1.发货日期,\n" + @@ -56,7 +56,23 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " ISNULL( b.ReceiptQty, 0 ) AS 发货数量,\n" + " ISNULL( b.ReceiptQty, 0 ) AS 开票数量 \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 = 'is90' \n" + + " GROUP BY\n" + + " PurchaseOrderNo,\n" + + " MaterialCode,\n" + + " Version,\n" + + " PurchasePriceNoTax \n" + + " ) AS a\n" + " LEFT OUTER JOIN (\n" + " SELECT\n" + " WMSDeliveryNote,\n" + @@ -76,9 +92,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " 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 \n" + - "WHERE\n" + - " temp1.SAP编码 IS NULL"; + " 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"; string addwhere = string.Empty; string addSqlStr = string.Format(sqlString, version); diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs index 891f0eab..a2043ae0 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs @@ -21,10 +21,11 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report //public async Task SettledSparePart(string purchaseOrderNo, string sapCode, string version, string customerCode, string factory, string matialCode, //string state, DateTime begin, DateTime end) + public virtual List GetSettleSparePartReportList(string purchaseOrderNo, string version, string sapCode, string matialCode, string begintime, string endtime) { - string sqlString = + string sqlString = " SELECT\n" + " temp1.期间,\n" + " temp1.交货单号,\n" +