Commit a5d91c0b authored by 吴春's avatar 吴春

提交代码

parent 21640522
...@@ -1305,6 +1305,18 @@ namespace Mall.Module.Property ...@@ -1305,6 +1305,18 @@ namespace Mall.Module.Property
{ {
return supplies_MaterialRepository.GetList(dmodel); return supplies_MaterialRepository.GetList(dmodel);
} }
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Supplies_Material_Extend> GetHaveInventory(RB_Supplies_Material_Extend dmodel)
{
return supplies_MaterialRepository.GetHaveInventory(dmodel);
}
#endregion #endregion
......
...@@ -25,7 +25,8 @@ namespace Mall.Repository.Property ...@@ -25,7 +25,8 @@ namespace Mall.Repository.Property
string where = " where 1=1 "; string where = " where 1=1 ";
where += string.Format(" AND {0}={1}", nameof(RB_Supplies_Inventory_Extend.Status), 0); where += string.Format(" AND {0}={1}", nameof(RB_Supplies_Inventory_Extend.Status), 0);
where += $@" and RB_Group_Id={dmodel.RB_Group_Id}"; where += $@" and RB_Group_Id={dmodel.RB_Group_Id}";
if (dmodel.WarehouseId > 0) { if (dmodel.WarehouseId > 0)
{
where += " and " + nameof(RB_Supplies_Inventory_Extend.WarehouseId) + $" ={dmodel.WarehouseId}"; where += " and " + nameof(RB_Supplies_Inventory_Extend.WarehouseId) + $" ={dmodel.WarehouseId}";
} }
if (dmodel.SuppliesId > 0) if (dmodel.SuppliesId > 0)
...@@ -56,7 +57,8 @@ namespace Mall.Repository.Property ...@@ -56,7 +57,8 @@ namespace Mall.Repository.Property
{ {
where += " and " + nameof(RB_Supplies_Inventory_Extend.SuppliesId) + $" ={dmodel.SuppliesId}"; where += " and " + nameof(RB_Supplies_Inventory_Extend.SuppliesId) + $" ={dmodel.SuppliesId}";
} }
if (!string.IsNullOrEmpty(dmodel.WarehouseIdStr)) { if (!string.IsNullOrEmpty(dmodel.WarehouseIdStr))
{
where += " and " + nameof(RB_Supplies_Inventory_Extend.WarehouseId) + $" in({dmodel.WarehouseIdStr})"; where += " and " + nameof(RB_Supplies_Inventory_Extend.WarehouseId) + $" in({dmodel.WarehouseIdStr})";
} }
if (!string.IsNullOrEmpty(dmodel.SuppliesIdStr)) if (!string.IsNullOrEmpty(dmodel.SuppliesIdStr))
...@@ -87,6 +89,11 @@ left join rb_supplies_material sm on si.SuppliesId=sm.Id ...@@ -87,6 +89,11 @@ left join rb_supplies_material sm on si.SuppliesId=sm.Id
return Get<RB_Supplies_Inventory_Extend>(sql).FirstOrDefault()?.Number ?? 0; return Get<RB_Supplies_Inventory_Extend>(sql).FirstOrDefault()?.Number ?? 0;
} }
/// <summary> /// <summary>
/// 获取库存日志 /// 获取库存日志
/// </summary> /// </summary>
......
...@@ -116,5 +116,37 @@ left join rb_property_category pc on sm.CategoryId=pc.Id ...@@ -116,5 +116,37 @@ left join rb_property_category pc on sm.CategoryId=pc.Id
return Get<RB_Supplies_Material_Extend>(sql).ToList(); return Get<RB_Supplies_Material_Extend>(sql).ToList();
} }
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Supplies_Material_Extend> GetHaveInventory(RB_Supplies_Material_Extend dmodel)
{
string where = " where 1=1 ";
where += string.Format(" AND sm.{0}={1}", nameof(RB_Supplies_Material.Status), 0);
where += $@" and sm.RB_Group_Id={dmodel.RB_Group_Id}";
if (!string.IsNullOrWhiteSpace(dmodel.GoodsIds))
{
where += $@" and sm.{nameof(RB_Supplies_Material.GoodsId)} in ({dmodel.GoodsIds})";
}
if (dmodel.TenantId > 0)
{
where += " and sm." + nameof(RB_Supplies_Material_Extend.TenantId) + "=" + dmodel.TenantId;
}
if (dmodel.MallBaseId > 0)
{
where += " and sm." + nameof(RB_Supplies_Material_Extend.MallBaseId) + "=" + dmodel.MallBaseId;
}
string sql = $@" select sm.*,si.Number as InventoryNum
from rb_supplies_material sm
LEFT join RB_Supplies_Inventory si on si.SuppliesId=sm.Id AND si.Status=0
{where} order by si.Id desc";
return Get<RB_Supplies_Material_Extend>(sql).ToList();
}
} }
} }
...@@ -147,7 +147,7 @@ namespace Mall.WebApi.Controllers.Property ...@@ -147,7 +147,7 @@ namespace Mall.WebApi.Controllers.Property
//获取商品的出库规格物料信息 //获取商品的出库规格物料信息
var goodsIds = string.Join(",", demodel.WarehouseOutGoodsList.Select(x => x.NewGoodsId)); var goodsIds = string.Join(",", demodel.WarehouseOutGoodsList.Select(x => x.NewGoodsId));
var materialList = propertyModule.GetSuppliesMaterialList(new RB_Supplies_Material_Extend { GoodsIds = goodsIds, RB_Group_Id = requestParm.ERPGroupId, TenantId = requestParm.TenantId, MallBaseId = requestParm.MallBaseId }); var materialList = propertyModule.GetSuppliesMaterialList(new RB_Supplies_Material_Extend { GoodsIds = goodsIds, RB_Group_Id = requestParm.ERPGroupId, TenantId = requestParm.TenantId, MallBaseId = requestParm.MallBaseId });
// var materialList = propertyModule.GetHaveInventory(new RB_Supplies_Material_Extend { GoodsIds = goodsIds, RB_Group_Id = requestParm.ERPGroupId, TenantId = requestParm.TenantId, MallBaseId = requestParm.MallBaseId });
foreach (var item in demodel.WarehouseOutGoodsList) foreach (var item in demodel.WarehouseOutGoodsList)
{ {
if (item.NewNumber <= 0) if (item.NewNumber <= 0)
...@@ -164,6 +164,10 @@ namespace Mall.WebApi.Controllers.Property ...@@ -164,6 +164,10 @@ namespace Mall.WebApi.Controllers.Property
{ {
return ApiResult.Failed("订单号:" + orderGoodsDetail?.OrderNo + "的商品:" + orderGoodsDetail?.GoodsName + "不存在物料请先同步"); return ApiResult.Failed("订单号:" + orderGoodsDetail?.OrderNo + "的商品:" + orderGoodsDetail?.GoodsName + "不存在物料请先同步");
} }
//if (!materialModel.InventoryNum.HasValue || (materialModel.InventoryNum ?? 0) <= 0)
//{
// return ApiResult.Failed("订单号:" + orderGoodsDetail?.OrderNo + "的商品:" + orderGoodsDetail?.GoodsName + "库存不足");
//}
item.NewSpecificationSort = materialModel.SpecificationKey; item.NewSpecificationSort = materialModel.SpecificationKey;
item.NewSpecification = materialModel.SpecificationName; item.NewSpecification = materialModel.SpecificationName;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment