完善打卡,计件薪酬

master
zhaojian 1 year ago
parent 223dae62a2
commit 97ca6f96af

@ -94,7 +94,38 @@ namespace XGL.Dats.DBServiceFinishProd
/// <returns></returns>
public DataTable GetUserInfoFromCloudServer(string userID)
{
string sql = $@"SELECT user_name,nick_name,sex FROM [dbo].[sys_user] where del_flag = '0' and pe_snr = '{userID}'";
string sql = $@"SELECT user_name,nick_name,sex FROM [dbo].[sys_user] where del_flag = '0' and pe_snr like '%{userID}%'";
DataSet dtset = Utils.cloudDBHelper.getDataSet(sql);
if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0)
{
return dtset.Tables[0];
}
return null;
}
/// <summary>
/// 刷卡功能用户编码打卡
/// </summary>
/// <param name="userID"></param>
/// <returns></returns>
public DataTable GetUserCodeServer(string userID)
{
string sql = $@"SELECT user_name,nick_name,sex FROM [dbo].[sys_user] where del_flag = '0' and user_name = '{userID}'";
DataSet dtset = Utils.cloudDBHelper.getDataSet(sql);
if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0)
{
return dtset.Tables[0];
}
return null;
}
/// <summary>
/// 找出所有的打卡人员
/// </summary>
/// <param name="userID"></param>
/// <returns></returns>
public DataTable GetUserCodeServerAll()
{
string sql = $@"SELECT user_name,nick_name,sex FROM [dbo].[sys_user] where del_flag = '0'";
DataSet dtset = Utils.cloudDBHelper.getDataSet(sql);
if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0)
{
@ -620,7 +651,7 @@ workorder.unit,workorder.shift_id ,batch.batch_code,batch.batch_quantity,sort_no
from pro_order_workorder workorder WITH (NOLOCK)
left JOIN base_shifts_t shifts WITH (NOLOCK) on workorder.shift_id = shifts.shift_id
left JOIN pro_order_workorder_batch batch WITH (NOLOCK) on workorder.workorder_id = batch.workorder_id
LEFT JOIN ( SELECT * FROM qc_check_task WHERE check_type='checkTypeCPPC' ) chack ON batch.batch_code = chack.income_batch_no
LEFT JOIN ( SELECT * FROM qc_check_task WHERE check_type='checkTypeCPPC' AND del_flag =0) chack ON workorder.workorder_code = chack.order_no AND batch.batch_code = chack.income_batch_no
left join (SELECT sum(quantity_feedback) as batchQty,workorder_code,batch FROM [dbo].[mes_report_work] where del_flag = 0 GROUP BY workorder_code,batch) qty on qty.workorder_code = workorder.workorder_code and batch.batch_code = qty.batch
where 1=1 and batch.del_flag = 0 and workorder.del_flag = 0 and
workorder.parent_order ='0' and CONVERT(VARCHAR(10), workorder.product_date , 120)= CONVERT(VARCHAR(10), '{date}' , 120) and workorder.prod_line_code like '%{deviceCode}%' order by sort_no,batch_code";
@ -641,7 +672,7 @@ where 1=1 and batch.del_flag = 0 and workorder.del_flag = 0 and
/// <returns></returns>
public DataTable GetProductStepListInfo(string deviceCode, string productCode)
{
string sql = $@"SELECT childprocess_code,childprocess_name FROM [dbo].[mes_unit_price]
string sql = $@"SELECT childprocess_code,childprocess_name,attr1 FROM [dbo].[mes_unit_price]
where product_code = '{productCode.Replace("0000000","")}' and line_code = '{deviceCode}' ORDER BY childprocess_code";
DataSet dtset = Utils.netClientDBHelper.getDataSet(sql);
@ -677,7 +708,7 @@ where 1=1 and
/// <returns></returns>
public DataTable GetUnitPriceData(string deviceCode ,string sheredata)
{
string sql = $@"select [workorder_code], [workorder_code_sap], [product_name], SUBSTRING([product_code], 8, LEN(product_code)) as product_code, [user_name], [nick_name], [childprocess_code], [childprocess_name] ,[create_by], [create_time], [line_code] ,[attr1]
string sql = $@"select [workorder_code], [workorder_code_sap], [product_name], SUBSTRING([product_code], 8, LEN(product_code)) as product_code, [user_name], [nick_name], [childprocess_code], [childprocess_name] ,[create_by], [create_time], [line_code] ,[attr1],[attr2]
from mes_unitprice_report
where line_code = '{deviceCode}' AND create_time BETWEEN '{sheredata} 00:00:00' AND '{sheredata} 23:59:59' ORDER BY childprocess_code,create_time";
@ -1024,7 +1055,17 @@ where detail.parent_work_order = '{processid}'"; //where CONVERT(VARCHAR(10), w
return Utils.netClientDBHelper.executeUpdate(sql1) > 0 ? true : false;
}
/// <summary>
/// 删除打卡
/// </summary>
/// <returns></returns>
public bool Updaterdaka(string userId, string startAddr, string data)
{
string sql1 = $@"DELETE FROM mes_attendance_records WHERE user_id='{userId}' AND start_addr='{startAddr}'AND attendance_date='{data}' ";
return Utils.netClientDBHelper.executeUpdate(sql1) > 0 ? true : false;
}
/// <summary>
/// 写入开始、报工状态
/// </summary>

@ -10,7 +10,7 @@
<!--车间编码-->
<add key="SiteCode" value="1000" />
<!--设备编码-->
<add key="DeviceCode" value="XL08" />
<add key="DeviceCode" value="XL09" />
<!--上位机类型 0:工单准备1成型机\shoupei2烘房,3:人员登录,4:称重系统-->
<add key="ClientMode" value="1" />

@ -392,7 +392,7 @@ namespace XGLFinishPro.Views
createCheckProductTask createCheckProductTask = new createCheckProductTask();
createCheckProductTask.factoryCode = Utils.GetAppSetting("SiteCode");//工厂编码
createCheckProductTask.incomeBatchNo = comboBoxBatch.Text.ToString();//批次号
createCheckProductTask.orderNo = lbCurrOrderNo.Content.ToString();//订单号
createCheckProductTask.orderNo = selectedRow["workorder_code"].ToString();//订单号
if (getorder != null && getorder.Rows.Count > 0)
{
createCheckProductTask.materialCode = getorder.Rows[0]["product_code"].ToString(); ;//物料编码
@ -427,11 +427,14 @@ namespace XGLFinishPro.Views
// 获取响应内容
string responseBody = response.Content.ReadAsStringAsync().Result; // 或者 .Wait();
CustomMessageBox.Show("批次成品检验任务创建成功!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning, 2000);
LogHelper.instance.log.Error("批次成品检验任务创建成功~即将准备更改工单状态");
return AddConsumInfo(reportWorkSqlList, newReportCode);
}
else
{
// 输出失败信息
CustomMessageBox.Show("批次成品入库检验任务创建接口调用失败!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning, 3000);
CustomMessageBox.Show("批次成品入库检验任务创建接口调用失败,请咨询开发人员", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning, 3000);
LogHelper.instance.log.Error("批次成品入库检验任务创建接口返回失败!");
}
}
}
@ -441,9 +444,9 @@ namespace XGLFinishPro.Views
CustomMessageBox.Show("批次成品入库检验任务创建接口调用失败:" + ex.Message, CustomMessageBoxButton.OK, CustomMessageBoxIcon.Error);
}
}
return false;
//if (result.code == 200)
//{
return AddConsumInfo(reportWorkSqlList, newReportCode);
//}
//else
//{
@ -478,6 +481,7 @@ namespace XGLFinishPro.Views
string insertConsumeSql = formingMachineService.GetInsertConsumeInfoSql(selectedConsumeRow, newReportCode, _siteCode);
reportWorkSqlList.Add(insertConsumeSql);
LogHelper.instance.log.Error("报工SQL生成"+ insertConsumeSql);
//// 获取 DataGridRow
//var dataGridRow = dgConsumeInfo.ItemContainerGenerator.ContainerFromItem(row) as DataGridRow;
@ -507,10 +511,12 @@ namespace XGLFinishPro.Views
//}
}
}
LogHelper.instance.log.Error("准备执行插入SQL"+ reportWorkSqlList.Count+"条");
bool isReportSuccess = formingMachineService.GetExecuteReportWorkSql(reportWorkSqlList);
if (isReportSuccess)
{
LogHelper.instance.log.Error("完成插入!");
}
return isReportSuccess; ;
}

