@ -67,20 +67,38 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
}
}
string str = "SELECT\n" +
string str = "SELECT\n" +
" temp1.*,\n" +
" temp1.交货日期,\n" +
" temp1.手工或自动,\n" +
" '' 订单日期,\n" +
" temp1.[收货仓库],\n" +
" temp1.[收货仓库描述],\n" +
" temp1.[订货看板号],\n" +
" temp1.[订货零件号],\n" +
" temp1.[SAP编码],\n" +
" temp1.[发货零件号],\n" +
" temp1.[物料组],\n" +
" temp1.[物料描述],\n" +
" temp1.[发货数量],\n" +
" ISNULL( TEMP2.Price, 0 ) AS 发货定价,\n" +
" temp1.[发货总金额],\n" +
" temp1.[发货状态],\n" +
" temp1.[结算验收单],\n" +
" temp1.[结算零件号],\n" +
" temp1.[结算数量],\n" +
" temp1.[结算单价],\n" +
" temp1.[结算金额],\n" +
" temp1.[发货数量] - temp1.[结算数量] AS 数量差异,\n" +
" temp1.结算单价 - ISNULL( TEMP2.Price, 0 ) AS 单价差异 ,\n" +
" temp1.结算单价 - ISNULL( TEMP2.Price, 0 ) AS 单价差异 ,\n" +
" ( temp1.结算单价 - ISNULL( TEMP2.Price, 0 ) ) * temp1.结算数量 AS 差异总金额 -- isnull( temp2.Price, 0 ) 销售单价,\n" +
" ( temp1.结算单价 - ISNULL( TEMP2.Price, 0 ) ) * temp1.结算数量 AS 差异总金额 \n" +
"-- ( isnull( temp1.结算单价, 0 ) - isnull( temp2.Price, 0 ) ) 价格差异\n" +
" \n" +
"FROM\n" +
"FROM\n" +
" (\n" +
" (\n" +
" SELECT NULL AS\n" +
" SELECT NULL AS\n" +
" 交货日期,\n" +
" 交货日期,\n" +
" '手工看板' AS 手工或自动,\n" +
" '' AS 手工或自动,\n" +
" '' 交货单号,\n" +
" '' 交货单号,\n" +
" A.StorageLocation 收货仓库,\n" +
" '' 收货仓库,\n" +
" A.StorageLocationDesc 收货仓库描述,\n" +
" '' 收货仓库描述,\n" +
" A.AcceptanceNo 订货看板号,\n" +
" '' 订货看板号,\n" +
" '' 订货零件号,\n" +
" '' 订货零件号,\n" +
" C.MaterialCode AS SAP编码,\n" +
" C.MaterialCode AS SAP编码,\n" +
" '' 发货零件号,\n" +
" '' 发货零件号,\n" +
@ -93,35 +111,72 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" '' 结算零件号,\n" +
" '' 结算零件号,\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.Price, 0 ) * isnull( A.Qty, 0 ) AS 结算金额,\n" +
"--A.MaterialCode 物料号,\n" +
" 0 寄销库数量 \n" +
" 0 寄销库数量 \n" +
" FROM\n" +
" FROM\n" +
" (\n" +
" ( SELECT Price, SUM ( Qty ) Qty, MaterialCode, Version FROM Set_BT_Car_Platform GROUP BY MaterialCode, price, Version ) A\n" +
" SELECT\n" +
" Price,\n" +
" SUM ( Qty ) Qty,\n" +
" MaterialCode,\n" +
" StorageLocation,\n" +
" StorageLocationDesc,\n" +
" AcceptanceNo,\n" +
" Amt \n" +
" FROM\n" +
" Set_BT_Car_Platform \n" +
" WHERE\n" +
" version = '{0}' \n" +
" GROUP BY\n" +
" MaterialCode,\n" +
" StorageLocation,\n" +
" StorageLocationDesc,\n" +
" price,\n" +
" AcceptanceNo,\n" +
" Amt \n" +
" ) A\n" +
" INNER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
" INNER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
" WHERE\n" +
" A.Version= '{0}' \n" +
" ) temp1\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" ;
" 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" ;
;
//string str = "SELECT\n" +
// " temp1.*,\n" +
// " temp1.结算单价 - ISNULL( TEMP2.Price, 0 ) AS 单价差异 ,\n" +
// " ( temp1.结算单价 - ISNULL( TEMP2.Price, 0 ) ) * temp1.结算数量 AS 差异总金额 -- isnull( temp2.Price, 0 ) 销售单价,\n" +
// "-- ( isnull( temp1.结算单价, 0 ) - isnull( temp2.Price, 0 ) ) 价格差异\n" +
// " \n" +
// "FROM\n" +
// " (\n" +
// " SELECT NULL AS\n" +
// " 交货日期,\n" +
// " '手工看板' AS 手工或自动,\n" +
// " '' 交货单号,\n" +
// " A.StorageLocation 收货仓库,\n" +
// " A.StorageLocationDesc 收货仓库描述,\n" +
// " A.AcceptanceNo 订货看板号,\n" +
// " '' 订货零件号,\n" +
// " C.MaterialCode AS SAP编码,\n" +
// " '' 发货零件号,\n" +
// " C.EstimateTypeDesc 物料组,\n" +
// " C.MaterialDesc 物料描述,\n" +
// " 0 AS 发货数量,\n" +
// " 0 发货总金额,\n" +
// " '' 发货状态,\n" +
// " '' 结算验收单,\n" +
// " '' 结算零件号,\n" +
// " isnull(A.Qty,0) AS 结算数量,\n" +
// " isnull(A.Price,0) AS 结算单价,\n" +
// " isnull(A.Amt,0) AS 结算金额,\n" +
// "--A.MaterialCode 物料号,\n" +
// " 0 寄销库数量 \n" +
// " FROM\n" +
// " (\n" +
// " SELECT\n" +
// " Price,\n" +
// " SUM ( Qty ) Qty,\n" +
// " MaterialCode,\n" +
// " StorageLocation,\n" +
// " StorageLocationDesc,\n" +
// " AcceptanceNo,\n" +
// " Amt \n" +
// " FROM\n" +
// " Set_BT_Car_Platform \n" +
// " WHERE\n" +
// " version = '{0}' \n" +
// " GROUP BY\n" +
// " MaterialCode,\n" +
// " StorageLocation,\n" +
// " StorageLocationDesc,\n" +
// " price,\n" +
// " AcceptanceNo,\n" +
// " Amt \n" +
// " ) A\n" +
// " INNER 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";
var _ sql = string . Format ( str , version , condition ) ;
var _ sql = string . Format ( str , version , condition ) ;
var _ query = DbConnection . Query < HQCarSettledDetailDiff > ( _ sql , null , null , true , 1 2 0 0 , null ) ;
var _ query = DbConnection . Query < HQCarSettledDetailDiff > ( _ sql , null , null , true , 1 2 0 0 , null ) ;
@ -226,6 +281,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
public string 物 料 描 述 { set ; get ; }
public string 物 料 描 述 { set ; get ; }
[ExporterHeader(DisplayName = "发货数量")]
[ExporterHeader(DisplayName = "发货数量")]
public decimal 发 货 数 量 { set ; get ; }
public decimal 发 货 数 量 { set ; get ; }
[ExporterHeader(DisplayName = "发货定价")]
public decimal 发 货 定 价 { set ; get ; }
[ExporterHeader(DisplayName = "发货总金额")]
[ExporterHeader(DisplayName = "发货总金额")]
public decimal 发 货 总 金 额 { set ; get ; }
public decimal 发 货 总 金 额 { set ; get ; }
[ExporterHeader(DisplayName = "发货状态")]
[ExporterHeader(DisplayName = "发货状态")]
@ -240,12 +297,14 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
public decimal 结 算 单 价 { set ; get ; }
public decimal 结 算 单 价 { set ; get ; }
[ExporterHeader(DisplayName = "结算金额")]
[ExporterHeader(DisplayName = "结算金额")]
public decimal 结 算 金 额 { set ; get ; }
public decimal 结 算 金 额 { set ; get ; }
[ExporterHeader(DisplayName = "寄销库 数量")]
[ExporterHeader(DisplayName = "数量差异 ")]
public decimal 寄 销 库 数 量 { set ; get ; }
public decimal 数 量 差 异 { set ; get ; }
[ExporterHeader(DisplayName = "单价差异")]
[ExporterHeader(DisplayName = "单价差异")]
public decimal 单 价 差 异 { set ; get ; }
public decimal 单 价 差 异 { set ; get ; }
[ExporterHeader(DisplayName = "差异总金额")]
[ExporterHeader(DisplayName = "差异总金额")]
public decimal 差 异 总 金 额 { set ; get ; }
public decimal 差 异 总 金 额 { set ; get ; }
[ExporterHeader(DisplayName = "寄销库数量")]
public decimal 寄 销 库 数 量 { set ; get ; }
}
}