库存回传MES

This commit is contained in:
zgf committed 2023-11-22 16:39:13 +08:00
1 parent b864a80e29
commit 4334683c6f
5 files changed
+139 -71

No files matched your search

@@ -6,6 +6,7 @@ using WalkingTec.Mvvm.Core.Extensions;
using HHWMS.Web.Models;
using System.Collections.Generic;
using System;
using System.Linq;
namespace HHWMS.Web.Controllers
{
@@ -161,7 +162,11 @@ namespace HHWMS.Web.Controllers
});
}
}
var uniqueGroup = detailList.GroupBy(x => x.UniqueCode);
if (uniqueGroup.Any(x => x.Count() > 1))
{
return FFResult().Alert("新增明细中,存在重复的唯一码!");
}
// 补充物料明细
foreach(var item in detailList)
{
@@ -97,6 +97,46 @@ namespace HHWMS.Web.Controllers
[HttpPost]
public ActionResult BindingData(List<Binding> data)
{
// 判断库内是否有充足库位执行入库 todo
/*var emptyLoc = _unitWork.Find<Location>(x => x.Type == LocationTypeEnum.盘料库位)
.ToList()
.GroupBy(x => Convert.ToInt32(x.Length));
var sizeEmptyNum = new List<dynamic>();
foreach (var group in emptyLoc)
{
var num = group.Sum(x => (x.Length - x.Width));
sizeEmptyNum.Add(new
{
size = group.Key,
num = Convert.ToInt32(num)
});
}
var sizeList = data.GroupBy(x => x.Size).ToList();
foreach(var item in sizeList)
{
var size = 23;
switch (item.Key)
{
case 8:
size = 23;
break;
case 10:
size = 19;
break;
case 16:
size = 16;
break;
case 24:
size = 13;
break;
default:
break;
}
var num = sizeEmptyNum.First(x => x.size == item.Key).num
if(item.Count() > num)
return JsonMore(null, 500, $"尺寸{item.Key}的盘料盒无法满足入库需求,剩余数量{num}");
}*/
var receiptHeaderList = _unitWork.Find<ReceiptHeader>(x =>
data.Select(x => x.ReceiptCode).ToList().Contains(x.Code))
.Include(x => x.ReceiptDetails).ToList();
@@ -173,12 +173,19 @@ public class ReceiptSLInController : BaseController
{
ZoneCode = ZoneCodeEnum.散料库,
UniqueCode = item.UniqueCode,
MaterialCode = receipt.MaterialCode,
MaterialType = receipt.MaterialType,
MaterialName = receipt.MaterialName,
MaterialSpec = receipt.MaterialSpec,
Batch = receipt.Batch,
MaterialUnit = receipt.MaterialUnit,
SupplierCode = receipt.SupplierCode,
Qty = item.BindQty,
Lot = item.Size.ToString(),
LocationCode = item.BoxCode,
ContainerCode = station.ContainerCode,
Status = "0",
TaskStatus = InventoryTaskStatus.任务中
TaskStatus = InventoryTaskStatus.任务中,
Flag = item.Size,
};
_unitWork.Add(inventory);
}