master
liuwf 1 year ago
parent 89d6a133ab
commit b76444e1fc

@ -0,0 +1,37 @@
//-----------------------------------------------------------------------
//<copyright>
// * Copyright (C) 2021 KEHAIDASOFT All Rights Reserved
// * version : 4.0.30319.42000
// * author : khd by t4-2
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Khd.Core.Domain.Models
{
[Table("mes_sale_order_relate")]
public class MesSaleOrderRelate
{
[Key]
[Column("sale_order_relate_id")]
public long SaleOrderRelateId { get; set; }
[Column("sale_order_id")]
public long SaleOrderId { get; set; }
[Column("relate_sale_order_id")]
public long RelateSaleOrderId { get; set; }
[Column("purchase_order_id")]
public long PurchaseOrderId { get; set; }
[Column("relate_sale_order_amout")]
public decimal RelateSaleOrderAmount { get; set; }
}
}

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

@ -32,6 +32,9 @@ namespace Khd.Core.EntityFramework
public DbSet<BasePlc> BasePlc { get; set; }
public DbSet<MesBasePalletInfo> MesBasePalletInfo { get; set; }
public DbSet<MesSaleOrderRelate> MesSaleOrderRelate { get; set; }
public DbSet<MesProductPlanDetail> MesProductPlanDetail { get; set; }
public DbSet<WcsCmd> WcsCmd { get; set; }

