@ -46,6 +46,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
return _l ist ;
return _l ist ;
}
}
public virtual List < HQCarSettledDetailDiff > GetHQCarSettledDetailDiffReportList ( string version , string materialCode , string begin , string end , string materialGroup )
public virtual List < HQCarSettledDetailDiff > GetHQCarSettledDetailDiffReportList ( string version , string materialCode , string begin , string end , string materialGroup )
{
{
@ -64,22 +66,35 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
condition + = string . Format ( " and a.LastModificationTime<='{0}' " , end ) ;
condition + = string . Format ( " and a.LastModificationTime<='{0}' " , end ) ;
}
}
string str =
string str = "SELECT\n" +
"SELECT\n" +
" temp1.*,\n" +
" temp1.*,\n" +
" isnull( temp2.Price, 0 ) 销售单价,\n" +
" temp1.结算单价 - ISNULL( TEMP2.Price, 0 ) AS 单价差异 ,\n" +
" ( isnull( temp1.结算单价, 0 ) - isnull( temp2.Price, 0 ) ) 价格差异 \n" +
" ( temp1.结算单价 - ISNULL( TEMP2.Price, 0 ) ) * temp1.结算数量 AS 差异总金额 -- isnull( temp2.Price, 0 ) 销售单价,\n" +
"-- ( isnull( temp1.结算单价, 0 ) - isnull( temp2.Price, 0 ) ) 价格差异\n" +
" \n" +
"FROM\n" +
"FROM\n" +
" (\n" +
" (\n" +
" SELECT\n" +
" SELECT NULL AS \n" +
" A.Price 结算单价 ,\n" +
" 交货日期 ,\n" +
" A.Qty 结算数量 ,\n" +
" '手工看板' AS 手工或自动 ,\n" +
" A.MaterialCode 结算物料 号,\n" +
" '' 交货单 号,\n" +
" A.StorageLocation 收货仓库,\n" +
" A.StorageLocation 收货仓库,\n" +
" A.StorageLocationDesc 收货仓库描述,\n" +
" A.StorageLocationDesc 收货仓库描述,\n" +
" A.AcceptanceNo 订货看板号,\n" +
" '' 订货零件号,\n" +
" C.MaterialCode AS SAP编码,\n" +
" '' 发货零件号,\n" +
" C.EstimateTypeDesc 物料组,\n" +
" C.EstimateTypeDesc 物料组,\n" +
" C.MaterialCode Sap编码,\n" +
" C.MaterialDesc 物料描述,\n" +
" C.MaterialDesc 物料描述,\n" +
" 0 发货数量,\n" +
" 0 发货总金额,\n" +
" '' 发货状态,\n" +
" '' 结算验收单,\n" +
" '' 结算零件号,\n" +
" A.Qty 结算数量,\n" +
" A.Price 结算单价,\n" +
" A.Amt 结算金额,\n" +
"--A.MaterialCode 物料号,\n" +
" 0 寄销库数量 \n" +
" 0 寄销库数量 \n" +
" FROM\n" +
" FROM\n" +
" (\n" +
" (\n" +
@ -88,21 +103,25 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" SUM ( Qty ) Qty,\n" +
" SUM ( Qty ) Qty,\n" +
" MaterialCode,\n" +
" MaterialCode,\n" +
" StorageLocation,\n" +
" StorageLocation,\n" +
" StorageLocationDesc \n" +
" StorageLocationDesc,\n" +
" AcceptanceNo,\n" +
" Amt \n" +
" FROM\n" +
" FROM\n" +
" Set_BT_Car_Platform \n" +
" Set_BT_Car_Platform \n" +
" WHERE\n" +
" WHERE\n" +
" version = '{0}' \n" +
" version = '{0}' \n" +
" {1} \n" +
" GROUP BY\n" +
" GROUP BY\n" +
" MaterialCode,\n" +
" MaterialCode,\n" +
" StorageLocation,\n" +
" StorageLocation,\n" +
" StorageLocationDesc,\n" +
" StorageLocationDesc,\n" +
" price \n" +
" price,\n" +
" AcceptanceNo,\n" +
" Amt \n" +
" ) A\n" +
" ) A\n" +
" LEFT JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
" LEFT 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" ;
;
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 ) ;
@ -112,6 +131,72 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
}
}
//public virtual List<HQCarSettledDetailDiff> GetHQCarSettledDetailDiffReportList(string version, string materialCode, string begin, string end, string materialGroup)
//{
// List<HQCarSettledDetailDiff> _list = new List<HQCarSettledDetailDiff>();
// 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( temp1.结算单价, 0 ) - isnull( temp2.Price, 0 ) ) 价格差异 \n" +
// "FROM\n" +
// " (\n" +
// " SELECT\n" +
// " A.Price 结算单价,\n" +
// " A.Qty 结算数量,\n" +
// " A.MaterialCode 结算物料号,\n" +
// " A.StorageLocation 收货仓库,\n" +
// " A.StorageLocationDesc 收货仓库描述,\n" +
// " C.EstimateTypeDesc 物料组,\n" +
// " C.MaterialCode Sap编码,\n" +
// " C.MaterialDesc 物料描述,\n" +
// " 0 寄销库数量 \n" +
// " FROM\n" +
// " (\n" +
// " SELECT\n" +
// " Price,\n" +
// " SUM ( Qty ) Qty,\n" +
// " MaterialCode,\n" +
// " StorageLocation,\n" +
// " StorageLocationDesc \n" +
// " FROM\n" +
// " Set_BT_Car_Platform \n" +
// " WHERE\n" +
// " version = '{0}' \n" +
// " {1} \n" +
// " GROUP BY\n" +
// " MaterialCode,\n" +
// " StorageLocation,\n" +
// " StorageLocationDesc,\n" +
// " price \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";
// var _sql = string.Format(str, version, condition);
// var _query = DbConnection.Query<HQCarSettledDetailDiff>(_sql, null, null, true, 1200, null);
// _list = _query.ToList();
// return _list;
//}
}
}
@ -147,6 +232,38 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
}
}
//public class HQCarSettledDetailDiff
//{
// [ExporterHeader(DisplayName = "收货仓库")]
// public string 收货仓库 { set; get; }
// [ExporterHeader(DisplayName = "收货仓库描述")]
// public string 收货仓库描述 { set; get; }
// [ExporterHeader(DisplayName = "结算物料号")]
// public string 结算物料号 { set; get; }
// [ExporterHeader(DisplayName = "结算物料描述")]
// public string 物料描述 { set; get; }
// [ExporterHeader(DisplayName = "结算数量")]
// public decimal 结算数量 { set; get; }
// [ExporterHeader(DisplayName = "结算单价")]
// public decimal 结算单价 { set; get; }
// [ExporterHeader(DisplayName = "结算金额")]
// public decimal 结算金额 { set; get; }
// [ExporterHeader(DisplayName = "Sap编码")]
// public string Sap编码 { set; get; }
// [ExporterHeader(DisplayName = "物料组(车型)")]
// public string 物料组 { set; get; }
// [ExporterHeader(DisplayName = "寄销库数量")]
// public decimal 寄销库数量 { set; get; }
// [ExporterHeader(DisplayName = "是否备件")]
// public string 是否备件 { set; get; }
//}
public class HQCarSettleQtyDiff
public class HQCarSettleQtyDiff
{
{
public string 客 户 物 料 号 { set ; get ; }
public string 客 户 物 料 号 { set ; get ; }