@ -30,24 +30,31 @@ namespace SCP.Views.PlanData
return ;
return ;
}
}
BindFactory ( ) ;
BindFactory ( ) ;
BindArrive ( ) ;
BindArrive ( "1" ) ;
DP_StartDate . MaxDate = DateTime . Now ;
DP_StartDate . MinDate = DateTime . Now . AddYears ( - 1 ) ;
}
}
private void BindFactory ( )
private void BindFactory ( )
{
{
var _l s = ScpCache . FactoryList ;
var _l s = ScpCache . FactoryList ;
_l s = _l s . Where ( q = > CurrentUser . FactoryList . Contains ( q . FactoryId ) ) . ToList ( ) ;
_l s . Insert ( 0 , new TB_FACTORY ( ) { FactoryId = "" , FactoryName = "" } ) ;
_l s . Insert ( 0 , new TB_FACTORY ( ) { FactoryId = "" , FactoryName = "" } ) ;
factoryList . DataSource = _l s ;
factoryList . DataSource = _l s ;
factoryList . DataBind ( ) ;
factoryList . DataBind ( ) ;
}
}
public void BindArrive ( )
public void BindArrive ( string flag = "0" )
{
{
SearchV_TB_ARRIVEData ( ( result ) = >
if ( flag = = "0" )
{
{
Grid_V_TB_ARRIVE . RecordCount = result . Count ( ) ;
SearchV_TB_ARRIVEData ( ( result ) = >
var list = SortAndPage < V_TB_ARRIVE > ( result , Grid_V_TB_ARRIVE ) ;
{
Grid_V_TB_ARRIVE . DataSource = list ;
Grid_V_TB_ARRIVE . RecordCount = result . Count ( ) ;
Grid_V_TB_ARRIVE . DataBind ( ) ;
var list = SortAndPage < V_TB_ARRIVE > ( result , Grid_V_TB_ARRIVE ) ;
} ) ;
Grid_V_TB_ARRIVE . DataSource = list ;
Grid_V_TB_ARRIVE . DataBind ( ) ;
} ) ;
}
}
}
public void SearchV_TB_ARRIVEData ( Action < IQueryable < V_TB_ARRIVE > > p_action )
public void SearchV_TB_ARRIVEData ( Action < IQueryable < V_TB_ARRIVE > > p_action )
@ -78,6 +85,10 @@ namespace SCP.Views.PlanData
{
{
_ entity . SubSite = factoryList . SelectedValue ;
_ entity . SubSite = factoryList . SelectedValue ;
}
}
else if ( string . IsNullOrEmpty ( factoryList . SelectedValue ) )
{
_ entity . Site = CurrentUser . UsedDomain ;
}
if ( ! string . IsNullOrEmpty ( DDL_BillState . SelectedValue ) )
if ( ! string . IsNullOrEmpty ( DDL_BillState . SelectedValue ) )
{
{
_ entity . BillType_DESC = DDL_BillState . SelectedValue ;
_ entity . BillType_DESC = DDL_BillState . SelectedValue ;
@ -86,10 +97,18 @@ namespace SCP.Views.PlanData
{
{
_ entity . BeginTime = DP_StartDate . SelectedDate ;
_ entity . BeginTime = DP_StartDate . SelectedDate ;
}
}
else
{
_ entity . BeginTime = DateTime . Now . AddYears ( - 1 ) ;
}
if ( DP_StartDate . SelectedDate ! = null )
if ( DP_StartDate . SelectedDate ! = null )
{
{
_ entity . EndTime = Date_EndDate . SelectedDate ;
_ entity . EndTime = Date_EndDate . SelectedDate ;
}
}
else
{
_ entity . EndTime = DateTime . Now ;
}
_ entity . UserInAddress = CurrentUser . FactoryList ;
_ entity . UserInAddress = CurrentUser . FactoryList ;
_ entity . UserInVendIds = CurrentUser . VenderList ;
_ entity . UserInVendIds = CurrentUser . VenderList ;
_ entity . UserInSubSite = CurrentUser . SubSiteList ;
_ entity . UserInSubSite = CurrentUser . SubSiteList ;
@ -122,7 +141,11 @@ namespace SCP.Views.PlanData
}
}
protected void Grid_V_TB_ARRIVE_PageIndexChange ( object sender , GridPageEventArgs e )
protected void Grid_V_TB_ARRIVE_PageIndexChange ( object sender , GridPageEventArgs e )
{
{
BindArrive ( ) ;
if ( Grid_V_TB_ARRIVE . RecordCount ! = 0 )
{
BindArrive ( ) ;
}
}
}
protected void Grid_V_TB_ARRIVE_RowDataBound ( object sender , GridRowEventArgs e )
protected void Grid_V_TB_ARRIVE_RowDataBound ( object sender , GridRowEventArgs e )
{
{
@ -130,7 +153,10 @@ namespace SCP.Views.PlanData
}
}
protected void Grid_V_TB_ARRIVE_Sort ( object sender , GridSortEventArgs e )
protected void Grid_V_TB_ARRIVE_Sort ( object sender , GridSortEventArgs e )
{
{
BindArrive ( ) ;
if ( Grid_V_TB_ARRIVE . RecordCount ! = 0 )
{
BindArrive ( ) ;
}
}
}
protected void btnShow_Click ( object sender , EventArgs e )
protected void btnShow_Click ( object sender , EventArgs e )
{
{
@ -147,7 +173,10 @@ namespace SCP.Views.PlanData
protected void ddlGridPageSize_SelectedIndexChanged ( object sender , EventArgs e )
protected void ddlGridPageSize_SelectedIndexChanged ( object sender , EventArgs e )
{
{
Grid_V_TB_ARRIVE . PageSize = Convert . ToInt32 ( ddlGridPageSize . SelectedValue ) ;
Grid_V_TB_ARRIVE . PageSize = Convert . ToInt32 ( ddlGridPageSize . SelectedValue ) ;
BindArrive ( ) ;
if ( Grid_V_TB_ARRIVE . RecordCount ! = 0 )
{
BindArrive ( ) ;
}
}
}
protected void Window1_Close ( object sender , WindowCloseEventArgs e )
protected void Window1_Close ( object sender , WindowCloseEventArgs e )
{
{
@ -155,21 +184,67 @@ namespace SCP.Views.PlanData
}
}
protected void btnOutput_OnClick ( object sender , EventArgs e )
protected void btnOutput_OnClick ( object sender , EventArgs e )
{
{
List < string > _l s = new List < string > ( ) ;
if ( Grid_V_TB_ARRIVE . RecordCount = = 0 )
SearchV_TB_ARRIVEData ( rs = > {
{
_l s = rs . Select ( p = > p . ArrvBillNum ) . ToList ( ) ;
Alert . Show ( "请先完成查询后再进行导出!" ) ;
DataSet ds = null ;
return ;
if ( CurrentUser . VenderList . Count > 0 )
}
{
V_TB_ARRIVE _ entity = new V_TB_ARRIVE ( ) ;
ds = SCP_EXCEL_CONTROLLER . GET_ARRIVE_EXECEL ( _l s , CurrentUser . VenderList . FirstOrDefault ( ) ) ;
_ entity . IsDeleted = false ;
}
if ( ! string . IsNullOrEmpty ( TXT_BillNo . Text ) )
else
{
{
_ entity . PoBillNum = TXT_BillNo . Text ;
ds = SCP_EXCEL_CONTROLLER . GET_ARRIVE_EXECEL ( _l s ) ;
}
}
if ( ! string . IsNullOrEmpty ( TXT_ArriveBill . Text ) )
{
PageBase . DataSetToExcel ( ds , "到货单" ) ;
_ entity . ArrvBillNum = TXT_ArriveBill . Text ;
} ) ;
}
if ( ! string . IsNullOrEmpty ( TXT_AsnBill . Text ) )
{
_ entity . AsnBillNum = TXT_AsnBill . Text ;
}
if ( ! string . IsNullOrEmpty ( TXT_AskBill . Text ) )
{
_ entity . AskBillNum = TXT_AskBill . Text ;
}
if ( ! string . IsNullOrEmpty ( TXT_VendId . Text ) )
{
_ entity . VendId = TXT_VendId . Text ;
}
if ( ! string . IsNullOrEmpty ( factoryList . SelectedValue ) )
{
_ entity . SubSite = factoryList . SelectedValue ;
}
else if ( string . IsNullOrEmpty ( factoryList . SelectedValue ) )
{
_ entity . Site = CurrentUser . UsedDomain ;
}
if ( ! string . IsNullOrEmpty ( DDL_BillState . SelectedValue ) )
{
_ entity . BillType_DESC = DDL_BillState . SelectedValue ;
}
if ( DP_StartDate . SelectedDate ! = null )
{
_ entity . BeginTime = DP_StartDate . SelectedDate ;
}
else
{
_ entity . BeginTime = DateTime . Now . AddYears ( - 1 ) ;
}
if ( DP_StartDate . SelectedDate ! = null )
{
_ entity . EndTime = Date_EndDate . SelectedDate ;
}
else
{
_ entity . EndTime = DateTime . Now ;
}
_ entity . UserInAddress = CurrentUser . FactoryList ;
_ entity . UserInVendIds = CurrentUser . VenderList ;
_ entity . UserInSubSite = CurrentUser . SubSiteList ;
DataSet ds = null ;
ds = SCP_EXCEL_CONTROLLER . GET_ARRIVE_EXECELBycondition ( _ entity ) ;
PageBase . DataSetToExcel ( ds , "到货单" ) ;
}
}
}
}
}
}