diff --git a/.gitignore b/.gitignore index a50da15..d6ce843 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,6 @@ shangjian/XGL/bin/ shangjian/CommonFunc/obj/ shangjian/CommonFunc/bin/ shangjian/XGL.Data/obj/ -shangjian/XGL.Data/bin/ \ No newline at end of file +shangjian/XGL.Data/bin/ +shangjian/XGLFinishPro/obj/ +shangjian/XGLFinishPro/bin/ diff --git a/shangjian/.vs/BL/v17/.suo b/shangjian/.vs/BL/v17/.suo index 7570057..f7106fc 100644 Binary files a/shangjian/.vs/BL/v17/.suo and b/shangjian/.vs/BL/v17/.suo differ diff --git a/shangjian/.vs/BL/v17/HierarchyCache.v1.txt b/shangjian/.vs/BL/v17/HierarchyCache.v1.txt index 28cb238..9541633 100644 Binary files a/shangjian/.vs/BL/v17/HierarchyCache.v1.txt and b/shangjian/.vs/BL/v17/HierarchyCache.v1.txt differ diff --git a/shangjian/AutoUpdate/bin/Debug/AutoUpdate.application b/shangjian/AutoUpdate/bin/Debug/AutoUpdate.application index 6e4aad7..a8655b1 100644 --- a/shangjian/AutoUpdate/bin/Debug/AutoUpdate.application +++ b/shangjian/AutoUpdate/bin/Debug/AutoUpdate.application @@ -1,7 +1,7 @@  - + @@ -14,7 +14,7 @@ - IfQ2LLDWJC73HvMngEFjpyEOT7eiZ99iYdurmK8S2RA= + kCr1fh10+EtMBHGFNQ8qK4lr256zI+0Jrd2pZnBY0uI= diff --git a/shangjian/AutoUpdate/bin/Debug/AutoUpdate.exe b/shangjian/AutoUpdate/bin/Debug/AutoUpdate.exe index 670f998..d386d4b 100644 Binary files a/shangjian/AutoUpdate/bin/Debug/AutoUpdate.exe and b/shangjian/AutoUpdate/bin/Debug/AutoUpdate.exe differ diff --git a/shangjian/AutoUpdate/bin/Debug/AutoUpdate.exe.manifest b/shangjian/AutoUpdate/bin/Debug/AutoUpdate.exe.manifest index f86d951..af8e83c 100644 --- a/shangjian/AutoUpdate/bin/Debug/AutoUpdate.exe.manifest +++ b/shangjian/AutoUpdate/bin/Debug/AutoUpdate.exe.manifest @@ -49,7 +49,7 @@ - c7WQpMXek3r/jb4SdOtNd1qocYw496LLF05iMXjF3aU= + qnFKF+/3YlPAODyAGRSFG761uj8zOHLBVY6MUaXwrHc= diff --git a/shangjian/AutoUpdate/bin/Debug/AutoUpdate.pdb b/shangjian/AutoUpdate/bin/Debug/AutoUpdate.pdb index f4117b1..c224b13 100644 Binary files a/shangjian/AutoUpdate/bin/Debug/AutoUpdate.pdb and b/shangjian/AutoUpdate/bin/Debug/AutoUpdate.pdb differ diff --git a/shangjian/AutoUpdate/bin/Debug/app.publish/AutoUpdate.exe b/shangjian/AutoUpdate/bin/Debug/app.publish/AutoUpdate.exe index 670f998..d386d4b 100644 Binary files a/shangjian/AutoUpdate/bin/Debug/app.publish/AutoUpdate.exe and b/shangjian/AutoUpdate/bin/Debug/app.publish/AutoUpdate.exe differ diff --git a/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.application b/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.application index 6e4aad7..a8655b1 100644 --- a/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.application +++ b/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.application @@ -1,7 +1,7 @@  - + @@ -14,7 +14,7 @@ - IfQ2LLDWJC73HvMngEFjpyEOT7eiZ99iYdurmK8S2RA= + kCr1fh10+EtMBHGFNQ8qK4lr256zI+0Jrd2pZnBY0uI= diff --git a/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.csproj.AssemblyReference.cache b/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.csproj.AssemblyReference.cache index ce3a2ee..034c195 100644 Binary files a/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.csproj.AssemblyReference.cache and b/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.csproj.AssemblyReference.cache differ diff --git a/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.csproj.CoreCompileInputs.cache b/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.csproj.CoreCompileInputs.cache index 67d7c4b..3e54865 100644 --- a/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.csproj.CoreCompileInputs.cache +++ b/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -eea3ff7a82b036285dd19ec3ef2dc8d3e7eddf67 +f67dc885e7551d573c533635607a154a9fcfd039 diff --git a/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.csproj.GenerateResource.cache b/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.csproj.GenerateResource.cache index 62d51ac..74285bb 100644 Binary files a/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.csproj.GenerateResource.cache and b/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.csproj.GenerateResource.cache differ diff --git a/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.exe b/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.exe index 670f998..d386d4b 100644 Binary files a/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.exe and b/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.exe differ diff --git a/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.exe.manifest b/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.exe.manifest index f86d951..af8e83c 100644 --- a/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.exe.manifest +++ b/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.exe.manifest @@ -49,7 +49,7 @@ - c7WQpMXek3r/jb4SdOtNd1qocYw496LLF05iMXjF3aU= + qnFKF+/3YlPAODyAGRSFG761uj8zOHLBVY6MUaXwrHc= diff --git a/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.pdb b/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.pdb index f4117b1..c224b13 100644 Binary files a/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.pdb and b/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.pdb differ diff --git a/shangjian/AutoUpdate/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/shangjian/AutoUpdate/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache index 7b17953..946926c 100644 Binary files a/shangjian/AutoUpdate/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/shangjian/AutoUpdate/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/shangjian/BL.sln b/shangjian/BL.sln index a6e7c00..b387977 100644 --- a/shangjian/BL.sln +++ b/shangjian/BL.sln @@ -25,6 +25,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoUpdate", "AutoUpdate\Au EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPFupdate", "WPFupdate\WPFupdate.csproj", "{703CDC32-203A-4B71-8B3E-306A48AB3F8B}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XGLFinishPro", "XGLFinishPro\XGLFinishPro.csproj", "{9EF5B36A-859B-4445-9F7C-B6D796898AD6}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -305,6 +307,30 @@ Global {703CDC32-203A-4B71-8B3E-306A48AB3F8B}.Release|x64.Build.0 = Release|Any CPU {703CDC32-203A-4B71-8B3E-306A48AB3F8B}.Release|x86.ActiveCfg = Release|Any CPU {703CDC32-203A-4B71-8B3E-306A48AB3F8B}.Release|x86.Build.0 = Release|Any CPU + {9EF5B36A-859B-4445-9F7C-B6D796898AD6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9EF5B36A-859B-4445-9F7C-B6D796898AD6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9EF5B36A-859B-4445-9F7C-B6D796898AD6}.Debug|ARM.ActiveCfg = Debug|Any CPU + {9EF5B36A-859B-4445-9F7C-B6D796898AD6}.Debug|ARM.Build.0 = Debug|Any CPU + {9EF5B36A-859B-4445-9F7C-B6D796898AD6}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {9EF5B36A-859B-4445-9F7C-B6D796898AD6}.Debug|ARM64.Build.0 = Debug|Any CPU + {9EF5B36A-859B-4445-9F7C-B6D796898AD6}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {9EF5B36A-859B-4445-9F7C-B6D796898AD6}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {9EF5B36A-859B-4445-9F7C-B6D796898AD6}.Debug|x64.ActiveCfg = Debug|Any CPU + {9EF5B36A-859B-4445-9F7C-B6D796898AD6}.Debug|x64.Build.0 = Debug|Any CPU + {9EF5B36A-859B-4445-9F7C-B6D796898AD6}.Debug|x86.ActiveCfg = Debug|x86 + {9EF5B36A-859B-4445-9F7C-B6D796898AD6}.Debug|x86.Build.0 = Debug|x86 + {9EF5B36A-859B-4445-9F7C-B6D796898AD6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9EF5B36A-859B-4445-9F7C-B6D796898AD6}.Release|Any CPU.Build.0 = Release|Any CPU + {9EF5B36A-859B-4445-9F7C-B6D796898AD6}.Release|ARM.ActiveCfg = Release|Any CPU + {9EF5B36A-859B-4445-9F7C-B6D796898AD6}.Release|ARM.Build.0 = Release|Any CPU + {9EF5B36A-859B-4445-9F7C-B6D796898AD6}.Release|ARM64.ActiveCfg = Release|Any CPU + {9EF5B36A-859B-4445-9F7C-B6D796898AD6}.Release|ARM64.Build.0 = Release|Any CPU + {9EF5B36A-859B-4445-9F7C-B6D796898AD6}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {9EF5B36A-859B-4445-9F7C-B6D796898AD6}.Release|Mixed Platforms.Build.0 = Release|x86 + {9EF5B36A-859B-4445-9F7C-B6D796898AD6}.Release|x64.ActiveCfg = Release|Any CPU + {9EF5B36A-859B-4445-9F7C-B6D796898AD6}.Release|x64.Build.0 = Release|Any CPU + {9EF5B36A-859B-4445-9F7C-B6D796898AD6}.Release|x86.ActiveCfg = Release|x86 + {9EF5B36A-859B-4445-9F7C-B6D796898AD6}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/shangjian/CentralControl/bin/Debug/CentralControl.exe b/shangjian/CentralControl/bin/Debug/CentralControl.exe index 014f127..38078fb 100644 Binary files a/shangjian/CentralControl/bin/Debug/CentralControl.exe and b/shangjian/CentralControl/bin/Debug/CentralControl.exe differ diff --git a/shangjian/CentralControl/bin/Debug/CentralControl.pdb b/shangjian/CentralControl/bin/Debug/CentralControl.pdb index f4a2b29..34d1e64 100644 Binary files a/shangjian/CentralControl/bin/Debug/CentralControl.pdb and b/shangjian/CentralControl/bin/Debug/CentralControl.pdb differ diff --git a/shangjian/CentralControl/bin/Debug/CommonFunc.dll b/shangjian/CentralControl/bin/Debug/CommonFunc.dll index fbb67a7..817b693 100644 Binary files a/shangjian/CentralControl/bin/Debug/CommonFunc.dll and b/shangjian/CentralControl/bin/Debug/CommonFunc.dll differ diff --git a/shangjian/CentralControl/bin/Debug/CommonFunc.pdb b/shangjian/CentralControl/bin/Debug/CommonFunc.pdb index 359ee5e..76c2a7b 100644 Binary files a/shangjian/CentralControl/bin/Debug/CommonFunc.pdb and b/shangjian/CentralControl/bin/Debug/CommonFunc.pdb differ diff --git a/shangjian/CentralControl/bin/Debug/XGL.Data.dll b/shangjian/CentralControl/bin/Debug/XGL.Data.dll index 71ba813..9b6211f 100644 Binary files a/shangjian/CentralControl/bin/Debug/XGL.Data.dll and b/shangjian/CentralControl/bin/Debug/XGL.Data.dll differ diff --git a/shangjian/CentralControl/bin/Debug/XGL.Data.pdb b/shangjian/CentralControl/bin/Debug/XGL.Data.pdb index baf1af8..a00753d 100644 Binary files a/shangjian/CentralControl/bin/Debug/XGL.Data.pdb and b/shangjian/CentralControl/bin/Debug/XGL.Data.pdb differ diff --git a/shangjian/CentralControl/bin/Debug/XGL.Models.dll b/shangjian/CentralControl/bin/Debug/XGL.Models.dll index 2da6265..acfd5db 100644 Binary files a/shangjian/CentralControl/bin/Debug/XGL.Models.dll and b/shangjian/CentralControl/bin/Debug/XGL.Models.dll differ diff --git a/shangjian/CentralControl/bin/Debug/XGL.Models.pdb b/shangjian/CentralControl/bin/Debug/XGL.Models.pdb index 6a87e1d..d332ee5 100644 Binary files a/shangjian/CentralControl/bin/Debug/XGL.Models.pdb and b/shangjian/CentralControl/bin/Debug/XGL.Models.pdb differ diff --git a/shangjian/CentralControl/bin/Debug/XGL.Thrift.dll b/shangjian/CentralControl/bin/Debug/XGL.Thrift.dll index b83d144..ee4b893 100644 Binary files a/shangjian/CentralControl/bin/Debug/XGL.Thrift.dll and b/shangjian/CentralControl/bin/Debug/XGL.Thrift.dll differ diff --git a/shangjian/CentralControl/bin/Debug/XGL.Thrift.pdb b/shangjian/CentralControl/bin/Debug/XGL.Thrift.pdb index 8945932..6d5f944 100644 Binary files a/shangjian/CentralControl/bin/Debug/XGL.Thrift.pdb and b/shangjian/CentralControl/bin/Debug/XGL.Thrift.pdb differ diff --git a/shangjian/CentralControl/obj/Debug/CentralControl.csproj.AssemblyReference.cache b/shangjian/CentralControl/obj/Debug/CentralControl.csproj.AssemblyReference.cache index 6874aa1..7a6e978 100644 Binary files a/shangjian/CentralControl/obj/Debug/CentralControl.csproj.AssemblyReference.cache and b/shangjian/CentralControl/obj/Debug/CentralControl.csproj.AssemblyReference.cache differ diff --git a/shangjian/CentralControl/obj/Debug/CentralControl.exe b/shangjian/CentralControl/obj/Debug/CentralControl.exe index 014f127..38078fb 100644 Binary files a/shangjian/CentralControl/obj/Debug/CentralControl.exe and b/shangjian/CentralControl/obj/Debug/CentralControl.exe differ diff --git a/shangjian/CentralControl/obj/Debug/CentralControl.pdb b/shangjian/CentralControl/obj/Debug/CentralControl.pdb index f4a2b29..34d1e64 100644 Binary files a/shangjian/CentralControl/obj/Debug/CentralControl.pdb and b/shangjian/CentralControl/obj/Debug/CentralControl.pdb differ diff --git a/shangjian/CommonFunc/CommonFunc.csproj b/shangjian/CommonFunc/CommonFunc.csproj index b431db5..df5129a 100644 --- a/shangjian/CommonFunc/CommonFunc.csproj +++ b/shangjian/CommonFunc/CommonFunc.csproj @@ -11,6 +11,7 @@ CommonFunc v4.8 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} @@ -156,6 +157,12 @@ + + PauseOrderWin.xaml + + + PauseRecoverWin.xaml + @@ -180,6 +187,14 @@ Designer MSBuild:Compile + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + diff --git a/shangjian/CommonFunc/HMessageBox.xaml b/shangjian/CommonFunc/HMessageBox.xaml index 2a8a7f8..c7931b5 100644 --- a/shangjian/CommonFunc/HMessageBox.xaml +++ b/shangjian/CommonFunc/HMessageBox.xaml @@ -38,13 +38,13 @@ - + + + 记住密码 + + + + + + + - - + > + + + diff --git a/shangjian/XGL/Views/LanJu_Operator.xaml.cs b/shangjian/XGL/Views/LanJu_Operator.xaml.cs index 95284bc..9114d4f 100644 --- a/shangjian/XGL/Views/LanJu_Operator.xaml.cs +++ b/shangjian/XGL/Views/LanJu_Operator.xaml.cs @@ -56,9 +56,18 @@ namespace XGL.Views Window1.Content = frame; } + List sfcList = null; + private void InOut_Click(object sender, RoutedEventArgs e) { LanJu_InOut lanJu_InOut = new LanJu_InOut(_workOrderCode, deviceCode); + // 在主界面中的某个位置订阅事件 + lanJu_InOut.ValueSelected += (sender1, args) => + { + // 在这里处理从子窗口传回的值 + sfcList = lanJu_InOut.SFCCodeList; + // 执行需要的操作 + }; Window1.Content = new Frame { Content = lanJu_InOut @@ -98,7 +107,7 @@ namespace XGL.Views timerDeciveState.Interval = Utils.GetAppSetting("GetDeviceStateInterval") == "" ? 15000 : Convert.ToInt32(Utils.GetAppSetting("GetDeviceStateInterval")); timerDeciveState.Elapsed += TimerDeciveState_Elapsed; timerDeciveState.Start(); - GetWorkOrderInfo(); + GetWorkOrderInfo(); } string isbaiye; string plantime; @@ -106,6 +115,7 @@ namespace XGL.Views { try { + if (Utils.isAnyBodyPerating) return; List orderList = new List(); int currHour = DateTime.Now.Hour; @@ -360,9 +370,13 @@ namespace XGL.Views MessageBox.Show("只有活动中的工单才支持暂停!", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Warning); return; } - - formingMachineService.UpdateWorkOrder(workordercode,"w4"); - GetWorkOrderInfo(); + PauseOrderWin pauseOrderWin = new PauseOrderWin(); + if (pauseOrderWin.ShowDialog() == true) + { + + formingMachineService.UpdateWorkOrder(workordercode, "w4", pauseOrderWin.remark, pauseOrderWin.type, deviceCode); + GetWorkOrderInfo(); + } } private void btnRecover_Click(object sender, RoutedEventArgs e) @@ -373,13 +387,24 @@ namespace XGL.Views MessageBox.Show("请选择你要恢复的工单!", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Warning); return; } - MessageBoxResult result = MessageBox.Show("你确定要恢复该工单吗?", "温馨提示", MessageBoxButton.YesNo, MessageBoxImage.Information); - if (result == MessageBoxResult.No) - return; var workordercode = selectedRow.workorder_code; - - formingMachineService.UpdateWorkOrder(workordercode, "w2"); - GetWorkOrderInfo(); + string currStatus = selectedRow.status; + if (currStatus != "w4") + { + MessageBox.Show("只有暂停中的工单才支持恢复!", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Warning); + return; + } + //MessageBoxResult result = MessageBox.Show("你确定要恢复该工单吗?", "温馨提示", MessageBoxButton.YesNo, MessageBoxImage.Information); + //if (result == MessageBoxResult.No) + // return; + PauseOrderWin pauseOrderWin = new PauseOrderWin(); + if (pauseOrderWin.ShowDialog() == true) + { + + + formingMachineService.UpdateWorkOrder(workordercode, "w2", pauseOrderWin.remark, pauseOrderWin.type, deviceCode); + GetWorkOrderInfo(); + } } /// @@ -436,14 +461,82 @@ namespace XGL.Views private void btnComplete_Click(object sender, RoutedEventArgs e) { - if (dgWorkOrderInfo.SelectedItems.Count == 0) + //if (dgWorkOrderInfo.SelectedItems.Count == 0) + //{ + // CustomMessageBox.Show("请选择要完成的数据", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning); + // return; + //} + //string str = sfcList[0].ToString(); + //var selectedRow = dgWorkOrderInfo.SelectedItem as FoamingMacModel; + //ShouPeiWin shouPeiWin = new ShouPeiWin(selectedRow); + //shouPeiWin.ShowDialog(); + + //先获取当前机台解绑的条码 + DBService userDbWareHouse = new DBService(); + DataTable dt = formingMachineService.GetRfidInfo(deviceCode); + + foreach (DataRow item in dt.Rows) { - CustomMessageBox.Show("请选择要完成的数据", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning); - return; + string newRfid = ""; + DataTable dtNewRFID = formingMachineService.GetNewRFID(); + if (dtNewRFID == null || dtNewRFID.Rows.Count == 0) + { + newRfid = "B" + DateTime.Now.ToString("yyyyMMdd") + "001"; + } + else + { + if (string.IsNullOrEmpty(dtNewRFID.Rows[0]["report_code"].ToString())) + { + newRfid = "B" + DateTime.Now.ToString("yyyyMMdd") + "001"; + } + else + { + newRfid = "B" + (Convert.ToInt32(dtNewRFID.Rows[0]["rfid"].ToString().TrimStart('B')) + 1).ToString(); + } + } + + + string sqlInsertMesResult = $@"INSERT INTO [mes_material_transfer_result] ( + [id], + [begin], + [beout], + [equipmentCode], + [OrderCode], + [sku], + [planID], + [rfid], + [now_process_id], + [status], + [create_time], + [rfid_status], + [taskcode], + [state], + [update_time], + [work_date], + [shift_id] +) +VALUES + ( + '{CommonFunc.Common.GetUUID()}', + GetDate(), + GetDate(), + '{deviceCode}', + '{item["workorder_code"]}', + '{item["product_code"]}', + NULL, + 'B{DateTime.Now.ToString("yyyyMMdd")}001', + 'af69d35181624b00848958c93c875818', + NULL, + GetDate(), + '2', + '0', + NULL, + GetDate(), + NULL, + NULL + ); +"; } - var selectedRow = dgWorkOrderInfo.SelectedItem as FoamingMacModel; - ShouPeiWin shouPeiWin = new ShouPeiWin(selectedRow); - shouPeiWin.ShowDialog(); } private void btnCheckLog_Click(object sender, RoutedEventArgs e) diff --git a/shangjian/XGL/Views/LanJu_Prepare.xaml b/shangjian/XGL/Views/LanJu_Prepare.xaml index b64bc60..7cd2acb 100644 --- a/shangjian/XGL/Views/LanJu_Prepare.xaml +++ b/shangjian/XGL/Views/LanJu_Prepare.xaml @@ -8,7 +8,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:hc="https://handyorg.github.io/handycontrol" Width="1920" xmlns:localDate="clr-namespace:XGL.Tools" - Height="800" + mc:Ignorable="d" Loaded="UserControl_Loaded"> @@ -93,6 +93,8 @@ + + @@ -148,8 +150,8 @@ + Height="800" Background="LightGray" + > - + @@ -175,19 +177,20 @@ Height="37" Margin="26,0,0,0" HorizontalAlignment="Left"> - + + + - + - @@ -197,9 +200,10 @@ x:Name="dgMaterialInfo" Grid.Row="1" Grid.Column="0" - + Background="#F2F3F5" MinHeight="309" Margin="25,0,0,0" + BorderThickness="0" CellStyle="{StaticResource CustomCellStyle}" LoadingRow="dgMaterialInfo_LoadingRow" HeadersVisibility="Column" @@ -243,18 +247,32 @@ --> - + + + + + + + + + + + + @@ -297,11 +316,13 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/shangjian/XGLFinishPro/CSS/NormalSmlBtnClass.xaml b/shangjian/XGLFinishPro/CSS/NormalSmlBtnClass.xaml new file mode 100644 index 0000000..3cefa1e --- /dev/null +++ b/shangjian/XGLFinishPro/CSS/NormalSmlBtnClass.xaml @@ -0,0 +1,13 @@ + + + + + + \ No newline at end of file diff --git a/shangjian/XGLFinishPro/CSS/SearchBtnClass.xaml b/shangjian/XGLFinishPro/CSS/SearchBtnClass.xaml new file mode 100644 index 0000000..1fd606d --- /dev/null +++ b/shangjian/XGLFinishPro/CSS/SearchBtnClass.xaml @@ -0,0 +1,604 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/shangjian/XGLFinishPro/CSS/SearchTextClass.xaml b/shangjian/XGLFinishPro/CSS/SearchTextClass.xaml new file mode 100644 index 0000000..c5548ea --- /dev/null +++ b/shangjian/XGLFinishPro/CSS/SearchTextClass.xaml @@ -0,0 +1,182 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/shangjian/XGLFinishPro/CSS/Style.xaml b/shangjian/XGLFinishPro/CSS/Style.xaml new file mode 100644 index 0000000..13963e6 --- /dev/null +++ b/shangjian/XGLFinishPro/CSS/Style.xaml @@ -0,0 +1,120 @@ + + + + + + + + + + \ No newline at end of file diff --git a/shangjian/XGLFinishPro/CSS/TabControl.xaml b/shangjian/XGLFinishPro/CSS/TabControl.xaml new file mode 100644 index 0000000..7265b8f --- /dev/null +++ b/shangjian/XGLFinishPro/CSS/TabControl.xaml @@ -0,0 +1,604 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/shangjian/XGLFinishPro/FormItem/FormBlankingBoard.xaml b/shangjian/XGLFinishPro/FormItem/FormBlankingBoard.xaml new file mode 100644 index 0000000..d5dc5da --- /dev/null +++ b/shangjian/XGLFinishPro/FormItem/FormBlankingBoard.xaml @@ -0,0 +1,267 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/shangjian/XGLFinishPro/FormItem/FormHandUp.xaml.cs b/shangjian/XGLFinishPro/FormItem/FormHandUp.xaml.cs new file mode 100644 index 0000000..6963083 --- /dev/null +++ b/shangjian/XGLFinishPro/FormItem/FormHandUp.xaml.cs @@ -0,0 +1,1002 @@ +using CommonFunc; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Data; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; +using System.Windows.Threading; +using XGL.Data; +using XGL.Models; +using XGL.UControl; +using Thrift.Protocol; +using Thrift.Server; +using Thrift.Transport; +using CentralControl.BaseData; +using CentralControl.DBDAO; +using XGL.Thrift; +using System.Threading; +namespace XGL.FormItem +{ + /// + /// FormHandUp.xaml 的交互逻辑 + /// + public partial class FormHandUp : Window + { + + FormShowSelect formSelect; + public static int WeekNo = CommonHelper.WeekOfYear(DateTime.Now, new System.Globalization.CultureInfo("zh-CN")); + private FormLocator formLocator; + // private object refrushState{get;set;} + private DateTime LastDBTime; + // private int lastindex = 0; + List listCatchAreas = new List(); + List listCarreals = new List(); + + FormUpLineBoard uplineBoard = null; + FormLogin loginForm = null; + /// + /// 时间刷新 + /// + private DispatcherTimer dispatcherTimer; + + + Thread ThreadBeginLeave; + /// + /// UI数据刷新 + /// + private DispatcherTimer RefreshUITimer; + /// + /// 上件区小车列表 + /// + ObservableCollection Cars = new ObservableCollection(); + public FormHandUp() + { + // refrushState = true; + InitializeComponent(); + LastDBTime = new DateTime(); + } + + private void Window_Loaded(object sender, RoutedEventArgs e) + { + try + { + dispatcherTimer = new DispatcherTimer(); + dispatcherTimer.Interval = TimeSpan.FromMilliseconds(1000); + dispatcherTimer.Tick += DispatcherTimer_Tick; + dispatcherTimer.IsEnabled = true; + dispatcherTimer.Start(); + + RefreshUITimer = new DispatcherTimer(); + RefreshUITimer.Interval = TimeSpan.FromSeconds(1); + RefreshUITimer.Tick += RefreshUITimer_Tick; + RefreshUITimer.IsEnabled = true; + RefreshUITimer.Start(); + txtTime.Content = DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString(); + + + this.lblWeekDay.Content = WeekNo.ToString(); + string lineno = System.Configuration.ConfigurationManager.AppSettings["LineId"]; + if (lineno != "1") + { + this.rdoRunModel0.Visibility = Visibility.Hidden; + this.rdoRunModel1.Visibility = Visibility.Hidden; + this.rdoRunModel2.Visibility = Visibility.Hidden; + } + else + { + List listnode = DBService.GetNodeSettingList("", new List()); + NodeSetting node = listnode.FirstOrDefault(t => t.NodeNo == "1001"); + if (node != null) + { + if (node.IsClearCar == 1) + { + rdoRunModel1.Background = new SolidColorBrush(Color.FromRgb(0x1f, 0xb0, 0x8e)); + //this.rdoRunModel1.IsChecked = true; + } + else if (node.IsClearCar == 2) + { + rdoRunModel2.Background = new SolidColorBrush(Color.FromRgb(0x1f, 0xb0, 0x8e)); + //this.rdoRunModel2.IsChecked = true; + } + else + { + rdoRunModel0.Background = new SolidColorBrush(Color.FromRgb(0x1f, 0xb0, 0x8e)); + // this.rdoRunModel0.IsChecked = true; + } + } + } + //UpdateLocatorCarDB(); + + //BindPlan(); + //BindProductDesc(); + ////BindKC(); + //BindModelLocatorList(); + //BindLocatorViewList(); + + LastDBTime = new DateTime(); + + uplineBoard = new FormUpLineBoard(); + } + catch (Exception ex) + { + //MessageBox.Show("系统错误:" + ex.Message); + lblMessage.Content = "系统错误:" + ex.Message; + MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod(); + Common.Log.Error(method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace); + } + } + + + /// + /// 绑定左侧库位图形列表 + /// + private void BindLocatorViewList() + { + + // refrushState = false; + try + { + + Application.Current.Dispatcher.Invoke(new Action( + delegate + { + + + LeftLocatorInfo.Children.Clear(); + RightLocatorInfo.Children.Clear(); + + lblemptycarnum.Content = this.listCarreals.Count(t => t.MaterialNo == ""); + + List liststorage = new List(); + foreach (var area in this.listCatchAreas) + { + + var list1 = this.listCarreals.Where(t => t.LocatorId == area.Id).ToList(); + List list = new List(); + foreach (var realcar in list1) + { + CarInfo car = new CarInfo(); + car.LineAreaId = realcar.LocatorId; + car.CarNo = realcar.CarNo; + car.IsOutLocator = realcar.IsOutLocator; + car.IsPreOut = realcar.IsProOutLocator; + car.MaterialBarNo = realcar.MaterialBarNo; + car.MaterialNo = realcar.MaterialNo.Trim(); + list.Add(car); + } + + + if (area.LineNo == "1") + { + UCStorageNewx locator = new UCStorageNewx(); + locator.LocatorId = area.Id; + locator.TotalNum = area.MaxNumber; + locator.StorageNm = area.AreaNm; + locator.AreaType = area.LineNo; + locator.StorageTypeNm = area.MaterialNm;// area.AreaStorageType == 0 ? "混合库" : "单型库"; + locator.ProductCar = list; + locator.SetCarLocatorEvent += CarSetting; + locator.SetLocatorMaterialEvent += SetLocatorMaterial; + // liststorage.Add(locator); + LeftLocatorInfo.Children.Add(locator); + } + else + { + UCStorageNew locator = new UCStorageNew(); + locator.LocatorId = area.Id; + locator.TotalNum = area.MaxNumber; + locator.StorageNm = area.AreaNm; + locator.AreaType = area.LineNo; + locator.StorageTypeNm = area.MaterialNm; // area.AreaStorageType == 0 ? "混合库" : "单型库"; + locator.ProductCar = list; + locator.SetCarLocatorEvent += CarSetting; + locator.SetLocatorMaterialEvent += SetLocatorMaterial; + //liststorage.Add(locator); + RightLocatorInfo.Children.Add(locator); + } + } + + + })); + + } + catch (Exception ex) + { + MessageBox.Show(ex.Message); + MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod(); + Common.Log.Error(method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace); + } + //lvStorages.ItemsSource = liststorage; + //lvStorages.Items.Refresh(); + + } + + private void UpdateLocatorCarDB() + { + this.listCatchAreas = DBService.GetLineCatchAreaList(" and areatype=4"); + this.listCarreals = DBService.getCarInfoList("", null); + + } + private string SetLocatorMaterial(int locatorid) + { + + if (formSelect != null) + { + formSelect.Close(); + formSelect = null; + } + formSelect = new FormShowSelect(2, FormHandUp.WeekNo, locatorid); + formSelect.optLocatorEvent += SetLocatorMaterial; + formSelect.Show(); + return ""; + } + + private void SetLocatorMaterial(int locatorid, string val) + { + + TTransport transport = new TSocket(Common.ThriftConfigIp, 7915); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + transport.Open(); + string ret = client.OperateLocatorMaterial(locatorid, val); + if (ret == "") + { + Application.Current.Dispatcher.Invoke(new Action( + delegate + { + MessageBox.Show("修改成功"); + this.formSelect.Close(); + this.formSelect = null; + + LastDBTime = new DateTime(); + })); + } + else + { + Application.Current.Dispatcher.Invoke(new Action( + delegate + { + MessageBox.Show(ret); + })); + } + transport.Close(); + transport.Dispose(); + transport = null; + + } + + /// + /// 绑定型号库位 + /// + private void CheckDBandPLCState() + { + Application.Current.Dispatcher.Invoke(new Action( + delegate + { + try + { + bool state = DBService.GetDBTime(""); + if (state) + { + serverDBState.Fill = new SolidColorBrush(Colors.Green); + } + else + { + serverDBState.Fill = new SolidColorBrush(Colors.Red); + } + + + } + catch (Exception ex) + { + serverDBState.Fill = new SolidColorBrush(Colors.Red); + } + })); + } + + + ///// + ///// 绑定型号库位 + ///// + //private void BindModelLocatorList() + //{ + // List listCar = new List(); + // Application.Current.Dispatcher.Invoke(new Action( + // delegate + // { + + + // leftmodelLocator.Children.Clear(); + // rightmodelLocator.Children.Clear(); + // modelLocator.Children.Clear(); + + // foreach (var realcar in listCarreals) + // { + // CarInfo car = new CarInfo(); + // car.LineAreaId = realcar.LocatorId; + // car.CarNo = realcar.CarNo; + // car.CarNo = realcar.CarNo; + // car.MaterialBarNo = realcar.MaterialBarNo; + // car.IsOutLocator = realcar.IsOutLocator; + // car.MaterialNo = realcar.MaterialNo.Trim(); + // listCar.Add(car); + // } + + + // List liststorage = new List(); + // foreach (var area in listCatchAreas) + // { + + // UCStorage locator = new UCStorage(); + // locator.StorageNm = area.AreaNm; + // locator.AreaType = area.LineNo; + // var list1 = listCar.Where(t => t.LineAreaId == area.Id).ToList(); + // locator.ProductCar = list1; + // locator.TotalNum = area.MaxNumber; + // locator.SetCarLocatorEvent += CarSetting; + // liststorage.Add(locator); + + // if (locator.AreaType == "1") + // { + // leftmodelLocator.Children.Add(locator); + + // } + // else + // { + // rightmodelLocator.Children.Add(locator); + // } + // } + + + // var list = from car in listCar group car by car.MaterialBarNo into materialno select materialno; + // foreach (var car in list) + // { + // Button btn = new Button(); + // btn.Background = new SolidColorBrush(Colors.Gray); + // btn.Foreground = new SolidColorBrush(Colors.White); + // btn.Width = 100; + // btn.Height = 40; + // btn.FontSize = 16; + // btn.Content = car.Key.Trim() == "" ? "空车" : car.Key; + // btn.Tag = car.Key; + // btn.Margin = new Thickness(10); + // btn.Click += Btn_Click; ; + // modelLocator.Children.Add(btn); + // } + + // })); + + + // //lvStorages.ItemsSource = liststorage; + // //lvStorages.Items.Refresh(); + + //} + + private void Btn_Click(object sender, RoutedEventArgs e) + { + Button button = sender as Button; + button.Background = new SolidColorBrush(Colors.Blue); + + + MessageBox.Show(button.Tag.ToString()); + } + + + + private string CarSetting(string carno) + { + + if (CommonHelper.UserName == "") + { + loginForm = new FormLogin(); + loginForm.loginWindow += LoginWindow; + loginForm.Show(); + return ""; + } + + if (CommonHelper.UserName != "") + { + if (formLocator != null) + { + formLocator.Close(); + formLocator = null; + } + + List carlist = DBService.getCarInfoList("", this.listCatchAreas); + var car = carlist.FirstOrDefault(t => t.CarNo == carno); + if (car != null) + { + formLocator = new FormLocator(car); + formLocator.optCarEvent += CarSetting; + formLocator.Show(); + } + else + { + MessageBox.Show("无法找到小车" + carno); + + } + } + return ""; + } + + private string CarSetting(CarRealInfo car) + { + try + { + + TTransport transport = new TSocket(Common.ThriftConfigIp, 7915); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + transport.Open(); + string msg = client.SetCarInfo(car.CarNo, car.MaterialNo, car.MaterialBarNo, car.LocatorId.ToString(), car.IsProOutLocator.ToString(), car.OptDt.ToString()); + transport.Close(); + LastDBTime = DateTime.Now; + return msg; + } + catch (Exception ex) + { + MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod(); + Common.Log.Error(method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace); + } + return ""; + } + + + + private string CarRunModelSetting(int type) + { + try + { + + TTransport transport = new TSocket(Common.ThriftConfigIp, 7911); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + transport.Open(); + string msg = client.OperateUploadPoint("", type); + transport.Close(); + LastDBTime = DateTime.Now; + return msg; + } + catch (Exception ex) + { + MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod(); + Common.Log.Error(method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace); + } + return ""; + } + + private void RefreshUITimer_Tick(object sender, EventArgs e) + { + try + { + + if (LastDBTime <= DateTime.Now.AddSeconds(-30)) + { + CheckDBandPLCState(); + LastDBTime = DateTime.Now; + // BindPlan(); + BindProductDesc(); + // BindKC(); + + UpdateLocatorCarDB(); + // BindModelLocatorList(); + BindLocatorViewList(); + + BindOutingLocatorCars(); + } + } + catch (Exception ex) + { + CommonFunc.Logger logger = new CommonFunc.Logger(); + logger.Error("系统刷新数据上件点异常:" + ex.Message + ex.StackTrace); + } + } + + + private void BindOutingLocatorCars() + { + + + + // refrushState = false; + try + { + + Application.Current.Dispatcher.Invoke(new Action( + delegate + { + List list = DBService.getOutCarInfo(); + this.gridOutCar.ItemsSource = list; + this.gridOutCar.Items.Refresh(); + })); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message); + MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod(); + Common.Log.Error(" 获取出库队列 " + method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace); + } + } + + private void GridMaterial_LoadingRow(object sender, DataGridRowEventArgs e) + { + e.Row.Header = e.Row.GetIndex() + 1; + + } + private void DispatcherTimer_Tick(object sender, EventArgs e) + { + txtTime.Content = DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString(); + if (CommonHelper.UserName != "" && CommonHelper.LoginDt < DateTime.Now.AddMinutes(-5)) + { + CommonHelper.UserName = ""; + } + } + + private void btnExit_Click(object sender, RoutedEventArgs e) + { + try + { + if (MessageBox.Show("是否确认关闭当前窗口", "提示信息", MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.No) + { + return; + } + else + { + Environment.Exit(System.Environment.ExitCode); + } + + } + catch (Exception ex) + { + MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod(); + Common.Log.Error(method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace); + } + } + + private void btnProdDesc_Click(object sender, RoutedEventArgs e) + { + try + { + ///检查库内可入数量 + // AutoClosedMsgBox.Show("最大库存量已满", "提示", 2000); + // return; + + if (lvCars.SelectedIndex == -1) + { + AutoClosedMsgBox.Show("请先选择小车", "提示", 2000); + return; + } + else + { + //var control = lvCars.SelectedItem as UControl.UCCar; + basedata_carrealinfoModel model = lvCars.SelectedItem as basedata_carrealinfoModel; + var button = sender as Button; + model.CarNo = button.CommandParameter.ToString(); + model.ProductCode = button.Content.ToString(); + lvCars.Items.Refresh(); + } + } + catch (Exception ex) + { + MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod(); + Common.Log.Error(method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace); + } + } + + //private void BindPlan() + //{ + // try + // { + // using (basedata_orderplanDb orderplanDb = new basedata_orderplanDb()) + // { + // int week = CommonHelper.WeekOfYear(DateTime.Now, new System.Globalization.CultureInfo("zh-CN")); + // List models = orderplanDb.GetVList(" PlanWeek = " + week).OrderBy(t => t.PlanState).OrderBy(t => t.PlanDate).ToList(); + // gridPlan.ItemsSource = models; + // gridPlan.Items.Refresh(); + // } + // } + // catch (Exception ex) + // { + // MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod(); + // Common.Log.Error(method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace); + // } + + //} + + private void BindProductDesc() + { + try + { + using (basedata_orderplanDb orderplanDb = new basedata_orderplanDb()) + { + + DataSet ds = orderplanDb.GetData(WeekNo.ToString()); + productDesc.ItemsSource = ds.Tables[0].DefaultView; + productDesc.Items.Refresh(); + } + } + catch (Exception ex) + { + MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod(); + Common.Log.Error(method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace); + } + } + + private void btnAdd_Click(object sender, RoutedEventArgs e) + { + try + { + Cars.Add(new basedata_carrealinfoModel()); + lvCars.ItemsSource = Cars; + lvCars.Items.Refresh(); + } + catch (Exception ex) + { + MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod(); + Common.Log.Error(method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace); + } + } + + private void btnDel_Click(object sender, RoutedEventArgs e) + { + try + { + Cars.RemoveAt(0); + lvCars.ItemsSource = Cars; + lvCars.Items.Refresh(); + } + catch (Exception ex) + { + MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod(); + Common.Log.Error(method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace); + } + } + + /// + /// 小车离开上线点 + /// + /// + /// + private void btnLeave_Click(object sender, RoutedEventArgs e) + { + btnLeave.IsEnabled = false; + btnLeave.Content = "发车中..."; + lblMessage.Content = ""; + List carlist = new List(); + foreach (var car in this.lvCars.Items) + { + var carinfo = car as basedata_carrealinfoModel; + + if (!string.IsNullOrEmpty(carinfo.CarNo)) + { + string carStr = carinfo.ProductCode.Trim() + "*" + carinfo.CarNo + "*"; + if (Convert.ToBoolean(rdoTwo.IsChecked)) + { + carStr += "2"; + } + else if (Convert.ToBoolean(rdoThree.IsChecked)) + { + carStr += "3"; + } + else if (Convert.ToBoolean(rdoFour.IsChecked)) + { + carStr += "4"; + } + else + { + carStr += "1"; + } + carlist.Add(carStr); + } + else + { + //MessageBox.Show("请选择物料号"); + lblMessage.Content = "请选择物料号"; + btnLeave.IsEnabled = true; + btnLeave.Content = "发车"; + return; + } + + } + + ThreadBeginLeave = new Thread(new ParameterizedThreadStart(LeaveCar)); + ThreadBeginLeave.Start(carlist); + } + + private void LeaveCar(object obj) + { + + try + { + List carlist = obj as List; + if (carlist.Count > 0) + { + + + TTransport transport = new TSocket(Common.ThriftConfigIp, Convert.ToInt32(Common.ThriftConfigPort)); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + transport.Open(); + string ret = client.DischargeCar(carlist); + if (ret == "") + { + foreach (var car in this.lvCars.Items) + { + var carinfo = car as basedata_carrealinfoModel; + carinfo.ProductCode = ""; + carinfo.CarNo = ""; + } + + + Application.Current.Dispatcher.Invoke(new Action( + delegate + { + lvCars.ItemsSource = Cars; + lvCars.Items.Refresh(); + btnLeave.IsEnabled = true; + btnLeave.Content = "发车"; + })); + } + else + { + + Application.Current.Dispatcher.Invoke(new Action( + delegate + { + lblMessage.Content = ret; + //MessageBox.Show(ret); + btnLeave.IsEnabled = true; + btnLeave.Content = "发车"; + })); + + } + transport.Close(); + } + else + { + Application.Current.Dispatcher.Invoke(new Action( + delegate + { + //MessageBox.Show("请为小车绑定物料信息"); + lblMessage.Content = "请为小车绑定物料信息"; + btnLeave.IsEnabled = true; + btnLeave.Content = "发车"; + })); + + + } + } + catch (Exception ex) + { + Application.Current.Dispatcher.Invoke(new Action( + delegate + { + //MessageBox.Show("请为小车绑定物料信息"); + lblMessage.Content = "服务器连接不上,请重试"; + btnLeave.IsEnabled = true; + btnLeave.Content = "发车"; + })); + + MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod(); + Common.Log.Error(method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace); + } + + } + ///// + ///// + ///// + //private void BindKC() + //{ + // try + // { + // using (basedata_carrealinfoDb carrealinfoDb = new basedata_carrealinfoDb()) + // { + // DataSet ds = carrealinfoDb.GetDataCount(" AreaType>=4"); + + // if (ds.Tables[0].Rows.Count > 0) + // { + // DataTable dataTable = ds.Tables[0]; + // dataTable.Columns.Add("Index", typeof(int)); + // int Index = 0; + // foreach (DataRow row in dataTable.Rows) + // { + // Index++; + // row["Index"] = Index; + // } + // DataView dataView = dataTable.DefaultView; + // //gridEmergency.ItemsSource = dataView; + // //gridEmergency.Items.Refresh(); + // } + // } + // } + // catch (Exception ex) + // { + // MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod(); + // Common.Log.Error(method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace); + // } + + //} + + + + private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + //TabControl controlTab = sender as TabControl; + //if (lastindex != controlTab.SelectedIndex) + //{ + + // if (controlTab.Name != "tabLocator") + // { + // if (controlTab.SelectedIndex == 0) + // { + + // BindProductDesc(); + + // } + // else if (controlTab.SelectedIndex == 1) + // { + // BindPlan(); + // } + // else if (controlTab.SelectedIndex == 2) + // { + // UpdateLocatorCarDB(); + // BindModelLocatorList(); + // } + // else if (controlTab.SelectedIndex == 3) + // { + // UpdateLocatorCarDB(); + // BindLocatorViewList(); + // } + // else if (controlTab.SelectedIndex == 4) + // { + + // } + // lastindex = controlTab.SelectedIndex; + // e.Handled = true; + // LastDBTime = new DateTime(); + // } + //} + LastDBTime = new DateTime(); + } + + private void BtnClearCar_Click(object sender, RoutedEventArgs e) + { + DBService.GetClearMaterial(""); + LastDBTime = new DateTime(); + + } + + private void RdoRunModel2_Checked(object sender, RoutedEventArgs e) + { + + if (CommonHelper.UserName == "") + { + loginForm = new FormLogin(); + loginForm.loginWindow += LoginWindow; + loginForm.Show(); + return; + } + + if (CommonHelper.UserName != "") + { + CarRunModelSetting(2); + rdoRunModel2.Background = new SolidColorBrush(Color.FromRgb(0x1f, 0xb0, 0x8e)); + rdoRunModel1.Background = new SolidColorBrush(Colors.Silver); + rdoRunModel0.Background = new SolidColorBrush(Colors.Silver); + } + } + private string LoginWindow(string loginnm, string pwd) + { + CommonHelper.UserName = loginnm; + CommonHelper.LoginDt = DateTime.Now; + return ""; + } + + private void RdoRunModel1_Checked(object sender, RoutedEventArgs e) + { + + if (CommonHelper.UserName == "") + { + loginForm = new FormLogin(); + loginForm.loginWindow += LoginWindow; + loginForm.Show(); + return; + } + + if (CommonHelper.UserName != "") + { + CarRunModelSetting(1); + rdoRunModel1.Background = new SolidColorBrush(Color.FromRgb(0x1f, 0xb0, 0x8e)); + rdoRunModel2.Background = new SolidColorBrush(Colors.Silver); + rdoRunModel0.Background = new SolidColorBrush(Colors.Silver); + } + + } + + private void RdoRunModel0_Checked(object sender, RoutedEventArgs e) + { + + if (CommonHelper.UserName == "") + { + loginForm = new FormLogin(); + loginForm.loginWindow += LoginWindow; + loginForm.Show(); + return; + } + + if (CommonHelper.UserName != "") + { + CarRunModelSetting(0); + rdoRunModel0.Background = new SolidColorBrush(Color.FromRgb(0x1f, 0xb0, 0x8e)); + rdoRunModel1.Background = new SolidColorBrush(Colors.Silver); + rdoRunModel2.Background = new SolidColorBrush(Colors.Silver); + } + + } + + private void BtnAdd_Copy_Click(object sender, RoutedEventArgs e) + { + + } + + private void BtnLastWeek_Click(object sender, RoutedEventArgs e) + { + + FormHandUp.WeekNo -= 1; + lblWeekDay.Content = FormHandUp.WeekNo.ToString(); + LastDBTime = new DateTime(); + } + + private void BtnNextWeek_Click(object sender, RoutedEventArgs e) + { + + FormHandUp.WeekNo += 1; + lblWeekDay.Content = FormHandUp.WeekNo.ToString(); + LastDBTime = new DateTime(); + } + + private void BtnSearchCar_Click(object sender, RoutedEventArgs e) + { + List list = DBService.getCurrCarInfo(txtCarNo.Text); + if(list.Count<=0) + { + MessageBox.Show("无法找到相关信息"); + return; + } + this.gridCarReal.ItemsSource = list; + this.gridCarReal.Items.Refresh(); + } + + //private void TabLocator_SelectionChanged(object sender, SelectionChangedEventArgs e) + //{ + // TabControl controlTab = sender as TabControl; + // if (controlTab.Name == "tabLocator") + // { + // if (controlTab.SelectedIndex == 0) + // { + + // UpdateLocatorCarDB(); + // BindLocatorViewList(); + + // } + // else if (controlTab.SelectedIndex == 1) + // { + // UpdateLocatorCarDB(); + // BindLocatorViewList(); + // } + // e.Handled = true; + // LastDBTime = new DateTime(); + // } + //} + } +} diff --git a/shangjian/XGLFinishPro/FormItem/FormLocator.xaml b/shangjian/XGLFinishPro/FormItem/FormLocator.xaml new file mode 100644 index 0000000..c77fa81 --- /dev/null +++ b/shangjian/XGLFinishPro/FormItem/FormLocator.xaml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/shangjian/XGLFinishPro/FormItem/FormLocator.xaml.cs b/shangjian/XGLFinishPro/FormItem/FormLocator.xaml.cs new file mode 100644 index 0000000..b81bcf6 --- /dev/null +++ b/shangjian/XGLFinishPro/FormItem/FormLocator.xaml.cs @@ -0,0 +1,194 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; +using CentralControl.DBDAO; +using CentralControl.BaseData; +namespace XGL.FormItem +{ + /// + /// FormLocator.xaml 的交互逻辑 + /// + public partial class FormLocator : Window + { + + public delegate string OptCarDelegate(CarRealInfo car); + public event OptCarDelegate optCarEvent; + + FormShowSelect form; + private CarRealInfo CarInfo { get; set; } + public FormLocator() + { + InitializeComponent(); + + } + public FormLocator(CarRealInfo carinfo) + { + InitializeComponent(); + this.CarInfo = carinfo; + } + + private void Window_Loaded(object sender, RoutedEventArgs e) + { + this.lblCarNo.Content = this.CarInfo.CarNo; + this.lblLocatorNo.Content = this.CarInfo.LocatorId != 0 ? this.CarInfo.LocatorId : 0; + this.lblMaterialNo.Content = this.CarInfo.MaterialNo; + this.lblMaterialNm.Content = this.CarInfo.MaterialBarNo; + this.lblMaterialNum.Content = this.CarInfo.HadNumber.ToString(); + this.CarInfo.MaterialBarNo = "D3"; + if (this.CarInfo.IsProOutLocator == 1) + { + this.btnOutLocator.IsChecked = true; + } + else if (this.CarInfo.IsProOutLocator == 2) + { + this.btnBackLocator.IsChecked = true; + } + else + { + this.btnNoOpt.IsChecked = true; + this.btnWarehouseA.IsChecked = true; + } + if (this.CarInfo.LocatorId > 9) + { + this.btnWarehouseC.Visibility = Visibility.Hidden; + } + else + { + this.btnWarehouseC.Visibility = Visibility.Visible; + } + } + + private void BtnclearLocator_Click(object sender, RoutedEventArgs e) + { + this.lblLocatorNo.Content = ""; + this.CarInfo.LocatorId = 0; + } + + private void BtnclearCar_Click(object sender, RoutedEventArgs e) + { + this.lblCarNo.Content = ""; + //this.CarInfo.CarNo = 0; + } + + private void BtnclearMaterial_Click(object sender, RoutedEventArgs e) + { + this.lblMaterialNo.Content = ""; + this.lblMaterialNm.Content = ""; + this.CarInfo.MaterialBarNo = ""; + this.CarInfo.MaterialNo = ""; + } + + private void BtnselectLocator_Click(object sender, RoutedEventArgs e) + { + + if (form != null) + { + form.Close(); + form = null; + } + form = new FormShowSelect(0); + form.optItemEvent += SelectLocatorItem; + form.Show(); + } + + private void SelectMaterialItem(string val1, string val2) + { + this.lblMaterialNo.Content = val1.Trim(); + this.lblMaterialNm.Content = val2.Trim(); + this.CarInfo.MaterialBarNo = val2.Trim(); ; + this.CarInfo.MaterialNo = val1.Trim(); + } + + private void SelectLocatorItem(string val1, string val2) + { + this.lblLocatorNo.Content = val2.Trim(); + this.CarInfo.LocatorId = Convert.ToInt32(val1); + + } + private void BtnselectCar_Click(object sender, RoutedEventArgs e) + { + + } + + private void BtnselecMaterial_Click(object sender, RoutedEventArgs e) + { + if (form != null) + { + form.Close(); + form = null; + } + form = new FormShowSelect(1); + form.optItemEvent += SelectMaterialItem; + form.Show(); + } + + private void BtnSaveSetting_Click(object sender, RoutedEventArgs e) + { + try + { + string msg = ""; + if (optCarEvent != null) + { + if (this.CarInfo.IsOutLocator == 2) + { + msg = "当前小车已经出库,不能重复出库!"; + MessageBox.Show(msg); + return; + } + msg = optCarEvent(this.CarInfo); + MessageBox.Show(msg); + this.Close(); + } + + } + catch (Exception ex) + { + + MessageBox.Show("出库异常!" + ex.ToString()); + return; + } + } + + private void BtnCancelSetting_Click(object sender, RoutedEventArgs e) + { + this.Close(); + } + + private void BtnOutLocator_Click(object sender, RoutedEventArgs e) + { + this.CarInfo.IsProOutLocator = 1; + } + + private void BtnBackLocator_Click(object sender, RoutedEventArgs e) + { + this.CarInfo.IsProOutLocator = 2; + } + + private void BtnNoOpt_Checked(object sender, RoutedEventArgs e) + { + this.CarInfo.IsProOutLocator = 0; + + } + private void BtnWareHouseA_Click(object sender, RoutedEventArgs e) + { + this.CarInfo.MaterialBarNo = "D3"; + } + private void BtnWareHouseB_Click(object sender, RoutedEventArgs e) + { + this.CarInfo.MaterialBarNo = "TV"; + } + private void BtnWareHouseC_Click(object sender, RoutedEventArgs e) + { + this.CarInfo.MaterialBarNo = "TQ"; + } + } +} diff --git a/shangjian/XGLFinishPro/FormItem/FormLogin.xaml b/shangjian/XGLFinishPro/FormItem/FormLogin.xaml new file mode 100644 index 0000000..5399024 --- /dev/null +++ b/shangjian/XGLFinishPro/FormItem/FormLogin.xaml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/shangjian/XGLFinishPro/FormItem/FormLogin.xaml.cs b/shangjian/XGLFinishPro/FormItem/FormLogin.xaml.cs new file mode 100644 index 0000000..993ae94 --- /dev/null +++ b/shangjian/XGLFinishPro/FormItem/FormLogin.xaml.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; +using CentralControl.DBDAO; +using CentralControl.BaseData; +using System.Data; +using XGL.Data; +using XGL.Models; + +namespace XGL.FormItem +{ + /// + /// FormLocator.xaml 的交互逻辑 + /// + public partial class FormLogin : Window + { + + public delegate string LoginDelegate(string usernm, string passwd); + public event LoginDelegate loginWindow; + + public FormLogin() + { + InitializeComponent(); + + } + public FormLogin(int type) + { + InitializeComponent(); + + } + + + private void BtnCancelSetting_Click(object sender, RoutedEventArgs e) + { + this.Close(); + } + + private void BtnSaveSetting_Click(object sender, RoutedEventArgs e) + { + string usernm = txtUserNm.Text; + string pwsd = txtPwd.Password; + if (loginWindow != null) + { + using (common_auth_userDb userdb = new common_auth_userDb()) + { + common_auth_userModel user= userdb.GetModel(usernm); + if(pwsd== DESProvider.DecryptString(user.LoginPwd)) + { + this.Close(); + loginWindow(usernm, pwsd); + }else + { + MessageBox.Show("密码错误,重新输入"); + } + } + + + } + } + + private void Window_Loaded(object sender, RoutedEventArgs e) + { + + } + } +} diff --git a/shangjian/XGLFinishPro/FormItem/FormOutBoxBoard.xaml b/shangjian/XGLFinishPro/FormItem/FormOutBoxBoard.xaml new file mode 100644 index 0000000..2a9e311 --- /dev/null +++ b/shangjian/XGLFinishPro/FormItem/FormOutBoxBoard.xaml @@ -0,0 +1,301 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/shangjian/XGLFinishPro/FormItem/FormShowSelect.xaml.cs b/shangjian/XGLFinishPro/FormItem/FormShowSelect.xaml.cs new file mode 100644 index 0000000..d86c2ac --- /dev/null +++ b/shangjian/XGLFinishPro/FormItem/FormShowSelect.xaml.cs @@ -0,0 +1,135 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; +using CentralControl.DBDAO; +using CentralControl.BaseData; +using System.Data; +using XGL.Data; + +namespace XGL.FormItem +{ + /// + /// FormLocator.xaml 的交互逻辑 + /// + public partial class FormShowSelect : Window + { + + + + public delegate void OptCarDelegate(string file1, string file2); + public event OptCarDelegate optItemEvent; + + public delegate void OptLocatorDelegate(int locatorid,string file1); + public event OptLocatorDelegate optLocatorEvent; + + private int SelectType { get; set; } + private int WeekDay { get; set; } + + private int LocatorId { get; set; } + public FormShowSelect() + { + InitializeComponent(); + + } + public FormShowSelect(int type) + { + InitializeComponent(); + this.SelectType = type; + } + + public FormShowSelect(int type, int week,int locatorid) + { + InitializeComponent(); + this.SelectType = type; + this.WeekDay = week; + this.LocatorId = locatorid; + } + private void GridMaterial_LoadingRow(object sender, DataGridRowEventArgs e) + { + e.Row.Header = e.Row.GetIndex() + 1; + } + private void Window_Loaded(object sender, RoutedEventArgs e) + { + if (SelectType == 0) + { + List dt = DBService.GetLineCatchAreaList(""); + this.gridLocatorDataList.ItemsSource = dt.Where(t => t.AreaType == 4).ToList(); + // this.gridLocatorDataList.Items.Refresh(); + this.gridLocatorDataList.Visibility = Visibility.Visible; + + } + else if (SelectType == 1) + { + List list = DBService.GetMaterialInfoList(""); + this.gridMaterialList.ItemsSource = list; + // this.gridMaterialList.Items.Refresh(); + this.gridMaterialList.Visibility = Visibility.Visible; + } + else if (SelectType == 2) + { + List list = new List(); + using (basedata_orderplanDb orderplanDb = new basedata_orderplanDb()) + { + DataSet ds = orderplanDb.GetData(this.WeekDay.ToString()); + foreach (DataRow dr in ds.Tables[0].Rows) + { + MaterialInfo mater = new MaterialInfo(); + mater.MaterialNo = dr["MaterialNo"].ToString(); + mater.MaterialNm = dr["MaterialNm"].ToString(); + list.Add(mater); + } + } + + this.gridMaterialList.ItemsSource = list; + // this.gridMaterialList.Items.Refresh(); + this.gridMaterialList.Visibility = Visibility.Visible; + } + + + } + + private void BtnSaveSetting_Click(object sender, RoutedEventArgs e) + { + if (optItemEvent != null) + { + if (this.gridLocatorDataList.Visibility != Visibility.Hidden) + { + LineCatchArea selectrow = (this.gridLocatorDataList.SelectedItem as LineCatchArea); + string val = selectrow.AreaNo.ToString(); + optItemEvent(selectrow.Id.ToString(), val); + } + else + { + MaterialInfo selectrow = (this.gridMaterialList.SelectedItem as MaterialInfo); + string val = selectrow.MaterialNo.ToString(); + string val1 = selectrow.MaterialNm.ToString(); + optItemEvent(val, val1); + } + this.Close(); + + } + + if(optLocatorEvent!=null) + { + MaterialInfo selectrow = (this.gridMaterialList.SelectedItem as MaterialInfo); + string val = selectrow.MaterialNo.ToString(); + string val1 = selectrow.MaterialNm.ToString(); + optLocatorEvent(this.LocatorId, val); + } + } + + private void BtnCancelSetting_Click(object sender, RoutedEventArgs e) + { + this.Close(); + } + } +} diff --git a/shangjian/XGLFinishPro/FormItem/FormTakeOff.xaml b/shangjian/XGLFinishPro/FormItem/FormTakeOff.xaml new file mode 100644 index 0000000..d92f5ce --- /dev/null +++ b/shangjian/XGLFinishPro/FormItem/FormTakeOff.xaml @@ -0,0 +1,295 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/shangjian/XGLFinishPro/FormItem/FormTakeOff.xaml.cs b/shangjian/XGLFinishPro/FormItem/FormTakeOff.xaml.cs new file mode 100644 index 0000000..54dd607 --- /dev/null +++ b/shangjian/XGLFinishPro/FormItem/FormTakeOff.xaml.cs @@ -0,0 +1,300 @@ +using CommonFunc; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; +using System.Windows.Threading; +using XGL.Data; +using XGL.Models; +using Thrift.Protocol; +using Thrift.Server; +using Thrift.Transport; +using CentralControl.BaseData; +using CentralControl.DBDAO; +namespace XGL.FormItem +{ + /// + /// FormHandUp.xaml 的交互逻辑 + /// + public partial class FormTakeOff : Window + { + /// + /// 时间刷新 + /// + private DispatcherTimer dispatcherTimer; + + public FormTakeOff() + { + InitializeComponent(); + } + + private void Window_Loaded(object sender, RoutedEventArgs e) + { + try + { + + string thriftport = System.Configuration.ConfigurationManager.AppSettings["localPort"]; + Thread offMaterialThriftThread = new Thread(new ParameterizedThreadStart(StartOffThriftLogic)); + offMaterialThriftThread.Start(thriftport); + + + dispatcherTimer = new DispatcherTimer(); + dispatcherTimer.Interval = TimeSpan.FromMilliseconds(1000); + dispatcherTimer.Tick += DispatcherTimer_Tick; + dispatcherTimer.IsEnabled = true; + dispatcherTimer.Start(); + txtTime.Content = DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString(); + List tests = new List() { + // new test() + //{ + // ProductCode="e", + //}, + new test() + { + ProductCode="d", + }, + new test() + { + ProductCode="c", + }, + new test() + { + ProductCode="b", + }, + new test() + { + ProductCode="a", + } + }; + lvCars.ItemsSource = tests; + lvCars.Items.Refresh(); + + List tests1 = new List() { + new test() + { + ProductCode="f", + }, + new test() + { + ProductCode="e", + }, + new test() + { + ProductCode="d", + }, + new test() + { + ProductCode="c", + }, + new test() + { + ProductCode="b", + }, + new test() + { + ProductCode="a", + } + }; + List tests2 = new List() { + new test() + { + ProductCode="c", + }, + new test() + { + ProductCode="b", + }, + new test() + { + ProductCode="a", + } + }; + lvCar.ItemsSource = tests1; + lvCar.Items.Refresh(); + + lvEmptyCars1.ItemsSource = tests2; + lvEmptyCars1.Items.Refresh(); + lvEmptyCars2.ItemsSource = tests2; + lvEmptyCars2.Items.Refresh(); + } + catch (Exception ex) + { + MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod(); + Common.Log.Error(method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace); + } + } + + + /// + /// 启动小车扫描监听队列 + /// + private void StartOffThriftLogic(object thriftpoint) + { + int point = Convert.ToInt32(thriftpoint); + XGL.Thrift.ThriftServiceImp business = new XGL.Thrift.ThriftServiceImp(); + business.GetUnloadMaterialEvent += GetUnloadMaterial; + XGL.Thrift.ThriftCommon thriftCommon = new XGL.Thrift.ThriftCommon(); + thriftCommon.Start(business, point); + + } + + + string GetUnloadMaterial(string carno, string materialno, string materialdesc, string orderno, string str1, string str2, string str3) + { + Application.Current.Dispatcher.Invoke(new Action( + delegate + { + lblBarcode.Content = str1; + lblCarNo.Content = carno; + lblMaterialDesc.Content = materialdesc; + lblMaterialMode.Content = str2; + lblMaterialNo.Content = materialno; + lblOrdercode.Content = orderno; + })); + + return ""; + } + + + private void DispatcherTimer_Tick(object sender, EventArgs e) + { + txtTime.Content = DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString(); + } + + private void btnExit_Click(object sender, RoutedEventArgs e) + { + try + { + if (MessageBox.Show("是否确认关闭当前窗口", "提示信息", MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.No) + { + return; + } + else + { + Environment.Exit(System.Environment.ExitCode); + } + + } + catch (Exception ex) + { + MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod(); + Common.Log.Error(method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace); + } + } + + /// + /// 下件 + /// + /// + /// + private void btnTakeOff_Click(object sender, RoutedEventArgs e) + { + try + { + TTransport transport = new TSocket(Common.ThriftConfigIp, Convert.ToInt32(Common.ThriftConfigPort)); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + transport.Open(); + client.UnloadCarMaterial(lblCarNo.Content.ToString().Trim()); + transport.Close(); + } + catch (Exception ex) + { + MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod(); + Common.Log.Error(method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace); + } + } + + /// + /// 拉回 + /// + /// + /// + private void btnPullBack_Click(object sender, RoutedEventArgs e) + { + try + { + TTransport transport = new TSocket(Common.ThriftConfigIp, Convert.ToInt32(Common.ThriftConfigPort)); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + transport.Open(); + List list = new List(); + list.Add(lblCarNo.Content.ToString().Trim()); + client.HaulbackCarFromPoint(list); + transport.Close(); + } + catch (Exception ex) + { + MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod(); + Common.Log.Error(method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace); + } + + } + //private void BindPlan() + //{ + // try + // { + // using (basedata_orderplanDb orderplanDb = new basedata_orderplanDb()) + // { + // List models = orderplanDb.GetVList(""); + // gridPlan.ItemsSource = models; + // gridPlan.Items.Refresh(); + // } + // } + // catch (Exception ex) + // { + // MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod(); + // Common.Log.Error(method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace); + // } + + //} + + + private void BindBill() + { + try + { + + } + catch (Exception ex) + { + MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod(); + Common.Log.Error(method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace); + } + + } + + /// + /// 绑定暂存区域库存信息 + /// + private void BindKC() + { + try + { + using (basedata_carrealinfoDb carrealinfoDb = new basedata_carrealinfoDb()) + { + DataSet ds = carrealinfoDb.GetDataCount(" AreaType>=4"); + //gridEmergency.ItemsSource = ds.Tables[0].DefaultView; + //gridEmergency.Items.Refresh(); + } + } + catch (Exception ex) + { + MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod(); + Common.Log.Error(method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace); + } + + } + } +} diff --git a/shangjian/XGLFinishPro/FormItem/FormUpLineBoard.xaml b/shangjian/XGLFinishPro/FormItem/FormUpLineBoard.xaml new file mode 100644 index 0000000..36f714a --- /dev/null +++ b/shangjian/XGLFinishPro/FormItem/FormUpLineBoard.xaml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + 记住密码 + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/shangjian/XGLFinishPro/UControl/UCUserList.xaml.cs b/shangjian/XGLFinishPro/UControl/UCUserList.xaml.cs new file mode 100644 index 0000000..16a81fe --- /dev/null +++ b/shangjian/XGLFinishPro/UControl/UCUserList.xaml.cs @@ -0,0 +1,64 @@ +using CommonFunc; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using XGL.Data; + +namespace XGL.UControl +{ + /// + /// UCUserList.xaml 的交互逻辑 + /// + public partial class UCUserList : UserControl + { + public UCUserList() + { + InitializeComponent(); + } + + private void Button_Click(object sender, RoutedEventArgs e) + { + + } + + private void btnQuary_Click(object sender, RoutedEventArgs e) + { + if (CommonHelper.IsHavePermition("1002", "Quary")) + { + //MainContent.Child = new UControl.UCUserList(); + } + else + { + MessageBox.Show("用户没有按钮权限,请联系管理员!", "提示", MessageBoxButton.OK); + return; + } + } + + private void BindGrid() + { + try + { + using (userDB ud = new userDB()) + { + + } + } + catch (Exception ex) + { + MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod(); + Common.Log.Error(method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace); + } + } + } +} diff --git a/shangjian/XGLFinishPro/UControl/ordertj.xaml b/shangjian/XGLFinishPro/UControl/ordertj.xaml new file mode 100644 index 0000000..4bfa826 --- /dev/null +++ b/shangjian/XGLFinishPro/UControl/ordertj.xaml @@ -0,0 +1,19 @@ + + + + + + + + + + + + diff --git a/shangjian/XGLFinishPro/UControl/ordertj.xaml.cs b/shangjian/XGLFinishPro/UControl/ordertj.xaml.cs new file mode 100644 index 0000000..4a88455 --- /dev/null +++ b/shangjian/XGLFinishPro/UControl/ordertj.xaml.cs @@ -0,0 +1,157 @@ +using CentralControl.DBDAO; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; +using XGL.Models; + +namespace XGL.UControl +{ + /// + /// orderzy.xaml 的交互逻辑 + /// + public partial class ordertj : Window + { + //需要转入的订单号 + public static string orderCode_no = ""; + //上件数量 + public static string upNum_no = ""; + public static string lineCode = ""; + //计划数量 + public static string upQuanity_no = ""; + //传值订单号 + public static string orderCode = ""; + public static string upQuanity = ""; + public static string upNum = ""; + public static string lineCode_no = ""; + public ordertj() + { + InitializeComponent(); + } + //内筒号 + public static string order_code = ""; + int number_XB = 0; + int znumber = 0; + private void Window_Loaded(object sender, RoutedEventArgs e) + { + orderCode_no = orderCode; + upNum_no = upNum; + upQuanity_no = upQuanity; + lineCode_no = lineCode; + this.ydd.Text = order_code; + //根据订单的对应线体查询此订单在线边库的物料数量 + DBService userXB = new DBService(); + var number_xianbian = userXB.GetMaterielNoNumber_xb(lineCode_no, this.ydd.Text.Trim()); + + if (number_xianbian != null && number_xianbian.Rows.Count > 0 && number_xianbian.Rows[0]["materiel_num_add"].ToString() != "") + { + number_XB = Convert.ToInt32(number_xianbian.Rows[0]["materiel_num_add"].ToString()); + } + else + { + number_XB = 0; + } + //获取库区内此物料总数量 + DBService userKK = new DBService(); + var item = userKK.GetMaterielNoNumber(this.ydd.Text.Trim()); + //获取此物料订单上件数量 + DBService userKB = new DBService(); + var item1 = userKB.GetMaterielNoNumber_dingdan(); + //存在订单的上件数量 + int numb = 0; + //存在订单的出库数量 + int numb_xj = 0; + if (item1 != null && item1.Rows.Count > 0) + { + foreach (DataRow i in item1.Rows) + { + if (this.ydd.Text.Trim().ToString().Equals(i["materiel_box_no"].ToString())) + { + numb += Convert.ToInt32(i["UpQuantity"].ToString()); + numb_xj += Convert.ToInt32(i["OutWareHouseQuantity"].ToString()); + } + } + } + if (item != null && item.Rows.Count > 0) + { + znumber = Convert.ToInt32(item.Rows[0]["materiel_num"].ToString()); + int maybe_amount = Convert.ToInt32(item.Rows[0]["materiel_num"].ToString()) + number_XB - (numb - numb_xj); + if (maybe_amount < 0 || maybe_amount.ToString() == "" || maybe_amount.ToString() == null) + { + maybe_amount = 0; + } + this.ydd_ky.Text = maybe_amount.ToString().Trim(); + } + else + { + MessageBox.Show("暂无可转入物料"); + this.Close(); + } + } + + private void Button_Click(object sender, RoutedEventArgs e) + { + this.Close(); + } + + private void Button_Click_1(object sender, RoutedEventArgs e) + { + //查询 + try + { + var reg = @"^[0-9]\d*$"; + if (this.xdd.Text.Trim() == "") + { + MessageBox.Show("请填写转入数量"); + } + else if (!Regex.IsMatch(this.xdd.Text.Trim(), reg)) + { + MessageBox.Show("转入数量不可为非数字"); + } + else if (Convert.ToInt32(this.xdd.Text.Trim()) < 0) + { + MessageBox.Show("转入数量不可为负数"); + } + else if (Convert.ToInt32(this.xdd.Text.Trim()) <= Convert.ToInt32(this.ydd_ky.Text.Trim())) + { + if (Convert.ToInt32(this.xdd.Text.Trim()) + Convert.ToInt32(upNum_no) <= Convert.ToInt32(upQuanity_no)) + { + DBService.SetUpdateOrderLineNum_zhuanru(orderCode_no, Convert.ToInt32(this.xdd.Text.Trim()));//修改上件数量 + + if (number_XB != 0 && znumber < Convert.ToInt32(this.xdd.Text.Trim()))//可转数量>大库区数量并且线边数量<>0 + { + DBService.SetUpdateOrderLineNum_zhuanruCK(orderCode_no, Convert.ToInt32(this.xdd.Text.Trim()) - znumber);//修改出库数量 + } + + MessageBox.Show("转入成功!", "提示", MessageBoxButton.OK); + this.DialogResult = true; + this.Close(); + } + else + { + MessageBox.Show("转入数量加上件数量大于计划数量"); + } + } + else + { + MessageBox.Show("转入数量大于可转入数量,请重新输入"); + } + } + catch (Exception ex) + { + MessageBox.Show("获取订单错误"); + } + } + + } +} diff --git a/shangjian/XGLFinishPro/UControl/orderzfzy.xaml b/shangjian/XGLFinishPro/UControl/orderzfzy.xaml new file mode 100644 index 0000000..1ac85d2 --- /dev/null +++ b/shangjian/XGLFinishPro/UControl/orderzfzy.xaml @@ -0,0 +1,17 @@ + + + + + + + + + + diff --git a/shangjian/XGLFinishPro/UControl/orderzfzy.xaml.cs b/shangjian/XGLFinishPro/UControl/orderzfzy.xaml.cs new file mode 100644 index 0000000..f0b5255 --- /dev/null +++ b/shangjian/XGLFinishPro/UControl/orderzfzy.xaml.cs @@ -0,0 +1,92 @@ +using CentralControl.DBDAO; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; +using XGL.Models; + +namespace XGL.UControl +{ + /// + /// orderzy.xaml 的交互逻辑 + /// + public partial class orderzfzy : Window + { + public orderzfzy() + { + InitializeComponent(); + } + public static string order_code = ""; + + private void Window_Loaded(object sender, RoutedEventArgs e) + { + this.ydd.Text = order_code; + } + + private void Button_Click(object sender, RoutedEventArgs e) + { + this.Close(); + } + + private void Button_Click_1(object sender, RoutedEventArgs e) + { + //查询 + try + { + List model = new List(); + DBService userDb = new DBService(); + var Items = userDb.GetOrderZFZYList(this.ydd.Text.Trim()); + if (Items != null && Items.Rows.Count > 0) + { + List model1 = new List(); + DBService userDb1 = new DBService(); + var Items1 = userDb1.GetOrderZYList(this.xdd.Text.Trim(), ""); + if (Items1 != null && Items1.Rows.Count > 0) + { + if (Items.Rows[0]["materiel_box_no"].ToString()!= Items1.Rows[0]["materiel_box_no"].ToString()) + { + MessageBox.Show("原订单与新订单的内筒编号不一致!", "提示", MessageBoxButton.OK); + return; + } + //if (Items.Rows[0]["line_code"].ToString() != Items1.Rows[0]["line_code"].ToString()) + //{ + // MessageBox.Show("原订单与新订单的线体不一致!", "提示", MessageBoxButton.OK); + // return; + //} + //修改订单数量 + int num = Convert.ToInt32(Items.Rows[0]["UpQuantity"].ToString()) - Convert.ToInt32(Items.Rows[0]["outwarehousequantity"].ToString());//查询数量 + DBService.SetUpdateOrderLineNum(Items.Rows[0]["order_code"].ToString(), -num); + DBService.SetUpdateOrderNum(Items1.Rows[0]["order_code"].ToString(), num); + MessageBox.Show("转移成功!", "提示", MessageBoxButton.OK); + this.DialogResult = true; + this.Close(); + } + else + { + MessageBox.Show("未查到新订单信息!", "提示", MessageBoxButton.OK); + return; + } + } + else + { + MessageBox.Show("未查到原订单信息!", "提示", MessageBoxButton.OK); + return; + } + } + catch (Exception ex) + { + MessageBox.Show("获取订单错误"); + } + } + + } +} diff --git a/shangjian/XGLFinishPro/UControl/orderzy.xaml b/shangjian/XGLFinishPro/UControl/orderzy.xaml new file mode 100644 index 0000000..56503d1 --- /dev/null +++ b/shangjian/XGLFinishPro/UControl/orderzy.xaml @@ -0,0 +1,17 @@ + + + + + + + + + + diff --git a/shangjian/XGLFinishPro/UControl/orderzy.xaml.cs b/shangjian/XGLFinishPro/UControl/orderzy.xaml.cs new file mode 100644 index 0000000..64620e3 --- /dev/null +++ b/shangjian/XGLFinishPro/UControl/orderzy.xaml.cs @@ -0,0 +1,92 @@ +using CentralControl.DBDAO; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; +using XGL.Models; + +namespace XGL.UControl +{ + /// + /// orderzy.xaml 的交互逻辑 + /// + public partial class orderzy : Window + { + public orderzy() + { + InitializeComponent(); + } + public static string order_code = ""; + + private void Window_Loaded(object sender, RoutedEventArgs e) + { + this.ydd.Text = order_code; + } + + private void Button_Click(object sender, RoutedEventArgs e) + { + this.Close(); + } + + private void Button_Click_1(object sender, RoutedEventArgs e) + { + //查询 + try + { + List model = new List(); + DBService userDb = new DBService(); + var Items = userDb.GetOrderZYList(this.ydd.Text.Trim()); + if (Items != null && Items.Rows.Count > 0) + { + List model1 = new List(); + DBService userDb1 = new DBService(); + var Items1 = userDb1.GetOrderZYList(this.xdd.Text.Trim(),""); + if (Items1 != null && Items1.Rows.Count > 0) + { + if (Items.Rows[0]["materiel_box_no"].ToString()!= Items1.Rows[0]["materiel_box_no"].ToString()) + { + MessageBox.Show("原订单与新订单的内筒编号不一致!", "提示", MessageBoxButton.OK); + return; + } + //if (Items.Rows[0]["line_code"].ToString() != Items1.Rows[0]["line_code"].ToString()) + //{ + // MessageBox.Show("原订单与新订单的线体不一致!", "提示", MessageBoxButton.OK); + // return; + //} + //修改订单数量 + int num = Convert.ToInt32(Items.Rows[0]["UpQuantity"].ToString()) - Convert.ToInt32(Items.Rows[0]["outwarehousequantity"].ToString());//查询数量 + DBService.SetUpdateOrderNum(Items.Rows[0]["order_code"].ToString(), -num); + DBService.SetUpdateOrderNum(Items1.Rows[0]["order_code"].ToString(), num); + MessageBox.Show("转移成功!", "提示", MessageBoxButton.OK); + this.DialogResult = true; + this.Close(); + } + else + { + MessageBox.Show("未查到新订单信息!", "提示", MessageBoxButton.OK); + return; + } + } + else + { + MessageBox.Show("未查到原订单信息!", "提示", MessageBoxButton.OK); + return; + } + } + catch (Exception ex) + { + MessageBox.Show("获取订单错误"); + } + } + + } +} diff --git a/shangjian/XGLFinishPro/UControl/product_order.xaml b/shangjian/XGLFinishPro/UControl/product_order.xaml new file mode 100644 index 0000000..6b5a801 --- /dev/null +++ b/shangjian/XGLFinishPro/UControl/product_order.xaml @@ -0,0 +1,194 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/shangjian/XGLFinishPro/UControl/product_order.xaml.cs b/shangjian/XGLFinishPro/UControl/product_order.xaml.cs new file mode 100644 index 0000000..555a8a2 --- /dev/null +++ b/shangjian/XGLFinishPro/UControl/product_order.xaml.cs @@ -0,0 +1,167 @@ +using CentralControl.DBDAO; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; +using XGL; +using XGL.Data; +using XGL.Models; + +namespace CSWMS.UControl +{ + /// + /// UserAdd.xaml 的交互逻辑 + /// + public partial class product_order : Window + { + public static string id = ""; + public static string order_code = ""; + public static string line_code = ""; + public static string prod_code = ""; + public static string materiel_box_no = ""; + public product_order() + { + WindowStartupLocation = WindowStartupLocation.CenterScreen; + InitializeComponent(); + } + + private void Window_Loaded(object sender, RoutedEventArgs e) + { + //查询 + try + { + List model = new List(); + DBService userDb = new DBService(); + var Items = userDb.GetUnitList_new(); + if (Items != null && Items.Rows.Count > 0) + { + foreach (DataRow row in Items.Rows) + { + common_base_unitModel list_model = new common_base_unitModel(); + list_model.id = row["id"].ToString(); + list_model.order_code = row["order_code"].ToString(); + list_model.line_code = row["line_code"].ToString(); + list_model.prod_code = row["prod_desc"].ToString(); + list_model.materiel_box_no = row["materiel_box_no"].ToString(); + list_model.est = Convert.ToDateTime(row["est"].ToString()).ToString("yyyy-MM-dd"); + list_model.Quantity = row["Quantity"].ToString(); + list_model.UpQuantity = row["UpQuantity"].ToString(); + list_model.production_sequence = row["production_sequence"].ToString(); + model.Add(list_model); + } + gridBill.ItemsSource = model; + } + else + { + MessageBox.Show("未查到订单信息!", "提示", MessageBoxButton.OK); + return; + } + } + catch(Exception ex) + { + MessageBox.Show("获取订单错误"); + } + } + + private void gridBill_MouseDoubleClick(object sender, MouseButtonEventArgs e) + { + try { + if (gridBill.SelectedIndex != -1) + { + var unit = this.gridBill.SelectedItem as common_base_unitModel; + if (unit != null) + { + id = unit.id; + order_code = unit.order_code; + line_code = unit.line_code; + prod_code = unit.prod_code; + materiel_box_no = unit.materiel_box_no; + this.DialogResult = true; + this.Close(); + } + else + { + this.Close(); + } + } + } + catch (Exception ex) + { + this.Close(); + } + } + + private void Button_ChaXun(object sender, RoutedEventArgs e) + { + //查询 + try + { + string lineCode = ""; + if (this.line_name.Text.Trim() == "A线") + { + lineCode = "D3"; + } + else if (this.line_name.Text.Trim() == "B线") + { + lineCode = "TV"; + } + else if (this.line_name.Text.Trim() == "C线") + { + lineCode = "TQ"; + } + else if(this.line_name.Text.Trim() == "F线") + { + lineCode = "W8"; + } + List model = new List(); + DBService userDb = new DBService(); + var Items = userDb.GetUnitList_line(lineCode); + if (Items != null && Items.Rows.Count > 0) + { + foreach (DataRow row in Items.Rows) + { + common_base_unitModel list_model = new common_base_unitModel(); + list_model.id = row["id"].ToString(); + list_model.order_code = row["order_code"].ToString(); + list_model.line_code = row["line_code"].ToString(); + list_model.prod_code = row["prod_desc"].ToString(); + list_model.materiel_box_no = row["materiel_box_no"].ToString(); + list_model.est = Convert.ToDateTime(row["est"].ToString()).ToString("yyyy-MM-dd"); + list_model.Quantity = row["Quantity"].ToString(); + list_model.UpQuantity = row["UpQuantity"].ToString(); + list_model.production_sequence = row["production_sequence"].ToString(); + model.Add(list_model); + } + gridBill.ItemsSource = model; + } + else + { + MessageBox.Show("未查到订单信息!", "提示", MessageBoxButton.OK); + return; + } + } + catch (Exception ex) + { + MessageBox.Show("获取订单错误"); + } + } + + /// + /// 显示序号事件 + /// + /// + /// + private void dgData_LoadingRow(object sender, DataGridRowEventArgs e) + { e.Row.Header = e.Row.GetIndex() + 1; } + } + +} diff --git a/shangjian/XGLFinishPro/UControl/product_ordertj.xaml b/shangjian/XGLFinishPro/UControl/product_ordertj.xaml new file mode 100644 index 0000000..6b62cd7 --- /dev/null +++ b/shangjian/XGLFinishPro/UControl/product_ordertj.xaml @@ -0,0 +1,210 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/shangjian/XGLFinishPro/UControl/product_ordertj.xaml.cs b/shangjian/XGLFinishPro/UControl/product_ordertj.xaml.cs new file mode 100644 index 0000000..a5c4a4e --- /dev/null +++ b/shangjian/XGLFinishPro/UControl/product_ordertj.xaml.cs @@ -0,0 +1,333 @@ +using CentralControl.DBDAO; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; +using XGL; +using XGL.Data; +using XGL.Models; +using XGL.UControl; + +namespace CSWMS.UControl +{ + /// + /// UserAdd.xaml 的交互逻辑 + /// + public partial class product_ordertj : Window + { + public static string id = ""; + public static string order_code = ""; + public static string line_code = ""; + public static string prod_code = ""; + public static string materiel_box_no = ""; + public product_ordertj() + { + WindowStartupLocation = WindowStartupLocation.CenterScreen; + InitializeComponent(); + } + + private void Window_Loaded(object sender, RoutedEventArgs e) + { + //查询 + try + { + List model = new List(); + //获取所有订单 + DBService userDb = new DBService(); + var Items = userDb.GetOrderTJList(); + if (Items != null && Items.Rows.Count > 0) + { + foreach (DataRow row in Items.Rows) + { + common_base_unitModel list_model = new common_base_unitModel(); + list_model.id = row["id"].ToString(); + list_model.order_code = row["order_code"].ToString(); + list_model.line_code = row["line_code"].ToString(); + list_model.prod_code = row["prod_desc"].ToString(); + list_model.materiel_box_no = row["materiel_box_no"].ToString(); + list_model.est = Convert.ToDateTime(row["est"].ToString()).ToString("yyyy-MM-dd"); + list_model.Quantity = row["Quantity"].ToString(); + list_model.UpQuantity = row["UpQuantity"].ToString(); + list_model.outwarehousequantity = row["outwarehousequantity"].ToString(); + list_model.production_sequence = row["production_sequence"].ToString(); + + //查询此订单的可转入物料数量 + //根据订单的对应线体查询此订单在线边库的物料数量 + DBService userXB = new DBService(); + var number_xianbian = userXB.GetMaterielNoNumber_xb(row["line_code"].ToString(), row["materiel_box_no"].ToString()); + int number_XB = 0; + if (number_xianbian != null && number_xianbian.Rows.Count > 0 && number_xianbian.Rows[0]["materiel_num_add"].ToString() != "") + { + number_XB = Convert.ToInt32(number_xianbian.Rows[0]["materiel_num_add"].ToString()); + } + else + { + number_XB = 0; + } + //获取库区内此物料总数量 + DBService userKK = new DBService(); + var item = userKK.GetMaterielNoNumber(row["materiel_box_no"].ToString()); + //获取此物料订单上件数量 + DBService userKB = new DBService(); + var item1 = userKB.GetMaterielNoNumber_dingdan(); + //存在订单的上件数量 + int numb = 0; + //存在订单的出库数量 + int numb_xj = 0; + if (item1 != null && item1.Rows.Count > 0) + { + foreach (DataRow i in item1.Rows) + { + if (row["materiel_box_no"].ToString().Equals(i["materiel_box_no"].ToString())) + { + numb += Convert.ToInt32(i["UpQuantity"].ToString()); + numb_xj += Convert.ToInt32(i["OutWareHouseQuantity"].ToString()); + } + } + } + if (item != null && item.Rows.Count > 0) + { + + list_model.area_amount = item.Rows[0]["materiel_num"].ToString(); + list_model.maby_amount = (Convert.ToInt32(item.Rows[0]["materiel_num"].ToString()) + number_XB - (numb - numb_xj)).ToString(); + if (Convert.ToInt32(list_model.maby_amount) <= 0 || list_model.maby_amount == null || list_model.maby_amount == "") + { + list_model.maby_amount = "0"; + } + } + else + { + list_model.area_amount = "0"; + list_model.maby_amount = "0"; + //try + //{ + // if (number_XB > 0) + // { + // list_model.maby_amount = number_XB.ToString(); + // } + //} + //catch (Exception ex) + //{ + + //} + + } + model.Add(list_model); + } + gridBill.ItemsSource = model; + } + else + { + MessageBox.Show("未查到订单信息!", "提示", MessageBoxButton.OK); + return; + } + } + catch(Exception ex) + { + MessageBox.Show("获取订单错误"); + } + } + + private void gridBill_MouseDoubleClick(object sender, MouseButtonEventArgs e) + { + try + { + if (gridBill.SelectedIndex != -1) + { + var unit = this.gridBill.SelectedItem as common_base_unitModel; + if (unit != null) + { + id = unit.id; + order_code = unit.order_code; + line_code = unit.line_code; + prod_code = unit.prod_code; + materiel_box_no = unit.materiel_box_no; + this.DialogResult = true; + this.Close(); + } + else + { + this.Close(); + } + } + } + catch (Exception ex) + { + this.Close(); + } + } + + private void BtnAction_Click(object sender, RoutedEventArgs e) + { + try + { + common_base_unitModel mySelectedElement = (common_base_unitModel)gridBill.SelectedItem; + string order_code = mySelectedElement.materiel_box_no; + string orderCode = mySelectedElement.order_code; + string upNum = mySelectedElement.UpQuantity; + string upQuanity = mySelectedElement.Quantity; + string line_code = mySelectedElement.line_code; + + ordertj order = new ordertj(); + ordertj.order_code = order_code; + ordertj.orderCode = orderCode; + ordertj.upNum = upNum; + ordertj.upQuanity = upQuanity; + ordertj.lineCode = line_code; + + if (order.ShowDialog() == true) + { + //查询 + try + { + Button_ChaXun(null,null); + } + catch (Exception ex) + { + MessageBox.Show("获取订单错误"); + } + } + } + catch (Exception ex) + { + this.Focus(); + } + } + /// + /// 显示序号事件 + /// + /// + /// + private void dgData_LoadingRow(object sender, DataGridRowEventArgs e) + { e.Row.Header = e.Row.GetIndex() + 1; } + + private void Button_ChaXun(object sender, RoutedEventArgs e) + { + //查询 + try + { + string lineCode = ""; + if (this.line_name.Text.Trim() == "A线") + { + lineCode = "D3"; + } + else if (this.line_name.Text.Trim() == "B线") + { + lineCode = "TV"; + } + else if (this.line_name.Text.Trim() == "C线") + { + lineCode = "TQ"; + } + else if(this.line_name.Text.Trim() == "F线") + { + lineCode = "W8"; + } + List model = new List(); + //获取所有订单 + DBService userDb = new DBService(); + var Items = userDb.GetOrderTJList_new(lineCode); + if (Items != null && Items.Rows.Count > 0) + { + foreach (DataRow row in Items.Rows) + { + common_base_unitModel list_model = new common_base_unitModel(); + list_model.id = row["id"].ToString(); + list_model.order_code = row["order_code"].ToString(); + list_model.line_code = row["line_code"].ToString(); + list_model.prod_code = row["prod_desc"].ToString(); + list_model.materiel_box_no = row["materiel_box_no"].ToString(); + list_model.est = Convert.ToDateTime(row["est"].ToString()).ToString("yyyy-MM-dd"); + list_model.Quantity = row["Quantity"].ToString(); + list_model.UpQuantity = row["UpQuantity"].ToString(); + list_model.outwarehousequantity = row["outwarehousequantity"].ToString(); + list_model.production_sequence = row["production_sequence"].ToString(); + + //查询此订单的可转入物料数量 + //根据订单的对应线体查询此订单在线边库的物料数量 + DBService userXB = new DBService(); + var number_xianbian = userXB.GetMaterielNoNumber_xb(row["line_code"].ToString(), row["materiel_box_no"].ToString()); + int number_XB = 0; + if (number_xianbian != null && number_xianbian.Rows.Count > 0 && number_xianbian.Rows[0]["materiel_num_add"].ToString() != "") + { + number_XB = Convert.ToInt32(number_xianbian.Rows[0]["materiel_num_add"].ToString()); + } + else + { + number_XB = 0; + } + //获取库区内此物料总数量 + DBService userKK = new DBService(); + var item = userKK.GetMaterielNoNumber(row["materiel_box_no"].ToString()); + //获取此物料订单上件数量 + DBService userKB = new DBService(); + var item1 = userKB.GetMaterielNoNumber_dingdan(); + //存在订单的上件数量 + int numb = 0; + //存在订单的出库数量 + int numb_xj = 0; + if (item1 != null && item1.Rows.Count > 0) + { + foreach (DataRow i in item1.Rows) + { + if (row["materiel_box_no"].ToString().Equals(i["materiel_box_no"].ToString())) + { + numb += Convert.ToInt32(i["UpQuantity"].ToString()); + numb_xj += Convert.ToInt32(i["OutWareHouseQuantity"].ToString()); + } + } + } + + if (item != null && item.Rows.Count > 0) + { + list_model.area_amount = item.Rows[0]["materiel_num"].ToString(); + list_model.maby_amount = (Convert.ToInt32(item.Rows[0]["materiel_num"].ToString()) + number_XB - (numb - numb_xj)).ToString(); + if (Convert.ToInt32(list_model.maby_amount) <= 0 || list_model.maby_amount == null || list_model.maby_amount == "") + { + list_model.maby_amount = "0"; + } + } + else + { + list_model.area_amount = "0"; + list_model.maby_amount = "0"; + //try + //{ + // if (number_XB > 0) + // { + // list_model.maby_amount = number_XB.ToString(); + // } + //} + //catch (Exception ex) + //{ + + //} + + } + model.Add(list_model); + } + gridBill.ItemsSource = model; + } + else + { + MessageBox.Show("未查到订单信息!", "提示", MessageBoxButton.OK); + return; + } + } + catch (Exception ex) + { + MessageBox.Show("获取订单错误"); + } + } + } + +} diff --git a/shangjian/XGLFinishPro/UControl/product_orderzfzy.xaml b/shangjian/XGLFinishPro/UControl/product_orderzfzy.xaml new file mode 100644 index 0000000..eb271a8 --- /dev/null +++ b/shangjian/XGLFinishPro/UControl/product_orderzfzy.xaml @@ -0,0 +1,190 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/shangjian/XGLFinishPro/UControl/product_orderzfzy.xaml.cs b/shangjian/XGLFinishPro/UControl/product_orderzfzy.xaml.cs new file mode 100644 index 0000000..1a4e3ad --- /dev/null +++ b/shangjian/XGLFinishPro/UControl/product_orderzfzy.xaml.cs @@ -0,0 +1,160 @@ +using CentralControl.DBDAO; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; +using XGL; +using XGL.Data; +using XGL.Models; +using XGL.UControl; + +namespace CSWMS.UControl +{ + /// + /// UserAdd.xaml 的交互逻辑 + /// + public partial class product_orderzfzy : Window + { + public static string id = ""; + public static string order_code = ""; + public static string line_code = ""; + public static string prod_code = ""; + public static string materiel_box_no = ""; + public product_orderzfzy() + { + WindowStartupLocation = WindowStartupLocation.CenterScreen; + InitializeComponent(); + } + + private void Window_Loaded(object sender, RoutedEventArgs e) + { + //查询 + try + { + List model = new List(); + DBService userDb = new DBService(); + var Items = userDb.GetOrderZFZYList(); + if (Items != null && Items.Rows.Count > 0) + { + foreach (DataRow row in Items.Rows) + { + common_base_unitModel list_model = new common_base_unitModel(); + list_model.id = row["id"].ToString(); + list_model.order_code = row["order_code"].ToString(); + list_model.line_code = row["line_code"].ToString(); + list_model.prod_code = row["prod_code"].ToString(); + list_model.materiel_box_no = row["materiel_box_no"].ToString(); + list_model.est = row["est"].ToString(); + list_model.Quantity = row["Quantity"].ToString(); + list_model.UpQuantity = row["UpQuantity"].ToString(); + list_model.outwarehousequantity = row["outwarehousequantity"].ToString(); + list_model.kzquantity = row["kzquantity"].ToString(); + model.Add(list_model); + } + gridBill.ItemsSource = model; + } + else + { + MessageBox.Show("未查到订单信息!", "提示", MessageBoxButton.OK); + return; + } + } + catch(Exception ex) + { + MessageBox.Show("获取订单错误"); + } + } + + private void gridBill_MouseDoubleClick(object sender, MouseButtonEventArgs e) + { + try + { + if (gridBill.SelectedIndex != -1) + { + var unit = this.gridBill.SelectedItem as common_base_unitModel; + if (unit != null) + { + id = unit.id; + order_code = unit.order_code; + line_code = unit.line_code; + prod_code = unit.prod_code; + materiel_box_no = unit.materiel_box_no; + this.DialogResult = true; + this.Close(); + } + else + { + this.Close(); + } + } + } + catch (Exception ex) + { + this.Close(); + } + } + + private void BtnAction_Click(object sender, RoutedEventArgs e) + { + try + { + common_base_unitModel mySelectedElement = (common_base_unitModel)gridBill.SelectedItem; + string order_code = mySelectedElement.order_code; + orderzfzy order = new orderzfzy(); + orderzfzy.order_code = order_code; + if (order.ShowDialog() == true) + { + //查询 + try + { + List model = new List(); + DBService userDb = new DBService(); + var Items = userDb.GetOrderZFZYList(); + if (Items != null && Items.Rows.Count > 0) + { + foreach (DataRow row in Items.Rows) + { + common_base_unitModel list_model = new common_base_unitModel(); + list_model.id = row["id"].ToString(); + list_model.order_code = row["order_code"].ToString(); + list_model.line_code = row["line_code"].ToString(); + list_model.prod_code = row["prod_code"].ToString(); + list_model.materiel_box_no = row["materiel_box_no"].ToString(); + list_model.est = row["est"].ToString(); + list_model.Quantity = row["Quantity"].ToString(); + list_model.UpQuantity = row["UpQuantity"].ToString(); + list_model.outwarehousequantity = row["outwarehousequantity"].ToString(); + list_model.kzquantity = row["kzquantity"].ToString(); + model.Add(list_model); + } + gridBill.ItemsSource = model; + } + else + { + MessageBox.Show("未查到订单信息!", "提示", MessageBoxButton.OK); + return; + } + } + catch (Exception ex) + { + MessageBox.Show("获取订单错误"); + } + } + } + catch (Exception ex) + { + this.Focus(); + } + } + } + +} diff --git a/shangjian/XGLFinishPro/UControl/product_orderzy.xaml b/shangjian/XGLFinishPro/UControl/product_orderzy.xaml new file mode 100644 index 0000000..70102f8 --- /dev/null +++ b/shangjian/XGLFinishPro/UControl/product_orderzy.xaml @@ -0,0 +1,190 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/shangjian/XGLFinishPro/UControl/product_orderzy.xaml.cs b/shangjian/XGLFinishPro/UControl/product_orderzy.xaml.cs new file mode 100644 index 0000000..bb686bc --- /dev/null +++ b/shangjian/XGLFinishPro/UControl/product_orderzy.xaml.cs @@ -0,0 +1,160 @@ +using CentralControl.DBDAO; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; +using XGL; +using XGL.Data; +using XGL.Models; +using XGL.UControl; + +namespace CSWMS.UControl +{ + /// + /// UserAdd.xaml 的交互逻辑 + /// + public partial class product_orderzy : Window + { + public static string id = ""; + public static string order_code = ""; + public static string line_code = ""; + public static string prod_code = ""; + public static string materiel_box_no = ""; + public product_orderzy() + { + WindowStartupLocation = WindowStartupLocation.CenterScreen; + InitializeComponent(); + } + + private void Window_Loaded(object sender, RoutedEventArgs e) + { + //查询 + try + { + List model = new List(); + DBService userDb = new DBService(); + var Items = userDb.GetOrderZYList(); + if (Items != null && Items.Rows.Count > 0) + { + foreach (DataRow row in Items.Rows) + { + common_base_unitModel list_model = new common_base_unitModel(); + list_model.id = row["id"].ToString(); + list_model.order_code = row["order_code"].ToString(); + list_model.line_code = row["line_code"].ToString(); + list_model.prod_code = row["prod_code"].ToString(); + list_model.materiel_box_no = row["materiel_box_no"].ToString(); + list_model.est = row["est"].ToString(); + list_model.Quantity = row["Quantity"].ToString(); + list_model.UpQuantity = row["UpQuantity"].ToString(); + list_model.outwarehousequantity = row["outwarehousequantity"].ToString(); + list_model.kzquantity = row["kzquantity"].ToString(); + model.Add(list_model); + } + gridBill.ItemsSource = model; + } + else + { + MessageBox.Show("未查到订单信息!", "提示", MessageBoxButton.OK); + return; + } + } + catch(Exception ex) + { + MessageBox.Show("获取订单错误"); + } + } + + private void gridBill_MouseDoubleClick(object sender, MouseButtonEventArgs e) + { + try + { + if (gridBill.SelectedIndex != -1) + { + var unit = this.gridBill.SelectedItem as common_base_unitModel; + if (unit != null) + { + id = unit.id; + order_code = unit.order_code; + line_code = unit.line_code; + prod_code = unit.prod_code; + materiel_box_no = unit.materiel_box_no; + this.DialogResult = true; + this.Close(); + } + else + { + this.Close(); + } + } + } + catch (Exception ex) + { + this.Close(); + } + } + + private void BtnAction_Click(object sender, RoutedEventArgs e) + { + try + { + common_base_unitModel mySelectedElement = (common_base_unitModel)gridBill.SelectedItem; + string order_code = mySelectedElement.order_code; + orderzy order = new orderzy(); + orderzy.order_code = order_code; + if (order.ShowDialog() == true) + { + //查询 + try + { + List model = new List(); + DBService userDb = new DBService(); + var Items = userDb.GetOrderZYList(); + if (Items != null && Items.Rows.Count > 0) + { + foreach (DataRow row in Items.Rows) + { + common_base_unitModel list_model = new common_base_unitModel(); + list_model.id = row["id"].ToString(); + list_model.order_code = row["order_code"].ToString(); + list_model.line_code = row["line_code"].ToString(); + list_model.prod_code = row["prod_code"].ToString(); + list_model.materiel_box_no = row["materiel_box_no"].ToString(); + list_model.est = row["est"].ToString(); + list_model.Quantity = row["Quantity"].ToString(); + list_model.UpQuantity = row["UpQuantity"].ToString(); + list_model.outwarehousequantity = row["outwarehousequantity"].ToString(); + list_model.kzquantity = row["kzquantity"].ToString(); + model.Add(list_model); + } + gridBill.ItemsSource = model; + } + else + { + MessageBox.Show("未查到订单信息!", "提示", MessageBoxButton.OK); + return; + } + } + catch (Exception ex) + { + MessageBox.Show("获取订单错误"); + } + } + } + catch (Exception ex) + { + this.Focus(); + } + } + } + +} diff --git a/shangjian/XGLFinishPro/Views/CheckUserWin.xaml b/shangjian/XGLFinishPro/Views/CheckUserWin.xaml new file mode 100644 index 0000000..d518899 --- /dev/null +++ b/shangjian/XGLFinishPro/Views/CheckUserWin.xaml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/shangjian/XGLFinishPro/Views/DryingRoomUC.xaml.cs b/shangjian/XGLFinishPro/Views/DryingRoomUC.xaml.cs new file mode 100644 index 0000000..74cc121 --- /dev/null +++ b/shangjian/XGLFinishPro/Views/DryingRoomUC.xaml.cs @@ -0,0 +1,261 @@ +using CommonFunc.Tools; +using System; +using System.Collections.Generic; +using System.Data; +using System.Timers; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using XGL.Data.DBService; + +namespace XGLFinishPro.Views +{ + /// + /// DryingRoomUC.xaml 的交互逻辑 + /// + public partial class DryingRoomUC : UserControl + { + DringRoomService dringRoomService = new DringRoomService(); + Timer timerDeciveState = new Timer(); + string deviceCode = ""; + + public DryingRoomUC() + { + InitializeComponent(); + } + + private void UserControl_Loaded(object sender, RoutedEventArgs e) + { + timerDeciveState.Interval = Utils.GetAppSetting("GetDeviceStateInterval") == "" ? 15000 : Convert.ToInt32(Utils.GetAppSetting("GetDeviceStateInterval")); + timerDeciveState.Elapsed += TimerDeciveState_Elapsed; + timerDeciveState.Start(); + InitComBoboxData(); + GetDringRoomData(); + GetOutDringRoomData(); + GetDeviceInfo(); + } + + private void GetDeviceInfo() + { + TimerDeciveState_Elapsed(null,null); + } + + private void TimerDeciveState_Elapsed(object sender, ElapsedEventArgs e) + { + DataTable dt = dringRoomService.GetTemperAndHumilly(deviceCode); + if (dt == null) + { + //使用Dispatcher来在UI线程上更新UI + this.Dispatcher.Invoke( + new Action(() => + { + lbCurrTemperature.Content = "0"; + lbCurrHumilly.Content = "0"; + } + ), + System.Windows.Threading.DispatcherPriority.Render); + } + else + { + //使用Dispatcher来在UI线程上更新UI + this.Dispatcher.Invoke( + new Action(() => + { + lbCurrTemperature.Content = dt.Rows[0][0].ToString(); + lbCurrHumilly.Content = dt.Rows[1][0].ToString(); + } + ), + System.Windows.Threading.DispatcherPriority.Render); + } + + DataTable dtDringRoomData = dringRoomService.GetDringRoomData(deviceCode, 1); + if (dtDringRoomData != null) + { + //使用Dispatcher来在UI线程上更新UI + this.Dispatcher.Invoke( + new Action(() => + { + DringRoomListBox.ItemsSource = null; + DringRoomListBox.Items.Clear(); + DringRoomListBox.ItemsSource = dtDringRoomData.DefaultView; + } + ), + System.Windows.Threading.DispatcherPriority.Render); + } + + DataTable dtDringRoomOuter = dringRoomService.GetDringRoomData(deviceCode, 0); + if (dtDringRoomOuter != null) + { + //使用Dispatcher来在UI线程上更新UI + this.Dispatcher.Invoke( + new Action(() => + { + DringRoomOuterListBox.ItemsSource = null; + DringRoomOuterListBox.Items.Clear(); + DringRoomOuterListBox.ItemsSource = dtDringRoomOuter.DefaultView; + } + ), + System.Windows.Threading.DispatcherPriority.Render); + } + + //if (dt.Rows[0][0].ToString() == "1") + //{ + // this.Dispatcher.Invoke( + // new Action(() => { LbDeviceState.Background = Brushes.Green; } + // ), + // System.Windows.Threading.DispatcherPriority.Render); + //} + //else + //{ + // this.Dispatcher.Invoke( + // new Action(() => { LbDeviceState.Background = Brushes.Red; } + // ), + // System.Windows.Threading.DispatcherPriority.Render); + + //} + } + + private void GetDringRoomData() + { + //DringRoomListBox.ItemsSource = null; + //DringRoomListBox.Items.Clear(); + DataTable dt = dringRoomService.GetDringRoomData(deviceCode, 1); + if (dt == null) + { + return; + } + + + //int index = 0; + //int i = 0; + //foreach (DataRow item in dt.Rows) + //{ + // index = i++; + // string rfid = item["rfid_no"].ToString(); + // string workorder_code = item["workorder_code"].ToString(); + // string materialCode = item["material_code"].ToString(); + // string inTime = item["update_time"].ToString(); + + // TimeSpan ts; + + // ts = DateTime.Now - Convert.ToDateTime(inTime); + + // int minuteDiff = Convert.ToInt32(ts.TotalMinutes); + // //string workorder_code = item["workorder_code"].ToString(); + // ModuleUC uc = new ModuleUC(index.ToString(), rfid, workorder_code, materialCode, minuteDiff); + + // DringRoomListBox.Items.Add(uc); + //} + DringRoomListBox.ItemsSource = null; + DringRoomListBox.Items.Clear(); + DringRoomListBox.ItemsSource = dt.DefaultView; + + + } + + private void GetOutDringRoomData() + { + //DringRoomOuterListBox.ItemsSource = null; + //DringRoomOuterListBox.Items.Clear(); + DataTable dt = dringRoomService.GetDringRoomData(deviceCode, 0); + if (dt == null) + { + return; + } + + + //int index = 0; + //int i = 0; + //foreach (DataRow item in dt.Rows) + //{ + // index = i++; + // string rfid = item["rfid_no"].ToString(); + // string workorder_code = item["workorder_code"].ToString(); + // string materialCode = item["material_code"].ToString(); + // string inTime = item["update_time"].ToString(); + // TimeSpan ts; + + // ts = DateTime.Now - Convert.ToDateTime(inTime); + + // int minuteDiff = Convert.ToInt32(ts.TotalMinutes); + // //string workorder_code = item["workorder_code"].ToString(); + // ModuleUC uc = new ModuleUC(index.ToString(), rfid, workorder_code, materialCode, minuteDiff); + + // DringRoomOuterListBox.Items.Add(uc); + //} + DringRoomOuterListBox.ItemsSource = null; + DringRoomOuterListBox.Items.Clear(); + DringRoomOuterListBox.ItemsSource = dt.DefaultView; + + } + + private void InitComBoboxData() + { + DataTable dt = dringRoomService.GetDringRoomInfo(Utils.GetAppSetting("DryingHouseList")); + if (dt == null) + { + CustomMessageBox.Show("没有维护设备信息,请维护设备后重试!", CustomMessageBoxIcon.Warning); + return; + } + + List listEquip = Utils.ToDataList(dt); + //comboDryRoomInfo.SelectedValuePath = "quipName"; + //comboDryRoomInfo.DisplayMemberPath = "quipCode"; + //comboDryRoomInfo.ItemsSource = listEquip; + //绑定 + comboDryRoomInfo.ItemsSource = listEquip; + comboDryRoomInfo.SelectedValuePath = "quipCode"; + comboDryRoomInfo.DisplayMemberPath = "quipName"; + comboDryRoomInfo.SelectedIndex = 0; + } + + private void comboDryRoomInfo_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + string hfCode = comboDryRoomInfo.SelectedValue.ToString();//.Text; + deviceCode = hfCode; + GetDringRoomData(); + GetOutDringRoomData(); + GetDeviceInfo(); + } + + private void btnRefrsh_Click(object sender, RoutedEventArgs e) + { + GetDringRoomData(); + GetOutDringRoomData(); + } + private void btnCheckLog_Click(object sender, RoutedEventArgs e) + { + ViewLogWin viewLogWin = new ViewLogWin(); + viewLogWin.ShowDialog(); + } + + private void btnViewPlcvalue_Click(object sender, RoutedEventArgs e) + { + ViewPlcInfoWin viewPlcWin = new ViewPlcInfoWin(); + viewPlcWin.ShowDialog(); + } + + private void ScrollViewer_PreviewMouseWheel(object sender, MouseWheelEventArgs e) + { + ScrollViewer scrollViewer = sender as ScrollViewer; + if (scrollViewer != null) + { + if (e.Delta > 0) + { + scrollViewer.LineUp(); + } + else + { + scrollViewer.LineDown(); + } + e.Handled = true; + } + } + } + public class EquipmentMode + { + public int type { get; set; } + public string quipCode { get; set; } + public string quipName { get; set; } + } +} diff --git a/shangjian/XGLFinishPro/Views/ExecReportWorkWin.xaml b/shangjian/XGLFinishPro/Views/ExecReportWorkWin.xaml new file mode 100644 index 0000000..e622052 --- /dev/null +++ b/shangjian/XGLFinishPro/Views/ExecReportWorkWin.xaml @@ -0,0 +1,149 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/shangjian/XGLFinishPro/Views/FlowInfoWin.xaml.cs b/shangjian/XGLFinishPro/Views/FlowInfoWin.xaml.cs new file mode 100644 index 0000000..0876f67 --- /dev/null +++ b/shangjian/XGLFinishPro/Views/FlowInfoWin.xaml.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; + +namespace XGLFinishPro.Views +{ + /// + /// FlowInfoWin.xaml 的交互逻辑 + /// + public partial class FlowInfoWin : Window + { + DataTable _dt; + public FlowInfoWin() + { + InitializeComponent(); + } + + public FlowInfoWin(DataTable dt) + { + InitializeComponent(); + _dt = dt; + } + private void Back_Click(object sender, RoutedEventArgs e) + { + this.Close(); + } + + private void Window_Loaded(object sender, RoutedEventArgs e) + { + this.WindowState = WindowState.Maximized; + this.dgFlow.ItemsSource = _dt.DefaultView; + } + + private void dgFlow_LoadingRow(object sender, DataGridRowEventArgs e) + { + e.Row.Header = (e.Row.GetIndex() + 1).ToString(); + } + } +} diff --git a/shangjian/XGLFinishPro/Views/HBLogWin.xaml b/shangjian/XGLFinishPro/Views/HBLogWin.xaml new file mode 100644 index 0000000..23fe3f0 --- /dev/null +++ b/shangjian/XGLFinishPro/Views/HBLogWin.xaml @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/shangjian/XGLFinishPro/Views/LanJu_DeviceItems.xaml.cs b/shangjian/XGLFinishPro/Views/LanJu_DeviceItems.xaml.cs new file mode 100644 index 0000000..8ad63de --- /dev/null +++ b/shangjian/XGLFinishPro/Views/LanJu_DeviceItems.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace XGLFinishPro.Views +{ + /// + /// LanJu_DeviceItems.xaml 的交互逻辑 + /// + public partial class LanJu_DeviceItems : UserControl + { + public LanJu_DeviceItems() + { + InitializeComponent(); + } + } +} diff --git a/shangjian/XGLFinishPro/Views/LanJu_Flow.xaml b/shangjian/XGLFinishPro/Views/LanJu_Flow.xaml new file mode 100644 index 0000000..2e65403 --- /dev/null +++ b/shangjian/XGLFinishPro/Views/LanJu_Flow.xaml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/shangjian/XGLFinishPro/Views/LanJu_Flow.xaml.cs b/shangjian/XGLFinishPro/Views/LanJu_Flow.xaml.cs new file mode 100644 index 0000000..979f099 --- /dev/null +++ b/shangjian/XGLFinishPro/Views/LanJu_Flow.xaml.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace XGLFinishPro.Views +{ + /// + /// LanJu_Flow.xaml 的交互逻辑 + /// + public partial class LanJu_Flow : UserControl + { + public LanJu_Flow() + { + InitializeComponent(); + } + public static int jump = 1; + public static readonly RoutedEvent BackEvent = EventManager.RegisterRoutedEvent("Back", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(LanJu_Flow)); + + public event RoutedEventHandler Back + { + add { AddHandler(BackEvent, value); } + remove { RemoveHandler(BackEvent, value); } + } + + private void Back_Click(object sender, RoutedEventArgs e) + { + if (jump == 1) + { + LanJu_Operator lanJu_Flow = new LanJu_Operator(); + Window2.Content = new Frame + { + Content = lanJu_Flow + }; + + } + else // + { + + + } + } + + + } + +} diff --git a/shangjian/XGLFinishPro/Views/LanJu_InOut.xaml b/shangjian/XGLFinishPro/Views/LanJu_InOut.xaml new file mode 100644 index 0000000..63293ee --- /dev/null +++ b/shangjian/XGLFinishPro/Views/LanJu_InOut.xaml @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/shangjian/XGLFinishPro/Views/LanJu_InOut.xaml.cs b/shangjian/XGLFinishPro/Views/LanJu_InOut.xaml.cs new file mode 100644 index 0000000..a0df282 --- /dev/null +++ b/shangjian/XGLFinishPro/Views/LanJu_InOut.xaml.cs @@ -0,0 +1,161 @@ +using CommonFunc; +using System; +using System.Collections.Generic; +using System.Data; +using System.Windows; +using System.Windows.Controls; +using XGL.Data.DBService; +using XGL.Models.Model.FoamingMac; + +namespace XGLFinishPro.Views +{ + /// + /// LanJu_InOut.xaml 的交互逻辑 + /// + public partial class LanJu_InOut : UserControl + { + + FormingMachineService formingMachineService = new FormingMachineService(); + string _workOrderCode = ""; + string _deviceCode = ""; + public event EventHandler ValueSelected; + public List SFCCodeList { get; private set; } = new List(); + + + public LanJu_InOut() + { + InitializeComponent(); + } + + public LanJu_InOut(string workOrderCode, string deviceCode) + { + InitializeComponent(); + _workOrderCode = workOrderCode; + _deviceCode = deviceCode; + } + + private void UserControl_Loaded(object sender, RoutedEventArgs e) + { + GetInOutRecordInfo(); + } + + public void GetInOutRecordInfo() + { + try + { + List orderList = new List(); + + int currHour = DateTime.Now.Hour; + int currMinute = DateTime.Now.Minute; + //modelWareHouse = new List(); + //userDbWareHouse = new DBService(); + int shiftId = 0; + DataTable shiftlist = formingMachineService.GetShiftList(); + string endTimeRecord = ""; + string startTimeRecord = ""; + foreach (DataRow shift in shiftlist.Rows) + { + string[] timeStart = shift["Shift_Start_Time"].ToString().Split(':'); + string[] timeEnd = shift["Shift_End_Time"].ToString().Split(':'); + + // 创建两个不带日期的时间点 + TimeSpan currTime = new TimeSpan(currHour, currMinute, 0); // 获取当前小时+分钟数 + TimeSpan startTime = new TimeSpan(Convert.ToInt32(timeStart[0]), Convert.ToInt32(timeStart[1]), 0); // 表示9小时45分钟0秒 + TimeSpan endTime = new TimeSpan(Convert.ToInt32(timeEnd[0]), Convert.ToInt32(timeEnd[1]), 0); + // 比较当前时间点和班次开始的时间点 + int comparisonResultStart = TimeSpan.Compare(currTime, startTime); + // 比较当前时间点和班次结束的时间点 + int comparisonResultEnd = TimeSpan.Compare(currTime, endTime); + //if (comparisonResultStart > 0) { Console.WriteLine("time1 大于 time2"); } + if (comparisonResultStart >= 0 && comparisonResultEnd < 0) + { + endTimeRecord = shift["Shift_Start_Time"].ToString(); + startTimeRecord = shift["Shift_End_Time"].ToString(); + shiftId = Convert.ToInt32(shift["shift_id"].ToString()); + break; + } + else if (comparisonResultStart >= 0 || comparisonResultEnd < 0) + { + endTimeRecord = shift["Shift_Start_Time"].ToString(); + startTimeRecord = shift["Shift_End_Time"].ToString(); + shiftId = Convert.ToInt32(shift["shift_id"].ToString()); + break; + } + //if (Convert.ToInt32(timeStart[0]) <= currHourWithDecimal && currHourWithDecimal < Convert.ToInt32(timeEnd[0])) + //{ + // shiftId = shift.shiftId; + // break; + //} + //else if (currHourWithDecimal >= Convert.ToInt32(timeStart[0]) || currHourWithDecimal < Convert.ToInt32(timeEnd[0])) + //{ + // shiftId = shift.shiftId; + // break; + //} + } + + string[] endTimeReally = endTimeRecord.Split(':'); + string[] startTimeReally = startTimeRecord.Split(':'); + DateTime currShiftDate = DateTime.Now.Date; + TimeSpan currTimeNew = new TimeSpan(currHour, currMinute, 0); // 获取当前小时+分钟数 + TimeSpan startTimeNew = new TimeSpan(Convert.ToInt32(startTimeReally[0]), Convert.ToInt32(startTimeReally[1]), 0); // 表示9小时45分钟0秒 + TimeSpan endTimeNew = new TimeSpan(Convert.ToInt32(endTimeReally[0]), Convert.ToInt32(endTimeReally[1]), 0); // 表示9小时45分钟0秒 + //计算白夜班工作日期用 + int resultstart = TimeSpan.Compare(currTimeNew, startTimeNew); + // 比较当前时间点和班次结束的时间点 + int resultEnd = TimeSpan.Compare(currTimeNew, endTimeNew); + + //夜班、 + if (resultstart < 0 && resultEnd < 0) + { + currShiftDate = DateTime.Now.Date.AddDays(-1); + } + + DataTable dt = formingMachineService.GetInOutHistoryList(_workOrderCode, _deviceCode, currShiftDate.ToString()); + if (dt == null) return; + foreach (DataRow i in dt.Rows) + { + FoamingMacModel order = new FoamingMacModel(); + order.workorder_code = i["workorder_code"].ToString(); + order.begin = Convert.ToDateTime(i["begin"].ToString()); + //order.beout = Convert.ToDateTime(i["beout"].ToString()); + order.product_code = i["product_code"].ToString(); + order.product_name = i["product_name"].ToString(); + order.car_num = Convert.ToInt32(i["car_num"].ToString()); + order.product_date = i["plan_time"].ToString(); + order.update_time = i["update_time"].ToString(); + order.status = i["status"].ToString(); + order.work_batch_code = i["work_batch_code"].ToString(); + order.attr1 = i["attr1"].ToString(); + order.taskcode = i["taskcode"].ToString(); + order.rfid = i["rfid"].ToString(); + + orderList.Add(order); + + } + this.dgInOutRecord.ItemsSource = null; + this.dgInOutRecord.ItemsSource = orderList; + } + catch (Exception ex) + { + LogHelper.instance.log.Error("获取出入记录信息时发生异常:" + ex.Message); + } + } + + private void dgInOutRecord_LoadingRow(object sender, DataGridRowEventArgs e) + { + e.Row.Header = (e.Row.GetIndex() + 1).ToString(); + } + + private void dgInOutRecord_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + SFCCodeList.Clear(); + if (SFCCodeList.Count >= 2) + { + + } + SFCCodeList.Add("123"); + SFCCodeList.Add("456"); + ValueSelected?.Invoke(this, EventArgs.Empty); + } + } +} diff --git a/shangjian/XGLFinishPro/Views/LanJu_Index.xaml b/shangjian/XGLFinishPro/Views/LanJu_Index.xaml new file mode 100644 index 0000000..cc781e1 --- /dev/null +++ b/shangjian/XGLFinishPro/Views/LanJu_Index.xaml @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/shangjian/XGLFinishPro/Views/LanJu_Index.xaml.cs b/shangjian/XGLFinishPro/Views/LanJu_Index.xaml.cs new file mode 100644 index 0000000..2ccd7ad --- /dev/null +++ b/shangjian/XGLFinishPro/Views/LanJu_Index.xaml.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace XGLFinishPro.Views +{ + /// + /// LanJu_Index.xaml 的交互逻辑 + /// + public partial class LanJu_Index : UserControl + { + public LanJu_Index() + { + InitializeComponent(); + + } + + private void Prepare_Click(object sender, RoutedEventArgs e) + { + LanJu_Prepare prepare = new LanJu_Prepare(); + Window.Content = new Frame() + { + Content = prepare + }; + } + + private void Operator_Click(object sender, RoutedEventArgs e) + { + LanJu_Operator op = new LanJu_Operator(); + Window.Content = new Frame() + { + Content = op + }; + } + + private void User_Click(object sender, RoutedEventArgs e) + { + LanJu_User lanJu_User = new LanJu_User(); + Window.Content = new Frame() + { + Content = lanJu_User + }; + } + } +} diff --git a/shangjian/XGLFinishPro/Views/LanJu_Material.xaml b/shangjian/XGLFinishPro/Views/LanJu_Material.xaml new file mode 100644 index 0000000..60a37ab --- /dev/null +++ b/shangjian/XGLFinishPro/Views/LanJu_Material.xaml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/shangjian/XGLFinishPro/Views/LanJu_Material.xaml.cs b/shangjian/XGLFinishPro/Views/LanJu_Material.xaml.cs new file mode 100644 index 0000000..9452271 --- /dev/null +++ b/shangjian/XGLFinishPro/Views/LanJu_Material.xaml.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace XGLFinishPro.Views +{ + /// + /// LanJu_Material.xaml 的交互逻辑 + /// + public partial class LanJu_Material : Window + { + DataTable _dt; + public LanJu_Material() + { + InitializeComponent(); + } + + public LanJu_Material(DataTable dt) + { + InitializeComponent(); + _dt = dt; + } + + private void Window_Loaded(object sender, RoutedEventArgs e) + { + this.WindowState = WindowState.Maximized; + if (_dt == null) return; + this.dgMaterialInfo.ItemsSource = _dt.DefaultView; + } + + + private void DataGrid_LoadingRow(object sender, DataGridRowEventArgs e) + { + e.Row.Header = (e.Row.GetIndex() + 1).ToString(); + } + + private void Button_Click(object sender, RoutedEventArgs e) + { + this.Close(); + } + } +} diff --git a/shangjian/XGLFinishPro/Views/LanJu_NowUser.xaml b/shangjian/XGLFinishPro/Views/LanJu_NowUser.xaml new file mode 100644 index 0000000..f7731ea --- /dev/null +++ b/shangjian/XGLFinishPro/Views/LanJu_NowUser.xaml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/shangjian/XGLFinishPro/Views/LanJu_NowUser.xaml.cs b/shangjian/XGLFinishPro/Views/LanJu_NowUser.xaml.cs new file mode 100644 index 0000000..4fb6ddd --- /dev/null +++ b/shangjian/XGLFinishPro/Views/LanJu_NowUser.xaml.cs @@ -0,0 +1,56 @@ +using CommonFunc.Tools; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using XGL.Dats.DBServiceFinishProd; + +namespace XGLFinishPro.Views +{ + /// + /// LanJu_NowUser.xaml 的交互逻辑 + /// + public partial class LanJu_NowUser : UserControl + { + FinishProdDBService userDbWareHouse = new FinishProdDBService(); + string deviceCode = Utils.GetAppSetting("DeviceCode"); + public LanJu_NowUser() + { + InitializeComponent(); + } + + private void DataGrid_LoadingRow(object sender, DataGridRowEventArgs e) + { + e.Row.Header = (e.Row.GetIndex() + 1).ToString(); + } + + private void UserControl_Loaded(object sender, RoutedEventArgs e) + { + GetRecordInfo(); + } + + private void GetRecordInfo() + { + DataTable dt = userDbWareHouse.GetAttendanceRecord(deviceCode); + if (dt == null) + { + dgUserInfo.ItemsSource = null; + } + else + { + dgUserInfo.ItemsSource = dt.DefaultView; + } + } + } +} diff --git a/shangjian/XGLFinishPro/Views/LanJu_Operator.xaml b/shangjian/XGLFinishPro/Views/LanJu_Operator.xaml new file mode 100644 index 0000000..8c3de15 --- /dev/null +++ b/shangjian/XGLFinishPro/Views/LanJu_Operator.xaml @@ -0,0 +1,542 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/shangjian/XGLFinishPro/Views/LanJu_Operator.xaml.cs b/shangjian/XGLFinishPro/Views/LanJu_Operator.xaml.cs new file mode 100644 index 0000000..b955c10 --- /dev/null +++ b/shangjian/XGLFinishPro/Views/LanJu_Operator.xaml.cs @@ -0,0 +1,513 @@ +using CommonFunc; +using CommonFunc.Tools; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Data; +using System.Timers; +using System.Windows; +using System.Windows.Controls; +using XGL.Data.DBService; +using XGL.Dats.DBServiceFinishProd; +using XGL.Models.Model.FoamingMac; +using XGL.Models.Model.OrderPrepare; + +namespace XGLFinishPro.Views + +{ + /// + /// LanJu_Operator.xaml 的交互逻辑 + /// + public partial class LanJu_Operator : UserControl + { + FormingMachineService formingMachineService = new FormingMachineService(); + FinishProdDBService userDbWareHouse = new FinishProdDBService(); + public static LanJu_Operator lanJu_Operator; + Frame frame = new Frame() { Content = new Views.LanJu_InOut()}; + string deviceCode = Utils.GetAppSetting("DeviceCode"); + Timer timerDeciveState = new Timer(); + string _workOrderCode = ""; + + public enum WindowID + { + frame + } + public LanJu_Operator() + { + InitializeComponent(); + WindowChange(WindowID.frame); + + } + + + + public void WindowChange(WindowID windowID) + { + Window1.Content = frame; + } + + List sfcList = null; + + private void InOut_Click(object sender, RoutedEventArgs e) + { + LanJu_InOut lanJu_InOut = new LanJu_InOut(_workOrderCode, deviceCode); + // 在主界面中的某个位置订阅事件 + lanJu_InOut.ValueSelected += (sender1, args) => + { + // 在这里处理从子窗口传回的值 + sfcList = lanJu_InOut.SFCCodeList; + // 执行需要的操作 + }; + Window1.Content = new Frame + { + Content = lanJu_InOut + }; + } + + private void Complete_Click(object sender, RoutedEventArgs e) + { + LanJu_Complete lanJu_Complete = new LanJu_Complete(); + Window1.Content = new Frame + { + Content = lanJu_Complete + }; + } + + private void DeviceItems_Click(object sender, RoutedEventArgs e) + { + LanJu_DeviceItems lanJu_DeviceItems = new LanJu_DeviceItems(); + Window1.Content = new Frame + { + Content = lanJu_DeviceItems + }; + } + + private void Paused_Click(object sender, RoutedEventArgs e) + { + LanJu_Paused lanJu_Paused = new LanJu_Paused(); + Window1.Content= new Frame + { + Content = lanJu_Paused + }; + } + + + private void UCOperator_Loaded(object sender, RoutedEventArgs e) + { + timerDeciveState.Interval = Utils.GetAppSetting("GetDeviceStateInterval") == "" ? 15000 : Convert.ToInt32(Utils.GetAppSetting("GetDeviceStateInterval")); + timerDeciveState.Elapsed += TimerDeciveState_Elapsed; + timerDeciveState.Start(); + GetWorkOrderInfo(); + } + string isbaiye; + string plantime; + private void TimerDeciveState_Elapsed(object sender, ElapsedEventArgs e) + { + if (Utils.isAnyBodyPerating) return; + try + { + List orderList = new List(); + + int currHour = DateTime.Now.Hour; + int currMinute = DateTime.Now.Minute; + //modelWareHouse = new List(); + //userDbWareHouse = new DBService(); + int shiftId = 0; + DataTable shiftlist = formingMachineService.GetShiftList(); + string endTimeRecord = ""; + string startTimeRecord = ""; + foreach (DataRow shift in shiftlist.Rows) + { + string[] timeStart = shift["Shift_Start_Time"].ToString().Split(':'); + string[] timeEnd = shift["Shift_End_Time"].ToString().Split(':'); + + // 创建两个不带日期的时间点 + TimeSpan currTime = new TimeSpan(currHour, currMinute, 0); // 获取当前小时+分钟数 + TimeSpan startTime = new TimeSpan(Convert.ToInt32(timeStart[0]), Convert.ToInt32(timeStart[1]), 0); // 表示9小时45分钟0秒 + TimeSpan endTime = new TimeSpan(Convert.ToInt32(timeEnd[0]), Convert.ToInt32(timeEnd[1]), 0); + // 比较当前时间点和班次开始的时间点 + int comparisonResultStart = TimeSpan.Compare(currTime, startTime); + // 比较当前时间点和班次结束的时间点 + int comparisonResultEnd = TimeSpan.Compare(currTime, endTime); + //if (comparisonResultStart > 0) { Console.WriteLine("time1 大于 time2"); } + if (comparisonResultStart >= 0 && comparisonResultEnd < 0) + { + endTimeRecord = shift["Shift_Start_Time"].ToString(); + startTimeRecord = shift["Shift_End_Time"].ToString(); + shiftId = Convert.ToInt32(shift["shift_id"].ToString()); + break; + } + else if (comparisonResultStart >= 0 || comparisonResultEnd < 0) + { + endTimeRecord = shift["Shift_Start_Time"].ToString(); + startTimeRecord = shift["Shift_End_Time"].ToString(); + shiftId = Convert.ToInt32(shift["shift_id"].ToString()); + break; + } + //if (Convert.ToInt32(timeStart[0]) <= currHourWithDecimal && currHourWithDecimal < Convert.ToInt32(timeEnd[0])) + //{ + // shiftId = shift.shiftId; + // break; + //} + //else if (currHourWithDecimal >= Convert.ToInt32(timeStart[0]) || currHourWithDecimal < Convert.ToInt32(timeEnd[0])) + //{ + // shiftId = shift.shiftId; + // break; + //} + } + + string[] endTimeReally = endTimeRecord.Split(':'); + string[] startTimeReally = startTimeRecord.Split(':'); + DateTime currShiftDate = DateTime.Now.Date; + TimeSpan currTimeNew = new TimeSpan(currHour, currMinute, 0); // 获取当前小时+分钟数 + TimeSpan startTimeNew = new TimeSpan(Convert.ToInt32(startTimeReally[0]), Convert.ToInt32(startTimeReally[1]), 0); // 表示9小时45分钟0秒 + TimeSpan endTimeNew = new TimeSpan(Convert.ToInt32(endTimeReally[0]), Convert.ToInt32(endTimeReally[1]), 0); // 表示9小时45分钟0秒 + //计算白夜班工作日期用 + int resultstart = TimeSpan.Compare(currTimeNew, startTimeNew); + // 比较当前时间点和班次结束的时间点 + int resultEnd = TimeSpan.Compare(currTimeNew, endTimeNew); + + //夜班、 + if (resultstart < 0 && resultEnd < 0) + { + currShiftDate = DateTime.Now.Date.AddDays(-1); + } + + + + //modelWareHouse = new List(); + + DataTable dt = userDbWareHouse.GetWetPlanInfo(deviceCode,currShiftDate.ToString());//formingMachineService.GetFormingMachineInfo(deviceCode, currShiftDate.ToString()); + if (dt == null) return; + + if (orderList != null) + { + //使用Dispatcher来在UI线程上更新UI + this.Dispatcher.Invoke( + new Action(() => + { + this.dgWorkOrderInfo.ItemsSource = null; + this.dgWorkOrderInfo.ItemsSource = dt.DefaultView; + dgWorkOrderInfo.SelectedIndex = 0; + } + ), + System.Windows.Threading.DispatcherPriority.Render); + } + } + catch (Exception ex) + { + LogHelper.instance.log.Error("获取工单准备信息时发生异常:" + ex.Message); + } + } + + private void GetWorkOrderInfo() + { + try + { + List orderList = new List(); + + int currHour = DateTime.Now.Hour; + int currMinute = DateTime.Now.Minute; + //modelWareHouse = new List(); + //userDbWareHouse = new DBService(); + int shiftId = 0; + DataTable shiftlist = formingMachineService.GetShiftList(); + string endTimeRecord = ""; + string startTimeRecord = ""; + foreach (DataRow shift in shiftlist.Rows) + { + string[] timeStart = shift["Shift_Start_Time"].ToString().Split(':'); + string[] timeEnd = shift["Shift_End_Time"].ToString().Split(':'); + + // 创建两个不带日期的时间点 + TimeSpan currTime = new TimeSpan(currHour, currMinute, 0); // 获取当前小时+分钟数 + TimeSpan startTime = new TimeSpan(Convert.ToInt32(timeStart[0]), Convert.ToInt32(timeStart[1]), 0); // 表示9小时45分钟0秒 + TimeSpan endTime = new TimeSpan(Convert.ToInt32(timeEnd[0]), Convert.ToInt32(timeEnd[1]), 0); + // 比较当前时间点和班次开始的时间点 + int comparisonResultStart = TimeSpan.Compare(currTime, startTime); + // 比较当前时间点和班次结束的时间点 + int comparisonResultEnd = TimeSpan.Compare(currTime, endTime); + //if (comparisonResultStart > 0) { Console.WriteLine("time1 大于 time2"); } + if (comparisonResultStart >= 0 && comparisonResultEnd < 0) + { + endTimeRecord = shift["Shift_Start_Time"].ToString(); + startTimeRecord = shift["Shift_End_Time"].ToString(); + shiftId = Convert.ToInt32(shift["shift_id"].ToString()); + break; + } + else if (comparisonResultStart >= 0 || comparisonResultEnd < 0) + { + endTimeRecord = shift["Shift_Start_Time"].ToString(); + startTimeRecord = shift["Shift_End_Time"].ToString(); + shiftId = Convert.ToInt32(shift["shift_id"].ToString()); + break; + } + //if (Convert.ToInt32(timeStart[0]) <= currHourWithDecimal && currHourWithDecimal < Convert.ToInt32(timeEnd[0])) + //{ + // shiftId = shift.shiftId; + // break; + //} + //else if (currHourWithDecimal >= Convert.ToInt32(timeStart[0]) || currHourWithDecimal < Convert.ToInt32(timeEnd[0])) + //{ + // shiftId = shift.shiftId; + // break; + //} + } + + string[] endTimeReally = endTimeRecord.Split(':'); + string[] startTimeReally = startTimeRecord.Split(':'); + DateTime currShiftDate = DateTime.Now.Date; + TimeSpan currTimeNew = new TimeSpan(currHour, currMinute, 0); // 获取当前小时+分钟数 + TimeSpan startTimeNew = new TimeSpan(Convert.ToInt32(startTimeReally[0]), Convert.ToInt32(startTimeReally[1]), 0); // 表示9小时45分钟0秒 + TimeSpan endTimeNew = new TimeSpan(Convert.ToInt32(endTimeReally[0]), Convert.ToInt32(endTimeReally[1]), 0); // 表示9小时45分钟0秒 + //计算白夜班工作日期用 + int resultstart = TimeSpan.Compare(currTimeNew, startTimeNew); + // 比较当前时间点和班次结束的时间点 + int resultEnd = TimeSpan.Compare(currTimeNew, endTimeNew); + + //夜班、 + if (resultstart < 0 && resultEnd < 0) + { + currShiftDate = DateTime.Now.Date.AddDays(-1); + } + + + + //modelWareHouse = new List(); + + DataTable dt = userDbWareHouse.GetWetPlanInfo(deviceCode,currShiftDate.ToString()); + if (dt == null) return; + + this.dgWorkOrderInfo.ItemsSource = null; + this.dgWorkOrderInfo.ItemsSource = dt.DefaultView; + } + catch (Exception ex) + { + LogHelper.instance.log.Error("操作界面:获取成品工单准备信息时发生异常:" + ex.Message); + } + } + + + private void dgWorkOrderInfo_LoadingRow(object sender, DataGridRowEventArgs e) + { + e.Row.Header = (e.Row.GetIndex() + 1).ToString(); + } + + private void btnPause_Click(object sender, RoutedEventArgs e) + { + var selectedRow = (dgWorkOrderInfo.SelectedItem as DataRowView); + //var selectedRow = dgWorkOrderInfo.SelectedItem as FoamingMacModel; + if (selectedRow == null) + { + MessageBox.Show("请选择你要暂停的工单!", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Warning); + return; + } + + var workordercode = selectedRow["workorder_code"].ToString();//.workorder_code; + string currStatus = selectedRow["status"].ToString();//.status; + if (currStatus != "w2") + { + MessageBox.Show("只有活动中的工单才支持暂停!", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Warning); + return; + } + + PauseOrderWin pauseOrderWin = new PauseOrderWin(); + if (pauseOrderWin.ShowDialog() == true) + { + + + formingMachineService.UpdateWorkOrder(workordercode, "w4", pauseOrderWin.remark, pauseOrderWin.type, deviceCode); + GetWorkOrderInfo(); + } + //MessageBoxResult result = MessageBox.Show("你确定要暂停该工单吗?", "温馨提示", MessageBoxButton.YesNo, MessageBoxImage.Information); + //if (result == MessageBoxResult.No) + // return; + + } + + private void btnRecover_Click(object sender, RoutedEventArgs e) + { + //var selectedRow = dgWorkOrderInfo.SelectedItem as FoamingMacModel; + var selectedRow = (dgWorkOrderInfo.SelectedItem as DataRowView); + if (selectedRow == null) + { + MessageBox.Show("请选择你要恢复的工单!", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Warning); + return; + } + var workordercode = selectedRow["workorder_code"].ToString();//.workorder_code; + string currStatus = selectedRow["status"].ToString();//.status; + if (currStatus != "w4") + { + MessageBox.Show("只有暂停中的工单才支持恢复!", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Warning); + return; + } + //MessageBoxResult result = MessageBox.Show("你确定要恢复该工单吗?", "温馨提示", MessageBoxButton.YesNo, MessageBoxImage.Information); + //if (result == MessageBoxResult.No) + // return; + PauseOrderWin pauseOrderWin = new PauseOrderWin(); + if (pauseOrderWin.ShowDialog() == true) + { + formingMachineService.UpdateWorkOrder(workordercode, "w2", pauseOrderWin.remark, pauseOrderWin.type, deviceCode); + GetWorkOrderInfo(); + } + + } + + /// + /// 查看工艺 + /// + /// + /// + private void Flow_Click(object sender, RoutedEventArgs e) + { + var selectedRow = (dgWorkOrderInfo.SelectedItem as DataRowView);//dgWorkOrderInfo.SelectedItem as FoamingMacModel; + if (selectedRow == null) return; + var workordercode = selectedRow["workorder_code"].ToString();//.workorder_code; + DataTable dt = userDbWareHouse.GetFlowInfo(workordercode); + FlowInfoWin flowInfoWin = new FlowInfoWin(dt); + flowInfoWin.ShowDialog(); + } + + /// + /// 查看物料 + /// + /// + /// + private void Material_Click(object sender, RoutedEventArgs e) + { + var selectedRow = (dgWorkOrderInfo.SelectedItem as DataRowView); //dgWorkOrderInfo.SelectedItem as FoamingMacModel; + if (selectedRow == null) return; + var processid = selectedRow["workorder_code"].ToString();//.workorder_code; + DataTable dt = userDbWareHouse.GetMaterialInfo(processid); + LanJu_Material sopInfoWin = new LanJu_Material(dt); + sopInfoWin.ShowDialog(); + } + + /// + /// 查看SOP + /// + /// + /// + private void Button_Click(object sender, RoutedEventArgs e) + { + var selectedRow = (dgWorkOrderInfo.SelectedItem as DataRowView); //dgWorkOrderInfo.SelectedItem as FoamingMacModel; + if (selectedRow == null) return; + var workordercode = selectedRow["route_code"].ToString();//.workorder_code; + DataTable dt = userDbWareHouse.GetSOPInfo(workordercode); + SopInfoWin sopInfoWin = new SopInfoWin(dt); + sopInfoWin.ShowDialog(); + } + + private void btnRefresh_Click(object sender, RoutedEventArgs e) + { + GetWorkOrderInfo(); + LanJu_InOut lanJu_In = new LanJu_InOut(_workOrderCode, deviceCode); + lanJu_In.GetInOutRecordInfo(); + } + + private async void btnComplete_Click(object sender, RoutedEventArgs e) + { + var selectedRow = (dgWorkOrderInfo.SelectedItem as DataRowView); //dgWorkOrderInfo.SelectedItem as FoamingMacModel; + if (selectedRow == null) + { + MessageBox.Show("请选择你要报工的工单!", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Warning); + return; + } + if (!selectedRow["status"].ToString().Equals("w2")) + { + MessageBox.Show("你选择的工单不能报工!", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Warning); + return; + } + string newReportCode = ""; + DataTable dtNewReportCode = formingMachineService.GetReportCode(); + if (dtNewReportCode == null || dtNewReportCode.Rows.Count == 0) + { + newReportCode = DateTime.Now.ToString("yyyyMMdd") + "001"; + } + else + { + if (string.IsNullOrEmpty(dtNewReportCode.Rows[0]["report_code"].ToString())) + { + newReportCode = DateTime.Now.ToString("yyyyMMdd") + "001"; + } + else + { + newReportCode = (Convert.ToInt32(dtNewReportCode.Rows[0]["report_code"].ToString()) + 1).ToString(); + } + } + ExecReportWorkWin execReport = new ExecReportWorkWin(selectedRow["workorder_code"].ToString(), selectedRow["quantity_split"].ToString()); + + if (execReport.ShowDialog() == true) + { + string workTime = execReport._workTime; + string costCenter = execReport._costCenter; + string userCount = execReport._useMan; + bool issucc = formingMachineService.ExecuteReportWork(selectedRow, newReportCode, workTime, userCount, costCenter, deviceCode); + if (issucc) + { + //调用报工接口 + string apiUrl = formingMachineService.InterfaceUrl("reportWork"); + ReportWork reportWork = new ReportWork(); + reportWork.factoryCode = Utils.GetAppSetting("SiteCode"); + reportWork.reportCode = newReportCode; + // 将要发送的数据序列化为JSON格式 + var jsonContent = JsonConvert.SerializeObject(reportWork); + LogHelper.instance.log.Info("开始报工>>" + jsonContent); + RestHelper restClient = new RestHelper(); + var response = await restClient.PostAsync(apiUrl, jsonContent); + + MesResult result = Utils.DeJson(response); + + if (result.code == 200) + { + GetWorkOrderInfo(); + } + else + { + CustomMessageBox.Show("调用报工接口失败!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning); + } + } + else + { + CustomMessageBox.Show("报工失败",CustomMessageBoxButton.OK,CustomMessageBoxIcon.Error); + } + } + + } + + private void btnCheckLog_Click(object sender, RoutedEventArgs e) + { + ViewLogWin viewLogWin = new ViewLogWin(); + viewLogWin.ShowDialog(); + } + + private void btnViewPlcvalue_Click(object sender, RoutedEventArgs e) + { + ViewPlcInfoWin viewPlcWin = new ViewPlcInfoWin(); + viewPlcWin.ShowDialog(); + } + + private void dgWorkOrderInfo_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + if (dgWorkOrderInfo.SelectedItems.Count == 0) + { + return; + } + var selectedRow = (dgWorkOrderInfo.SelectedItem as DataRowView); + _workOrderCode = selectedRow["workorder_code"].ToString(); + //InOut_Click(null,null); + //Complete_Click(null,null); + } + + private void HFPlcvalue_Click(object sender, RoutedEventArgs e) + { + HBLogWin HFPlcWin = new HBLogWin(); + HFPlcWin.ShowDialog(); + } + } + public class ReportWork + { + public string factoryCode { get; set; } + public string reportCode { get; set; } + } +} diff --git a/shangjian/XGLFinishPro/Views/LanJu_Operatorbak - 复制.xaml b/shangjian/XGLFinishPro/Views/LanJu_Operatorbak - 复制.xaml new file mode 100644 index 0000000..9327437 --- /dev/null +++ b/shangjian/XGLFinishPro/Views/LanJu_Operatorbak - 复制.xaml @@ -0,0 +1,436 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/shangjian/XGLFinishPro/Views/LanJu_Operatorbak - 复制.xaml.cs b/shangjian/XGLFinishPro/Views/LanJu_Operatorbak - 复制.xaml.cs new file mode 100644 index 0000000..5f9dd13 --- /dev/null +++ b/shangjian/XGLFinishPro/Views/LanJu_Operatorbak - 复制.xaml.cs @@ -0,0 +1,107 @@ +using COSMO.IM.LanJu.Index; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace XGL.Views + +{ + /// + /// LanJu_Operator.xaml 的交互逻辑 + /// + public partial class LanJu_Operatorbak : UserControl + { + public static LanJu_Operator lanJu_Operator; + Frame frame = new Frame() { Content = new Views.LanJu_InOut()}; + + public enum WindowID + { + frame + } + public LanJu_Operatorbak() + { + InitializeComponent(); + WindowChange(WindowID.frame); + + } + + public void WindowChange(WindowID windowID) + { + Window1.Content = frame; + } + + private void InOut_Click(object sender, RoutedEventArgs e) + { + LanJu_InOut lanJu_InOut = new LanJu_InOut(); + Window1.Content = new Frame + { + Content = lanJu_InOut + }; + } + + private void Complete_Click(object sender, RoutedEventArgs e) + { + LanJu_Complete lanJu_Complete = new LanJu_Complete(); + Window1.Content = new Frame + { + Content = lanJu_Complete + }; + } + + private void DeviceItems_Click(object sender, RoutedEventArgs e) + { + LanJu_DeviceItems lanJu_DeviceItems = new LanJu_DeviceItems(); + Window1.Content = new Frame + { + Content = lanJu_DeviceItems + }; + } + + private void Paused_Click(object sender, RoutedEventArgs e) + { + LanJu_Paused lanJu_Paused = new LanJu_Paused(); + Window1.Content= new Frame + { + Content = lanJu_Paused + }; + } + + /// + /// 上部按钮 + /// + /// + /// + private void Flow_Click(object sender, RoutedEventArgs e) + { + LanJu_Flow lanJu_Flow = new LanJu_Flow(); + LanJu_Flow.jump = 1; + Window2.Content = new Frame + { + Content= lanJu_Flow + }; + } + + private void Material_Click(object sender, RoutedEventArgs e) + { + LanJu_Material lanJu_Material = new LanJu_Material(); + Window2.Content = new Frame + { + Content = lanJu_Material + }; + } + + + } +} diff --git a/shangjian/XGLFinishPro/Views/LanJu_Paused.xaml b/shangjian/XGLFinishPro/Views/LanJu_Paused.xaml new file mode 100644 index 0000000..a40b712 --- /dev/null +++ b/shangjian/XGLFinishPro/Views/LanJu_Paused.xaml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/shangjian/XGLFinishPro/Views/LanJu_Paused.xaml.cs b/shangjian/XGLFinishPro/Views/LanJu_Paused.xaml.cs new file mode 100644 index 0000000..22fee4b --- /dev/null +++ b/shangjian/XGLFinishPro/Views/LanJu_Paused.xaml.cs @@ -0,0 +1,58 @@ +using CommonFunc; +using CommonFunc.Tools; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using XGL.Dats.DBServiceFinishProd; + +namespace XGLFinishPro.Views +{ + /// + /// LanJu_Paused.xaml 的交互逻辑 + /// + public partial class LanJu_Paused : UserControl + { + FinishProdDBService userDbWareHouse = new FinishProdDBService(); + public LanJu_Paused() + { + InitializeComponent(); + } + + private void UserControl_Loaded(object sender, RoutedEventArgs e) + { + GetInfo(); + } + + private void GetInfo() + { + try + { + DataTable dt = userDbWareHouse.GetOperationRecord(Utils.GetAppSetting("DeviceCode")); + if (dt == null) return; + + this.dgUserInfo.ItemsSource = dt.DefaultView; + } + catch (Exception ex) + { + LogHelper.instance.log.Error("获取完成记录信息时发生异常:" + ex.Message); + } + } + + private void datagrid1_LoadingRow(object sender, DataGridRowEventArgs e) + { + e.Row.Header = (e.Row.GetIndex() + 1).ToString(); + } + } +} diff --git a/shangjian/XGLFinishPro/Views/LanJu_Prepare.xaml b/shangjian/XGLFinishPro/Views/LanJu_Prepare.xaml new file mode 100644 index 0000000..c8c6265 --- /dev/null +++ b/shangjian/XGLFinishPro/Views/LanJu_Prepare.xaml @@ -0,0 +1,448 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/shangjian/XGLFinishPro/Views/LanJu_User.xaml.cs b/shangjian/XGLFinishPro/Views/LanJu_User.xaml.cs new file mode 100644 index 0000000..cc63165 --- /dev/null +++ b/shangjian/XGLFinishPro/Views/LanJu_User.xaml.cs @@ -0,0 +1,144 @@ +using CommonFunc; +using CommonFunc.Tools; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using XGL.Dats.DBServiceFinishProd; + +namespace XGLFinishPro.Views +{ + /// + /// LanJu_User.xaml 的交互逻辑 + /// + public partial class LanJu_User : UserControl + { + FinishProdDBService finishProdDBService = new FinishProdDBService(); + string deviceCode = Utils.GetAppSetting("DeviceCode"); + public static LanJu_User lanJu_User; + Frame frame = new Frame() { Content = new Views.LanJu_NowUser() }; + public enum WindowID + { + frame + } + public LanJu_User() + { + InitializeComponent(); + lanJu_User = this; + WindowChange(WindowID.frame); + } + + public void WindowChange(WindowID windowID) + { + Window3.Content = frame; + } + + private void Now_Click(object sender, RoutedEventArgs e) + { + LanJu_NowUser lanJu_NowUser = new LanJu_NowUser(); + Window3.Content = new Frame() + { + Content = lanJu_NowUser + }; + } + + private void Record_Click(object sender, RoutedEventArgs e) + { + LanJu_UserRecord lanJu_UserRecord = new LanJu_UserRecord(); + Window3.Content = new Frame() + { + Content = lanJu_UserRecord + }; + } + private void txtOnWorkUserID_KeyDown(object sender, KeyEventArgs e) + { + if (e.Key == Key.Enter) + { + try + { + string userID = txtOnWorkUserID.Text; + DataTable dt = finishProdDBService.GetExistAttendanceRecord(deviceCode); + + if (dt != null && dt.Select("user_id = '" + userID + "'").Length > 0) + { + CustomMessageBox.Show("您已经上班打卡成功,请勿再次打卡!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning); + return; + } + DataTable dtUserInfo = finishProdDBService.GetUserInfoFromCloudServer(userID); + if (dtUserInfo == null || dtUserInfo.Rows.Count <= 0) + { + CustomMessageBox.Show("找不到该账户,请重试!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning); + return; + } + string userName = dtUserInfo.Rows[0]["nick_name"].ToString(); + string sex = dtUserInfo.Rows[0]["sex"].ToString(); + bool isSucc = finishProdDBService.InsertAttendanceRecord(userID, userName, sex,deviceCode); + if (isSucc) + { + CustomMessageBox.Show("打卡成功,祝您工作愉快!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning); + + Now_Click(null, null); + } + else { + CustomMessageBox.Show("打卡失败,请重试!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning); + + } + } + catch (Exception ex) + { + LogHelper.instance.log.Error("上班打卡发生异常>>" + ex.Message); + CustomMessageBox.Show("上班打卡发生异常!" + ex.Message, CustomMessageBoxButton.OK, CustomMessageBoxIcon.Error); + } + + } + } + + private void txtOffWorkUserID_KeyDown(object sender, KeyEventArgs e) + { + if (e.Key == Key.Enter) + { + try + { + string userID = txtOffWorkUserID.Text; + DataTable dt = finishProdDBService.GetExistAttendanceRecord(deviceCode); + if (dt!=null && dt.Select("user_id = '" + userID + "'").Length > 0) + { + if (dt.Select("user_id = '" + userID + "' and start_addr = '" + deviceCode + "'").Length > 0) + { + bool isSucc = finishProdDBService.UpdateAttendanceRecord(userID, deviceCode); + if (isSucc) + { + CustomMessageBox.Show("打卡成功,再见!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning); + Now_Click(null, null); + } + } + else + { + string start_addr = dt.Select("user_id = '" + userID + "'")[0]["start_addr"].ToString(); + CustomMessageBox.Show("打卡失败,您的打卡地址在" + start_addr + "!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning); + return; + } + } + } + catch (Exception ex) + { + LogHelper.instance.log.Error("下班打卡发生异常>>" + ex.Message); + CustomMessageBox.Show("下班打卡发生异常!" + ex.Message, CustomMessageBoxButton.OK, CustomMessageBoxIcon.Error); + } + + } + } + } +} diff --git a/shangjian/XGLFinishPro/Views/LanJu_UserRecord.xaml b/shangjian/XGLFinishPro/Views/LanJu_UserRecord.xaml new file mode 100644 index 0000000..393aa62 --- /dev/null +++ b/shangjian/XGLFinishPro/Views/LanJu_UserRecord.xaml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/shangjian/XGLFinishPro/Views/LanJu_UserRecord.xaml.cs b/shangjian/XGLFinishPro/Views/LanJu_UserRecord.xaml.cs new file mode 100644 index 0000000..2ea0850 --- /dev/null +++ b/shangjian/XGLFinishPro/Views/LanJu_UserRecord.xaml.cs @@ -0,0 +1,59 @@ +using CommonFunc.Tools; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using XGL.Dats.DBServiceFinishProd; + +namespace XGLFinishPro.Views +{ + /// + /// LanJu_UserRecord.xaml 的交互逻辑 + /// + public partial class LanJu_UserRecord : UserControl + { + FinishProdDBService userDbWareHouse = new FinishProdDBService(); + string deviceCode = Utils.GetAppSetting("DeviceCode"); + + public LanJu_UserRecord() + { + InitializeComponent(); + } + + + + private void DataGrid_LoadingRow(object sender, DataGridRowEventArgs e) + { + e.Row.Header = (e.Row.GetIndex() + 1).ToString(); + } + + private void UserControl_Loaded(object sender, RoutedEventArgs e) + { + GetRecordInfo(); + } + + private void GetRecordInfo() + { + DataTable dt = userDbWareHouse.GetAttendanceRecord(deviceCode); + if (dt == null) + { + dgUserInfo.ItemsSource = null; + } + else + { + dgUserInfo.ItemsSource = dt.DefaultView; + } + } + } +} diff --git a/shangjian/XGLFinishPro/Views/ShouPeiWin.xaml b/shangjian/XGLFinishPro/Views/ShouPeiWin.xaml new file mode 100644 index 0000000..1943ded --- /dev/null +++ b/shangjian/XGLFinishPro/Views/ShouPeiWin.xaml @@ -0,0 +1,41 @@ + + + + + + + + + + diff --git a/shangjian/XGLFinishPro/Views/SopInfoWin.xaml.cs b/shangjian/XGLFinishPro/Views/SopInfoWin.xaml.cs new file mode 100644 index 0000000..83f636c --- /dev/null +++ b/shangjian/XGLFinishPro/Views/SopInfoWin.xaml.cs @@ -0,0 +1,129 @@ +using PdfSharpCore.Drawing; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Forms; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; +using PdfiumViewer; + +namespace XGLFinishPro.Views +{ + /// + /// FlowInfoWin.xaml 的交互逻辑 + /// + public partial class SopInfoWin : Window + { + DataTable _dt; + Image imgSop = new Image(); + private System.Windows.Forms.WebBrowser webBrowser; + + public SopInfoWin() + { + InitializeComponent(); + } + + public SopInfoWin(DataTable dt) + { + InitializeComponent(); + _dt = dt; + } + private void Back_Click(object sender, RoutedEventArgs e) + { + this.Close(); + } + + + + private void Window_Loaded(object sender, RoutedEventArgs e) + { + this.WindowState = WindowState.Maximized; + if (_dt == null || _dt.Rows.Count == 0) return; + + string address = _dt.Rows[0][0].ToString(); + if (address.ToLower().Contains(".png") || address.ToLower().Contains(".jpg")) + { + windowsFormsHost.Visibility = Visibility.Collapsed; + pdfViewer.Visible = false; + System.Windows.Media.Imaging.BitmapImage src = new System.Windows.Media.Imaging.BitmapImage(); + src.BeginInit(); + src.UriSource = new Uri(address, UriKind.Relative); + src.CacheOption = System.Windows.Media.Imaging.BitmapCacheOption.OnLoad; + src.EndInit(); + imgSop.Stretch = System.Windows.Media.Stretch.Fill; + imgSop.Source = src; + + Window2.Content = new Frame + { + Content = imgSop + }; + + } + if (address.ToLower().Contains(".doc") || address.ToLower().Contains(".docx") || address.ToLower().Contains(".xls") || address.ToLower().Contains(".xlxs")) + { + imgSop.Visibility = Visibility.Collapsed; + pdfViewer.Visible = false; + windowsFormsHost.Visibility = Visibility.Visible; + InitializeOfficeViewer(address); + } + if (address.ToLower().Contains(".pdf")) + { + windowsFormsHost.Visibility = Visibility.Collapsed; + imgSop.Visibility = Visibility.Collapsed; + pdfViewer.Visible = true; + LoadPdfFile(address); + } + } + private void LoadPdfFile(string filePath) + { + try + { + PdfDocument pdfDocument = PdfDocument.Load(filePath); + + pdfViewer.Document = pdfDocument; + } + catch (Exception ex) + { + // 处理加载 PDF 文件的异常 + System.Windows.MessageBox.Show("无法加载 PDF 文件:" + ex.Message); + } + } + + private void InitializeOfficeViewer(string filePath) + { + webBrowser = new System.Windows.Forms.WebBrowser(); + + // Add WebBrowser control to WindowsFormsHost + windowsFormsHost.Child = webBrowser; + + // Load and display the Office document + LoadOfficeDocument("path_to_your_office_document.docx"); + } + + private void LoadOfficeDocument(string filePath) + { + try + { + webBrowser.Navigate(filePath); + } + catch (Exception ex) + { + System.Windows.MessageBox.Show($"Error loading Office document: {ex.Message}", "Error", MessageBoxButton.OK, MessageBoxImage.Error); + } + } + + private void dgFlow_LoadingRow(object sender, DataGridRowEventArgs e) + { + e.Row.Header = (e.Row.GetIndex() + 1).ToString(); + } + } +} diff --git a/shangjian/XGLFinishPro/Views/ViewLogWin.xaml b/shangjian/XGLFinishPro/Views/ViewLogWin.xaml new file mode 100644 index 0000000..f6a1bfa --- /dev/null +++ b/shangjian/XGLFinishPro/Views/ViewLogWin.xaml @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + +