diff --git a/src/Khd.Core.Domain/Models/WmsInventoryCheck.cs b/src/Khd.Core.Domain/Models/WmsInventoryCheck.cs
index 490f66c..7db09e4 100644
--- a/src/Khd.Core.Domain/Models/WmsInventoryCheck.cs
+++ b/src/Khd.Core.Domain/Models/WmsInventoryCheck.cs
@@ -41,6 +41,6 @@ namespace Khd.Core.Domain.Models
/// 物料类型id,如果为null盘所有库,不为null盘该物料的库
///
[Column("material_id")]
- public long? MaterialId { get; set; }
+ public string? MaterialId { get; set; }
}
}
diff --git a/src/Khd.Core.Wpf/Form/FormBoardT.xaml b/src/Khd.Core.Wpf/Form/FormBoardT.xaml
index 9a99d3d..4682346 100644
--- a/src/Khd.Core.Wpf/Form/FormBoardT.xaml
+++ b/src/Khd.Core.Wpf/Form/FormBoardT.xaml
@@ -1938,6 +1938,7 @@
+
/// 页面加载事件
@@ -296,7 +297,7 @@ namespace Khd.Core.Wpf.Form
HandyControl.Controls.MessageBox.Error(ex.Message);
}
-
+
}
#region 库位状态可视化
@@ -1550,7 +1551,7 @@ namespace Khd.Core.Wpf.Form
// GetTask();
//}
- if (selectedTabItem != null && selectedTabItem.Name == "CallPersonManager")
+ if (selectedTabItem != null && selectedTabItem.Name == "CallPersonManager")
{ //人工叫料界面
CallSelectedItem.Clear();
await GetPersonCallMaterialData();
@@ -2904,11 +2905,15 @@ namespace Khd.Core.Wpf.Form
if (!hasTask)
{
List? locationCodeList = null;
- if (InventoryCheck.MaterialId != null)
- {
- // 盘点某个型号的物料库存的库位
- locationCodeList = dbContext.WmsRawStock.Where(t => t.warehouseId == 512 && t.materialId == InventoryCheck.MaterialId ).Select(x=>x.locationCode).ToList();
-
+ if (!string.IsNullOrEmpty(InventoryCheck.MaterialId))
+ {
+ List materialIds = InventoryCheck.MaterialId.Split(';').Select(id => long.Parse(id)).ToList();
+ if(materialIds!=null && materialIds.Count > 0)
+ {
+ // 盘点指定型号的物料库存的库位
+ locationCodeList = dbContext.WmsRawStock.Where(t => t.warehouseId == 512 && materialIds.Contains((long)t.materialId)).Select(x => x.locationCode).Distinct().ToList();
+ }
+
}
//所有满足条件的需要盘库的库位
var wmsBaseLocations = dbContext.WmsBaseLocation
@@ -2917,9 +2922,9 @@ namespace Khd.Core.Wpf.Form
.OrderBy(t => t.locRow)
.ThenBy(t => t.locColumn)
.ToList();
- if(locationCodeList != null && locationCodeList.Count > 0)
+ if (locationCodeList != null && locationCodeList.Count > 0)
{
- wmsBaseLocations = wmsBaseLocations.Where(x=>locationCodeList.Contains(x.locationCode)).ToList();
+ wmsBaseLocations = wmsBaseLocations.Where(x => locationCodeList.Contains(x.locationCode)).ToList();
}
var wmsInventoryCheckDetails = dbContext.WmsInventoryCheckDetail
@@ -2932,8 +2937,7 @@ namespace Khd.Core.Wpf.Form
List locations = wmsBaseLocations.Select(t => t.locationCode).ToList();
List wmsRawStocks = dbContext.WmsRawStock.Where(t => t.warehouseId == 512)
- .Where(t => locations.Contains(t.locationCode))
- .WhereIf(InventoryCheck.MaterialId!=null,t => t.materialId == InventoryCheck.MaterialId).ToList();
+ .Where(t => locations.Contains(t.locationCode)).ToList();
// 过滤后需要满足条件的有库存的库位
List codes = wmsRawStocks.Select(t => t.locationCode).Distinct().ToList();
@@ -2949,7 +2953,7 @@ namespace Khd.Core.Wpf.Form
WmsBaseLocation startBaseLocation = item.a;
startBaseLocation.locationStatus = "6";
//startBaseLocation.ContainerStatus = "2";
-
+
addList.Add(new WcsTaskManual()
{
objid = Global.SnowId.NextId(),
@@ -4295,7 +4299,7 @@ namespace Khd.Core.Wpf.Form
{
InventoryMaterialWindow window = new InventoryMaterialWindow(_host);
window.ShowDialog();
-
+
}
private void GetInvertoryData()
diff --git a/src/Khd.Core.Wpf/WindowPage/InventoryMaterialWindow.xaml.cs b/src/Khd.Core.Wpf/WindowPage/InventoryMaterialWindow.xaml.cs
index aad77fc..e0881e4 100644
--- a/src/Khd.Core.Wpf/WindowPage/InventoryMaterialWindow.xaml.cs
+++ b/src/Khd.Core.Wpf/WindowPage/InventoryMaterialWindow.xaml.cs
@@ -31,6 +31,11 @@ namespace Khd.Core.Wpf.WindowPage
private ObservableCollection itemsControlItems;
+ ///
+ /// 刷新盘库任务列表
+ ///
+ public delegate void RefreshInventoryList();
+ public static event RefreshInventoryList? RefreshInventoryListEvent;
public InventoryMaterialWindow(IHost _host)
@@ -121,16 +126,21 @@ namespace Khd.Core.Wpf.WindowPage
var dbContext = scope.ServiceProvider.GetRequiredService();
int locationCount = 0;
-
- if (string.IsNullOrEmpty(SelectMaterialId.Text)){
- locationCount = dbContext.WmsBaseLocation.Where(t => t.warehouseId == 512).Count();
+ if(itemsControlItems.Count == 0)
+ {
+ locationCount = dbContext.WmsBaseLocation.Where(t => t.warehouseId == 512 && t.ContainerStatus == "1").Count();
}
else
{
- locationCount = dbContext.WmsBaseLocation.Where(t => t.warehouseId == 512).Count();
+ var materialIdList = itemsControlItems.Select(t => long.Parse(t.materialId)).ToList();
+ var locations = dbContext.WmsRawStock.Where(t => materialIdList.Contains((long)t.materialId)).ToList().Select(t=>t.locationCode).Distinct();
+ locationCount = locations.Count();
+ }
+ string materialIds = null;
+ if (itemsControlItems.Count > 0)
+ {
+ materialIds = string.Join(";", itemsControlItems.Select(t => t.materialId));
}
-
-
var Orders = dbContext.WmsInventoryCheck.Where(t => t.CheckStatus == "0" || t.CheckStatus == "1").ToList();
if (Orders != null && Orders.Count > 0)
@@ -153,7 +163,7 @@ namespace Khd.Core.Wpf.WindowPage
InventoryingAmount = 0,
WarehouseId = 512,
CreateBy = "WCS",
- MaterialId = string.IsNullOrEmpty(SelectMaterialId.Text) ? null : long.Parse(SelectMaterialId.Text)
+ MaterialId = materialIds
}) ;
dbContext.SaveChanges();
HandyControl.Controls.Growl.Info("创建盘库任务成功!");
@@ -178,7 +188,7 @@ namespace Khd.Core.Wpf.WindowPage
InventoryingAmount = 0,
WarehouseId = 512,
CreateBy = "WCS",
- MaterialId = string.IsNullOrEmpty(SelectMaterialId.Text) ? null : long.Parse(SelectMaterialId.Text)
+ MaterialId = materialIds
});
dbContext.SaveChanges();
HandyControl.Controls.Growl.Info("创建盘库任务成功!");
@@ -186,7 +196,10 @@ namespace Khd.Core.Wpf.WindowPage
}
this.Close();
-
+ //刷新列表
+ RefreshInventoryListEvent?.Invoke();
+
+
}
catch
{
@@ -210,12 +223,12 @@ namespace Khd.Core.Wpf.WindowPage
dynamic Currentselected = StockDataGrid.SelectedItem;
if (checkbox.IsChecked != null && checkbox.IsChecked.Value)
{
- if (itemsControlItems != null && itemsControlItems.Count >= 6)
- {
- MessageBox.Show("最多只能选择6个");
- checkbox.IsChecked = false;
- return;
- }
+ //if (itemsControlItems != null && itemsControlItems.Count >= 6)
+ //{
+ // MessageBox.Show("最多只能选择6个");
+ // checkbox.IsChecked = false;
+ // return;
+ //}
// 添加选中项
string selectedItem = Currentselected.materialName;