Commit 816b06b1 authored by 吴春's avatar 吴春
parents d9026760 4c1578c3
This diff is collapsed.
......@@ -3906,7 +3906,7 @@ namespace Mall.Module.Product
goodsRepository.Update(keyValues1, wheres1);
}
}
else if (goodsModel.IsProxy == 2 && demodel.IsProxy == 1 && demodel.GoodsStatus == 1)
else if ((goodsModel.IsProxy == 2 || goodsModel.IsProxy == 1) && demodel.IsProxy == 1 && demodel.GoodsStatus == 1)
{
//启用代理 检测是否有已代理的 同步数据 并采购商品状态
var plist = goods_ProxyRepository.GetList(new RB_Goods_Proxy_Extend() { GoodsId = demodel.Id, MallBaseId = goodsModel.MallBaseId, TenantId = goodsModel.TenantId });
......@@ -3924,6 +3924,7 @@ namespace Mall.Module.Product
{ nameof(RB_Goods.IsGoodsNegotiable),demodel.IsGoodsNegotiable},
{ nameof(RB_Goods.GoodsNumbers),demodel.GoodsNumbers},
{ nameof(RB_Goods.GoodsWeight),demodel.GoodsWeight},
{ nameof(RB_Goods.ProcurementStatus),1},
{ nameof(RB_Goods.UpdateDate),demodel.UpdateDate}
};
List<WhereHelper> wheres2 = new List<WhereHelper>() {
......@@ -3940,18 +3941,19 @@ namespace Mall.Module.Product
{
}
else {
else {
//删除规格
var slist = goods_SpecificationRepository.GetList(new RB_Goods_Specification_Extend() { GoodsId = item.Id, TenantId = item.TenantId, MallBaseId = item.MallBaseId });
var svlist = goods_SpecificationValueRepository.GetList(new RB_Goods_SpecificationValue_Extend() { GoodsId = item.Id, TenantId = item.TenantId, MallBaseId = item.MallBaseId });
var splist = goods_SpecificationPriceRepository.GetList(new RB_Goods_SpecificationPrice_Extend() { GoodsId = item.Id, TenantId = item.TenantId, MallBaseId = item.MallBaseId });
//删除
goods_SpecificationRepository.DeleteBatch(slist);
goods_SpecificationValueRepository.DeleteBatch(svlist);
goods_SpecificationPriceRepository.DeleteBatch(splist);
}
}
}
}
else if (goodsModel.IsProxy == 1 && demodel.IsProxy == 1 && demodel.GoodsStatus == 1)
{
//修改所有采购商品 成本价格 规格
}
#endregion
}
}
......@@ -4704,6 +4706,9 @@ namespace Mall.Module.Product
if (goodsModel == null) {
return ApiResult.Failed("采购商品不存在");
}
if (goodsModel.GoodsStatus != 1) {
return ApiResult.Failed("该商品未上架,无法采购");
}
if (goodsModel.IsProxy != 1) {
return ApiResult.Failed("采购商品不可代理");
}
......@@ -4719,7 +4724,7 @@ namespace Mall.Module.Product
var trans = goodsRepository.DbTransaction;
try
{
{
//复制商品信息
int Id = goodsRepository.Insert(new RB_Goods()
{
......@@ -4779,6 +4784,19 @@ namespace Mall.Module.Product
}, trans);
if (Id > 0)
{
goods_ProxyRepository.Insert(new RB_Goods_Proxy()
{
CreateDate = DateTime.Now,
GoodsId = goodsId,
Id = 0,
MallBaseId = goodsModel.MallBaseId,
TenantId = goodsModel.TenantId,
ProxyGoodsId = Id,
ProxyMallBaseId = mallBaseId,
ProxyTenantId = tenantId,
Remark = "新增采购",
Status = 0
}, trans);
//商品分类
foreach (var item in categoryList) {
goods_CategoryRepository.Insert(new RB_Goods_Category()
......@@ -4891,6 +4909,65 @@ namespace Mall.Module.Product
return flag;
}
/// <summary>
/// 设置采购商品上下架
/// </summary>
/// <param name="goodsId"></param>
/// <param name="type">类型 1上架 2下架</param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public bool SetGoodsProxyStatus(int goodsId, int type, int tenantId, int mallBaseId)
{
var goodsModel = goodsRepository.GetEntity(goodsId);
if (goodsModel == null)
{
return false;
}
if (goodsModel.IsProcurement != 1) {
return false;
}
if (goodsModel.ProcurementStatus != 1) {
return false;
}
int GoodsStatus = 1;
if (type == 1)
{
if (goodsModel.GoodsStatus != 2)
{
return false;
}
}
else {
if (goodsModel.GoodsStatus != 1)
{
return false;
}
GoodsStatus = 2;
}
var pModel = goods_ProxyRepository.GetList(new RB_Goods_Proxy_Extend() { ProxyGoodsId = goodsId, ProxyMallBaseId = mallBaseId, ProxyTenantId = tenantId }).FirstOrDefault();
if (pModel == null) { return false; }
var gModel = goodsRepository.GetEntity(pModel.GoodsId);
if (gModel == null) { return false; }
if (gModel.GoodsStatus == 1 && gModel.IsProxy == 1)
{
Dictionary<string, object> keyValues1 = new Dictionary<string, object>() {
{ nameof(RB_Goods.GoodsStatus),GoodsStatus},
{ nameof(RB_Goods.UpdateDate),DateTime.Now}
};
List<WhereHelper> wheres1 = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Goods.Id),
FiledValue=goodsModel.Id,
OperatorEnum=OperatorEnum.Equal
}
};
return goodsRepository.Update(keyValues1, wheres1);
}
return false;
}
#endregion
#region 商品导入
......
......@@ -1984,6 +1984,7 @@ namespace Mall.WebApi.Controllers.MallBase
//demodel.MallBaseId = parms.MallBaseId;
demodel.IsProxy = 1;
demodel.IsProcurement = 2;
demodel.GoodsStatus = 1;
var list = productModule.GetProductGoodsProxyPageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list.Select(x => new
......@@ -2020,7 +2021,8 @@ namespace Mall.WebApi.Controllers.MallBase
if (GoodsId <= 0) {
return ApiResult.ParamIsNull("请传递商品id");
}
if (string.IsNullOrEmpty(CategoryStr)) {
if (string.IsNullOrEmpty(CategoryStr) || CategoryStr == "[]")
{
return ApiResult.ParamIsNull("请选择分类");
}
List<int> CategoryList = JsonConvert.DeserializeObject<List<int>>(CategoryStr);
......@@ -2054,6 +2056,32 @@ namespace Mall.WebApi.Controllers.MallBase
}
}
/// <summary>
/// 采购商品上下架
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetGoodsProxyStatus() {
var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
int GoodsId = parms.GetInt("GoodsId", 0);
int Type = parms.GetInt("Type", 1);//类型 1上架 2下架
if (GoodsId <= 0)
{
return ApiResult.ParamIsNull("请传递商品id");
}
bool flag = productModule.SetGoodsProxyStatus(GoodsId, Type, req.TenantId, req.MallBaseId);
if (flag)
{
return ApiResult.Success();
}
else
{
return ApiResult.Failed();
}
}
#endregion
#region 商品导入
......
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