Browse Source

红旗备件提交

FoShanPG
44673626 3 years ago
parent
commit
eaf6707fbd
  1. 35
      src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs
  2. 11
      src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml
  3. 324
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs
  4. 23
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/KanbanUnSettledDapperRepository.cs
  5. 64
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleKBWithCodeDapperReportRepository.cs
  6. 6
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHSettledDetailDiffExportService.cs
  7. 72
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHSharePartSettledDetailDiffExportService.cs
  8. 135
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHUnSettledDetailDiffExportService.cs
  9. 2
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/KanBanUnSettledExport.cs

35
src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs

@ -653,7 +653,7 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
}
/// <summary>
///红旗H平台核对明细
///红旗工厂核对明细
/// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns>
@ -682,8 +682,39 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
return _taskid;
}
/// <summary>
///红旗工厂未结明细
/// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns>
[HttpPost]
[Route("HQHUnSettledDetailDiffExportService")]
[DisableRequestSizeLimit]
public async Task<string> HQHUnSettledDetailDiffExportServiceMake(
HQKanbanRequestDto input
)
{
List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version });
customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode });
customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = input.Begin });
customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = input.End });
customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode });
customConditionList.Add(new CustomCondition() { Name = "AcceptNo", Value = input.AcceptNo });
customConditionList.Add(new CustomCondition() { Name = "WarehouseDesc", Value = input.WarehouseDesc });
customConditionList.Add(new CustomCondition() { Name = "Kanban", Value = input.Kanban });
customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup });
customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(input.SapCode) ? string.Empty : input.SapCode });
var _taskid = await _service.ExportEnqueueAsync("红旗工厂未结明细", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(HQHSettledDetailDiffExportService), customConditionList, (rs) =>
{
});
return _taskid;
}
/// <summary>
/// 红旗H平台备件结算出库
/// 红旗工厂备件明细
/// </summary>
/// <param name="input"></param>
/// <returns></returns>

11
src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml

@ -4095,14 +4095,21 @@
</member>
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.HQHSettledDetailDiffExportServiceMake(Win.Sfs.SettleAccount.Reports.ReportRequestDto.HQKanbanRequestDto)">
<summary>
红旗H平台核对明细
红旗工厂核对明细
</summary>
<param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.HQHUnSettledDetailDiffExportServiceMake(Win.Sfs.SettleAccount.Reports.ReportRequestDto.HQKanbanRequestDto)">
<summary>
红旗工厂未结明细
</summary>
<param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.HQHSharePartSettledDetailDiffExportServiceMake(Win.Sfs.SettleAccount.Reports.ReportRequestDto.HQKanbanRequestDto)">
<summary>
红旗H平台备件结算出库
红旗工厂备件明细
</summary>
<param name="input"></param>
<returns></returns>

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

