|
|
|
|
@ -1324,8 +1324,12 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
|
|
|
|
|
|
if (wcsTaskManual != null)
|
|
|
|
|
{
|
|
|
|
|
var wmsRawOutstock = dbContext.WmsRawOutstock.FirstOrDefault(t => t.rawOutstockId == wcsTaskManual.orderId);
|
|
|
|
|
|
|
|
|
|
var wmsRawOutstock = dbContext.WmsRawOutstock.FirstOrDefault(t => t.rawOutstockId == wcsTaskManual.orderId);
|
|
|
|
|
if (!string.IsNullOrEmpty(wcsTaskManual.startPointNo)) //手动投料没有申请单
|
|
|
|
|
{
|
|
|
|
|
wmsRawOutstock = null;
|
|
|
|
|
}
|
|
|
|
|
var wmsRawStocks = dbContext.WmsRawStock
|
|
|
|
|
.WhereIf(wmsRawOutstock != null, t => t.saleOrderId == (wmsRawOutstock.saleOrderId == null ? 0 : wmsRawOutstock.saleOrderId))
|
|
|
|
|
.WhereIf(wmsRawOutstock != null, t => t.materialId == wmsRawOutstock.materialId)
|
|
|
|
|
@ -1345,8 +1349,12 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
|
.Where(t => wmsRawStockLocations.Contains(t.locationCode))
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(wcsTaskManual.startPointNo), t => t.locationCode == wcsTaskManual.startPointNo)
|
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
|
|
//手动模式
|
|
|
|
|
if (!string.IsNullOrEmpty(wcsTaskManual.startPointNo))
|
|
|
|
|
{
|
|
|
|
|
wmsBaseLocations = dbContext.WmsBaseLocation.Where(x => x.locationCode == wcsTaskManual.startPointNo).ToList();
|
|
|
|
|
|
|
|
|
|
var wmsRawPreferredOut = dbContext.WmsRawPreferredOut.Where(t => t.LocationCode == wcsTaskManual.startPointNo).FirstOrDefault();
|
|
|
|
|
if (wmsRawPreferredOut != null)
|
|
|
|
|
{
|
|
|
|
|
@ -1371,13 +1379,7 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
bill = bill.OrderBy(t => list.Contains(t.a.locationCode) ? 0 : 1).OrderBy(t => t.b.instockDate.Value.Date);//按某个时间段
|
|
|
|
|
//#region 如果有需要优先投料的库位,则该库位优先投料
|
|
|
|
|
//List<string> PreferredOutsLocation = dbContext.WmsRawPreferredOut.Where(x => x.WarehouseId == 311).ToList().Select(x => x.LocationCode).ToList();
|
|
|
|
|
//if (PreferredOutsLocation != null && PreferredOutsLocation.Count > 0)
|
|
|
|
|
//{
|
|
|
|
|
// bill.OrderBy(t => PreferredOutsLocation.Contains(t.a.locationCode) ? 0 : 1);
|
|
|
|
|
//}
|
|
|
|
|
//#endregion
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
foreach (var item in bill)
|
|
|
|
|
{
|
|
|
|
|
@ -1527,6 +1529,29 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
|
MesBaseBarcodeInfo? mesBaseBarcodeInfo = dbContext.MesBaseBarcodeInfo.FirstOrDefault(t => t.barcodeInfo == mesBasePalletInfo.materialBarcode);
|
|
|
|
|
if (mesBaseBarcodeInfo != null)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (wmsRawOutstock == null)
|
|
|
|
|
{
|
|
|
|
|
wmsRawOutstock = new WmsRawOutstock();
|
|
|
|
|
|
|
|
|
|
wmsRawOutstock.rawOutstockId = StaticData.SnowId.NextId();
|
|
|
|
|
wmsRawOutstock.taskCode = StaticData.SnowId.NextId().ToString();
|
|
|
|
|
wmsRawOutstock.warehouseId = 311;
|
|
|
|
|
wmsRawOutstock.locationCode = wmsBaseLocation.locationCode;
|
|
|
|
|
wmsRawOutstock.materialId = mesBaseBarcodeInfo.materialId;
|
|
|
|
|
wmsRawOutstock.materialBatch = mesBaseBarcodeInfo.barcodeInfo;
|
|
|
|
|
wmsRawOutstock.palletInfoCode = wmsBaseLocation.containerCode;
|
|
|
|
|
wmsRawOutstock.outstockAmount = 1;
|
|
|
|
|
wmsRawOutstock.realOutstockAmount = 0;
|
|
|
|
|
wmsRawOutstock.operationType = "1";
|
|
|
|
|
wmsRawOutstock.taskType = "1";
|
|
|
|
|
wmsRawOutstock.auditStatus = "1";
|
|
|
|
|
wmsRawOutstock.executeStatus = "0";
|
|
|
|
|
wmsRawOutstock.applyBy = "WCS";
|
|
|
|
|
wmsRawOutstock.auditDate = DateTime.Now;
|
|
|
|
|
wmsRawOutstock.saleOrderId = mesBaseBarcodeInfo != null ? mesBaseBarcodeInfo.saleOrderId : 0;
|
|
|
|
|
dbContext.Add(wmsRawOutstock);
|
|
|
|
|
}
|
|
|
|
|
//if (wmsRawOutstock != null)
|
|
|
|
|
//{
|
|
|
|
|
// WmsRawOutstockDetail wmsRawOutstockDetail = new WmsRawOutstockDetail()
|
|
|
|
|
@ -1574,6 +1599,7 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
|
useFlag = 1,
|
|
|
|
|
qty = 1
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
SystemData.LockOutLocation(wmsBaseLocation, dbContext);
|
|
|
|
|
wmsBaseLocation.locationStatus = "6";
|
|
|
|
|
dbContext.Update(wmsBaseLocation);
|
|
|
|
|
|