1 year ago
parent 21f8c47d48
commit 98689350a2

@ -1581,8 +1581,8 @@ where machine_code = 'X1' and bind_status = '0' order by update_time DESC";
public int InsertMesUnitPriceReport(string user_name, string nick_name, string post, string gs, string kk, string remark, string deviceCode, string product_code, string product_name, string childprocess_code, string childprocess_name, string workorder_code, string workorder_code_sap, string workDate, string attr1) public int InsertMesUnitPriceReport(string user_name, string nick_name, string post, string gs, string kk, string remark, string deviceCode, string product_code, string product_name, string childprocess_code, string childprocess_name, string workorder_code, string workorder_code_sap, string workDate, string attr1)
{ {
string sql = $@"insert into mes_unitprice_report (id,workorder_code,workorder_code_sap,product_name,product_code,childprocess_code,childprocess_name,user_name,nick_name,create_time,line_code,post,kk,attr2,remark,work_order_product_date,attr1) string sql = $@"insert into mes_unitprice_report (id,workorder_code,workorder_code_sap,product_name,product_code,childprocess_code,childprocess_name,user_name,nick_name,create_time,line_code,post,kk,attr2,remark,work_order_product_date,attr1,attr3)
values ('{Guid.NewGuid().ToString().Substring(0, 32)}','{workorder_code}','{workorder_code_sap}','{product_name}','{product_code}','{childprocess_code}','{childprocess_name}','{user_name}','{nick_name}',GetDate(),'{deviceCode}','{post}',{kk},'{gs}','{remark}','{workDate}','{attr1}')"; values ('{Guid.NewGuid().ToString().Substring(0, 32)}','{workorder_code}','{workorder_code_sap}','{product_name}','{product_code}','{childprocess_code}','{childprocess_name}','{user_name}','{nick_name}',GetDate(),'{deviceCode}','{post}',{kk},'{gs}','{remark}','{workDate}','{attr1}','f')";
return Utils.netClientDBHelper.executeUpdate(sql); return Utils.netClientDBHelper.executeUpdate(sql);
} }
} }

