@ -67,61 +67,116 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
}
}
string str = "SELECT\n" +
string str = "SELECT\n" +
" temp1.*,\n" +
" temp1.交货日期,\n" +
" temp1.结算单价 - ISNULL( TEMP2.Price, 0 ) AS 单价差异 ,\n" +
" temp1.手工或自动,\n" +
" ( temp1.结算单价 - ISNULL( TEMP2.Price, 0 ) ) * temp1.结算数量 AS 差异总金额 -- isnull( temp2.Price, 0 ) 销售单价,\n" +
" '' 订单日期,\n" +
"-- ( isnull( temp1.结算单价, 0 ) - isnull( temp2.Price, 0 ) ) 价格差异\n" +
" temp1.[收货仓库],\n" +
" \n" +
" temp1.[收货仓库描述],\n" +
"FROM\n" +
" temp1.[订货看板号],\n" +
" (\n" +
" temp1.[订货零件号],\n" +
" SELECT NULL AS\n" +
" temp1.[SAP编码],\n" +
" 交货日期,\n" +
" temp1.[发货零件号],\n" +
" '手工看板' AS 手工或自动,\n" +
" temp1.[物料组],\n" +
" '' 交货单号,\n" +
" temp1.[物料描述],\n" +
" A.StorageLocation 收货仓库,\n" +
" temp1.[发货数量],\n" +
" A.StorageLocationDesc 收货仓库描述,\n" +
" ISNULL( TEMP2.Price, 0 ) AS 发货定价,\n" +
" A.AcceptanceNo 订货看板号,\n" +
" temp1.[发货总金额],\n" +
" '' 订货零件号,\n" +
" temp1.[发货状态],\n" +
" C.MaterialCode AS SAP编码,\n" +
" temp1.[结算验收单],\n" +
" '' 发货零件号,\n" +
" temp1.[结算零件号],\n" +
" C.EstimateTypeDesc 物料组,\n" +
" temp1.[结算数量],\n" +
" C.MaterialDesc 物料描述,\n" +
" temp1.[结算单价],\n" +
" 0 AS 发货数量,\n" +
" temp1.[结算金额],\n" +
" 0 发货总金额,\n" +
" temp1.[发货数量] - temp1.[结算数量] AS 数量差异,\n" +
" '' 发货状态,\n" +
" temp1.结算单价 - ISNULL( TEMP2.Price, 0 ) AS 单价差异 ,\n" +
" '' 结算验收单,\n" +
" ( temp1.结算单价 - ISNULL( TEMP2.Price, 0 ) ) * temp1.结算数量 AS 差异总金额 \n" +
" '' 结算零件号,\n" +
"FROM\n" +
" isnull(A.Qty,0) AS 结算数量,\n" +
" (\n" +
" isnull(A.Price,0) AS 结算单价,\n" +
" SELECT NULL AS\n" +
" isnull(A.Amt,0) AS 结算金额,\n" +
" 交货日期,\n" +
"--A.MaterialCode 物料号,\n" +
" '' AS 手工或自动,\n" +
" 0 寄销库数量 \n" +
" '' 交货单号,\n" +
" FROM\n" +
" '' 收货仓库,\n" +
" (\n" +
" '' 收货仓库描述,\n" +
" SELECT\n" +
" '' 订货看板号,\n" +
" Price,\n" +
" '' 订货零件号,\n" +
" SUM ( Qty ) Qty,\n" +
" C.MaterialCode AS SAP编码,\n" +
" MaterialCode,\n" +
" '' 发货零件号,\n" +
" StorageLocation,\n" +
" C.EstimateTypeDesc 物料组,\n" +
" StorageLocationDesc,\n" +
" C.MaterialDesc 物料描述,\n" +
" AcceptanceNo,\n" +
" 0 AS 发货数量,\n" +
" Amt \n" +
" 0 发货总金额,\n" +
" FROM\n" +
" '' 发货状态,\n" +
" Set_BT_Car_Platform \n" +
" '' 结算验收单,\n" +
" WHERE\n" +
" '' 结算零件号,\n" +
" version = '{0}' \n" +
" isnull( A.Qty, 0 ) AS 结算数量,\n" +
" GROUP BY\n" +
" isnull( A.Price, 0 ) AS 结算单价,\n" +
" MaterialCode,\n" +
" isnull( A.Price, 0 ) * isnull( A.Qty, 0 ) AS 结算金额,\n" +
" StorageLocation,\n" +
" 0 寄销库数量 \n" +
" StorageLocationDesc,\n" +
" FROM\n" +
" price,\n" +
" ( SELECT Price, SUM ( Qty ) Qty, MaterialCode, Version FROM Set_BT_Car_Platform GROUP BY MaterialCode, price, Version ) A\n" +
" AcceptanceNo,\n" +
" INNER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
" Amt \n" +
" WHERE\n" +
" ) A\n" +
" A.Version= '{0}' \n" +
" INNER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \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 ; }
}
}