Browse Source

已出库查询更改为post方式

FoShanPG
44673626 3 years ago
parent
commit
db62054351
  1. 35
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsUnSumInterface.cs
  2. 12
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WmsDetailReport.cs
  3. 141
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/WmsOutputSumDapperRepository.cs

35
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsUnSumInterface.cs

@ -27,7 +27,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
/// <summary> /// <summary>
/// 已结算出库查询 /// 已结算出库查询
/// </summary> /// </summary>
//[Authorize(SettleAccountPermissions.WMSJIT.Default)] [Authorize(SettleAccountPermissions.WMSJIT.Default)]
[Route("api/settleaccount/WMSOutputDetailWithCodeReport")] [Route("api/settleaccount/WMSOutputDetailWithCodeReport")]
public class WMSOutputDetailWithCodeReportAppService : public class WMSOutputDetailWithCodeReportAppService :
SettleAccountApplicationBase<WmsDetailWithCodeReport> SettleAccountApplicationBase<WmsDetailWithCodeReport>
@ -61,14 +61,15 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
} }
[HttpGet] [HttpPost]
[Route("Make")] [Route("Make")]
[UnitOfWork(false)] [UnitOfWork(false)]
public async Task<string> ReportMake(string cnumber,string materialCode, DateTime accountDate) public async Task<string> ReportMake(WmsDetailWithCodeDto input)
{ {
//先删除
await _wmsRepository.BatchDeleteAsync(); await _wmsRepository.BatchDeleteAsync();
//有条码的业务(可根据条码/K号/底盘号,查询是否结算过,结算期间) //有条码的业务(可根据条码/K号/底盘号,查询是否结算过,结算期间)
var _ls = _dapper.GetWmsSearchWithCodeReportList(cnumber, materialCode); var _ls = _dapper.GetWmsSearchWithCodeReportList(input.cnumber, input.materialCode);
//var _count = _wmsRepository.Count(p =>p.State > 0); //var _count = _wmsRepository.Count(p =>p.State > 0);
//if (_count > 0) //if (_count > 0)
@ -108,11 +109,20 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
)); ));
} }
} }
//过滤 物料号 //get方法
if (!string.IsNullOrEmpty(materialCode)) //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 = input.materialCode.Split(new char[] { '\n' }).Distinct().ToList();
var _groupList = _org_groupList[0].Replace("\\n", ",").TrimEnd(',');
if (_groupList.Count() > 0) if (_groupList.Count() > 0)
{ {
_lst = _lst.Where(p => _groupList.Contains(p.MaterialCode)).ToList(); _lst = _lst.Where(p => _groupList.Contains(p.MaterialCode)).ToList();
@ -148,12 +158,17 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
return new PagedResultDto<WmsDetailWithCodeReport>(totalCount, entities); return new PagedResultDto<WmsDetailWithCodeReport>(totalCount, entities);
} }
private async Task<long> GetCountAsync(WmsRequestDetailReportDto input) private async Task<long> 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); return await _wmsRepository.GetCountByFilterAsync(GuidGenerator.Create(), input.Filters);
} }
//private async Task<long> 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] [HttpPost]
[Route("ModifyTaskState")] [Route("ModifyTaskState")]

12
src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WmsDetailReport.cs

@ -337,5 +337,17 @@ namespace Win.Sfs.SettleAccount.Entities
[Display(Name = "状态")] [Display(Name = "状态")]
public int State { set; get; } public int State { set; get; }
}
public class WmsDetailWithCodeDto
{
public string cnumber { set; get; }
public string materialCode { set; get; }
} }
} }

141
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/WmsOutputSumDapperRepository.cs

@ -1150,6 +1150,137 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
/// <param name="state"></param> /// <param name="state"></param>
/// <returns></returns> /// <returns></returns>
public virtual List<WmsOutputtSearchWithCode> GetWmsSearchWithCodeReportList(string CNumber, string materialCode) public virtual List<WmsOutputtSearchWithCode> GetWmsSearchWithCodeReportList(string CNumber, string materialCode)
{
if (string.IsNullOrEmpty(CNumber))
{
throw new BusinessException("001", "通用代码号不能为空!");
}
string getcnumber = "";
var _cnumbersList = CNumber.Split(new char[] { '\n' }).Distinct().ToList();
foreach (var cnumber in _cnumbersList)
{
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<WmsOutputtSearchWithCode>(_sql, null, null, true, 1200, null);
var _ls = _query.ToList();
return _ls;
}
public virtual List<WmsOutputtSearchWithCode> GetWmsSearchWithCodeReportList1(string CNumber, string materialCode)
{ {
if (string.IsNullOrEmpty(CNumber)) if (string.IsNullOrEmpty(CNumber))
@ -1159,10 +1290,18 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
string getcnumber = ""; string getcnumber = "";
var _org_cnumbersList = CNumber.Split(new char[] { '\n' }).Distinct().ToList(); var _org_cnumbersList = CNumber.Split(new char[] { '\n' }).Distinct().ToList();
var _cnumbersList = _org_cnumbersList[0].Replace("\\n", ",").TrimEnd(',').Split(','); 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) foreach (var cnumber in _cnumbersList)
{ {
getcnumber += "'" + cnumber.ToString().Trim() + "'" + ","; getcnumber += "'" + cnumber.ToString().Trim() + "'" + ",";
} }
getcnumber = getcnumber.TrimEnd(',');
}
var _sql = "SELECT\n" + var _sql = "SELECT\n" +
" ROW_NUMBER ( ) OVER ( ORDER BY Type DESC ) 行号 ,\n" + " ROW_NUMBER ( ) OVER ( ORDER BY Type DESC ) 行号 ,\n" +
" temp1.Client 客户,\n" + " temp1.Client 客户,\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<WmsOutputtSearchWithCode>(_sql, null, null, true, 1200, null); var _query = DbConnection.Query<WmsOutputtSearchWithCode>(_sql, null, null, true, 1200, null);

Loading…
Cancel
Save