开始、结束按钮

20260122
1 year ago
parent e2968ab0a4
commit 22e965b105

@ -1222,7 +1222,7 @@ where machine_code = 'X1' and bind_status = '0' order by update_time DESC";
string date = DateTime.Parse(workDate).ToString("yyyy-MM-dd");
string sql = $@"select workorder_id,product_name,product_code
from pro_order_workorder
where prod_line_code like '%{deviceCode}%' and product_date='{date}' and parent_order=0";
where prod_line_code like '%{deviceCode}%' and product_date='{date}' and parent_order='0' order by parent_order";
//string sql = $@"select workorder_id,product_name
// from pro_order_workorder
// where prod_line_code like '%{deviceCode}% and status='w2''";
@ -1234,6 +1234,7 @@ where machine_code = 'X1' and bind_status = '0' order by update_time DESC";
return null;
}
public DataTable GetProOrderWorkorder(string id)
{
string sql = $@"select workorder_id,product_name,product_code
@ -1457,7 +1458,7 @@ where machine_code = 'X1' and bind_status = '0' order by update_time DESC";
if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
{
DataRow dr = ds.Tables[0].Rows[0];
return new MesTableSelf()
MesTableSelf mesTableSelf = new MesTableSelf()
{
id = dr["id"].ToString(),
line_code = dr["line_code"].ToString(),
@ -1475,6 +1476,8 @@ where machine_code = 'X1' and bind_status = '0' order by update_time DESC";
del_flag = dr["del_flag"].ToString(),
report_name = dr["report_name"].ToString(),
};
mesTableSelf.IsFinal = dr["is_final"].ToString() == "1";
return mesTableSelf;
}
return null;
}
@ -1544,7 +1547,7 @@ where machine_code = 'X1' and bind_status = '0' order by update_time DESC";
public MesTableSelfDetialModel GetMesTableSelfDetialById(string id)
{
string sql = $@"select check_result,check_time_s,check_time_e from [dbo].[mes_table_self_detial] where id='{id}'";
string sql = $@"select check_result,check_time_s,check_time_e,is_final from [dbo].[mes_table_self_detial] where id='{id}'";
DataSet ds = Utils.netClientDBHelper.getDataSet(sql);
if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
{
@ -1558,9 +1561,9 @@ where machine_code = 'X1' and bind_status = '0' order by update_time DESC";
return null;
}
public void UpdateMesTableSelf(string id, string text, string text1)
public void UpdateMesTableSelf(string id, string text, string text1,string isFinal)
{
string sql = $@"update [dbo].[mes_table_self] set bz='{text}',create_by='{text1}' where id='{id}'";
string sql = $@"update [dbo].[mes_table_self] set bz='{text}',create_by='{text1}',is_final='{isFinal}' where id='{id}'";
Utils.netClientDBHelper.executeUpdate(sql);
}
@ -1585,6 +1588,19 @@ where machine_code = 'X1' and bind_status = '0' order by update_time DESC";
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);
}
public string GetProOrderWorkorderBatchStatusById(string workorderId,string batch_code)
{
string sql = $@"select qc_status from [dbo].[pro_order_workorder_batch] where workorder_id='{workorderId}' and batch_code='{batch_code}' and del_flag='0'";
DataSet ds = Utils.netClientDBHelper.getDataSet(sql);
if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
{
return ds.Tables[0].Rows[0]["qc_status"].ToString();
}else
{
return "";
}
}
}
public class MesTableSelfDetialModel
{

@ -698,11 +698,37 @@ select a.TrayCode,a.ProductBarNo,a.carcode,a.createtime,a.lineno,b.HadNumber
//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";
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";
DataSet dtset = Utils.netClientDBHelper.getDataSet(sql);
if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0)
{
return dtset.Tables[0];
DataTable dataTable = dtset.Tables[0];
bool isStart = false;
foreach (DataRow dr in dataTable.Rows)
{
if (dr["BtnTest"].ToString() == "结束")
{
isStart = true;
break;
}
}
if (isStart)
{
foreach (DataRow dr in dataTable.Rows)
{
if (dr["BtnTest"].ToString() == "开始")
{
dr["IsEnabled"] = false;
}
else
{
dr["IsEnabled"] = true;
}
}
}
return dataTable;
}
return null;
}
@ -805,20 +831,20 @@ where line_code = '{deviceCode}' and CONVERT(VARCHAR(10), Create_time , 120) = C
/// </summary>
/// <param name="item"></param>
/// <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,string attr3="")
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="", decimal total = 0)
{
string sql = $@"INSERT INTO [dbo].[mes_unitprice_report] (
[id],[workorder_code], [workorder_code_sap], [product_name], [product_code],
[user_name], [nick_name], [childprocess_code], [childprocess_name], [attr1],
[attr2], [attr3], [create_by], [create_time], [update_by],
[update_time], [remark] ,[post],[line_code],[work_order_product_date]
[update_time], [remark] ,[post],[line_code],[work_order_product_date],[total]
)
VALUES
(
'{Common.GetUUID()}', '{workorderCode}','{sapWorkorderCode}', '{productName}', '{productCode}',
N'{item.user_name}', N'{item.nick_name}', N'{childProcessCode}', N'{childProcessName}',' {number}',
{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',{total} );";
return sql;
}
@ -3617,6 +3643,12 @@ left join basedata_plcsetting f on a.PlcId5=f.Id
return result;
}
public void UpdateProWorkOrderBatch(string batchId, string attr1)
{
string sql = $"update pro_order_workorder_batch set attr1='{attr1}' where batch_id='{batchId}'";
Utils.netClientDBHelper.executeUpdate(sql);
}
// /// <summary>

