Administrator 3 years ago
parent
commit
c345bbb965
  1. 16
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSCusomerKanbanAppService.cs
  2. 21
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs
  3. 25
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/KanbanUnSettledDapperRepository.cs
  4. 21
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs
  5. 4
      src/Modules/SettleAccount/src/SettleAccount.HttpApi/BlobFileController.cs
  6. 72
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettledSumService.cs

16
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSCusomerKanbanAppService.cs

@ -467,14 +467,14 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
}
var filteResult = result.Where(p =>!string.IsNullOrEmpty(p.Kanban));//过滤掉看板号为空的数据
var filteResult = result.Where(p =>!string.IsNullOrEmpty(p.SapMaterialCode));//过滤掉物料号为空的数据
//检验2:导入模板中的结算数据是否为0
foreach (var itm in filteResult)
{
if (itm.Qty == 0)
{
checkList.Add(new ErrorExportDto(version, "自定义出库单导入", string.Empty, string.Empty, string.Empty, string.Empty, string.Format("导入模板中看板号{0}的结算数量为0,影响出库请检查!", itm.Kanban), string.Empty));
checkList.Add(new ErrorExportDto(version, "自定义出库单导入", string.Empty, string.Empty, string.Empty, string.Empty, string.Format("导入模板中物料号{0}的结算数量为0,影响出库请检查!", itm.SapMaterialCode), string.Empty));
}
}
@ -509,8 +509,16 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
_lsCopy.Add(_detail);
}
_lst.AddRange(_lsCopy.ToArray());
//看板编号为空,加个默认值
foreach (var itm in _lst)
{
if (string.IsNullOrEmpty(itm.Kanban))
{
itm.Kanban = "WMSDBoardNum";
}
}
//检验3:导入模板中看板号+物料号,不能重复
//检验3:导入模板中物料号,不能重复
var _isRepeatOfReportList = from arc in _lst
group arc by new { arc.Kanban, arc.SapMaterialCode, arc.Version }
into g
@ -518,7 +526,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
select g;
foreach (var itm in _isRepeatOfReportList)
{
checkList.Add(new ErrorExportDto(version, "自定义出库单", string.Empty, string.Empty, string.Empty, string.Empty, string.Format("导入模板中看板号{0}组合物料号{1}有重复,请检查!", itm.Key.Kanban, itm.Key.SapMaterialCode), string.Empty));
checkList.Add(new ErrorExportDto(version, "自定义出库单", string.Empty, string.Empty, string.Empty, string.Empty, string.Format("导入模板中物料号{0}有重复,请检查!", itm.Key.SapMaterialCode), string.Empty));
}
if (checkList.Count > 0)
{

21
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs

@ -673,6 +673,17 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
condition += string.Format(" and a.LastModificationTime<='{0}' ", end);
}
string conditionDate = "";
if (!string.IsNullOrEmpty(begin))
{
conditionDate += string.Format(" and LastModificationTime>='{0}' ", begin);
}
if (!string.IsNullOrEmpty(end))
{
conditionDate += string.Format(" and LastModificationTime<='{0}' ", end);
}
string contion = string.Empty;
//选中,是否过滤掉当期结算数据
if (iscontionversion == "0")
@ -724,7 +735,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" 0 AS 结算金额 ,\n" +
" C.EstimateTypeDesc AS 物料组 \n" +
" FROM\n" +
" ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban GROUP BY kanban, MaterialCode ) AS a\n" +
" ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban WHERE 1=1 {1} GROUP BY kanban, MaterialCode ) AS a\n" +
" LEFT OUTER JOIN ( SELECT SUM ( Qty ) Qty, HQHKanBan, MaterialCode FROM Set_HQ_H_Platform {0} GROUP BY HQHKanBan, MaterialCode ) AS b ON a.Kanban = b.HQHKanBan \n" +
" AND a.MaterialCode = b.MaterialCode\n" +
" LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
@ -733,7 +744,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" AND b.MaterialCode IS NULL \n" +
" ) AS temp1\n" +
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode\n" +
" LEFT JOIN (select * from set_backQty WHERE Version='{1}') tt ON temp1.Sap编码 = tt.MaterialCode \n" +
" LEFT JOIN set_backQty tt ON temp1.Sap编码 = tt.MaterialCode \n" +
" AND temp1.订货看板编号 = tt.Code \n" +
" ) UNION1 UNION ALL\n" +
"SELECT\n" +
@ -776,7 +787,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" isnull( b.Qty, 0 ) * isnull( b.Price, 0 ) AS 结算金额 ,\n" +
" C.EstimateTypeDesc AS 物料组 \n" +
" FROM\n" +
" ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban GROUP BY kanban, MaterialCode ) AS a\n" +
" ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban WHERE 1=1 {1} GROUP BY kanban, MaterialCode ) AS a\n" +
" INNER JOIN ( SELECT SUM ( Qty ) Qty, HQHKanBan, MaterialCode,Price FROM Set_HQ_H_Platform {0} GROUP BY HQHKanBan, MaterialCode,Price ) AS b ON a.Kanban = b.HQHKanBan \n" +
" AND a.MaterialCode = b.MaterialCode\n" +
" LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
@ -784,13 +795,13 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" a.Qty> b.Qty \n" +
" ) AS temp1\n" +
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode\n" +
" LEFT JOIN (select * from set_backQty WHERE Version='{1}') tt ON temp1.Sap编码 = tt.MaterialCode \n" +
" LEFT JOIN set_backQty tt ON temp1.Sap编码 = tt.MaterialCode \n" +
" AND temp1.订货看板编号 = tt.Code \n" +
" ) UNION2";
//var _sql = string.Format(str, contion, condition,version);
var _sql = string.Format(str, contion, version);
var _sql = string.Format(str, contion, conditionDate);

