@ -298,6 +298,38 @@ namespace XGLFinishPro.Views
dgUserInfo . Items . Refresh ( ) ;
}
/// <summary>
/// 全选/取消全选
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void cf_all_Click ( object sender , RoutedEventArgs e )
{
CheckBox cb = sender as CheckBox ;
bool isChecked = cb . IsChecked = = true ;
foreach ( var item in MainGrid . Items )
{
sys_user curRow = item as sys_user ;
curRow . IsChecked = isChecked ;
if ( isChecked )
{
if ( ! checkedRowsCache . Contains ( curRow ) )
{
checkedRowsCache . Add ( curRow ) ;
}
}
else
{
if ( checkedRowsCache . Contains ( curRow ) )
{
checkedRowsCache . Remove ( curRow ) ;
}
}
}
MainGrid . Items . Refresh ( ) ;
}
private void dgUserInfo_CellEditEnding ( object sender , DataGridCellEditEndingEventArgs e )
{
@ -376,6 +408,41 @@ namespace XGLFinishPro.Views
curRow . IsChecked = false ;
}
}
private void cf_child_Click ( object sender , RoutedEventArgs e )
{
CheckBox cb = e . Source as CheckBox ;
bool isChecked ;
isChecked = cb . IsChecked = = true ? true : false ;
sys_user curRow = ( MainGrid . CurrentItem as sys_user ) ;
if ( isChecked )
{
//this.chkPrintBatch.IsChecked = false;
foreach ( var item in MainGrid . Items )
{
// DataGridTemplateColumn templeColumn = dgUserInfo.Columns[0] as DataGridTemplateColumn;
// FrameworkElement fwElement = dgUserInfo.Columns[0].GetCellContent(item);
// CheckBox cBox = templeColumn.CellTemplate.FindName("cb_child", fwElement) as CheckBox;
// //循环的行
// //DataRow tempRow = (item as DataRowView).Row;
// cBox.IsChecked = false;
}
checkedRowsCache . Add ( curRow ) ;
cb . IsChecked = true ;
curRow . IsChecked = true ;
}
else
{
checkedRowsCache . Remove ( curRow ) ;
cb . IsChecked = false ;
curRow . IsChecked = false ;
}
}
private CheckBox _previousCheckBox = null ;
private void cb_child_Click_1 ( object sender , RoutedEventArgs e )
{
@ -426,6 +493,7 @@ namespace XGLFinishPro.Views
private void txtP_TextChanged ( object sender , TextChangedEventArgs e )
{
btnQueryUser_Click ( null , null ) ;
GetDataFZ ( ) ;
}
private void btnUserConfirm_Click ( object sender , RoutedEventArgs e )
@ -463,7 +531,12 @@ namespace XGLFinishPro.Views
{
item . attr2 = "0" ;
}
string sql = prodDBService . GetCreateUnitPriceInfo ( item , _workOrderCode , _sapWorkOrderCode , _productCode , _productName , _childprocessCode , _childprocessName , sapCode , item . number , LoginUser . WorkDate , item . attr2 , item . post ) ;
string attr3 = "" ;
if ( item . user_m_type = = "f" )
{
attr3 = "1" ;
}
string sql = prodDBService . GetCreateUnitPriceInfo ( item , _workOrderCode , _sapWorkOrderCode , _productCode , _productName , _childprocessCode , _childprocessName , sapCode , item . number , LoginUser . WorkDate , item . attr2 , item . post , attr3 ) ;
CreateUnitPriceSqlList . Add ( sql ) ;
}
//if (!name.IsNullOrEmpty())
@ -595,26 +668,14 @@ namespace XGLFinishPro.Views
private void GetDataFZ ( )
{
string type = "" ;
if ( this . UserType . SelectionBoxItem ! = null & & this . UserType . SelectionBoxItem . ToString ( ) = = "辅助人员" )
string type = "f" ;
users = usdb . GetUsers ( "" , type , 0 , 10000 ) ;
string queryP = this . txtP . Text . Trim ( ) ;
if ( ! string . IsNullOrEmpty ( queryP ) )
{
type = "f" ;
users = users . Where ( t = > t . nick_name . Contains ( queryP ) | | t . user_name . Contains ( queryP ) ) . ToList ( ) ;
}
else if ( this . UserType . SelectionBoxItem ! = null & & this . UserType . SelectionBoxItem . ToString ( ) = = "管理人员" )
{
type = "g" ;
}
else
{
type = "" ;
}
users = usdb . GetUsers ( this . RealName . Text , type , 0 , 10000 ) ;
users . ForEach ( t = >
{
t . user_m_type = t . user_m_type = = "f" ? "辅助人员" : t . user_m_type = = "g" ? "管理人员" : t . user_m_type = = "p" ? "一线员工" : "其他" ;
} ) ;
usdb . GetUsersCount ( this . RealName . Text , type , out var Count ) ;
PageMax = Count / PageSize + ( Count % PageSize > 0 ? 1 : 0 ) ;
this . MainGrid . ItemsSource = users ;
}