From f43970a061d3c90520b4e8f48caa17a204d9a085 Mon Sep 17 00:00:00 2001
From: 移动系统liao <liaoxujun@qq.com>
Date: 星期四, 15 八月 2024 10:19:38 +0800
Subject: [PATCH] 完供应商自主维护商品api和后台基础管理页面
---
CoreCms.Net.Web.Admin/Controllers/Stock/CoreCmsStockController.cs | 63 ++++++++++++++++++++++++++-----
1 files changed, 53 insertions(+), 10 deletions(-)
diff --git a/CoreCms.Net.Web.Admin/Controllers/Stock/CoreCmsStockController.cs b/CoreCms.Net.Web.Admin/Controllers/Stock/CoreCmsStockController.cs
index e5ca9e8..f641727 100644
--- a/CoreCms.Net.Web.Admin/Controllers/Stock/CoreCmsStockController.cs
+++ b/CoreCms.Net.Web.Admin/Controllers/Stock/CoreCmsStockController.cs
@@ -1,10 +1,10 @@
/***********************************************************************
- * Project: CoreCms
- * ProjectName: 鏍稿績鍐呭绠$悊绯荤粺
- * Web: https://www.corecms.net
- * Author: 澶х伆鐏�
- * Email: jianweie@163.com
- * CreateTime: 2021/1/31 21:45:10
+ * Project: baifenBinfa
+ * ProjectName: 鐧惧垎鍏垫硶绠$悊绯荤粺
+ * Web: http://chuanyin.com
+ * Author:
+ * Email:
+ * CreateTime: 202403/02
* Description: 鏆傛棤
***********************************************************************/
@@ -31,6 +31,9 @@
using Microsoft.AspNetCore.Mvc;
using NPOI.HSSF.UserModel;
using SqlSugar;
+using CoreCms.Net.Services;
+using Essensoft.Paylink.Alipay.Domain;
+using CoreCms.Net.Services.Basic;
namespace CoreCms.Net.Web.Admin.Controllers
{
@@ -50,12 +53,18 @@
private readonly ICoreCmsStockLogServices _stockLogServices;
private readonly ISysUserServices _sysUserServices;
private readonly IHttpContextUser _user;
+ private readonly ICoreCmsDistributionServices _coreCmsDistributionServices;
+ private readonly ICoreCmsAreaServices _coreCmsAreaServices;
+ private readonly ICoreCmsGoodsCategoryServices _coreCmsGoodsCategoryServices;
/// <summary>
/// 鏋勯�犲嚱鏁�
///</summary>
public CoreCmsStockController(IWebHostEnvironment webHostEnvironment
- , ICoreCmsStockServices stockServices, ICoreCmsProductsServices productsServices, IHttpContextUser user, ICoreCmsStockLogServices stockLogServices, ISysUserServices sysUserServices)
+ , ICoreCmsStockServices stockServices, ICoreCmsProductsServices productsServices, IHttpContextUser user, ICoreCmsStockLogServices stockLogServices, ISysUserServices sysUserServices
+ , ICoreCmsDistributionServices coreCmsDistributionServices
+ , ICoreCmsAreaServices coreCmsAreaServices
+ , ICoreCmsGoodsCategoryServices coreCmsGoodsCategoryServices)
{
_webHostEnvironment = webHostEnvironment;
_stockServices = stockServices;
@@ -63,6 +72,9 @@
_user = user;
_stockLogServices = stockLogServices;
_sysUserServices = sysUserServices;
+ _coreCmsDistributionServices = coreCmsDistributionServices;
+ _coreCmsAreaServices = coreCmsAreaServices;
+ _coreCmsGoodsCategoryServices = coreCmsGoodsCategoryServices;
}
#region 鑾峰彇鍒楄〃============================================================
@@ -167,16 +179,20 @@
/// <returns></returns>
[HttpPost]
[Description("棣栭〉鏁版嵁")]
- public AdminUiCallBack GetIndex()
+ public async Task<AdminUiCallBack> GetIndex()
{
//杩斿洖鏁版嵁
var jm = new AdminUiCallBack { code = 0 };
var stockType = EnumHelper.EnumToList<GlobalEnumVars.StockType>();
stockType = stockType.Where(p => p.value < 3).ToList();
+
+ var categories = await _coreCmsGoodsCategoryServices.QueryListByClauseAsync(p => p.isShow, p => p.sort, OrderByType.Asc, true, true);
+ var categoriesTree = GoodsHelper.GetTree(categories, false);
jm.data = new
{
- stockType,
+ stockType
+
};
return jm;
}
@@ -199,10 +215,13 @@
var products = await _productsServices.GetProducts();
+ var distributions = await _coreCmsDistributionServices.QueryListByClauseAsync(p => p.isDelete == false && p.verifyStatus == 1 && p.profession == "鏍″洯浠g悊", p => p.createTime, OrderByType.Desc, true, true);
+
jm.data = new
{
stockType,
products,
+ distributions
};
return jm;
@@ -220,6 +239,8 @@
[Description("鍒涘缓鎻愪氦")]
public async Task<AdminUiCallBack> DoCreate([FromBody] FMCreateStock entity)
{
+ //杩斿洖鏁版嵁
+ var jm = new AdminUiCallBack { code = 0 };
if (_user != null)
{
entity.model.manager = _user.ID;
@@ -228,8 +249,30 @@
{
entity.model.manager = 0;
}
+ var distributions = new CoreCmsDistribution();
+ if (entity.model.type == 3)
+ {
+ if (entity.model.distributionId == 0)
+ {
+ jm.msg = "璇烽�夋嫨缁忛攢鍟�";
+ return jm;
+ }
- var jm = await _stockServices.InsertAsync(entity);
+ distributions = await _coreCmsDistributionServices.QueryByIdAsync(entity.model.distributionId);
+ if (distributions != null)
+ {
+
+ var d = await _coreCmsAreaServices.GetAreaFullName(distributions.areaCode?.Split(",").ToList().OrderDescending()?.FirstOrDefault()?.ToInt32OrDefault(0) ?? 0);
+ if (d.status == true)
+ {
+ distributions.areaName = d.data.ToString();
+ }
+
+ }
+ }
+
+
+ jm = await _stockServices.InsertAsync(entity,_user.Name, distributions);
return jm;
}
#endregion
--
Gitblit v1.9.1