Commit 65c58a2c authored by 吴春's avatar 吴春

提交代码

parent 87f6ad82
......@@ -99,6 +99,31 @@ namespace Mall.Model.Entity.Property
/// </summary>
public string SpecificationSort { get; set; }
/// <summary>
/// 规格key(出库的规格),没有修改为
/// </summary>
public string NewSpecificationSort { get; set; }
/// <summary>
/// 规格(出库的规格名称)
/// </summary>
public string NewSpecification
{
get;
set;
}
/// <summary>
/// 规格(出库的数量)
/// </summary>
public int NewNumber
{
get;
set;
}
/// <summary>
/// 货号
/// </summary>
......@@ -134,7 +159,7 @@ namespace Mall.Model.Entity.Property
set;
}
/// <summary>
/// 成本价
......
......@@ -155,5 +155,30 @@ namespace Mall.Model.Extend.Product
/// </summary>
public int IsSelectAll { get; set; }
/// <summary>
/// 规格key(出库的规格),没有修改为
/// </summary>
public string NewSpecificationSort { get; set; }
/// <summary>
/// 规格(出库的规格名称)
/// </summary>
public string NewSpecification
{
get;
set;
}
/// <summary>
/// 规格(出库的数量)
/// </summary>
public int NewNumber
{
get;
set;
}
}
}
This diff is collapsed.
......@@ -93,6 +93,10 @@ left join rb_property_category pc on sm.CategoryId=pc.Id
{
where += " and sm." + nameof(RB_Supplies_Material_Extend.CategoryId) + "=" + dmodel.CategoryId;
}
if (dmodel.GoodsId > 0)
{
where += " and sm." + nameof(RB_Supplies_Material_Extend.GoodsId) + "=" + dmodel.GoodsId;
}
if (!string.IsNullOrEmpty(dmodel.SuppliesIdStr)) {
where += " and sm." + nameof(RB_Supplies_Material_Extend.Id) + " in(" + dmodel.SuppliesIdStr + ")";
}
......
......@@ -24,6 +24,7 @@ namespace Mall.WebApi.Controllers.Property
private readonly WarehouseOutModule warehouseOutModule = new WarehouseOutModule();
private readonly OrderModule orderModule = new OrderModule();
private readonly PropertyModule propertyModule = new PropertyModule();
/// <summary>
/// 获取出库申请列表
......@@ -59,6 +60,24 @@ namespace Mall.WebApi.Controllers.Property
/// <summary>
/// 根据商品id获取物料规格信息
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetSuppliesMaterialList()
{
var parms = RequestParm;
// var materialList = propertyModule.GetSuppliesMaterialList(new RB_Supplies_Material_Extend { GoodsIds = goodsIds, RB_Group_Id = requestParm.ERPGroupId, TenantId = requestParm.TenantId, MallBaseId = requestParm.MallBaseId });
RB_Supplies_Material_Extend demodel = JsonConvert.DeserializeObject<RB_Supplies_Material_Extend>(parms.msg.ToString());
demodel.TenantId = parms.TenantId;
demodel.MallBaseId = parms.MallBaseId;
demodel.RB_Group_Id = parms.ERPGroupId;
var list = propertyModule.GetSuppliesMaterialList(demodel);
return ApiResult.Success("", list);
}
/// <summary>
/// 提交出库申请
/// </summary>
......@@ -77,7 +96,7 @@ namespace Mall.WebApi.Controllers.Property
{
return ApiResult.ParamIsNull("请传递参数");
}
if (demodel.WarehouseOutGoodsList == null || !demodel.WarehouseOutGoodsList.Any())
{
return ApiResult.ParamIsNull("请选择商品");
......@@ -89,6 +108,7 @@ namespace Mall.WebApi.Controllers.Property
return ApiResult.ParamIsNull("订单商品id未传递");
}
}
//根据订单商品id查询商品信息
var orderGoodsIds = string.Join(",", demodel.WarehouseOutGoodsList.Select(x => x.OrderGoodsId));
var orderGoodsList = orderModule.GetOrderGoodsList(new Model.Extend.Product.RB_Goods_OrderDetail_Extend { TenantId = requestParm.TenantId, MallBaseId = requestParm.MallBaseId, IdList = demodel.WarehouseOutGoodsList.Select(x => x.OrderGoodsId).ToList() });
......@@ -124,9 +144,33 @@ namespace Mall.WebApi.Controllers.Property
return ApiResult.Failed("订单号:" + msg + "的商品已申请出库,请勿重复申请");
}
//获取商品的出库规格物料信息
var goodsIds = string.Join(",", orderGoodsList.Select(x => x.GoodsId));
var materialList = propertyModule.GetSuppliesMaterialList(new RB_Supplies_Material_Extend { GoodsIds = goodsIds, RB_Group_Id = requestParm.ERPGroupId, TenantId = requestParm.TenantId, MallBaseId = requestParm.MallBaseId });
foreach (var item in demodel.WarehouseOutGoodsList)
{
if (item.NewNumber <= 0)
{
return ApiResult.Failed("出库商品数量不能小于0");
}
var orderGoodsDetailModel = orderGoodsList.Where(x => x.Id == item.OrderGoodsId).FirstOrDefault();
if (item.NewSpecificationSort != item.SpecificationSort)//修改了规格的判断新规格是否在物料中存在
{
var materialModel = materialList.Where(x => x.GoodsId == orderGoodsDetailModel.GoodsId && x.SpecificationKey == item.NewSpecificationSort).FirstOrDefault();
if (materialModel == null)
{
return ApiResult.Failed("订单号:" + item.OrderNo + "的商品:" + item.GoodsName + "不存在物料请先同步");
}
item.NewSpecificationSort = materialModel.SpecificationKey;
item.NewSpecification = materialModel.SpecificationName;
}
else//没有就直接等于订单的规格和数量
{
item.NewSpecificationSort = orderGoodsDetailModel.SpecificationSort;
item.NewNumber = orderGoodsDetailModel.Number.Value;
item.NewSpecification = orderGoodsDetailModel.Specification;
}
if (orderGoodsDetailModel != null)
{
item.TenantId = orderGoodsDetailModel.TenantId;
......@@ -188,6 +232,9 @@ namespace Mall.WebApi.Controllers.Property
demodel.TenantId = parms.TenantId;
demodel.MallBaseId = parms.MallBaseId;
var list = orderModule.GetNoOutOrderGoodsList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
list.ForEach(x => x.NewSpecificationSort = x.SpecificationSort);
list.ForEach(x => x.NewSpecification = x.Specification);
list.ForEach(x => x.NewNumber = (x.Number ?? 0));
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list;
return ApiResult.Success("", pagelist);
......
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