diff --git a/src/Khd.Core.Wpf/Form/FormBoardT.xaml b/src/Khd.Core.Wpf/Form/FormBoardT.xaml
index b284197..94f7010 100644
--- a/src/Khd.Core.Wpf/Form/FormBoardT.xaml
+++ b/src/Khd.Core.Wpf/Form/FormBoardT.xaml
@@ -1576,6 +1576,7 @@
+
@@ -1586,8 +1587,25 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -1903,7 +1921,7 @@
-
+
diff --git a/src/Khd.Core.Wpf/Form/FormBoardT.xaml.cs b/src/Khd.Core.Wpf/Form/FormBoardT.xaml.cs
index f3f35bf..1e2d31d 100644
--- a/src/Khd.Core.Wpf/Form/FormBoardT.xaml.cs
+++ b/src/Khd.Core.Wpf/Form/FormBoardT.xaml.cs
@@ -18,6 +18,7 @@ using Microsoft.Extensions.Hosting;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
+using System.Collections.ObjectModel;
using System.Data;
using System.Diagnostics;
using System.IO.Ports;
@@ -60,6 +61,20 @@ namespace Khd.Core.Wpf.Form
private int pageCount = 15;
private object updateLock = new object();
+
+ private ObservableCollection itemsControlItems;
+
+ //人工叫料选中类
+ public class SelectItemModel
+ {
+ //料箱位置id
+ public long baseLocationId { get; set; }
+ //托盘号
+ public string palletInfoCode { get; set; }
+ }
+
+
+
private void ScanMessage()
{
while (true)
@@ -107,6 +122,10 @@ namespace Khd.Core.Wpf.Form
{
try
{
+
+ itemsControlItems = new ObservableCollection();
+ itemsControl.ItemsSource = itemsControlItems;
+
//连接PLC
Task.Run(() =>
{
@@ -1312,17 +1331,69 @@ 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
{
CallSelectedItem.Remove(Currentselected.baseLocationId);
+
+
+ // 删除选中项
+ SelectItemModel model = itemsControlItems.FirstOrDefault(x => x.baseLocationId == Currentselected.baseLocationId);
+ if (model != null)
+ {
+ itemsControlItems.Remove(model);
+ }
}
+
+
+
+
+ }
+ }
+
+ ///
+ /// 删除选中的值
+ ///
+ ///
+ ///
+ private void DeleteButton_Click(object sender, RoutedEventArgs e)
+ {
+ // 获取点击按钮的实例
+ Button button = sender as Button;
+
+ // 从按钮的 Tag 属性中获取当前数据项
+ SelectItemModel itemToRemove = button.Tag as SelectItemModel;
+
+ if (itemToRemove != null)
+ {
+ // 从集合中移除数据项
+ itemsControlItems.Remove(itemToRemove);
}
}
///
@@ -2018,6 +2089,8 @@ namespace Khd.Core.Wpf.Form
///
private void SelectButton_Click(object sender, RoutedEventArgs e)
{
+
+
CallSelectedItem.Clear();
GetPersonCallMaterialData();
}
@@ -2026,6 +2099,8 @@ namespace Khd.Core.Wpf.Form
///
private void GetPersonCallMaterialData()
{
+
+
try
{
using var scope = _host.Services.CreateScope();
@@ -2078,6 +2153,7 @@ namespace Khd.Core.Wpf.Form
if (string.IsNullOrEmpty(MaterialName.Text))
{
materialInfos = dbContext.MesBaseMaterialInfo.ToList();
+
}
var bill = from a in wmsBaseLocations
from b in groupWmsRawStock
@@ -2114,6 +2190,10 @@ namespace Khd.Core.Wpf.Form
materialSpec = string.Join("\n", t.Select(x => x.materialSpec[..(x.materialSpec.Length > 20 ? 20 : x.materialSpec.Length)])),
materialSpecSrc = string.Join("\n", t.Select(x => x.materialSpec))
}).ToList();
+
+
+
+
bills = bills.OrderBy(t => t.palletInfoCode).ThenBy(t => t.materialId).ToList();
PersonCallMaterial.ItemsSource = bills.Skip((this.Pagination2.PageIndex - 1) * this.pageCount).Take(this.pageCount);
int sum = bills.Count();
@@ -2390,7 +2470,12 @@ 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 (CallSelectedItem.Count == 0)
+ //{ 替换
+ // MessageBox.Show("请选择料箱!");
+ // return;
+ //}
+ if (itemsControlItems.Count == 0)
{
MessageBox.Show("请选择料箱!");
return;
@@ -2404,7 +2489,12 @@ namespace Khd.Core.Wpf.Form
// 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 b545c56..e8a62b5 100644
--- a/src/Khd.Core.Wpf/appsettings.json
+++ b/src/Khd.Core.Wpf/appsettings.json
@@ -5,8 +5,10 @@
//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=106.12.13.113;port=3336;database=khd_jyhb;uid=khd;pwd=khd@123;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='utf8mb4';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": [
{
"IP": "192.168.2.30",