From 25199b542135ba4076397df90c9cf08428d32ec0 Mon Sep 17 00:00:00 2001 From: liuwf Date: Mon, 5 Aug 2024 19:16:27 +0800 Subject: [PATCH] =?UTF-8?q?change-=E4=BA=BA=E5=B7=A5=E5=8F=AB=E6=96=99?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E8=BF=98=E5=8E=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Khd.Core.Wpf/Form/FormBoardT.xaml.cs | 38 ++++++++++++++++++++++-- src/Khd.Core.Wpf/appsettings.json | 4 +-- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/src/Khd.Core.Wpf/Form/FormBoardT.xaml.cs b/src/Khd.Core.Wpf/Form/FormBoardT.xaml.cs index f084ed9..50d60ab 100644 --- a/src/Khd.Core.Wpf/Form/FormBoardT.xaml.cs +++ b/src/Khd.Core.Wpf/Form/FormBoardT.xaml.cs @@ -118,6 +118,9 @@ namespace Khd.Core.Wpf.Form { try { + itemsControlItems = new ObservableCollection(); + itemsControl.ItemsSource = itemsControlItems; + Task.Run(() => { foreach (var plcConfig in SystemData.PlcConfigs) @@ -1427,12 +1430,33 @@ namespace Khd.Core.Wpf.Form /// private void CheckPersonBox_Click(object sender, RoutedEventArgs e) { + if (sender is CheckBox checkbox) { dynamic Currentselected = PersonCallMaterial.SelectedItem; if (checkbox.IsChecked != null && checkbox.IsChecked.Value) { + if (itemsControlItems != null && itemsControlItems.Count >= 6) + { + MessageBox.Show("最多只能选择6个"); + checkbox.IsChecked = false; + return; + } CallSelectedItem.Add(Currentselected.baseLocationId); + + // 添加选中项 + string selectedItem = Currentselected.palletInfoCode; + + bool isIn = itemsControlItems.Any(t => t.baseLocationId == Currentselected.baseLocationId); + if (!isIn) + { + itemsControlItems.Add(new SelectItemModel + { + baseLocationId = Currentselected.baseLocationId, + palletInfoCode = Currentselected.palletInfoCode + }); + + } } else { @@ -1448,8 +1472,11 @@ namespace Khd.Core.Wpf.Form } + + } } + /// /// 删除选中的值 /// @@ -2612,9 +2639,9 @@ namespace Khd.Core.Wpf.Form { BaseEquip ctuEquip = SystemData.BaseEquip.First(t => t.objid == 11); BaseEquip endEquip = SystemData.BaseEquip.First(t => t.objid == 20); - if (CallSelectedItem.Count == 0) + if (itemsControlItems.Count == 0) { - HandyControl.Controls.MessageBox.Show("请选择料箱!"); + MessageBox.Show("请选择料箱!"); return; } @@ -2626,7 +2653,12 @@ namespace Khd.Core.Wpf.Form // HandyControl.Controls.MessageBox.Show($"当前CTU只能有6个任务,当前任务数{taskCount}"); // return; //} - var wmsBaseLocation = dbContext.WmsBaseLocation.Where(t => t.warehouseId == 512 && t.ContainerStatus == "1").Where(t => CallSelectedItem.Contains(t.locationId)).ToList(); + //替换 var wmsBaseLocation = dbContext.WmsBaseLocation.Where(t => t.warehouseId == 512 && t.ContainerStatus == "1").Where(t => CallSelectedItem.Contains(t.locationId)).ToList(); + List idList = itemsControlItems.Select(x => x.baseLocationId).ToList(); + + var wmsBaseLocation = dbContext.WmsBaseLocation.Where(t => t.warehouseId == 512 && t.ContainerStatus == "1").Where(t => idList.Contains(t.locationId)).ToList(); + + StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("确认出库:"); foreach (var item in wmsBaseLocation) diff --git a/src/Khd.Core.Wpf/appsettings.json b/src/Khd.Core.Wpf/appsettings.json index b18e921..14994a2 100644 --- a/src/Khd.Core.Wpf/appsettings.json +++ b/src/Khd.Core.Wpf/appsettings.json @@ -3,9 +3,9 @@ //mysql 本地 //"DefaultConnection": "server=106.12.13.113;port=3306;database=khd_jyhb;uid=root;pwd=root;charset='utf8';persistsecurityinfo=True;SslMode=none;Allow User Variables=True" //khd服务器 - //"DefaultConnection": "server=172.16.12.100;port=3306;database=hwjy-cloud;uid=kehaida;pwd=khdrkjy2024...;charset='utf8';persistsecurityinfo=True;SslMode=None;Allow User Variables=True" + "DefaultConnection": "server=172.16.12.100;port=3306;database=hwjy-cloud;uid=kehaida;pwd=khdrkjy2024...;charset='utf8';persistsecurityinfo=True;SslMode=None;Allow User Variables=True" //"DefaultConnection": "server=175.27.215.92;port=3306;database=hwjy-cloud;uid=kehaida;pwd=khd2024;charset='utf8';persistsecurityinfo=True;SslMode=none;Allow User Variables=True" - "DefaultConnection": "server=localhost;port=3306;database=jyhb;uid=root;pwd=root;charset='utf8';persistsecurityinfo=True;SslMode=None;Allow User Variables=True" + // "DefaultConnection": "server=localhost;port=3306;database=jyhb;uid=root;pwd=root;charset='utf8';persistsecurityinfo=True;SslMode=None;Allow User Variables=True" }, "PlcConfigs": [ {