From 7050ab32bc9dac406e7d4cba86f118622767efc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8C=83?= <15095123350@163.com> Date: Tue, 14 Jan 2025 15:24:28 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BB=E5=8F=96=E7=AE=B1=E4=BD=93=E6=95=B0?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DBService/FormingMachineService.cs | 11 + shangjian/XGL/App.config | 2 +- shangjian/XGLFinishPro/App.config | 2 +- .../XGLFinishPro/Views/ExecReportWorkWin.xaml | 3 +- .../Views/ExecReportWorkWin.xaml.cs | 48 +- .../XGLFinishPro/Views/LanJu_Operator.xaml | 865 ++++++++++-------- .../XGLFinishPro/Views/LanJu_Operator.xaml.cs | 14 +- 7 files changed, 544 insertions(+), 401 deletions(-) diff --git a/shangjian/XGL.Data/DBService/FormingMachineService.cs b/shangjian/XGL.Data/DBService/FormingMachineService.cs index 03381e8..b62af84 100644 --- a/shangjian/XGL.Data/DBService/FormingMachineService.cs +++ b/shangjian/XGL.Data/DBService/FormingMachineService.cs @@ -1705,6 +1705,17 @@ where machine_code = 'X1' and bind_status = '0' order by update_time DESC"; } return ""; } + + public DataTable GetWcsPlcPointBoxCount(string pointNo) + { + string sql = $"SELECT * FROM wcs_plc_point WHERE plc_point_no ='{pointNo}' and equip='BoxCount'"; + DataSet ds = Utils.netClientDBHelper.getDataSet(sql); + if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) + { + return ds.Tables[0]; + } + return null; + } } public class MesTableSelfDetialModel { diff --git a/shangjian/XGL/App.config b/shangjian/XGL/App.config index d2b4db4..0f4164b 100644 --- a/shangjian/XGL/App.config +++ b/shangjian/XGL/App.config @@ -10,7 +10,7 @@ - + diff --git a/shangjian/XGLFinishPro/App.config b/shangjian/XGLFinishPro/App.config index db5af69..657dcc1 100644 --- a/shangjian/XGLFinishPro/App.config +++ b/shangjian/XGLFinishPro/App.config @@ -10,7 +10,7 @@ - + diff --git a/shangjian/XGLFinishPro/Views/ExecReportWorkWin.xaml b/shangjian/XGLFinishPro/Views/ExecReportWorkWin.xaml index 4422ff2..f712e44 100644 --- a/shangjian/XGLFinishPro/Views/ExecReportWorkWin.xaml +++ b/shangjian/XGLFinishPro/Views/ExecReportWorkWin.xaml @@ -369,8 +369,7 @@ Margin="20,0" Click="ReadOrder_Click" Content="获取" - Style="{StaticResource btnKey}" - Visibility="Collapsed" /> + Style="{StaticResource btnKey}" /> 0) { - LanJu_Operator.plc = new PlcHelper(); + string address = dataTable.Rows[0]["plc_point_address"].ToString(); + var boxCount = LanJu_Operator.plc.Read(new CentralControl.BaseData.PlcSetting + { + PlcAddress = address, + PlcDataType = 1, + PlcValueLength = "2" + }); + if (boxCount != null && int.TryParse(boxCount.ToString(), out int count)) + { + txtQuantity.Text = boxCount.ToString(); + } + else + { + CustomMessageBox.Show("读取失败!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning); + } + } + else + { + CustomMessageBox.Show("获取点位信息失败!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning); } } - if (!isSuccess) + catch { - CustomMessageBox.Show("读取失败!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning); - return; + CustomMessageBox.Show("Plc连接失败!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning); + } + finally + { + IsReading = false; } } } diff --git a/shangjian/XGLFinishPro/Views/LanJu_Operator.xaml b/shangjian/XGLFinishPro/Views/LanJu_Operator.xaml index f981093..d7c586b 100644 --- a/shangjian/XGLFinishPro/Views/LanJu_Operator.xaml +++ b/shangjian/XGLFinishPro/Views/LanJu_Operator.xaml @@ -1,51 +1,55 @@  + Loaded="UCOperator_Loaded" + mc:Ignorable="d"> - - - - - - + + + + + + - - + + - + - + - + -