@ -2415,7 +2415,8 @@ namespace Khd.Core.Wcs.Wcs
{
// TODO : 没有找到可以移库的目标库位,添加报警
Console.WriteLine("5F原材料前往背板安装需要先移库没有找到可以移库的目标库位添加报警");
return;
Thread.Sleep(1000 * 5);
continue;
}
var RemoveTask = new WcsTask()
{
@ -2565,7 +2566,7 @@ namespace Khd.Core.Wcs.Wcs
{
Console.WriteLine(DateTime.Now + $":{location.locationCode}库位状态异常,无法出库");
_logger.Info($"{location.locationCode}库位状态异常,无法出库");
return;
continue;
}
if (location.locDeep == 1)
{
@ -2634,7 +2635,7 @@ namespace Khd.Core.Wcs.Wcs
{
// TODO : 没有找到可以移库的目标库位,添加报警
Console.WriteLine("5F原材料前往背板安装需要先移库没有找到可以移库的目标库位添加报警");
return;
continue;
}
var RemoveTask = new WcsTask()
{
@ -2672,7 +2673,7 @@ namespace Khd.Core.Wcs.Wcs
else if (wmsBaseLocation.locationStatus != "1")
{
Console.WriteLine("浅库位状态异常,禁止出库,请检查浅库位状态");
return;
continue;
}
}

@ -808,6 +808,41 @@ namespace Khd.Core.Wcs.Wcs
var mesBaseBarcodeInfo = dbContext.MesBaseBarcodeInfo.FirstOrDefault(t => t.barcodeInfo == mesBasePalletInfo.materialBarcode);
if (mesBaseBarcodeInfo != null)
{
if (mesBaseBarcodeInfo.PurchaseOrderId == -1)
{ // 合并的物料
// List<MesSaleOrderRelate> mesSaleOrderRelates = dbContext.MesSaleOrderRelate.Where(x=>x.SaleOrderId==mesBaseBarcodeInfo.saleOrderId)
}
else
{
WmsRawInstock wmsRawInstock = new WmsRawInstock()
{
taskCode = item.taskCode,
materialBarCode = mesBaseBarcodeInfo.barcodeInfo,
materialBatchCode = mesBaseBarcodeInfo.batchCode,
applyBy = "wcs",
applyDate = System.DateTime.Now,
purchaseOrderId = mesBaseBarcodeInfo.PurchaseOrderId,
beginTime = DateTime.Now,
endTime = DateTime.Now,
locationCode = wmsBaseLocation.locationCode,
executeStatus = "2",
instockAmount = 1,
instockType = "1",
materialId = mesBaseBarcodeInfo.materialId,
operationType = "3",
palletInfoCode = mesBaseBarcodeInfo.palletInfoCode,
poNo = mesBaseBarcodeInfo.poNo,
warehouseId = 511
};
dbContext.Add(wmsRawInstock);
}
WmsRawStock wmsRawStock = new()
{
palletInfoCode = mesBasePalletInfo.palletInfoCode,
@ -833,31 +868,8 @@ namespace Khd.Core.Wcs.Wcs
updateDate = DateTime.Now,
warehouseId = 511,
};
WmsRawInstock wmsRawInstock = new WmsRawInstock()
{
taskCode = item.taskCode,
materialBarCode = mesBaseBarcodeInfo.barcodeInfo,
materialBatchCode = mesBaseBarcodeInfo.batchCode,
applyBy = "wcs",
applyDate = System.DateTime.Now,
purchaseOrderId = mesBaseBarcodeInfo.PurchaseOrderId,
beginTime = DateTime.Now,
endTime = DateTime.Now,
locationCode = wmsBaseLocation.locationCode,
executeStatus = "2",
instockAmount = 1,
instockType = "1",
materialId = mesBaseBarcodeInfo.materialId,
operationType = "3",
palletInfoCode = mesBaseBarcodeInfo.palletInfoCode,
poNo = mesBaseBarcodeInfo.poNo,
warehouseId = 511
};
SystemData.UnLockOutLocation(wmsBaseLocation, dbContext);
dbContext.Add(wmsRawInstock);
wmsBaseLocation.returnFlag = "0";
BaseEquip lineEquip = dbContext.BaseEquip.First(t => t.objid == 5);
lineEquip.equipStatus = 0;

@ -65,13 +65,13 @@ namespace Khd.Core.Wcs.Wcs
var PalletInIsHas2F = StaticData.PlcDic[2].Read(PalletInIsHas2FPoint.plcpointAddress);//2F托盘库入口上料光电
var agvGetValue = StaticData.PlcDic[2].Read(agvGetPoint.plcpointAddress);//小包出口的到位
var rfidValue = StaticData.PlcDic[2].ReadRFID(rfidPoint.plcpointAddress,15);//小包出口的RFID
if (agvGetValue != null && agvPutValue != null && rfidValue != null && ConnectStatus2F!=null && PalletInIsHas2F!=null)//读Plc
var rfidValue = StaticData.PlcDic[2].ReadRFID(rfidPoint.plcpointAddress, 15);//小包出口的RFID
if (agvGetValue != null && agvPutValue != null && rfidValue != null && ConnectStatus2F != null && PalletInIsHas2F != null)//读Plc
{
// 托盘库叫料信号,并且通讯正常,并且小包入口无料才可叫料
// 托盘库叫料信号,并且通讯正常,并且小包入口无料才可叫料
if (Convert.ToInt32(agvPutValue) == 1 && Convert.ToInt32(ConnectStatus2F) == 1 && Convert.ToInt32(PalletInIsHas2F) == 0)//小包入口叫料
{
bool canCreate = dbContext.WcsTask.Where(t => t.nextPointId == 8 || t.endPointId == endEquip.objid).Any();//有没有生成任务
//36 是小包入口的设备信息8是二楼Agv设备
if (!canCreate)//没有任务
@ -232,7 +232,7 @@ namespace Khd.Core.Wcs.Wcs
//todo:没有空托盘超过十次预警报警
Console.WriteLine(DateTime.Now + ":二楼码垛输送线没有空托盘,叫托盘失败!");
_logger.Info("二楼码垛输送线没有空托盘,叫托盘失败!");
Thread.Sleep(1000*60);
Thread.Sleep(1000 * 5);
}
}
}
@ -251,6 +251,8 @@ namespace Khd.Core.Wcs.Wcs
MesBaseBarcodeInfo? mesBaseBarcodeInfo = dbContext.MesBaseBarcodeInfo.FirstOrDefault(t => t.barcodeInfo == mesBasePalletInfo.materialBarcode);
if (mesBaseBarcodeInfo != null)
{
// 目标库位
WmsBaseLocation? wmsBaseLocation = null;
var wmsBaseLocations = dbContext.WmsBaseLocation
.Where(t => t.warehouseFloor == FloorNo)
.Where(t => t.activeFlag == "1")
@ -258,96 +260,124 @@ namespace Khd.Core.Wcs.Wcs
.Where(t => t.locationScrapType == "1")
.Where(t => t.locationStatus == "1")
.Where(t => t.warehouseId == 231)
.ToList();//所有可用库位
var wmsProductStocks = dbContext.WmsProductStock
.Where(t => t.warehouseId == 231)
.ToList();//仓库的库存
WmsBaseLocation? wmsBaseLocation = null;
if (wmsBaseLocations.Count > 0)
{
List<string> containerCodes = wmsBaseLocations
.Where(t => t.locDeep == 1)
.Select(t => t.containerCode).ToList();//深库位的有托盘
containerCodes.RemoveAll(t => string.IsNullOrEmpty(t));
.ToList();//所有未锁定的库位
List<WmsProductStock> productStocks = wmsProductStocks.Where(t => t.productId == mesBaseBarcodeInfo.materialId)
.Where(t => t.saleOrderId == mesBaseBarcodeInfo.saleOrderId)
.Where(t => t.palletInfoCode != null)
.Where(t => containerCodes.Contains(t.palletInfoCode)).ToList();
//深库位有库存的库位
List<string> DeepContainerCodes = wmsBaseLocations
.Where(t => t.locDeep == 1)
.Where(t => !string.IsNullOrEmpty(t.containerCode))
.Select(t => t.containerCode).ToList();
var bill = from a in productStocks
join b in wmsBaseLocations.Where(t => t.locDeep == 1) on a.palletInfoCode equals b.containerCode
select new { b };//等于当前任务的物料的托盘的库位信息
//相同型号及销售订单的深库位库存
List<WmsProductStock> productStocks = dbContext.WmsProductStock.Where(t => t.productId == mesBaseBarcodeInfo.materialId)
.Where(t => t.saleOrderId == mesBaseBarcodeInfo.saleOrderId)
.Where(t => t.warehouseId== 231)
.Where(t => DeepContainerCodes.Contains(t.palletInfoCode)).ToList();
var outBill = from a in bill//深库位托盘和当前任务绑定物料一致的托盘库位
from b in wmsBaseLocations//所有库位
where b.locDeep == 2//浅库位
&& b.locRow == (a.b.locRow % 2 == 0 ? a.b.locRow - 1 : a.b.locRow + 1)
//如果是4则找3如果是1则找2
&& a.b.locColumn == b.locColumn//列数相同
&& string.IsNullOrEmpty(b.containerCode)
select new { a.b };//在上面的基础上获取对应托盘的外侧库位的空库位信息
wmsBaseLocation ??= outBill.Where(t => !canNotIn.Contains(t.b.locationCode)).FirstOrDefault()?.b;//先找相同物料的外侧库位
wmsBaseLocation ??= wmsBaseLocations.Where(t => !canNotIn.Contains(t.locationCode)).Where(t => string.IsNullOrEmpty(t.containerCode)).FirstOrDefault(t => t.locDeep == 1);//找不到再找深库位
wmsBaseLocation ??= wmsBaseLocations.Where(t => !canNotIn.Contains(t.locationCode)).Where(t => string.IsNullOrEmpty(t.containerCode)).FirstOrDefault();//找不到再找任意库位
if (wmsBaseLocation != null)//如果找到库位,生成入库任务
if(productStocks.Count > 0)
{ //优先找同销售订单的有库存的深库位对应的浅库位
foreach(var productStock in productStocks)
{
if (wmsBaseLocation.locDeep == 1)
// 深库位库存对用的Location信息
var deepStockLocation = wmsBaseLocations.Where(t => t.containerCode == productStock.palletInfoCode).FirstOrDefault();
wmsBaseLocation = wmsBaseLocations.Where(t => string.IsNullOrEmpty(t.containerCode) && t.locationStatus=="1")
.Where(t=> t.locDeep == 2 && t.locColumn ==deepStockLocation.locColumn)
.Where(t=> t.locRow == (deepStockLocation.locRow % 2 == 0 ? (deepStockLocation.locRow - 1) :(deepStockLocation.locRow + 1)) )
.FirstOrDefault();
if (wmsBaseLocation != null)
{
var hasLocation = wmsBaseLocations
.Where(t => t.locRow == (wmsBaseLocation.locRow % 2 == 1 ? (wmsBaseLocation.locRow + 1) : (wmsBaseLocation.locRow - 1)))
.Where(t => t.locColumn == wmsBaseLocation.locColumn)
.Where(t => !string.IsNullOrEmpty(t.containerCode) || t.locationStatus != "1")
.Any();
if (hasLocation)
{
canNotIn.Add(wmsBaseLocation.locationCode);
Console.WriteLine(DateTime.Now + $":目标库位{canNotIn.Join(",")}的浅库位库位状态异常,无法入库");
_logger.Info($"目标库位{canNotIn.Join(",")}的浅库位库位状态异常,无法入库");
continue;
}
break;
}
BaseEquip startEquip = StaticData.BaseEquip.First(t => t.objid == 37);
var wcsTask = new WcsTask()
{
objid = StaticData.SnowId.NextId(),
currPointId = startEquip.objid,
currPointNo = startEquip.equipNo,
nextPointId = agvEquip.objid,
nextPointNo = agvEquip.equipNo,
endPointId = wmsBaseLocation.locationId,
endPointNo = wmsBaseLocation.locationCode,
taskStatus = 0,
useFlag = 1,
containerNo = rfidValue,
createBy = "WCS",
createTime = DateTime.Now,
floorNo = 2,
fromFloorNo = 2,
isEmpty = "0",
taskType = StaticTaskType.SecondSmallPackageToStorage,
qty = 1,
};
SystemData.LockOutLocation(wmsBaseLocation, dbContext);
dbContext.Add(wcsTask);
WcsTaskLog wcsTaskLog = CoreMapper.Map<WcsTaskLog>(wcsTask);
dbContext.Add(wcsTaskLog);
dbContext.SaveChanges();
canNotIn.Clear();
Console.WriteLine(DateTime.Now + ":二楼码垛输送线生成入库托盘任务成功:" + wcsTask.objid);
_logger.Info("二楼码垛输送线生成入库托盘任务成功:" + wcsTask.objid);
}
else
{
//报警
}
}
if(wmsBaseLocation == null)
{ // 找深库位有库存的库位对应的浅库位
var stockLocations = wmsBaseLocations.Where(x => !string.IsNullOrEmpty(x.containerCode) && x.locDeep==1).ToList();
foreach (var item in stockLocations)
{
wmsBaseLocation = wmsBaseLocations.Where(t => string.IsNullOrEmpty(t.containerCode) && t.locationStatus == "1")
.Where(t => t.locDeep == 2 && t.locColumn == item.locColumn)
.Where(t => t.locRow == (item.locRow % 2 == 0 ? (item.locRow - 1) : (item.locRow + 1)))
.FirstOrDefault();
if (wmsBaseLocation != null)
{
break;
}
}
}
if(wmsBaseLocation == null)
{ // 在所有符合条件的库位里,找一个库位,优先深库位,但是如果是深库位,需要判断浅库位状态是否正常
var searchLocations = wmsBaseLocations.Where(x => string.IsNullOrEmpty(x.containerCode) && x.locationStatus == "1").OrderBy(x=>x.locDeep).ToList();
foreach (var item in searchLocations)
{
if(item.locDeep == 1)
{
//浅库位能否使用
var shallowLocation = wmsBaseLocations.Where(t => string.IsNullOrEmpty(t.containerCode) && t.locationStatus == "1")
.Where(t => t.locDeep == 2 && t.locColumn == item.locColumn)
.Where(t => t.locRow == (item.locRow % 2 == 0 ? (item.locRow - 1) : (item.locRow + 1)))
.FirstOrDefault();
if (shallowLocation != null)
{
wmsBaseLocation = item;
break;
}
}
else
{
wmsBaseLocation = item;
break;
}
}
}
if (wmsBaseLocation != null)//如果找到库位,生成入库任务
{
BaseEquip startEquip = StaticData.BaseEquip.First(t => t.objid == 37);
var wcsTask = new WcsTask()
{
objid = StaticData.SnowId.NextId(),
currPointId = startEquip.objid,
currPointNo = startEquip.equipNo,
nextPointId = agvEquip.objid,
nextPointNo = agvEquip.equipNo,
endPointId = wmsBaseLocation.locationId,
endPointNo = wmsBaseLocation.locationCode,
taskStatus = 0,
useFlag = 1,
containerNo = rfidValue,
createBy = "WCS",
createTime = DateTime.Now,
floorNo = 2,
fromFloorNo = 2,
isEmpty = "0",
taskType = StaticTaskType.SecondSmallPackageToStorage,
qty = 1,
};
SystemData.LockOutLocation(wmsBaseLocation, dbContext);
dbContext.Add(wcsTask);
WcsTaskLog wcsTaskLog = CoreMapper.Map<WcsTaskLog>(wcsTask);
dbContext.Add(wcsTaskLog);
dbContext.SaveChanges();
canNotIn.Clear();
Console.WriteLine(DateTime.Now + ":二楼码垛输送线生成入库托盘任务成功:" + wcsTask.objid);
_logger.Info("二楼码垛输送线生成入库托盘任务成功:" + wcsTask.objid);
}
else
{
Console.WriteLine(DateTime.Now + ":2楼调度入库任务,未找到库位");
_logger.Info("2楼调度入库任务,未找到库位");
// TODO: 没有找到库位,添加报警处理
Thread.Sleep(1000 * 5);
}
}
}
}
}
}
}
}

