@ -1150,6 +1150,137 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
/// <param name="state"></param>
/// <returns></returns>
public virtual List < WmsOutputtSearchWithCode > GetWmsSearchWithCodeReportList ( string CNumber , string materialCode )
{
if ( string . IsNullOrEmpty ( CNumber ) )
{
throw new BusinessException ( "001" , "通用代码号不能为空!" ) ;
}
string getcnumber = "" ;
var _ cnumbersList = CNumber . Split ( new char [ ] { '\n' } ) . Distinct ( ) . ToList ( ) ;
foreach ( var cnumber in _ cnumbersList )
{
getcnumber + = "'" + cnumber . ToString ( ) . Trim ( ) + "'" + "," ;
}
getcnumber = getcnumber . TrimEnd ( ',' ) ;
var _ sql = "SELECT\n" +
" ROW_NUMBER ( ) OVER ( ORDER BY Type DESC ) 行号 ,\n" +
" temp1.Client 客户,\n" +
" temp1.Type 出库类型,\n" +
" temp1.BillNum 结算单,\n" +
" temp1.MaterialCode 物料号,\n" +
" temp1.CNumber 通用代码号,\n" +
" Isnull( temp1.Qty, 0 ) 结算数量,\n" +
" Isnull( temp1.OutputQty, 0 ) 实际出库数量,\n" +
" Isnull( temp1.Qty, 0 ) - Isnull( temp1.OutputQty, 0 ) 差异数量,\n" +
" temp1.Price 开票单价,\n" +
" Round( Isnull( temp1.Qty, 0 ) * temp1.Price, 2 ) 结算金额,\n" +
" Round( ( Isnull( temp1.Qty, 0 ) - Isnull( temp1.OutputQty, 0 ) ) * temp1.Price, 2 ) WMS待出库金额,\n" +
" temp2.EstimateType 物料组编码,\n" +
" temp2.EstimateTypeDesc 物料组车型,\n" +
" temp2.MaterialDesc 物料描述,\n" +
" temp1.remark 备注 \n" +
"FROM\n" +
" (\n" +
" SELECT\n" +
" '大众准时化出库' AS Type,\n" +
" '大众' Client,\n" +
" BillNum,\n" +
" MaterialCode,\n" +
" Qty,\n" +
" 0 OutputQty,\n" +
" 0 IsBack,\n" +
" Price,\n" +
" ChassisNumber CNumber,\n" +
" Remark \n" +
" FROM\n" +
" Set_WmsJitOutPutDetial \n" +
" WHERE\n" +
" ChassisNumber IN ({0}) \n" +
" AND State = 2 UNION ALL\n" +
" SELECT\n" +
" '大众看板出库' AS Type,\n" +
" '大众' Client,\n" +
" BillNum,\n" +
" MaterialCode,\n" +
" Qty Qty,\n" +
" 0 OutputQty,\n" +
" 0 IsBack,\n" +
" Price,\n" +
" Kanban CNumber,\n" +
" Remark \n" +
" FROM\n" +
" Set_WmsKanbanOutPutDetial \n" +
" WHERE\n" +
" Kanban IN ({0}) \n" +
" AND State = 2 UNION ALL\n" +
" SELECT\n" +
" '大众备件条码出库' AS Type,\n" +
" '大众' Client,\n" +
" BillNum,\n" +
" MaterialCode,\n" +
" Qty Qty,\n" +
" 0 OutPutQty,\n" +
" 1 IsBack,\n" +
" Price,\n" +
" OrderBillNum CNumber,\n" +
" Remark \n" +
" FROM\n" +
" Set_WmsSharePart90OutPutDetial \n" +
" WHERE\n" +
" OrderBillNum IN ({0}) \n" +
" AND State = 2 UNION ALL\n" +
" SELECT\n" +
" '红旗看板出库' AS Type,\n" +
" '红旗' Client,\n" +
" BillNum,\n" +
" MaterialCode,\n" +
" Qty Qty,\n" +
" 0 OutPutQty,\n" +
" 0 IsBack,\n" +
" Price,\n" +
" Kanban CNumber,\n" +
" Remark \n" +
" FROM\n" +
" Set_WmsHQHKanbanOutPutDetial \n" +
" WHERE\n" +
" Kanban IN ({0}) \n" +
" AND State = 2 \n" +
" UNION ALL SELECT\n" +
" '自定义发货出库' AS Type,\n" +
" customercode Client,\n" +
" BillNum,\n" +
" SapMaterialCode,\n" +
" Qty Qty,\n" +
" Qty OutputQty,\n" +
" '0' IsBack,\n" +
" Price,\n" +
" Kanban CNumber,\n" +
" Remark \n" +
" FROM\n" +
" Set_WmsCustomerKanbanOutPutDetial \n" +
" WHERE\n" +
" Kanban IN ({0}) \n" +
" AND State = 2\n" +
" \n" +
" ) temp1\n" +
" LEFT JOIN ( SELECT MAX ( Id ) Id, MaterialCode, MaterialDesc, EstimateType, EstimateTypeDesc FROM Set_material GROUP BY MaterialCode, MaterialDesc, EstimateTypeDesc, EstimateType ) temp2 ON temp1.MaterialCode = temp2.MaterialCode" ;
_ sql = string . Format ( _ sql , getcnumber ) ;
var _ query = DbConnection . Query < WmsOutputtSearchWithCode > ( _ sql , null , null , true , 1 2 0 0 , null ) ;
var _l s = _ query . ToList ( ) ;
return _l s ;
}
public virtual List < WmsOutputtSearchWithCode > GetWmsSearchWithCodeReportList1 ( string CNumber , string materialCode )
{
if ( string . IsNullOrEmpty ( CNumber ) )
@ -1159,10 +1290,18 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
string getcnumber = "" ;
var _ org_cnumbersList = CNumber . Split ( new char [ ] { '\n' } ) . Distinct ( ) . ToList ( ) ;
var _ cnumbersList = _ org_cnumbersList [ 0 ] . Replace ( "\\n" , "," ) . TrimEnd ( ',' ) . Split ( ',' ) ;
if ( _ cnumbersList . Count ( ) = = 1 )
{
getcnumber = "'" + _ org_cnumbersList [ 0 ] . Replace ( "\\n" , "" ) + "'" ;
}
else
{
foreach ( var cnumber in _ cnumbersList )
{
getcnumber + = "'" + cnumber . ToString ( ) . Trim ( ) + "'" + "," ;
}
getcnumber = getcnumber . TrimEnd ( ',' ) ;
}
var _ sql = "SELECT\n" +
" ROW_NUMBER ( ) OVER ( ORDER BY Type DESC ) 行号 ,\n" +
" temp1.Client 客户,\n" +
@ -1269,7 +1408,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
_ sql = string . Format ( _ sql , getcnumber . TrimEnd ( ',' ) ) ;
_ sql = string . Format ( _ sql , getcnumber ) ;
var _ query = DbConnection . Query < WmsOutputtSearchWithCode > ( _ sql , null , null , true , 1 2 0 0 , null ) ;