|
|
|
|
@ -705,7 +705,7 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
|
warehouseFloor = 2,
|
|
|
|
|
warehouseId = wmsBaseLocation.warehouseId
|
|
|
|
|
};
|
|
|
|
|
#region 插入productStock表
|
|
|
|
|
#region 插入WmsProductInstock表
|
|
|
|
|
|
|
|
|
|
WmsProductInstock wmsProductInstock = new WmsProductInstock();
|
|
|
|
|
wmsProductInstock.taskCode = StaticData.SnowId.NextId().ToString();
|
|
|
|
|
@ -755,37 +755,45 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
|
WmsProductOutstock? wmsProductOutstock = dbContext.WmsProductOutstock.FirstOrDefault(t => t.productOutstockId == item.orderId);
|
|
|
|
|
if (wmsProductOutstock != null)
|
|
|
|
|
{
|
|
|
|
|
//WmsProductOutstockDetail newWmsProductOutstockDetail = new WmsProductOutstockDetail();
|
|
|
|
|
//newWmsProductOutstockDetail
|
|
|
|
|
|
|
|
|
|
var wmsBaseLocation = dbContext.WmsBaseLocation.Where(t => t.locationId == item.currPointId).First();
|
|
|
|
|
WmsProductStock wmsProductStock = dbContext.WmsProductStock.First(t => t.locationCode == wmsBaseLocation.locationCode);
|
|
|
|
|
|
|
|
|
|
WmsProductOutstockDetail newWmsProductOutstockDetail = new WmsProductOutstockDetail();
|
|
|
|
|
newWmsProductOutstockDetail.productOutstockId = wmsProductOutstock.productOutstockId;
|
|
|
|
|
newWmsProductOutstockDetail.warehouseId = wmsProductOutstock.warehouseId;
|
|
|
|
|
newWmsProductOutstockDetail.locationCode = wmsBaseLocation.locationCode;
|
|
|
|
|
newWmsProductOutstockDetail.productBarcode = wmsProductStock.productBatch;
|
|
|
|
|
newWmsProductOutstockDetail.productId = wmsProductStock.productId;
|
|
|
|
|
newWmsProductOutstockDetail.planAmount = wmsProductOutstock.applyQty;
|
|
|
|
|
newWmsProductOutstockDetail.outstockAmount = wmsProductOutstock.outstockQty;
|
|
|
|
|
newWmsProductOutstockDetail.executeStatus = "2";
|
|
|
|
|
newWmsProductOutstockDetail.updateBy = "WCS";
|
|
|
|
|
newWmsProductOutstockDetail.updateDate = DateTime.Now;
|
|
|
|
|
newWmsProductOutstockDetail.beginTime = DateTime.Now;
|
|
|
|
|
newWmsProductOutstockDetail.endTime = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
WmsProductOutstockDetail? wmsProductOutstockDetail = dbContext.WmsProductOutstockDetail.FirstOrDefault(t => t.productOutstockId == wmsProductOutstock.productOutstockId);
|
|
|
|
|
if (wmsProductOutstockDetail != null)
|
|
|
|
|
wmsProductOutstock.outstockQty++;
|
|
|
|
|
if (wmsProductOutstock.applyQty <= wmsProductOutstock.outstockQty)
|
|
|
|
|
{
|
|
|
|
|
var wmsBaseLocation = dbContext.WmsBaseLocation.Where(t => t.locationId == item.currPointId).First();
|
|
|
|
|
WmsProductStock wmsProductStock = dbContext.WmsProductStock.First(t => t.locationCode == wmsBaseLocation.locationCode);
|
|
|
|
|
wmsProductOutstock.outstockQty++;
|
|
|
|
|
if (wmsProductOutstock.applyQty <= wmsProductOutstock.outstockQty)
|
|
|
|
|
{
|
|
|
|
|
wmsProductOutstock.endTime = DateTime.Now;
|
|
|
|
|
wmsProductOutstock.executeStatus = "2";
|
|
|
|
|
}
|
|
|
|
|
wmsProductOutstockDetail.executeStatus = "2";
|
|
|
|
|
wmsProductOutstockDetail.endTime = DateTime.Now;
|
|
|
|
|
wmsBaseLocation.locationStatus = "1";
|
|
|
|
|
wmsBaseLocation.containerCode = null;
|
|
|
|
|
item.nextPointId = 2;
|
|
|
|
|
item.taskStatus = 8;
|
|
|
|
|
SystemData.UnLockOutLocation(wmsBaseLocation, dbContext);
|
|
|
|
|
dbContext.Remove(wmsProductStock);
|
|
|
|
|
dbContext.Update(wmsBaseLocation);
|
|
|
|
|
dbContext.Update(wmsProductOutstockDetail);
|
|
|
|
|
dbContext.Update(wmsProductOutstock);
|
|
|
|
|
dbContext.Update(item);
|
|
|
|
|
dbContext.WcsTaskLog.Where(t => t.objid == item.objid).Update(t => new WcsTaskLog() { taskStatus = 8 });
|
|
|
|
|
dbContext.SaveChanges();
|
|
|
|
|
_logger.Info("二楼AGV线程完成任务" + item.objid);
|
|
|
|
|
wmsProductOutstock.endTime = DateTime.Now;
|
|
|
|
|
wmsProductOutstock.executeStatus = "2";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
wmsBaseLocation.locationStatus = "1";
|
|
|
|
|
wmsBaseLocation.containerCode = null;
|
|
|
|
|
item.nextPointId = 2;
|
|
|
|
|
item.taskStatus = 8;
|
|
|
|
|
SystemData.UnLockOutLocation(wmsBaseLocation, dbContext);
|
|
|
|
|
dbContext.Remove(wmsProductStock);
|
|
|
|
|
dbContext.Update(wmsBaseLocation);
|
|
|
|
|
dbContext.Add(newWmsProductOutstockDetail);
|
|
|
|
|
dbContext.Update(wmsProductOutstock);
|
|
|
|
|
dbContext.Update(item);
|
|
|
|
|
dbContext.WcsTaskLog.Where(t => t.objid == item.objid).Update(t => new WcsTaskLog() { taskStatus = 8 });
|
|
|
|
|
dbContext.SaveChanges();
|
|
|
|
|
_logger.Info("二楼AGV线程完成任务" + item.objid);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (item.taskType == StaticTaskType.SecondLiftToTransit)//空托盘入周转位
|
|
|
|
|
|