From febc756b0adaa709512c2e72e14b5d00df306579 Mon Sep 17 00:00:00 2001 From: Administrator Date: Sat, 29 Jan 2022 15:46:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/WMS/WMSJitAppService.cs | 58 ++++- .../Entities/WMS/WmsOutputSumAppService.cs | 154 ++++++++++++ .../ReportServices/ReportMakeService.cs | 47 ++++ .../SettleAccount.Application.xml | 14 ++ .../Entities/WMS/TaskList.cs | 7 +- .../Tasks/TaskDapperRepository.cs | 54 ++-- .../Report/WmsOutputSumExportService.cs | 235 ++++++++++++++++++ 7 files changed, 537 insertions(+), 32 deletions(-) create mode 100644 src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsOutputSumAppService.cs create mode 100644 src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/WmsOutputSumExportService.cs diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSJitAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSJitAppService.cs index f607feb2..2ce0f9a4 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSJitAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSJitAppService.cs @@ -226,6 +226,58 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts return new PagedResultDto(totalCount, entities); } + + + /// + /// 准时化出库明细 + /// + /// + /// + [HttpPost] + [Route("Export")] + //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] + virtual public async Task ExportAsync(WmsJitOutPutDetialRequestDto 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); + + IExporter _csv = new CsvExporter(); + IExporter _excel = new ExcelExporter(); + string _fileName = string.Empty; + //声明导出容器 + + byte[] result = null; + + _fileName = string.Format("准时化出库单_{0}.xlsx", Guid.NewGuid().ToString()); + result = await _csv.ExportAsByteArray(entities); + + result.ShouldNotBeNull(); + + //保存导出文件到服务器存成二进制 + await _excelImportService.SaveBlobAsync( + new SaveExcelImportInputDto + { + Name = _fileName, + Content = result + } + ); + return _fileName; + + } + + + + + + + + + + + + /// /// 准时化出库明细 /// @@ -322,13 +374,13 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts string.Empty, string.Empty, 0, - string.Empty, - string.Empty, + itm.Extend1, + itm.Extend2, input.Version, itm.ParentMaterialCode, itm.BillNum, GuidGenerator.Create() - , string.Empty + ,string.Empty , itm.Qty ); _lsCopy.Add(_detail); diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsOutputSumAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsOutputSumAppService.cs new file mode 100644 index 00000000..48772476 --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsOutputSumAppService.cs @@ -0,0 +1,154 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Caching.Distributed; +using AutoMapper; +using System.Linq; +using System.Text; +using Volo.Abp.Guids; +using Volo.Abp.Application.Services; +using Volo.Abp.Caching; + +using Volo.Abp.ObjectMapping; +using Win.Sfs.SettleAccount.ExcelImporter; +using Win.Sfs.Shared.CacheBase; +using Win.Utils; +using Volo.Abp.Application.Dtos; +using Win.Sfs.BaseData.ImportExcelCommon; +using Volo.Abp.Domain.Repositories; +using EFCore.BulkExtensions; +using System.IO; +using Microsoft.EntityFrameworkCore; +using Win.Sfs.SettleAccount.Entities.SettleAccountVersion; +using Win.Sfs.SettleAccount.FISes; +using Win.Sfs.Shared.Enums.SettleAccount; +using Win.Sfs.Shared.Filter; +using Shouldly; +using Magicodes.ExporterAndImporter.Csv; +using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Excel; +using System.Data.Common; +using Volo.Abp.Uow; +using Volo.Abp; +using Win.Abp.Snowflakes; +using Win.Sfs.SettleAccount.CommonManagers; +using Win.Sfs.SettleAccount.ExportReports; +using Win.Sfs.SettleAccount.Constant; +using Win.Sfs.SettleAccount.MaterialRelationships; +using Win.Sfs.SettleAccount.Entities.TaskJobs; +using Magicodes.ExporterAndImporter.Core.Models; + +using TaskJob.Services; +using TaskJob.EventArgs; +using Win.Sfs.SettleAccount.Entities.WMS; +using Win.Sfs.SettleAccount.Entities.Wms; +using Win.Sfs.SettleAccount.Repository; +using WY.NewJit.Extends.PaiGe.WMS; +using System.Text.RegularExpressions; + +namespace Win.Sfs.SettleAccount.Entities.WMS +{ + public class WmsOutputSum + { + [ImporterHeader(Name = "物料号", AutoTrim = true)] + //物料号 + public string MaterialCode { set; get; } + [ImporterHeader(Name = "物料描述", AutoTrim = true)] + //物料描述 + public string MaterialDesc { set; get; } + [ImporterHeader(Name = "物料组(车型)", AutoTrim = true)] + //物料组(车型) + public string MaterialGroup { set; get; } + [ImporterHeader(Name = "结算数量")] + public decimal Qty { set; get; } + [ImporterHeader(Name = "单价")] + public decimal Price { set; get; } + [ImporterHeader(Name = "金额")] + public decimal Amt { set; get; } + + + } + + + + [Route("api/settleaccount/WmsOutputSum")] + [Authorize(SettleAccountPermissions.WMSJIT.Default)] + public class WmsOutputSumAppService: SettleAccountApplicationBase + { + private readonly TaskJobService _service; + private readonly IExcelImportAppService _excelImportService; + private readonly ISettleAccountBranchEfCoreRepository _job; + public WmsOutputSumAppService( + IExcelImportAppService excelImportService, + ISettleAccountBranchEfCoreRepository job, + ISnowflakeIdGenerator snowflakeIdGenerator, + ICommonManager commonManager, + IDistributedCache cache + ) : base(cache, excelImportService, snowflakeIdGenerator, commonManager) + { + _job = job; + + _excelImportService = excelImportService; + } + + + + + + //public async Task GetWmsSum(WmsJitOutPutDetial input) + //{ + // var jobList= _job.Where(p => p.Type == input.Version).ToList(); + + // var _fileList= jobList.Where(p=>p.Name == "准时化结算核对明细" && Regex.Replace(p.FileName, @"^[A-Z]+[0-9]+$", string.Empty)==string.Empty); + + + // List _lst = new List(); + // foreach (var filename in _fileList) + // { + // string fileSavePath = Environment.CurrentDirectory + @"\wwwroot\files\host\my-file-container\" + filename.RealDownFileName; + // ExcelHelper _excelHelper = new ExcelHelper(fileSavePath); + // var _list = _excelHelper.ExcelToList(); + // var _ls1 = _list.Where(p => p.ParentMaterialCode == p.MaterialCode).ToList(); + + // _ls1.GroupBy(p=>new {p.MaterialCode,p. }) + // foreach (var itm in _ls1) + // { + // var _detail = new List(); + // } + + // //var _lsCopy = new List(); + // //foreach (var itm in _list) + // //{ + // // WmsJitOutPutDetial _detail = new WmsJitOutPutDetial( + // // GuidGenerator.Create(), + // // itm.WmsBillNum, + // // itm.KennCode, + // // itm.ChassisNumber, + // // itm.MaterialCode, + // // itm.MaterialDesc, + // // itm.MaterialGroup, + // // string.Empty, + // // string.Empty, + // // 0, + // // string.Empty, + // // string.Empty, + // // input.Version, + // // itm.ParentMaterialCode, + // // itm.BillNum, + // // GuidGenerator.Create() + // // , string.Empty + // // , itm.Qty + // // ); + // // _lsCopy.Add(_detail); + // //} + // //_lst.AddRange(_lsCopy.ToArray()); + // } + //} + + + + } +} 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 748fcb72..f22ba4ea 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs @@ -377,6 +377,53 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices }); return _taskid; } + /// + ///发票与结算核对明细表 + /// + /// 上传的文件(前端已经限制只能上传一个附件) + /// + [HttpPost] + [Route("VersionSum")] + [DisableRequestSizeLimit] + + public async Task VersionSumMake( + BaseRequestDto request + ) + { + + + List customConditionList = new List(); + customConditionList.Add(new CustomCondition() { Name = "Version", Value = string.IsNullOrEmpty(request.Version) ? string.Empty : request.Version }); + customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = string.IsNullOrEmpty(request.MaterialCode) ? string.Empty : request.MaterialCode }); + customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = string.IsNullOrEmpty(request.Begin) ? string.Empty : request.Begin }); + customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = string.IsNullOrEmpty(request.End) ? string.Empty : request.End }); + customConditionList.Add(new CustomCondition() { Name = "Cp7BeginTime", Value = string.IsNullOrEmpty(request.Cp7Begin) ? string.Empty : request.Cp7Begin }); + customConditionList.Add(new CustomCondition() { Name = "Cp7EndTime", Value = string.IsNullOrEmpty(request.Cp7End) ? string.Empty : request.Cp7End }); + customConditionList.Add(new CustomCondition() { Name = "KennCode", Value = string.IsNullOrEmpty(request.Kenncode) ? string.Empty : request.Kenncode }); + customConditionList.Add(new CustomCondition() { Name = "ChassisNumber", Value = string.IsNullOrEmpty(request.ChassisNumber) ? string.Empty : request.ChassisNumber }); + customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(request.MaterialGroup) ? string.Empty : request.MaterialGroup }); + customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(request.SapCode) ? string.Empty : request.SapCode }); + + + + + + var _taskid = await _service.ExportEnqueueAsync("", ExportExtentsion.Excel, request.Version, string.IsNullOrEmpty(request.MaterialGroup) ? string.Empty : request.MaterialGroup, CurrentUser, typeof(InvoiceSettledDetailDiffExportService), 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 a30a9fd5..6021af5a 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml @@ -2076,6 +2076,13 @@ + + + 准时化出库明细 + + + + 准时化出库明细 @@ -3782,6 +3789,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 6b107b77..e71ec430 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs @@ -83,6 +83,9 @@ namespace Win.Sfs.SettleAccount.Entities.WMS } + + + /// /// 准时化出库明细 /// @@ -139,7 +142,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS public string InPut { set; get; } [ImporterHeader(Name = "状态")] public int State { get; set; } - [ImporterHeader(Name = "客户物料")] + [ImporterHeader(Name = "开票单价")] /// /// 扩展字段1 /// @@ -147,7 +150,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS /// /// 扩展字段2 /// - [ImporterHeader(Name = "扩展字段2", IsIgnore = true)] + [ImporterHeader(Name = "开票金额", IsIgnore = true)] public string Extend2 { set; get; } /// /// 扩展字段3 diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Tasks/TaskDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Tasks/TaskDapperRepository.cs index 05ad1568..90d99cc6 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Tasks/TaskDapperRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Tasks/TaskDapperRepository.cs @@ -31,33 +31,33 @@ namespace Win.Sfs.SettleAccount.Repository public virtual async Task> GetTaskJobsAsync(Job p_task) { string str = string.Empty; - str= "SELECT\n" + - " b.Id,\n" + - " isnull( a.StateId, 0 ) StateId,\n" + - " b.Type,\n" + - " isnull( a.StateName, 'Succeeded' ) StateName,\n" + - " isnull( a.InvocationData, '' ) InvocationData,\n" + - " Isnull( a.Arguments, '' ) Arguments,\n" + - " b.CreationTime CreatedAt,\n" + - " b.CreationTime ExpireAt,\n" + - " b.TaskId,\n" + - " b.NAME,\n" + - " isnull( b.remark, '' ) remark,\n" + - " b.ActionName,\n" + - " b.Error,\n" + - " b.Creator,\n" + - " b.Email,\n" + - " b.FileName,\n" + - " b.DownFileName,\n" + - " b.ServiceName,\n" + - " b.RealDownFileName,\n" + - " b.RealFileName \n" + - "FROM\n" + - " Set_TaskJob AS b\n" + - " LEFT JOIN HangFire.Job AS a ON a.Id = b.TaskId \n" + - "WHERE\n" + - " 1 = 1 \n" + - " AND a.StateName IS NULL"; + str = "SELECT\n" + + " b.Id,\n" + + " isnull( a.StateId, 0 ) StateId,\n" + + " b.Type,\n" + + " isnull( a.StateName, 'Succeeded' ) StateName,\n" + + " isnull( a.InvocationData, '' ) InvocationData,\n" + + " Isnull( a.Arguments, '' ) Arguments,\n" + + " b.CreationTime CreatedAt,\n" + + " b.CreationTime ExpireAt,\n" + + " b.TaskId,\n" + + " b.NAME,\n" + + " isnull( b.remark, '' ) remark,\n" + + " b.ActionName,\n" + + " b.Error,\n" + + " b.Creator,\n" + + " b.Email,\n" + + " b.FileName,\n" + + " b.DownFileName,\n" + + " b.ServiceName,\n" + + " b.RealDownFileName,\n" + + " b.RealFileName \n" + + "FROM\n" + + " Set_TaskJob AS b\n" + + " LEFT JOIN HangFire.Job AS a ON a.Id = b.TaskId \n" + + "WHERE\n" + + " 1 = 1 \n"; + if (!string.IsNullOrEmpty(p_task.Email)) diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/WmsOutputSumExportService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/WmsOutputSumExportService.cs new file mode 100644 index 00000000..203bd9af --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/WmsOutputSumExportService.cs @@ -0,0 +1,235 @@ +using Magicodes.ExporterAndImporter.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using TaskJob.EventArgs; +using TaskJob.Interfaces; +using Volo.Abp.DependencyInjection; +using Win.Sfs.SettleAccount.Reports.InvoiceSettledDiffs; +using Win.Sfs.SettleAccount.Repository.SettleAccount; +using Win.Sfs.SettleAccount.Repository.SettleAccountJob; +using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report; +namespace SettleAccount.Job.Services.Report +{ + public class WmsOutputSum + { + [ImporterHeader(Name = "物料号", AutoTrim = true)] + //物料号 + public string MaterialCode { set; get; } + [ImporterHeader(Name = "物料描述", AutoTrim = true)] + //物料描述 + public string MaterialDesc { set; get; } + [ImporterHeader(Name = "物料组(车型)", AutoTrim = true)] + //物料组(车型) + public string MaterialGroup { set; get; } + [ImporterHeader(Name = "结算数量")] + public decimal Qty { set; get; } + [ImporterHeader(Name = "单价")] + public decimal Price { set; get; } + [ImporterHeader(Name = "金额")] + public decimal Amt { set; get; } + + + } + + + + + public class WmsOutputSumExportService + : ITransientDependency, IExportJob + { + + private readonly InvoiceSettledDetailDiffDapperRepository _dapperRepository; + private readonly ErpPartDapperRepository _erpdapperRepository; + + private readonly OutputService _outputService; + private readonly InputService _inputService; + + public WmsOutputSumExportService( + + ErpPartDapperRepository erpdapperRepository, + InvoiceSettledDetailDiffDapperRepository dapperRepository, + OutputService outputService, + InputService inputService + ) + { + _inputService = inputService; + _outputService = outputService; + _erpdapperRepository = erpdapperRepository; + //_repository = repository; + //_versionRepository = versionRepository; + _dapperRepository = dapperRepository; + } + + + public string ExportFile(Guid id, List exportName, List p_list) + { + + return id.ToString(); + } + + + + //public List InvoiceSettledDetailExportFile(Guid id, List exportName, List p_list) + //{ + // //var _filename = exportName.FirstOrDefault(); + // //var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value; + // //var materialCode = p_list.Where(p => p.Name == "MaterialCode").FirstOrDefault().Value; + // //var begin = p_list.Where(p => p.Name == "BeginTime").FirstOrDefault().Value; + // //var end = p_list.Where(p => p.Name == "EndTime").FirstOrDefault().Value; + // //var cp7begin = p_list.Where(p => p.Name == "Cp7BeginTime").FirstOrDefault().Value; + // //var cp7end = p_list.Where(p => p.Name == "Cp7EndTime").FirstOrDefault().Value; + // //var kenncode = p_list.Where(p => p.Name == "KennCode").FirstOrDefault().Value; + // //var chassisNumber = p_list.Where(p => p.Name == "ChassisNumber").FirstOrDefault().Value; + // //var materialGroup = p_list.Where(p => p.Name == "MaterialGroup").FirstOrDefault().Value; + // //var sapCode = p_list.Where(p => p.Name == "SapCode").FirstOrDefault().Value; + // //var _ls = _dapperRepository.GetInvoiceSettledDetailDiffReportList(version, materialCode, begin, end, cp7begin, cp7end, kenncode, chassisNumber, materialGroup); + // //var _list = _ls.Where(p => p.ParentSapMaterialCode != p.SapMaterialCode).GroupBy(p => new { p.ParentSapMaterialCode, p.ChassisNumber, p.KENNCode }) + // //.Select(p => p.FirstOrDefault()).ToList(); + // //var rangeList = _erpdapperRepository.GetSapList(_list, version, true); + // //var diffList = _erpdapperRepository.GetSettleInvoiceDiff(version); + + // //if (_ls.Count > 0) + // //{ + // // var erpPriceList = _ls.Where(p => p.ParentSapMaterialCode != p.SapMaterialCode) + // // .GroupBy(p => new { p.ParentSapMaterialCode, p.ChassisNumber, p.KENNCode }) + // // .Select(p => new { ParentSapMaterialCode = p.Key.ParentSapMaterialCode, ChassisNumber = p.Key.ChassisNumber, KENNCode = p.Key.KENNCode, Price = p.Sum(itm => itm.InvoiceAmt) }).ToList(); + + + + // // var rangList = from itm1 in rangeList + // // join itm2 in erpPriceList + // // on new { itm1.ParentSapMaterialCode, itm1.KENNCode, itm1.ChassisNumber } + // // equals new { itm2.ParentSapMaterialCode, itm2.KENNCode, itm2.ChassisNumber } + // // into temp1 + // // from tm1 in temp1.DefaultIfEmpty() + // // select new InvoiceSettledDetailDiff + // // { + // // WmsBillNum = itm1.WmsBillNum, + // // CP5Time = itm1.CP5Time, + // // KENNCode = itm1.KENNCode, + // // ChassisNumber = itm1.ChassisNumber, + // // WmsState = itm1.WmsState, + // // SapMaterialCode = itm1.SapMaterialCode, + // // MaterialDesc = itm1.MaterialDesc, + // // MaterialCode = itm1.MaterialCode, + // // ParentSapMaterialCode = itm1.ParentSapMaterialCode, + // // ParentMaterialDesc = itm1.ParentMaterialDesc, + // // MaterialGroup = itm1.MaterialGroup, + // // Price = itm1.Price, + // // Amt = itm1.Amt, + // // Qty = 1, + // // SettledQty = 1, + // // CP7Time = itm1.CP7Time, + // // DiffSettleFisQty = 0, + // // DiffSettleInvQty = 0, + // // InvoiceQty = 1, + // // InvoicePrice = itm1 == null ? 0 : tm1.Price, + // // InvoiceAmt = itm1 == null ? 0 : tm1.Price, + // // SettleAmt = itm1 == null ? 0 : tm1.Price, + // // DiffPrice = itm1 == null ? 0 - itm1.Price : tm1.Price - itm1.Price + // // }; + + // // rangeList = rangList.ToList(); + + + + + // // foreach (var itm in diffList) + // // { + // // var _first = _ls.FirstOrDefault(p => p.MaterialCode == itm.MaterialCode); + // // if (_first != null) + // // { + // // _first.InvoiceQty = _first.SettledQty + itm.DiffQty; + // // _first.DiffSettleInvQty = itm.DiffQty; + // // } + // // } + + // // foreach (var itm in _ls) + // // { + // // itm.InvoiceAmt = Math.Round(itm.InvoiceQty * itm.InvoicePrice, 2); + // // itm.DiffPrice = itm.Price - itm.InvoicePrice; + // // } + // // _ls.AddRange(rangeList); + + // // //var list1 = _ls.GroupBy(p => new { p.ChassisNumber, p.MaterialCode, p.SettleReadyQty }).Select(p => new { SettleQty = p.Key.SettleReadyQty, MaterialCode = p.Key.MaterialCode, ChassisNumber = p.Key.ChassisNumber, Qty = p.Sum(itm => itm.Qty) }).Where(p => p.Qty > 1).ToList(); + // // //foreach (var itm in list1) + // // //{ + // // // var _first = _ls.FirstOrDefault(p => p.ChassisNumber == itm.ChassisNumber && p.MaterialCode == itm.MaterialCode && p.SettleReadyQty == itm.SettleQty); + // // // if (_first != null) + // // // { + // // // _first.DiffSettleFisQty = itm.Qty - itm.SettleQty; + // // // } + // // //} + + + // // if (!string.IsNullOrEmpty(materialGroup)) + // // { + // // var _groupList = materialGroup.Split(new char[] { ',' }).Distinct().ToList(); + // // if (_groupList.Count() > 0) + // // { + // // _ls = _ls.Where(p => _groupList.Contains(p.MaterialGroup)).ToList(); + // // } + // // } + // // if (!string.IsNullOrEmpty(kenncode)) + // // { + // // var _groupList = kenncode.Split("\n").ToList(); + // // if (_groupList.Count() > 0) + // // { + // // _ls = _ls.Where(p => _groupList.Contains(p.KENNCode)).ToList(); + // // } + // // } + // // if (!string.IsNullOrEmpty(chassisNumber)) + // // { + // // var _groupList = chassisNumber.Split("\n").ToList(); + // // if (_groupList.Count() > 0) + // // { + // // _ls = _ls.Where(p => _groupList.Contains(p.ChassisNumber)).ToList(); + // // } + // // } + // // if (!string.IsNullOrEmpty(materialCode)) + // // { + // // var _groupList = materialCode.Split(new char[] { '\n' }).Distinct().ToList(); + // // if (_groupList.Count() > 0) + // // { + // // _ls = _ls.Where(p => _groupList.Contains(p.MaterialCode)).ToList(); + // // } + // // } + // // if (!string.IsNullOrEmpty(sapCode)) + // // { + // // var _groupList = sapCode.Split(new char[] { '\n' }).Distinct().ToList(); + // // if (_groupList.Count() > 0) + // // { + // // _ls = _ls.Where(p => _groupList.Contains(p.SapMaterialCode)).ToList(); + // // } + // // } + + // // //.Select(p => p.FirstOrDefault()); + // // _ls = _ls.OrderBy(p => p.ChassisNumber).ThenBy(p => p.KENNCode).ThenBy(p => p.SapMaterialCode).ToList(); + + // //} + + // //_ls=_ls.Where(p => p.SapMaterialCode == p.MaterialCode).ToList(); + // //var _lstSum= _ls.GroupBy(p => new { p.MaterialGroup, p.MaterialCode, p.InvoicePrice, p.InvoiceAmt,p.MaterialDesc }) + // // .Select(p => new WmsOutputSum + // // { + // // MaterialCode=p.Key.MaterialCode, + // // MaterialGroup=p.Key.MaterialGroup, + // // Price=p.Key.InvoicePrice, + // // Amt=p.Sum(p=>p.InvoiceAmt), + // // MaterialDesc=p.Key.MaterialDesc, + // // Qty=p.Sum(p=>p.Qty) + + + // // }); + + // //return _lstSum; + //} + + } + + + +}