@ -334,6 +334,7 @@ namespace XGL.Data
LoginUser.End_Time = endTime;
LoginUser.CurrDeviceIP = Common.GetLocationHostAddress();
}
issuccess = true;
return issuccess;//lst.Count > 0 ? true : false;
}

@ -168,5 +168,6 @@ namespace XGL.Models
public string update_time { get; set; }
public string factory_code { get; set; }
public string del_flag { get; set; }
public bool IsFinal { get; set; }
}
}

@ -132,7 +132,7 @@ namespace XGLFinishPro.Tools
public void DOControl(DOName dOName, DOOnOff dOOnOff)
{
//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>

@ -97,6 +97,15 @@
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
</Style>
<Style x:Key="CheckBoxStyle" TargetType="{x:Type CheckBox}">
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="LayoutTransform">
<Setter.Value>
<ScaleTransform ScaleX="1.5" ScaleY="1.5" />
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</Window.Resources>
<Grid>
@ -118,8 +127,9 @@
<Label Content="产品转换/完产清线点检表" Grid.RowSpan="2" Grid.Column="1" VerticalAlignment="Center" FontWeight="Bold" FontSize="40" HorizontalAlignment="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="Add_Click"/>
<Button Content="提交" Background="#2B7EE6" Foreground="White" Width="100" FontSize="20" Height="50" Margin="10" Click="Submit_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="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"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Column="2" Grid.Row="2" VerticalAlignment="Bottom" HorizontalAlignment="Right">

@ -50,7 +50,6 @@ namespace XGLFinishPro.Views
InitializeComponent();
this.date = LoginUser.WorkDate;
}
private List<ConveterData> list = new List<ConveterData>();
private string date;
private MesTableSelf mesTableSelf;
@ -190,8 +189,12 @@ namespace XGLFinishPro.Views
{
comboBox.Width = (lineWidth - 10) * 2;
comboBox.Height = lineHeight - 10;
comboBox.IsEnabled = !mesTableSelf.IsFinal;
}
}
this.Commit.Visibility=mesTableSelf.IsFinal? Visibility.Collapsed:Visibility.Visible;
this.IsFinalSubmit.Visibility = this.Commit.Visibility;
this.Add.Visibility=this.Commit.Visibility;
}
catch
{
@ -326,7 +329,7 @@ namespace XGLFinishPro.Views
Name = list.First(t => t.label == baseDictDatas[i].dict_label).value + index,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
ItemsSource = mainDict[baseDictDatas[i].dict_label],
ItemsSource = mainDict[baseDictDatas[i].dict_label]?.Distinct(),
SelectedItem = data.Where(t => t.info_name == baseDictDatas[i].dict_label && t.index == j).Select(t => t.check_result).FirstOrDefault(),
};
comboBox.SelectionChanged += SelectionChanged;
@ -731,7 +734,7 @@ namespace XGLFinishPro.Views
{
Name = $"班组{index}",
FontSize = 18,
ItemsSource = teamGroup,
ItemsSource = teamGroup?.Distinct(),
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
};
@ -830,7 +833,8 @@ namespace XGLFinishPro.Views
}
}
mesTableSelf.create_by = LoginUser.UserName;
dbService.UpdateMesTableSelf(belong_to, "", LoginUser.UserName);
string isFinal = this.IsFinalSubmit.IsChecked.Value ? "1" : "0";
dbService.UpdateMesTableSelf(belong_to, "", LoginUser.UserName, isFinal);
MessageBox.Show("保存成功");
LoadData();
}

