@ -25,8 +25,14 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
List < HQHSettledDetailDiff > _l ist = new List < HQHSettledDetailDiff > ( ) ;
List < HQHSettledDetailDiff > _l ist = new List < HQHSettledDetailDiff > ( ) ;
//string condition = " where 1=1 ";
string condition = " " ;
string condition = " " ;
////if (!string.IsNullOrEmpty(materialCode))
////{
//// condition += string.Format(" and d.MaterialCode in ({0}) ", materialCode);
////}
if ( ! string . IsNullOrEmpty ( begin ) )
if ( ! string . IsNullOrEmpty ( begin ) )
{
{
condition + = string . Format ( " and b.LastModificationTime>='{0}' " , begin ) ;
condition + = string . Format ( " and b.LastModificationTime>='{0}' " , begin ) ;
@ -35,9 +41,28 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{
{
condition + = string . Format ( " and b.LastModificationTime<='{0}' " , end ) ;
condition + = string . Format ( " and b.LastModificationTime<='{0}' " , end ) ;
}
}
//if (!string.IsNullOrEmpty(cp7begin))
//{
// condition += string.Format(" and B.cp7>='{0}' ", cp7begin);
//}
//if (!string.IsNullOrEmpty(cp7end))
//{
// condition += string.Format(" and B.cp7<='{0}' ", cp7end);
//}
////if (!string.IsNullOrEmpty(kennCode))
////{
//// condition += string.Format(" and B.kenncode='{0}' ", kennCode);
////}
////if (!string.IsNullOrEmpty(chassisNumber))
////{
//// condition += string.Format(" and B.chassisNumber='{0}' ", chassisNumber);
////}
////if (!string.IsNullOrEmpty(materialGroup))
////{
//// condition += string.Format(" B.chassisNumber='{0}' ", materialGroup);
////}
string str =
string str =
"SELECT\n" +
"SELECT\n" +
" temp1.行号, \n" +
" isnull(temp1.交货单号,'') 交货单号,\n" +
" isnull(temp1.交货单号,'') 交货单号,\n" +
" temp1.交货时间,\n" +
" temp1.交货时间,\n" +
" isnull(temp1.手工或自动,'') 手工或自动,\n" +
" isnull(temp1.手工或自动,'') 手工或自动,\n" +
@ -63,7 +88,6 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
"FROM\n" +
"FROM\n" +
" (\n" +
" (\n" +
" SELECT\n" +
" SELECT\n" +
" b.poLine AS 行号,\n" +
" b.WmsBillNum AS 交货单号,\n" +
" b.WmsBillNum AS 交货单号,\n" +
" b.LastModificationTime AS 交货时间,\n" +
" b.LastModificationTime AS 交货时间,\n" +
" b.IsAuto AS 手工或自动,\n" +
" b.IsAuto AS 手工或自动,\n" +
@ -111,18 +135,31 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{
{
List < HQHSettleQtyDiff > _l ist = new List < HQHSettleQtyDiff > ( ) ;
List < HQHSettleQtyDiff > _l ist = new List < HQHSettleQtyDiff > ( ) ;
var str =
var str =
"SELECT\n" +
"SELECT temp1.MaterialCode 客户物料号,temp1.HQHKanBan 看板号 ,temp1.SettleQty 结算数量, temp2.Qty 发货数量,( temp1.SettleQty - temp2.Qty ) 差异数量 \n" +
" temp1.MaterialCode 客户物料号,\n" +
"FROM\n" +
" temp1.HQHKanBan 看板号,\n" +
" (\n" +
" temp1.SettleQty 结算数量,\n" +
" SELECT\n" +
" ISNULL( temp2.Qty, 0 ) 发货数量,(\n" +
" SUM( Qty ) SettleQty,\n" +
" temp1.SettleQty - ISNULL( temp2.Qty, 0 )) 差异数量 \n" +
" HQHKanBan,\n" +
"FROM\n" +
" MaterialCode \n" +
" ( SELECT SUM( Qty ) SettleQty, HQHKanBan, MaterialCode FROM Set_HQ_H_Platform WHERE version = '{0}' GROUP BY HQHKanBan, MaterialCode ) temp1\n" +
" FROM\n" +
" LEFT JOIN ( SELECT SUM( Qty ) Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban GROUP BY Kanban, MaterialCode ) temp2 ON temp1.HQHKanBan = temp2.Kanban \n" +
" Set_HQ_H_Platform where version='{0}'\n" +
" AND temp1.MaterialCode = temp2.MaterialCode \n" +
" GROUP BY\n" +
"WHERE\n" +
" HQHKanBan,\n" +
" temp1.SettleQty != ISNULL( temp2.Qty, 0 )" ;
" MaterialCode \n" +
" ) temp1\n" +
" LEFT JOIN (\n" +
" SELECT\n" +
" SUM( Qty ) Qty,\n" +
" Kanban,\n" +
" MaterialCode \n" +
" FROM\n" +
" Set_HQ_H_Kanban \n" +
" GROUP BY\n" +
" Kanban,\n" +
" MaterialCode \n" +
" ) temp2 ON temp1.HQHKanBan = temp2.Kanban \n" +
" AND temp1.MaterialCode = temp2.MaterialCode where temp1.SettleQty!=temp2.Qty " ;
str = string . Format ( str , version ) ;
str = string . Format ( str , version ) ;
var _ query = DbConnection . Query < HQHSettleQtyDiff > ( str , null , null , true , 1 2 0 0 , null ) ;
var _ query = DbConnection . Query < HQHSettleQtyDiff > ( str , null , null , true , 1 2 0 0 , null ) ;
@ -137,9 +174,9 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
List < HQHSharePartSettledDetailDiff > _l ist = new List < HQHSharePartSettledDetailDiff > ( ) ;
List < HQHSharePartSettledDetailDiff > _l ist = new List < HQHSharePartSettledDetailDiff > ( ) ;
string condition = " " ;
//string condition = " where 1=1 ";
string condition = " " ;
if ( ! string . IsNullOrEmpty ( begin ) )
if ( ! string . IsNullOrEmpty ( begin ) )
{
{
@ -205,6 +242,10 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
return _l ist ;
return _l ist ;
}
}
}
}
public class HQHSharePartSettledDetailDiff
public class HQHSharePartSettledDetailDiff