最终提交按钮

master
1 year ago
parent dc14adea98
commit 1da8c83599

@ -700,7 +700,7 @@ select a.TrayCode,a.ProductBarNo,a.carcode,a.createtime,a.lineno,b.HadNumber
// 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"; // 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";
////string sql = $"WITH LatestCheck AS (\r\n SELECT \r\n *,\r\n ROW_NUMBER() OVER (PARTITION BY order_no, income_batch_no ORDER BY create_time DESC) AS rn\r\n FROM \r\n qc_check_task\r\n WHERE \r\n check_type = 'checkTypeCPPC' \r\n AND del_flag = 0\r\n)\r\nSELECT \r\n workorder.factory_code,\r\n workorder.product_date AS plan_time,\r\n workorder.workorder_id,\r\n workorder.workorder_code,\r\n product_code,\r\n product_name,\r\n product_spc,\r\n shifts.shift_desc,\r\n prod_line_code,\r\n workorder.status,\r\n route_code,\r\n quantity_split,\r\n workorder.unit,\r\n workorder.shift_id,\r\n batch.batch_code,\r\n batch.batch_quantity,\r\n sort_no,\r\n workorder.parent_order,\r\n batch.qc_status,\r\n ISNULL(batch.qc_result, '') AS qc_result,\r\n batch.status AS batchStatus,\r\n workorder_code_sap,\r\n salary_flag,\r\n qty.batchQty,\r\n batch.batch_quantity - qty.batchQty AS diffQty,\r\n chack.create_time,\r\n chack.check_status\r\nFROM \r\n pro_order_workorder workorder WITH (NOLOCK)\r\nLEFT JOIN \r\n base_shifts_t shifts WITH (NOLOCK) ON workorder.shift_id = shifts.shift_id\r\nLEFT JOIN \r\n pro_order_workorder_batch batch WITH (NOLOCK) ON workorder.workorder_id = batch.workorder_id\r\nOUTER APPLY \r\n (SELECT TOP 1 * \r\n FROM LatestCheck \r\n WHERE rn = 1 \r\n AND workorder.workorder_code = LatestCheck.order_no \r\n AND batch.batch_code = LatestCheck.income_batch_no) chack\r\nLEFT JOIN \r\n (SELECT sum(quantity_feedback) AS batchQty, workorder_code, batch \r\n FROM [dbo].[mes_report_work] \r\n WHERE del_flag = 0 \r\n GROUP BY workorder_code, batch) qty \r\n ON qty.workorder_code = workorder.workorder_code AND batch.batch_code = qty.batch\r\nWHERE \r\n 1 = 1 \r\n AND batch.del_flag = 0 \r\n AND workorder.del_flag = 0 \r\n AND workorder.parent_order = '0' \r\n AND CONVERT(VARCHAR(10), workorder.product_date, 120) = CONVERT(VARCHAR(10), '{date}', 120) \r\n AND workorder.prod_line_code LIKE '%{deviceCode}%'\r\nORDER BY \r\n sort_no, batch_code;\r\n"; ////string sql = $"WITH LatestCheck AS (\r\n SELECT \r\n *,\r\n ROW_NUMBER() OVER (PARTITION BY order_no, income_batch_no ORDER BY create_time DESC) AS rn\r\n FROM \r\n qc_check_task\r\n WHERE \r\n check_type = 'checkTypeCPPC' \r\n AND del_flag = 0\r\n)\r\nSELECT \r\n workorder.factory_code,\r\n workorder.product_date AS plan_time,\r\n workorder.workorder_id,\r\n workorder.workorder_code,\r\n product_code,\r\n product_name,\r\n product_spc,\r\n shifts.shift_desc,\r\n prod_line_code,\r\n workorder.status,\r\n route_code,\r\n quantity_split,\r\n workorder.unit,\r\n workorder.shift_id,\r\n batch.batch_code,\r\n batch.batch_quantity,\r\n sort_no,\r\n workorder.parent_order,\r\n batch.qc_status,\r\n ISNULL(batch.qc_result, '') AS qc_result,\r\n batch.status AS batchStatus,\r\n workorder_code_sap,\r\n salary_flag,\r\n qty.batchQty,\r\n batch.batch_quantity - qty.batchQty AS diffQty,\r\n chack.create_time,\r\n chack.check_status\r\nFROM \r\n pro_order_workorder workorder WITH (NOLOCK)\r\nLEFT JOIN \r\n base_shifts_t shifts WITH (NOLOCK) ON workorder.shift_id = shifts.shift_id\r\nLEFT JOIN \r\n pro_order_workorder_batch batch WITH (NOLOCK) ON workorder.workorder_id = batch.workorder_id\r\nOUTER APPLY \r\n (SELECT TOP 1 * \r\n FROM LatestCheck \r\n WHERE rn = 1 \r\n AND workorder.workorder_code = LatestCheck.order_no \r\n AND batch.batch_code = LatestCheck.income_batch_no) chack\r\nLEFT JOIN \r\n (SELECT sum(quantity_feedback) AS batchQty, workorder_code, batch \r\n FROM [dbo].[mes_report_work] \r\n WHERE del_flag = 0 \r\n GROUP BY workorder_code, batch) qty \r\n ON qty.workorder_code = workorder.workorder_code AND batch.batch_code = qty.batch\r\nWHERE \r\n 1 = 1 \r\n AND batch.del_flag = 0 \r\n AND workorder.del_flag = 0 \r\n AND workorder.parent_order = '0' \r\n AND CONVERT(VARCHAR(10), workorder.product_date, 120) = CONVERT(VARCHAR(10), '{date}', 120) \r\n AND workorder.prod_line_code LIKE '%{deviceCode}%'\r\nORDER BY \r\n sort_no, batch_code;\r\n";
string sql = $"WITH LatestCheck AS (\r\n SELECT \r\n *,\r\n ROW_NUMBER() OVER (PARTITION BY order_no, income_batch_no ORDER BY create_time DESC) AS rn\r\n FROM \r\n qc_check_task\r\n WHERE \r\n check_type = 'checkTypeCPPC' \r\n AND del_flag = 0\r\n)\r\nSELECT \r\n workorder.factory_code,\r\n workorder.product_date AS plan_time,\r\n workorder.workorder_id,\r\n workorder.workorder_code,\r\n product_code,\r\n product_name,\r\n product_spc,\r\n shifts.shift_desc,\r\n prod_line_code,\r\n workorder.status,\r\n route_code,\r\n quantity_split,\r\n workorder.unit,\r\n workorder.shift_id,\r\n batch.batch_code,\r\n batch.batch_quantity,\r\n sort_no,\r\n workorder.parent_order,\r\n batch.qc_status,\r\n ISNULL(batch.qc_result, '') AS qc_result,\r\n batch.status AS batchStatus,\r\n workorder_code_sap,\r\n salary_flag,\r\n qty.batchQty,\r\n batch.batch_quantity - qty.batchQty AS diffQty,\r\n chack.create_time,\r\n chack.check_status,CASE\r\n WHEN batch.attr1 = '1' THEN 'false'\r\n ELSE 'true'\r\n END AS IsEnabled,\r\n CASE\r\n WHEN batch.attr1 = '1' THEN '结束'\r\n ELSE '开始'\r\n END AS BtnTest ,\r\n batch.batch_id AS batchId \r\nFROM \r\n pro_order_workorder workorder WITH (NOLOCK)\r\nLEFT JOIN \r\n base_shifts_t shifts WITH (NOLOCK) ON workorder.shift_id = shifts.shift_id\r\nLEFT JOIN \r\n pro_order_workorder_batch batch WITH (NOLOCK) ON workorder.workorder_id = batch.workorder_id\r\nOUTER APPLY \r\n (SELECT TOP 1 * \r\n FROM LatestCheck \r\n WHERE rn = 1 \r\n AND workorder.workorder_code = LatestCheck.order_no \r\n AND batch.batch_code = LatestCheck.income_batch_no) chack\r\nLEFT JOIN \r\n (SELECT sum(quantity_feedback) AS batchQty, workorder_code, batch \r\n FROM [dbo].[mes_report_work] \r\n WHERE del_flag = 0 \r\n GROUP BY workorder_code, batch) qty \r\n ON qty.workorder_code = workorder.workorder_code AND batch.batch_code = qty.batch\r\nWHERE \r\n 1 = 1 \r\n AND batch.del_flag = 0 \r\n AND workorder.del_flag = 0 \r\n AND workorder.parent_order = '0' \r\n AND CONVERT(VARCHAR(10), workorder.product_date, 120) = CONVERT(VARCHAR(10), '2024-05-22', 120) \r\n AND workorder.prod_line_code LIKE '%XL01%'\r\nORDER BY \r\n sort_no, batch_code;\r\n"; string sql = $"WITH LatestCheck AS (\r\n SELECT \r\n *,\r\n ROW_NUMBER() OVER (PARTITION BY order_no, income_batch_no ORDER BY create_time DESC) AS rn\r\n FROM \r\n qc_check_task\r\n WHERE \r\n check_type = 'checkTypeCPPC' \r\n AND del_flag = 0\r\n)\r\nSELECT \r\n workorder.factory_code,\r\n workorder.product_date AS plan_time,\r\n workorder.workorder_id,\r\n workorder.workorder_code,\r\n product_code,\r\n product_name,\r\n product_spc,\r\n shifts.shift_desc,\r\n prod_line_code,\r\n workorder.status,\r\n route_code,\r\n quantity_split,\r\n workorder.unit,\r\n workorder.shift_id,\r\n batch.batch_code,\r\n batch.batch_quantity,\r\n sort_no,\r\n workorder.parent_order,\r\n batch.qc_status,\r\n ISNULL(batch.qc_result, '') AS qc_result,\r\n batch.status AS batchStatus,\r\n workorder_code_sap,\r\n salary_flag,\r\n qty.batchQty,\r\n batch.batch_quantity - qty.batchQty AS diffQty,\r\n chack.create_time,\r\n chack.check_status,CASE\r\n WHEN batch.attr1 = '1' THEN 'false'\r\n ELSE 'true'\r\n END AS IsEnabled,\r\n CASE\r\n WHEN batch.attr1 = '1' THEN '结束'\r\n ELSE '开始'\r\n END AS BtnTest ,\r\n batch.batch_id AS batchId \r\nFROM \r\n pro_order_workorder workorder WITH (NOLOCK)\r\nLEFT JOIN \r\n base_shifts_t shifts WITH (NOLOCK) ON workorder.shift_id = shifts.shift_id\r\nLEFT JOIN \r\n pro_order_workorder_batch batch WITH (NOLOCK) ON workorder.workorder_id = batch.workorder_id\r\nOUTER APPLY \r\n (SELECT TOP 1 * \r\n FROM LatestCheck \r\n WHERE rn = 1 \r\n AND workorder.workorder_code = LatestCheck.order_no \r\n AND batch.batch_code = LatestCheck.income_batch_no) chack\r\nLEFT JOIN \r\n (SELECT sum(quantity_feedback) AS batchQty, workorder_code, batch \r\n FROM [dbo].[mes_report_work] \r\n WHERE del_flag = 0 \r\n GROUP BY workorder_code, batch) qty \r\n ON qty.workorder_code = workorder.workorder_code AND batch.batch_code = qty.batch\r\nWHERE \r\n 1 = 1 \r\n AND batch.del_flag = 0 \r\n AND workorder.del_flag = 0 \r\n AND workorder.parent_order = '0' \r\n AND CONVERT(VARCHAR(10), workorder.product_date, 120) = CONVERT(VARCHAR(10), '{date}', 120) \r\n AND workorder.prod_line_code LIKE '%{deviceCode}%'\r\nORDER BY \r\n sort_no, batch_code;\r\n";
DataSet dtset = Utils.netClientDBHelper.getDataSet(sql); DataSet dtset = Utils.netClientDBHelper.getDataSet(sql);
if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0) if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0)
{ {

@ -134,7 +134,7 @@ namespace XGLFinishPro.Tools
//ComOn(); //ComOn();
serialPort.Write(new byte[] { 0xE3, 0x01, 0x09, (byte)dOName, (byte)dOOnOff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0, 12); serialPort.Write(new byte[] { 0xE3, 0x01, 0x09, (byte)dOName, (byte)dOOnOff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0, 12);
} }
/// <summary> /// <summary>
/// 文本框传输数据控制COM5串口 /// 文本框传输数据控制COM5串口
/// </summary> /// </summary>

@ -128,7 +128,7 @@
<StackPanel Orientation="Horizontal" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center"> <StackPanel Orientation="Horizontal" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button Content="刷新" Background="#2B7EE6" Foreground="White" Width="100" FontSize="20" Height="50" Margin="10" Click="Refresh_Click"/> <Button Content="刷新" Background="#2B7EE6" Foreground="White" Width="100" FontSize="20" Height="50" Margin="10" Click="Refresh_Click"/>
<Button x:Name="Add" Content="新增一列" Background="#2B7EE6" Foreground="White" Width="100" FontSize="20" Height="50" Margin="10" Click="Add_Click"/> <Button x:Name="Add" Content="新增一列" Background="#2B7EE6" Foreground="White" Width="100" FontSize="20" Height="50" Margin="10" Click="Add_Click"/>
<CheckBox x:Name="IsFinalSubmit" Content="最终提交" Style="{StaticResource CheckBoxStyle}"/> <Button x:Name="IsFinalSubmit" Content="最终提交" Background="Red" Foreground="White" Width="100" FontSize="20" Height="50" Margin="10" Click="Submit_Click"/>
<Button x:Name="Commit" Content="提交" Background="#2B7EE6" Foreground="White" Width="100" FontSize="20" Height="50" Margin="10" Click="Submit_Click"/> <Button x:Name="Commit" Content="提交" Background="#2B7EE6" Foreground="White" Width="100" FontSize="20" Height="50" Margin="10" Click="Submit_Click"/>
<Button Content="关闭" Background="#2B7EE6" Foreground="White" Width="100" FontSize="20" Height="50" Margin="10" Click="Close_Click"/> <Button Content="关闭" Background="#2B7EE6" Foreground="White" Width="100" FontSize="20" Height="50" Margin="10" Click="Close_Click"/>
</StackPanel> </StackPanel>

@ -817,6 +817,19 @@ namespace XGLFinishPro.Views
private void Submit_Click(object sender, RoutedEventArgs e) private void Submit_Click(object sender, RoutedEventArgs e)
{ {
string isFinal = "0";
if (sender is Button button)
{
isFinal = button.Content == "最终提交" ? "1" : "0";
}
if (isFinal == "1")
{
var result = HandyControl.Controls.MessageBox.Show("是否将报表最终提交?", "提示", MessageBoxButton.YesNo, MessageBoxImage.Question);
if (result != MessageBoxResult.Yes)
{
return;
}
}
foreach (var item in data) foreach (var item in data)
{ {
if (!string.IsNullOrEmpty(item.belong_to)) if (!string.IsNullOrEmpty(item.belong_to))
@ -833,7 +846,6 @@ namespace XGLFinishPro.Views
} }
} }
mesTableSelf.create_by = LoginUser.UserName; mesTableSelf.create_by = LoginUser.UserName;
string isFinal = this.IsFinalSubmit.IsChecked.Value ? "1" : "0";
dbService.UpdateMesTableSelf(belong_to, "", LoginUser.UserName, isFinal); dbService.UpdateMesTableSelf(belong_to, "", LoginUser.UserName, isFinal);
MessageBox.Show("保存成功"); MessageBox.Show("保存成功");
LoadData(); LoadData();

@ -122,7 +122,7 @@
<StackPanel Orientation="Horizontal" Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Center"> <StackPanel Orientation="Horizontal" Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Center">
<Button Content="刷新" Background="#2B7EE6" Foreground="White" Width="100" FontSize="20" Height="50" Margin="10" Click="Refresh_Click"/> <Button Content="刷新" Background="#2B7EE6" Foreground="White" Width="100" FontSize="20" Height="50" Margin="10" Click="Refresh_Click"/>
<Button x:Name="Add" Content="新增一列" Background="#2B7EE6" Foreground="White" Width="100" FontSize="20" Height="50" Margin="10" Click="Add_Click"/> <Button x:Name="Add" Content="新增一列" Background="#2B7EE6" Foreground="White" Width="100" FontSize="20" Height="50" Margin="10" Click="Add_Click"/>
<CheckBox x:Name="IsFinalSubmit" Content="最终提交" Style="{StaticResource CheckBoxStyle}"/> <Button x:Name="IsFinalSubmit" Content="最终提交" Background="Red" Foreground="White" Width="100" FontSize="20" Height="50" Margin="10" Click="Submit_Click"/>
<Button x:Name="Commit" Content="提交" Background="#2B7EE6" Foreground="White" Width="100" FontSize="20" Height="50" Margin="10" Click="Submit_Click"/> <Button x:Name="Commit" Content="提交" Background="#2B7EE6" Foreground="White" Width="100" FontSize="20" Height="50" Margin="10" Click="Submit_Click"/>
<Button Content="关闭" Background="#2B7EE6" Foreground="White" Width="100" FontSize="20" Height="50" Margin="10" Click="Close_Click"/> <Button Content="关闭" Background="#2B7EE6" Foreground="White" Width="100" FontSize="20" Height="50" Margin="10" Click="Close_Click"/>

@ -772,6 +772,20 @@ namespace XGLFinishPro.Views
private void Submit_Click(object sender, RoutedEventArgs e) private void Submit_Click(object sender, RoutedEventArgs e)
{ {
string isFinal = "0";
if (sender is Button button)
{
isFinal = button.Content == "最终提交" ? "1" : "0";
}
if (isFinal == "1")
{
var result = HandyControl.Controls.MessageBox.Show("是否将报表最终提交?", "提示", MessageBoxButton.YesNo, MessageBoxImage.Question);
if (result != MessageBoxResult.Yes)
{
return;
}
}
foreach (var item in data) foreach (var item in data)
{ {
if (item.table_line == 0) if (item.table_line == 0)
@ -792,8 +806,7 @@ namespace XGLFinishPro.Views
dbService.InsertMesTableSelfDetial(item); dbService.InsertMesTableSelfDetial(item);
} }
} }
string isFinalSubmit = this.IsFinalSubmit.IsChecked.Value ? "1" : "0"; dbService.UpdateMesTableSelf(mesTableSelf.id, this.ExceptionDesc.Text, this.NickName.Text, isFinal);
dbService.UpdateMesTableSelf(mesTableSelf.id, this.ExceptionDesc.Text, this.NickName.Text, isFinalSubmit);
LoadData(); LoadData();
MessageBox.Show("提交成功"); MessageBox.Show("提交成功");
} }

