Commit 610ef333 authored by 吴春's avatar 吴春

解决冲突

parents 5a07e1d3 0328e912
......@@ -23,4 +23,5 @@ REBORN.DataAccess/obj/
REBORN.DataHelper/obj/
.vs/
Property.Module.Mall/bin/Debug/netcoreapp3.0/Property.Module.Mall.deps.json
Property.Module.Mall/bin/
Property.Module.Mall/obj/
using System;
using REBORN.Common.AOP;
using REBORN.Common.Plugin;
namespace Property.Model.Entity
{
/// <summary>
/// 采购单实体
/// </summary>
[Serializable]
[DB(ConnectionName = "PropertyConnection")]
public class RB_Procurement
{
/// <summary>
/// Id
/// </summary>
public int Id
{
get;
set;
}
/// <summary>
/// 采购仓库
/// </summary>
public int? WareHouseId
{
get;
set;
}
/// <summary>
/// 总成本
/// </summary>
public decimal? TotalCostMoney
{
get;
set;
}
/// <summary>
/// 总数量
/// </summary>
public int? TotalNumber
{
get;
set;
}
/// <summary>
/// 备注
/// </summary>
public string Remark
{
get;
set;
}
/// <summary>
/// 状态 0 正常 1删除
/// </summary>
public int? Status
{
get;
set;
}
/// <summary>
/// 公司
/// </summary>
public int? RB_Branch_Id
{
get;
set;
}
/// <summary>
/// 集团
/// </summary>
public int? RB_Group_Id
{
get;
set;
}
/// <summary>
/// CreateBy
/// </summary>
public int? CreateBy
{
get;
set;
}
/// <summary>
/// CreateDate
/// </summary>
public DateTime? CreateDate
{
get;
set;
}
/// <summary>
/// UpdateBy
/// </summary>
public int? UpdateBy
{
get;
set;
}
/// <summary>
/// UpdateDate
/// </summary>
public DateTime? UpdateDate
{
get;
set;
}
/// <summary>
/// 商户号
/// </summary>
public int TenantId
{
get;
set;
}
/// <summary>
/// 小程序id
/// </summary>
public int MallBaseId
{
get;
set;
}
/// <summary>
/// 财务单据id
/// </summary>
public int? FinanceId { get; set; }
/// <summary>
/// 供应商id
/// </summary>
public int? SupplierId { get; set; }
/// <summary>
/// 供应商名称
/// </summary>
public string SupplierName { get; set; }
/// <summary>
/// 入库状态 1未入库 2部分入库 3已入库
/// </summary>
public int? StockInStatus { get; set; }
}
}
\ No newline at end of file
using System;
using REBORN.Common.AOP;
using REBORN.Common.Plugin;
namespace Property.Model.Entity
{
/// <summary>
/// 采购单明细实体
/// </summary>
[Serializable]
[DB(ConnectionName = "PropertyConnection")]
public class RB_Procurement_Detail
{
/// <summary>
/// Id
/// </summary>
public int Id
{
get;
set;
}
/// <summary>
/// 采购单id
/// </summary>
public int? ProcurementId
{
get;
set;
}
/// <summary>
/// 耗材id
/// </summary>
public int? MaterialId
{
get;
set;
}
/// <summary>
/// 成本价格
/// </summary>
public decimal? CostMoney
{
get;
set;
}
/// <summary>
/// 采购数量
/// </summary>
public int? Number
{
get;
set;
}
/// <summary>
/// 状态 0 正常 1删除
/// </summary>
public int? Status
{
get;
set;
}
/// <summary>
/// 公司
/// </summary>
public int? RB_Branch_Id
{
get;
set;
}
/// <summary>
/// 集团
/// </summary>
public int? RB_Group_Id
{
get;
set;
}
/// <summary>
/// CreateBy
/// </summary>
public int? CreateBy
{
get;
set;
}
/// <summary>
/// CreateDate
/// </summary>
public DateTime? CreateDate
{
get;
set;
}
/// <summary>
/// 商户号
/// </summary>
public int TenantId
{
get;
set;
}
/// <summary>
/// 小程序id
/// </summary>
public int MallBaseId
{
get;
set;
}
/// <summary>
/// 已入库的数量
/// </summary>
public int? StockInNum { get; set; }
}
}
\ No newline at end of file
......@@ -181,5 +181,26 @@ namespace Property.Model.Entity
get;
set;
}
/// <summary>
/// 商品id
/// </summary>
public int? GoodsId { get; set; }
/// <summary>
/// 规格名称
/// </summary>
public string SpecificationName { get; set; }
/// <summary>
/// 规格Key
/// </summary>
public string SpecificationKey { get; set; }
/// <summary>
/// 商品分类ids
/// </summary>
public string GoodsCategoryIds { get; set; }
/// <summary>
/// 商品分类名称
/// </summary>
public string GoodsCategoryName { get; set; }
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using Property.Model.Entity;
using REBORN.Common.AOP;
namespace Property.Model.Extend
{
/// <summary>
/// 꽃뭔데츠玖윈嵐茄竟
/// </summary>
[Serializable]
[DB(ConnectionName = "PropertyConnection")]
public class RB_Procurement_Detail_Extend : RB_Procurement_Detail
{
/// <summary>
/// 꽃뭔데ids
/// </summary>
public string ProcurementIds { get; set; }
/// <summary>
/// 膠죕도갭
/// </summary>
public RB_Supplies_Material_Extend MaterialModel { get; set; }
/// <summary>
/// 방목key
/// </summary>
public string SpecificationKey { get; set; }
/// <summary>
/// /틔id
/// </summary>
public int GoodsId { get; set; }
/// <summary>
/// 구鬧
/// </summary>
public string GoodsRemark { get; set; }
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using Property.Model.Entity;
using REBORN.Common.AOP;
namespace Property.Model.Extend
{
/// <summary>
/// 采购单扩展实体
/// </summary>
[Serializable]
[DB(ConnectionName = "PropertyConnection")]
public class RB_Procurement_Extend : RB_Procurement
{
/// <summary>
/// 商品名称
/// </summary>
public string GoodsName { get; set; }
/// <summary>
/// 商品id
/// </summary>
public int GoodsId { get; set; }
/// <summary>
/// 开始时间
/// </summary>
public string StartTime { get; set; }
/// <summary>
/// 结束时间
/// </summary>
public string EndTime { get; set; }
/// <summary>
/// 创建人
/// </summary>
public string CreateByName { get; set; }
/// <summary>
/// 仓库名称
/// </summary>
public string WareHouseName { get; set; }
/// <summary>
/// 明细列表
/// </summary>
public List<RB_Procurement_Detail_Extend> DetailList { get; set; }
/// <summary>
/// 账户类型
/// </summary>
public int IsPublic { get; set; }
}
}
\ No newline at end of file
......@@ -39,5 +39,13 @@ namespace Property.Model.Extend
/// 档案ids
/// </summary>
public string SuppliesIdStr { get; set; }
/// <summary>
/// 商品规格
/// </summary>
public List<string> GoodsSpecificationList { get; set; }
/// <summary>
/// 商品分类
/// </summary>
public List<string> GoodsCategoryList { get; set; }
}
}
\ No newline at end of file
......@@ -59,6 +59,17 @@ namespace Property.Module.FixedAssets
/// 分类
/// </summary>
private readonly RB_Property_CategoryRepository property_CategoryRepository = new RB_Property_CategoryRepository();
/// <summary>
/// 采购单
/// </summary>
private readonly RB_ProcurementRepository procurementRepository = new RB_ProcurementRepository();
/// <summary>
/// 采购单明细
/// </summary>
private readonly RB_Procurement_DetailRepository procurement_DetailRepository = new RB_Procurement_DetailRepository();
/// <summary>
/// 获取物料详情
......@@ -120,6 +131,16 @@ namespace Property.Module.FixedAssets
item.ImageList.Add(Config.GetFileUrl(img));
}
item.InventoryNum = iList.Where(x => x.SuppliesId == item.Id).FirstOrDefault()?.Number ?? 0;
item.GoodsSpecificationList = new List<string>();
item.GoodsCategoryList = new List<string>();
if (!string.IsNullOrEmpty(item.SpecificationName))
{
item.GoodsSpecificationList = JsonConvert.DeserializeObject<List<string>>(item.SpecificationName);
}
if (!string.IsNullOrEmpty(item.GoodsCategoryName))
{
item.GoodsCategoryList = JsonConvert.DeserializeObject<List<string>>(item.GoodsCategoryName);
}
}
return list;
}
......@@ -1667,5 +1688,121 @@ namespace Property.Module.FixedAssets
}
#endregion
#region 采购单
/// <summary>
/// 获取采购单分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="demodel"></param>
/// <param name="count"></param>
/// <returns></returns>
public List<RB_Procurement_Extend> GetProcurementPageList(int pageIndex, int pageSize, RB_Procurement_Extend demodel, out long count)
{
var list = procurementRepository.GetPageList(pageIndex, pageSize, demodel, out count);
if (list.Any())
{
string procurementIds = string.Join(",", list.Select(x => x.Id));
//查询明细
var pdList = procurement_DetailRepository.GetList(new RB_Procurement_Detail_Extend() { RB_Group_Id = demodel.RB_Group_Id, ProcurementIds = procurementIds });
//查询物料
if (pdList.Any())
{
string MaterialIds = string.Join(",", pdList.Select(x => x.MaterialId).Distinct());
var mList = supplies_MaterialRepository.GetList(new RB_Supplies_Material_Extend() { RB_Group_Id = demodel.RB_Group_Id, SuppliesIdStr = MaterialIds });
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 = "[]";
}
item.MaterialModel.ImageList = JsonConvert.DeserializeObject<List<string>>(item.MaterialModel.Images);
}
else
{
item.MaterialModel = new RB_Supplies_Material_Extend();
}
}
}
var wlist = supplies_WareHouseRepository.GetList(new RB_Supplies_WareHouse_Extend() { RB_Group_Id = demodel.RB_Group_Id, 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();
item.WareHouseName = wlist.Where(x => x.Id == item.WareHouseId).FirstOrDefault()?.Name ?? "";
}
}
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 ERPGroupId)
{
var pmodel = procurementRepository.GetEntity<RB_Procurement_Extend>(procurementId);
//查询明细
var pdList = procurement_DetailRepository.GetList(new RB_Procurement_Detail_Extend() { RB_Group_Id = ERPGroupId, ProcurementId = procurementId });
//查询物料
if (pdList.Any())
{
string MaterialIds = string.Join(",", pdList.Select(x => x.MaterialId).Distinct());
var mList = supplies_MaterialRepository.GetList(new RB_Supplies_Material_Extend() { RB_Group_Id = ERPGroupId, SuppliesIdStr = MaterialIds });
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 = "[]";
}
item.MaterialModel.ImageList = JsonConvert.DeserializeObject<List<string>>(item.MaterialModel.Images);
}
else
{
item.MaterialModel = new RB_Supplies_Material_Extend();
}
}
}
var wlist = supplies_WareHouseRepository.GetList(new RB_Supplies_WareHouse_Extend() { RB_Group_Id = ERPGroupId, WareHouseIdStr = (pmodel.WareHouseId ?? 0).ToString() });
pmodel.DetailList = pdList;
pmodel.WareHouseName = wlist.FirstOrDefault()?.Name ?? "";
return pmodel;
}
#endregion
}
}
using Property.Model.Entity;
using Property.Model.Extend;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Property.Repository
{
/// <summary>
/// 采购单仓储类
/// </summary>
public partial class RB_ProcurementRepository : RepositoryBase<RB_Procurement>
{
/// <summary>
/// 获取采购单分页数据
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="dmodel"></param>
/// <param name="count"></param>
/// <returns></returns>
public List<RB_Procurement_Extend> GetPageList(int pageIndex, int pageSize, RB_Procurement_Extend dmodel, out long count)
{
string where = " where 1=1 ";
where += string.Format(" AND p.{0}={1}", nameof(RB_Procurement_Extend.Status), 0);
where += $@" and p.RB_Group_Id={dmodel.RB_Group_Id}";
if (!string.IsNullOrWhiteSpace(dmodel.GoodsName))
{
where += " and m." + nameof(RB_Supplies_Material_Extend.Name) + " like '%" + dmodel.GoodsName + "%'";
}
if (dmodel.GoodsId > 0)
{
where += " and m." + nameof(RB_Supplies_Material_Extend.GoodsId) + "=" + dmodel.GoodsId;
}
if (dmodel.TenantId > 0)
{
where += " and p." + nameof(RB_Procurement_Extend.TenantId) + "=" + dmodel.TenantId;
}
if (dmodel.MallBaseId > 0)
{
where += " and p." + nameof(RB_Procurement_Extend.MallBaseId) + "=" + dmodel.MallBaseId;
}
if (!string.IsNullOrEmpty(dmodel.StartTime))
{
where += " and p.CreateTime >='" + dmodel.StartTime + "'";
}
if (!string.IsNullOrEmpty(dmodel.EndTime))
{
where += " and p.CreateTime <='" + dmodel.EndTime + " 23:59:59'";
}
if (dmodel.StockInStatus > 0) {
where += " and p." + nameof(RB_Procurement_Extend.StockInStatus) + "=" + dmodel.StockInStatus;
}
string sql = $@" SELECT p.* FROM rb_procurement p
INNER JOIN rb_procurement_detail pd on p.Id = pd.ProcurementId
INNER JOIN rb_supplies_material m on pd.MaterialId = m.Id
{where}
GROUP BY p.Id order by p.Id desc";
return GetPage<RB_Procurement_Extend>(pageIndex, pageSize, out count, sql).ToList();
}
}
}
using Property.Model.Entity;
using Property.Model.Extend;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Property.Repository
{
/// <summary>
/// 采购单仓储类
/// </summary>
public partial class RB_Procurement_DetailRepository : RepositoryBase<RB_Procurement_Detail>
{
/// <summary>
/// 获取采购单分页数据
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="dmodel"></param>
/// <param name="count"></param>
/// <returns></returns>
public List<RB_Procurement_Detail_Extend> GetList(RB_Procurement_Detail_Extend dmodel)
{
string where = " where 1=1 ";
where += string.Format(" AND p.{0}={1}", nameof(RB_Procurement_Detail_Extend.Status), 0);
where += $@" and p.RB_Group_Id={dmodel.RB_Group_Id}";
if (dmodel.TenantId > 0)
{
where += " and p." + nameof(RB_Procurement_Detail_Extend.TenantId) + "=" + dmodel.TenantId;
}
if (dmodel.MallBaseId > 0)
{
where += " and p." + nameof(RB_Procurement_Detail_Extend.MallBaseId) + "=" + dmodel.MallBaseId;
}
if (dmodel.ProcurementId > 0)
{
where += " and p." + nameof(RB_Procurement_Detail_Extend.ProcurementId) + "=" + dmodel.ProcurementId;
}
if (!string.IsNullOrEmpty(dmodel.ProcurementIds))
{
where += " and p." + nameof(RB_Procurement_Detail_Extend.ProcurementId) + " in(" + dmodel.ProcurementIds + ")";
}
if (dmodel.MaterialId > 0)
{
where += " and p." + nameof(RB_Procurement_Detail_Extend.MaterialId) + "=" + dmodel.MaterialId;
}
string sql = $@" SELECT * FROM RB_Procurement_Detail p {where} order by p.Id desc";
return Get<RB_Procurement_Detail_Extend>(sql).ToList();
}
}
}
......@@ -50,6 +50,8 @@ namespace Property.WebApi.Controllers.User
x.SuppliesModel,
x.SuppliesNum,
x.InventoryNum,
x.GoodsSpecificationList,
x.GoodsCategoryList,
UpdateBy = CacheManager.User.UserReidsCache.GetEmployee(x.UpdateBy)?.EmName ?? "",
UpdateDate = x.UpdateDate.Value.ToString("yyyy-MM-dd")
});
......@@ -1390,5 +1392,110 @@ namespace Property.WebApi.Controllers.User
#endregion
#region 采购单
/// <summary>
/// 获取采购单分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetProcurementPageList()
{
var requestParm = GetRequestParm();
UserInfo userInfo = CacheManager.User.UserReidsCache.GetUserLoginInfo(requestParm.uid);
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(requestParm.msg.ToString());
RB_Procurement_Extend demodel = JsonConvert.DeserializeObject<RB_Procurement_Extend>(requestParm.msg.ToString());
demodel.RB_Group_Id = userInfo.RB_Group_id;
var list = suppliesModule.GetProcurementPageList(pagelist.pageIndex, pagelist.pageSize, demodel, out long count);
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list.Select(x => new
{
x.Id,
x.WareHouseId,
x.WareHouseName,
x.TotalCostMoney,
x.TotalNumber,
x.Remark,
x.StockInStatus,
DetailList = x.DetailList.Select(y => new
{
y.Id,
y.MaterialId,
y.CostMoney,
y.Number,
y.StockInNum,
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
}
}),
x.FinanceId,
CreateBy = (CacheManager.User.UserReidsCache.GetEmployee(x.CreateBy)?.EmName ?? ""),
CreateDate = x.CreateDate.Value.ToString("yyyy-MM-dd")
});
return ApiResult.Success("", pagelist);
}
/// <summary>
/// 获取采购单详情
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetProcurementInfo()
{
var requestParm = GetRequestParm();
UserInfo userInfo = CacheManager.User.UserReidsCache.GetUserLoginInfo(requestParm.uid);
JObject parms = JObject.Parse(requestParm.msg.ToString());
int ProcurementId = parms.GetInt("ProcurementId", 0);
if (ProcurementId <= 0)
{
return ApiResult.ParamIsNull("请传递参数");
}
var model = suppliesModule.GetProcurementInfo(ProcurementId, userInfo.RB_Group_id);
return ApiResult.Success("", new
{
model.Id,
model.WareHouseId,
model.WareHouseName,
model.TotalCostMoney,
model.TotalNumber,
model.Remark,
model.StockInStatus,
DetailList = model.DetailList.Select(y => new
{
y.Id,
y.MaterialId,
y.CostMoney,
y.Number,
y.StockInNum,
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
});
}
#endregion
}
}
......@@ -2,7 +2,7 @@
"ConnectionStrings": {
"DefaultConnection": "server=192.168.2.214;port=3306;user id=reborn;password=Reborn@2018;database=reborn_user;CharSet=utf8; Convert Zero Datetime=true; ",
"DefaultConnectionPName": "MySql.Data.MySqlClient",
"PropertyConnection": "server=192.168.2.214;port=3306;user id=reborn;password=Reborn@2018;database=property;CharSet=utf8; Convert Zero Datetime=true; ",
"PropertyConnection": "server=192.168.2.214;port=3306;user id=reborn;password=Reborn@2018;database=test_property;CharSet=utf8; Convert Zero Datetime=true; ",
"PropertyConnectionPName": "MySql.Data.MySqlClient",
"FinanceConnection": "server=192.168.2.214;port=3306;user id=reborn;password=Reborn@2018;database=test_reborn_finance;CharSet=utf8; Convert Zero Datetime=true; ",
"FinanceConnectionPName": "MySql.Data.MySqlClient",
......
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