master
1 year ago
parent 45e532edda
commit b8c83e39e1

@ -124,8 +124,9 @@ namespace Khd.Core.Wcs.Wcs
List<MesBaseBarcodeInfo> mesBasePalletInfos = dbContext.MesBaseBarcodeInfo
.Where(t => t.materialId == wcsTask.materialId)
.Where(t => t.saleOrderId == mesBaseBarcodeInfo.saleOrderId)
.Where(t => t.palletInfoCode != null)
.Where(t => containerCodes.Contains(t.palletInfoCode)).ToList();//深库位的托盘的物料等于当前任务的物料
mesBasePalletInfos.RemoveAll(t => t.palletInfoCode == null);
var bill = from a in mesBasePalletInfos
join b in wmsBaseLocations
.Where(t => t.locDeep == 1 && mesBaseBarcodeInfo.completeFlag == "0" ? t.returnFlag == "1" : t.returnFlag == "0") on a.palletInfoCode equals b.containerCode
@ -162,8 +163,9 @@ namespace Khd.Core.Wcs.Wcs
bool hasLocation = wmsBaseLocations
.Where(t => t.locRow == (wmsBaseLocation.locRow % 2 == 1 ? (wmsBaseLocation.locRow + 1) : (wmsBaseLocation.locRow - 1)))
.Where(t => t.locColumn == wmsBaseLocation.locColumn)
.Any();
if (!hasLocation)
.Where(t => !string.IsNullOrEmpty(t.containerCode) || t.locationStatus != "1")
.Any();
if (hasLocation)
{
canNotIn.Add(wmsBaseLocation.locationCode);
Console.WriteLine(DateTime.Now + $":目标库位{canNotIn.Join(",")}的浅库位库位状态异常,无法入库");

@ -255,8 +255,9 @@ namespace Khd.Core.Wcs.Wcs
List<MesBaseBarcodeInfo> mesBasePalletInfos = dbContext.MesBaseBarcodeInfo
.Where(t => t.saleOrderId == mesBaseBarcodeInfo.saleOrderId)//销售订单
.Where(t => t.materialId == mesBasePalletInfo.materialId)//物料Id
.Where(t => t.palletInfoCode != null)
.Where(t => containerCodes.Contains(t.palletInfoCode)).ToList();//深库位的托盘的物料等于当前任务的物料
mesBasePalletInfos.RemoveAll(t=>t.palletInfoCode==null);
var bill = from a in mesBasePalletInfos
join b in wmsBaseLocations.Where(t => t.locDeep == 1) on a.palletInfoCode equals b.containerCode
select new { b };//等于当前任务的物料的托盘的库位信息
@ -269,7 +270,7 @@ namespace Khd.Core.Wcs.Wcs
&& 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();//找不到再找任意库位
@ -279,8 +280,10 @@ namespace Khd.Core.Wcs.Wcs
{
var hasLocation = wmsBaseLocations
.Where(t => t.locRow == (wmsBaseLocation.locRow % 2 == 1 ? (wmsBaseLocation.locRow + 1) : (wmsBaseLocation.locRow - 1)))
.Where(t => t.locColumn == wmsBaseLocation.locColumn).Any();
if (!hasLocation)
.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(",")}的浅库位库位状态异常,无法入库");

@ -88,8 +88,9 @@ namespace Khd.Core.Wcs.Wcs
List<MesBaseBarcodeInfo> mesBasePalletInfos = dbContext.MesBaseBarcodeInfo
.Where(t => t.materialId == wcsTask.materialId)
.Where(t=>t.saleOrderId== mesBaseBarcodeInfo.saleOrderId)
.Where(t=>t.palletInfoCode!=null)
.Where(t => containerCodes.Contains(t.palletInfoCode)).ToList();//深库位的托盘的物料等于当前任务的物料
mesBasePalletInfos.RemoveAll(t => t.palletInfoCode == null);
var bill = from a in mesBasePalletInfos
join b in wmsBaseLocations.Where(t => t.locDeep == 1 && !string.IsNullOrEmpty(t.containerCode)) on a.palletInfoCode equals b.containerCode
select new { b };//等于当前任务的物料的托盘的库位信息
@ -114,8 +115,9 @@ namespace Khd.Core.Wcs.Wcs
bool hasLocation = wmsBaseLocations
.Where(t => t.locRow == (wmsBaseLocation.locRow % 2 == 1 ? (wmsBaseLocation.locRow + 1) : (wmsBaseLocation.locRow - 1)))
.Where(t => t.locColumn == wmsBaseLocation.locColumn)
.Any();
if (!hasLocation)
.Where(t=>!string.IsNullOrEmpty(t.containerCode)||t.locationStatus!="1")
.Any();
if (hasLocation)
{
canNotIn.Add(wmsBaseLocation.locationCode);
Console.WriteLine(DateTime.Now + $":目标库位{canNotIn.Join(",")}的浅库位库位状态异常,无法入库");

Loading…
Cancel
Save