@ -85,6 +85,15 @@
</Setter.Value>
</Setter>
</Style>
<Style x:Key="CheckBoxStyle" TargetType="{x:Type CheckBox}">
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="LayoutTransform">
<Setter.Value>
<ScaleTransform ScaleX="1.5" ScaleY="1.5" />
</Setter.Value>
</Setter>
</Style>
<Style x:Key="TextBlockStyle" TargetType="TextBlock">
<Setter Property="FontSize" Value="25"/>
<Setter Property="Margin" Value="10,0,8,0"/>
@ -112,8 +121,9 @@
</Grid.RowDefinitions>
<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="Add_Click"/>
<Button Content="提交" Background="#2B7EE6" Foreground="White" Width="100" FontSize="20" Height="50" Margin="10" Click="Submit_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="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"/>
</StackPanel>

@ -43,7 +43,8 @@ namespace XGLFinishPro.Views
string deviceCode = Utils.GetAppSetting("DeviceCode");
private string date = string.Empty;
private string workId = string.Empty;
private string productName=string.Empty;
private string productName = string.Empty;
private bool IsFinal = false;
public LanJu_Conversion_Report()
{
InitializeComponent();
@ -133,8 +134,15 @@ namespace XGLFinishPro.Views
{
comboBox.IsEnabled = false;
}
else
{
comboBox.IsEnabled = !mesTableSelf.IsFinal;
}
}
}
this.Commit.Visibility = mesTableSelf.IsFinal ? Visibility.Collapsed : Visibility.Visible;
this.IsFinalSubmit.Visibility = this.Commit.Visibility;
this.Add.Visibility = this.Commit.Visibility;
});
}
@ -358,7 +366,7 @@ namespace XGLFinishPro.Views
ComboBox comboBox = new ComboBox()
{
Name = $"{list.First(t => t.label == key).value}{j}",
ItemsSource = hasType ? type : DefaultTypeDic,
ItemsSource = hasType ? type.Distinct() : DefaultTypeDic.Distinct(),
SelectedItem = SelectedItem,
Width = MainLineWidth,
Height = MainLineHeight
@ -389,7 +397,7 @@ namespace XGLFinishPro.Views
ComboBox comboBox = new ComboBox()
{
Name = $"{list.First(t => t.label == key).value}{j}",
ItemsSource = hasType ? type : DefaultTypeDic,
ItemsSource = hasType ? type.Distinct() : DefaultTypeDic.Distinct(),
SelectedItem = SelectedItem,
Width = MainLineWidth,
Height = MainLineHeight
@ -419,7 +427,7 @@ namespace XGLFinishPro.Views
ComboBox comboBox = new ComboBox()
{
Name = $"{list.First(t => t.label == key).value}{j}",
ItemsSource = hasType ? type : DefaultTypeDic,
ItemsSource = hasType ? type.Distinct() : DefaultTypeDic.Distinct(),
SelectedItem = SelectedItem,
Width = MainLineWidth,
Height = MainLineHeight
@ -440,7 +448,7 @@ namespace XGLFinishPro.Views
string label = list.Where(t => t.value == box.Name.Substring(0, box.Name.Length - 1)).First().label;
if (label.Contains("日期码") || label.Contains("生产批号"))
{
box.ItemsSource = batchCodes;
box.ItemsSource = batchCodes.Distinct();
}
}
}
@ -546,7 +554,7 @@ namespace XGLFinishPro.Views
var startHour = new ComboBox()
{
Name = $"StartHour{i}",
ItemsSource = _hours,
ItemsSource = _hours.Distinct(),
SelectedIndex = 0,
Width = timeWidth,
Height = timeHeight,
@ -569,7 +577,7 @@ namespace XGLFinishPro.Views
var startMinute = new ComboBox()
{
Name = $"StartMinute{i}",
ItemsSource = _minutes,
ItemsSource = _minutes.Distinct(),
SelectedIndex = 0,
Width = timeWidth,
Height = timeHeight,
@ -591,7 +599,7 @@ namespace XGLFinishPro.Views
var endHour = new ComboBox()
{
Name = $"EndHour{i}",
ItemsSource = _hours,
ItemsSource = _hours.Distinct(),
SelectedIndex = 0,
Width = timeWidth,
Height = timeHeight,
@ -614,7 +622,7 @@ namespace XGLFinishPro.Views
var endMinute = new ComboBox()
{
Name = $"EndMinute{i}",
ItemsSource = _minutes,
ItemsSource = _minutes.Distinct(),
SelectedIndex = 0,
Width = timeWidth,
Height = timeHeight,
@ -784,7 +792,8 @@ namespace XGLFinishPro.Views
dbService.InsertMesTableSelfDetial(item);
}
}
dbService.UpdateMesTableSelf(mesTableSelf.id, this.ExceptionDesc.Text, this.NickName.Text);
string isFinalSubmit = this.IsFinalSubmit.IsChecked.Value ? "1" : "0";
dbService.UpdateMesTableSelf(mesTableSelf.id, this.ExceptionDesc.Text, this.NickName.Text, isFinalSubmit);
LoadData();
MessageBox.Show("提交成功");
}
@ -801,6 +810,10 @@ namespace XGLFinishPro.Views
{
foreach (DataRow row in dataTable.Rows)
{
if (orderWorks.Where(t => t.WorkName == row["product_name"].ToString()).Any())
{
continue;
}
orderWorks.Add(new OrderWork()
{
WorkId = row["workorder_id"].ToString(),
@ -808,7 +821,7 @@ namespace XGLFinishPro.Views
});
}
}
this.ProductName.ItemsSource = orderWorks;
this.ProductName.ItemsSource = orderWorks?.Distinct();
this.ProductName.Items.Refresh();
this.workId = string.Empty;
this.productName = string.Empty;
@ -822,7 +835,7 @@ namespace XGLFinishPro.Views
if (comboBox.SelectedItem is OrderWork orderWork)
{
this.workId = orderWork.WorkId;
this.productName= orderWork.WorkName;
this.productName = orderWork.WorkName;
}
}
LoadData();

@ -98,6 +98,15 @@
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
</Style>
<Style x:Key="CheckBoxStyle" TargetType="{x:Type CheckBox}">
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="LayoutTransform">
<Setter.Value>
<ScaleTransform ScaleX="1.5" ScaleY="1.5" />
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</Window.Resources>
<Grid>
@ -124,8 +133,9 @@
</Grid.RowDefinitions>
<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="Add_Click"/>
<Button Content="提交" Background="#2B7EE6" Foreground="White" Width="100" FontSize="20" Height="50" Margin="10" Click="Submit_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="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"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Column="0" Grid.Row="0">

@ -254,10 +254,10 @@ namespace XGLFinishPro.Views
//UpdateUi(this.Right);
isUpdate = false;
}
private MesTableSelf leftmesTableSelf;
private void GetMesTableSeft()
{
MesTableSelf leftmesTableSelf = dbService.GetMesTableSelf(deviceCode, LProductName, this.LeftCheckDate.Text, "ConversionReportLeft");
leftmesTableSelf = dbService.GetMesTableSelf(deviceCode, LProductName, this.LeftCheckDate.Text, "ConversionReportLeft");
if (leftmesTableSelf == null)
{
if (!string.IsNullOrEmpty(LProductName))
@ -425,7 +425,7 @@ namespace XGLFinishPro.Views
ComboBox comboBox = new ComboBox()
{
Name = $"{grid.Name}{list.First(t => t.label == key).value}{j}",
ItemsSource = hasType ? type : DefaultTypeDic,
ItemsSource = hasType ? type.Distinct() : DefaultTypeDic.Distinct(),
SelectedItem = SelectedItem,
Width = MainLineWidth,
Height = MainLineHeight
@ -447,7 +447,7 @@ namespace XGLFinishPro.Views
string label = list.Where(t => t.value == box.Name.Substring(0, box.Name.Length - 1).Replace("Left", "").Replace("Right", "")).First().label;
if (label.Contains("日期码") || label.Contains("生产批号"))
{
box.ItemsSource = batchCodes;
box.ItemsSource = batchCodes.Distinct();
}
}
}
@ -460,7 +460,7 @@ namespace XGLFinishPro.Views
string label = list.Where(t => t.value == box.Name.Substring(0, box.Name.Length - 1).Replace("Left", "").Replace("Right", "")).First().label;
if (label.Contains("日期码") || label.Contains("生产批号"))
{
box.ItemsSource = batchCodes;
box.ItemsSource = batchCodes.Distinct();
}
}
}
@ -517,6 +517,10 @@ namespace XGLFinishPro.Views
{
comboBox.IsEnabled = false;
}
else
{
comboBox.IsEnabled = !leftmesTableSelf.IsFinal;
}
}
if (item is TextBox textBox)
{
@ -526,9 +530,15 @@ namespace XGLFinishPro.Views
{
textBox.IsReadOnly = false;
}
else
{
textBox.IsEnabled = !leftmesTableSelf.IsFinal;
}
}
}
this.Commit.Visibility = leftmesTableSelf.IsFinal ? Visibility.Collapsed : Visibility.Visible;
this.IsFinalSubmit.Visibility = this.Commit.Visibility;
this.Add.Visibility = this.Commit.Visibility;
});
}
@ -905,8 +915,9 @@ namespace XGLFinishPro.Views
dbService.UpdateMesTableSelfDetial(item);
}
}
dbService.UpdateMesTableSelf(leftbelong_to, "", LoginUser.UserName);
dbService.UpdateMesTableSelf(rightbelong_to, "", LoginUser.UserName);
string isFinal = this.IsFinalSubmit.IsChecked.Value ? "1" : "0";
dbService.UpdateMesTableSelf(leftbelong_to, "", LoginUser.UserName, isFinal);
//dbService.UpdateMesTableSelf(rightbelong_to, "", LoginUser.UserName);
MessageBox.Show("提交成功!");
LoadData();
}
@ -939,6 +950,10 @@ namespace XGLFinishPro.Views
{
foreach (DataRow row in dataTable.Rows)
{
if (orderWorks.Where(t => t.WorkName == row["product_name"].ToString()).Any())
{
continue;
}
orderWorks.Add(new OrderWork()
{
WorkId = row["workorder_id"].ToString(),
@ -946,7 +961,7 @@ namespace XGLFinishPro.Views
});
}
}
this.LeftProductName.ItemsSource = orderWorks;
this.LeftProductName.ItemsSource = orderWorks.Distinct();
this.LeftProductName.Items.Refresh();
this.workId = string.Empty;
this.LProductName = string.Empty;

