diff --git a/.vs/BPA.SAAS.Manage/v17/.futdcache.v1 b/.vs/BPA.SAAS.Manage/v17/.futdcache.v1
new file mode 100644
index 0000000..d32a98e
Binary files /dev/null and b/.vs/BPA.SAAS.Manage/v17/.futdcache.v1 differ
diff --git a/BPA.SAAS.Manage.Application/DataBase/BomServices.cs b/BPA.SAAS.Manage.Application/DataBase/BomServices.cs
index 8216827..1a15719 100644
--- a/BPA.SAAS.Manage.Application/DataBase/BomServices.cs
+++ b/BPA.SAAS.Manage.Application/DataBase/BomServices.cs
@@ -125,7 +125,7 @@ namespace BPA.SAAS.Manage.Application.DataBase
///
/// 删除配方
///
- ///
+ ///
///
[HttpPost("/api/bom/DelBom")]
public async Task DelBom(string id)
diff --git a/BPA.SAAS.Manage.Application/DataBase/Dtos/Goods/BatchingModel.cs b/BPA.SAAS.Manage.Application/DataBase/Dtos/Goods/BatchingModel.cs
index bb1e3fd..5e6972c 100644
--- a/BPA.SAAS.Manage.Application/DataBase/Dtos/Goods/BatchingModel.cs
+++ b/BPA.SAAS.Manage.Application/DataBase/Dtos/Goods/BatchingModel.cs
@@ -9,7 +9,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Dtos.Goods
{
public class BatchingModel
{
- [Column("仓位号")]
+ [Column("仓位")]
public string Index { get; set; }
[Column("物料名称")]
public string BatchingName { get; set; }
diff --git a/BPA.SAAS.Manage.Application/DataBase/Dtos/Goods/GoodsTechnologyImportDto.cs b/BPA.SAAS.Manage.Application/DataBase/Dtos/Goods/GoodsTechnologyImportDto.cs
new file mode 100644
index 0000000..3c69d33
--- /dev/null
+++ b/BPA.SAAS.Manage.Application/DataBase/Dtos/Goods/GoodsTechnologyImportDto.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPA.SAAS.Manage.Application.DataBase.Dtos.Goods
+{
+ public class GoodsTechnologyImportDto
+ {
+ ///
+ /// 文件
+ ///
+ public IFormFile file { get; set; }
+ }
+
+ public class GoodsTechnologyExportDto
+ {
+ ///
+ /// 商品Id
+ ///
+ public string GoodId { get; set; }
+ ///
+ /// 设备Id
+ ///
+ public string DeviceId { get; set; }
+ ///
+ /// 文档名
+ ///
+ public string FileName { get; set; }
+ }
+}
diff --git a/BPA.SAAS.Manage.Application/DataBase/Dtos/Goods/GoodsTechnologyImportModel.cs b/BPA.SAAS.Manage.Application/DataBase/Dtos/Goods/GoodsTechnologyImportModel.cs
new file mode 100644
index 0000000..aab0f7d
--- /dev/null
+++ b/BPA.SAAS.Manage.Application/DataBase/Dtos/Goods/GoodsTechnologyImportModel.cs
@@ -0,0 +1,31 @@
+using Npoi.Mapper.Attributes;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPA.SAAS.Manage.Application.DataBase.Dtos.Goods
+{
+ public class GoodsTechnologyDataModel
+ {
+ public string Ids { get; set; }
+ public string Names { get; set; }
+ public List Values { get; set; }
+ }
+ public class GoodsTechnologyValueModel
+ {
+ public string StepName { get;set; }
+ public string ActionName { get;set; }
+ public string ActionValue { get;set; }
+ public string Index { get;set; }
+ }
+
+ public class ActionJsonModel
+ {
+ public string actionName { get;set; }
+ public string actionValue { get;set; }
+ public string technologyactionId { get;set; }
+ public string index { get;set;}
+ }
+}
diff --git a/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsTechnology/GoodsTechnologDelete.cs b/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsTechnology/GoodsTechnologDelete.cs
index f17ffbd..e93c95e 100644
--- a/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsTechnology/GoodsTechnologDelete.cs
+++ b/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsTechnology/GoodsTechnologDelete.cs
@@ -11,5 +11,6 @@ namespace BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsTechnology
public string devideId { get; set; }
public string goodsId { get; set; }
public string goodsAttributeId { get; set; }
+ public string warehousrTemplateId { get; set; }
}
}
diff --git a/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsTechnology/GoodsTechnologyActionListView.cs b/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsTechnology/GoodsTechnologyActionListView.cs
index 25a2727..0d7cd63 100644
--- a/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsTechnology/GoodsTechnologyActionListView.cs
+++ b/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsTechnology/GoodsTechnologyActionListView.cs
@@ -12,6 +12,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsTechnology
public string WarehousrTemplateId { get; set; }
public string GoodsAttributeId { get; set; }
public string DeviceName { get; set; }
+ public int Order { get; set; }
public List Data { get; set; }
}
public class GoodsTechnologyActionView
@@ -44,6 +45,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsTechnology
public string GoodsId { get; set; }
public string DeviceId { get; set; }
public string WarehousrTemplateId { get; set; }
+ public int Order { get; set; }
}
public class DeviceTechnologyActionListView
diff --git a/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsTechnology/GoodsTechnologyQueryDto.cs b/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsTechnology/GoodsTechnologyQueryDto.cs
new file mode 100644
index 0000000..0fe8349
--- /dev/null
+++ b/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsTechnology/GoodsTechnologyQueryDto.cs
@@ -0,0 +1,15 @@
+using BPA.SAAS.Manage.Core.Base;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsTechnology
+{
+ public class GoodsTechnologyQueryDto : PageInputBase
+ {
+ public string GoodsId { get; set; }
+ public string DeviceName { get; set; }
+ }
+}
diff --git a/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsType/GoodsTypeDto.cs b/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsType/GoodsTypeDto.cs
index 5d21114..e152948 100644
--- a/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsType/GoodsTypeDto.cs
+++ b/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsType/GoodsTypeDto.cs
@@ -1,4 +1,5 @@
-using System;
+using BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsAttribute;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -14,5 +15,19 @@ namespace BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsType
public int Sort { get; set; }
public int Status { get; set; }
public string Remark { get; set; }
+ public List AttributeList { get; set; }
+ }
+
+ public class AttributeDto
+ {
+ public string AttributeName { get; set; }
+ public int Sort { get; set; }
+ public List AttributeValueList { get; set; }
+ }
+
+ public class AttributeValueDto
+ {
+ public string AttributeValue { get; set; }
+ public int Sort { get; set; }
}
}
diff --git a/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsType/GoodsTypeTree.cs b/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsType/GoodsTypeTree.cs
index 8107a62..60734e5 100644
--- a/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsType/GoodsTypeTree.cs
+++ b/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsType/GoodsTypeTree.cs
@@ -1,4 +1,5 @@
-using BPA.SAAS.Manage.Comm.Enum;
+using BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsAttribute;
+using BPA.SAAS.Manage.Comm.Enum;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -17,5 +18,6 @@ namespace BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsType
public CommonStatus Status { get; set; }
public string Pid { get; set; }//父级字段
public List Children { get; set; }
+ public List GoodsAttributeViewList { get;set; }
}
}
diff --git a/BPA.SAAS.Manage.Application/DataBase/GoodsAttributeServices.cs b/BPA.SAAS.Manage.Application/DataBase/GoodsAttributeServices.cs
index ad6d86a..ad6e77a 100644
--- a/BPA.SAAS.Manage.Application/DataBase/GoodsAttributeServices.cs
+++ b/BPA.SAAS.Manage.Application/DataBase/GoodsAttributeServices.cs
@@ -98,6 +98,15 @@ namespace BPA.SAAS.Manage.Application.DataBase
{
return await _goodsAttributeServices.GetByGoodsIdAttribute(id);
}
-
+ ///
+ /// 获取商品属性和属性值
+ ///
+ ///
+ ///
+ [HttpPost("/api/goodsattribute/GetGoodsAttributeList")]
+ public async Task> GetGoodsAttributeViewList(string id)
+ {
+ return await _goodsAttributeServices.GetGoodsAttributeViewList(id);
+ }
}
}
diff --git a/BPA.SAAS.Manage.Application/DataBase/GoodsServices.cs b/BPA.SAAS.Manage.Application/DataBase/GoodsServices.cs
index fe18661..c88368f 100644
--- a/BPA.SAAS.Manage.Application/DataBase/GoodsServices.cs
+++ b/BPA.SAAS.Manage.Application/DataBase/GoodsServices.cs
@@ -192,5 +192,26 @@ namespace BPA.SAAS.Manage.Application.DataBase
{
return await _goodsService.DeviceVersionTemplateImport(inputDto);
}
+
+ ///
+ /// 商品工艺导入
+ ///
+ ///
+ ///
+ [HttpPost("/api/goods/goodsTechnologyImport"), NonUnify]
+ public async Task GoodsTechnologyImport([FromForm]GoodsTechnologyImportDto importDto)
+ {
+ return await _goodsService.GoodsTechnologyImport(importDto);
+ }
+
+ ///
+ /// 商品工艺导出
+ ///
+ ///
+ [HttpPost("/api/goods/goodsTechnologyExport"), NonUnify]
+ public async Task GoodsTechnologyExport(GoodsTechnologyExportDto exportDto)
+ {
+ return await _goodsService.GoodsTechnologyExport(exportDto);
+ }
}
}
diff --git a/BPA.SAAS.Manage.Application/DataBase/GoodsTechnologyService.cs b/BPA.SAAS.Manage.Application/DataBase/GoodsTechnologyService.cs
index a9681fc..38b2b81 100644
--- a/BPA.SAAS.Manage.Application/DataBase/GoodsTechnologyService.cs
+++ b/BPA.SAAS.Manage.Application/DataBase/GoodsTechnologyService.cs
@@ -113,9 +113,15 @@ namespace BPA.SAAS.Manage.Application.DataBase
return await _goodsTechnologyService.CopyTechnologyAction(param);
}
-
-
-
-
+ ///
+ /// 根据设备获取工艺(分页)
+ ///
+ ///
+ ///
+ [HttpPost("/api/goodstechnology/GetGoodsTechnologyPage")]
+ public async Task GetGoodsTechnologyPage(GoodsTechnologyQueryDto dto)
+ {
+ return await _goodsTechnologyService.GetGoodsTechnologyPage(dto);
+ }
}
}
diff --git a/BPA.SAAS.Manage.Application/DataBase/Interface/IGoodsAttributeService.cs b/BPA.SAAS.Manage.Application/DataBase/Interface/IGoodsAttributeService.cs
index 1ad1260..edc9b83 100644
--- a/BPA.SAAS.Manage.Application/DataBase/Interface/IGoodsAttributeService.cs
+++ b/BPA.SAAS.Manage.Application/DataBase/Interface/IGoodsAttributeService.cs
@@ -59,5 +59,11 @@ namespace BPA.SAAS.Manage.Application.DataBase.Interface
///
Task> GetByGoodsIdAttribute(string id);
Task> GetByNameAttribute(string name);
+ ///
+ /// 获取商品属性和属性值
+ ///
+ ///
+ ///
+ Task> GetGoodsAttributeViewList(string id);
}
}
diff --git a/BPA.SAAS.Manage.Application/DataBase/Interface/IGoodsService.cs b/BPA.SAAS.Manage.Application/DataBase/Interface/IGoodsService.cs
index 920fa99..29f725a 100644
--- a/BPA.SAAS.Manage.Application/DataBase/Interface/IGoodsService.cs
+++ b/BPA.SAAS.Manage.Application/DataBase/Interface/IGoodsService.cs
@@ -102,5 +102,18 @@ namespace BPA.SAAS.Manage.Application.DataBase.Interface
///
///
Task DeviceVersionTemplateImport(DeviceVersionTemplateImportInputDto inputDto);
+
+ ///
+ /// 商品工艺导入
+ ///
+ ///
+ ///
+ Task GoodsTechnologyImport([FromForm] GoodsTechnologyImportDto importDto);
+
+ ///
+ /// 商品工艺导出
+ ///
+ ///
+ Task GoodsTechnologyExport(GoodsTechnologyExportDto exportDto);
}
}
diff --git a/BPA.SAAS.Manage.Application/DataBase/Interface/IGoodsTechnologyService.cs b/BPA.SAAS.Manage.Application/DataBase/Interface/IGoodsTechnologyService.cs
index 7af6823..b979d9c 100644
--- a/BPA.SAAS.Manage.Application/DataBase/Interface/IGoodsTechnologyService.cs
+++ b/BPA.SAAS.Manage.Application/DataBase/Interface/IGoodsTechnologyService.cs
@@ -25,5 +25,6 @@ namespace BPA.SAAS.Manage.Application.DataBase.Interface
Task CopyTechnologyAction(IputParam param);
+ Task GetGoodsTechnologyPage(GoodsTechnologyQueryDto dto);
}
}
diff --git a/BPA.SAAS.Manage.Application/DataBase/Services/BomService.cs b/BPA.SAAS.Manage.Application/DataBase/Services/BomService.cs
index 458aa6b..d24db15 100644
--- a/BPA.SAAS.Manage.Application/DataBase/Services/BomService.cs
+++ b/BPA.SAAS.Manage.Application/DataBase/Services/BomService.cs
@@ -337,7 +337,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
///
/// 删除配方
///
- ///
+ ///
///
public async Task DelBom(string id)
{
@@ -345,8 +345,9 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
try
{
_db.Ado.BeginTran();
- await _db.Deleteable().Where(x => x.Id == id).ExecuteCommandAsync();
- await _db.Deleteable().Where(x => x.BomId == id).ExecuteCommandAsync();
+ var ids = id.Split(",");
+ await _db.Deleteable().Where(x =>ids.Contains(x.Id)).ExecuteCommandAsync();
+ await _db.Deleteable().Where(x => ids.Contains(x.BomId)).ExecuteCommandAsync();
_db.Ado.CommitTran();
return true;
}
diff --git a/BPA.SAAS.Manage.Application/DataBase/Services/GoodsAttributeService.cs b/BPA.SAAS.Manage.Application/DataBase/Services/GoodsAttributeService.cs
index 4b7f230..5b59940 100644
--- a/BPA.SAAS.Manage.Application/DataBase/Services/GoodsAttributeService.cs
+++ b/BPA.SAAS.Manage.Application/DataBase/Services/GoodsAttributeService.cs
@@ -361,6 +361,32 @@ namespace BPA.Franchisee.Application.FranchiseeCenter.GoodsServices
.ToListAsync();
return goodsAttributeList;
}
-
+ ///
+ /// 获取商品属性和属性值
+ ///
+ ///
+ ///
+ public async Task> GetGoodsAttributeViewList(string id)
+ {
+ var goodType = await _db.Queryable().Where(x => x.Id == id).FirstAsync();
+ if (goodType == null) throw Oops.Oh("商品分类不存在");
+ var res = await _db.Queryable()
+ .Where(a => a.IsDeleted == 0)
+ .WhereIF(!id.IsNullOrWhiteSpace(), x => x.GoodsTypeId.Contains(id))
+ .OrderBy(a => a.CreateAt, OrderByType.Desc)
+ .Select(a => new GoodsAttributeView
+ {
+ Id = a.Id,
+ AttributeName = a.AttributeName,
+ GoodsTypeId = a.GoodsTypeId,
+ Sort = a.Sort,
+ })
+ .Mapper(x =>
+ {
+ var list = _db.Queryable().Where(p => p.GoodsAttributeId == x.Id).OrderBy(x => x.Sort).ToList();
+ x.AttributeValueList = list;
+ }).ToListAsync();
+ return res;
+ }
}
}
diff --git a/BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs b/BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs
index b1ad3db..259f0e1 100644
--- a/BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs
+++ b/BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs
@@ -16,6 +16,7 @@ using BPA.SAAS.Manage.Core.DataBase;
using BPA.SAAS.Manage.Core.Device;
using BPA.SAAS.Manage.Core.Product;
using Furion.ClayObject.Extensions;
+using Microsoft.AspNetCore.Hosting;
using Newtonsoft.Json;
using Npoi.Mapper;
using NPOI.HSSF.UserModel;
@@ -32,6 +33,7 @@ using System.Drawing.Imaging;
using System.Linq;
using System.Reflection;
using System.Text;
+using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace BPA.SAAS.Manage.Application.DataBase.Services
@@ -42,12 +44,14 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
IGoodsAttributeService _goodsAttributeService;
ISystemConfigService _SystemConfigService;
IAliyunOssService _aliyunOssService;
- public GoodsService(ISqlSugarClient db, IGoodsAttributeService goodsAttributeService, ISystemConfigService SystemConfigService, IAliyunOssService aliyunOssService)
+ IWebHostEnvironment _hostingEnvironment;
+ public GoodsService(ISqlSugarClient db, IGoodsAttributeService goodsAttributeService, ISystemConfigService SystemConfigService, IAliyunOssService aliyunOssService, IWebHostEnvironment webHostEnvironment)
{
_db=db;
_goodsAttributeService=goodsAttributeService;
_SystemConfigService = SystemConfigService;
_aliyunOssService = aliyunOssService;
+ _hostingEnvironment = webHostEnvironment;
}
///
/// 分页查询
@@ -300,7 +304,6 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
resEntity.Price = dto.Price;
resEntity.IsWeigh = dto.IsWeigh;
resEntity.GoodsUintId = dto.GoodsUintId;
- resEntity.IsAttrubute = Convert.ToBoolean(dto.IsAttrubute);
if (!string.IsNullOrWhiteSpace(dto.Status))
{
resEntity.Status = (CommonStatus)Enum.ToObject(typeof(CommonStatus), int.Parse(dto.Status));
@@ -316,20 +319,22 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
///
public async Task DeleteGoods(string id)
{
+ var res = 0;
try
{
_db.Ado.BeginTran();
-
var ids = id.Split(",");
- var goods = _db.Queryable().Where(x =>ids.Contains( x.Id)).First();
- if (goods == null) throw Oops.Oh("商品不存在");
- var goodsbom = _db.Queryable().Where(x => ids.Contains(x.Goods_Id)).ToList();
- var goodsTechnology = _db.Queryable().Where(x => ids.Contains(x.GoodsId)).ToList();
- //var FoodMenuGoods = _db.Queryable().Where(x => x.GoodsId == id).ToList();
- await _db.Deleteable(goodsbom).ExecuteCommandAsync();
- await _db.Deleteable(goodsTechnology).ExecuteCommandAsync();
- //await _db.Deleteable(FoodMenuGoods).ExecuteCommandAsync();
- var res = await _db.Deleteable(goods).ExecuteCommandAsync();
+ foreach (var idItem in ids)
+ {
+ var good = _db.Queryable().Where(x => x.Id == idItem).First();
+ if (good == null)
+ throw Oops.Oh("商品不存在");
+ var goodsbom = _db.Queryable().Where(x => ids.Contains(x.Goods_Id)).ToList();
+ var goodsTechnology = _db.Queryable().Where(x => ids.Contains(x.GoodsId)).ToList();
+ await _db.Deleteable(goodsbom).ExecuteCommandAsync();
+ await _db.Deleteable(goodsTechnology).ExecuteCommandAsync();
+ res += await _db.Deleteable(good).ExecuteCommandAsync();
+ }
_db.Ado.CommitTran();
return res > 0;
}
@@ -338,7 +343,6 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
_db.Ado.RollbackTran();
throw Oops.Oh("删除失败");
}
-
}
///
/// 查询商品单位
@@ -1250,6 +1254,354 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
return true;
}
+ ///
+ /// 商品工艺导入
+ ///
+ ///
+ ///
+ public async Task GoodsTechnologyImport(GoodsTechnologyImportDto importDto)
+ {
+ string pattern = @"(?[^,(]+),(?\([^)]+\)),(?[^,]+)";
+ var file = importDto.file;
+ var userId = App.User?.FindFirst(ClaimConst.CLAINM_USERID)?.Value;
+ if (string.IsNullOrEmpty(userId))
+ {
+ userId = "";
+ }
+ var goodsInfoList = await _db.Queryable().ToListAsync();
+ var deviceList = await _db.Queryable().ToListAsync();
+ var technologyList = await _db.Queryable().ToListAsync();
+ var technologyActionList = await _db.Queryable().ToListAsync();
+ var wareHouseTemplateList = await _db.Queryable().OrderBy(a => a.Id).ToListAsync();
+ var batchList = await _db.Queryable((a, b) => new JoinQueryInfos(JoinType.Left, a.TypeID == b.Id)).Select((a, b) => new BatchingView() { Id = a.Id, Name = a.Batching_Name, TypeName = b.Name }).ToListAsync();
+ try
+ {
+ _db.Ado.BeginTran();
+ var sheetNameList = GetSheetNameList(file.OpenReadStream());
+ foreach (var sheetName in sheetNameList)
+ {
+ var source = file.OpenReadStream();
+ var mapper = new Mapper(source);
+ var objModel = new ReadExcel