From db620543510615cf01eae07277ad458651120bba Mon Sep 17 00:00:00 2001 From: 44673626 <44673626@qq.com> Date: Sat, 16 Apr 2022 19:40:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=B2=E5=87=BA=E5=BA=93=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=E4=B8=BApost=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/WMS/WmsUnSumInterface.cs | 35 ++-- .../Entities/WmsDetailReport.cs | 12 ++ .../Report/WmsOutputSumDapperRepository.cs | 151 +++++++++++++++++- 3 files changed, 182 insertions(+), 16 deletions(-) diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsUnSumInterface.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsUnSumInterface.cs index a319e116..5490749d 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsUnSumInterface.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsUnSumInterface.cs @@ -27,7 +27,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS /// /// 已结算出库查询 /// - //[Authorize(SettleAccountPermissions.WMSJIT.Default)] + [Authorize(SettleAccountPermissions.WMSJIT.Default)] [Route("api/settleaccount/WMSOutputDetailWithCodeReport")] public class WMSOutputDetailWithCodeReportAppService : SettleAccountApplicationBase @@ -61,14 +61,15 @@ namespace Win.Sfs.SettleAccount.Entities.WMS } - [HttpGet] + [HttpPost] [Route("Make")] [UnitOfWork(false)] - public async Task ReportMake(string cnumber,string materialCode, DateTime accountDate) + public async Task ReportMake(WmsDetailWithCodeDto input) { + //先删除 await _wmsRepository.BatchDeleteAsync(); //有条码的业务(可根据条码/K号/底盘号,查询是否结算过,结算期间) - var _ls = _dapper.GetWmsSearchWithCodeReportList(cnumber, materialCode); + var _ls = _dapper.GetWmsSearchWithCodeReportList(input.cnumber, input.materialCode); //var _count = _wmsRepository.Count(p =>p.State > 0); //if (_count > 0) @@ -108,11 +109,20 @@ namespace Win.Sfs.SettleAccount.Entities.WMS )); } } - //过滤 物料号 - if (!string.IsNullOrEmpty(materialCode)) + //get方法 + //if (!string.IsNullOrEmpty(input.materialCode)) + //{ + // var _org_groupList = input.materialCode.Split(new char[] { '\n' }).Distinct().ToList(); + // var _groupList = _org_groupList[0].Replace("\\n", ",").TrimEnd(','); + // if (_groupList.Count() > 0) + // { + // _lst = _lst.Where(p => _groupList.Contains(p.MaterialCode)).ToList(); + // } + //} + //post方式 + if (!string.IsNullOrEmpty(input.materialCode)) { - var _org_groupList = materialCode.Split(new char[] { '\n' }).Distinct().ToList(); - var _groupList = _org_groupList[0].Replace("\\n", ",").TrimEnd(','); + var _groupList = input.materialCode.Split(new char[] { '\n' }).Distinct().ToList(); if (_groupList.Count() > 0) { _lst = _lst.Where(p => _groupList.Contains(p.MaterialCode)).ToList(); @@ -148,12 +158,17 @@ namespace Win.Sfs.SettleAccount.Entities.WMS return new PagedResultDto(totalCount, entities); } - private async Task GetCountAsync(WmsRequestDetailReportDto input) { - input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Version", Logic = EnumFilterLogic.And, Value = input.Version }); return await _wmsRepository.GetCountByFilterAsync(GuidGenerator.Create(), input.Filters); } + + + //private async Task GetCountAsync(WmsRequestDetailReportDto input) + //{ + // input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Version", Logic = EnumFilterLogic.And, Value = input.Version }); + // return await _wmsRepository.GetCountByFilterAsync(GuidGenerator.Create(), input.Filters); + //} [HttpPost] [Route("ModifyTaskState")] diff --git a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WmsDetailReport.cs b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WmsDetailReport.cs index fa933172..8ae2ba75 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WmsDetailReport.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WmsDetailReport.cs @@ -337,5 +337,17 @@ namespace Win.Sfs.SettleAccount.Entities [Display(Name = "状态")] public int State { set; get; } + } + + public class WmsDetailWithCodeDto + { + + public string cnumber { set; get; } + + + public string materialCode { set; get; } + + + } } diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/WmsOutputSumDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/WmsOutputSumDapperRepository.cs index 1b0dfcd6..6d2c1279 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/WmsOutputSumDapperRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/WmsOutputSumDapperRepository.cs @@ -1151,17 +1151,156 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report /// public virtual List GetWmsSearchWithCodeReportList(string CNumber, string materialCode) { - - if(string.IsNullOrEmpty(CNumber)) + + if (string.IsNullOrEmpty(CNumber)) { throw new BusinessException("001", "通用代码号不能为空!"); } string getcnumber = ""; - var _org_cnumbersList = CNumber.Split(new char[] { '\n' }).Distinct().ToList(); - var _cnumbersList = _org_cnumbersList[0].Replace("\\n", ",").TrimEnd(',').Split(','); + var _cnumbersList = CNumber.Split(new char[] { '\n' }).Distinct().ToList(); foreach (var cnumber in _cnumbersList) { - getcnumber += "'" + cnumber.ToString().Trim() + "'"+ ","; + getcnumber += "'" + cnumber.ToString().Trim() + "'" + ","; + } + getcnumber = getcnumber.TrimEnd(','); + + var _sql = "SELECT\n" + + " ROW_NUMBER ( ) OVER ( ORDER BY Type DESC ) 行号 ,\n" + + " temp1.Client 客户,\n" + + " temp1.Type 出库类型,\n" + + " temp1.BillNum 结算单,\n" + + " temp1.MaterialCode 物料号,\n" + + " temp1.CNumber 通用代码号,\n" + + " Isnull( temp1.Qty, 0 ) 结算数量,\n" + + " Isnull( temp1.OutputQty, 0 ) 实际出库数量,\n" + + " Isnull( temp1.Qty, 0 ) - Isnull( temp1.OutputQty, 0 ) 差异数量,\n" + + " temp1.Price 开票单价,\n" + + " Round( Isnull( temp1.Qty, 0 ) * temp1.Price, 2 ) 结算金额,\n" + + " Round( ( Isnull( temp1.Qty, 0 ) - Isnull( temp1.OutputQty, 0 ) ) * temp1.Price, 2 ) WMS待出库金额,\n" + + " temp2.EstimateType 物料组编码,\n" + + " temp2.EstimateTypeDesc 物料组车型,\n" + + " temp2.MaterialDesc 物料描述,\n" + + " temp1.remark 备注 \n" + + "FROM\n" + + " (\n" + + " SELECT\n" + + " '大众准时化出库' AS Type,\n" + + " '大众' Client,\n" + + " BillNum,\n" + + " MaterialCode,\n" + + " Qty,\n" + + " 0 OutputQty,\n" + + " 0 IsBack,\n" + + " Price,\n" + + " ChassisNumber CNumber,\n" + + " Remark \n" + + " FROM\n" + + " Set_WmsJitOutPutDetial \n" + + " WHERE\n" + + " ChassisNumber IN ({0}) \n" + + " AND State = 2 UNION ALL\n" + + " SELECT\n" + + " '大众看板出库' AS Type,\n" + + " '大众' Client,\n" + + " BillNum,\n" + + " MaterialCode,\n" + + " Qty Qty,\n" + + " 0 OutputQty,\n" + + " 0 IsBack,\n" + + " Price,\n" + + " Kanban CNumber,\n" + + " Remark \n" + + " FROM\n" + + " Set_WmsKanbanOutPutDetial \n" + + " WHERE\n" + + " Kanban IN ({0}) \n" + + " AND State = 2 UNION ALL\n" + + " SELECT\n" + + " '大众备件条码出库' AS Type,\n" + + " '大众' Client,\n" + + " BillNum,\n" + + " MaterialCode,\n" + + " Qty Qty,\n" + + " 0 OutPutQty,\n" + + " 1 IsBack,\n" + + " Price,\n" + + " OrderBillNum CNumber,\n" + + " Remark \n" + + " FROM\n" + + " Set_WmsSharePart90OutPutDetial \n" + + " WHERE\n" + + " OrderBillNum IN ({0}) \n" + + " AND State = 2 UNION ALL\n" + + " SELECT\n" + + " '红旗看板出库' AS Type,\n" + + " '红旗' Client,\n" + + " BillNum,\n" + + " MaterialCode,\n" + + " Qty Qty,\n" + + " 0 OutPutQty,\n" + + " 0 IsBack,\n" + + " Price,\n" + + " Kanban CNumber,\n" + + " Remark \n" + + " FROM\n" + + " Set_WmsHQHKanbanOutPutDetial \n" + + " WHERE\n" + + " Kanban IN ({0}) \n" + + " AND State = 2 \n" + + " UNION ALL SELECT\n" + + " '自定义发货出库' AS Type,\n" + + " customercode Client,\n" + + " BillNum,\n" + + " SapMaterialCode,\n" + + " Qty Qty,\n" + + " Qty OutputQty,\n" + + " '0' IsBack,\n" + + " Price,\n" + + " Kanban CNumber,\n" + + " Remark \n" + + " FROM\n" + + " Set_WmsCustomerKanbanOutPutDetial \n" + + " WHERE\n" + + " Kanban IN ({0}) \n" + + " AND State = 2\n" + + " \n" + + " ) temp1\n" + + " LEFT JOIN ( SELECT MAX ( Id ) Id, MaterialCode, MaterialDesc, EstimateType, EstimateTypeDesc FROM Set_material GROUP BY MaterialCode, MaterialDesc, EstimateTypeDesc, EstimateType ) temp2 ON temp1.MaterialCode = temp2.MaterialCode"; + + + + + _sql = string.Format(_sql, getcnumber); + + var _query = DbConnection.Query(_sql, null, null, true, 1200, null); + + var _ls = _query.ToList(); + + return _ls; + } + + + public virtual List GetWmsSearchWithCodeReportList1(string CNumber, string materialCode) + { + + if (string.IsNullOrEmpty(CNumber)) + { + throw new BusinessException("001", "通用代码号不能为空!"); + } + string getcnumber = ""; + var _org_cnumbersList = CNumber.Split(new char[] { '\n' }).Distinct().ToList(); + var _cnumbersList = _org_cnumbersList[0].Replace("\\n", ",").TrimEnd(',').Split(','); + if (_cnumbersList.Count() == 1) + { + getcnumber = "'" + _org_cnumbersList[0].Replace("\\n", "") + "'"; + } + else + { + foreach (var cnumber in _cnumbersList) + { + getcnumber += "'" + cnumber.ToString().Trim() + "'" + ","; + } + getcnumber = getcnumber.TrimEnd(','); } var _sql = "SELECT\n" + " ROW_NUMBER ( ) OVER ( ORDER BY Type DESC ) 行号 ,\n" + @@ -1269,7 +1408,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report - _sql = string.Format(_sql, getcnumber.TrimEnd(',')); + _sql = string.Format(_sql, getcnumber); var _query = DbConnection.Query(_sql, null, null, true, 1200, null);