|
|
|
@ -31,6 +31,11 @@ namespace Khd.Core.Wpf.WindowPage
|
|
|
|
|
|
|
|
|
|
|
|
private ObservableCollection<StockItem> itemsControlItems;
|
|
|
|
private ObservableCollection<StockItem> itemsControlItems;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 刷新盘库任务列表
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public delegate void RefreshInventoryList();
|
|
|
|
|
|
|
|
public static event RefreshInventoryList? RefreshInventoryListEvent;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public InventoryMaterialWindow(IHost _host)
|
|
|
|
public InventoryMaterialWindow(IHost _host)
|
|
|
|
@ -121,16 +126,21 @@ namespace Khd.Core.Wpf.WindowPage
|
|
|
|
var dbContext = scope.ServiceProvider.GetRequiredService<DefaultDbContext>();
|
|
|
|
var dbContext = scope.ServiceProvider.GetRequiredService<DefaultDbContext>();
|
|
|
|
|
|
|
|
|
|
|
|
int locationCount = 0;
|
|
|
|
int locationCount = 0;
|
|
|
|
|
|
|
|
if(itemsControlItems.Count == 0)
|
|
|
|
if (string.IsNullOrEmpty(SelectMaterialId.Text)){
|
|
|
|
{
|
|
|
|
locationCount = dbContext.WmsBaseLocation.Where(t => t.warehouseId == 512).Count();
|
|
|
|
locationCount = dbContext.WmsBaseLocation.Where(t => t.warehouseId == 512 && t.ContainerStatus == "1").Count();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
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();
|
|
|
|
var Orders = dbContext.WmsInventoryCheck.Where(t => t.CheckStatus == "0" || t.CheckStatus == "1").ToList();
|
|
|
|
if (Orders != null && Orders.Count > 0)
|
|
|
|
if (Orders != null && Orders.Count > 0)
|
|
|
|
@ -153,7 +163,7 @@ namespace Khd.Core.Wpf.WindowPage
|
|
|
|
InventoryingAmount = 0,
|
|
|
|
InventoryingAmount = 0,
|
|
|
|
WarehouseId = 512,
|
|
|
|
WarehouseId = 512,
|
|
|
|
CreateBy = "WCS",
|
|
|
|
CreateBy = "WCS",
|
|
|
|
MaterialId = string.IsNullOrEmpty(SelectMaterialId.Text) ? null : long.Parse(SelectMaterialId.Text)
|
|
|
|
MaterialId = materialIds
|
|
|
|
}) ;
|
|
|
|
}) ;
|
|
|
|
dbContext.SaveChanges();
|
|
|
|
dbContext.SaveChanges();
|
|
|
|
HandyControl.Controls.Growl.Info("创建盘库任务成功!");
|
|
|
|
HandyControl.Controls.Growl.Info("创建盘库任务成功!");
|
|
|
|
@ -178,7 +188,7 @@ namespace Khd.Core.Wpf.WindowPage
|
|
|
|
InventoryingAmount = 0,
|
|
|
|
InventoryingAmount = 0,
|
|
|
|
WarehouseId = 512,
|
|
|
|
WarehouseId = 512,
|
|
|
|
CreateBy = "WCS",
|
|
|
|
CreateBy = "WCS",
|
|
|
|
MaterialId = string.IsNullOrEmpty(SelectMaterialId.Text) ? null : long.Parse(SelectMaterialId.Text)
|
|
|
|
MaterialId = materialIds
|
|
|
|
});
|
|
|
|
});
|
|
|
|
dbContext.SaveChanges();
|
|
|
|
dbContext.SaveChanges();
|
|
|
|
HandyControl.Controls.Growl.Info("创建盘库任务成功!");
|
|
|
|
HandyControl.Controls.Growl.Info("创建盘库任务成功!");
|
|
|
|
@ -186,6 +196,9 @@ namespace Khd.Core.Wpf.WindowPage
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.Close();
|
|
|
|
this.Close();
|
|
|
|
|
|
|
|
//刷新列表
|
|
|
|
|
|
|
|
RefreshInventoryListEvent?.Invoke();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch
|
|
|
|
catch
|
|
|
|
@ -210,12 +223,12 @@ namespace Khd.Core.Wpf.WindowPage
|
|
|
|
dynamic Currentselected = StockDataGrid.SelectedItem;
|
|
|
|
dynamic Currentselected = StockDataGrid.SelectedItem;
|
|
|
|
if (checkbox.IsChecked != null && checkbox.IsChecked.Value)
|
|
|
|
if (checkbox.IsChecked != null && checkbox.IsChecked.Value)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (itemsControlItems != null && itemsControlItems.Count >= 6)
|
|
|
|
//if (itemsControlItems != null && itemsControlItems.Count >= 6)
|
|
|
|
{
|
|
|
|
//{
|
|
|
|
MessageBox.Show("最多只能选择6个");
|
|
|
|
// MessageBox.Show("最多只能选择6个");
|
|
|
|
checkbox.IsChecked = false;
|
|
|
|
// checkbox.IsChecked = false;
|
|
|
|
return;
|
|
|
|
// return;
|
|
|
|
}
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
// 添加选中项
|
|
|
|
// 添加选中项
|
|
|
|
string selectedItem = Currentselected.materialName;
|
|
|
|
string selectedItem = Currentselected.materialName;
|
|
|
|
|