diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/TaskListDto.cs b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/TaskListDto.cs index 1d2991de..7d7edfce 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/TaskListDto.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/TaskListDto.cs @@ -429,6 +429,60 @@ namespace Win.Sfs.SettleAccount.Entities } + + /// + ///一次性寄售销售出库单 + /// + public class WmsOneTimeSaleOutPutDetialDto + { + [ImporterHeader(Name = "单据类型", IsIgnore = true)] + [ExporterHeader(DisplayName = "单据类型", IsIgnore = true)] + public string Type { set; get; } + [ImporterHeader(Name = "物料号")] + [ExporterHeader(DisplayName = "物料号")] + public string SapMaterialCode { set; get; } + [ImporterHeader(Name = "物料描述")] + [ExporterHeader(DisplayName = "物料描述")] + public string MaterialDesc { set; get; } + [ImporterHeader(Name = "版本号")] + [ExporterHeader(DisplayName = "版本号")] + public string Version { set; get; } + [ImporterHeader(Name = "是否备件")] + [ExporterHeader(DisplayName = "是否备件")] + public string IsBack { set; get; } + [ImporterHeader(Name = "结算数量")] + [ExporterHeader(DisplayName = "结算数量")] + public decimal Qty { set; get; } + [ImporterHeader(Name = "寄售库存数量", IsIgnore = true)] + [ExporterHeader(DisplayName = "寄售库存数量", IsIgnore = true)] + public decimal SockQty { set; get; } + + [ImporterHeader(Name = "真实数量", IsIgnore = true)] + [ExporterHeader(DisplayName = "真实数量", IsIgnore = true)] + public decimal RealityNumber { set; get; } + + [ImporterHeader(Name = "出库数量", IsIgnore = true)] + [ExporterHeader(DisplayName = "出库数量", IsIgnore = true)] + public decimal OutputQty { set; get; } + [ImporterHeader(Name = "客户")] + [ExporterHeader(DisplayName = "客户")] + public string Extend { set; get; } + [ImporterHeader(Name = "BillNum", IsIgnore = true)] + [ExporterHeader(DisplayName = "BillNum", IsIgnore = true)] + public string BillNum { set; get; } + [ImporterHeader(Name = "状态", IsIgnore = true)] + [ExporterHeader(DisplayName = "状态", IsIgnore = true)] + public int State { set; get; } + [ImporterHeader(Name = "开票单价")] + [ExporterHeader(DisplayName = "开票单价")] + + public decimal Price { set; get; } + [ImporterHeader(Name = "开票金额")] + [ExporterHeader(DisplayName = "开票金额")] + public decimal Amt { set; get; } + + } + /// ///一汽轿车出库单 /// diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Wms/WmsJitOutPutDetialDto.cs b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Wms/WmsJitOutPutDetialDto.cs index 7d80802d..775d2a02 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Wms/WmsJitOutPutDetialDto.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Wms/WmsJitOutPutDetialDto.cs @@ -185,6 +185,40 @@ namespace Win.Sfs.SettleAccount.Entities.Wms } + + + public class WmsOneTimeSaleOutPutDetialRequestDto : RequestDtoBase + { + [ImporterHeader(Name = "交货单号")] + public string WmsBillNum { set; get; } + + [ImporterHeader(Name = "单号", IsIgnore = true)] + public string BillNum { set; get; } + [ImporterHeader(Name = "订单号")] + //底盘号 + public string OrderBillNum { set; get; } + + [ImporterHeader(Name = "物料号")] + //物料号 + public string MaterialCode { set; get; } + + + + + [ImporterHeader(Name = "物料描述")] + //物料描述 + public string MaterialDesc { set; get; } + + [ImporterHeader(Name = "物料组(车型)")] + //物料组(车型) + public string MaterialGroup { set; get; } + + + + + + } + public class WmsKanbanOutPutDetialRequestDto : RequestDtoBase { [ImporterHeader(Name = "交货单号")] diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQKBOutputAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQKBOutputAppService.cs index a5e94276..08f8b365 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQKBOutputAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQKBOutputAppService.cs @@ -255,7 +255,14 @@ namespace Win.Sfs.SettleAccount.Entities.WMS //var _list = _dapper.GetNoKanbanSettleDetail(input.Version); ExportImporter _exportImporter = new ExportImporter(); - var _list = await _exportImporter.ExtendExcelImport(files, _excelImportService); + var _list = await _exportImporter.ExtendExcelOfSheetOneImport(files, _excelImportService); + + if (_list == null || _list.Count == 0) + { + throw new BusinessException("导入模板数据不能为空!"); + } + + var stockList = _wmsDapper.GetSalesStock(); var query = from itm in _list join itm1 in stockList on itm.SapMaterialCode equals itm1.SapCode @@ -267,12 +274,12 @@ namespace Win.Sfs.SettleAccount.Entities.WMS itm.SapMaterialCode, itm.MaterialDesc, version, - string.Empty, + itm.IsBack,//是否备件 string.Empty, itm.Qty, tm1 == null ? 0 : tm1.Qty, itm.Qty, - string.Empty, + itm.Extend,//存储客户信息 _billNum, 0, 0, diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsOneTimeSaleOutputAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsOneTimeSaleOutputAppService.cs new file mode 100644 index 00000000..3df9f30d --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsOneTimeSaleOutputAppService.cs @@ -0,0 +1,442 @@ +using EFCore.BulkExtensions; +using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Excel; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using Shouldly; +using System; +using System.Collections.Generic; +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 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.SettleAccount.Repository.SettleAccountJob.Report; +using Win.Sfs.Shared.Filter; +using WY.NewJit.Extends.PaiGe.WMS; + +namespace Win.Sfs.SettleAccount.Entities.WMS +{ + [Route("api/settleaccount/WmsOneTimeSaleOutput")] + //[AllowAnonymous] + //[Authorize(SettleAccountPermissions.WMSJIT.Default)] + public class WmsOneTimeSaleOutputAppService : SettleAccountApplicationBase + { + + private readonly ISettleAccountBranchEfCoreRepository _wmsRepository; + private readonly ISettleAccountBranchEfCoreRepository _wmsVersionRepository; + + private readonly KanbanUnSettledDapperRepository _dapper; + private readonly WMSEfCoreRepository _wmsefRespository; + + private readonly WMSEfCoreRepository _wmstbRespository; + private readonly ISettleAccountBranchEfCoreRepository _job; + private readonly IExcelImportAppService _excelImportService; + + + private readonly TaskJobService _service; + private readonly WmsDapperRepository _wmsDapper; + /// + /// + /// + /// + /// + /// + /// + /// + public WmsOneTimeSaleOutputAppService( + + IExcelImportAppService excelImportService, + ISettleAccountBranchEfCoreRepository wmsRepository, + ISettleAccountBranchEfCoreRepository job, + ISettleAccountBranchEfCoreRepository wmsVersionRepository, + WMSEfCoreRepository wmsefRespository, + KanbanUnSettledDapperRepository dapper, + WMSEfCoreRepository wmstbRespository, + IDistributedCache cache, + ISnowflakeIdGenerator snowflakeIdGenerator, + ICommonManager commonManager, + WmsDapperRepository wmsDapper + ) : base(cache, excelImportService, snowflakeIdGenerator, commonManager) + { + _job = job; + _wmstbRespository = wmstbRespository; + _wmsRepository = wmsRepository; + _wmsVersionRepository = wmsVersionRepository; + _wmsefRespository = wmsefRespository; + _excelImportService = excelImportService; + _dapper = dapper; + _wmsDapper = wmsDapper; + } + + private async Task GetCountAsync(WmsOneTimeSaleOutPutDetialRequestDto 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(WmsKanbanOutPutRequestDto input) + { + return await _wmsVersionRepository.GetCountByFilterAsync(GuidGenerator.Create(), input.Filters); + } + + /// + /// 准时化出库主表 + /// + /// + /// + [HttpPost] + [Route("WmsKanbanList")] + //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] + virtual public async Task> GetListAsync(WmsKanbanOutPutRequestDto input) + { + //input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "BillNum", Logic = EnumFilterLogic.And, Value = input.BillNum }); + 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("WmsKanbanDetailList")] + [UnitOfWork(false)] + //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] + virtual public async Task> GetListAsync(WmsOneTimeSaleOutPutDetialRequestDto 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); + var stockList = _wmsDapper.GetSalesStock(); + var query = from itm in entities + join itm1 in stockList on itm.SapMaterialCode equals itm1.SapCode + into temp1 + from tm1 in temp1.DefaultIfEmpty() + select new WmsOneTimeSaleOutPutDetial( + GuidGenerator.Create(), + "无看板发货", + itm.SapMaterialCode, + itm.MaterialDesc, + itm.Version, + itm.IsBack, + string.Empty, + itm.Qty, + tm1 == null ? 0 : tm1.Qty, + itm.Qty, + itm.Extend, + itm.BillNum, + itm.State, + itm.RealityNumber, + itm.Price, + itm.Amt + ); + + return new PagedResultDto(totalCount, entities); + } + + /// + ///更新备注 + /// + /// + /// + [HttpGet] + [Route("UpdateRemark")] + + public async Task UpdateRemark(Guid id, string remark) + { + var entity = _wmsVersionRepository.FirstOrDefault(p => p.Id == id); + if (entity != null) + { + entity.Remark = remark; + await _wmsVersionRepository.UpdateAsync(entity); + + } + return true; + } + + + /// + /// 任务明细标记已确认 + /// + /// 上传的文件(前端已经限制只能上传一个附件) + /// + [HttpPost] + [Route("WmsSharePartOutPutModify")] + [DisableRequestSizeLimit] + + public async Task WmsSharePartUpdate(WmsOneTimeSaleOutPutDetial detial) + { + var _entityList = _wmsRepository.Where(p => p.Id == detial.BranchId).ToList(); + if (_entityList.Count() > 0) + { + foreach (var itm in _entityList) + { + itm.OutputQty = detial.OutputQty; + await _wmsRepository.UpdateAsync(itm); + } + } + return true; + + } + + /// + /// 选择任务,生成出库单,只包含已确认的单据 + /// + /// + /// + /// + [HttpPost] + [Route("ExcelImport")] + [UnitOfWork(false)] + public async Task WmsKanbanOutPut([FromForm] IFormFileCollection files, string version) + { + + var _billNum = "OTS" + DateTime.Now.ToString("yyyyMMddhhmmss"); + + + //var _list = _dapper.GetNoKanbanSettleDetail(input.Version); + + ExportImporter _exportImporter = new ExportImporter(); + //只取导入模板第一个页签 + var _list = await _exportImporter.ExtendExcelOfSheetOneImport(files, _excelImportService); + + if (_list == null || _list.Count == 0) + { + throw new BusinessException("导入模板数据不能为空!"); + } + + ////插入数据前检验 + //var checkList = new List(); + //var _group = _list.GroupBy(x => new { x.Qty,x.SapMaterialCode, x.Version }).Select(p => new { Count = p.Count(), Qty = p.Key.Qty, SapMaterialCode = p.Key.SapMaterialCode }); + //foreach (var itm in _group) + //{ + // if (itm.Qty==null) + // { + // checkList.Add(new ErrorExportDto(version, "OneTiemSale", string.Empty, string.Empty, string.Empty, string.Empty, string.Format("导入的平台数据不是{0}平台的,请检查!", itm.Factory), string.Empty)); + // break; + // } + //} + + + var stockList = _wmsDapper.GetSalesStock(); + var query = from itm in _list + join itm1 in stockList on itm.SapMaterialCode equals itm1.SapCode + into temp1 + from tm1 in temp1.DefaultIfEmpty() + select new WmsOneTimeSaleOutPutDetial( + GuidGenerator.Create(), + "无看板发货", + itm.SapMaterialCode, + itm.MaterialDesc, + version, + itm.IsBack,//是否备件 + string.Empty, + itm.Qty, + tm1 == null ? 0 : tm1.Qty, + itm.Qty, + itm.Extend,//客户信息 + _billNum, + 0, + 0, + itm.Price, + itm.Amt + ); + + await _wmsRepository.GetDbContext().BulkInsertAsync(query.ToList(), new BulkConfig() { BulkCopyTimeout = 0, BatchSize = 10000 }); + int _count = _wmsVersionRepository.Count(p => p.Version == version && p.BillNum == _billNum); + if (_count == 0) + { + var _version = new WmsOneTimeSaleOutPut(GuidGenerator.Create(), version, _billNum, CurrentUser.Email); + await _wmsVersionRepository.InsertAsync(_version, true); + } + return ApplicationConsts.SuccessStr; + } + /// + /// 出库界面功能,核准出库功能 + /// + /// + /// + /// + [HttpPost] + [Route("WmsKanbanOutPut-Pass")] + [UnitOfWork(false)] + public async Task WmsKanbanOutPutPass(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(); + } + //_ls = _ls.Where(p => p.SockQty < p.OutputQty || p.Qty < p.OutputQty).ToList(); + //var checkList = new List(); + + //foreach (var itm in _ls) + //{ + // checkList.Add(new ErrorExportDto() { Message = string.Format("物料号:{0}出库数量大于结算数量或寄售库存数量!",itm.SapMaterialCode) }); + //} + //if (checkList.Count > 0) + //{ + + // return await ExportErrorReportAsync(checkList,"校验失败.xlsx"); + //} + + if (_ls.Count() > 0) + { + var sql = "DECLARE @return_value int\n" + + "EXEC @return_value = [dbo].[p_wms_ou" + + "tput]\n" + + " @billnum = N'{0}',\n" + + " @type = 21,\n" + + " @date = N'{1}'\n" + + "SELECT 'Return Value' = @return_value"; + await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync( + string.Format(sql, input.BillNum, input.AccountDate.ToShortDateString())); + + } + } + return ApplicationConsts.SuccessStr; + } + /// + ///出库界面功能, 撤销核准出库 + /// + /// + /// + /// + [HttpPost] + [Route("WmsKanbanOutPut-Cancel")] + public async Task WmsKanbanOutPutCancel(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 = 21,\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 = 21\n" + + "SELECT 'Return Value' = @return_value"; + await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync( + string.Format(sql, input.BillNum) + ); + + return true; + } + + + /// + /// 导出 + /// + /// + /// + [HttpPost] + [Route("Export")] + //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] + virtual public async Task ExportAsync(WmsOneTimeSaleOutPutDetialRequestDto 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, int.MaxValue, + 0, true); + + var dtos = ObjectMapper.Map, List>(entities); + + IExporter _excel = new ExcelExporter(); + byte[] result = null; + + var _fileName = string.Format("一次性寄售销售出库单_{0}.xlsx", Guid.NewGuid().ToString()); + result = await _excel.ExportAsByteArray(dtos); + + + result.ShouldNotBeNull(); + + //保存导出文件到服务器存成二进制 + await _excelImportService.SaveBlobAsync( + new SaveExcelImportInputDto + { + Name = _fileName, + Content = result + } + ); + return _fileName; + + + + } + + + // 物料 物料组 物料描述 物料号 期间 单位 出库数量 结算数量 + + + + + + + + } +} diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/ImportExcelCommon/ExportImporter.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/ImportExcelCommon/ExportImporter.cs index d5d2d23a..a4d8f376 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/ImportExcelCommon/ExportImporter.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/ImportExcelCommon/ExportImporter.cs @@ -469,21 +469,4 @@ public class GetSetting /// 返回错误信息 /// public string errMessage { get; set; } - } - - - - - - - - - - - - - - - - - + } \ No newline at end of file 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 dce65dea..7ab6c1a6 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs @@ -683,35 +683,35 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices } - ///// - /////红旗工厂未结明细 - ///// - ///// 上传的文件(前端已经限制只能上传一个附件) - ///// - //[HttpPost] - //[Route("HQHUnSettledDetailDiffExportService")] - //[DisableRequestSizeLimit] - //public async Task HQHUnSettledDetailDiffExportServiceMake( - // HQKanbanRequestDto input - // ) - //{ + /// + ///红旗工厂未结明细 + /// + /// 上传的文件(前端已经限制只能上传一个附件) + /// + [HttpPost] + [Route("HQHUnSettledDetailDiffExportService")] + [DisableRequestSizeLimit] + public async Task HQHUnSettledDetailDiffExportServiceMake( + HQKanbanRequestDto input + ) + { - // List customConditionList = new List(); - // customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version }); - // customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode }); - // customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = input.Begin }); - // customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = input.End }); - // customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode }); - // customConditionList.Add(new CustomCondition() { Name = "AcceptNo", Value = input.AcceptNo }); - // customConditionList.Add(new CustomCondition() { Name = "WarehouseDesc", Value = input.WarehouseDesc }); - // customConditionList.Add(new CustomCondition() { Name = "Kanban", Value = input.Kanban }); - // customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup }); - // customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(input.SapCode) ? string.Empty : input.SapCode }); - // var _taskid = await _service.ExportEnqueueAsync("红旗工厂未结明细", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(HQHSettledDetailDiffExportService), customConditionList, (rs) => - // { - // }); - // return _taskid; - //} + List customConditionList = new List(); + customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version }); + customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode }); + customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = input.Begin }); + customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = input.End }); + customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode }); + customConditionList.Add(new CustomCondition() { Name = "AcceptNo", Value = input.AcceptNo }); + customConditionList.Add(new CustomCondition() { Name = "WarehouseDesc", Value = input.WarehouseDesc }); + customConditionList.Add(new CustomCondition() { Name = "Kanban", Value = input.Kanban }); + customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup }); + customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(input.SapCode) ? string.Empty : input.SapCode }); + var _taskid = await _service.ExportEnqueueAsync("红旗工厂未结明细", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(HQHUnSettledDetailDiffExportService), customConditionList, (rs) => + { + }); + return _taskid; + } /// /// 红旗工厂备件明细 diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml index 87cc32f5..33b68568 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml @@ -3344,6 +3344,83 @@ + + + + + + + + + + + + + 准时化出库主表 + + + + + + + 准时化出库明细 + + + + + + + 更新备注 + + + + + + + 任务明细标记已确认 + + 上传的文件(前端已经限制只能上传一个附件) + + + + + 选择任务,生成出库单,只包含已确认的单据 + + + + + + + + 出库界面功能,核准出库功能 + + + + + + + + 出库界面功能, 撤销核准出库 + + + + + + + + 出库界面功能删除 + + + + + + + + 导出 + + + + @@ -4100,6 +4177,13 @@ 上传的文件(前端已经限制只能上传一个附件) + + + 红旗工厂未结明细 + + 上传的文件(前端已经限制只能上传一个附件) + + 红旗工厂备件明细 diff --git a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs index c6abda67..e12cc9fb 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs @@ -660,12 +660,117 @@ namespace Win.Sfs.SettleAccount.Entities.WMS } + #region 一次性寄售销售结算主表 + /// + /// 一次性寄售销售结算主表 + /// + public class WmsOneTimeSaleOutPut : FullAuditedAggregateRootBase + { + public WmsOneTimeSaleOutPut() + { + } + + public WmsOneTimeSaleOutPut(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 WmsOneTimeSaleOutPutDetial : FullAuditedAggregateRootBase + { + public WmsOneTimeSaleOutPutDetial() + { + } + + + + public WmsOneTimeSaleOutPutDetial(Guid id, string type, string sapMaterialCode, string materialDesc, string version, string isBack, string remark, decimal qty, decimal sockQty, decimal outputQty, string extend, string billnum, int state, decimal realqty, decimal price, decimal amt) : base(id) + { + Type = type; + SapMaterialCode = sapMaterialCode; + MaterialDesc = materialDesc; + Version = version; + IsBack = isBack; + Remark = remark; + Qty = qty; + SockQty = sockQty; + OutputQty = outputQty; + Extend = extend; + BillNum = billnum; + State = state; + RealityNumber = realqty; + Price = price; + Amt = amt; + } + + + + [ImporterHeader(Name = "单据类型", IsIgnore = true)] + [ExporterHeader(DisplayName = "单据类型", IsIgnore = true)] + public string Type { set; get; } + [ImporterHeader(Name = "物料号")] + [ExporterHeader(DisplayName = "物料号")] + public string SapMaterialCode { set; get; } + [ImporterHeader(Name = "物料描述")] + [ExporterHeader(DisplayName = "物料描述")] + public string MaterialDesc { set; get; } + [ImporterHeader(Name = "版本号")] + [ExporterHeader(DisplayName = "版本号")] + public string Version { set; get; } + [ImporterHeader(Name = "是否备件")] + [ExporterHeader(DisplayName = "是否备件")] + public string IsBack { set; get; } + [ImporterHeader(Name = "结算数量")] + [ExporterHeader(DisplayName = "结算数量")] + public decimal Qty { set; get; } + [ImporterHeader(Name = "寄售库存数量", IsIgnore = true)] + [ExporterHeader(DisplayName = "寄售库存数量", IsIgnore = true)] + public decimal SockQty { set; get; } + [ImporterHeader(Name = "真实数量", IsIgnore = true)] + [ExporterHeader(DisplayName = "真实数量", IsIgnore = true)] + public decimal RealityNumber { set; get; } + [ImporterHeader(Name = "出库数量", IsIgnore = true)] + [ExporterHeader(DisplayName = "出库数量", IsIgnore = true)] + public decimal OutputQty { set; get; } + [ImporterHeader(Name = "客户")] + [ExporterHeader(DisplayName = "客户")] + public string Extend { set; get; } + [ImporterHeader(Name = "BillNum", IsIgnore = true)] + [ExporterHeader(DisplayName = "BillNum", IsIgnore = true)] + public string BillNum { set; get; } + [ImporterHeader(Name = "状态", IsIgnore = true)] + [ExporterHeader(DisplayName = "状态", IsIgnore = true)] + public int State { set; get; } + [ImporterHeader(Name = "开票单价")] + [ExporterHeader(DisplayName = "开票单价")] + public decimal Price { set; get; } + [ImporterHeader(Name = "开票金额")] + [ExporterHeader(DisplayName = "开票金额")] + public decimal Amt { set; get; } + } + #endregion diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs index 5eb62f1b..e8e3fef9 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs @@ -841,6 +841,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " temp1.订货看板编号,\n" + " temp1.订货零件号,\n" + " temp1.Sap编码,\n" + + " temp1.[客户物料号],\n" + " temp1.发货零件号,\n" + " temp1.物料组,\n" + " temp1.零件中文名称,\n" + @@ -863,9 +864,10 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " a.IsAuto AS 手工或自动,\n" + " b.StorageLocation AS 收货仓库,\n" + " b.StorageLocationDesc AS 收货仓库描述,\n" + - " b.HQHKanBan AS 订货看板编号,\n" + + " a.Kanban AS 订货看板编号,\n" + " b.MaterialCode AS 订货零件号,\n" + " c.MaterialCode Sap编码,\n" + + " c.CustomerPartCode 客户物料号,\n" + " '' AS 发货零件号,\n" + " c.MaterialDesc AS 零件中文名称,\n" + " isnull( a.Qty, 0 ) AS 发货数量,\n" + @@ -1073,6 +1075,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " A.MaterialCode 结算物料号,\n" + " A.StorageLocation 收货仓库,\n" + " A.StorageLocationDesc 收货仓库描述,\n" + + " a.[AcceptanceNo] AS 结算验收单号,\n" + " C.EstimateTypeDesc 物料组,\n" + " C.MaterialCode Sap编码,\n" + " C.MaterialDesc 物料描述,\n" + @@ -1084,7 +1087,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " SUM ( Qty ) Qty,\n" + " MaterialCode,\n" + " StorageLocation,\n" + - " StorageLocationDesc \n" + + " StorageLocationDesc,\n" + + " AcceptanceNo \n" + " FROM\n" + " Set_HQ_H_Platform \n" + " WHERE\n" + @@ -1094,7 +1098,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " MaterialCode,\n" + " StorageLocation,\n" + " StorageLocationDesc,\n" + - " price \n" + + " price,\n" + + " AcceptanceNo \n" + " ) A\n" + " LEFT JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" + " ) temp1\n" + @@ -1283,6 +1288,10 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report public string 零件中文名称 { set; get; } [ExporterHeader(DisplayName = "Sap编码")] public string Sap编码 { set; get; } + + [ExporterHeader(DisplayName = "客户物料号")] + public string 客户物料号 { set; get; } + [ExporterHeader(DisplayName = "物料组(车型)")] public string 物料组 { set; get; } [ExporterHeader(DisplayName = "发货数量")] diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleKBWithCodeDapperReportRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleKBWithCodeDapperReportRepository.cs index dec9e90b..1f2bd7e1 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleKBWithCodeDapperReportRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleKBWithCodeDapperReportRepository.cs @@ -45,7 +45,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report string sqlString = "SELECT\n" + " * ,\n" + - " ISNULL( Price * Qty, 0 ) AS InvoiceMoney,--开票金额\n" + + " ISNULL( temp1.InvoicePrice * Qty, 0 ) AS InvoiceMoney,--开票金额\n" + " ISNULL( Price * WMSDeliveryQty, 0 ) AS Amount,--金额\n" + " ISNULL( Price * Qty, 0 ) AS SettlePrice,--结算金额\n" + " ( Price - InvoicePrice ) AS InvoiceDiffPrice,--单价差异\n" + @@ -65,7 +65,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " b.EstimateTypeDesc,--物料组(车型)\n" + " c.WMSDeliveryQty,--交货数量\n" + " ISNULL( a.Qty, 0 ) AS SettleNumber,--结算数量\n" + - " a.SettleDate,--结算日期\n" + + " CONVERT ( VARCHAR ( 100 ), a.SettleDate, 23 ) SettleDate,--结算日期\n" + " ISNULL( a.Qty, 0 ) AS Qty,--用于计算\n" + " ( ISNULL( a.Qty, 0 ) - ISNULL( c.WMSDeliveryQty, 0 ) ) AS SettleWMSDiffQty,--结算与发货差异\n" + " 0 AS SettleInvoiceDiffQty,--结算与开票差异\n" + diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHSettledDetailDiffExportService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHSettledDetailDiffExportService.cs index 83c85c1e..099c4979 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHSettledDetailDiffExportService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHSettledDetailDiffExportService.cs @@ -63,7 +63,7 @@ namespace SettleAccount.Job.Services.Report var _lsnoSettle = _dapperRepository.GetNOInvoiceSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup); //反向对比,有发货无结算,单独拿出去,财务要求 - var _reversels = _dapperRepository.GetReverseSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup); + //var _reversels = _dapperRepository.GetReverseSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup); var _lst = _dapperRepository.GetDiffQtyList(version); diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHUnSettledDetailDiffExportService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHUnSettledDetailDiffExportService.cs index c1614a66..2643bd34 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHUnSettledDetailDiffExportService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHUnSettledDetailDiffExportService.cs @@ -64,47 +64,49 @@ namespace SettleAccount.Job.Services.Report - if (!string.IsNullOrEmpty(kanban)) - { - var _groupList = kanban.Split(new char[] { '\n' }).Distinct().ToList(); - if (_groupList.Count() > 0) - { - _ls = _ls.Where(p => _groupList.Contains(p.订货看板编号)).ToList(); - } - } - if (!string.IsNullOrEmpty(warehouseDesc)) - { - var _groupList = warehouseDesc.Split(new char[] { '\n' }).Distinct().ToList(); - if (_groupList.Count() > 0) - { - _ls = _ls.Where(p => _groupList.Contains(p.收货仓库描述)).ToList(); - } - } + //if (!string.IsNullOrEmpty(kanban)) + //{ + // var _groupList = kanban.Split(new char[] { '\n' }).Distinct().ToList(); + // if (_groupList.Count() > 0) + // { + // _ls = _ls.Where(p => _groupList.Contains(p.订货看板编号)).ToList(); + // } + //} + + //if (!string.IsNullOrEmpty(warehouseDesc)) + //{ + // var _groupList = warehouseDesc.Split(new char[] { '\n' }).Distinct().ToList(); + // if (_groupList.Count() > 0) + // { + // _ls = _ls.Where(p => _groupList.Contains(p.收货仓库描述)).ToList(); + // } + //} + + //if (!string.IsNullOrEmpty(acceptNo)) + //{ + // var _groupList = acceptNo.Split(new char[] { '\n' }).Distinct().ToList(); + // if (_groupList.Count() > 0) + // { + // _ls = _ls.Where(p => _groupList.Contains(p.结算验收单号)).ToList(); + // } + //} + //if (!string.IsNullOrEmpty(materialGroup)) + //{ + // var _groupList = materialGroup.Split(new char[] { ',' }).Distinct().ToList(); + // if (_groupList.Count() > 0) + // { + // _ls = _ls.Where(p => _groupList.Contains(p.物料组)).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.发货零件号)).ToList(); + // } + //} - if (!string.IsNullOrEmpty(acceptNo)) - { - var _groupList = acceptNo.Split(new char[] { '\n' }).Distinct().ToList(); - if (_groupList.Count() > 0) - { - _ls = _ls.Where(p => _groupList.Contains(p.结算验收单号)).ToList(); - } - } - if (!string.IsNullOrEmpty(materialGroup)) - { - var _groupList = materialGroup.Split(new char[] { ',' }).Distinct().ToList(); - if (_groupList.Count() > 0) - { - _ls = _ls.Where(p => _groupList.Contains(p.物料组)).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.发货零件号)).ToList(); - } - } if (!string.IsNullOrEmpty(sapCode)) { var _groupList = sapCode.Split(new char[] { '\n' }).Distinct().ToList(); diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobModule.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobModule.cs index 2c8851a7..0e96f885 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobModule.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobModule.cs @@ -174,6 +174,11 @@ namespace Win.Sfs.SettleAccount { return implementationFactory.GetService(); } + //红旗结算未结明细 + if (key.Equals(typeof(HQHUnSettledDetailDiffExportService).FullName)) + { + return implementationFactory.GetService(); + } if (key.Equals(typeof(HQHSharePartSettledDetailDiffExportService).FullName)) { return implementationFactory.GetService();