@ -493,7 +493,6 @@ namespace XGLFinishPro.Views
CustomMessageBox.Show("你选择的工单不能报工,请检查工单状态,当前工单状态为:"+ st, CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
return;
}
//20240424预报工功能不能限制批次报工次数
//if (selectedRow["batchStatus"].ToString().Equals("0"))
//{

@ -6,10 +6,10 @@
xmlns:local="clr-namespace:XGLFinishPro.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" Loaded="UserControl_Loaded"
VerticalAlignment="Stretch" Loaded="UserControl_Loaded"
mc:Ignorable="d">
<UserControl.Resources>
<Style TargetType="TextBox">
<Style TargetType="TextBox" >
<Setter Property="FontSize" Value="18"/>
<Setter Property="Width" Value="280"/>
<Setter Property="Height" Value="50"/>
@ -71,13 +71,30 @@
<TextBlock
FontSize="22"
FontWeight="Bold"
Text=" 打卡:" />
Text=" 员工打卡:" />
</Label>
<TextBox Name="txtOnWorkUserID" KeyDown="txtOnWorkUserID_KeyDown"/>
</StackPanel>
<StackPanel Grid.Row="0" Orientation="Horizontal" Margin="525,0,0,0">
<Label
Grid.Row="0"
Width="175"
Height="37"
Margin="25,20,0,25"
HorizontalAlignment="Left"
VerticalAlignment="Center">
<TextBlock
FontSize="22"
FontWeight="Bold"
Text=" 工号打卡:" />
</Label>
<TextBox Name="txtOnWorkUsername" KeyDown="txtOnWorkUsername_KeyDown" TextChanged="txtOnWorkUsername_TextChanged"/>
<Border Margin="30,17,0,17" Width="288" BorderThickness="1" BorderBrush="Gray" >
<Label Name="dakaname" FontSize="30" />
</Border>
</StackPanel>
<!--<Button
Grid.Row="0"

@ -29,6 +29,7 @@ namespace XGLFinishPro.Views
string deviceCode = Utils.GetAppSetting("DeviceCode");
public static LanJu_User lanJu_User;
Frame frame = new Frame() { Content = new Views.LanJu_UserRecord() };
List<useralldaka> listuserall=new List<useralldaka>();
public enum WindowID
{
frame
@ -38,6 +39,17 @@ namespace XGLFinishPro.Views
InitializeComponent();
lanJu_User = this;
WindowChange(WindowID.frame);
DataTable userall = finishProdDBService.GetUserCodeServerAll();
if (userall != null)
{
foreach (DataRow row in userall.Rows)
{
string userName = row["user_name"].ToString(); // 假设列名为 user_name
string nikeName = row["nick_name"].ToString(); // 假设列名为 nick_name
useralldaka user = new useralldaka { UserName = userName ,nikeName=nikeName};
listuserall.Add(user);
}
}
}
public void WindowChange(WindowID windowID)
@ -83,10 +95,12 @@ namespace XGLFinishPro.Views
string userName = dtUserInfo.Rows[0]["nick_name"].ToString();
string sex = dtUserInfo.Rows[0]["sex"].ToString();
DataTable dt = finishProdDBService.GetExistAttendanceRecord(deviceCode);
if (dt != null && dt.Select("user_id = '" + userCode + "' AND end_time IS NULL").Length > 0)
if (dt != null && dt.Select($"user_id = '" + userCode + "' AND end_time IS NULL and start_addr='"+ deviceCode + "'").Length > 0)
{
//2024-06-21陈恒杰说一天只需要一次打卡
CustomMessageBox.Show("一天只能打卡一次谢谢!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Success, 1500);
txtOnWorkUserID.Text = "";
txtOnWorkUserID.Focus();
//bool isSucc = finishProdDBService.UpdateAttendanceRecord(userCode, deviceCode);
//if (isSucc)
//{
@ -123,9 +137,107 @@ namespace XGLFinishPro.Views
}
}
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
txtOnWorkUserID.Focus();
}
/// <summary>
/// 20240627杨万里提出添加员工号打卡
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void txtOnWorkUsername_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
try
{
string userID = txtOnWorkUsername.Text;//20240628杨万里说员工号打卡不需要去0
DataTable dtUserInfo = finishProdDBService.GetUserCodeServer(userID);
if (dtUserInfo == null || dtUserInfo.Rows.Count <= 0)
{
CustomMessageBox.Show("找不到该账户,请重试!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning, 1500);
txtOnWorkUsername.Text = "";
txtOnWorkUsername.Focus();
return;
}
string userCode = dtUserInfo.Rows[0]["user_name"].ToString();
string userName = dtUserInfo.Rows[0]["nick_name"].ToString();
string sex = dtUserInfo.Rows[0]["sex"].ToString();
DataTable dt = finishProdDBService.GetExistAttendanceRecord(deviceCode);
if (dt != null && dt.Select($"user_id = '" + userCode + "' AND end_time IS NULL and start_addr='" + deviceCode + "'").Length > 0)
{
//2024-06-21陈恒杰说一天只需要一次打卡
CustomMessageBox.Show("一天只能打卡一次谢谢!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Success, 1500);
txtOnWorkUsername.Text = "";
txtOnWorkUsername.Focus();
dakaname.Content = null;
//bool isSucc = finishProdDBService.UpdateAttendanceRecord(userCode, deviceCode);
//if (isSucc)
//{
// CustomMessageBox.Show("打卡成功,再见!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Success,1500);
// Record_Click(null, null);
// txtOnWorkUserID.Text = "";
// txtOnWorkUserID.Focus();
// return;
//}
}
else
{
bool isSucc = finishProdDBService.InsertAttendanceRecord(userCode, userName, sex, deviceCode);
if (isSucc)
{
CustomMessageBox.Show("打卡成功,祝您工作愉快!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Success, 1500);
txtOnWorkUsername.Text = "";
txtOnWorkUsername.Focus();
dakaname.Content = null;
Record_Click(null, null);
}
else
{
CustomMessageBox.Show("打卡失败,请重试!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Error, 1500);
txtOnWorkUsername.Text = "";
dakaname.Content = null;
txtOnWorkUsername.Focus();
}
}
}
catch (Exception ex)
{
LogHelper.instance.log.Error("上班打卡发生异常>>" + ex.Message);
CustomMessageBox.Show("上班打卡发生异常!" + ex.Message, CustomMessageBoxButton.OK, CustomMessageBoxIcon.Error);
}
}
}
private void txtOnWorkUsername_TextChanged(object sender, TextChangedEventArgs e)
{
if (txtOnWorkUsername.Text.Length > 4)
{
if (listuserall.Count != 0)
{
var dtUserInfo = listuserall.Find(t => t.UserName == txtOnWorkUsername.Text);
if (dtUserInfo != null)
{
dakaname.Content = dtUserInfo.nikeName;
}
}
}
}
private void Button_Click(object sender, RoutedEventArgs e)
{
}
}
public class useralldaka {
public string UserName { get; set; }
public string nikeName { get; set; }
}
}

@ -68,6 +68,15 @@
<DataGridTextColumn Width="*" Header="用户编码" Binding="{Binding user_id}"/>
<DataGridTextColumn Width="*" Header="人员" Binding="{Binding user_name}"/>
<DataGridTextColumn Width="*" Header="工作区间" Binding="{Binding attendance_time}"/>
<DataGridTemplateColumn Width="180" Header="操作">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Border BorderThickness="1" BorderBrush="Gray" CornerRadius="4" Height="38" Background="Aqua" Width="120">
<Button Content="删 除" Click="Button_Click" Height="38" Width="120" BorderThickness="0" FontSize="20" Background="Transparent" />
</Border>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>

@ -55,5 +55,19 @@ namespace XGLFinishPro.Views
dgUserInfo.ItemsSource = dt.DefaultView;
}
}
private void Button_Click(object sender, RoutedEventArgs e)
{
if (dgUserInfo.SelectedItem != null)
{
DataRowView selectedItem = dgUserInfo.SelectedItem as DataRowView;
var bol = userDbWareHouse.Updaterdaka(selectedItem["user_id"].ToString(), deviceCode, LoginUser.WorkDate);
GetRecordInfo();
}
else
{
Console.WriteLine("未选择任何项。");
}
}
}
}