@ -319,23 +319,32 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{
var first = _ls.FirstOrDefault(p => p.Kanban == itm.Kanban && p.MaterialCode == itm.MaterialCode);
if (first != null)
{
if (!string.IsNullOrEmpty(itm.WmsDate))
{
itm.WmsDate = DateTime.Parse(itm.WmsDate).ToShortDateString();
}
first.WmsBillNum += "," + itm.WmsBillNum;
first.WmsDate += "," + itm.WmsDate;
}
else
{
if (!string.IsNullOrEmpty(itm.WmsDate))
{
itm.WmsDate = DateTime.Parse(itm.WmsDate).ToShortDateString();
}
_ls.Add(itm);
}
}
foreach (var itm in listCompare1.ToList())
{
if (!string.IsNullOrEmpty(itm.WmsDate))
{
itm.WmsDate = DateTime.Parse(itm.WmsDate).ToShortDateString();
}
_ls.Add(itm);
}
@ -445,7 +454,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" AND a.MaterialCode = b.MaterialCode\n" +
" LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
" WHERE\n" +
" a.Version= '{0}' \n" +
" a.HQHKanBan <>'BJ' AND a.Version= '{0}' \n" +
" ) AS temp1\n" +
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode WHERE temp1.[交货单号] is null ";
var _sql = string.Format(str, version);
@ -455,6 +464,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
return _list;
}
/// <summary>
/// 反向对比,有发货无结算报表
/// </summary>
@ -471,14 +481,14 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
string condition = " ";
//if (!string.IsNullOrEmpty(begin))
//{
// condition += string.Format(" and a.LastModificationTime>='{0}' ", begin);
//}
//if (!string.IsNullOrEmpty(end))
//{
// condition += string.Format(" and a.LastModificationTime<='{0}' ", end);
//}
if (!string.IsNullOrEmpty(begin))
{
condition += string.Format(" and a.LastModificationTime>='{0}' ", begin);
}
if (!string.IsNullOrEmpty(end))
{
condition += string.Format(" and a.LastModificationTime<='{0}' ", end);
}
string str = "SELECT\n" +
" temp1.交货时间,\n" +
@ -525,15 +535,15 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" C.EstimateTypeDesc AS 物料组 \n" +
" FROM\n" +
" Set_HQ_H_Kanban AS a\n" +
" LEFT OUTER JOIN ( SELECT * FROM Set_HQ_H_Platform WHERE HQHKanBan <> 'BJ' AND Version = '{0}' ) AS b ON a.Kanban = b.HQHKanBan \n" +
" LEFT OUTER JOIN ( SELECT * FROM Set_HQ_H_Platform WHERE HQHKanBan <> 'BJ' ) 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" +
" WHERE\n" +
" b.HQHKanBan IS NULL \n" +
" AND b.MaterialCode IS NULL \n" +
" AND b.MaterialCode IS NULL {0} \n" +
" ) AS temp1\n" +
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode";
var _sql = string.Format(str, version, condition);
var _sql = string.Format(str, condition);
var _query = DbConnection.Query<HQHSettledDetailDiff>(_sql, null, null, true, 1200, null);
_list = _query.ToList();
@ -542,6 +552,128 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
}
///// <summary>
///// 反向对比,有发货无结算报表
///// </summary>
///// <param name="version"></param>
///// <param name="materialCode"></param>
///// <param name="begin"></param>
///// <param name="end"></param>
///// <param name="materialGroup"></param>
///// <returns></returns>
//public virtual List<HQHSettledDetailDiff> GetReverseSettledDetailDiffReportList(string version, string materialCode, string begin, string end, string materialGroup)
//{
// List<HQHSettledDetailDiff> _list = new List<HQHSettledDetailDiff>();
// string condition = " ";
// string str = "SELECT\n" +
// " isnull( temp1.交货单号, '' ) 交货单号,\n" +
// " temp1.交货时间,\n" +
// " isnull( temp1.手工或自动, '' ) 手工或自动,\n" +
// " temp1.[工厂],\n" +
// " temp1.收货仓库,\n" +
// " temp1.收货仓库描述,\n" +
// " temp1.订货看板编号,\n" +
// " temp1.订货零件号,\n" +
// " temp1.验收单日期,\n" +
// " temp1.Sap编码,\n" +
// " temp1.看板编号,\n" +
// " temp1.物料组,\n" +
// " temp1.零件中文名称,\n" +
// " temp1.发货数量,\n" +
// " temp1.发货状态,\n" +
// " temp1.结算验收单号,\n" +
// " temp1.结算数量,\n" +
// " temp3.Price AS 结算单价,\n" +
// " ( temp1.[结算数量] * ISNULL( temp3.Price, 0 ) ) AS 结算金额,\n" +
// " isnull( TEMP2.Price, 0 ) AS 发货定价,\n" +
// " isnull( temp1.发货数量, 0 ) * isnull( TEMP2.Price, 0 ) AS 发货总金额,\n" +
// " ( isnull( temp1.发货数量, 0 ) - isnull( temp1.[结算数量], 0 ) ) AS 数量差异,\n" +
// " ISNULL( temp3.Price, 0 ) - ISNULL( TEMP2.Price, 0 ) AS 单价差异,\n" +
// " ( ISNULL( temp3.Price, 0 ) - ISNULL( TEMP2.Price, 0 ) ) * temp1.结算数量 AS 差异总金额 \n" +
// "FROM\n" +
// " (\n" +
// " SELECT\n" +
// " '' AS 交货单号,\n" +
// " NULL AS 交货时间,\n" +
// " '' AS 手工或自动,\n" +
// " b.StorageLocation AS 收货仓库,\n" +
// " b.StorageLocationDesc AS 收货仓库描述,\n" +
// " a.Kanban AS 订货看板编号,\n" +
// " a.MaterialCode AS 订货零件号,\n" +
// " c.MaterialCode Sap编码,\n" +
// " a.MaterialCode 结算物料代码,\n" +
// " c.MaterialDesc AS 零件中文名称,\n" +
// " isnull( a.Qty, 0 ) AS 发货数量,\n" +
// " 0 AS 发货状态,\n" +
// " '' AS 结算验收单号,\n" +
// " isnull( b.Qty, 0 ) AS 结算数量,\n" +
// " C.EstimateTypeDesc AS 物料组,\n" +
// " b.Factory AS 工厂,\n" +
// " '' AS 看板编号,\n" +
// " '' AS 验收单日期 \n" +
// " FROM\n" +
// " (\n" +
// " SELECT SUM ( Qty ) AS Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban GROUP BY Kanban, MaterialCode\n" +
// " ) AS a\n" +
// " LEFT JOIN \n" +
// " ( \n" +
// " SELECT SUM\n" +
// " ( Qty ) AS Qty,\n" +
// " HQHKanBan,\n" +
// " MaterialCode,\n" +
// " Version,\n" +
// " StorageLocation,\n" +
// " StorageLocationDesc,\n" +
// " Factory \n" +
// " FROM\n" +
// " Set_HQ_H_Platform WHERE HQHKanBan <> 'BJ'\n" +
// " GROUP BY\n" +
// " HQHKanBan,\n" +
// " MaterialCode,\n" +
// " Version,\n" +
// " StorageLocation,\n" +
// " StorageLocationDesc,\n" +
// " Factory\n" +
// " \n" +
// " ) AS b \n" +
// " 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" +
// " WHERE\n" +
// " b.HQHKanBan is NULL \n" +
// " AND b.MaterialCode is NULL \n" +
// " ) AS temp1\n" +
// " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode\n" +
// " LEFT JOIN (\n" +
// " SELECT SUM\n" +
// " ( Amt ) / SUM ( Qty ) AS Price,\n" +
// " HQHKanBan,\n" +
// " MaterialCode,\n" +
// " Version \n" +
// " FROM\n" +
// " Set_HQ_H_Platform \n" +
// " WHERE\n" +
// " HQHKanBan <> 'BJ' \n" +
// " GROUP BY\n" +
// " HQHKanBan,\n" +
// " MaterialCode,\n" +
// " Version \n" +
// " ) AS TEMP3 ON temp1.[结算物料代码] = TEMP3.MaterialCode \n" +
// " AND temp1.订货看板编号 = TEMP3.HQHKanBan";
// var _sql = string.Format(str, version, condition);
// var _query = DbConnection.Query<HQHSettledDetailDiff>(_sql, null, null, true, 1200, null);
// return _list;
//}
public virtual List<HQHSettleQtyDiff> GetDiffQtyList(string version)
{
List<HQHSettleQtyDiff> _list = new List<HQHSettleQtyDiff>();
@ -576,25 +708,26 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
string condition = " ";
if (!string.IsNullOrEmpty(begin))
{
condition += string.Format(" and a.LastModificationTime>='{0}' ", begin);
}
if (!string.IsNullOrEmpty(end))
{
condition += string.Format(" and a.LastModificationTime<='{0}' ", end);
}
//if (!string.IsNullOrEmpty(begin))
//{
// condition += string.Format(" and a.LastModificationTime>='{0}' ", begin);
//}
//if (!string.IsNullOrEmpty(end))
//{
// condition += string.Format(" and a.LastModificationTime<='{0}' ", end);
//}
string str =
"SELECT\n" +
string str = "SELECT\n" +
" temp1.*,\n" +
" isnull( temp2.Price, 0 ) 销售单价,(\n" +
" isnull( temp1.结算单价, 0 )- isnull( temp2.Price, 0 )) 价格差异 \n" +
" isnull( temp2.Price, 0 ) 销售单价,\n" +
" ( isnull( temp1.结算单价, 0 ) - isnull( temp2.Price, 0 ) ) 价格差异,\n" +
" ( isnull( temp1.结算单价, 0 ) - isnull( temp2.Price, 0 ) ) * temp1.结算数量 AS 差异总金额 \n" +
"FROM\n" +
" (\n" +
" SELECT\n" +
" A.Price 结算单价,\n" +
" A.Qty 结算数量,\n" +
" ISNULL( A.Price, 0 ) 结算单价,\n" +
" ISNULL( A.Qty, 0 ) 结算数量,\n" +
" ISNULL( A.Price, 0 ) * ISNULL( A.Qty, 0 ) 结算金额,\n" +
" A.MaterialCode 结算物料号,\n" +
" A.StorageLocation 收货仓库,\n" +
" A.StorageLocationDesc 收货仓库描述,\n" +
@ -614,7 +747,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" Set_HQ_H_Platform \n" +
" WHERE\n" +
" version = '{0}' \n" +
" AND HQHKanBan = 'BJ' {1}\n" +
" AND HQHKanBan = 'BJ' \n" +
" GROUP BY\n" +
" MaterialCode,\n" +
" StorageLocation,\n" +
@ -623,17 +756,99 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" ) A\n" +
" LEFT JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
" ) temp1\n" +
" LEFT OUTER JOIN (\n" +
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS temp2 ON temp1.Sap编码 = temp2.MaterialCode";
// var _sql = string.Format(str, version, condition);
var _sql = string.Format(str, version);
var _query = DbConnection.Query<HQHSharePartSettledDetailDiff>(_sql, null, null, true, 1200, null);
_list = _query.ToList();
return _list;
}
/// <summary>
/// 求和汇总,厂内零件号+数量
/// </summary>
/// <param name="version"></param>
/// <param name="materialCode"></param>
/// <param name="begin"></param>
/// <param name="end"></param>
/// <param name="materialGroup"></param>
/// <returns></returns>
public virtual List<HQHSharePartSettledDetailDiff> GetSharePartSumSettledDetailDiffReportList(string version, string materialCode, string begin, string end, string materialGroup)
{
List<HQHSharePartSettledDetailDiff> _list = new List<HQHSharePartSettledDetailDiff>();
//string condition = " where 1=1 ";
string condition = " ";
//if (!string.IsNullOrEmpty(begin))
//{
// condition += string.Format(" and a.LastModificationTime>='{0}' ", begin);
//}
//if (!string.IsNullOrEmpty(end))
//{
// condition += string.Format(" and a.LastModificationTime<='{0}' ", end);
//}
string str = "SELECT\n" +
" temp1.*,\n" +
" isnull( temp2.Price, 0 ) 销售单价,\n" +
" isnull( temp3.Price, 0 ) 结算单价,\n" +
" ( isnull( temp3.Price, 0 ) - isnull( temp2.Price, 0 ) ) 价格差异,\n" +
" (temp3.Price * temp1.结算数量) 结算金额,\n" +
" ( isnull( temp3.Price, 0 ) - isnull( temp2.Price, 0 ) ) * temp1.结算数量 AS 差异总金额 \n" +
"FROM\n" +
" (\n" +
" SELECT\n" +
" Price,\n" +
" MaterialCode \n" +
" isnull( A.Qty, 0 ) 结算数量,\n" +
" A.MaterialCode 结算物料号,\n" +
" A.StorageLocation 收货仓库,\n" +
" A.StorageLocationDesc 收货仓库描述,\n" +
" C.EstimateTypeDesc 物料组,\n" +
" C.MaterialCode Sap编码,\n" +
" C.MaterialDesc 物料描述,\n" +
" 0 寄销库数量 \n" +
" FROM\n" +
" Set_PriceList \n" +
" WHERE\n" +
" (\n" +
" Version = ( SELECT MAX( Version ) AS Expr1 FROM Set_PriceList ))) AS temp2 ON temp1.Sap编码 = temp2.MaterialCode";
;
var _sql = string.Format(str, version, condition);
" SELECT SUM\n" +
" ( Qty ) Qty,\n" +
" MaterialCode,\n" +
" StorageLocation,\n" +
" StorageLocationDesc \n" +
" FROM\n" +
" Set_HQ_H_Platform \n" +
" WHERE\n" +
" version = '{0}' \n" +
" AND HQHKanBan = 'BJ' \n" +
" GROUP BY\n" +
" MaterialCode,\n" +
" StorageLocation,\n" +
" StorageLocationDesc \n" +
" ) A\n" +
" LEFT JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
" ) temp1\n" +
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS temp2 ON temp1.Sap编码 = temp2.MaterialCode\n" +
" LEFT JOIN (\n" +
" SELECT SUM\n" +
" ( Amt ) / SUM ( Qty ) AS Price,\n" +
" HQHKanBan,\n" +
" MaterialCode,\n" +
" Version \n" +
" FROM\n" +
" Set_HQ_H_Platform \n" +
" WHERE\n" +
" HQHKanBan = 'BJ' \n" +
" AND Version = '{0}' \n" +
" GROUP BY\n" +
" HQHKanBan,\n" +
" MaterialCode,\n" +
" Version \n" +
" ) AS TEMP3 ON temp1.[结算物料号] = temp3.MaterialCode";
// var _sql = string.Format(str, version, condition);
var _sql = string.Format(str, version);
var _query = DbConnection.Query<HQHSharePartSettledDetailDiff>(_sql, null, null, true, 1200, null);
_list = _query.ToList();
@ -641,11 +856,35 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
}
}
public class HQHSharePartSettledDetailDiff
{
public HQHSharePartSettledDetailDiff()
{
}
public HQHSharePartSettledDetailDiff(string sapMaterialCode, string materialCode, string materialDesc,decimal price,
string storageLocation,string storageLocationDesc,decimal selprice,decimal diffprice,decimal sumprice,decimal settleprice, decimal qty,
decimal sockQty)
{
Sap编码 = sapMaterialCode;
= materialDesc;
= materialCode;
= sockQty;
= price;
= storageLocation;
= storageLocationDesc;
= selprice;
= diffprice;
= sumprice;
= qty;
= settleprice;
}
[ExporterHeader(DisplayName = "收货仓库")]
public string { set; get; }
[ExporterHeader(DisplayName = "收货仓库描述")]
@ -660,6 +899,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
public decimal { set; get; }
[ExporterHeader(DisplayName = "结算单价")]
public decimal { set; get; }
[ExporterHeader(DisplayName = "销售单价")]
public decimal { set; get; }
[ExporterHeader(DisplayName = "结算金额")]
public decimal { set; get; }
[ExporterHeader(DisplayName = "Sap编码")]
@ -667,6 +908,12 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
[ExporterHeader(DisplayName = "物料组(车型)")]
public string { set; get; }
[ExporterHeader(DisplayName = "差异总金额")]
public decimal { set; get; }
[ExporterHeader(DisplayName = "价格差异")]
public decimal { set; get; }
[ExporterHeader(DisplayName = "寄销库数量")]
public decimal { set; get; }
@ -707,6 +954,11 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
[ExporterHeader(DisplayName = "结算单价")]
public decimal { set; get; }
[ExporterHeader(DisplayName = "结算金额")]
public decimal { set; get; }
public decimal { set; get; }
[ExporterHeader(DisplayName = "发货定价")]
public decimal { set; get; }

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

@ -78,7 +78,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
[ExporterHeader(DisplayName = "结算数量")]
public decimal SettleQty { set; get; }
[ExporterHeader(DisplayName = "发货数量")]
public decimal Qty { set; get; }
public decimal WMSDeliveryQty { set; get; }
[ExporterHeader(DisplayName = "量差")]
public decimal DiffQty { set; get; }
[ExporterHeader(DisplayName = "单价")]
@ -145,32 +145,37 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" (\n" +
" SELECT\n" +
" a.WMSDeliveryNote WmsBillNum,\n" +
" a.WMSActualGoodsDate BeginDate,\n" +
" CONVERT ( VARCHAR ( 100 ), a.WMSActualGoodsDate, 23 ) BeginDate,\n" +
" a.Kanban,\n" +
" C.MaterialCode SapCode,\n" +
" C.MaterialDesc,\n" +
" C.CustomerPartCode,\n" +
" C.EstimateTypeDesc MaterialGroup,\n" +
" ISNULL( B.Qty, 0 ) SettleQty,\n" +
" a.WMSDeliveryQty,\n" +
" (\n" +
" a.WMSDeliveryQty - ISNULL( b.Qty, 0 )) AS DiffQty \n" +
" ISNULL( a.WMSDeliveryQty, 0 ) WMSDeliveryQty,\n" +
" ( ISNULL( a.WMSDeliveryQty, 0 ) - ISNULL( b.Qty, 0 ) ) AS DiffQty \n" +
" FROM\n" +
" Set_WMSKanBanSettle A\n" +
" LEFT JOIN ( SELECT * FROM Set_KanBanSettle ) B ON A.Kanban = B.Kanban \n" +
" AND A.MaterialCode = B.MaterialCode\n" +
" LEFT JOIN Set_material AS C ON a.MaterialCode = C.CustomerPartCode {0}\n" +
" LEFT JOIN Set_material AS C ON a.MaterialCode = C.CustomerPartCode \n" +
" WHERE\n" +
" B.Kanban IS NULL \n" +
" AND B.MaterialCode IS NULL {0}\n" +
" ) TEMP1\n" +
" LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) TEMP2 ON TEMP1.SapCode = TEMP2.MaterialCode";
string str = string.Empty;
str += " where 1=1 ";
//str += " where 1=1 ";
if (!string.IsNullOrEmpty(begintime))
{
str += string.Format(" and WMSActualGoodsDate >='{0}' ", begintime);
str += string.Format(" and a.WMSActualGoodsDate >='{0}' ", begintime);
}
if (string.IsNullOrEmpty(endtime))
{
str += string.Format(" and WMSActualGoodsDate<='{0}' ", endtime);
str += string.Format(" and a.WMSActualGoodsDate<='{0}' ", endtime);
}
sql = string.Format(sql, str);
var _query = DbConnection.Query<KanbanUnSettled>(sql, null, null, true, 1200, null);

64
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleKBWithCodeDapperReportRepository.cs

@ -31,47 +31,18 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
public virtual List<SettleKBWithCode> GetSettleKBWithCodeReportList(string kanBan, string version, string sapMaterialCode,
string customerPartCode,string estimateTypeDesc, string begintime, string endtime)
{
//string sqlString = "SELECT\n" +
//" * ,\n" +
//" ISNULL( Price * WMSDeliveryQty, 0 ) AS Amount,--金额\n" +
//" ISNULL( Price * Qty, 0 ) AS SettlePrice,--结算金额\n" +
//" ( Price - InvoicePrice ) AS InvoiceDiffPrice,--单价差异\n" +
//" ISNULL( Price * Qty - InvoiceMoney, 0 ) AS SumDiffMoney --总金额差异\n" +
//" \n" +
//"FROM\n" +
//" (\n" +
//" SELECT\n" +
//" row_number() over(order by b.EstimateTypeDesc) as RowId ,\n" +
//" c.WMSDeliveryNote,--交货单号\n" +
//" CONVERT ( VARCHAR ( 100 ), c.WMSActualGoodsDate, 23 ) AS WMSActualGoodsDate,--实际发货日期年-月-日\n" +
//" a.Kanban,--条码号\n" +
//" b.MaterialCode SapMaterialCode,--厂内物料号\n" +
//" b.MaterialDesc,--物料描述\n" +
//" b.CustomerPartCode,--客户物料\n" +
//" b.EstimateTypeDesc,--物料组(车型)\n" +
//" c.WMSDeliveryQty,--交货数量\n" +
//" a.Qty AS SettleNumber,--结算数量\n" +
//" a.SettleDate,--结算日期\n" +
//" a.Qty,--用于计算\n" +
//" ( a.Qty- c.WMSDeliveryQty ) AS SettleWMSDiffQty,--结算与发货差异\n" +
//" 0 AS SettleInvoiceDiffQty,--结算与发货差异\n" +
//" a.Qty AS InvoiceDiffQty,--开票数量,默认0,后续拿算法动态算\n" +
//" d.InvoicePrice,--开票单价\n" +
//" 0 AS InvoiceMoney,--开票金额\n" +
//" '' DeliveryOrderNo --出库单号\n" +
//" \n" +
//" FROM\n" +
//" Set_KanBanSettle AS a\n" +
//" LEFT JOIN Set_material AS b ON a.MaterialCode= b.CustomerPartCode\n" +
//" LEFT JOIN Set_WMSKanBanSettle c ON a.Kanban= c.Kanban \n" +
//" AND a.MaterialCode= c.MaterialCode\n" +
//" LEFT JOIN ( SELECT SUM ( amt ) / SUM ( Qty ) InvoicePrice, MaterialCode FROM set_invoice WHERE version = '{0}' GROUP BY materialcode ) d ON a.MaterialCode= d.MaterialCode where a.VERSION='{0}'\n" +
//" ) TEMP1\n" +
//" LEFT JOIN ( SELECT Price, --定价\n" +
//" MaterialCode --厂内物料号\n" +
//" FROM Set_PriceList WHERE version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) TEMP2 ON TEMP1.SapMaterialCode= TEMP2.MaterialCode \n" +
//"WHERE 1=1 ";
string condition = " ";
if (!string.IsNullOrEmpty(begintime) && Convert.ToDateTime(begintime) != DateTime.MinValue)
{
condition += string.Format(" and c.WMSActualGoodsDate>='{0}' ", begintime);
}
if (!string.IsNullOrEmpty(endtime) && Convert.ToDateTime(begintime) != DateTime.MinValue)
{
condition += string.Format(" and c.WMSActualGoodsDate<='{0}' ", endtime);
}
string sqlString = "SELECT\n" +
" * ,\n" +
" ISNULL( Price * Qty, 0 ) AS InvoiceMoney,--开票金额\n" +
@ -93,11 +64,11 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" b.CustomerPartCode,--客户物料\n" +
" b.EstimateTypeDesc,--物料组(车型)\n" +
" c.WMSDeliveryQty,--交货数量\n" +
" a.Qty AS SettleNumber,--结算数量\n" +
" ISNULL( a.Qty, 0 ) AS SettleNumber,--结算数量\n" +
" a.SettleDate,--结算日期\n" +
" a.Qty,--用于计算\n" +
" ( a.Qty- c.WMSDeliveryQty ) AS SettleWMSDiffQty,--结算与发货差异\n" +
" 0 AS SettleInvoiceDiffQty,--结算与发货差异\n" +
" ISNULL( a.Qty, 0 ) AS Qty,--用于计算\n" +
" ( ISNULL( a.Qty, 0 ) - ISNULL( c.WMSDeliveryQty, 0 ) ) AS SettleWMSDiffQty,--结算与发货差异\n" +
" 0 AS SettleInvoiceDiffQty,--结算与开票差异\n" +
" ISNULL( a.Qty, 0 ) AS InvoiceDiffQty,--开票数量,默认0,后续拿算法动态算\n" +
" ISNULL( d.InvoicePrice, 0 ) InvoicePrice --开票单价\n" +
" \n" +
@ -108,7 +79,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" AND a.MaterialCode= c.MaterialCode\n" +
" LEFT JOIN ( SELECT SUM ( amt ) / SUM ( Qty ) InvoicePrice, MaterialCode FROM set_invoice WHERE version = '{0}' GROUP BY materialcode ) d ON a.MaterialCode= d.MaterialCode \n" +
" WHERE\n" +
" a.VERSION= '{0}' \n" +
" a.VERSION= '{0}' {1} \n" +
" ) TEMP1\n" +
" LEFT JOIN ( SELECT Price, --定价\n" +
" MaterialCode --厂内物料号\n" +
@ -116,7 +87,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
"WHERE\n" +
" 1 =1";
string addwhere = string.Empty;
string addSqlStr = string.Format(sqlString, version);
string addSqlStr = string.Format(sqlString, version, condition);
//if (!string.IsNullOrEmpty(kanBan))
//{
// addwhere += string.Format(" AND Kanban LIKE '{0}%' ", kanBan);

6
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHSettledDetailDiffExportService.cs

@ -62,7 +62,7 @@ namespace SettleAccount.Job.Services.Report
//有结算无发货报表
var _lsnoSettle = _dapperRepository.GetNOInvoiceSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup);
//反向对比,有发货无结算
//反向对比,有发货无结算,单独拿出去,财务要求
var _reversels = _dapperRepository.GetReverseSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup);
@ -134,8 +134,8 @@ namespace SettleAccount.Job.Services.Report
var result = _exporter.Append(_ls.ToList(), "红旗工厂核对明细")
.SeparateBySheet()
.Append(_lsnoSettle.ToList(), "有结算无发货对比")
.SeparateBySheet()
.Append(_reversels.ToList(), "有发货无结算对比")
//.SeparateBySheet()
//.Append(_reversels.ToList(), "有发货无结算对比")
.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();
_fileContainer.SaveAsync(_filename, result.Result, true);

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

