liuwf 1 year ago
parent f05a1153c9
commit 24dbc80a04

@ -41,6 +41,6 @@ namespace Khd.Core.Domain.Models
/// 物料类型id,如果为null盘所有库不为null盘该物料的库
/// </summary>
[Column("material_id")]
public long? MaterialId { get; set; }
public string? MaterialId { get; set; }
}
}

@ -1938,6 +1938,7 @@
<Button Content="搜索" Background="#346DFF" Foreground="White" FontSize="25" Height="50" Width="100" Margin="20,0,0,0" Click="SelectInventoryButton_Click"/>
<Button Content="添加盘库任务" Background="#346DFF" Foreground="White" FontSize="25" Height="50" Width="200" Margin="20,0,0,0" Click="AddInventoryButton_Click"/>
<Button Content="库存盘点" Background="#346DFF" Foreground="White" FontSize="25" Height="50" Width="150" Margin="20,0,0,0" Click="InventoryTaskButton_Click"/>
<Button Content="一键收料" Grid.Row="7" Grid.ColumnSpan="2" FontSize="25" Height="50" Width="150" Background="#346DFF" Foreground="White" Click="callPlc_Click" HorizontalAlignment="Left" Grid.Column="4" Margin="222,0,0,0"/>
</StackPanel>
<DataGrid
Style="{StaticResource DataGridStyle}"

@ -114,6 +114,7 @@ namespace Khd.Core.Wpf.Form
{
InitializeComponent();
this._host = host;
InventoryMaterialWindow.RefreshInventoryListEvent += GetInvertoryData;
}
/// <summary>
/// 页面加载事件
@ -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<string>? 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<long> 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<string> locations = wmsBaseLocations.Select(t => t.locationCode).ToList();
List<WmsRawStock> 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<string> 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()

@ -31,6 +31,11 @@ namespace Khd.Core.Wpf.WindowPage
private ObservableCollection<StockItem> itemsControlItems;
/// <summary>
/// 刷新盘库任务列表
/// </summary>
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<DefaultDbContext>();
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;

Loading…
Cancel
Save