@ -134,7 +134,7 @@
<StackPanel Orientation="Horizontal" Grid.Column="4" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.ColumnSpan="3"> <StackPanel Orientation="Horizontal" Grid.Column="4" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.ColumnSpan="3">
<Button Content="刷新" Background="#2B7EE6" Foreground="White" Width="100" FontSize="20" Height="50" Margin="10" Click="Refresh_Click"/> <Button Content="刷新" Background="#2B7EE6" Foreground="White" Width="100" FontSize="20" Height="50" Margin="10" Click="Refresh_Click"/>
<Button x:Name="Add" Content="新增一列" Background="#2B7EE6" Foreground="White" Width="100" FontSize="20" Height="50" Margin="10" Click="Add_Click"/> <Button x:Name="Add" Content="新增一列" Background="#2B7EE6" Foreground="White" Width="100" FontSize="20" Height="50" Margin="10" Click="Add_Click"/>
<CheckBox x:Name="IsFinalSubmit" Content="最终提交" Style="{StaticResource CheckBoxStyle}"/> <Button x:Name="IsFinalSubmit" Content="最终提交" Background="Red" Foreground="White" Width="100" FontSize="20" Height="50" Margin="10" Click="Submit_Click"/>
<Button x:Name="Commit" Content="提交" Background="#2B7EE6" Foreground="White" Width="100" FontSize="20" Height="50" Margin="10" Click="Submit_Click"/> <Button x:Name="Commit" Content="提交" Background="#2B7EE6" Foreground="White" Width="100" FontSize="20" Height="50" Margin="10" Click="Submit_Click"/>
<Button Content="关闭" Background="#2B7EE6" Foreground="White" Width="100" FontSize="20" Height="50" Margin="10" Click="Close_Click"/> <Button Content="关闭" Background="#2B7EE6" Foreground="White" Width="100" FontSize="20" Height="50" Margin="10" Click="Close_Click"/>
</StackPanel> </StackPanel>

