From 4cca6af72fa2288f433a7c4d604f9639d3fbfc63 Mon Sep 17 00:00:00 2001 From: czw <selecti@yeah.net> Date: 星期三, 02 七月 2025 18:47:44 +0800 Subject: [PATCH] 1 --- 2025年6月12日/AuxAllWCS/Build/Project/AuxAllWCS.csproj | 45 +++++++++++++++ 2025年6月12日/AuxAllWCS/Build/Project/界面/View1.xaml.cs | 1 2025年6月12日/AuxAllWCS/Build/Project/界面/View1.xaml | 75 ++++++++++++++++++++++++ 2025年6月12日/AuxAllWCS/Build/Project/代码/VS自定义类/AutoThread.cs | 31 +++++++--- 2025年6月12日/AuxAllWCS/Build/Project/代码/VS自定义类/TcpServer.cs | 18 +++-- 5 files changed, 152 insertions(+), 18 deletions(-) diff --git "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/AuxAllWCS.csproj" "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/AuxAllWCS.csproj" index 03e827b..3f00080 100644 --- "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/AuxAllWCS.csproj" +++ "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/AuxAllWCS.csproj" @@ -7,6 +7,8 @@ <AssemblyName>AuxAllWCS</AssemblyName> <TargetFrameworkVersion>4.6.1</TargetFrameworkVersion> <ProjectGuid>{D55A8F58-C2AA-442E-93D3-7537992A4993}</ProjectGuid> + <NuGetPackageImportStamp> + </NuGetPackageImportStamp> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'"> <PlatformTarget>AnyCPU</PlatformTarget> @@ -230,6 +232,49 @@ </ItemGroup> <ItemGroup> <None Include="App.config" /> + <None Include="packages.config" /> + <None Include="Static\config.json"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </None> + <None Include="Static\js\app.829e775c.js.map"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </None> + <None Include="Static\js\chunk-vendors.3e768dfe.js.map"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </None> + </ItemGroup> + <ItemGroup> + <Content Include="Static\css\a.css"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Content> + <Content Include="Static\css\app.d545ec97.css"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Content> + <Content Include="Static\favicon.ico"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Content> + <Content Include="Static\index.html"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Content> + <Content Include="Static\js\a.js"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Content> + <Content Include="Static\js\app.829e775c.js"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Content> + <Content Include="Static\js\chunk-vendors.3e768dfe.js"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Content> + <Content Include="Static\W.html"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Content> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <Import Project="packages\Microsoft.Web.WebView2.1.0.3351.48\build\Microsoft.Web.WebView2.targets" Condition="Exists('packages\Microsoft.Web.WebView2.1.0.3351.48\build\Microsoft.Web.WebView2.targets')" /> + <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> + <PropertyGroup> + <ErrorText>杩欏彴璁$畻鏈轰笂缂哄皯姝ら」鐩紩鐢ㄧ殑 NuGet 绋嬪簭鍖呫�浣跨敤鈥淣uGet 绋嬪簭鍖呰繕鍘熲�鍙笅杞借繖浜涚▼搴忓寘銆傛湁鍏虫洿澶氫俊鎭紝璇峰弬瑙�http://go.microsoft.com/fwlink/?LinkID=322105銆傜己灏戠殑鏂囦欢鏄�{0}銆�/ErrorText> + </PropertyGroup> + <Error Condition="!Exists('packages\Microsoft.Web.WebView2.1.0.3351.48\build\Microsoft.Web.WebView2.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Web.WebView2.1.0.3351.48\build\Microsoft.Web.WebView2.targets'))" /> + </Target> </Project> \ No newline at end of file diff --git "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/AutoThread.cs" "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/AutoThread.cs" index 9708c0d..b2e5286 100644 --- "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/AutoThread.cs" +++ "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/AutoThread.cs" @@ -122,7 +122,7 @@ public string WriteLine(string value = "") { - + // 鍦ㄨ繖閲屾嫤鎴鐞嗚緭鍑�@@ -251,7 +251,7 @@ { if (tag.wxr1.R44 && !tag.wxr1.R44_LAST && tag.wxr1.R10) { - if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[0], out string traycode)) + if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[0], out string traycode) && !string.IsNullOrEmpty(traycode.Trim())) { var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/200", JsonConvert.SerializeObject(new { @@ -284,7 +284,7 @@ RedisHelper.Add($"缁村笇灏旀姄鑷�.R10_LAST", "false", out string msg); } else - if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[0], out string traycode)) + if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[0], out string traycode) && !string.IsNullOrEmpty(traycode.Trim())) { //涓婃姤鏍¢獙銆� ///var str = Settings.apiHelper.Post(Settings.MESbaseUrl + "mom-basic/dataTransmission/json/service/202", requestJson); @@ -324,7 +324,7 @@ { if (tag.wxr1.R46 && !tag.wxr1.R46_LAST && tag.wxr1.R11) { - if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[1], out string traycode)) + if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[1], out string traycode) && !string.IsNullOrEmpty(traycode.Trim())) { var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/200", JsonConvert.SerializeObject(new { @@ -356,7 +356,7 @@ RedisHelper.Add($"缁村笇灏旀姄鑷�.R11_LAST", "false", out string msg); } else - if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[1], out string traycode)) + if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[1], out string traycode) && !string.IsNullOrEmpty(traycode.Trim())) { //涓婃姤鏍¢獙銆� ///var str = Settings.apiHelper.Post(Settings.MESbaseUrl + "mom-basic/dataTransmission/json/service/202", requestJson); @@ -396,7 +396,7 @@ { if (tag.wxr2.R44 && !tag.wxr2.R44_LAST && tag.wxr2.R10) { - if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[0], out string traycode)) + if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[0], out string traycode) && !string.IsNullOrEmpty(traycode.Trim())) { var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/200", JsonConvert.SerializeObject(new { @@ -428,7 +428,7 @@ RedisHelper.Add($"缁村笇灏旀姄鑷�.R10_LAST", "false", out string msg); } else - if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[0], out string traycode)) + if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[0], out string traycode) && !string.IsNullOrEmpty(traycode.Trim())) { //涓婃姤鏍¢獙銆� ///var str = Settings.apiHelper.Post(Settings.MESbaseUrl + "mom-basic/dataTransmission/json/service/202", requestJson); @@ -469,7 +469,7 @@ { if (tag.wxr2.R46 && !tag.wxr2.R46_LAST && tag.wxr2.R11) { - if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[1], out string traycode)) + if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[1], out string traycode) && !string.IsNullOrEmpty(traycode.Trim())) { var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/200", JsonConvert.SerializeObject(new { @@ -493,16 +493,19 @@ } else { + //LogHelper.Info($"Threadwxr2R 鎵樼洏鏀剧疆淇″彿1銆傘� -{tag.wxr2.R11_LAST}"); if (tag.wxr2.R11_LAST) //鎵樼洏鏀剧疆淇″彿銆傘� { + //LogHelper.Info($"Threadwxr2R 鎵樼洏鏀剧疆淇″彿1銆傘� -{tag.wxr2.R11}"); if (tag.wxr2.R11) { //tag.wxr2.R11_LAST = false; RedisHelper.Add($"缁村笇灏旀姄鑷�.R11_LAST", "false", out string msg); } else - if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[1], out string traycode)) + if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[1], out string traycode) && !string.IsNullOrEmpty(traycode.Trim())) { + LogHelper.Info($"Threadwxr2R 涓婃姤鏍¢獙>{traycode}"); //涓婃姤鏍¢獙銆� ///var str = Settings.apiHelper.Post(Settings.MESbaseUrl + "mom-basic/dataTransmission/json/service/202", requestJson); var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/202", JsonConvert.SerializeObject(new @@ -522,10 +525,18 @@ //鎶ヨ銆� } } - else { TcpServer.TcpServerSend(VERX.deviceNo[1], GZ.Device.PLC.PlcHelper.Hex2Bin("544F4E")); } + else + { + LogHelper.Info($"Threadwxr2R銆傘� -鍙戦�鎵爜"); + TcpServer.TcpServerSend(VERX.deviceNo[1], GZ.Device.PLC.PlcHelper.Hex2Bin("544F4E")); + } } } } + else + { + Console.WriteLine($"Threadwxr2R 缁村笇灏� 鍙� 璁惧鏈壘鍒般� =================> "); + } } public void ThreadTaskRun(Tag tag, Func<TaskEntity, bool> action) diff --git "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/TcpServer.cs" "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/TcpServer.cs" index 4ebf30c..c20febb 100644 --- "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/TcpServer.cs" +++ "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/TcpServer.cs" @@ -117,19 +117,23 @@ //{ Console.WriteLine($"銆怲CP淇℃伅鍗忚 {DateTime.Now.Millisecond}銆戯細IP锛歿remote_ip},MSG锛歿message}"); var mg = Encoding.ASCII.GetString(PlcHelper.Hex2Bin(message)); + if (mg.Length > 10) + { + mg = mg.Substring(0, 10); + } Console.WriteLine(mg); - if (mg.StartsWith("DK") && mg.Trim().Length == "DK01000024".Length) + if (mg.StartsWith("DK"))//&& mg.Trim().Length == "DK01000024".Length { LogHelper.Info($"鎵爜鍣�>{remote_ip} -{mg}"); if (TrayIps.TryGetValue(remote_ip, out string traycode)) { - TrayIps[remote_ip] = traycode; + TrayIps[remote_ip] = mg; } - else TrayIps.Add(remote_ip, traycode); + else TrayIps.Add(remote_ip, mg); - Console.WriteLine("TOFF"); - var mst = PlcHelper.Hex2Bin("544F4646"); - TcpServer.TcpServerSend(remote_ip, mst); + //Console.WriteLine("TOFF"); + //var mst = PlcHelper.Hex2Bin("544F4646"); + //TcpServer.TcpServerSend(remote_ip, mst); } //} } @@ -170,7 +174,7 @@ { try { - client.Send(msg); + client.Send(msg); LogHelper.Info($"TcpServerSend > 鍙戦�鎴愬姛銆�); return true; } diff --git "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\347\225\214\351\235\242/View1.xaml" "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\347\225\214\351\235\242/View1.xaml" index ddd97e4..f10b380 100644 --- "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\347\225\214\351\235\242/View1.xaml" +++ "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\347\225\214\351\235\242/View1.xaml" @@ -3,7 +3,40 @@ Title="鍝堝搱wcs" > <Grid> - <TextBlock HorizontalAlignment="Center" FontFamily="Courier New" Text="
 + <Grid> + <TabControl> + <TabControl.Resources> + <Style TargetType="TabItem"> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="TabItem"> + <Border Name="Border" BorderThickness="1,1,1,0" BorderBrush="Gainsboro" CornerRadius="4,4,0,0" Margin="2,0"> + <ContentPresenter x:Name="ContentSite" + VerticalAlignment="Center" + HorizontalAlignment="Center" + ContentSource="Header" + Margin="10,2"/> + </Border> + <ControlTemplate.Triggers> + <Trigger Property="IsSelected" Value="True"> + <Setter TargetName="Border" Property="Background" Value="LightSkyBlue" /> + </Trigger> + <Trigger Property="IsSelected" Value="False"> + <Setter TargetName="Border" Property="Background" Value="GhostWhite" /> + </Trigger> + </ControlTemplate.Triggers> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + </TabControl.Resources> + <TabItem> + <TabItem.Header> + <StackPanel Orientation="Horizontal"> + <TextBlock Text="emmm" Foreground="Orange" /> + </StackPanel> + </TabItem.Header> + <TextBlock HorizontalAlignment="Center" FontFamily="Courier New" Text="
 ////////////////////////////////////////////////////////////////////
 // _ooOoo_ //
 // o8888888o //
 @@ -27,5 +60,45 @@ // 浣涚淇濅綉 姘告棤BUG 姘镐笉淇敼 //
 ////////////////////////////////////////////////////////////////////" TextWrapping="Wrap" /> + </TabItem> + <TabItem> + <TabItem.Header> + <StackPanel Orientation="Horizontal"> + <TextBlock Text="WebView" Foreground="Purple" /> + </StackPanel> + </TabItem.Header> + </TabItem> + <!--<TabItem> + <TabItem.Header> + <StackPanel Orientation="Horizontal"> + <TextBlock Text="AGV浠诲姟" Foreground="Black" /> + </StackPanel> + </TabItem.Header> + <Label Content="Content goes here..." /> + </TabItem> + <TabItem> + <TabItem.Header> + <StackPanel Orientation="Horizontal"> + <TextBlock Text="澹充綋涓嬫枡" Foreground="Blue" /> + </StackPanel> + </TabItem.Header> + <Label Content="Content goes here..." /> + </TabItem> + <TabItem> + <TabItem.Header> + <StackPanel Orientation="Horizontal"> + <TextBlock Text="鎬昏涓婃枡" Foreground="Red" /> + </StackPanel> + </TabItem.Header> + </TabItem> + <TabItem> + <TabItem.Header> + <StackPanel Orientation="Horizontal"> + <TextBlock Text="鎵爜澶� Foreground="Green" /> + </StackPanel> + </TabItem.Header> + </TabItem>--> + </TabControl> + </Grid> </Grid> </Window> \ No newline at end of file diff --git "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\347\225\214\351\235\242/View1.xaml.cs" "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\347\225\214\351\235\242/View1.xaml.cs" index d874b53..0b220b8 100644 --- "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\347\225\214\351\235\242/View1.xaml.cs" +++ "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\347\225\214\351\235\242/View1.xaml.cs" @@ -28,6 +28,7 @@ using GZ.DB.Repository.OIDATABASE; using GZ.DB.IRepository.OIDATABASE; using GZ.DB.Entity.OIDATABASE; + namespace GZ.Projects.AuxAllWCS { /// <summary> -- Gitblit v1.9.1