@ -78,66 +78,55 @@
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Border x:Name="Bd" BorderThickness="3"
Width="125"
Height="80"
Margin="2,0,0,0"
Style="{DynamicResource ListBoxItemNormalBackground_Border_Style}">
<Grid >
Width="165"
Height="80"
Margin="2,0,0,0"
Style="{DynamicResource ListBoxItemNormalBackground_Border_Style}">
<Grid>
<Image Source="../Resources/leaf.png" Margin="223,-82,0,0" Width="50"/>
<TextBlock Text="{Binding childprocess_code}"
VerticalAlignment="Center"
Margin="10,0,0,0" FontWeight="Bold" Foreground="Black"
Style="{DynamicResource ListBoxItemContent_TextBlock_Style}"/>
VerticalAlignment="Center"
Margin="10,0,0,0" FontWeight="Bold" Foreground="Black"
Style="{DynamicResource ListBoxItemContent_TextBlock_Style}"/>
<TextBlock Text="{Binding childprocess_name}"
VerticalAlignment="Center"
Margin="55,0,0,0" FontWeight="Bold" Foreground="Black"
Style="{DynamicResource ListBoxItemContent_TextBlock_Style}"/>
VerticalAlignment="Center"
Margin="55,0,0,0" FontWeight="Bold" Foreground="Black"
Style="{DynamicResource ListBoxItemContent_TextBlock_Style}"
TextTrimming="CharacterEllipsis"
Width="100">
<TextBlock.ToolTip>
<ToolTip>
<TextBlock Text="{Binding childprocess_name}" TextWrapping="Wrap"/>
</ToolTip>
</TextBlock.ToolTip>
</TextBlock>
<Grid
Margin="-15,12,0,0"
Width="90"
Height="102"
VerticalAlignment="Top"
HorizontalAlignment="Left" >
<Image Source="../Resources/circular.png" Width="10" Height="10" Margin="0,-62,0,0"/>
<Image Source="../Resources/circular.png" Width="10" Height="10" Margin="0,-22,0,0"/>
<Image Source="../Resources/circular.png" Width="10" Height="10" Margin="0,18,0,0"/>
<Image Source="../Resources/circular.png" Width="10" Height="10" Margin="0,56,0,0"/>
<!--<Image Source="../Resources/lanjuLogo.png" VerticalAlignment="Stretch"/>-->
<!--<StackPanel Orientation="Vertical">
<TextBlock Text="{Binding rfid_no}" FontSize="18"
Foreground="{Binding rfid_no,Converter={StaticResource ForeGroundBatchType}}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<Image Source="..\Img\1.png"></Image>
</StackPanel>-->
<Grid Margin="-15,12,0,0"
Width="90"
Height="102"
VerticalAlignment="Top"
HorizontalAlignment="Left">
<Image Source="../Resources/circular.png" Width="10" Height="10" Margin="0,-62,0,0"/>
<Image Source="../Resources/circular.png" Width="10" Height="10" Margin="0,-22,0,0"/>
<Image Source="../Resources/circular.png" Width="10" Height="10" Margin="0,18,0,0"/>
<Image Source="../Resources/circular.png" Width="10" Height="10" Margin="0,56,0,0"/>
</Grid>
</Grid>
</Border>
<!--控件触发器-->
<!-- 控件触发器 -->
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="true">
<Setter Property="Background" TargetName="Bd">
<Setter.Value>
<!--LinearGradientBrush,渐变线画笔-->
<LinearGradientBrush
StartPoint="0.4,0"
EndPoint="0.4,1">
<LinearGradientBrush StartPoint="0.4,0" EndPoint="0.4,1">
<LinearGradientBrush.GradientStops>
<!--GradientStops渐变线停止GradientStopCollection渐变线停止集合点-->
<GradientStopCollection>
<GradientStop
Color="#FFffeeac"
Offset="0" />
<GradientStop
Color="#FFfbe178"
Offset="0.4" />
<GradientStop
Color="#FFfbe178"
Offset="0.6" />
<GradientStop
Color="#FFfffbd9"
Offset="1" />
<GradientStop Color="#FFffeeac" Offset="0" />
<GradientStop Color="#FFfbe178" Offset="0.4" />
<GradientStop Color="#FFfbe178" Offset="0.6" />
<GradientStop Color="#FFfffbd9" Offset="1" />
</GradientStopCollection>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
@ -148,25 +137,13 @@
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" TargetName="Bd">
<Setter.Value>
<!--LinearGradientBrush,渐变线画笔-->
<LinearGradientBrush
StartPoint="0.4,0"
EndPoint="0.4,1">
<LinearGradientBrush StartPoint="0.4,0" EndPoint="0.4,1">
<LinearGradientBrush.GradientStops>
<!--GradientStops渐变线停止GradientStopCollection渐变线停止集合点-->
<GradientStopCollection>
<GradientStop
Color="#FFC2E0FF"
Offset="0" />
<GradientStop
Color="#FFC2E0dF"
Offset="0.4" />
<GradientStop
Color="#FFC2E0dF"
Offset="0.6" />
<GradientStop
Color="#FFfffbd9"
Offset="1" />
<GradientStop Color="#FFC2E0FF" Offset="0" />
<GradientStop Color="#FFC2E0dF" Offset="0.4" />
<GradientStop Color="#FFC2E0dF" Offset="0.6" />
<GradientStop Color="#FFfffbd9" Offset="1" />
</GradientStopCollection>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
@ -280,13 +257,62 @@
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<DataGrid
x:Name="dgUserInfo1"
MinWidth="200"
MinHeight="260"
Width="562"
Height="385"
RowStyle="{StaticResource DataGridRowStyle}"
MaxHeight="400"
AlternationCount="2"
FontSize="18"
LoadingRow="dgWorkOrderInfo_LoadingRow"
HeadersVisibility="Column"
HorizontalAlignment="Center"
VerticalAlignment="Top" VerticalContentAlignment="Center"
AutoGenerateColumns="False" CanUserAddRows="False" SelectionMode="Extended" SelectionUnit="FullRow" SelectionChanged="dgUserInfo_SelectionChanged"
CellEditEnding="dgUserInfo_CellEditEnding" Grid.Row="1" Margin="0,10,0,0">
<DataGrid.ColumnHeaderStyle >
<Style TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="Height" Value="48" />
<Setter Property="FontSize" Value="20" />
<Setter Property="Foreground" Value="White" />
<Setter Property="Background" Value="#2B7EE6" />
</Style>
</DataGrid.ColumnHeaderStyle>
<DataGrid.Columns>
<DataGridTemplateColumn Width="50">
<!--<DataGridTemplateColumn.Header>
<CheckBox x:Name="cb_all" Click="cb_all_Click" HorizontalAlignment="Center" VerticalAlignment="Center" />
</DataGridTemplateColumn.Header>-->
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox x:Name="cb_child" Click="cb_child_Click_1" IsChecked="{Binding IsChecked}" HorizontalAlignment="Left" VerticalAlignment="Center" VerticalContentAlignment="Center" Margin="15,0,0,0"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="序号" Width="50" MinWidth="10" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="10,0,0,0"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Width="60*" Header="工序编号" IsReadOnly="true" Binding="{Binding childprocess_code}"/>
<DataGridTextColumn Width="190*" Header="工序名称" IsReadOnly="true" Binding="{Binding childprocess_name}"/>
<DataGridTextColumn Width="70*" Header="单价" Binding="{Binding attr1}"/>
</DataGrid.Columns>
</DataGrid>
<!--<Button x:Name="btnStepConfirm1" Style="{StaticResource btnKey}" Background="#2B7EE6" Width="100" Height="40" Click="btnConfirm_Click">
<StackPanel Orientation="Horizontal">
<Image Source="/Resources/green.png" Width="30" Height="30"/>
<TextBlock Text="确认" VerticalAlignment="Center" Margin="15,0,0,0"/>
</StackPanel>
</Button>-->
<CheckBox x:Name="btnSelectStep" Visibility="Collapsed" Grid.Row="0" Content="选择工序" FontSize="16" HorizontalAlignment="Left" Width="100" Margin="10,0,0,9" FontWeight="Bold" Background="#2B7EE6"
<!--<CheckBox x:Name="btnSelectStep" Visibility="Collapsed" Grid.Row="0" Content="选择工序" FontSize="16" HorizontalAlignment="Left" Width="100" Margin="10,0,0,9" FontWeight="Bold" Background="#2B7EE6"
Click="btnSelectStep_Click"/>
<Popup Grid.Row="1" Grid.RowSpan="2" IsOpen="{Binding ElementName=btnSelectStep,Path=IsChecked,UpdateSourceTrigger=PropertyChanged}" PlacementTarget="{Binding ElementName=btnSelectStep}">
<StackPanel Orientation="Vertical">
@ -294,13 +320,15 @@
</ListBox>
<Button x:Name="btnStepConfirm" Style="{StaticResource btnKey}" Background="#2B7EE6" Content="确认" Width="100" Height="30" Click="btnConfirm_Click"/>
</StackPanel>
</Popup>
<ListBox x:Name="lstSelectedStep" Grid.Row="1" Grid.Column="0" Background="#F2F3F5" Style="{DynamicResource ApplicantList_ListBox_Style}"
</Popup>-->
<!--<ListBox x:Name="lstSelectedStep" Grid.Row="1" Grid.Column="0" Background="#F2F3F5" Style="{DynamicResource ApplicantList_ListBox_Style}"
ItemContainerStyle="{DynamicResource ApplicantList_ListBoxItem_Style}" SelectionMode="Single" SelectionChanged="lstSelectedStep_SelectionChanged">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<!-- 这里放置你的数据绑定内容 -->
-->
<!-- 这里放置你的数据绑定内容 -->
<!--
<TextBlock Text="{Binding childprocess_name}" />
</Grid>
<DataTemplate.Triggers>
@ -310,7 +338,7 @@
</DataTemplate.Triggers>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</ListBox>-->
<Grid Grid.Row="0" Grid.RowSpan="2" Grid.Column="1">
<Grid.RowDefinitions>
@ -325,7 +353,7 @@
<TextBlock Text="请输入用户名或者ID" VerticalAlignment="Center"/>
<TextBox x:Name="txtP" Width="120" Height="30" FontSize="18" VerticalAlignment="Center" VerticalContentAlignment="Center" TextChanged="txtP_TextChanged"/>
<Button x:Name="btnQueryUser" Content="查询" FontWeight="Bold" Width="100" Height="40" Style="{StaticResource btnKey}" Click="btnQueryUser_Click" Visibility="Collapsed"/>
<Button x:Name="btnUserConfirm" Content="确认" FontWeight="Bold" Width="100" Height="40" Style="{StaticResource btnKey}" Click="btnUserConfirm_Click"/>
<Button x:Name="btnUserConfirm" Content="确认" FontWeight="Bold" Width="100" Height="40" Style="{StaticResource btnKey}" Click="btnUserConfirm_Click"/>
<Button x:Name="btnCloseWin" Content="关闭" FontWeight="Bold" Width="100" Height="40" Style="{StaticResource btnKey}" Click="btnCloseWin_Click"/>
<CheckBox Content="为所有用户更改" x:Name="alluser" Margin="10,25,0,0"></CheckBox>
</StackPanel>
@ -425,6 +453,7 @@
<DataGridTextColumn Width="80" Header="工序名称" Binding="{Binding childprocess_name}"/>
<DataGridTextColumn Width="80" Header="线体" Binding="{Binding line_code}"/>
<DataGridTextColumn Width="80" Header="报工数量" Binding="{Binding attr1}"/>
<DataGridTextColumn Width="80" Header="工时" Binding="{Binding attr2}"/>
<DataGridTextColumn Width="185" Header="创建时间" Binding="{Binding create_time, StringFormat={}{0:yyyy-MM-dd HH:mm:ss}}"/>
<DataGridTemplateColumn Width="80" Header="操作">
<DataGridTemplateColumn.CellTemplate>

