手动出库接口调整,需检测是否在清单中

This commit is contained in:
2025-11-19 20:16:26 +08:00
parent 530e682541
commit 81e17fd62f

View File

@@ -119,11 +119,24 @@ namespace ZR.Service.mes.wms
model.Id = SnowFlakeSingle.Instance.NextId().ToString(); //也可以在程序中直接获取ID
}
// 检查计划中是否有此零件号
/* bool hasMaterial = Context
WmMaterial material = Context
.Queryable<WmMaterial>()
.Where(it => it.Partnumber == model.Partnumber)
.First();
if (material == null)
{
throw new Exception("物料号不存在:" + model.Partnumber);
}
bool hasMaterial = Context
.Queryable<WmMaterialOutorder>()
.Where(it => it.FkOutorderId == model.FkOutOrderId)
.Where(it => it.FkMaterialId == )
.Any();*/
.Where(it => it.FkMaterialId == material.Id)
.Any();
if (!hasMaterial)
{
throw new Exception($"该物料在此出库计划中不存在物料号:{model.Partnumber},工单号:{model.FkOutOrderId}");
}
//2. 根据成品仓库id修改记录
WmGoodsNowProduction updateModel = new WmGoodsNowProduction();
@@ -296,6 +309,25 @@ namespace ZR.Service.mes.wms
{
continue;
}
// 检查计划中是否有此零件号
WmMaterial material = Context
.Queryable<WmMaterial>()
.Where(it => it.Partnumber == nowProduction.Partnumber)
.First();
if (material == null)
{
throw new Exception("物料号不存在:" + nowProduction.Partnumber);
}
bool hasMaterial = Context
.Queryable<WmMaterialOutorder>()
.Where(it => it.FkOutorderId == parm.FkOutOrderId)
.Where(it => it.FkMaterialId == material.Id)
.Any();
if (!hasMaterial)
{
throw new Exception($"该物料在此出库计划中不存在物料号:{nowProduction.Partnumber},工单号:{parm.FkOutOrderId}");
}
WmGoodsOutRecord outRecord =
new()
{
@@ -357,6 +389,25 @@ namespace ZR.Service.mes.wms
{
continue;
}
// 检查计划中是否有此零件号
WmMaterial material = Context
.Queryable<WmMaterial>()
.Where(it => it.Partnumber == nowProduction.Partnumber)
.First();
if (material == null)
{
throw new Exception("物料号不存在:" + nowProduction.Partnumber);
}
bool hasMaterial = Context
.Queryable<WmMaterialOutorder>()
.Where(it => it.FkOutorderId == parm.FkOutOrderId)
.Where(it => it.FkMaterialId == material.Id)
.Any();
if (!hasMaterial)
{
throw new Exception($"该物料在此出库计划中不存在物料号:{nowProduction.Partnumber},工单号:{parm.FkOutOrderId}");
}
WmGoodsOutRecord outRecord =
new()
{