|
|
|
@ -361,7 +361,7 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
WcsTask? wcsTask = dbContext.WcsTask.Where(t => t.nextPointId == 28).FirstOrDefault();
|
|
|
|
WcsTask? wcsTask = dbContext.WcsTask.Where(t => t.nextPointId == 28).FirstOrDefault();
|
|
|
|
if (wcsTask == null)
|
|
|
|
if (wcsTask == null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
WmsRawInstock? wmsRawInstock = dbContext.WmsRawInstock.Where(t => t.warehouseId == 511 && t.instockType == "2" && t.executeStatus == "0").FirstOrDefault();
|
|
|
|
WmsRawInstock? wmsRawInstock = dbContext.WmsRawInstock.Where(t => t.warehouseId == 511 && (t.instockType == "2" || t.instockType == "4") && t.executeStatus == "0").FirstOrDefault();
|
|
|
|
if (wmsRawInstock != null)
|
|
|
|
if (wmsRawInstock != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MesBasePalletInfo? mesBasePalletInfo = dbContext.MesBasePalletInfo.FirstOrDefault(t => t.palletInfoCode == wmsRawInstock.palletInfoCode);
|
|
|
|
MesBasePalletInfo? mesBasePalletInfo = dbContext.MesBasePalletInfo.FirstOrDefault(t => t.palletInfoCode == wmsRawInstock.palletInfoCode);
|
|
|
|
@ -939,12 +939,11 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
if (wcsTaskManual != null)
|
|
|
|
if (wcsTaskManual != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var wmsRawOutstock = dbContext.WmsRawOutstock.FirstOrDefault(t => t.rawOutstockId == wcsTaskManual.orderId);
|
|
|
|
var wmsRawOutstock = dbContext.WmsRawOutstock.FirstOrDefault(t => t.rawOutstockId == wcsTaskManual.orderId);
|
|
|
|
if (wmsRawOutstock != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var wmsRawStocks = dbContext.WmsRawStock
|
|
|
|
var wmsRawStocks = dbContext.WmsRawStock
|
|
|
|
.Where(t => t.saleOrderId == (wmsRawOutstock.saleOrderId == null ? 0 : wmsRawOutstock.saleOrderId))
|
|
|
|
.WhereIf(wmsRawOutstock != null, t => t.saleOrderId == (wmsRawOutstock.saleOrderId == null ? 0 : wmsRawOutstock.saleOrderId))
|
|
|
|
|
|
|
|
.WhereIf(wmsRawOutstock != null, t => t.materialId == wmsRawOutstock.materialId)
|
|
|
|
.Where(t => t.warehouseId == 311)
|
|
|
|
.Where(t => t.warehouseId == 311)
|
|
|
|
.Where(t => t.materialId == wmsRawOutstock.materialId)
|
|
|
|
|
|
|
|
.Where(t => t.totalAmount > t.frozenAmount)
|
|
|
|
.Where(t => t.totalAmount > t.frozenAmount)
|
|
|
|
.ToList();
|
|
|
|
.ToList();
|
|
|
|
var wmsRawStockLocations = wmsRawStocks.Select(x => x.locationCode).ToList();
|
|
|
|
var wmsRawStockLocations = wmsRawStocks.Select(x => x.locationCode).ToList();
|
|
|
|
@ -958,7 +957,7 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
var wmsBaseLocations = AllWmsBaseLocations
|
|
|
|
var wmsBaseLocations = AllWmsBaseLocations
|
|
|
|
.Where(t => t.warehouseId == 311)
|
|
|
|
.Where(t => t.warehouseId == 311)
|
|
|
|
.Where(t => wmsRawStockLocations.Contains(t.locationCode))
|
|
|
|
.Where(t => wmsRawStockLocations.Contains(t.locationCode))
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(wcsTaskManual.startPointNo),t=>t.locationCode== wcsTaskManual.startPointNo)
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(wcsTaskManual.startPointNo), t => t.locationCode == wcsTaskManual.startPointNo)
|
|
|
|
.ToList();
|
|
|
|
.ToList();
|
|
|
|
if (!string.IsNullOrEmpty(wcsTaskManual.startPointNo))
|
|
|
|
if (!string.IsNullOrEmpty(wcsTaskManual.startPointNo))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -1141,39 +1140,43 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
MesBaseBarcodeInfo? mesBaseBarcodeInfo = dbContext.MesBaseBarcodeInfo.FirstOrDefault(t => t.barcodeInfo == mesBasePalletInfo.materialBarcode);
|
|
|
|
MesBaseBarcodeInfo? mesBaseBarcodeInfo = dbContext.MesBaseBarcodeInfo.FirstOrDefault(t => t.barcodeInfo == mesBasePalletInfo.materialBarcode);
|
|
|
|
if (mesBaseBarcodeInfo != null)
|
|
|
|
if (mesBaseBarcodeInfo != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
WmsRawOutstockDetail wmsRawOutstockDetail = new WmsRawOutstockDetail()
|
|
|
|
//if (wmsRawOutstock != null)
|
|
|
|
{
|
|
|
|
//{
|
|
|
|
rawOutstockDetailId = StaticData.SnowId.NextId(),
|
|
|
|
// WmsRawOutstockDetail wmsRawOutstockDetail = new WmsRawOutstockDetail()
|
|
|
|
createBy = "WCS",
|
|
|
|
// {
|
|
|
|
createDate = DateTime.Now,
|
|
|
|
// rawOutstockDetailId = StaticData.SnowId.NextId(),
|
|
|
|
executeStatus = "0",
|
|
|
|
// createBy = "WCS",
|
|
|
|
erpAmount = 0,
|
|
|
|
// createDate = DateTime.Now,
|
|
|
|
erpStatus = "0",
|
|
|
|
// executeStatus = "0",
|
|
|
|
instockBatch = mesBaseBarcodeInfo.batchCode,
|
|
|
|
// erpAmount = 0,
|
|
|
|
stackAmount = 1,
|
|
|
|
// erpStatus = "0",
|
|
|
|
locationCode = wmsBaseLocation.locationCode,
|
|
|
|
// instockBatch = mesBaseBarcodeInfo.batchCode,
|
|
|
|
rawOutstockId = wmsRawOutstock.rawOutstockId,
|
|
|
|
// stackAmount = 1,
|
|
|
|
planAmount = 1,
|
|
|
|
// locationCode = wmsBaseLocation.locationCode,
|
|
|
|
outstockWay = "2",
|
|
|
|
// rawOutstockId = wmsRawOutstock.rawOutstockId,
|
|
|
|
outstockPerson = "WCS",
|
|
|
|
// planAmount = 1,
|
|
|
|
outstockTime = DateTime.Now,
|
|
|
|
// outstockWay = "2",
|
|
|
|
materialProductionDate = mesBaseBarcodeInfo.productionDate,
|
|
|
|
// outstockPerson = "WCS",
|
|
|
|
materialBarcode = mesBasePalletInfo.materialBarcode,
|
|
|
|
// outstockTime = DateTime.Now,
|
|
|
|
materialId = wmsRawOutstock.materialId,
|
|
|
|
// materialProductionDate = mesBaseBarcodeInfo.productionDate,
|
|
|
|
machineName = mesBaseBarcodeInfo.machineName,
|
|
|
|
// materialBarcode = mesBasePalletInfo.materialBarcode,
|
|
|
|
outstockAmount = 1,
|
|
|
|
// materialId = wmsRawOutstock.materialId,
|
|
|
|
taskCode = wmsRawOutstock.taskCode
|
|
|
|
// machineName = mesBaseBarcodeInfo.machineName,
|
|
|
|
};
|
|
|
|
// outstockAmount = 1,
|
|
|
|
|
|
|
|
// taskCode = wmsRawOutstock.taskCode
|
|
|
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
// dbContext.Add(wmsRawOutstockDetail);
|
|
|
|
|
|
|
|
//}
|
|
|
|
wcsTask = new WcsTask()
|
|
|
|
wcsTask = new WcsTask()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
objid = StaticData.SnowId.NextId(),
|
|
|
|
objid = StaticData.SnowId.NextId(),
|
|
|
|
orderId = wmsRawOutstock.rawOutstockId,
|
|
|
|
orderId = wmsRawOutstock?.rawOutstockId,
|
|
|
|
taskType = StaticTaskType.ThirdRawToFlip,
|
|
|
|
taskType = StaticTaskType.ThirdRawToFlip,
|
|
|
|
containerNo = wmsRawStock.palletInfoCode,
|
|
|
|
containerNo = wmsRawStock.palletInfoCode,
|
|
|
|
createBy = "WCS",
|
|
|
|
createBy = "WCS",
|
|
|
|
createTime = DateTime.Now,
|
|
|
|
createTime = DateTime.Now,
|
|
|
|
taskStatus = 0,
|
|
|
|
taskStatus = 0,
|
|
|
|
materialId = wmsRawOutstock.materialId,
|
|
|
|
materialId = mesBaseBarcodeInfo.materialId,
|
|
|
|
currPointId = wmsBaseLocation.locationId,
|
|
|
|
currPointId = wmsBaseLocation.locationId,
|
|
|
|
currPointNo = wmsBaseLocation.locationCode,
|
|
|
|
currPointNo = wmsBaseLocation.locationCode,
|
|
|
|
nextPointId = baseEquip.objid,
|
|
|
|
nextPointId = baseEquip.objid,
|
|
|
|
@ -1187,7 +1190,6 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
SystemData.LockOutLocation(wmsBaseLocation, dbContext);
|
|
|
|
SystemData.LockOutLocation(wmsBaseLocation, dbContext);
|
|
|
|
wmsBaseLocation.locationStatus = "6";
|
|
|
|
wmsBaseLocation.locationStatus = "6";
|
|
|
|
dbContext.Update(wmsBaseLocation);
|
|
|
|
dbContext.Update(wmsBaseLocation);
|
|
|
|
dbContext.Add(wmsRawOutstockDetail);
|
|
|
|
|
|
|
|
WcsTaskLog wcsTaskLog = CoreMapper.Map<WcsTaskLog>(wcsTask);
|
|
|
|
WcsTaskLog wcsTaskLog = CoreMapper.Map<WcsTaskLog>(wcsTask);
|
|
|
|
dbContext.Remove(wcsTaskManual);
|
|
|
|
dbContext.Remove(wcsTaskManual);
|
|
|
|
dbContext.Add(wcsTask);
|
|
|
|
dbContext.Add(wcsTask);
|
|
|
|
@ -1205,7 +1207,6 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_logger.Error(ex.Message + "\n" + ex.StackTrace);
|
|
|
|
_logger.Error(ex.Message + "\n" + ex.StackTrace);
|
|
|
|
@ -1569,22 +1570,23 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
WmsProductOutstockDetail detail = new()
|
|
|
|
//WmsProductOutstockDetail detail = new()
|
|
|
|
{
|
|
|
|
//{
|
|
|
|
productId = item.productId,
|
|
|
|
// productId = item.productId,
|
|
|
|
productOutstockId = item.productOutstockId,
|
|
|
|
// productOutstockId = item.productOutstockId,
|
|
|
|
locationCode = location.locationCode,
|
|
|
|
// locationCode = location.locationCode,
|
|
|
|
executeStatus = "1",
|
|
|
|
// executeStatus = "1",
|
|
|
|
beginTime = DateTime.Now,
|
|
|
|
// beginTime = DateTime.Now,
|
|
|
|
warehouseId = item.warehouseId,
|
|
|
|
// warehouseId = item.warehouseId,
|
|
|
|
erpAmount = 0,
|
|
|
|
// erpAmount = 0,
|
|
|
|
confirmAmount = 0,
|
|
|
|
// confirmAmount = 0,
|
|
|
|
outstockAmount = 1,
|
|
|
|
// outstockAmount = 1,
|
|
|
|
planAmount = 1,
|
|
|
|
// planAmount = 1,
|
|
|
|
productBatch = item.productBatch,
|
|
|
|
// productBatch = item.productBatch,
|
|
|
|
productOutstockDetailId = StaticData.SnowId.NextId(),
|
|
|
|
// productOutstockDetailId = StaticData.SnowId.NextId(),
|
|
|
|
productBarcode = mesBasePalletInfo.materialBarcode
|
|
|
|
// productBarcode = mesBasePalletInfo.materialBarcode
|
|
|
|
};
|
|
|
|
//};
|
|
|
|
|
|
|
|
//dbContext.Add(detail);
|
|
|
|
wcsTask = new WcsTask()
|
|
|
|
wcsTask = new WcsTask()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
objid = StaticData.SnowId.NextId(),
|
|
|
|
objid = StaticData.SnowId.NextId(),
|
|
|
|
@ -1609,7 +1611,6 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
location.locationStatus = "6";
|
|
|
|
location.locationStatus = "6";
|
|
|
|
location.updateBy = "WCS";
|
|
|
|
location.updateBy = "WCS";
|
|
|
|
location.updateTime = DateTime.Now;
|
|
|
|
location.updateTime = DateTime.Now;
|
|
|
|
dbContext.Add(detail);
|
|
|
|
|
|
|
|
dbContext.Update(location);
|
|
|
|
dbContext.Update(location);
|
|
|
|
dbContext.Add(wcsTask);
|
|
|
|
dbContext.Add(wcsTask);
|
|
|
|
dbContext.Update(stock);
|
|
|
|
dbContext.Update(stock);
|
|
|
|
@ -1867,27 +1868,27 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
useFlag = 1,
|
|
|
|
useFlag = 1,
|
|
|
|
qty = 1
|
|
|
|
qty = 1
|
|
|
|
};
|
|
|
|
};
|
|
|
|
WmsProductOutstockDetail detail = new()
|
|
|
|
//WmsProductOutstockDetail detail = new()
|
|
|
|
{
|
|
|
|
//{
|
|
|
|
productId = item.productId,
|
|
|
|
// productId = item.productId,
|
|
|
|
productOutstockId = item.productOutstockId,
|
|
|
|
// productOutstockId = item.productOutstockId,
|
|
|
|
locationCode = location.locationCode,
|
|
|
|
// locationCode = location.locationCode,
|
|
|
|
executeStatus = "1",
|
|
|
|
// executeStatus = "1",
|
|
|
|
beginTime = DateTime.Now,
|
|
|
|
// beginTime = DateTime.Now,
|
|
|
|
warehouseId = item.warehouseId,
|
|
|
|
// warehouseId = item.warehouseId,
|
|
|
|
erpAmount = 0,
|
|
|
|
// erpAmount = 0,
|
|
|
|
confirmAmount = 0,
|
|
|
|
// confirmAmount = 0,
|
|
|
|
outstockAmount = 1,
|
|
|
|
// outstockAmount = 1,
|
|
|
|
planAmount = 1,
|
|
|
|
// planAmount = 1,
|
|
|
|
productBatch = item.productBatch,
|
|
|
|
// productBatch = item.productBatch,
|
|
|
|
productOutstockDetailId = StaticData.SnowId.NextId(),
|
|
|
|
// productOutstockDetailId = StaticData.SnowId.NextId(),
|
|
|
|
productBarcode = mesBasePalletInfo.materialBarcode,
|
|
|
|
// productBarcode = mesBasePalletInfo.materialBarcode,
|
|
|
|
};
|
|
|
|
//};
|
|
|
|
|
|
|
|
//dbContext.Add(detail);
|
|
|
|
SystemData.LockOutLocation(location, dbContext);
|
|
|
|
SystemData.LockOutLocation(location, dbContext);
|
|
|
|
location.locationStatus = "6";
|
|
|
|
location.locationStatus = "6";
|
|
|
|
location.updateBy = "WCS";
|
|
|
|
location.updateBy = "WCS";
|
|
|
|
location.updateTime = DateTime.Now;
|
|
|
|
location.updateTime = DateTime.Now;
|
|
|
|
dbContext.Add(detail);
|
|
|
|
|
|
|
|
dbContext.Update(location);
|
|
|
|
dbContext.Update(location);
|
|
|
|
dbContext.Add(wcsTask);
|
|
|
|
dbContext.Add(wcsTask);
|
|
|
|
dbContext.Update(stock);
|
|
|
|
dbContext.Update(stock);
|
|
|
|
@ -2553,33 +2554,33 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
qty = qty
|
|
|
|
qty = qty
|
|
|
|
};
|
|
|
|
};
|
|
|
|
//location是出库的库位,mesBaseBarcodeInfo是条码信息表数据,item是出库申请单
|
|
|
|
//location是出库的库位,mesBaseBarcodeInfo是条码信息表数据,item是出库申请单
|
|
|
|
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
|
|
|
|
};
|
|
|
|
//};
|
|
|
|
|
|
|
|
//dbContext.Add(wmsProductOutstockDetail);
|
|
|
|
if (item.beginTime == null)
|
|
|
|
if (item.beginTime == null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
item.beginTime = DateTime.Now;
|
|
|
|
item.beginTime = DateTime.Now;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SystemData.LockOutLocation(location, dbContext);
|
|
|
|
SystemData.LockOutLocation(location, dbContext);
|
|
|
|
dbContext.Add(wmsProductOutstockDetail);
|
|
|
|
|
|
|
|
location.locationStatus = "6";
|
|
|
|
location.locationStatus = "6";
|
|
|
|
location.updateBy = "WCS";
|
|
|
|
location.updateBy = "WCS";
|
|
|
|
location.updateTime = DateTime.Now;
|
|
|
|
location.updateTime = DateTime.Now;
|
|
|
|
|