@ -1,11 +1,15 @@
using System;
using Magicodes.ExporterAndImporter.Excel;
using Shouldly;
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.BlobStoring;
using Volo.Abp.DependencyInjection;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report;
namespace SettleAccount.Job.Services.Report
@ -19,18 +23,26 @@ namespace SettleAccount.Job.Services.Report
private readonly OutputService _outputService;
private readonly InputService _inputService;
private readonly WmsDapperRepository _wmsDapper;
private readonly IBlobContainer<MyFileContainer> _fileContainer;
public HQHSharePartSettledDetailDiffExportService(
ErpPartDapperRepository erpdapperRepository,
HQHSettledDetailDapperRepository dapperRepository,
OutputService outputService,
WmsDapperRepository wmsDapper,
InputService inputService
, IBlobContainer<MyFileContainer> fileContainer
)
{
_inputService = inputService;
_outputService = outputService;
_erpdapperRepository = erpdapperRepository;
_wmsDapper = wmsDapper;
_fileContainer = fileContainer;
_dapperRepository = dapperRepository;
}
@ -46,7 +58,33 @@ namespace SettleAccount.Job.Services.Report
var acceptNo = p_list.Where(p => p.Name == "AcceptNo").FirstOrDefault().Value;
var sapCode = p_list.Where(p => p.Name == "SapCode").FirstOrDefault().Value;
var warehouseDesc = p_list.Where(p => p.Name == "WarehouseDesc").FirstOrDefault().Value;
var _ls = _dapperRepository.GetSharePartSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup);
//求和汇总
var _ls_sum = _dapperRepository.GetSharePartSumSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup);
//按照零件号汇总数量,有一列显示寄售库数量
var stockList = _wmsDapper.GetSalesStock();
var queryStockList = from itm in _ls_sum
join itm1 in stockList on itm.Sap编码 equals itm1.SapCode into temp1
from tm1 in temp1.DefaultIfEmpty()
select new HQHSharePartSettledDetailDiff(
itm.Sap编码,
itm.,
itm.,
itm.,
itm.,
itm.,
itm.,
itm.,
itm.,
itm.,
itm.,
tm1 == null ? 0 : tm1.Qty
);
//var _ls = _dapperRepository.GetInvoiceSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup);
//var _lst=_dapperRepository.GetDiffQtyList(version);
@ -86,14 +124,14 @@ namespace SettleAccount.Job.Services.Report
// _ls = _ls.Where(p => _groupList.Contains(p.结算验收单号)).ToList();
// }
//}
if (!string.IsNullOrEmpty(materialGroup))
{
var _groupList = materialGroup.Split(new char[] { ',' }).Distinct().ToList();
if (_groupList.Count() > 0)
{
_ls = _ls.Where(p => _groupList.Contains(p.)).ToList();
}
}
//if (!string.IsNullOrEmpty(materialGroup))
//{
// var _groupList = materialGroup.Split(new char[] { ',' }).Distinct().ToList();
// if (_groupList.Count() > 0)
// {
// _ls = _ls.Where(p => _groupList.Contains(p.物料组)).ToList();
// }
//}
if (!string.IsNullOrEmpty(materialCode))
{
var _groupList = materialCode.Split(new char[] { '\n' }).Distinct().ToList();
@ -110,7 +148,19 @@ namespace SettleAccount.Job.Services.Report
_ls = _ls.Where(p => _groupList.Contains(p.Sap编码)).ToList();
}
}
_outputService.Export<HQHSharePartSettledDetailDiff>(id, _filename, _ls);
//_outputService.Export<HQHSharePartSettledDetailDiff>(id, _filename, _ls);
ExcelExporter _exporter = new ExcelExporter();//导出Excel
var result = _exporter.Append(_ls.ToList(), "红旗工厂备件明细")
.SeparateBySheet()
.Append(queryStockList.ToList(), "备件汇总比对寄售库存")
.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();
_fileContainer.SaveAsync(_filename, result.Result, true);
return id.ToString();
}

