diff --git a/src/Khd.Core.Wcs/Wcs/FiveFloorCTU.cs b/src/Khd.Core.Wcs/Wcs/FiveFloorCTU.cs
index 9c06d7c..1a3634f 100644
--- a/src/Khd.Core.Wcs/Wcs/FiveFloorCTU.cs
+++ b/src/Khd.Core.Wcs/Wcs/FiveFloorCTU.cs
@@ -418,7 +418,7 @@ namespace Khd.Core.Wcs.Wcs
}
else if (item.taskType == StaticTaskType.FiveAccessoryIn)//入库任务
{
- bool haveOut = taskList.Where(t => t.taskType == StaticTaskType.FiveAccessoryOut).Where(t => t.taskStatus != 6).Any();
+ bool haveOut = taskList.Where(t => item.taskType == StaticTaskType.FiveAccessoryOut || item.taskType == StaticTaskType.FiveAccessoryStorage || item.taskType == StaticTaskType.FiveAccessoryRemove).Where(t => t.taskStatus != 6).Any();
if (!haveOut && CtuWaitLogic())
{
BaseEquip startEquip = StaticData.BaseEquip.First(t => t.objid == item.currPointId);
diff --git a/src/Khd.Core.Wpf/Form/FormBoardT.xaml b/src/Khd.Core.Wpf/Form/FormBoardT.xaml
index 4682346..0f51046 100644
--- a/src/Khd.Core.Wpf/Form/FormBoardT.xaml
+++ b/src/Khd.Core.Wpf/Form/FormBoardT.xaml
@@ -2044,8 +2044,8 @@
-
-
+
+
diff --git a/src/Khd.Core.Wpf/Form/FormBoardT.xaml.cs b/src/Khd.Core.Wpf/Form/FormBoardT.xaml.cs
index 4db13fe..063d5b2 100644
--- a/src/Khd.Core.Wpf/Form/FormBoardT.xaml.cs
+++ b/src/Khd.Core.Wpf/Form/FormBoardT.xaml.cs
@@ -2917,7 +2917,7 @@ namespace Khd.Core.Wpf.Form
}
//所有满足条件的需要盘库的库位
var wmsBaseLocations = dbContext.WmsBaseLocation
- .Where(t => t.ContainerStatus == "1")
+ .Where(t => t.ContainerStatus == "1" && t.warehouseId==512)
.Where(t => t.locationStatus == "1")
.OrderBy(t => t.locRow)
.ThenBy(t => t.locColumn)
@@ -3023,6 +3023,7 @@ namespace Khd.Core.Wpf.Form
RealAmount = rawItem.totalAmount,
InventoryCount = 0,
LocationCode = rawItem.locationCode,
+ MaterialBatch = rawItem.instockBatch,
StockId = 1,
StockType = "1",
MaterialId = rawItem.materialId,
@@ -3065,12 +3066,41 @@ namespace Khd.Core.Wpf.Form
GetInvertoryData();
}
+
///
- /// 查看盘点详情界面
+ /// 结束盘点
///
///
///
- private void OpenInventoryDetails(object sender, RoutedEventArgs e)
+ private void EndInventory(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ dynamic wmsInventoryCheck = this.InventoryMaterial.SelectedItem;
+ long inventoryCheckId = wmsInventoryCheck.InventoryCheckId;
+ using var scope = _host.Services.CreateScope();
+ using var dbContext = scope.ServiceProvider.GetRequiredService();
+ var InventoryCheck = dbContext.WmsInventoryCheck
+ .Where(t => t.InventoryCheckId == inventoryCheckId).FirstOrDefault();
+ if (InventoryCheck.CheckStatus != "2")
+ {
+ InventoryCheck.CheckStatus = "2";
+ InventoryCheck.EndTime = DateTime.Now;
+ }
+ dbContext.WmsInventoryCheck.Update(InventoryCheck);
+ dbContext.SaveChanges();
+ GetInvertoryData();
+ }catch(Exception ex)
+ {
+ Console.WriteLine(ex.Message);
+ }
+ }
+ ///
+ /// 查看盘点详情界面
+ ///
+ ///
+ ///
+ private void OpenInventoryDetails(object sender, RoutedEventArgs e)
{
dynamic wmsInventoryCheck = this.InventoryMaterial.SelectedItem;
long inventoryCheckId = wmsInventoryCheck.InventoryCheckId;
@@ -3598,6 +3628,7 @@ namespace Khd.Core.Wpf.Form
BasePlcpoint basePlcpoint = SystemData.BasePlcpoints.First(t => t.plcpointNo == "canReceive");
SystemData.PlcDic[1].WriteToPoint(basePlcpoint.plcpointAddress, "1", basePlcpoint.plcpointLength.ToString());
MsgText.Text = "一键收料发送成功";
+ HandyControl.Controls.MessageBox.Show("一键收料发送成功!");
}
catch (Exception ex)
{
@@ -4328,6 +4359,10 @@ namespace Khd.Core.Wpf.Form
UpdateBy = t.UpdateBy,
UpdateTime = t.UpdateTime,
WarehouseId = t.WarehouseId,
+ StartContent = t.CheckStatus == "0" ? "开始盘点" : "继续盘点",
+ StartEnable = t.CheckStatus == "2" ? false : true,
+ EndEnable = t.CheckStatus == "2" ? false : true,
+
});
this.InventoryMaterial.Items.Refresh();
diff --git a/src/Khd.Core.Wpf/TaskForm/Inventory/InventoryTaskForm.xaml b/src/Khd.Core.Wpf/TaskForm/Inventory/InventoryTaskForm.xaml
index daa52b8..16aa25a 100644
--- a/src/Khd.Core.Wpf/TaskForm/Inventory/InventoryTaskForm.xaml
+++ b/src/Khd.Core.Wpf/TaskForm/Inventory/InventoryTaskForm.xaml
@@ -33,8 +33,9 @@
-
-
+
+
+
@@ -62,11 +63,13 @@
Visibility="Visible"
>
-
-
-
+
+
+
+
+
@@ -76,12 +79,12 @@
-
-
-
+
+
+
-
+
diff --git a/src/Khd.Core.Wpf/TaskForm/Inventory/InventoryTaskForm.xaml.cs b/src/Khd.Core.Wpf/TaskForm/Inventory/InventoryTaskForm.xaml.cs
index 5a79511..c80c0b2 100644
--- a/src/Khd.Core.Wpf/TaskForm/Inventory/InventoryTaskForm.xaml.cs
+++ b/src/Khd.Core.Wpf/TaskForm/Inventory/InventoryTaskForm.xaml.cs
@@ -1,11 +1,17 @@
using Khd.Core.Domain.Models;
using Khd.Core.EntityFramework;
+using Khd.Core.Wpf.Scan;
using Khd.Core.Wpf.TaskForm.Inventory;
+using Masuit.Tools.Logging;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
+using System;
using System.Collections.Generic;
using System.Linq;
+using System.Threading;
using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Input;
namespace Khd.Core.Wpf.TaskForm
{
@@ -14,30 +20,79 @@ namespace Khd.Core.Wpf.TaskForm
///
public partial class InventoryTaskForm : Window
{
+
private readonly IHost _host;
public InventoryTaskForm(IHost host)
{
InitializeComponent();
_host = host;
+
+ Thread scanThread = new Thread(ScanMessage);
+ scanThread.IsBackground = true;
+ scanThread.Start();
}
- private void Window_Loaded(object sender, RoutedEventArgs e)
+
+
+ private void ScanMessage()
+ {
+ while (true)
+ {
+ try
+ {
+ if (SystemData.isUpdate)
+ {
+ if (!string.IsNullOrEmpty(SystemData.message))
+ {
+ Dispatcher.Invoke(() =>
+ {
+ var focusedElement = FocusManager.GetFocusedElement(this);
+ if (focusedElement is TextBox textBox)
+ {
+ textBox.Text = SystemData.message;
+ SystemData.isUpdate = false;
+ }
+ });
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Error(ex);
+ }
+ Thread.Sleep(500);
+ }
+ }
+
+
+ private void txtInBox_TextChanged(object sender, RoutedEventArgs e)
+ {
+ if(txtInBox.Text.Length == 15)
+ {
+ GetData(txtInBox.Text);
+ }
+ else
+ {
+ this.InventoryDataGrid.ItemsSource = null;
+ }
+ }
+ private void Window_Loaded(object sender, RoutedEventArgs e)
{
try
{
using var scope = _host.Services.CreateScope();
var dbContext = scope.ServiceProvider.GetRequiredService();
var wcsTasks = dbContext.WcsTask.Where(t => t.taskType == 100 && t.taskStatus == 6).ToList();
- if (wcsTasks.Count > 0)
- {
- this.ContainerCodeBox.ItemsSource = wcsTasks.Distinct();
- }
- else
- {
- HandyControl.Controls.MessageBox.Show("未找到盘库已完成的小车任务!");
- this.Close();
- }
+ //if (wcsTasks.Count > 0)
+ //{
+ // this.ContainerCodeBox.ItemsSource = wcsTasks.Distinct();
+ //}
+ //else
+ //{
+ // HandyControl.Controls.MessageBox.Show("未找到盘库已完成的小车任务!");
+ // this.Close();
+ //}
}
catch
{
@@ -45,19 +100,23 @@ namespace Khd.Core.Wpf.TaskForm
}
}
- private void GetData()
+ private void GetData(string containerNo)
{
- if (this.ContainerCodeBox.SelectedItem is WcsTask task)
- {
using var scope = _host.Services.CreateScope();
var dbContext = scope.ServiceProvider.GetRequiredService();
var wcsTask = dbContext.WcsTask
.Where(t => t.taskType == 100)
- .Where(t => t.containerNo == task.containerNo).FirstOrDefault();
+ .Where(t => t.containerNo == containerNo).FirstOrDefault();
if (wcsTask != null)
{
+ WmsInventoryCheck check = dbContext.WmsInventoryCheck.Where(x => x.CheckStatus == "1").FirstOrDefault();
+ if (check == null)
+ {
+ HandyControl.Controls.MessageBox.Show("当前无正在执行的盘库任务");
+ return;
+ }
var wmsInventoryCheckDetails = dbContext.WmsInventoryCheckDetail
- .Where(t => t.InventoryCheckId == wcsTask.orderId)
+ .Where(t => t.InventoryCheckId == check.InventoryCheckId)
.Where(t => t.LocationCode == wcsTask.currPointNo)
.Where(t => t.CheckStatus == "1")
.ToList();
@@ -66,8 +125,10 @@ namespace Khd.Core.Wpf.TaskForm
this.InventoryDataGrid.ItemsSource = wmsInventoryCheckDetails.GroupBy(t => t.MaterialId).Select(t =>
new
{
- ContainerNo = wcsTask.containerNo,
- MaterialName = mesBaseMaterialInfos.FirstOrDefault(m => m.MaterialId == t.Key)?.MaterialSpec,
+ //ContainerNo = wcsTask.containerNo,
+ MaterialBatch = t.FirstOrDefault(n => n.MaterialId == t.Key)?.MaterialBatch,
+ MaterialSpec = mesBaseMaterialInfos.FirstOrDefault(m => m.MaterialId == t.Key)?.MaterialSpec,
+ MaterialName = mesBaseMaterialInfos.FirstOrDefault(m => m.MaterialId == t.Key)?.MaterialName,
StockAmount = t.Sum(n => n.StockAmount),
LocationCode = wcsTask.currPointNo,
MaterialId = t.Key,
@@ -78,20 +139,51 @@ namespace Khd.Core.Wpf.TaskForm
{
HandyControl.Controls.MessageBox.Show("该料箱为空料箱");
}
- }
}
else
{
- HandyControl.Controls.MessageBox.Show("请先选择料箱号!");
+ HandyControl.Controls.MessageBox.Show("请扫描盘库任务里面的料箱");
}
+
+
}
private void SearchBtn_Click(object sender, RoutedEventArgs e)
{
- GetData();
+
}
private void EditBtn_Click(object sender, RoutedEventArgs e)
+ {
+ //if (this.InventoryDataGrid.SelectedItem != null)
+ //{
+ // dynamic item = this.InventoryDataGrid.SelectedItem;
+ // long materialId = item.MaterialId;
+ // string containerNo = item.ContainerNo;
+ // string materialName = item.MaterialName;
+ // string locationCode = item.LocationCode;
+ // InventoryTaskEditForm editForm = new InventoryTaskEditForm(_host, materialId, containerNo, materialName, locationCode, this);
+ // this.Hide();
+ // editForm.ShowDialog();
+ // GetData();
+ //}
+ //else
+ //{
+ // if (this.ContainerCodeBox.SelectedItem is WcsTask task)
+ // {
+ // InventoryTaskEditForm editForm = new InventoryTaskEditForm(_host, 0, task.containerNo, "", task.currPointNo, this);
+ // this.Hide();
+ // editForm.ShowDialog();
+ // GetData();
+ // }
+ // else
+ // {
+ // HandyControl.Controls.MessageBox.Show("请先选择料箱号!");
+ // }
+ //}
+ }
+
+ private void Update_Click(object sender, RoutedEventArgs e)
{
if (this.InventoryDataGrid.SelectedItem != null)
{
@@ -100,25 +192,10 @@ namespace Khd.Core.Wpf.TaskForm
string containerNo = item.ContainerNo;
string materialName = item.MaterialName;
string locationCode = item.LocationCode;
- InventoryTaskEditForm editForm = new InventoryTaskEditForm(_host, materialId, containerNo, materialName, locationCode, this);
- this.Hide();
- editForm.ShowDialog();
- GetData();
- }
- else
- {
- if (this.ContainerCodeBox.SelectedItem is WcsTask task)
- {
- InventoryTaskEditForm editForm = new InventoryTaskEditForm(_host, 0, task.containerNo, "", task.currPointNo, this);
- this.Hide();
- editForm.ShowDialog();
- GetData();
- }
- else
- {
- HandyControl.Controls.MessageBox.Show("请先选择料箱号!");
- }
+
+ GetData(item.ContainerNo);
}
}
+
}
}
diff --git a/src/Khd.Core.Wpf/WindowPage/InventoryMaterialWindow.xaml b/src/Khd.Core.Wpf/WindowPage/InventoryMaterialWindow.xaml
index 806b1f1..03b3ec6 100644
--- a/src/Khd.Core.Wpf/WindowPage/InventoryMaterialWindow.xaml
+++ b/src/Khd.Core.Wpf/WindowPage/InventoryMaterialWindow.xaml
@@ -39,12 +39,12 @@
-
+
-
+
diff --git a/src/Khd.Core.Wpf/WindowPage/InventoryMaterialWindow.xaml.cs b/src/Khd.Core.Wpf/WindowPage/InventoryMaterialWindow.xaml.cs
index e0881e4..eb668a1 100644
--- a/src/Khd.Core.Wpf/WindowPage/InventoryMaterialWindow.xaml.cs
+++ b/src/Khd.Core.Wpf/WindowPage/InventoryMaterialWindow.xaml.cs
@@ -1,5 +1,6 @@
using Khd.Core.Domain.Models;
using Khd.Core.EntityFramework;
+using Khd.Core.Wpf.dto;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
@@ -106,15 +107,7 @@ namespace Khd.Core.Wpf.WindowPage
public string materialSpec { get; set; }
}
- private void ClearButton_Click(object sender, RoutedEventArgs e)
- {
- // 如果没有选中项,则清空TextBox的内容
- SelectMaterialId.Text = string.Empty;
- SelectMaterialName.Text = string.Empty;
- SearchTxt.Text = string.Empty;
- Init();
-
- }
+
private void CreateInventoryTask_Click(object sender, RoutedEventArgs e)
{
@@ -128,7 +121,7 @@ namespace Khd.Core.Wpf.WindowPage
int locationCount = 0;
if(itemsControlItems.Count == 0)
{
- locationCount = dbContext.WmsBaseLocation.Where(t => t.warehouseId == 512 && t.ContainerStatus == "1").Count();
+ locationCount = dbContext.WmsBaseLocation.Where(t => t.warehouseId == 512 && t.ContainerStatus == "1" && t.locationStatus=="1").Count();
}
else
{
@@ -150,6 +143,7 @@ namespace Khd.Core.Wpf.WindowPage
{
Orders.ForEach(t =>
{
+ t.EndTime = DateTime.Now;
t.CheckStatus = "2";
});
dbContext.UpdateRange(Orders);