Commit 01d28121 authored by liudong1993's avatar liudong1993

采购单

parent 6689189e
......@@ -85,6 +85,7 @@ namespace Mall.Module.Property
private readonly RB_Supplies_WareHouseRepository supplies_WareHouseRepository = new RB_Supplies_WareHouseRepository();
#region 获取采购单
/// <summary>
......@@ -132,7 +133,7 @@ namespace Mall.Module.Property
}
}
}
var elist = employeeRepository.GetEmployeeListRepository(new RB_Employee_Extend() { EmployeeIds = string.Join(",", list.Select(x => x.CreateBy ?? 0).Distinct()) });
var elist = employeeRepository.GetEmployeeListRepository(new Model.Entity.User.RB_Employee_Extend() { EmployeeIds = string.Join(",", list.Select(x => x.CreateBy ?? 0).Distinct()) });
var wlist = supplies_WareHouseRepository.GetList(new RB_Supplies_WareHouse_Extend() { WareHouseIdStr = string.Join(",", list.Select(x => x.WareHouseId ?? 0).Distinct()) });
foreach (var item in list) {
item.DetailList = pdList.Where(x => x.ProcurementId == item.Id).ToList();
......@@ -143,6 +144,59 @@ namespace Mall.Module.Property
return list;
}
/// <summary>
/// 获取采购单详情
/// </summary>
/// <param name="procurementId"></param>
/// <param name="TenantId"></param>
/// <param name="MallBaseId"></param>
/// <returns></returns>
public RB_Procurement_Extend GetProcurementInfo(int procurementId,int TenantId,int MallBaseId)
{
var pmodel = procurementRepository.GetEntity<RB_Procurement_Extend>(procurementId);
//查询明细
var pdList = procurement_DetailRepository.GetList(new RB_Procurement_Detail_Extend() { ProcurementId = procurementId, TenantId = TenantId, MallBaseId = MallBaseId });
//查询物料
if (pdList.Any())
{
string MaterialIds = string.Join(",", pdList.Select(x => x.MaterialId).Distinct());
var mList = supplies_MaterialRepository.GetList(new RB_Supplies_Material_Extend() { SuppliesIdStr = MaterialIds, TenantId = TenantId, MallBaseId = MallBaseId });
foreach (var item in pdList)
{
item.MaterialModel = mList.Where(x => x.Id == item.MaterialId).FirstOrDefault();
if (item.MaterialModel != null)
{
item.MaterialModel.GoodsSpecificationList = new List<string>();
item.MaterialModel.GoodsCategoryList = new List<string>();
if (!string.IsNullOrEmpty(item.MaterialModel.SpecificationName))
{
item.MaterialModel.GoodsSpecificationList = JsonConvert.DeserializeObject<List<string>>(item.MaterialModel.SpecificationName);
}
if (!string.IsNullOrEmpty(item.MaterialModel.GoodsCategoryName))
{
item.MaterialModel.GoodsCategoryList = JsonConvert.DeserializeObject<List<string>>(item.MaterialModel.GoodsCategoryName);
}
if (item.MaterialModel.Images == "" || item.MaterialModel.Images == null)
{
item.MaterialModel.Images = "[]";
}
var imglist = JsonConvert.DeserializeObject<List<string>>(item.MaterialModel.Images);
item.MaterialModel.ImageList = new List<string>();
}
else
{
item.MaterialModel = new RB_Supplies_Material_Extend();
}
}
}
var wlist = supplies_WareHouseRepository.GetList(new RB_Supplies_WareHouse_Extend() { WareHouseIdStr = (pmodel.WareHouseId ?? 0).ToString() });
pmodel.DetailList = pdList;
pmodel.WareHouseName = wlist.FirstOrDefault()?.Name ?? "";
return pmodel;
}
/// <summary>
/// 提交采购单
/// </summary>
......
......@@ -69,6 +69,9 @@ namespace Mall.Repository.User
{
builder.AppendFormat(" AND {0} LIKE '%{1}%' ", nameof(RB_Employee_Extend.EmpName), query.EmpName.Trim());
}
if (!string.IsNullOrEmpty(query.EmployeeIds)) {
builder.AppendFormat(" AND {0} in({1}) ", nameof(RB_Employee_Extend.EmpId), query.EmployeeIds);
}
return Get<RB_Employee_Extend>(builder.ToString()).ToList();
}
}
......
......@@ -78,14 +78,59 @@ namespace Mall.WebApi.Controllers.MallBase
}
/// <summary>
/// 获取商品规格列表
/// 获取采购单详情
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetGoodsToProcurementPageList() {
public ApiResult GetProcurementInfo()
{
var requestParm = RequestParm;
JObject parms = JObject.Parse(requestParm.msg.ToString());
int ProcurementId = parms.GetInt("ProcurementId", 0);
if (ProcurementId <= 0) {
return ApiResult.ParamIsNull("请传递参数");
}
var model = propertyModule.GetProcurementInfo(ProcurementId, requestParm.TenantId, requestParm.MallBaseId);
return ApiResult.Success("",new {
model.Id,
model.WareHouseId,
model.WareHouseName,
model.TotalCostMoney,
model.TotalNumber,
model.Remark,
DetailList = model.DetailList.Select(y => new
{
y.Id,
y.MaterialId,
y.CostMoney,
y.Number,
MaterialModel = new
{
y.MaterialModel.Name,
y.MaterialModel.SuppliesNum,
y.MaterialModel.Units,
y.MaterialModel.Money,
y.MaterialModel.GoodsSpecificationList,
y.MaterialModel.GoodsCategoryList,
y.MaterialModel.GoodsId,
y.MaterialModel.SpecificationKey,
y.MaterialModel.ImageList
}
}),
model.FinanceId
});
}
/// <summary>
/// 获取商品规格列表
/// </summary>
/// <returns></returns>
//[HttpPost]
//public ApiResult GetGoodsToProcurementPageList() {
//}
/// <summary>
/// 提交采购单
/// </summary>
......@@ -122,7 +167,7 @@ namespace Mall.WebApi.Controllers.MallBase
}
}
string msg = propertyModule.SetProcurementInfo(demodel, requestParm.ERPEmpId, requestParm.ERPBranchId, requestParm.ERPGroupId, requestParm.EmpId);
string msg = propertyModule.SetProcurementInfo(demodel, requestParm.ERPEmpId, requestParm.ERPBranchId, requestParm.ERPGroupId, requestParm.TenantId, requestParm.MallBaseId, requestParm.EmpId);
if (msg=="")
{
return ApiResult.Success();
......
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