|
|
|
@ -29,29 +29,29 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public void StartPoint()
|
|
|
|
public void StartPoint()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var createBearAgvReturnThread = new Thread(CreateBearAgvReturnLogic);
|
|
|
|
//var createBearAgvReturnThread = new Thread(CreateBearAgvReturnLogic);
|
|
|
|
createBearAgvReturnThread.Start();
|
|
|
|
//createBearAgvReturnThread.Start();
|
|
|
|
|
|
|
|
|
|
|
|
var createFiveProductInTaskThread = new Thread(CreateFiveProductInTaskLogic);
|
|
|
|
//var createFiveProductInTaskThread = new Thread(CreateFiveProductInTaskLogic);
|
|
|
|
createFiveProductInTaskThread.Start();
|
|
|
|
//createFiveProductInTaskThread.Start();
|
|
|
|
|
|
|
|
|
|
|
|
var createFiveProductTaskThread = new Thread(CreateFiveProductTaskLogic);
|
|
|
|
//var createFiveProductTaskThread = new Thread(CreateFiveProductTaskLogic);
|
|
|
|
createFiveProductTaskThread.Start();
|
|
|
|
//createFiveProductTaskThread.Start();
|
|
|
|
|
|
|
|
|
|
|
|
var createRawTaskThread = new Thread(CreateRawTaskLogic);
|
|
|
|
//var createRawTaskThread = new Thread(CreateRawTaskLogic);
|
|
|
|
createRawTaskThread.Start();
|
|
|
|
//createRawTaskThread.Start();
|
|
|
|
|
|
|
|
|
|
|
|
var createRawInThread = new Thread(CreateRawInTaskLogic);
|
|
|
|
//var createRawInThread = new Thread(CreateRawInTaskLogic);
|
|
|
|
createRawInThread.Start();
|
|
|
|
//createRawInThread.Start();
|
|
|
|
|
|
|
|
|
|
|
|
//var createThirdOutTaskThread = new Thread(CreateThirdOutTaskLogic);
|
|
|
|
var createThirdOutTaskThread = new Thread(CreateThirdOutTaskLogic);
|
|
|
|
//createThirdOutTaskThread.Start();
|
|
|
|
createThirdOutTaskThread.Start();
|
|
|
|
|
|
|
|
|
|
|
|
//var CreateSecondProductTaskThread = new Thread(CreateSecondProductTaskLogic);
|
|
|
|
var CreateSecondProductTaskThread = new Thread(CreateSecondProductTaskLogic);
|
|
|
|
//CreateSecondProductTaskThread.Start();
|
|
|
|
CreateSecondProductTaskThread.Start();
|
|
|
|
|
|
|
|
|
|
|
|
//var createEmptyTrayThread = new Thread(CreateEmptyTrayLogic);
|
|
|
|
var createEmptyTrayThread = new Thread(CreateEmptyTrayLogic);
|
|
|
|
//createEmptyTrayThread.Start();
|
|
|
|
createEmptyTrayThread.Start();
|
|
|
|
|
|
|
|
|
|
|
|
//var createThirdWasterTaskThread = new Thread(CreateThirdWasterTaskLogic);
|
|
|
|
//var createThirdWasterTaskThread = new Thread(CreateThirdWasterTaskLogic);
|
|
|
|
//createThirdWasterTaskThread.Start();
|
|
|
|
//createThirdWasterTaskThread.Start();
|
|
|
|
@ -371,7 +371,9 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
.Where(t => t.instockFlag == "0")
|
|
|
|
.Where(t => t.instockFlag == "0")
|
|
|
|
.Where(t => t.outstockFlag == "0")
|
|
|
|
.Where(t => t.outstockFlag == "0")
|
|
|
|
.Where(t => t.locationStatus == "1")
|
|
|
|
.Where(t => t.locationStatus == "1")
|
|
|
|
.Where(t => t.containerCode == null || t.containerCode == "").FirstOrDefault();
|
|
|
|
.Where(t => t.containerCode == null)
|
|
|
|
|
|
|
|
.OrderByDescending(t => t.locColumn)
|
|
|
|
|
|
|
|
.FirstOrDefault();
|
|
|
|
if (wmsBaseLocation != null)
|
|
|
|
if (wmsBaseLocation != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var wcsTask = new WcsTask()
|
|
|
|
var wcsTask = new WcsTask()
|
|
|
|
@ -379,10 +381,10 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
objid = StaticData.SnowId.NextId(),
|
|
|
|
objid = StaticData.SnowId.NextId(),
|
|
|
|
serialNo = SystemData.GetSerialNo(dbContext),
|
|
|
|
serialNo = SystemData.GetSerialNo(dbContext),
|
|
|
|
taskType = 34,
|
|
|
|
taskType = 34,
|
|
|
|
endPointId = endEquip.objid,
|
|
|
|
endPointId = wmsBaseLocation.locationId,
|
|
|
|
endPointNo = endEquip.equipNo,
|
|
|
|
endPointNo = wmsBaseLocation.locationCode,
|
|
|
|
currPointId = wmsBaseLocation.locationId,
|
|
|
|
currPointId = endEquip.objid,
|
|
|
|
currPointNo = wmsBaseLocation.locationCode,
|
|
|
|
currPointNo = endEquip.equipNo,
|
|
|
|
equipmentNo = agvEquip.equipNo,
|
|
|
|
equipmentNo = agvEquip.equipNo,
|
|
|
|
useFlag = 1,
|
|
|
|
useFlag = 1,
|
|
|
|
qty = 1,
|
|
|
|
qty = 1,
|
|
|
|
@ -420,7 +422,6 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
wmsProductInstock.executeStatus = "1";
|
|
|
|
wmsProductInstock.executeStatus = "1";
|
|
|
|
wmsBaseLocation.instockFlag = "1";
|
|
|
|
wmsBaseLocation.instockFlag = "1";
|
|
|
|
wmsBaseLocation.locationStatus = "4";
|
|
|
|
wmsBaseLocation.locationStatus = "4";
|
|
|
|
wmsProductInstock.instockAmount += 1;
|
|
|
|
|
|
|
|
dbContext.Add(wmsProductInstockDetail);
|
|
|
|
dbContext.Add(wmsProductInstockDetail);
|
|
|
|
dbContext.Update(wmsProductInstock);
|
|
|
|
dbContext.Update(wmsProductInstock);
|
|
|
|
dbContext.Update(wmsBaseLocation);
|
|
|
|
dbContext.Update(wmsBaseLocation);
|
|
|
|
@ -457,6 +458,9 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
dbContext.ChangeTracker.Entries().ToList().ForEach(e => e.Reload());
|
|
|
|
dbContext.ChangeTracker.Entries().ToList().ForEach(e => e.Reload());
|
|
|
|
bool task = dbContext.WcsTask.Where(t => t.nextPointId == 9 && t.taskStatus <= 5).Any();
|
|
|
|
bool task = dbContext.WcsTask.Where(t => t.nextPointId == 9 && t.taskStatus <= 5).Any();
|
|
|
|
if (!task)
|
|
|
|
if (!task)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
endEquip = dbContext.BaseEquip.First(t => t.objid == 31);
|
|
|
|
|
|
|
|
if (endEquip.emptyCount == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
WcsTask? wcsTask = dbContext.WcsTask.FirstOrDefault(t => t.endPointId == endEquip.objid);
|
|
|
|
WcsTask? wcsTask = dbContext.WcsTask.FirstOrDefault(t => t.endPointId == endEquip.objid);
|
|
|
|
if (wcsTask == null)
|
|
|
|
if (wcsTask == null)
|
|
|
|
@ -468,7 +472,7 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
if (wmsRawOutstock != null)
|
|
|
|
if (wmsRawOutstock != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var wmsRawStocks = dbContext.WmsRawStock
|
|
|
|
var wmsRawStocks = dbContext.WmsRawStock
|
|
|
|
.Where(t => t.materialId == wmsRawOutstock.materialId)
|
|
|
|
.Where(t => t.saleOrderId == wmsRawOutstock.saleOrderId)
|
|
|
|
.Where(t => t.warehouseId == 311)
|
|
|
|
.Where(t => t.warehouseId == 311)
|
|
|
|
.ToList();
|
|
|
|
.ToList();
|
|
|
|
var wmsBaseLocations = dbContext.WmsBaseLocation
|
|
|
|
var wmsBaseLocations = dbContext.WmsBaseLocation
|
|
|
|
@ -484,6 +488,7 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
where a.locationCode == b.locationCode
|
|
|
|
where a.locationCode == b.locationCode
|
|
|
|
select new { a, b };
|
|
|
|
select new { a, b };
|
|
|
|
WmsBaseLocation? wmsBaseLocation = null;
|
|
|
|
WmsBaseLocation? wmsBaseLocation = null;
|
|
|
|
|
|
|
|
WmsRawStock? wmsRawStock = null;
|
|
|
|
bill = bill.OrderBy(t => t.b.instockDate);
|
|
|
|
bill = bill.OrderBy(t => t.b.instockDate);
|
|
|
|
var fistbill = bill.FirstOrDefault();
|
|
|
|
var fistbill = bill.FirstOrDefault();
|
|
|
|
if (fistbill != null)
|
|
|
|
if (fistbill != null)
|
|
|
|
@ -500,17 +505,13 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
var lastbill = bill.Where(t => t.a.locRow == locRow)
|
|
|
|
var lastbill = bill.Where(t => t.a.locRow == locRow)
|
|
|
|
.Where(t => t.a.locColumn == fistbill.a.locColumn)
|
|
|
|
.Where(t => t.a.locColumn == fistbill.a.locColumn)
|
|
|
|
.Where(t => t.a.locDeep == 2)
|
|
|
|
.Where(t => t.a.locDeep == 2)
|
|
|
|
.Where(t => t.b.materialId == wmsRawOutstock.materialId)
|
|
|
|
|
|
|
|
.FirstOrDefault();
|
|
|
|
.FirstOrDefault();
|
|
|
|
|
|
|
|
wmsBaseLocation = fistbill.a;
|
|
|
|
if (lastbill != null)
|
|
|
|
if (lastbill != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (lastbill.b.instockDate != null && fistbill.b.instockDate != null)
|
|
|
|
if (lastbill.b.instockDate != null && fistbill.b.instockDate != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
wmsBaseLocation = fistbill.a;
|
|
|
|
|
|
|
|
if (lastbill.b.instockDate.Value.Date == fistbill.b.instockDate.Value.Date)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
wmsBaseLocation = lastbill.a;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (wmsBaseLocation.locDeep == 1)
|
|
|
|
if (wmsBaseLocation.locDeep == 1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int? row = 0;
|
|
|
|
int? row = 0;
|
|
|
|
@ -529,6 +530,7 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
{
|
|
|
|
{
|
|
|
|
WmsBaseLocation? toLocation = dbContext.WmsBaseLocation.Where(t => t.warehouseId == wmsBaseLocation.warehouseId)
|
|
|
|
WmsBaseLocation? toLocation = dbContext.WmsBaseLocation.Where(t => t.warehouseId == wmsBaseLocation.warehouseId)
|
|
|
|
.Where(t => t.locDeep == 1)
|
|
|
|
.Where(t => t.locDeep == 1)
|
|
|
|
|
|
|
|
|
|
|
|
.Where(t => string.IsNullOrEmpty(t.containerCode)).FirstOrDefault();
|
|
|
|
.Where(t => string.IsNullOrEmpty(t.containerCode)).FirstOrDefault();
|
|
|
|
toLocation ??= dbContext.WmsBaseLocation.Where(t => t.warehouseId == wmsBaseLocation.warehouseId)
|
|
|
|
toLocation ??= dbContext.WmsBaseLocation.Where(t => t.warehouseId == wmsBaseLocation.warehouseId)
|
|
|
|
.Where(t => t.warehouseId != wmsBaseLocation.locationId)
|
|
|
|
.Where(t => t.warehouseId != wmsBaseLocation.locationId)
|
|
|
|
@ -540,7 +542,7 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
{
|
|
|
|
{
|
|
|
|
objid = StaticData.SnowId.NextId(),
|
|
|
|
objid = StaticData.SnowId.NextId(),
|
|
|
|
taskType = 67,
|
|
|
|
taskType = 67,
|
|
|
|
containerNo = wmsBaseLocation.containerCode,
|
|
|
|
containerNo = fromBaseLocation.containerCode,
|
|
|
|
createBy = "WCS",
|
|
|
|
createBy = "WCS",
|
|
|
|
createTime = DateTime.Now.AddSeconds(-10),
|
|
|
|
createTime = DateTime.Now.AddSeconds(-10),
|
|
|
|
taskStatus = 0,
|
|
|
|
taskStatus = 0,
|
|
|
|
@ -574,7 +576,8 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (wmsBaseLocation != null)
|
|
|
|
if (wmsBaseLocation != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MesBasePalletInfo? mesBasePalletInfo = dbContext.MesBasePalletInfo.FirstOrDefault(t => t.palletInfoCode == wmsBaseLocation.containerCode);
|
|
|
|
wmsRawStock = wmsRawStocks.Where(t => t.locationCode == wmsBaseLocation.locationCode).First();
|
|
|
|
|
|
|
|
MesBasePalletInfo? mesBasePalletInfo = dbContext.MesBasePalletInfo.FirstOrDefault(t => t.palletInfoCode == wmsRawStock.palletInfoCode);
|
|
|
|
if (mesBasePalletInfo != null)
|
|
|
|
if (mesBasePalletInfo != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MesBaseBarcodeInfo? mesBaseBarcodeInfo = dbContext.MesBaseBarcodeInfo.FirstOrDefault(t => t.barcodeInfo == mesBasePalletInfo.materialBarcode);
|
|
|
|
MesBaseBarcodeInfo? mesBaseBarcodeInfo = dbContext.MesBaseBarcodeInfo.FirstOrDefault(t => t.barcodeInfo == mesBasePalletInfo.materialBarcode);
|
|
|
|
@ -623,6 +626,8 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
useFlag = 1,
|
|
|
|
useFlag = 1,
|
|
|
|
qty = 1
|
|
|
|
qty = 1
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
wmsBaseLocation.outstockFlag = "1";
|
|
|
|
|
|
|
|
wmsBaseLocation.locationStatus = "6";
|
|
|
|
dbContext.Update(wmsBaseLocation);
|
|
|
|
dbContext.Update(wmsBaseLocation);
|
|
|
|
dbContext.Add(wmsRawOutstockDetail);
|
|
|
|
dbContext.Add(wmsRawOutstockDetail);
|
|
|
|
WcsTaskLog wcsTaskLog = CoreMapper.Map<WcsTaskLog>(wcsTask);
|
|
|
|
WcsTaskLog wcsTaskLog = CoreMapper.Map<WcsTaskLog>(wcsTask);
|
|
|
|
@ -633,7 +638,7 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -670,13 +675,15 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
if (wmsRawReturn.executeStatus == "0")
|
|
|
|
if (wmsRawReturn.executeStatus == "0")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//任务未开始Status=0
|
|
|
|
//任务未开始Status=0
|
|
|
|
BaseEquip startEquip = StaticData.BaseEquip.First(t => t.equipNo == wmsRawReturn.endStationCode);
|
|
|
|
BaseEquip? startEquip = StaticData.BaseEquip.FirstOrDefault(t => t.equipNo == wmsRawReturn.endStationCode);
|
|
|
|
|
|
|
|
if (startEquip != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
WcsTask wcsTask = new()
|
|
|
|
WcsTask wcsTask = new()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
objid = StaticData.SnowId.NextId(),
|
|
|
|
objid = StaticData.SnowId.NextId(),
|
|
|
|
orderId = wmsRawReturn.rawReturnId,
|
|
|
|
orderId = wmsRawReturn.rawReturnId,
|
|
|
|
taskType = 48,
|
|
|
|
taskType = 48,
|
|
|
|
containerNo = "",
|
|
|
|
containerNo = null,
|
|
|
|
currPointId = startEquip.objid,
|
|
|
|
currPointId = startEquip.objid,
|
|
|
|
currPointNo = startEquip.equipNo,
|
|
|
|
currPointNo = startEquip.equipNo,
|
|
|
|
nextPointId = baseEquip.objid,
|
|
|
|
nextPointId = baseEquip.objid,
|
|
|
|
@ -698,7 +705,6 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
//materialNo = wmsRawReturn.materialBatch,
|
|
|
|
//materialNo = wmsRawReturn.materialBatch,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
wmsRawReturn.executeStatus = "1";
|
|
|
|
wmsRawReturn.executeStatus = "1";
|
|
|
|
wmsRawReturn.returnAmount += 1;
|
|
|
|
|
|
|
|
dbContext.Add(wcsTask);
|
|
|
|
dbContext.Add(wcsTask);
|
|
|
|
WcsTaskLog wcsTaskLog = CoreMapper.Map<WcsTaskLog>(wcsTask);
|
|
|
|
WcsTaskLog wcsTaskLog = CoreMapper.Map<WcsTaskLog>(wcsTask);
|
|
|
|
dbContext.Add(wcsTaskLog);
|
|
|
|
dbContext.Add(wcsTaskLog);
|
|
|
|
@ -707,6 +713,7 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LogManager.Error(ex);
|
|
|
|
LogManager.Error(ex);
|
|
|
|
@ -732,7 +739,7 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var proStock = dbContext.WmsProductStock
|
|
|
|
var proStock = dbContext.WmsProductStock
|
|
|
|
.Where(t => t.warehouseId == 531)
|
|
|
|
.Where(t => t.warehouseId == 531)
|
|
|
|
.Where(t => t.activeFlag == "0").ToList();
|
|
|
|
.Where(t => t.activeFlag == "1").ToList();
|
|
|
|
var proOutStock = dbContext.WmsProductOutstock
|
|
|
|
var proOutStock = dbContext.WmsProductOutstock
|
|
|
|
.Where(t => t.outstockQty < t.applyQty)
|
|
|
|
.Where(t => t.outstockQty < t.applyQty)
|
|
|
|
.Where(t => t.auditStatus == "1")
|
|
|
|
.Where(t => t.auditStatus == "1")
|
|
|
|
@ -749,7 +756,7 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
|
|
|
|
|
|
|
|
var wmsproStocks = proStock
|
|
|
|
var wmsproStocks = proStock
|
|
|
|
.Where(t => t.productId == item.productId && t.warehouseId == item.warehouseId)
|
|
|
|
.Where(t => t.productId == item.productId && t.warehouseId == item.warehouseId)
|
|
|
|
.Select(t => t.palletInfoCode)
|
|
|
|
.Select(t => t.locationCode)
|
|
|
|
.ToList();
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
|
|
|
|
var wmsBaseLocations = dbContext.WmsBaseLocation
|
|
|
|
var wmsBaseLocations = dbContext.WmsBaseLocation
|
|
|
|
@ -759,7 +766,7 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
.Where(t => t.instockFlag == "0")
|
|
|
|
.Where(t => t.instockFlag == "0")
|
|
|
|
.Where(t => t.outstockFlag == "0")
|
|
|
|
.Where(t => t.outstockFlag == "0")
|
|
|
|
.Where(t => t.warehouseId == item.warehouseId)
|
|
|
|
.Where(t => t.warehouseId == item.warehouseId)
|
|
|
|
.Where(t => wmsproStocks.Contains(t.containerCode))
|
|
|
|
.Where(t => wmsproStocks.Contains(t.locationCode))
|
|
|
|
.ToList();
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
|
|
|
|
decimal needNumber = Convert.ToDecimal(item.applyQty - item.outstockQty);
|
|
|
|
decimal needNumber = Convert.ToDecimal(item.applyQty - item.outstockQty);
|
|
|
|
@ -773,7 +780,7 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
|
|
|
|
|
|
|
|
var bill = from a in wmsBaseLocations
|
|
|
|
var bill = from a in wmsBaseLocations
|
|
|
|
from b in proStock
|
|
|
|
from b in proStock
|
|
|
|
where a.containerCode == b.palletInfoCode
|
|
|
|
where a.locationCode == b.locationCode
|
|
|
|
select new { a, b };
|
|
|
|
select new { a, b };
|
|
|
|
//如果第一列满足需求,则按第一列排序,否则按最后一列排序
|
|
|
|
//如果第一列满足需求,则按第一列排序,否则按最后一列排序
|
|
|
|
if (bill.Where(t => t.a.locColumn == 1).Select(t => t.b.totalAmount - t.b.frozenAmount).Sum() > needNumber)
|
|
|
|
if (bill.Where(t => t.a.locColumn == 1).Select(t => t.b.totalAmount - t.b.frozenAmount).Sum() > needNumber)
|
|
|
|
@ -807,7 +814,7 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
qty = Convert.ToInt32(needNumber);
|
|
|
|
qty = Convert.ToInt32(needNumber);
|
|
|
|
stock.updateDate = DateTime.Now;
|
|
|
|
stock.updateDate = DateTime.Now;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
MesBasePalletInfo? mesBasePalletInfo = dbContext.MesBasePalletInfo.FirstOrDefault(t => t.palletInfoCode == location.containerCode);
|
|
|
|
MesBasePalletInfo? mesBasePalletInfo = dbContext.MesBasePalletInfo.FirstOrDefault(t => t.palletInfoCode == stock.palletInfoCode);
|
|
|
|
if (mesBasePalletInfo != null)
|
|
|
|
if (mesBasePalletInfo != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
WmsProductOutstockDetail detail = new()
|
|
|
|
WmsProductOutstockDetail detail = new()
|
|
|
|
@ -920,13 +927,9 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
dbContext.Add(wcsTask);
|
|
|
|
dbContext.Add(wcsTask);
|
|
|
|
dbContext.Update(stock);
|
|
|
|
dbContext.Update(stock);
|
|
|
|
dbContext.SaveChanges();
|
|
|
|
dbContext.SaveChanges();
|
|
|
|
if (qty >= needNumber)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (item.beginTime == null)
|
|
|
|
if (item.beginTime == null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
item.beginTime = DateTime.Now;
|
|
|
|
item.beginTime = DateTime.Now;
|
|
|
|
@ -1178,7 +1181,8 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
{
|
|
|
|
{
|
|
|
|
dbContext.ChangeTracker.Entries().ToList().ForEach(e => e.Reload());
|
|
|
|
dbContext.ChangeTracker.Entries().ToList().ForEach(e => e.Reload());
|
|
|
|
//原材料库存
|
|
|
|
//原材料库存
|
|
|
|
var rawStock = dbContext.WmsRawStock.Where(t => t.activeFlag == "1").ToList();
|
|
|
|
var rawStock = dbContext.WmsRawStock
|
|
|
|
|
|
|
|
.Where(t => t.activeFlag == "1").ToList();
|
|
|
|
//原材料出库记录
|
|
|
|
//原材料出库记录
|
|
|
|
var rawOutStock = dbContext.WmsRawOutstock
|
|
|
|
var rawOutStock = dbContext.WmsRawOutstock
|
|
|
|
.Where(t => t.executeStatus == "0" || t.executeStatus == "1")
|
|
|
|
.Where(t => t.executeStatus == "0" || t.executeStatus == "1")
|
|
|
|
@ -1215,139 +1219,142 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
{
|
|
|
|
{
|
|
|
|
lock (SystemData.outStockLock)
|
|
|
|
lock (SystemData.outStockLock)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (endEquip.equipType == 8)//CTU出库
|
|
|
|
//if (endEquip.equipType == 8)//CTU出库
|
|
|
|
{
|
|
|
|
//{
|
|
|
|
var wcsOutstockLock = dbContext.WcsOutstockLock.Where(t => t.warehouseId == 512).First();
|
|
|
|
// var wcsOutstockLock = dbContext.WcsOutstockLock.Where(t => t.warehouseId == 512).First();
|
|
|
|
if (wcsOutstockLock.qty == 0 && wcsOutstockLock.boxStatus == 0)
|
|
|
|
// if (wcsOutstockLock.qty == 0 && wcsOutstockLock.boxStatus == 0)
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
var wmsRawStocks = rawStock
|
|
|
|
// var wmsRawStocks = rawStock
|
|
|
|
.Where(t => t.materialId == item.materialId)
|
|
|
|
// .Where(t => t.materialId == item.materialId)
|
|
|
|
.Where(t => t.warehouseId == item.warehouseId)
|
|
|
|
// .Where(t => t.warehouseId == item.warehouseId)
|
|
|
|
.Select(t => t.locationCode)
|
|
|
|
// .Select(t => t.locationCode)
|
|
|
|
.ToList();
|
|
|
|
// .ToList();
|
|
|
|
|
|
|
|
|
|
|
|
var wmsBaseLocations = dbContext.WmsBaseLocation
|
|
|
|
// var wmsBaseLocations = dbContext.WmsBaseLocation
|
|
|
|
.Where(t => t.activeFlag == "1")
|
|
|
|
// .Where(t => t.activeFlag == "1")
|
|
|
|
.Where(t => t.delFlag == "0")
|
|
|
|
// .Where(t => t.delFlag == "0")
|
|
|
|
.Where(t => t.locationScrapType == "1")
|
|
|
|
// .Where(t => t.locationScrapType == "1")
|
|
|
|
.Where(t => t.instockFlag == "0")
|
|
|
|
// .Where(t => t.instockFlag == "0")
|
|
|
|
.Where(t => t.outstockFlag == "0")
|
|
|
|
// .Where(t => t.outstockFlag == "0")
|
|
|
|
.Where(t => t.ContainerStatus == "1")
|
|
|
|
// .Where(t => t.ContainerStatus == "1")
|
|
|
|
.Where(t => t.warehouseId == item.warehouseId)
|
|
|
|
// .Where(t => t.warehouseId == item.warehouseId)
|
|
|
|
.Where(t => wmsRawStocks.Contains(t.locationCode))
|
|
|
|
// .Where(t => wmsRawStocks.Contains(t.locationCode))
|
|
|
|
.ToList();
|
|
|
|
// .ToList();
|
|
|
|
|
|
|
|
|
|
|
|
decimal? needNumber = item.outstockAmount - RealOutNumber;
|
|
|
|
// decimal? needNumber = item.outstockAmount - RealOutNumber;
|
|
|
|
|
|
|
|
|
|
|
|
var bill = from a in wmsBaseLocations
|
|
|
|
// var bill = from a in wmsBaseLocations
|
|
|
|
from b in rawStock
|
|
|
|
// from b in rawStock
|
|
|
|
where a.locationCode == b.locationCode
|
|
|
|
// where a.locationCode == b.locationCode
|
|
|
|
select new { a, b };
|
|
|
|
// select new { a, b };
|
|
|
|
//如果第一列满足需求,则按第一列排序,否则按最后一列排序
|
|
|
|
// //如果第一列满足需求,则按第一列排序,否则按最后一列排序
|
|
|
|
if (bill.Where(t => t.a.locColumn == 1).Select(t => t.b.totalAmount - t.b.frozenAmount).Sum() > needNumber)
|
|
|
|
// if (bill.Where(t => t.a.locColumn == 1).Select(t => t.b.totalAmount - t.b.frozenAmount).Sum() > needNumber)
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
bill = bill.OrderBy(t => t.a.locColumn).ToList();
|
|
|
|
// bill = bill.OrderBy(t => t.a.locColumn).ToList();
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
else
|
|
|
|
// else
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
bill = bill.OrderByDescending(t => t.a.locColumn).ToList();
|
|
|
|
// bill = bill.OrderByDescending(t => t.a.locColumn).ToList();
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
//做数量限制
|
|
|
|
// //做数量限制
|
|
|
|
|
|
|
|
|
|
|
|
//bill = bill.Take(5 - dbContext.WcsCmd.Where(t => t.cmdStatus < 3 && t.nextPointId == 20).Count());
|
|
|
|
// //bill = bill.Take(5 - dbContext.WcsCmd.Where(t => t.cmdStatus < 3 && t.nextPointId == 20).Count());
|
|
|
|
bill = bill.Take(6);
|
|
|
|
// bill = bill.Take(6);
|
|
|
|
BaseEquip ctuEquip = StaticData.BaseEquip.First(t => t.objid == 11);
|
|
|
|
// BaseEquip ctuEquip = StaticData.BaseEquip.First(t => t.objid == 11);
|
|
|
|
BaseEquip lineEquip = StaticData.BaseEquip.First(t => t.objid == 20);
|
|
|
|
// BaseEquip lineEquip = StaticData.BaseEquip.First(t => t.objid == 20);
|
|
|
|
foreach (var b in bill)
|
|
|
|
// foreach (var b in bill)
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
needNumber = item.outstockAmount - RealOutNumber;
|
|
|
|
// needNumber = item.outstockAmount - RealOutNumber;
|
|
|
|
item.executeStatus = "1";
|
|
|
|
// item.executeStatus = "1";
|
|
|
|
WmsBaseLocation location = b.a;
|
|
|
|
// WmsBaseLocation location = b.a;
|
|
|
|
WmsRawStock stock = b.b;
|
|
|
|
// WmsRawStock stock = b.b;
|
|
|
|
WcsTask wcsTask;
|
|
|
|
// WcsTask wcsTask;
|
|
|
|
int qty = 0;
|
|
|
|
// int qty = 0;
|
|
|
|
if (stock.totalAmount - stock.frozenAmount <= needNumber)//该料箱全部出
|
|
|
|
// if (stock.totalAmount - stock.frozenAmount <= needNumber)//该料箱全部出
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
RealOutNumber += stock.totalAmount - stock.frozenAmount;
|
|
|
|
// RealOutNumber += stock.totalAmount - stock.frozenAmount;
|
|
|
|
qty = Convert.ToInt32(stock.totalAmount - stock.frozenAmount);
|
|
|
|
// qty = Convert.ToInt32(stock.totalAmount - stock.frozenAmount);
|
|
|
|
stock.updateDate = DateTime.Now;
|
|
|
|
// stock.updateDate = DateTime.Now;
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
else
|
|
|
|
// else
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
RealOutNumber += needNumber;
|
|
|
|
// RealOutNumber += needNumber;
|
|
|
|
qty = Convert.ToInt32(needNumber);
|
|
|
|
// qty = Convert.ToInt32(needNumber);
|
|
|
|
stock.updateDate = DateTime.Now;
|
|
|
|
// stock.updateDate = DateTime.Now;
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
wcsTask = new WcsTask()
|
|
|
|
// wcsTask = new WcsTask()
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
objid = StaticData.SnowId.NextId(),
|
|
|
|
// objid = StaticData.SnowId.NextId(),
|
|
|
|
orderId = item.rawOutstockId,
|
|
|
|
// orderId = item.rawOutstockId,
|
|
|
|
taskType = 38,
|
|
|
|
// taskType = 38,
|
|
|
|
containerNo = location.containerCode,
|
|
|
|
// containerNo = location.containerCode,
|
|
|
|
createBy = "WCS",
|
|
|
|
// createBy = "WCS",
|
|
|
|
createTime = DateTime.Now,
|
|
|
|
// createTime = DateTime.Now,
|
|
|
|
taskStatus = -1,
|
|
|
|
// taskStatus = -1,
|
|
|
|
materialId = item.materialId,
|
|
|
|
// materialId = item.materialId,
|
|
|
|
currPointId = location.locationId,
|
|
|
|
// currPointId = location.locationId,
|
|
|
|
currPointNo = location.locationCode,
|
|
|
|
// currPointNo = location.locationCode,
|
|
|
|
nextPointId = ctuEquip.objid,
|
|
|
|
// nextPointId = ctuEquip.objid,
|
|
|
|
nextPointNo = ctuEquip.equipNo,
|
|
|
|
// nextPointNo = ctuEquip.equipNo,
|
|
|
|
endPointId = lineEquip.objid,
|
|
|
|
// endPointId = lineEquip.objid,
|
|
|
|
endPointNo = lineEquip.equipNo,
|
|
|
|
// endPointNo = lineEquip.equipNo,
|
|
|
|
equipmentNo = ctuEquip.equipNo,
|
|
|
|
// equipmentNo = ctuEquip.equipNo,
|
|
|
|
ud1 = location.locColumn,
|
|
|
|
// ud1 = location.locColumn,
|
|
|
|
useFlag = 1,
|
|
|
|
// useFlag = 1,
|
|
|
|
qty = qty
|
|
|
|
// qty = qty
|
|
|
|
};
|
|
|
|
// };
|
|
|
|
MesBaseBarcodeInfo? mesBaseBarcodeInfo = dbContext.MesBaseBarcodeInfo.Where(t => t.barcodeInfo == stock.instockBatch).FirstOrDefault();
|
|
|
|
// MesBaseBarcodeInfo? mesBaseBarcodeInfo = dbContext.MesBaseBarcodeInfo.Where(t => t.barcodeInfo == stock.instockBatch).FirstOrDefault();
|
|
|
|
if (mesBaseBarcodeInfo != null)
|
|
|
|
// if (mesBaseBarcodeInfo != null)
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
WmsRawOutstockDetail wmsProductOutstockDetail = new WmsRawOutstockDetail()
|
|
|
|
// WmsRawOutstockDetail wmsProductOutstockDetail = new WmsRawOutstockDetail()
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
rawOutstockDetailId = StaticData.SnowId.NextId(),
|
|
|
|
// rawOutstockDetailId = StaticData.SnowId.NextId(),
|
|
|
|
rawOutstockId = item.rawOutstockId,
|
|
|
|
// rawOutstockId = item.rawOutstockId,
|
|
|
|
materialId = item.materialId,
|
|
|
|
// materialId = item.materialId,
|
|
|
|
createDate = DateTime.Now,
|
|
|
|
// createDate = DateTime.Now,
|
|
|
|
createBy = "WCS",
|
|
|
|
// createBy = "WCS",
|
|
|
|
taskCode = wcsTask.objid.ToString(),
|
|
|
|
// taskCode = wcsTask.objid.ToString(),
|
|
|
|
executeStatus = "1",
|
|
|
|
// executeStatus = "1",
|
|
|
|
locationCode = location.locationCode,
|
|
|
|
// locationCode = location.locationCode,
|
|
|
|
outstockAmount = qty,
|
|
|
|
// outstockAmount = qty,
|
|
|
|
planAmount = item.outstockAmount,
|
|
|
|
// planAmount = item.outstockAmount,
|
|
|
|
warehouseId = item.warehouseId,
|
|
|
|
// warehouseId = item.warehouseId,
|
|
|
|
materialBarcode = mesBaseBarcodeInfo.barcodeInfo,
|
|
|
|
// materialBarcode = mesBaseBarcodeInfo.barcodeInfo,
|
|
|
|
instockBatch = mesBaseBarcodeInfo.batchCode,
|
|
|
|
// instockBatch = mesBaseBarcodeInfo.batchCode,
|
|
|
|
stackAmount = qty,
|
|
|
|
// stackAmount = qty,
|
|
|
|
outstockPerson = "WCS",
|
|
|
|
// outstockPerson = "WCS",
|
|
|
|
outstockTime = DateTime.Now,
|
|
|
|
// outstockTime = DateTime.Now,
|
|
|
|
outstockWay = "2",
|
|
|
|
// outstockWay = "2",
|
|
|
|
materialProductionDate = mesBaseBarcodeInfo.productionDate
|
|
|
|
// materialProductionDate = mesBaseBarcodeInfo.productionDate
|
|
|
|
};
|
|
|
|
// };
|
|
|
|
location.outstockFlag = "1";
|
|
|
|
// location.outstockFlag = "1";
|
|
|
|
location.locationStatus = "6";
|
|
|
|
// location.locationStatus = "6";
|
|
|
|
location.updateBy = "WCS";
|
|
|
|
// location.updateBy = "WCS";
|
|
|
|
location.updateTime = DateTime.Now;
|
|
|
|
// location.updateTime = DateTime.Now;
|
|
|
|
wcsOutstockLock.boxStatus = 1;
|
|
|
|
// wcsOutstockLock.boxStatus = 1;
|
|
|
|
dbContext.Add(wmsProductOutstockDetail);
|
|
|
|
// dbContext.Add(wmsProductOutstockDetail);
|
|
|
|
dbContext.Update(location);
|
|
|
|
// dbContext.Update(location);
|
|
|
|
dbContext.Add(wcsTask);
|
|
|
|
// dbContext.Add(wcsTask);
|
|
|
|
dbContext.Update(stock);
|
|
|
|
// dbContext.Update(stock);
|
|
|
|
if (qty >= needNumber)
|
|
|
|
// if (qty >= needNumber)
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
break;
|
|
|
|
// break;
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
if (item.beginTime == null)
|
|
|
|
// if (item.beginTime == null)
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
item.beginTime = DateTime.Now;
|
|
|
|
// item.beginTime = DateTime.Now;
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
dbContext.Update(wcsOutstockLock);
|
|
|
|
// dbContext.Update(wcsOutstockLock);
|
|
|
|
dbContext.Update(item);
|
|
|
|
// dbContext.Update(item);
|
|
|
|
dbContext.SaveChanges();
|
|
|
|
// dbContext.SaveChanges();
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}//CTU出库
|
|
|
|
//}//CTU出库
|
|
|
|
if (endEquip.equipType == 10)//CTU出库到装配区
|
|
|
|
if (endEquip.equipType == 10)//CTU出库到装配区
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
BaseEquip endStationCodeEquip = dbContext.BaseEquip.First(t => t.objid == 10);
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(endStationCodeEquip.remark))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
bool CreateSuccess = false;
|
|
|
|
bool CreateSuccess = false;
|
|
|
|
var wcsOutstockLock = dbContext.WcsOutstockLock
|
|
|
|
var wcsOutstockLock = dbContext.WcsOutstockLock
|
|
|
|
@ -1355,9 +1362,10 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
.First();
|
|
|
|
.First();
|
|
|
|
if (wcsOutstockLock.qty == 0 && wcsOutstockLock.boxStatus == 0)
|
|
|
|
if (wcsOutstockLock.qty == 0 && wcsOutstockLock.boxStatus == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var orderList = rawOutStock.Where(t => t.endStationCode == item.endStationCode).ToList();
|
|
|
|
var orderList = rawOutStock.Where(t => t.endStationCode == endStationCodeEquip.endStationCode).ToList();
|
|
|
|
List<WcsTask> tasks = new();
|
|
|
|
List<WcsTask> tasks = new();
|
|
|
|
|
|
|
|
List<long?> canOut = orderList.Select(t => t.saleOrderId).ToList();
|
|
|
|
|
|
|
|
rawStock = rawStock.Where(t => canOut.Contains(t.saleOrderId)).OrderByDescending(t => t.saleOrderId).ToList();
|
|
|
|
//对物料和数量进行分组
|
|
|
|
//对物料和数量进行分组
|
|
|
|
var list = orderList.GroupBy(t => t.materialId).Select(t => new
|
|
|
|
var list = orderList.GroupBy(t => t.materialId).Select(t => new
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -1366,7 +1374,6 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
realOutstockAmount = t.Sum(x => x.realOutstockAmount)
|
|
|
|
realOutstockAmount = t.Sum(x => x.realOutstockAmount)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
).ToList();
|
|
|
|
).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var order in list)
|
|
|
|
foreach (var order in list)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (tasks.Count >= 6)
|
|
|
|
if (tasks.Count >= 6)
|
|
|
|
@ -1446,7 +1453,7 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
endPointNo = lineEquip.equipNo,
|
|
|
|
endPointNo = lineEquip.equipNo,
|
|
|
|
equipmentNo = ctuEquip.equipNo,
|
|
|
|
equipmentNo = ctuEquip.equipNo,
|
|
|
|
ud1 = location.locColumn,
|
|
|
|
ud1 = location.locColumn,
|
|
|
|
useFlag = 0,
|
|
|
|
useFlag = 1,
|
|
|
|
qty = qty
|
|
|
|
qty = qty
|
|
|
|
};
|
|
|
|
};
|
|
|
|
tasks.Add(wcsTask);
|
|
|
|
tasks.Add(wcsTask);
|
|
|
|
@ -1615,12 +1622,15 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
BaseEquip startStationEquip = StaticData.BaseEquip.First(t => t.objid == 21);
|
|
|
|
BaseEquip startStationEquip = StaticData.BaseEquip.First(t => t.objid == 21);
|
|
|
|
BaseEquip bearAgvEquip = StaticData.BaseEquip.First(t => t.objid == 10);
|
|
|
|
BaseEquip bearAgvEquip = StaticData.BaseEquip.First(t => t.objid == 10);
|
|
|
|
BaseEquip endStationEquip = StaticData.BaseEquip.First(t => t.equipNo == item.endStationCode);
|
|
|
|
BaseEquip endStationEquip = StaticData.BaseEquip.First(t => t.equipNo == item.endStationCode);
|
|
|
|
|
|
|
|
bool hasTask = dbContext.WcsTask.Where(t => t.taskType == 32).Any();
|
|
|
|
|
|
|
|
if (!hasTask)
|
|
|
|
|
|
|
|
{
|
|
|
|
WcsTask bearAgvTask = new()
|
|
|
|
WcsTask bearAgvTask = new()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
objid = StaticData.SnowId.NextId(),
|
|
|
|
objid = StaticData.SnowId.NextId(),
|
|
|
|
orderId = item.orderId,
|
|
|
|
orderId = item.rawOutstockId,
|
|
|
|
taskType = 32,
|
|
|
|
taskType = 32,
|
|
|
|
containerNo = "",
|
|
|
|
containerNo = null,
|
|
|
|
currPointId = startStationEquip.objid,
|
|
|
|
currPointId = startStationEquip.objid,
|
|
|
|
currPointNo = startStationEquip.equipNo,
|
|
|
|
currPointNo = startStationEquip.equipNo,
|
|
|
|
nextPointId = bearAgvEquip.objid,
|
|
|
|
nextPointId = bearAgvEquip.objid,
|
|
|
|
@ -1640,19 +1650,22 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
masterId = item.materialId,
|
|
|
|
masterId = item.materialId,
|
|
|
|
fromFloorNo = 5,
|
|
|
|
fromFloorNo = 5,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
dbContext.Add(bearAgvTask);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (item.beginTime == null)
|
|
|
|
if (item.beginTime == null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
item.beginTime = DateTime.Now;
|
|
|
|
item.beginTime = DateTime.Now;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
dbContext.UpdateRange(orderList);
|
|
|
|
dbContext.UpdateRange(orderList);
|
|
|
|
dbContext.AddRange(tasks);
|
|
|
|
dbContext.AddRange(tasks);
|
|
|
|
dbContext.Add(bearAgvTask);
|
|
|
|
|
|
|
|
dbContext.Update(item);
|
|
|
|
dbContext.Update(item);
|
|
|
|
dbContext.Update(wcsOutstockLock);
|
|
|
|
dbContext.Update(wcsOutstockLock);
|
|
|
|
dbContext.SaveChanges();
|
|
|
|
dbContext.SaveChanges();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
if (endEquip.equipType == 12 || endEquip.equipType == 13)//原材料到柜体验收区
|
|
|
|
if (endEquip.equipType == 12 || endEquip.equipType == 13)//原材料到柜体验收区
|
|
|
|
{
|
|
|
|
{
|
|
|
|
bool hasTask = dbContext.WcsTask.Where(t => t.nextPointId == 28 && t.useFlag == 1 && t.taskStatus <= 5).Any();
|
|
|
|
bool hasTask = dbContext.WcsTask.Where(t => t.nextPointId == 28 && t.useFlag == 1 && t.taskStatus <= 5).Any();
|
|
|
|
@ -1664,10 +1677,10 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
.Where(t => t.materialId == item.materialId && t.warehouseId == item.warehouseId)
|
|
|
|
.Where(t => t.materialId == item.materialId && t.warehouseId == item.warehouseId)
|
|
|
|
.WhereIf(endEquip.equipType == 13, t => t.completeFlag == "0")
|
|
|
|
.WhereIf(endEquip.equipType == 13, t => t.completeFlag == "0")
|
|
|
|
.WhereIf(endEquip.equipType == 12, t => t.completeFlag == "1")
|
|
|
|
.WhereIf(endEquip.equipType == 12, t => t.completeFlag == "1")
|
|
|
|
|
|
|
|
.Where(t => t.saleOrderId == item.saleOrderId)
|
|
|
|
.Where(t => t.totalAmount > t.frozenAmount)
|
|
|
|
.Where(t => t.totalAmount > t.frozenAmount)
|
|
|
|
.Select(t => t.palletInfoCode)
|
|
|
|
.Select(t => t.palletInfoCode)
|
|
|
|
.ToList();
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
|
|
|
|
var wmsBaseLocations = dbContext.WmsBaseLocation
|
|
|
|
var wmsBaseLocations = dbContext.WmsBaseLocation
|
|
|
|
.Where(t => t.activeFlag == "1")
|
|
|
|
.Where(t => t.activeFlag == "1")
|
|
|
|
.Where(t => t.delFlag == "0")
|
|
|
|
.Where(t => t.delFlag == "0")
|
|
|
|
|