@ -805,7 +805,7 @@ where line_code = '{deviceCode}' and CONVERT(VARCHAR(10), Create_time , 120) = C
/// </summary> /// </summary>
/// <param name="item"></param> /// <param name="item"></param>
/// <exception cref="NotImplementedException"></exception> /// <exception cref="NotImplementedException"></exception>
public string GetCreateUnitPriceInfo(sys_user item, string workorderCode, string sapWorkorderCode, string productCode, string productName, string childProcessCode, string childProcessName, string deviceCode, string number, string credata, string attr2, string post) public string GetCreateUnitPriceInfo(sys_user item, string workorderCode, string sapWorkorderCode, string productCode, string productName, string childProcessCode, string childProcessName, string deviceCode, string number, string credata, string attr2, string post,string attr3="")
{ {
string sql = $@"INSERT INTO [dbo].[mes_unitprice_report] ( string sql = $@"INSERT INTO [dbo].[mes_unitprice_report] (
[id],[workorder_code], [workorder_code_sap], [product_name], [product_code], [id],[workorder_code], [workorder_code_sap], [product_name], [product_code],
@ -817,7 +817,7 @@ where line_code = '{deviceCode}' and CONVERT(VARCHAR(10), Create_time , 120) = C
( (
'{Common.GetUUID()}', '{workorderCode}','{sapWorkorderCode}', '{productName}', '{productCode}', '{Common.GetUUID()}', '{workorderCode}','{sapWorkorderCode}', '{productName}', '{productCode}',
N'{item.user_name}', N'{item.nick_name}', N'{childProcessCode}', N'{childProcessName}',' {number}', N'{item.user_name}', N'{item.nick_name}', N'{childProcessCode}', N'{childProcessName}',' {number}',
{attr2}, NULL, '{LoginUser.UserName}', '{DateTime.Now.ToString("G")}', NULL, {attr2}, '{attr3}', '{LoginUser.UserName}', '{DateTime.Now.ToString("G")}', NULL,
NULL, NULL,'{post}','{deviceCode}','{credata} 00:00:00' );"; NULL, NULL,'{post}','{deviceCode}','{credata} 00:00:00' );";
return sql; return sql;

@ -420,21 +420,13 @@
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="auto"/> <RowDefinition Height="auto"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Grid.ColumnSpan="3">
<TextBlock Text="姓名:" VerticalAlignment="Center" Margin="10,0,0,0"/>
<TextBox x:Name="RealName" VerticalAlignment="Center" Width="150"/>
<TextBlock Text="类型:" VerticalAlignment="Center" Margin="10,0,0,0"/>
<ComboBox x:Name="UserType" VerticalAlignment="Center" Width="150" hc:InfoElement.ShowClearButton="True">
<ComboBoxItem Content="辅助人员"/>
<ComboBoxItem Content="管理人员"/>
<ComboBoxItem Content="其他"/>
</ComboBox>
<Button x:Name="QueryBtn" Background="#2B7EE6" Foreground="White" Content="查询" Click="QueryBtn_Click"/>
<Button x:Name="AddBtn" Background="#2B7EE6" Foreground="White" Content="计件信息填写" Margin="10,0,0,0" Click="AddBtn_Click"/>
</StackPanel>
<DataGrid <DataGrid
Grid.Row="1" Grid.Column ="0" Grid.Row="1" Grid.Column ="0"
x:Name="MainGrid" x:Name="MainGrid"
MinWidth="200"
MinHeight="260"
Width="560"
Height="340"
RowStyle="{StaticResource DataGridRowStyle}" RowStyle="{StaticResource DataGridRowStyle}"
Margin="10,0,0,0" Margin="10,0,0,0"
MaxHeight="400" MaxHeight="400"
@ -445,7 +437,7 @@
HorizontalAlignment="Left" HorizontalAlignment="Left"
VerticalAlignment="Top" VerticalContentAlignment="Center" VerticalAlignment="Top" VerticalContentAlignment="Center"
AutoGenerateColumns="False" CanUserAddRows="False" SelectionMode="Extended" SelectionUnit="FullRow" SelectionChanged="dgUserInfo_SelectionChanged" AutoGenerateColumns="False" CanUserAddRows="False" SelectionMode="Extended" SelectionUnit="FullRow" SelectionChanged="dgUserInfo_SelectionChanged"
CellEditEnding="dgUserInfo_CellEditEnding" Grid.ColumnSpan="3"> CellEditEnding="dgUserInfo_CellEditEnding">
<DataGrid.ColumnHeaderStyle > <DataGrid.ColumnHeaderStyle >
<Style TargetType="DataGridColumnHeader"> <Style TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment" Value="Center" /> <Setter Property="HorizontalContentAlignment" Value="Center" />
@ -457,9 +449,12 @@ CellEditEnding="dgUserInfo_CellEditEnding" Grid.ColumnSpan="3">
</DataGrid.ColumnHeaderStyle> </DataGrid.ColumnHeaderStyle>
<DataGrid.Columns> <DataGrid.Columns>
<DataGridTemplateColumn Width="50"> <DataGridTemplateColumn Width="50">
<DataGridTemplateColumn.Header>
<CheckBox x:Name="cf_all" Click="cf_all_Click" HorizontalAlignment="Center" VerticalAlignment="Center" />
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellTemplate>
<DataTemplate> <DataTemplate>
<CheckBox x:Name="cb_child" Click="cb_child_Click" IsChecked="{Binding IsChecked}" HorizontalAlignment="Left" VerticalAlignment="Center" VerticalContentAlignment="Center" Margin="15,0,0,0"/> <CheckBox x:Name="cf_child" Click="cf_child_Click" IsChecked="{Binding IsChecked}" HorizontalAlignment="Left" VerticalAlignment="Center" VerticalContentAlignment="Center" Margin="15,0,0,0"/>
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn> </DataGridTemplateColumn>

@ -298,6 +298,38 @@ namespace XGLFinishPro.Views
dgUserInfo.Items.Refresh(); 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) private void dgUserInfo_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{ {
@ -376,6 +408,41 @@ namespace XGLFinishPro.Views
curRow.IsChecked = false; 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 CheckBox _previousCheckBox = null;
private void cb_child_Click_1(object sender, RoutedEventArgs e) 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) private void txtP_TextChanged(object sender, TextChangedEventArgs e)
{ {
btnQueryUser_Click(null, null); btnQueryUser_Click(null, null);
GetDataFZ();
} }
private void btnUserConfirm_Click(object sender, RoutedEventArgs e) private void btnUserConfirm_Click(object sender, RoutedEventArgs e)
@ -463,7 +531,12 @@ namespace XGLFinishPro.Views
{ {
item.attr2 = "0"; 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); CreateUnitPriceSqlList.Add(sql);
} }
//if (!name.IsNullOrEmpty()) //if (!name.IsNullOrEmpty())
@ -595,26 +668,14 @@ namespace XGLFinishPro.Views
private void GetDataFZ() private void GetDataFZ()
{ {
string type = ""; string type = "f";
if (this.UserType.SelectionBoxItem != null && this.UserType.SelectionBoxItem.ToString() == "辅助人员")
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; this.MainGrid.ItemsSource = users;
} }

Loading…
Cancel
Save