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"> - - - - - - + + + + + + - - + + - + - + - + -