@ -58,29 +58,30 @@ namespace XGLFinishPro.Views
try
{
List<ChildProcess> listDetail = new List<ChildProcess>();
if (lstBoxStep.SelectedItems.Count > 0)
{
foreach (var item in lstBoxStep.SelectedItems)
{
ChildProcess childProcess = new ChildProcess();
//if (lstBoxStep.SelectedItems.Count > 0)
//{
// foreach (var item in lstBoxStep.SelectedItems)
// {
// ChildProcess childProcess = new ChildProcess();
childProcess.childprocess_code = (item as ChildProcess).childprocess_code;
childProcess.childprocess_name = (item as ChildProcess).childprocess_name;
listDetail.Add(childProcess);
}
if (lstSelectedStep.Items.Count > 0)
{
//this.lstSelectedStep.Items.Clear();
this.lstSelectedStep.ItemsSource = null;
lstSelectedStep.ItemsSource = listDetail.OrderBy(a => a.childprocess_code);
this.btnSelectStep.IsChecked = false;
}
else
{
lstSelectedStep.ItemsSource = listDetail.OrderBy(a => a.childprocess_code);
this.btnSelectStep.IsChecked = false;
}
}
// childProcess.childprocess_code = (item as ChildProcess).childprocess_code;
// childProcess.childprocess_name = (item as ChildProcess).childprocess_name;
// childProcess.attr1 = (item as ChildProcess).attr1;
// listDetail.Add(childProcess);
// }
// if (dgUserInfo1.Items.Count > 0)
// {
// //this.lstSelectedStep.Items.Clear();
// this.dgUserInfo1.ItemsSource = null;
// dgUserInfo1.ItemsSource = listDetail.OrderBy(a => a.childprocess_code);
// this.btnSelectStep.IsChecked = false;
// }
// else
// {
// dgUserInfo1.ItemsSource = listDetail.OrderBy(a => a.childprocess_code);
// this.btnSelectStep.IsChecked = false;
// }
//}
}
catch (Exception ex)
{
@ -93,11 +94,11 @@ namespace XGLFinishPro.Views
{
this.msgBox.Text = "";
List<ChildProcess> listDetail = new List<ChildProcess>();
if (lstSelectedStep.SelectedItems.Count > 0)
{
_childprocessCode = (lstSelectedStep.SelectedItem as ChildProcess).childprocess_code;
_childprocessName = (lstSelectedStep.SelectedItem as ChildProcess).childprocess_name;
}
//if (lstSelectedStep.SelectedItems.Count > 0)
//{
// _childprocessCode = (lstSelectedStep.SelectedItem as ChildProcess).childprocess_code;
// _childprocessName = (lstSelectedStep.SelectedItem as ChildProcess).childprocess_name;
//}
// DataTable dt = prodDBService.GetUnitPriceInfo();
this.dgUserInfo.ItemsSource = null;
@ -181,7 +182,7 @@ namespace XGLFinishPro.Views
return;
}
_deviceCode = ds.Tables[0].Rows[0][0].ToString();
this.lstSelectedStep.ItemsSource = GetStepData();
this.dgUserInfo1.ItemsSource = GetStepData();
GetUserData();
GetData();
}
@ -371,6 +372,31 @@ namespace XGLFinishPro.Views
curRow.IsChecked = false;
}
}
private CheckBox _previousCheckBox = null;
private void cb_child_Click_1(object sender, RoutedEventArgs e)
{
CheckBox clickedCheckBox = sender as CheckBox;
if (clickedCheckBox == null)
return;
// 如果之前有选中的CheckBox取消其选中状态
if (_previousCheckBox != null && _previousCheckBox != clickedCheckBox)
{
_previousCheckBox.IsChecked = false;
}
// 记录当前选中的CheckBox
_previousCheckBox = clickedCheckBox;
// 获取当前选中项的值
var selectedItem = dgUserInfo1.SelectedItem as ChildProcess; // 替换 YourDataType 为实际的数据类型
if (selectedItem != null)
{
_childprocessCode = selectedItem.childprocess_code;
_childprocessName = selectedItem.childprocess_name;
btnQueryUser_Click(null, null);
}
}
private void btnQueryUser_Click(object sender, RoutedEventArgs e)
{
@ -408,12 +434,12 @@ namespace XGLFinishPro.Views
if (CustomMessageBox.Show("确定要生成该工序的数据吗?", CustomMessageBoxButton.OKCancel, CustomMessageBoxIcon.Question) == CustomMessageBoxResult.Cancel)
return;
List<string> CreateUnitPriceSqlList = new List<string>();
if (prodDBService.IsExistData(_workOrderCode, _childprocessCode, _deviceCode))
{
string delSql = prodDBService.GetDelUnitPriceData(_workOrderCode, _childprocessCode, _deviceCode);
CreateUnitPriceSqlList.Add(delSql);
//prodDBService.DelUnitPriceData(_workOrderCode, _childprocessCode, _deviceCode);
}
//if (prodDBService.IsExistData(_workOrderCode, _childprocessCode, _deviceCode))
//{
// string delSql = prodDBService.GetDelUnitPriceData(_workOrderCode, _childprocessCode, _deviceCode);
// CreateUnitPriceSqlList.Add(delSql);
// //prodDBService.DelUnitPriceData(_workOrderCode, _childprocessCode, _deviceCode);
//}
string name = "";
string Gong = "";
string sapCode = _deviceCode;//ds.Tables[0].Rows[0][0].ToString();
@ -421,39 +447,25 @@ namespace XGLFinishPro.Views
{
if (item.number.IsNullOrEmpty()||item.number=="0")
{
if (name.IsNullOrEmpty())
{
name = item.nick_name;
}
else
{
name = name + "," + item.nick_name;
}
item.number = "0";
}
if (item.attr2.IsNullOrEmpty() || item.attr2 == "0")
{
if (Gong.IsNullOrEmpty())
{
Gong = item.nick_name;
}
else
{
Gong = Gong + "," + item.nick_name;
}
item.attr2 = "0";
}
string sql = prodDBService.GetCreateUnitPriceInfo(item, _workOrderCode, _sapWorkOrderCode, _productCode, _productName, _childprocessCode, _childprocessName, sapCode, item.number,LoginUser.WorkDate,item.attr2);
CreateUnitPriceSqlList.Add(sql);
}
if (!name.IsNullOrEmpty())
{
CustomMessageBox.Show($"当前选择的人员[{name}][>报工总数<]为空或者为0,请填写数量后再提交!!!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
return;
}
if (!Gong.IsNullOrEmpty())
{
CustomMessageBox.Show($"当前选择的人员[{Gong}][>工时<]为空或者为0,请填写数量后再提交!!!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
return;
}
//if (!name.IsNullOrEmpty())
//{
// CustomMessageBox.Show($"当前选择的人员[{name}][>报工总数<]为空或者为0,请填写数量后再提交!!!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
// return;
//}
//if (!Gong.IsNullOrEmpty())
//{
// CustomMessageBox.Show($"当前选择的人员[{Gong}][>工时<]为空或者为0,请填写数量后再提交!!!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
// return;
//}
//之前如果已经插入了,先删除,
//暂时不更新工单状态
@ -468,7 +480,9 @@ namespace XGLFinishPro.Views
{
item.IsChecked = false;
}
dgUserInfo.Items.Refresh();
}
checkedRowsCache.Clear();
}
else
{
@ -486,28 +500,29 @@ namespace XGLFinishPro.Views
private void btnSelectStep_Click(object sender, RoutedEventArgs e)
{
List<ChildProcess> list = new List<ChildProcess>();
DataTable dt = prodDBService.GetProductStepListInfo(_deviceCode, _productCode);
//List<ChildProcess> list = new List<ChildProcess>();
//DataTable dt = prodDBService.GetProductStepListInfo(_deviceCode, _productCode);
if (dt == null)
{
lstBoxStep.ItemsSource = null;
lstBoxStep.Items.Clear();
}
else
{
foreach (DataRow item in dt.Rows)
{
list.Add(new ChildProcess()
{
childprocess_code = item["childprocess_code"].ToString(),
childprocess_name = item["childprocess_name"].ToString()
});
}
lstBoxStep.ItemsSource = null;
lstBoxStep.Items.Clear();
lstBoxStep.ItemsSource = list;//dt.DefaultView;
}
//if (dt == null)
//{
// lstBoxStep.ItemsSource = null;
// lstBoxStep.Items.Clear();
//}
//else
//{
// foreach (DataRow item in dt.Rows)
// {
// list.Add(new ChildProcess()
// {
// childprocess_code = item["childprocess_code"].ToString(),
// childprocess_name = item["childprocess_name"].ToString(),
// attr1 = TrimTrailingZeros(item["attr1"].ToString())
// });
// }
// lstBoxStep.ItemsSource = null;
// lstBoxStep.Items.Clear();
// lstBoxStep.ItemsSource = list;//dt.DefaultView;
//}
}
@ -520,8 +535,8 @@ namespace XGLFinishPro.Views
{
CustomMessageBox.Show("请配置工序数据之后再试!!!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Question);
lstBoxStep.ItemsSource = null;
lstBoxStep.Items.Clear();
//lstBoxStep.ItemsSource = null;
//lstBoxStep.Items.Clear();
}
else
{
@ -530,18 +545,36 @@ namespace XGLFinishPro.Views
list.Add(new ChildProcess()
{
childprocess_code = item["childprocess_code"].ToString(),
childprocess_name = item["childprocess_name"].ToString()
childprocess_name = item["childprocess_name"].ToString(),
attr1 = TrimTrailingZeros(item["attr1"].ToString())
});
}
}
return list;
}
public string TrimTrailingZeros(string input)
{
if (input.Contains('.'))
{
// 去掉末尾的0
input = input.TrimEnd('0');
// 如果最后一个字符是小数点,去掉小数点
if (input.EndsWith("."))
{
input = input.TrimEnd('.');
}
}
return input;
}
}
public class ChildProcess
{
public string childprocess_code { get; set; }
public string childprocess_name { get; set; }
public string attr1 { get; set; }
}
public class remuneration