25
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/KanbanUnSettledDapperRepository.cs

@ -165,6 +165,17 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
str += string.Format(" and a.WMSActualGoodsDate<='{0}' ", endtime);
}
string strDate = string.Empty;
//str += " where 1=1 ";
if (!string.IsNullOrEmpty(begintime) && Convert.ToDateTime(begintime) != DateTime.MinValue)
{
strDate += string.Format(" and WMSActualGoodsDate >='{0}' ", begintime);
}
if (!string.IsNullOrEmpty(endtime) && Convert.ToDateTime(endtime) != DateTime.MinValue)
{
strDate += string.Format(" and WMSActualGoodsDate<='{0}' ", endtime);
}
string sql = "SELECT\n" +
" * \n" +
"FROM\n" +
@ -188,11 +199,11 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" isnull( tt.qty, 0 ) BackQty,\n" +
" ( ISNULL( a.WMSDeliveryQty, 0 ) - ISNULL( b.Qty, 0 ) - isnull( tt.qty, 0 ) ) AS DiffQty \n" +
" FROM\n" +
" ( SELECT SUM ( WMSDeliveryQty ) WMSDeliveryQty, MaterialCode, Kanban FROM Set_WMSKanBanSettle GROUP BY MaterialCode, Kanban ) A\n" +
" ( SELECT SUM ( WMSDeliveryQty ) WMSDeliveryQty, MaterialCode, Kanban FROM Set_WMSKanBanSettle WHERE 1=1 {1} GROUP BY MaterialCode, Kanban ) A\n" +
" LEFT JOIN ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_KanBanSettle {0} GROUP BY Kanban, MaterialCode ) B ON A.Kanban = B.Kanban \n" +
" AND A.MaterialCode = B.MaterialCode\n" +
" LEFT JOIN Set_material AS C ON a.MaterialCode = C.CustomerPartCode\n" +
" LEFT JOIN ( SELECT * FROM set_backQty ) AS tt ON a.Kanban = tt.Code \n" +
" LEFT JOIN set_backQty AS tt ON a.Kanban = tt.Code \n" +
" AND a.MaterialCode = tt.MaterialCode \n" +
" WHERE\n" +
" B.Kanban IS NULL \n" +
@ -223,11 +234,11 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" isnull( tt.qty, 0 ) BackQty,\n" +
" ( ISNULL( a.WMSDeliveryQty, 0 ) - ISNULL( b.Qty, 0 ) - isnull( tt.qty, 0 ) ) AS DiffQty \n" +
" FROM\n" +
" ( SELECT SUM ( WMSDeliveryQty ) WMSDeliveryQty, MaterialCode, Kanban FROM Set_WMSKanBanSettle GROUP BY MaterialCode, Kanban ) A\n" +
" ( SELECT SUM ( WMSDeliveryQty ) WMSDeliveryQty, MaterialCode, Kanban FROM Set_WMSKanBanSettle WHERE 1=1 {1} GROUP BY MaterialCode, Kanban ) A\n" +
" INNER JOIN ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_KanBanSettle {0} GROUP BY Kanban, MaterialCode ) B ON A.Kanban = B.Kanban \n" +
" AND A.MaterialCode = B.MaterialCode\n" +
" LEFT JOIN Set_material AS C ON a.MaterialCode = C.CustomerPartCode\n" +
" LEFT JOIN ( SELECT * FROM set_backQty ) AS tt ON a.Kanban = tt.Code \n" +
" LEFT JOIN set_backQty AS tt ON a.Kanban = tt.Code \n" +
" AND a.MaterialCode = tt.MaterialCode \n" +
" WHERE\n" +
" a.WMSDeliveryQty> B.Qty \n" +
@ -237,7 +248,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
sql = string.Format(sql,contion);
sql = string.Format(sql,contion,strDate);
//发运数据中,查出看板号+物料号相同的重复数据
@ -245,7 +256,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" a.WMSDeliveryNote WmsBillNum,\n" +
" t1.MaterialCode MaterialCode,\n" +
" a.Kanban ,\n" +
" A.LastModificationTime WmsDate \n" +
" A.WMSActualGoodsDate WmsDate \n" +
"FROM\n" +
" Set_WMSKanBanSettle A\n" +
" INNER JOIN ( SELECT MaterialCode, Kanban FROM Set_WMSKanBanSettle GROUP BY MaterialCode, Kanban HAVING COUNT ( * ) > 1 ) B ON A.Kanban = B.Kanban \n" +
@ -261,7 +272,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" a.WMSDeliveryNote WmsBillNum,\n" +
" t1.MaterialCode MaterialCode,\n" +
" a.Kanban,\n" +
" A.LastModificationTime WmsDate \n" +
" A.WMSActualGoodsDate WmsDate \n" +
"FROM\n" +
" Set_WMSKanBanSettle A\n" +
" LEFT JOIN ( SELECT MaterialCode, Kanban FROM Set_WMSKanBanSettle GROUP BY MaterialCode, Kanban HAVING COUNT ( * ) > 1 ) B ON A.Kanban = B.Kanban \n" +