135
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHUnSettledDetailDiffExportService.cs

@ -0,0 +1,135 @@
using Magicodes.ExporterAndImporter.Excel;
using Shouldly;
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.BlobStoring;
using Volo.Abp.DependencyInjection;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report;
namespace SettleAccount.Job.Services.Report
{
/// <summary>
/// 红旗工厂未结明细
/// </summary>
public class HQHUnSettledDetailDiffExportService : ITransientDependency, IExportJob
{
private readonly HQHSettledDetailDapperRepository _dapperRepository;
private readonly ErpPartDapperRepository _erpdapperRepository;
private readonly IBlobContainer<MyFileContainer> _fileContainer;
private readonly OutputService _outputService;
private readonly InputService _inputService;
public HQHUnSettledDetailDiffExportService(
ErpPartDapperRepository erpdapperRepository,
HQHSettledDetailDapperRepository dapperRepository,
OutputService outputService,
InputService inputService
, IBlobContainer<MyFileContainer> fileContainer
)
{
_inputService = inputService;
_outputService = outputService;
_erpdapperRepository = erpdapperRepository;
_fileContainer = fileContainer;
_dapperRepository = dapperRepository;
}
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> 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 kanban = p_list.Where(p => p.Name == "Kanban").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 materialGroup = p_list.Where(p => p.Name == "MaterialGroup").FirstOrDefault().Value;
var acceptNo = p_list.Where(p => p.Name == "AcceptNo").FirstOrDefault().Value;
var sapCode = p_list.Where(p => p.Name == "SapCode").FirstOrDefault().Value;
var warehouseDesc = p_list.Where(p => p.Name == "WarehouseDesc").FirstOrDefault().Value;
//有发货无结算,单独拿出去,财务要求
var _ls = _dapperRepository.GetReverseSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup);
if (!string.IsNullOrEmpty(kanban))
{
var _groupList = kanban.Split(new char[] { '\n' }).Distinct().ToList();
if (_groupList.Count() > 0)
{
_ls = _ls.Where(p => _groupList.Contains(p.)).ToList();
}
}
if (!string.IsNullOrEmpty(warehouseDesc))
{
var _groupList = warehouseDesc.Split(new char[] { '\n' }).Distinct().ToList();
if (_groupList.Count() > 0)
{
_ls = _ls.Where(p => _groupList.Contains(p.)).ToList();
}
}
if (!string.IsNullOrEmpty(acceptNo))
{
var _groupList = acceptNo.Split(new char[] { '\n' }).Distinct().ToList();
if (_groupList.Count() > 0)
{
_ls = _ls.Where(p => _groupList.Contains(p.)).ToList();
}
}
if (!string.IsNullOrEmpty(materialGroup))
{
var _groupList = materialGroup.Split(new char[] { ',' }).Distinct().ToList();
if (_groupList.Count() > 0)
{
_ls = _ls.Where(p => _groupList.Contains(p.)).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.)).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.Sap编码)).ToList();
}
}
ExcelExporter _exporter = new ExcelExporter();//导出Excel
var result = _exporter.Append(_ls.ToList(), "有发货无结算对比")
//.SeparateBySheet()
//.Append(_lsnoSettle.ToList(), "有结算无发货对比")
.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();
_fileContainer.SaveAsync(_filename, result.Result, true);
return id.ToString();
}
}
}

2
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/KanBanUnSettledExport.cs

@ -97,7 +97,7 @@ namespace SettleAccount.Job.Services.Report
}
}
ExcelExporter _exporter = new ExcelExporter();//导出Excel
var result = _exporter.Append(_ls.ToList(), "有看板号未结差异对比")
var result = _exporter.Append(_ls.ToList(), "有发货无结算差异对比")
.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();

Loading…
Cancel
Save