Browse Source

红旗出库报表

FoShanPG
44673626 3 years ago
parent
commit
278b35b61b
  1. 112
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs
  2. 4
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHSettledDetailDiffExportService.cs

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

@ -72,62 +72,62 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
//// condition += string.Format(" B.chassisNumber='{0}' ", materialGroup); //// condition += string.Format(" B.chassisNumber='{0}' ", materialGroup);
////} ////}
string str = "SELECT\n" + string str = "SELECT\n" +
" temp1.交货时间,\n" + " isnull( temp1.交货单号, '' ) 交货单号,\n" +
" isnull( temp1.手工或自动, '' ) 手工或自动,\n" + " temp1.交货时间,\n" +
" isnull( temp1.交货单号, '' ) 交货单号,\n" + " isnull( temp1.手工或自动, '' ) 手工或自动,\n" +
" temp1.[工厂],\n" + " temp1.[工厂],\n" +
" temp1.收货仓库,\n" + " temp1.收货仓库,\n" +
" temp1.收货仓库描述,\n" + " temp1.收货仓库描述,\n" +
" temp1.订货看板编号,\n" + " temp1.订货看板编号,\n" +
" temp1.订货零件号,\n" + " temp1.订货零件号,\n" +
" temp1.验收单日期,\n" + " temp1.验收单日期,\n" +
" temp1.Sap编码,\n" + " temp1.Sap编码,\n" +
" temp1.看板编号,\n" + " temp1.看板编号,\n" +
" temp1.物料组,\n" + " temp1.物料组,\n" +
" temp1.零件中文名称,\n" + " temp1.零件中文名称,\n" +
" temp1.发货数量,\n" + " temp1.发货数量,\n" +
" temp1.发货状态,\n" + " temp1.发货状态,\n" +
" temp1.结算验收单号,\n" + " temp1.结算验收单号,\n" +
" temp1.结算数量,\n" + " temp1.结算数量,\n" +
" temp1.结算单价,\n" + " temp1.结算单价,\n" +
" temp1.结算金额,\n" + " temp1.结算金额,\n" +
" isnull( TEMP2.Price, 0 ) AS 发货定价,\n" + " isnull( TEMP2.Price, 0 ) AS 发货定价,\n" +
" isnull( temp1.发货数量, 0 ) * isnull( TEMP2.Price, 0 ) AS 发货总金额,\n" + " isnull( temp1.发货数量, 0 ) * isnull( TEMP2.Price, 0 ) AS 发货总金额,\n" +
" 0 AS 数量差异,\n" + " 0 AS 数量差异,\n" +
" temp1.结算单价 - ISNULL( TEMP2.Price, 0 ) AS 单价差异,\n" + " temp1.结算单价 - ISNULL( TEMP2.Price, 0 ) AS 单价差异,\n" +
" ( temp1.结算单价 - ISNULL( TEMP2.Price, 0 ) ) * temp1.结算数量 AS 差异总金额 \n" + " ( temp1.结算单价 - ISNULL( TEMP2.Price, 0 ) ) * temp1.结算数量 AS 差异总金额 \n" +
"FROM\n" + "FROM\n" +
" (\n" + " (\n" +
" SELECT\n" + " SELECT\n" +
" b.WmsBillNum AS 交货单号,\n" + " '' AS 交货单号,\n" +
" CONVERT ( VARCHAR ( 100 ), b.LastModificationTime, 23 ) AS 交货时间,\n" + " NULL AS 交货时间,\n" +
" b.IsAuto AS 手工或自动,\n" + " '' AS 手工或自动,\n" +
" a.StorageLocation AS 收货仓库,\n" + " a.StorageLocation AS 收货仓库,\n" +
" a.StorageLocationDesc AS 收货仓库描述,\n" + " a.StorageLocationDesc AS 收货仓库描述,\n" +
" a.HQHKanBan AS 订货看板编号,\n" + " a.HQHKanBan AS 订货看板编号,\n" +
" a.MaterialCode AS 订货零件号,\n" + " a.MaterialCode AS 订货零件号,\n" +
" c.MaterialCode Sap编码,\n" + " c.MaterialCode Sap编码,\n" +
" c.MaterialDesc AS 零件中文名称,\n" + " c.MaterialDesc AS 零件中文名称,\n" +
" isnull( b.Qty, 0 ) AS 发货数量,\n" + " isnull( b.Qty, 0 ) AS 发货数量,\n" +
" isnull( b.State, 0 ) AS 发货状态,\n" + " 0 AS 发货状态,\n" +
" a.AcceptanceNo AS 结算验收单号,\n" + " a.AcceptanceNo AS 结算验收单号,\n" +
" isnull( a.Qty, 0 ) AS 结算数量,\n" + " isnull( a.Qty, 0 ) AS 结算数量,\n" +
" isnull( a.Price, 0 ) AS 结算单价,\n" + " isnull( a.Price, 0 ) AS 结算单价,\n" +
" isnull( a.Amt, 0 ) AS 结算金额 ,\n" + " ( isnull( a.Qty, 0 ) * isnull( a.Price, 0 ) ) AS 结算金额 ,\n" +
" C.EstimateTypeDesc AS 物料组,\n" + " C.EstimateTypeDesc AS 物料组,\n" +
" a.Factory AS 工厂,\n" + " a.Factory AS 工厂,\n" +
" a.KanbanNumber AS 看板编号,\n" + " a.KanbanNumber AS 看板编号,\n" +
" CONVERT ( VARCHAR ( 100 ), a.AcceptanceDate, 23 ) AS 验收单日期 \n" + " CONVERT ( VARCHAR ( 100 ), a.AcceptanceDate, 23 ) AS 验收单日期 \n" +
" FROM\n" + " FROM\n" +
" Set_HQ_H_Platform AS a\n" + " Set_HQ_H_Platform AS a\n" +
" LEFT OUTER JOIN Set_HQ_H_Kanban AS b ON a.HQHKanBan = b.Kanban \n" + " INNER JOIN ( SELECT SUM ( Qty ) AS Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban GROUP BY Kanban, MaterialCode ) AS b ON a.HQHKanBan = b.Kanban \n" +
" AND a.MaterialCode = b.MaterialCode\n" + " AND a.MaterialCode = b.MaterialCode\n" +
" LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" + " LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
" WHERE\n" + " WHERE\n" +
" ( a.HQHKanBan <> 'BJ' ) \n" +
" a.Version= '{0}' {1} \n" + " AND a.Version= '{0}' {1} \n" +
" ) AS temp1\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 not null "; " 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, version, condition);
var _query = DbConnection.Query<HQHSettledDetailDiff>(_sql, null, null, true, 1200, null); var _query = DbConnection.Query<HQHSettledDetailDiff>(_sql, null, null, true, 1200, null);

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

@ -134,8 +134,8 @@ namespace SettleAccount.Job.Services.Report
var result = _exporter.Append(_ls.ToList(), "红旗工厂核对明细") var result = _exporter.Append(_ls.ToList(), "红旗工厂核对明细")
.SeparateBySheet() .SeparateBySheet()
.Append(_lsnoSettle.ToList(), "有结算无发货对比") .Append(_lsnoSettle.ToList(), "有结算无发货对比")
//.SeparateBySheet() .SeparateBySheet()
//.Append(_reversels.ToList(), "有发货无结算对比") .Append(_reversels.ToList(), "有发货无结算对比")
.ExportAppendDataAsByteArray(); .ExportAppendDataAsByteArray();
result.ShouldNotBeNull(); result.ShouldNotBeNull();
_fileContainer.SaveAsync(_filename, result.Result, true); _fileContainer.SaveAsync(_filename, result.Result, true);

Loading…
Cancel
Save