@ -816,10 +816,10 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
/// <param name="end"></param>
/// <param name="end"></param>
/// <param name="materialGroup"></param>
/// <param name="materialGroup"></param>
/// <returns></returns>
/// <returns></returns>
public virtual List < HQHSettledDetailDiff > GetReverseSettledDetailDiffReportList ( string version , string materialCode , string begin , string end , string materialGroup )
public virtual List < HQHUn SettledDetailDiff > GetReverseSettledDetailDiffReportList ( string version , string materialCode , string begin , string end , string materialGroup )
{
{
List < HQHSettledDetailDiff > _l ist = new List < HQHSettledDetailDiff > ( ) ;
List < HQHUn SettledDetailDiff > _l ist = new List < HQHUn SettledDetailDiff > ( ) ;
string condition = " " ;
string condition = " " ;
@ -842,7 +842,6 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" 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" +
@ -855,7 +854,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" 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" +
@ -868,7 +867,6 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" b.MaterialCode AS 订货零件号,\n" +
" b.MaterialCode AS 订货零件号,\n" +
" c.MaterialCode Sap编码,\n" +
" c.MaterialCode Sap编码,\n" +
" c.CustomerPartCode 客户物料号,\n" +
" c.CustomerPartCode 客户物料号,\n" +
" '' AS 发货零件号,\n" +
" c.MaterialDesc AS 零件中文名称,\n" +
" c.MaterialDesc AS 零件中文名称,\n" +
" isnull( a.Qty, 0 ) AS 发货数量,\n" +
" isnull( a.Qty, 0 ) AS 发货数量,\n" +
" isnull( a.State, 0 ) AS 发货状态,\n" +
" isnull( a.State, 0 ) AS 发货状态,\n" +
@ -884,12 +882,12 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" 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" +
" b.HQHKanBan IS NULL \n" +
" b.HQHKanBan IS NULL \n" +
" AND b.MaterialCode IS NULL {0} \n" +
" AND b.MaterialCode IS NULL {0}\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" ;
" 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 , condition ) ;
var _ sql = string . Format ( str , condition ) ;
var _ query = DbConnection . Query < HQHSettledDetailDiff > ( _ sql , null , null , true , 1 2 0 0 , null ) ;
var _ query = DbConnection . Query < HQHUn SettledDetailDiff > ( _ sql , null , null , true , 1 2 0 0 , null ) ;
_l ist = _ query . ToList ( ) ;
_l ist = _ query . ToList ( ) ;
return _l ist ;
return _l ist ;
@ -1061,9 +1059,10 @@ 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 = "SELECT\n" +
string str = "SELECT\n" +
" temp1.*,\n" +
" temp1.*,\n" +
" 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 ) ) 价格差异,\n" +
" ( isnull( temp1.结算单价, 0 ) - isnull( temp2.Price, 0 ) ) * temp1.结算数量 AS 差异总金额 \n" +
" ( isnull( temp1.结算单价, 0 ) - isnull( temp2.Price, 0 ) ) * temp1.结算数量 AS 差异总金额 \n" +
"FROM\n" +
"FROM\n" +
@ -1075,20 +1074,27 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" A.MaterialCode 结算物料号,\n" +
" A.MaterialCode 结算物料号,\n" +
" A.StorageLocation 收货仓库,\n" +
" A.StorageLocation 收货仓库,\n" +
" A.StorageLocationDesc 收货仓库描述,\n" +
" A.StorageLocationDesc 收货仓库描述,\n" +
" a.[AcceptanceNo] AS 结算验收单号,\n" +
" C.EstimateTypeDesc 物料组,\n" +
" C.EstimateTypeDesc 物料组,\n" +
" C.MaterialCode Sap编码,\n" +
" C.MaterialCode Sap编码,\n" +
" C.MaterialDesc 物料描述,\n" +
" C.MaterialDesc 零件中文名称,\n" +
" a.[AcceptanceNo] AS 结算验收单号,\n" +
" a.Factory AS 工厂,\n" +
" a.HQHKanBan AS 订货看板编号,\n" +
" a.AcceptanceDate 验收单日期,\n" +
" 0 寄销库数量 \n" +
" 0 寄销库数量 \n" +
" FROM\n" +
" FROM\n" +
" (\n" +
" (\n" +
" SELECT\n" +
" SELECT SUM\n" +
" Price,\n" +
" ( Qty ) AS Qty,\n" +
" SUM ( Qty ) Qty,\n" +
" MaterialCode,\n" +
" MaterialCode,\n" +
" Version,\n" +
" StorageLocation,\n" +
" StorageLocation,\n" +
" StorageLocationDesc,\n" +
" StorageLocationDesc,\n" +
" AcceptanceNo \n" +
" Factory,\n" +
" AcceptanceNo,\n" +
" Price,\n" +
" HQHKanBan,\n" +
" CONVERT ( VARCHAR ( 100 ), AcceptanceDate, 23 ) AcceptanceDate \n" +
" FROM\n" +
" FROM\n" +
" Set_HQ_H_Platform \n" +
" Set_HQ_H_Platform \n" +
" WHERE\n" +
" WHERE\n" +
@ -1096,14 +1102,63 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" AND HQHKanBan = 'BJ' \n" +
" AND HQHKanBan = 'BJ' \n" +
" GROUP BY\n" +
" GROUP BY\n" +
" MaterialCode,\n" +
" MaterialCode,\n" +
" Version,\n" +
" StorageLocation,\n" +
" StorageLocation,\n" +
" StorageLocationDesc,\n" +
" StorageLocationDesc,\n" +
" price,\n" +
" Factory,\n" +
" AcceptanceNo \n" +
" AcceptanceNo,\n" +
" Price,\n" +
" HQHKanBan,\n" +
" AcceptanceDate \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" ;
//string str = "SELECT\n" +
//" temp1.*,\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" +
//" 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" +
//" a.[AcceptanceNo] AS 结算验收单号,\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" +
//" AcceptanceNo \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" +
//" price,\n" +
//" AcceptanceNo \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 _sql = string.Format(str, version, condition);
var _ sql = string . Format ( str , version ) ;
var _ sql = string . Format ( str , version ) ;
@ -1142,7 +1197,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
string str = "SELECT\n" +
string str = "SELECT\n" +
" temp1.*,\n" +
" temp1.*,\n" +
" isnull( temp2.Price, 0 ) 销售单 价,\n" +
" isnull( temp2.Price, 0 ) 发货定 价,\n" +
" isnull( temp3.Price, 0 ) 结算单价,\n" +
" isnull( temp3.Price, 0 ) 结算单价,\n" +
" ( isnull( temp3.Price, 0 ) - isnull( temp2.Price, 0 ) ) 价格差异,\n" +
" ( isnull( temp3.Price, 0 ) - isnull( temp2.Price, 0 ) ) 价格差异,\n" +
" (temp3.Price * temp1.结算数量) 结算金额,\n" +
" (temp3.Price * temp1.结算数量) 结算金额,\n" +
@ -1219,52 +1274,72 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
decimal sockQty )
decimal sockQty )
{
{
Sap编码 = sapMaterialCode ;
Sap编码 = sapMaterialCode ;
物 料 描 述 = materialDesc ;
零 件 中 文 名 称 = materialDesc ;
结 算 物 料 号 = materialCode ;
结 算 物 料 号 = materialCode ;
寄 销 库 数 量 = sockQty ;
寄 销 库 数 量 = sockQty ;
结 算 单 价 = price ;
结 算 单 价 = price ;
收 货 仓 库 = storageLocation ;
收 货 仓 库 = storageLocation ;
收 货 仓 库 描 述 = storageLocationDesc ;
收 货 仓 库 描 述 = storageLocationDesc ;
销 售 单 价 = selprice ;
发 货 定 价 = selprice ;
价 格 差 异 = diffprice ;
价 格 差 异 = diffprice ;
差 异 总 金 额 = sumprice ;
差 异 总 金 额 = sumprice ;
结 算 数 量 = qty ;
结 算 数 量 = qty ;
结 算 金 额 = settleprice ;
结 算 金 额 = settleprice ;
}
}
[ExporterHeader(DisplayName = "工厂")]
public string 工 厂 { set ; get ; }
[ExporterHeader(DisplayName = "收货仓库")]
[ExporterHeader(DisplayName = "收货仓库")]
public string 收 货 仓 库 { set ; get ; }
public string 收 货 仓 库 { set ; get ; }
[ExporterHeader(DisplayName = "收货仓库描述")]
[ExporterHeader(DisplayName = "收货仓库描述")]
public string 收 货 仓 库 描 述 { set ; get ; }
public string 收 货 仓 库 描 述 { set ; get ; }
[ExporterHeader(DisplayName = "订货看板编号")]
public string 订 货 看 板 编 号 { set ; get ; }
[ExporterHeader(DisplayName = "Sap编码")]
public string Sap编码 { set ; get ; }
[ExporterHeader(DisplayName = "结算物料号")]
[ExporterHeader(DisplayName = "结算物料号")]
public string 结 算 物 料 号 { set ; get ; }
public string 结 算 物 料 号 { set ; get ; }
[ExporterHeader(DisplayName = "结算物料描述")]
[ExporterHeader(DisplayName = "物料组(车型)")]
public string 物 料 描 述 { set ; get ; }
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 = "结算数量")]
[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 ; }
[ExporterHeader(DisplayName = "结算金额")]
[ExporterHeader(DisplayName = "结算金额")]
public decimal 结 算 金 额 { set ; get ; }
public decimal 结 算 金 额 { set ; get ; }
[ExporterHeader(DisplayName = "Sap编码")]
public string Sap编码 { set ; get ; }
[ExporterHeader(DisplayName = "价格差异")]
[ExporterHeader(DisplayName = "物料组(车型)")]
public decimal 价 格 差 异 { 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 ; }
}
}
public class HQHSettledDetailDiff
public class HQHSettledDetailDiff
{
{
@ -1288,12 +1363,13 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
public string 零 件 中 文 名 称 { set ; get ; }
public string 零 件 中 文 名 称 { set ; get ; }
[ExporterHeader(DisplayName = "Sap编码")]
[ExporterHeader(DisplayName = "Sap编码")]
public string Sap编码 { set ; get ; }
public string Sap编码 { set ; get ; }
[ExporterHeader(DisplayName = "物料组(车型)")]
public string 物 料 组 { set ; get ; }
[ExporterHeader(DisplayName = "客户物料号")]
[ExporterHeader(DisplayName = "客户物料号")]
public string 客 户 物 料 号 { set ; get ; }
public string 客 户 物 料 号 { set ; get ; }
[ExporterHeader(DisplayName = "物料组(车型)")]
public string 物 料 组 { set ; get ; }
[ExporterHeader(DisplayName = "发货数量")]
[ExporterHeader(DisplayName = "发货数量")]
public decimal 发 货 数 量 { set ; get ; }
public decimal 发 货 数 量 { set ; get ; }
[ExporterHeader(DisplayName = "发货状态")]
[ExporterHeader(DisplayName = "发货状态")]
@ -1333,6 +1409,72 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
[ExporterHeader(DisplayName = "验收单日期")]
[ExporterHeader(DisplayName = "验收单日期")]
public string 验 收 单 日 期 { set ; get ; }
public string 验 收 单 日 期 { set ; get ; }
}
}
public class HQHUnSettledDetailDiff
{
[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 string 订 货 看 板 编 号 { set ; get ; }
[ExporterHeader(DisplayName = "订货零件号",IsIgnore =true)]
public string 订 货 零 件 号 { set ; get ; }
[ExporterHeader(DisplayName = "发货零件号", IsIgnore = true)]
public string 发 货 零 件 号 { set ; get ; }
[ExporterHeader(DisplayName = "Sap编码")]
public string Sap编码 { set ; get ; }
[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 string 结 算 验 收 单 号 { set ; get ; }
[ExporterHeader(DisplayName = "发货数量")]
public decimal 发 货 数 量 { set ; get ; }
[ExporterHeader(DisplayName = "发货状态", IsIgnore = true)]
public string 发 货 状 态 { set ; get ; }
[ExporterHeader(DisplayName = "结算数量")]
public decimal 结 算 数 量 { set ; get ; }
[ExporterHeader(DisplayName = "结算单价")]
public decimal 结 算 单 价 { set ; get ; }
[ExporterHeader(DisplayName = "结算金额")]
public decimal 结 算 金 额 { set ; get ; }
[ExporterHeader(DisplayName = "发货定价")]
public decimal 发 货 定 价 { set ; get ; }
[ExporterHeader(DisplayName = "发货总金额")]
public decimal 发 货 总 金 额 { set ; get ; }
[ExporterHeader(DisplayName = "数量差异")]
public decimal 数 量 差 异 { set ; get ; }
[ExporterHeader(DisplayName = "单价差异")]
public decimal 单 价 差 异 { set ; get ; }
[ExporterHeader(DisplayName = "差异总金额")]
public decimal 差 异 总 金 额 { set ; get ; }
[ExporterHeader(DisplayName = "工厂",IsIgnore =true)]
public string 工 厂 { set ; get ; }
[ExporterHeader(DisplayName = "看板编号")]
public string 看 板 编 号 { set ; get ; }
}
public class HQHSettleQtyDiff
public class HQHSettleQtyDiff
{
{
public string 客 户 物 料 号 { set ; get ; }
public string 客 户 物 料 号 { set ; get ; }