| | |
| | | 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 |
| | | { |
| | |
| | | private readonly ICoreCmsStockLogServices _stockLogServices; |
| | | private readonly ISysUserServices _sysUserServices; |
| | | private readonly IHttpContextUser _user; |
| | | private readonly ICoreCmsGoodsCategoryServices _coreCmsGoodsCategoryServices; |
| | | 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, |
| | | ICoreCmsGoodsCategoryServices coreCmsGoodsCategoryServices) |
| | | , ICoreCmsStockServices stockServices, ICoreCmsProductsServices productsServices, IHttpContextUser user, ICoreCmsStockLogServices stockLogServices, ISysUserServices sysUserServices |
| | | , ICoreCmsDistributionServices coreCmsDistributionServices |
| | | , ICoreCmsAreaServices coreCmsAreaServices |
| | | , ICoreCmsGoodsCategoryServices coreCmsGoodsCategoryServices) |
| | | { |
| | | _webHostEnvironment = webHostEnvironment; |
| | | _stockServices = stockServices; |
| | |
| | | _user = user; |
| | | _stockLogServices = stockLogServices; |
| | | _sysUserServices = sysUserServices; |
| | | _coreCmsDistributionServices = coreCmsDistributionServices; |
| | | _coreCmsAreaServices = coreCmsAreaServices; |
| | | _coreCmsGoodsCategoryServices = coreCmsGoodsCategoryServices; |
| | | |
| | | } |
| | | |
| | | #region 获取列表============================================================ |
| | |
| | | |
| | | var products = await _productsServices.GetProducts(); |
| | | |
| | | var distributions = await _coreCmsDistributionServices.QueryListByClauseAsync(p => p.isDelete == false && p.verifyStatus == 1 && p.profession == "校园代理", p => p.createTime, OrderByType.Desc, true, true); |
| | | |
| | | jm.data = new |
| | | { |
| | | stockType, |
| | | products, |
| | | distributions |
| | | }; |
| | | |
| | | return jm; |
| | |
| | | [Description("创建提交")] |
| | | public async Task<AdminUiCallBack> DoCreate([FromBody] FMCreateStock entity) |
| | | { |
| | | //返回数据 |
| | | var jm = new AdminUiCallBack { code = 0 }; |
| | | if (_user != null) |
| | | { |
| | | entity.model.manager = _user.ID; |
| | |
| | | { |
| | | 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 |