21
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs

@ -652,6 +652,17 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
condition += string.Format(" and a.SpareDate<='{0}' ", endtime);
}
string conditionDate = "";
if (!string.IsNullOrEmpty(begintime) && Convert.ToDateTime(begintime) != DateTime.MinValue)
{
conditionDate += string.Format(" and SpareDate>='{0}' ", begintime);
}
if (!string.IsNullOrEmpty(endtime) && Convert.ToDateTime(begintime) != DateTime.MinValue)
{
conditionDate += string.Format(" and SpareDate<='{0}' ", endtime);
}
string sqlString = "SELECT\n" +
" * \n" +
"FROM\n" +
@ -694,7 +705,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" Set_WMSSparePart \n" +
" WHERE\n" +
" PurchaseOrderNo IS NOT NULL \n" +
" AND PurchaseOrderNo != '' \n" +
" AND PurchaseOrderNo != '' {0} \n" +
" GROUP BY\n" +
" PurchaseOrderNo,\n" +
" MaterialCode \n" +
@ -706,7 +717,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" b.PurchaseOrderNo IS NULL \n" +
" AND b.MaterialCode IS NULL \n" +
" ) AS temp1\n" +
" LEFT JOIN ( SELECT * FROM set_backQty WHERE Version = '{0}' ) temp3 ON temp1.采购订单号 = temp3.Code \n" +
" LEFT JOIN ( SELECT * FROM set_backQty ) temp3 ON temp1.采购订单号 = temp3.Code \n" +
" AND temp1.SAP编码= temp3.MaterialCode\n" +
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode \n" +
" ) unint1 UNION ALL\n" +
@ -752,7 +763,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" Set_WMSSparePart \n" +
" WHERE\n" +
" PurchaseOrderNo IS NOT NULL \n" +
" AND PurchaseOrderNo != '' \n" +
" AND PurchaseOrderNo != '' {0} \n" +
" GROUP BY\n" +
" PurchaseOrderNo,\n" +
" MaterialCode \n" +
@ -763,7 +774,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" WHERE\n" +
" a.ReceiptQty> b.ReceiptQty \n" +
" ) AS temp1\n" +
" LEFT JOIN ( SELECT * FROM set_backQty WHERE Version = '{0}' ) temp3 ON temp1.采购订单号 = temp3.Code \n" +
" LEFT JOIN ( SELECT * FROM set_backQty ) temp3 ON temp1.采购订单号 = temp3.Code \n" +
" AND temp1.SAP编码= temp3.MaterialCode\n" +
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode \n" +
" ) unint2";
@ -771,7 +782,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
string _sql = string.Format(sqlString, version);
string _sql = string.Format(sqlString, conditionDate);

4
src/Modules/SettleAccount/src/SettleAccount.HttpApi/BlobFileController.cs

@ -90,7 +90,7 @@ namespace Win.Sfs.SettleAccount
/// </summary>
/// <returns></returns>
[HttpPost]
[Route("saveHQKBExcelTemplate")]
[Route("saveOneTimeExcelTemplate")]
public async Task<string> SaveOneTimeExcelImportTemplate()
{
string fileName = "一次性寄售销售出库单导入模板.xlsx";
@ -108,7 +108,7 @@ namespace Win.Sfs.SettleAccount
}
/// <summary>
/// 一次性销售出库单导入模板
/// 大众备件无单号出库单导入模板
/// </summary>
/// <returns></returns>
[HttpPost]