@ -6,6 +6,8 @@
xmlns:local="clr-namespace:XGLFinishPro.Views"
mc:Ignorable="d"
WindowStartupLocation="CenterScreen"
WindowStyle="SingleBorderWindow"
ResizeMode="NoResize"
Title="打卡"
Width="1220"
Height="780">

@ -23,7 +23,6 @@ namespace XGLFinishPro.Views
public punchCard()
{
InitializeComponent();
LanJu_User prepare = new LanJu_User();
this.Index.Content = prepare;
}

@ -2,11 +2,11 @@
<ConnectionConfig>
<Recommand>强烈建议:对数据库以及本软件的参数更改,不要在此页进行.可以通过系统配置页进行更新.</Recommand>
<!--本地的业务数据库-->
<!--<MESClientConnectionString>vadMWi9D6ZBkwIr78LoLmGwiSCvVnpY3nMB7IyQlxFiV2OD5s5WUgOabwGwWK3THofFvPL2rHpOvJVIvtz0oZU/NFQyT8KQlbk0rHjUXoU7wgRdUumDJ1RrSFmIjPm8S</MESClientConnectionString>-->
<MESClientConnectionString>vadMWi9D6ZBkwIr78LoLmGwiSCvVnpY3nMB7IyQlxFiV2OD5s5WUgOabwGwWK3THofFvPL2rHpOvJVIvtz0oZU/NFQyT8KQlbk0rHjUXoU7wgRdUumDJ1RrSFmIjPm8S</MESClientConnectionString>
<!--榄菊业务数据库-->
<!--<MESNetClientConnectionString>vadMWi9D6ZC3usVUY51rbTRH8TjL6CxlHbduXNDkc8suJwqe10me6ktk8XD3QU91A7V9zSnfhmhLWUQKZQdqof6chkC37l6QElb57z876mZdo9764iNmLGULHBiQyMu6PXowBdyaQVt17BPsWFn4EUs7Z7zTZwBP+2iJBVXitA3OF6EZXxAztmeZk/1iCwni+JzeWNpXqeOoGzkmSSzmVQH2Yf9m/mlqag2TbldSCcnUQl6lE7tcGg==</MESNetClientConnectionString>-->
<MESNetClientConnectionString>vadMWi9D6ZC3usVUY51rbTRH8TjL6CxlHbduXNDkc8suJwqe10me6ktk8XD3QU91A7V9zSnfhmhLWUQKZQdqof6chkC37l6QElb57z876mZdo9764iNmLGULHBiQyMu6PXowBdyaQVt17BPsWFn4EUs7Z7zTZwBP+2iJBVXitA3OF6EZXxAztmeZk/1iCwni+JzeWNpXqeOoGzkmSSzmVQH2Yf9m/mlqag2TbldSCcnUQl6lE7tcGg==</MESNetClientConnectionString>
<!--榄菊云数据库-->
<!--<CloudConnectionString>vadMWi9D6ZC3usVUY51rbTRH8TjL6CxlHbduXNDkc8suJwqe10me6ktk8XD3QU91ML11cYCqHcHmTXJFsNQamIbW3UEpkjgNPUcBwRfgP6AWftvk9YFyv7y7/6nzX/c+6z6xMDIdcjYVvfteU+7YtOQhJXTfF5ScosAA0GliBfD8dWAunW+ZCos5LemAj2xb2wvvCxlbnrof8IunWslCaBEAGrdC/KhE0qEfNbxydwc=</CloudConnectionString>-->
<CloudConnectionString>vadMWi9D6ZC3usVUY51rbTRH8TjL6CxlHbduXNDkc8suJwqe10me6ktk8XD3QU91ML11cYCqHcHmTXJFsNQamIbW3UEpkjgNPUcBwRfgP6AWftvk9YFyv7y7/6nzX/c+6z6xMDIdcjYVvfteU+7YtOQhJXTfF5ScosAA0GliBfD8dWAunW+ZCos5LemAj2xb2wvvCxlbnrof8IunWslCaBEAGrdC/KhE0qEfNbxydwc=</CloudConnectionString>
@ -14,10 +14,10 @@
<!--本地的业务数据库-->
<MESClientConnectionString>vadMWi9D6ZBkwIr78LoLmGwiSCvVnpY3nMB7IyQlxFiV2OD5s5WUgOabwGwWK3THofFvPL2rHpOvJVIvtz0oZU/NFQyT8KQlbk0rHjUXoU7wgRdUumDJ1RrSFmIjPm8S</MESClientConnectionString>
<!--<MESClientConnectionString>vadMWi9D6ZBkwIr78LoLmGwiSCvVnpY3nMB7IyQlxFiV2OD5s5WUgOabwGwWK3THofFvPL2rHpOvJVIvtz0oZU/NFQyT8KQlbk0rHjUXoU7wgRdUumDJ1RrSFmIjPm8S</MESClientConnectionString>-->
<!--榄菊业务数据库-->
<MESNetClientConnectionString>vadMWi9D6ZC3usVUY51rbTRH8TjL6CxlF0tM4FO8qPh090fSbocpFrq1jWXNjwNntlKCeRLc6CBQNAw+bzYK+yDKBny3FzdffaiQ/9ohZ/iFw6P/06Dz1d7Q8OX2fGT3YK8v2yeiGlLhRHNGlkzN6Okv9SEccNYXDHZKQND/31n9bbXRhaFERnPoCp+evwBwpKq0nDcp4lLRNDrJpG2b6nw1popy2st0u+eYfbIYddNpj2jZcnrJXg==</MESNetClientConnectionString>
<!--<MESNetClientConnectionString>vadMWi9D6ZC3usVUY51rbTRH8TjL6CxlF0tM4FO8qPh090fSbocpFrq1jWXNjwNntlKCeRLc6CBQNAw+bzYK+yDKBny3FzdffaiQ/9ohZ/iFw6P/06Dz1d7Q8OX2fGT3YK8v2yeiGlLhRHNGlkzN6Okv9SEccNYXDHZKQND/31n9bbXRhaFERnPoCp+evwBwpKq0nDcp4lLRNDrJpG2b6nw1popy2st0u+eYfbIYddNpj2jZcnrJXg==</MESNetClientConnectionString>-->
<!--榄菊云数据库-->
<CloudConnectionString>vadMWi9D6ZC3usVUY51rbTRH8TjL6CxlF0tM4FO8qPh090fSbocpFrq1jWXNjwNnXgKYRJ9zN5r4cTE3Hh+JS6lnhIJQCLO5Tn/1DUIbZe8kwpCPuiyxdQS9ApxjjxU3xmhgbAR3NfwaZV2/zLMECLZyTqYXOHwTHdkzxa9RyCzNcbpiSjkFFOVT9SrfkzeVUA+7kogOazAQ7II0ms/Pnls5vU+gUjP9JcI1Q6esb8M=</CloudConnectionString>
<!--<CloudConnectionString>vadMWi9D6ZC3usVUY51rbTRH8TjL6CxlF0tM4FO8qPh090fSbocpFrq1jWXNjwNnXgKYRJ9zN5r4cTE3Hh+JS6lnhIJQCLO5Tn/1DUIbZe8kwpCPuiyxdQS9ApxjjxU3xmhgbAR3NfwaZV2/zLMECLZyTqYXOHwTHdkzxa9RyCzNcbpiSjkFFOVT9SrfkzeVUA+7kogOazAQ7II0ms/Pnls5vU+gUjP9JcI1Q6esb8M=</CloudConnectionString>-->
</ConnectionConfig>
Loading…
Cancel
Save