@ -865,6 +865,20 @@ namespace XGLFinishPro.Views
private void Submit_Click(object sender, RoutedEventArgs e) private void Submit_Click(object sender, RoutedEventArgs e)
{ {
string isFinal = "0";
if (sender is Button button)
{
isFinal = button.Content == "最终提交" ? "1" : "0";
}
if (isFinal == "1")
{
var result = HandyControl.Controls.MessageBox.Show("是否将报表最终提交?", "提示", MessageBoxButton.YesNo, MessageBoxImage.Question);
if(result != MessageBoxResult.Yes)
{
return;
}
}
var tempLeftData = dbService.GetMesTableSelfDetial(leftbelong_to, 6); var tempLeftData = dbService.GetMesTableSelfDetial(leftbelong_to, 6);
var tempRightData = dbService.GetMesTableSelfDetial(rightbelong_to, 6); var tempRightData = dbService.GetMesTableSelfDetial(rightbelong_to, 6);
leftData.ForEach(t => leftData.ForEach(t =>
@ -915,7 +929,6 @@ namespace XGLFinishPro.Views
dbService.UpdateMesTableSelfDetial(item); dbService.UpdateMesTableSelfDetial(item);
} }
} }
string isFinal = this.IsFinalSubmit.IsChecked.Value ? "1" : "0";
dbService.UpdateMesTableSelf(leftbelong_to, "", LoginUser.UserName, isFinal); dbService.UpdateMesTableSelf(leftbelong_to, "", LoginUser.UserName, isFinal);
//dbService.UpdateMesTableSelf(rightbelong_to, "", LoginUser.UserName); //dbService.UpdateMesTableSelf(rightbelong_to, "", LoginUser.UserName);
MessageBox.Show("提交成功!"); MessageBox.Show("提交成功!");

Loading…
Cancel
Save