@ -543,6 +543,15 @@ Background="#F2F3F5"
</DataGridTemplateColumn>
<!--<DataGridTextColumn Width="60" Header="母单" Binding="{Binding parent_order,Converter={StaticResource ParentOrderConverter}}"/>-->
<DataGridTextColumn Width="200" Header="SAP工单" Binding="{Binding workorder_code_sap}"/>
<DataGridTemplateColumn Header="状态" Width="100">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid>
<Button IsEnabled="{Binding IsEnabled}" Content="{Binding BtnTest}" Tag="{Binding batchId}" Click="Button_Click_3" HorizontalAlignment="Center" VerticalAlignment="Center" Width="75" Height="35" Background="#2B7EE6" FontSize="20" Foreground="White" />
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!--<DataGridTextColumn Width="120" Header="RFID" Binding="{Binding rfid}"/>-->
<DataGridTextColumn Width="480" Header="产品名称" Binding="{Binding product_name}" />
<DataGridTextColumn Width="320" Header="批次号" Binding="{Binding batch_code}" />

@ -319,7 +319,6 @@ namespace XGLFinishPro.Views
dt.AcceptChanges();
}
}
this.dgWorkOrderInfo.ItemsSource = null;
if (dt != null && dt.Rows.Count > 0)
this.dgWorkOrderInfo.ItemsSource = dt.DefaultView;
@ -501,6 +500,13 @@ namespace XGLFinishPro.Views
//}
#region 添加验证
string workorderId = selectedRow["workorder_id"].ToString();
string batch_code = selectedRow["batch_code"].ToString();
string qc_status = selectedRow["qc_status"].ToString();
if (qc_status != "2" && qc_status != "首检完成")
{
CustomMessageBox.Show("该工单未首检,请重新选择!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
return;
}
if (!formingMachineService.GetProOrderWorkOrder(workorderId))
{
CustomMessageBox.Show("该工单已经被删除,请重新选择!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
@ -984,6 +990,44 @@ namespace XGLFinishPro.Views
}
new PersonView().ShowDialog();
}
private void Button_Click_3(object sender, RoutedEventArgs e)
{
try
{
if (sender is System.Windows.Controls.Button btn)
{
string batchId = btn.Tag.ToString();
DataTable dt = userDbWareHouse.GetWetPlanInfo(deviceCode, DateTime.Parse(LoginUser.WorkDate).ToString("yyyy-MM-dd"));
foreach (DataRow row in dt.Rows)
{
string content = btn.Content.ToString();
if (batchId == row["batchId"].ToString())
{
if (row["BtnTest"] != null && row["BtnTest"].ToString() == content)
{
string attr1 = "0";
if (content == "开始")
{
attr1 = "1";
}
else if (content == "结束")
{
attr1 = "0";
}
userDbWareHouse.UpdateProWorkOrderBatch(batchId, attr1);
GetWorkOrderInfo();
}
}
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
public class ReportWorkModel
{

@ -64,6 +64,10 @@ namespace XGLFinishPro.Views
{
foreach (DataRow row in dataTable.Rows)
{
if (orderWorks.Where(t => t.WorkName == row["product_name"].ToString()).Any())
{
continue;
}
orderWorks.Add(new OrderWork()
{
WorkId = row["workorder_id"].ToString(),

@ -509,6 +509,18 @@ namespace XGLFinishPro.Views
{
number = (dgUserInfo.SelectedItem as sys_user).number;
}
decimal dj = 0;
if (dgUserInfo1.SelectedItem is ChildProcess ch)
{
try
{
dj = Convert.ToDecimal(ch.attr1);
}
catch
{
}
}
if (CustomMessageBox.Show("确定要生成该工序的数据吗?", CustomMessageBoxButton.OKCancel, CustomMessageBoxIcon.Question) == CustomMessageBoxResult.Cancel)
return;
List<string> CreateUnitPriceSqlList = new List<string>();
@ -523,11 +535,11 @@ namespace XGLFinishPro.Views
string sapCode = _deviceCode;//ds.Tables[0].Rows[0][0].ToString();
foreach (sys_user item in checkedRowsCache)
{
if (item.number.IsNullOrEmpty() || item.number == "0")
if (string.IsNullOrEmpty(item.number) || item.number == "0")
{
item.number = "0";
}
if (item.attr2.IsNullOrEmpty() || item.attr2 == "0")
if (string.IsNullOrEmpty(item.attr2) || item.attr2 == "0")
{
item.attr2 = "0";
}
@ -536,7 +548,16 @@ namespace XGLFinishPro.Views
{
attr3 = "1";
}
string sql = prodDBService.GetCreateUnitPriceInfo(item, _workOrderCode, _sapWorkOrderCode, _productCode, _productName, _childprocessCode, _childprocessName, sapCode, item.number, LoginUser.WorkDate, item.attr2, item.post, attr3);
decimal total = 0;
try
{
total = dj * Convert.ToDecimal(item.number);
}
catch
{
}
string sql = prodDBService.GetCreateUnitPriceInfo(item, _workOrderCode, _sapWorkOrderCode, _productCode, _productName, _childprocessCode, _childprocessName, sapCode, item.number, LoginUser.WorkDate, item.attr2, item.post, attr3,total);
CreateUnitPriceSqlList.Add(sql);
}
//if (!name.IsNullOrEmpty())

Loading…
Cancel
Save