72
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettledSumService.cs

@ -51,13 +51,15 @@ namespace SettleAccount.Job.Services.Report
private readonly WmsDapperRepository _wmsDapper;
private readonly OutputService _outputService;
private readonly ErpPartDapperRepository _erpDapper;
private readonly SettleSparePartDapperReportRepository _sparepartdapper;
public UnSettledSumService(
HQHSettledDetailDapperRepository hqkanbanDapper,
KanbanUnSettledDapperRepository kanbanDapper,
UnSettledDetailDapperRepository dapper,
OutputService outputService,
ErpPartDapperRepository erpDapper,
WmsDapperRepository wmsDapper
WmsDapperRepository wmsDapper,
SettleSparePartDapperReportRepository sparepartdapper
)
{
_wmsDapper = wmsDapper;
@ -66,6 +68,7 @@ namespace SettleAccount.Job.Services.Report
_dapper = dapper;
_outputService = outputService;
_erpDapper = erpDapper;
_sparepartdapper = sparepartdapper;
}
[UnitOfWork(false)]
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> p_list)
@ -167,6 +170,14 @@ namespace SettleAccount.Job.Services.Report
}).ToList();
return _fislist;
}
/// <summary>
/// 大众看板未结数据
/// </summary>
/// <param name="id"></param>
/// <param name="exportName"></param>
/// <param name="p_list"></param>
/// <returns></returns>
public List<UnSettledSum> GetKanbanSum(Guid id, List<string> exportName, List<CustomCondition> p_list)
{
var _filename = exportName.FirstOrDefault();
@ -241,7 +252,13 @@ namespace SettleAccount.Job.Services.Report
}
/// <summary>
/// 红旗看板未结明细
/// </summary>
/// <param name="id"></param>
/// <param name="exportName"></param>
/// <param name="p_list"></param>
/// <returns></returns>
public List<UnSettledSum> GetHQKanbanSum(Guid id, List<string> exportName, List<CustomCondition> p_list)
{
var _filename = exportName.FirstOrDefault();
@ -283,6 +300,55 @@ namespace SettleAccount.Job.Services.Report
}
public List<UnSettledSum> GetSparePartSum(Guid id, List<string> exportName, List<CustomCondition> p_list)
{
var fileName = exportName.FirstOrDefault();
var purchaseOrderNo = p_list.Where(p => p.Name == "PurchaseOrderNo").FirstOrDefault().Value;
var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value;
var sapCode = p_list.Where(p => p.Name == "SAPCode").FirstOrDefault().Value;
var matialCode = p_list.Where(p => p.Name == "MatialCode").FirstOrDefault().Value;
var beginTime = p_list.Where(p => p.Name == "BegingTime").FirstOrDefault().Value;
var endTime = p_list.Where(p => p.Name == "EndTime").FirstOrDefault().Value;
//var iscontionversion = p_list.Where(p => p.Name == "IsContainVersion").FirstOrDefault().Value;
//反向对比,即大众备件未结(有单号),包含有发货有结算并且发货数量大于结算数量的数据也整合到未结中
var _ls = _sparepartdapper.GetReverseWithCodeSettleSparePartReportList(purchaseOrderNo, version, sapCode, matialCode, beginTime, endTime);
if (!string.IsNullOrEmpty(sapCode))
{
var _groupList = sapCode.Split(new char[] { '\n' }).Distinct().ToList();
if (_groupList.Count() > 0)
{
_ls = _ls.Where(p => _groupList.Contains(p.SAP编码)).ToList();
}
}
if (!string.IsNullOrEmpty(purchaseOrderNo))
{
var _groupList = purchaseOrderNo.Split(new char[] { '\n' }).Distinct().ToList();
if (_groupList.Count() > 0)
{
_ls = _ls.Where(p => _groupList.Contains(p.)).ToList();
}
}
var kanbanList = _ls.GroupBy(p => new { p.SAP编码, p., p. })
.Select(p => new UnSettledSum
{
= version,
= p.Key.SAP编码,
= p.Key.,
= p.Key.,
= string.Empty,
SAS未结明细汇总 = p.Sum(p => p.).ToString()
}).ToList();
return kanbanList;
}
@ -293,6 +359,8 @@ namespace SettleAccount.Job.Services.Report
_ls.AddRange(GetFisSum(id, exportName, p_list));
_ls.AddRange(GetHQKanbanSum(id, exportName, p_list));
_ls.AddRange(GetKanbanSum(id, exportName, p_list));
_ls.AddRange(GetSparePartSum(id, exportName, p_list));//大众备件未结
var _lst = _wmsDapper.GetSalesStockSum(version);

Loading…
Cancel
Save