diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Wms/WmsDetailReportDto.cs b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Wms/WmsDetailReportDto.cs index 6c6b3e9a..b81f9c00 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Wms/WmsDetailReportDto.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Wms/WmsDetailReportDto.cs @@ -122,7 +122,7 @@ namespace Win.Sfs.SettleAccount.Entities.Wms.WmsSumOutput [Display(Name = "状态")] public int State { set; get; } - [Display(Name = "过账日期")] + [ExporterHeader(DisplayName = "账期", IsIgnore = true)] public DateTime AccountDate { set; get; } } @@ -193,8 +193,6 @@ namespace Win.Sfs.SettleAccount.Entities.Wms.WmsSumOutput { } - - [Display(Name = "版本号")] public string Version { set; get; } diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsDetailUnInterface.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsDetailUnInterface.cs index dde7096f..774082a6 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsDetailUnInterface.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsDetailUnInterface.cs @@ -3,6 +3,7 @@ using EFCore.BulkExtensions; using Magicodes.ExporterAndImporter.Core; using Magicodes.ExporterAndImporter.Excel; using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; using Shouldly; using System; using System.Collections.Generic; @@ -130,8 +131,29 @@ namespace Win.Sfs.SettleAccount.Entities.WMS [HttpPost] [Route("ModifyTaskState")] - public virtual async Task SyncInterface() + public virtual async Task ModifyTaskState(List guids) { + if (guids != null && guids.Count() > 0) + { + var str = "DECLARE @return_value int \n" + + "EXEC @return_value = [dbo].[p_wms_output_modify]\n" + + "@billnum = N'{0}', \n" + + "@type = {1}, \n" + + "@date = N'{2}', \n" + + "@switchcode = N'{3}', \n" + + "@partcode = N'{4}' \n" + + "SELECT 'Return Value' = @return_value "; + + var _ls= _wmsRepository.Where(p => guids.Contains(p.Id)); + foreach (var itm in _ls) + { + var sql = string.Format(str, itm.BillNum, itm.Type, DateTime.Now, itm.SwitchCode, itm.MaterialCode); + _wmsRepository.GetDbContext().Database.SetCommandTimeout(300); + await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync( + sql + ); + } + } //_wmsRepository.Where(p => p.BillNum ==) return true; } diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsUnInterface.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsUnInterface.cs index 99f8ae42..ab7fcf03 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsUnInterface.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsUnInterface.cs @@ -86,11 +86,12 @@ namespace Win.Sfs.SettleAccount.Entities.WMS List _lst = new List(); if (_difflst != null && _difflst.Count() > 0) { + int line= _maxLine+1; foreach (var itm in _difflst) { - _maxLine = _maxLine++; + line = line++; _lst.Add(new WmsDetailReport(Guid.NewGuid(), - _maxLine, + line, itm.客户, itm.出库类型, itm.结算编码, @@ -297,8 +298,6 @@ namespace Win.Sfs.SettleAccount.Entities.WMS return false; } - - foreach (var itm in entities) { itm.State = 2; @@ -331,6 +330,27 @@ namespace Win.Sfs.SettleAccount.Entities.WMS [Route("Export")] virtual public async Task ExportAsync(WmsRequestDetailReportDto input) { + if (!string.IsNullOrEmpty(input.Client)) + { + input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Client", Logic = EnumFilterLogic.And, Value = input.Client }); + } + + if (!string.IsNullOrEmpty(input.Type)) + { + input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Type", Logic = EnumFilterLogic.And, Value = input.Type }); + } + + if (!string.IsNullOrEmpty(input.MaterialGroup)) + { + input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "MaterialGroup", Logic = EnumFilterLogic.And, Value = input.MaterialGroup }); + } + + if (!string.IsNullOrEmpty(input.BillNum)) + { + 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 = "Version", Logic = EnumFilterLogic.And, Value = input.Version }); var entities = await _wmsRepository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, int.MaxValue, 0, true); diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettledSum.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettledSum.cs new file mode 100644 index 00000000..a8bb0a48 --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettledSum.cs @@ -0,0 +1,109 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using TaskJob.EventArgs; +using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report; + +namespace SettleAccount.Job.Services.Report +{ + public class UnSettledSumService + { + + private readonly UnSettledDetailDapperRepository _dapper; + private readonly OutputService _outputService; + private readonly ErpPartDapperRepository _erpDapper; + public UnSettledSumService( + UnSettledDetailDapperRepository dapper, + OutputService outputService, + ErpPartDapperRepository erpDapper + ) + { + _dapper = dapper; + _outputService = outputService; + _erpDapper = erpDapper; + } + + + //public string GetFisSum(Guid id, List exportName, List p_list) + //{ + // var _first = exportName.FirstOrDefault(); + // var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value; + // var customerCode = p_list.Where(p => p.Name == "CustomerCode").FirstOrDefault().Value; + // var materailCode = p_list.Where(p => p.Name == "MaterialCode").FirstOrDefault().Value; + // var materialGroup = p_list.Where(p => p.Name == "MaterialGroup").FirstOrDefault().Value; + // var sapcode = p_list.Where(p => p.Name == "SapMaterialCode").FirstOrDefault().Value; + // var begin = p_list.Where(p => p.Name == "Begin").FirstOrDefault().Value; + // var end = p_list.Where(p => p.Name == "End").FirstOrDefault().Value; + // var kenncode = p_list.Where(p => p.Name == "KennCode").FirstOrDefault().Value; + // var chassisNumber = p_list.Where(p => p.Name == "ChassisNumber").FirstOrDefault().Value; + // var sapCode = p_list.Where(p => p.Name == "SapCode").FirstOrDefault().Value; + + + // //var cp7begin = p_list.Where(p => p.Name == "CP7Begin").FirstOrDefault().Value; + // //var cp7end = p_list.Where(p => p.Name == "CP7End").FirstOrDefault().Value; + + + // var _list = _dapper.GetDiffReport(DateTime.Now.Year.ToString(), begin, end, customerCode, version, materailCode, materialGroup, sapcode); + // var _ls = _list.Where(p => p.Flag != "L").Where(p => p.ParentSapMaterialCode != p.SapMaterialCode).GroupBy(p => new { p.KENNCode, p.ChassisNumber, p.ParentSapMaterialCode }).Select(p => p.FirstOrDefault()).ToList(); + // var _lst = _erpDapper.GetSapList(_ls, version, false); + // _lst.ForEach(p => + // { + + // p.Qty = 1; + // p.DiffAMT = Math.Round(p.Qty * p.Price, 2); + // p.DiffQty = 1; + // } + // ); + + // if (!string.IsNullOrEmpty(materialGroup)) + // { + // var _groupList = materialGroup.Split(new char[] { ',' }).Distinct().ToList(); + // if (_groupList.Count() > 0) + // { + // _list = _list.Where(p => _groupList.Contains(p.MaterialGroup)).ToList(); + // } + // } + // if (!string.IsNullOrEmpty(kenncode)) + // { + // var _groupList = kenncode.Split(new char[] { '\n' }).Distinct().ToList(); + // if (_groupList.Count() > 0) + // { + // _list = _list.Where(p => _groupList.Contains(p.KENNCode)).ToList(); + // } + // } + // if (!string.IsNullOrEmpty(chassisNumber)) + // { + // var _groupList = chassisNumber.Split(new char[] { '\n' }).Distinct().ToList(); + // if (_groupList.Count() > 0) + // { + // _list = _list.Where(p => _groupList.Contains(p.ChassisNumber)).ToList(); + // } + // } + // if (!string.IsNullOrEmpty(sapCode)) + // { + // var _groupList = sapCode.Split(new char[] { '\n' }).Distinct().ToList(); + // if (_groupList.Count() > 0) + // { + // _list = _list.Where(p => _groupList.Contains(p.SapMaterialCode)).ToList(); + // } + // } + // if (!string.IsNullOrEmpty(materailCode)) + // { + // var _groupList = materailCode.Split(new char[] { '\n' }).Distinct().ToList(); + // if (_groupList.Count() > 0) + // { + // _list = _list.Where(p => _groupList.Contains(p.SapMaterialCode)).ToList(); + // } + // } + // _lst.GroupBy(p=>sapcode).Select() + + + //} + + + + + } +}