@ -76,57 +76,90 @@ namespace Khd.Core.Wcs.Wcs
MesBaseBarcodeInfo? mesBaseBarcodeInfo = dbContext.MesBaseBarcodeInfo.FirstOrDefault(t => t.barcodeInfo == mesBasePalletInfo.materialBarcode);
if (mesBaseBarcodeInfo != null)
{
var wmsBaseLocations = dbContext.WmsBaseLocation.Where(t => t.warehouseFloor == FloorNo)
.Where(t => t.activeFlag == "1")
.Where(t => t.delFlag == "0")
.Where(t => t.locationScrapType == "1")
.Where(t => t.locationStatus == "1")
.OrderByDescending(t => t.locRow)
.ThenByDescending(t => t.locColumn)
.ToList();
// 目标库位
WmsBaseLocation? wmsBaseLocation = null;
var wmsBaseLocations = dbContext.WmsBaseLocation
.Where(t => t.warehouseFloor == FloorNo)
.Where(t => t.activeFlag == "1")
.Where(t => t.delFlag == "0")
.Where(t => t.locationScrapType == "1")
.Where(t => t.locationStatus == "1")
.Where(t => t.warehouseId == 311)
.ToList();//所有未锁定的库位
List<string> containerCodes = wmsBaseLocations.Where(t => t.locDeep == 1).Select(t => t.containerCode).ToList();//深库位的托盘
containerCodes.RemoveAll(t => string.IsNullOrEmpty(t));
//深库位有库存的库位
List<string> DeepContainerCodes = wmsBaseLocations
.Where(t => t.locDeep == 1)
.Where(t => !string.IsNullOrEmpty(t.containerCode))
.Select(t => t.containerCode).ToList();
//相同型号及销售订单的深库位库存
List<WmsRawStock> wmsRawStocks = dbContext.WmsRawStock.Where(t => t.materialId == mesBaseBarcodeInfo.materialId)
.Where(t => t.saleOrderId == mesBaseBarcodeInfo.saleOrderId)
.Where(t => t.palletInfoCode != null)
.Where(t => t.warehouseId == 311)
.Where(t => containerCodes.Contains(t.palletInfoCode)).ToList();
var bill = from a in wmsRawStocks
join b in wmsBaseLocations.Where(t => t.locDeep == 1 && !string.IsNullOrEmpty(t.containerCode)) on a.palletInfoCode equals b.containerCode
select new { b };//等于当前任务的物料的托盘的库位信息
var outBill = from b in wmsBaseLocations
from a in bill
where b.locDeep == 2
&& b.locRow == (a.b.locRow % 2 == 0 ? a.b.locRow - 1 : a.b.locRow + 1)
&& a.b.locColumn == b.locColumn
&& b.locationStatus == "1"
&& string.IsNullOrEmpty(b.containerCode)
select new { b };//在上面的基础上获取对应托盘的外侧库位的空库位信息
WmsBaseLocation? wmsBaseLocation = outBill.Where(t => !canNotIn.Contains(t.b.locationCode)).FirstOrDefault()?.b;//先找相同物料的外侧库位
wmsBaseLocation ??= wmsBaseLocations.Where(t => !canNotIn.Contains(t.locationCode)).Where(t => string.IsNullOrEmpty(t.containerCode)).FirstOrDefault(t => t.locDeep == 1);//找不到再找深库位
wmsBaseLocation ??= wmsBaseLocations.Where(t => !canNotIn.Contains(t.locationCode)).Where(t => string.IsNullOrEmpty(t.containerCode)).FirstOrDefault();//找不到再找任意库位
if (wmsBaseLocations.Count > 0 && wmsBaseLocation != null)
{
if (wmsBaseLocation.locDeep == 1)
.Where(t => t.saleOrderId == mesBaseBarcodeInfo.saleOrderId)
.Where(t => DeepContainerCodes.Contains(t.palletInfoCode))
.Where(t => t.warehouseId == 311).ToList();
if (wmsRawStocks.Count > 0)
{ //优先找同销售订单的有库存的深库位对应的浅库位
foreach (var wmsRawStock in wmsRawStocks)
{
bool hasLocation = wmsBaseLocations
.Where(t => t.locRow == (wmsBaseLocation.locRow % 2 == 1 ? (wmsBaseLocation.locRow + 1) : (wmsBaseLocation.locRow - 1)))
.Where(t => t.locColumn == wmsBaseLocation.locColumn)
.Where(t => !string.IsNullOrEmpty(t.containerCode) || t.locationStatus != "1")
.Any();
if (hasLocation)
// 深库位库存对用的Location信息
var deepStockLocation = wmsBaseLocations.Where(t => t.containerCode == wmsRawStock.palletInfoCode).FirstOrDefault();
wmsBaseLocation = wmsBaseLocations.Where(t => string.IsNullOrEmpty(t.containerCode) && t.locationStatus == "1")
.Where(t => t.locDeep == 2 && t.locColumn == deepStockLocation.locColumn)
.Where(t => t.locRow == (deepStockLocation.locRow % 2 == 0 ? (deepStockLocation.locRow - 1) : (deepStockLocation.locRow + 1)))
.FirstOrDefault();
if (wmsBaseLocation != null)
{
canNotIn.Add(wmsBaseLocation.locationCode);
Console.WriteLine(DateTime.Now + $":目标库位{canNotIn.Join(",")}的浅库位库位状态异常,无法入库");
_logger.Info($"目标库位{canNotIn.Join(",")}的浅库位库位状态异常,无法入库");
continue;
break;
}
}
}
if (wmsBaseLocation == null)
{ // 找深库位有库存的库位对应的浅库位
var stockLocations = wmsBaseLocations.Where(x => !string.IsNullOrEmpty(x.containerCode) && x.locDeep == 1).ToList();
foreach (var item in stockLocations)
{
wmsBaseLocation = wmsBaseLocations.Where(t => string.IsNullOrEmpty(t.containerCode) && t.locationStatus == "1")
.Where(t => t.locDeep == 2 && t.locColumn == item.locColumn)
.Where(t => t.locRow == (item.locRow % 2 == 0 ? (item.locRow - 1) : (item.locRow + 1)))
.FirstOrDefault();
if (wmsBaseLocation != null)
{
break;
}
}
}
if (wmsBaseLocation == null)
{ // 在所有符合条件的库位里,找一个库位,优先深库位,但是如果是深库位,需要判断浅库位状态是否正常
var searchLocations = wmsBaseLocations.Where(x => string.IsNullOrEmpty(x.containerCode) && x.locationStatus == "1").OrderBy(x => x.locDeep).ToList();
foreach (var item in searchLocations)
{
if (item.locDeep == 1)
{
//浅库位能否使用
var shallowLocation = wmsBaseLocations.Where(t => string.IsNullOrEmpty(t.containerCode) && t.locationStatus == "1")
.Where(t => t.locDeep == 2 && t.locColumn == item.locColumn)
.Where(t => t.locRow == (item.locRow % 2 == 0 ? (item.locRow - 1) : (item.locRow + 1)))
.FirstOrDefault();
if (shallowLocation != null)
{
wmsBaseLocation = item;
break;
}
}
else
{
wmsBaseLocation = item;
break;
}
}
}
if ( wmsBaseLocation != null)
{
dbContext.Remove(wcsTask);
WcsTask newTask = CoreMapper.Map<WcsTask>(wcsTask);
newTask.objid = StaticData.SnowId.NextId();
@ -155,6 +188,9 @@ namespace Khd.Core.Wcs.Wcs
{
Console.WriteLine(DateTime.Now + ":三楼楼接驳位调度入库任务,未找到库位");
_logger.Info("三楼接驳位调度入库任务,未找到库位");
// TODO: 没有找到库位,添加报警处理
Thread.Sleep(1000 * 5);
}
}
}

@ -1980,7 +1980,7 @@
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn
Width="180*"
Width="130*"
Binding="{Binding LocationAmount}"
CanUserSort="False"
ElementStyle="{StaticResource dgCell}"
@ -1988,7 +1988,7 @@
Header="库位数"
IsReadOnly="True" />
<DataGridTextColumn
Width="180*"
Width="200*"
Binding="{Binding InventoryingAmount}"
CanUserSort="False"
ElementStyle="{StaticResource dgCell}"
@ -2018,7 +2018,7 @@
ElementStyle="{StaticResource dgCell}"
FontSize="20"
Header="创建时间"
IsReadOnly="True" />
IsReadOnly="True" Visibility="Collapsed" />
<DataGridTextColumn
Width="220*"
Binding="{Binding BeginTime,StringFormat='{}{0:yyyy-MM-dd HH:mm:ss}'}"
@ -2043,10 +2043,14 @@
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button Content="开始盘点" Style="{StaticResource ButtonPrimary}" FontSize="25" Width="125" Height="75" Click="StartInventory" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<Button Content="开始盘点" Style="{StaticResource ButtonPrimary}" FontSize="15" Width="90" Height="55" Click="StartInventory" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<Button Content="结束盘点" Style="{StaticResource ButtonPrimary}" Margin="5 0 0 0" FontSize="15" Width="90" Height="55" Click="StartInventory" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<Button Content="详情" Style="{StaticResource ButtonPrimary}" Margin="5 0 0 0" FontSize="15" Width="90" Height="55" Click="OpenInventoryDetails" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
<DataGrid.CellStyle>

@ -1537,9 +1537,26 @@ namespace Khd.Core.Wpf.Form
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
private async void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
// 获取当前选中的TabItem
var selectedTabItem = TabControl.SelectedItem as TabItem;
if (selectedTabItem != null && selectedTabItem.Name == "TaskManager")
{ //任务界面
GetTask();
}
else if (selectedTabItem != null && selectedTabItem.Name == "CallPersonManager")
{ //人工叫料界面
CallSelectedItem.Clear();
await GetPersonCallMaterialData();
}
else if (selectedTabItem != null && selectedTabItem.Name == "InventoryManager")
{ //盘库界面
GetInvertoryData();
}
}
/// <summary>
/// 添加任务
@ -2854,65 +2871,105 @@ namespace Khd.Core.Wpf.Form
using var scope = _host.Services.CreateScope();
using var dbContext = scope.ServiceProvider.GetRequiredService<DefaultDbContext>();
var InventoryCheck = dbContext.WmsInventoryCheck
.Where(t => t.CheckStatus == "0" || t.CheckStatus == "1")
.Where(t => t.InventoryCheckId == inventoryCheckId).FirstOrDefault();
if (InventoryCheck == null || InventoryCheck.CheckStatus == "2")
{
MessageBox.Show("盘点单不存在或已盘点");
return;
}
BaseEquip agvEquip = SystemData.BaseEquip.First(t => t.objid == 11);
BaseEquip lineEquip = SystemData.BaseEquip.First(t => t.objid == 20);
if (InventoryCheck != null)
if (InventoryCheck.InventoryingAmount != 0)
{
if (InventoryCheck.InventoryingAmount != 0)
bool hasTask = dbContext.WcsTask.Where(t => t.taskType == 100).Any();
if (!hasTask)
{
bool hasTask = dbContext.WcsTask.Where(t => t.taskType == 100).Any();
hasTask = dbContext.WcsTaskManual.Where(t => t.taskType == 100).Any();
if (!hasTask)
{
hasTask = dbContext.WcsTaskManual.Where(t => t.taskType == 100).Any();
if (!hasTask)
{
InventoryCheck.InventoriedAmount += InventoryCheck.InventoryingAmount;
InventoryCheck.InventoryingAmount = 0;
}
InventoryCheck.InventoriedAmount += InventoryCheck.InventoryingAmount;
InventoryCheck.InventoryingAmount = 0;
}
}
if (InventoryCheck.InventoryingAmount == 0)
}
if (InventoryCheck.InventoryingAmount == 0)
{
bool hasTask = dbContext.WcsTask.Where(t => t.taskType == 100).Any();
if (!hasTask)
{
bool hasTask = dbContext.WcsTask.Where(t => t.taskType == 100).Any();
hasTask = dbContext.WcsTaskManual.Where(t => t.taskType == 100).Any();
if (!hasTask)
{
hasTask = dbContext.WcsTaskManual.Where(t => t.taskType == 100).Any();
if (!hasTask)
if (InventoryCheck.MaterialId != null)
{
// 盘点某个型号的物料库存的库位
// List<string> locationCodeList = dbContext.WmsRawStock.Where(t => t.warehouseId == 512 && t.materialId == InventoryCheck.MaterialId).Select(x=>x.locationCode).ToList();
}
var wmsBaseLocations = dbContext.WmsBaseLocation
.Where(t => t.ContainerStatus == "1")
.Where(t => t.locationStatus == "1")
.OrderBy(t => t.locRow)
.ThenBy(t => t.locColumn)
.ToList();
var wmsInventoryCheckDetails = dbContext.WmsInventoryCheckDetail
.Where(t => t.InventoryCheckId == InventoryCheck.InventoryCheckId).ToList();
List<string> locationCodes = wmsInventoryCheckDetails.Select(t => t.LocationCode).Distinct().ToList();
wmsBaseLocations.RemoveAll(t => locationCodes.Contains(t.locationCode));
if (wmsBaseLocations.Count > 0)
{
var wmsBaseLocations = dbContext.WmsBaseLocation
.Where(t => t.ContainerStatus == "1")
.Where(t => t.locationStatus == "1")
.OrderBy(t => t.locRow)
.ThenBy(t => t.locColumn)
.ToList();
var wmsInventoryCheckDetails = dbContext.WmsInventoryCheckDetail
.Where(t => t.InventoryCheckId == InventoryCheck.InventoryCheckId).ToList();
List<string> locationCodes = wmsInventoryCheckDetails.Select(t => t.LocationCode).Distinct().ToList();
wmsBaseLocations.RemoveAll(t => locationCodes.Contains(t.locationCode));
if (wmsBaseLocations.Count > 0)
List<string> locations = wmsBaseLocations.Select(t => t.locationCode).ToList();
List<WmsRawStock> wmsRawStocks = dbContext.WmsRawStock.Where(t => t.warehouseId == 512).ToList();
var wmsRawStock = wmsRawStocks
.Where(t => locations.Contains(t.locationCode)).ToList();
List<string> codes = wmsRawStock.Select(t => t.locationCode).Distinct().ToList();
var bill = from a in wmsBaseLocations
from b in codes
where a.locationCode == b
select new { a };
var outLocation = bill.OrderBy(t => t.a.locRow).ThenBy(t => t.a.locColumn).Take(6);
List<WcsTaskManual> addList = new List<WcsTaskManual>();
foreach (var item in outLocation)
{
List<string> locations = wmsBaseLocations.Select(t => t.locationCode).ToList();
List<WmsRawStock> wmsRawStocks = dbContext.WmsRawStock.Where(t => t.warehouseId == 512).ToList();
var wmsRawStock = wmsRawStocks
.Where(t => locations.Contains(t.locationCode)).ToList();
List<string> codes = wmsRawStock.Select(t => t.locationCode).Distinct().ToList();
var bill = from a in wmsBaseLocations
from b in codes
where a.locationCode == b
select new { a };
var outLocation = bill.OrderBy(t => t.a.locRow).ThenBy(t => t.a.locColumn).Take(6);
List<WcsTaskManual> addList = new List<WcsTaskManual>();
foreach (var item in outLocation)
WmsBaseLocation startBaseLocation = item.a;
startBaseLocation.locationStatus = "6";
startBaseLocation.ContainerStatus = "2";
addList.Add(new WcsTaskManual()
{
objid = Global.SnowId.NextId(),
taskType = 100,
containerNo = startBaseLocation.containerCode,
currPointId = startBaseLocation.locationId,
currPointNo = startBaseLocation.locationCode,
nextPointId = agvEquip.objid,
nextPointNo = agvEquip.equipNo,
endPointId = lineEquip.objid,
endPointNo = lineEquip.equipNo,
createTime = DateTime.Now,
ud1 = startBaseLocation.locColumn,
taskStatus = 0,
remark = "CTU盘点任务",
floorNo = 5,
fromFloorNo = 5,
useFlag = 1
});
dbContext.Update(startBaseLocation);
}
for (int i = addList.Count + 1; i <= 6; i++)
{
List<long?> list = addList.Select(t => t.currPointId).ToList();
WmsBaseLocation? startBaseLocation = wmsBaseLocations.Where(t => !list.Contains(t.locationId)).FirstOrDefault();
if (startBaseLocation != null)
{
WmsBaseLocation startBaseLocation = item.a;
startBaseLocation.locationStatus = "6";
startBaseLocation.ContainerStatus = "2";
addList.Add(new WcsTaskManual()
{
objid = Global.SnowId.NextId(),
taskType = 100,
orderId = InventoryCheck.InventoryCheckId,
containerNo = startBaseLocation.containerCode,
currPointId = startBaseLocation.locationId,
currPointNo = startBaseLocation.locationCode,
@ -2926,85 +2983,50 @@ namespace Khd.Core.Wpf.Form
remark = "CTU盘点任务",
floorNo = 5,
fromFloorNo = 5,
useFlag = 1
useFlag = 1,
});
dbContext.Update(startBaseLocation);
}
for (int i = addList.Count + 1; i <= 6; i++)
{
List<long?> list = addList.Select(t => t.currPointId).ToList();
WmsBaseLocation? startBaseLocation = wmsBaseLocations.Where(t => !list.Contains(t.locationId)).FirstOrDefault();
if (startBaseLocation != null)
{
startBaseLocation.locationStatus = "6";
startBaseLocation.ContainerStatus = "2";
addList.Add(new WcsTaskManual()
{
objid = Global.SnowId.NextId(),
taskType = 100,
orderId = InventoryCheck.InventoryCheckId,
containerNo = startBaseLocation.containerCode,
currPointId = startBaseLocation.locationId,
currPointNo = startBaseLocation.locationCode,
nextPointId = agvEquip.objid,
nextPointNo = agvEquip.equipNo,
endPointId = lineEquip.objid,
endPointNo = lineEquip.equipNo,
createTime = DateTime.Now,
ud1 = startBaseLocation.locColumn,
taskStatus = 0,
remark = "CTU盘点任务",
floorNo = 5,
fromFloorNo = 5,
useFlag = 1,
});
dbContext.Update(startBaseLocation);
}
}
List<WmsInventoryCheckDetail> addCheckDetail = new List<WmsInventoryCheckDetail>();
foreach (var item in addList)
{
List<WmsRawStock> itemList = wmsRawStocks.Where(t => t.locationCode == item.currPointNo).ToList();
foreach (var rawItem in itemList)
{
addCheckDetail.Add(new WmsInventoryCheckDetail
{
InventoryCheckDetailId = Global.SnowId.NextId(),
InventoryCheckId = inventoryCheckId,
CheckStatus = "1",
CreateBy = "WCS",
CreateTime = DateTime.Now,
StockAmount = rawItem.totalAmount,
RealAmount = rawItem.totalAmount,
InventoryCount = 0,
LocationCode = rawItem.locationCode,
StockId = 1,
StockType = "1",
MaterialId = rawItem.materialId,
ErpStatus = "0",
ErpAmount = 0,
});
}
}
InventoryCheck.InventoryingAmount += addList.Count;
if (InventoryCheck.BeginTime == null)
{
InventoryCheck.BeginTime = DateTime.Now;
InventoryCheck.CheckStatus = "1";
}
dbContext.AddRange(addCheckDetail);
dbContext.AddRange(addList);
dbContext.SaveChanges();
HandyControl.Controls.MessageBox.Show("任务创建成功!");
}
else
List<WmsInventoryCheckDetail> addCheckDetail = new List<WmsInventoryCheckDetail>();
foreach (var item in addList)
{
HandyControl.Controls.MessageBox.Error("无可盘点库位!");
List<WmsRawStock> itemList = wmsRawStocks.Where(t => t.locationCode == item.currPointNo).ToList();
foreach (var rawItem in itemList)
{
addCheckDetail.Add(new WmsInventoryCheckDetail
{
InventoryCheckDetailId = Global.SnowId.NextId(),
InventoryCheckId = inventoryCheckId,
CheckStatus = "1",
CreateBy = "WCS",
CreateTime = DateTime.Now,
StockAmount = rawItem.totalAmount,
RealAmount = rawItem.totalAmount,
InventoryCount = 0,
LocationCode = rawItem.locationCode,
StockId = 1,
StockType = "1",
MaterialId = rawItem.materialId,
ErpStatus = "0",
ErpAmount = 0,
});
}
}
InventoryCheck.InventoryingAmount += addList.Count;
if (InventoryCheck.BeginTime == null)
{
InventoryCheck.BeginTime = DateTime.Now;
InventoryCheck.CheckStatus = "1";
}
dbContext.AddRange(addCheckDetail);
dbContext.AddRange(addList);
dbContext.SaveChanges();
HandyControl.Controls.MessageBox.Show("任务创建成功!");
}
else
{
HandyControl.Controls.MessageBox.Info("当前有盘点任务正在出库");
HandyControl.Controls.MessageBox.Error("无可盘点库位!");
}
}
else
@ -3014,16 +3036,30 @@ namespace Khd.Core.Wpf.Form
}
else
{
HandyControl.Controls.MessageBox.Info("盘点中,请等待本次盘点完成!");
HandyControl.Controls.MessageBox.Info("当前有盘点任务正在出库");
}
}
else
{
HandyControl.Controls.MessageBox.Error("当前盘点点不可用!");
HandyControl.Controls.MessageBox.Info("盘点中,请等待本次盘点完成!");
}
GetInvertoryData();
}
/// <summary>
/// 查看盘点详情界面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OpenInventoryDetails(object sender, RoutedEventArgs e)
{
dynamic wmsInventoryCheck = this.InventoryMaterial.SelectedItem;
long inventoryCheckId = wmsInventoryCheck.InventoryCheckId;
InventoryDetails inventoryDetails = new InventoryDetails(_host, inventoryCheckId);
inventoryDetails.ShowDialog();
}
/// <summary>
/// 叫空料箱
/// </summary>
@ -4250,7 +4286,7 @@ namespace Khd.Core.Wpf.Form
var Orders = dbContext.WmsInventoryCheck.Where(t => t.CheckStatus == "0" || t.CheckStatus == "1").ToList();
if (Orders != null && Orders.Count > 0)
{
MessageBoxResult messageBoxResult = HandyControl.Controls.MessageBox.Show("已经有盘库任务是否重新开始一个盘库任务?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Question);
MessageBoxResult messageBoxResult = HandyControl.Controls.MessageBox.Show("已经有盘库任务是否继续创建新盘库任务?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Question);
if (messageBoxResult == MessageBoxResult.OK)
{
Orders.ForEach(t =>

@ -0,0 +1,117 @@
<Window x:Class="Khd.Core.Wpf.TaskForm.InventoryDetails"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Khd.Core.Wpf.TaskForm"
mc:Ignorable="d"
xmlns:hc="https://handyorg.github.io/handycontrol"
Background="#213269"
Loaded="Window_Loaded"
WindowStartupLocation="CenterScreen"
Height="900" Width="1700">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!--<hc:ThemeResources/>
<hc:Theme/>-->
<ResourceDictionary Source="/CSS/SearchBtnClass.xaml" />
<ResourceDictionary Source="/CSS/SearchTextClass.xaml" />
<ResourceDictionary Source="/CSS/DataGridClass.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style x:Key="dgCell" TargetType="TextBlock" BasedOn="{x:Null}">
<Setter Property="TextAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
</ResourceDictionary>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--<StackPanel Orientation="Horizontal" Margin="5">
<TextBlock Text="请选择容器编号:" FontSize="30" Foreground="White" VerticalAlignment="Center"/>
<ComboBox x:Name="ContainerCodeBox" IsEditable="True" DisplayMemberPath="containerNo" Style="{StaticResource ComboBoxExtend}" Width="300" hc:InfoElement.Placeholder="容器编码" hc:InfoElement.TitlePlacement="Left" hc:InfoElement.Necessary="True" FontSize="30" />
<Button x:Name="SearchBtn" Content="搜索" FontSize="30" Height="50" Foreground="White" Width="100" Background="#2196F3" Margin="10,0,0,0" Click="SearchBtn_Click"/>
<Button Content="编辑" FontSize="30" Height="50" Foreground="White" Width="100" Background="#2196F3" Margin="10,0,0,0" Click="EditBtn_Click"/>
</StackPanel>-->
<DataGrid
Style="{StaticResource DataGridStyle}"
Grid.Row="1"
x:Name="InventoryDetailsDataGrid"
AlternationCount="2"
AutoGenerateColumns="False"
MinRowHeight="50"
Background="Transparent"
CanUserAddRows="False"
GridLinesVisibility="None"
CanUserReorderColumns="False"
CanUserResizeColumns="False"
CanUserResizeRows="False"
Focusable="False"
HeadersVisibility="Column"
IsReadOnly="True"
VerticalAlignment="Stretch"
RowHeaderWidth="0"
SelectionMode="Single" FontSize="16"
Visibility="Visible"
>
<DataGrid.Columns>
<DataGridTextColumn Header="序号" Binding="{Binding Id}" ElementStyle="{StaticResource dgCell}" Width="50*"/>
<DataGridTextColumn Header="库位号" Binding="{Binding LocationCode}" ElementStyle="{StaticResource dgCell}" Width="200*"/>
<!--<DataGridTextColumn Header="料箱号" Binding="{Binding ContainerNo}" ElementStyle="{StaticResource dgCell}" Width="200*"/>-->
<DataGridTextColumn Header="物料编码" Binding="{Binding MaterialId}" ElementStyle="{StaticResource dgCell}" Width="120*"/>
<DataGridTemplateColumn
Width="300*"
CanUserSort="False"
Header="物料描述"
IsReadOnly="True" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock TextWrapping="Wrap" Text="{Binding MaterialName}" ToolTip="{Binding MaterialName}" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="20" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="库存数量" Binding="{Binding StockAmount}" ElementStyle="{StaticResource dgCell}" Width="120*"/>
<DataGridTextColumn Header="实际数量" Binding="{Binding RealAmount}" ElementStyle="{StaticResource dgCell}" Width="120*"/>
<DataGridTextColumn Header="盘库时间" Binding="{Binding UpdateDate,StringFormat=\{0:yyyy-MM-dd HH:mm:ss\}}" ElementStyle="{StaticResource dgCell}" Width="140*"/>
</DataGrid.Columns>
<DataGrid.CellStyle>
<Style TargetType="{x:Type DataGridCell}">
<Setter Property="Foreground" Value="White" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="Background" Value="#213269" />
</Style>
</DataGrid.CellStyle>
<DataGrid.RowStyle>
<Style TargetType="{x:Type DataGridRow}">
<Setter Property="Foreground" Value="White" />
<Setter Property="Background" Value="#213269" />
</Style>
</DataGrid.RowStyle>
<DataGrid.RowHeaderStyle>
<Style TargetType="{x:Type DataGridRowHeader}">
<Setter Property="Foreground" Value="White" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="Background" Value="#213269" />
</Style>
</DataGrid.RowHeaderStyle>
<DataGrid.ColumnHeaderStyle>
<Style TargetType="{x:Type DataGridColumnHeader}">
<Setter Property="Foreground" Value="White" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="Background" Value="#213269" />
<Setter Property="Margin" Value="0,0,0,0" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="BorderBrush" Value="White" />
<Setter Property="FontSize" Value="20" />
</Style>
</DataGrid.ColumnHeaderStyle>
</DataGrid>
</Grid>
</Window>

@ -0,0 +1,85 @@
using Khd.Core.Domain.Models;
using Khd.Core.EntityFramework;
using Khd.Core.Wpf.TaskForm.Inventory;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Media3D;
namespace Khd.Core.Wpf.TaskForm
{
/// <summary>
/// InventoryTaskForm.xaml 的交互逻辑
/// </summary>
public partial class InventoryDetails : Window
{
private readonly IHost _host;
private readonly long inventoryCheckId = 0;
public InventoryDetails(IHost host,long id)
{
InitializeComponent();
_host = host;
inventoryCheckId = id;
}
//在载入行的时候在行表头添加编号
private void dgvMH_LoadingRow(object sender, DataGridRowEventArgs e)
{
e.Row.Header = (e.Row.GetIndex() + 1).ToString();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
try
{
GetData();
}
catch
{
Console.WriteLine("InventoryDetails-Window_Loaded加载失败");
}
}
private void GetData()
{
int amount = 0;
if (inventoryCheckId == 0) return;
using var scope = _host.Services.CreateScope();
var dbContext = scope.ServiceProvider.GetRequiredService<DefaultDbContext>();
List<WmsInventoryCheckDetail> wmsInventoryCheckDetails = dbContext.WmsInventoryCheckDetail
.Where(t => t.InventoryCheckId == inventoryCheckId)
.ToList();
List<long?> list = wmsInventoryCheckDetails.Select(t => t.MaterialId).Distinct().ToList();
List<MesBaseMaterialInfo> mesBaseMaterialInfos = dbContext.MesBaseMaterialInfo.Where(t => list.Contains(t.MaterialId)).ToList();
this.InventoryDetailsDataGrid.ItemsSource = wmsInventoryCheckDetails.Select(t =>
new
{
Id = ++amount,
LocationCode = t.LocationCode,
MaterialId = t.MaterialId,
MaterialName = mesBaseMaterialInfos.FirstOrDefault(m => m.MaterialId == t.MaterialId)?.MaterialSpec,
StockAmount = t.StockAmount,
RealAmount = t.RealAmount,
UpdateDate = t.UpdateTime,
});
this.InventoryDetailsDataGrid.Items.Refresh();
}
private void SearchBtn_Click(object sender, RoutedEventArgs e)
{
GetData();
}
}
}
Loading…
Cancel
Save