Просмотр исходного кода

新增商品导入导出及分类,版本管理,设备工艺增加"备注",商品管理筛选增加"设备",隐藏"价格配置"20240815

ingredientmanage
gwbvipvip 4 месяцев назад
Родитель
Сommit
05fea5ccfb
65 измененных файлов: 3205 добавлений и 695 удалений
  1. +0
    -2
      BPA.SAAS.Manage.Application/AExternalPlatform/BaseDto/BaseRequestDto.cs
  2. +8
    -0
      BPA.SAAS.Manage.Application/AExternalPlatform/BaseDto/ResponDataBase.cs
  3. +9
    -1
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/CheckService/CheckServices.cs
  4. +13
    -0
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/CheckService/Services/CheckServices.cs
  5. +7
    -0
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/CheckService/Services/ICheckServices.cs
  6. +10
    -0
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/DeviceServices.cs
  7. +32
    -0
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Dtos/DeviceTechnogolyDto.cs
  8. +30
    -0
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Services/DeviceService.cs
  9. +7
    -0
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Services/IDeviceService.cs
  10. +10
    -3
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsAttributeinsertDto.cs
  11. +23
    -0
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsClassifyInsertDto.cs
  12. +14
    -0
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsClassifyQueryDto.cs
  13. +17
    -0
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsClassifyViewDto.cs
  14. +14
    -1
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsInsertDto.cs
  15. +13
    -0
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsTechnologyActionDelDto.cs
  16. +8
    -1
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsTechnologyActionListViewDto.cs
  17. +36
    -0
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsTechnologyActionUpdateDto.cs
  18. +1
    -0
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsUintInsertDto.cs
  19. +10
    -1
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsUpdateDto.cs
  20. +2
    -0
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodstypeInsertDto.cs
  21. +51
    -9
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/GoodsServices.cs
  22. +650
    -239
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Services/GoodsService.cs
  23. +34
    -5
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Services/IGoodsService.cs
  24. +37
    -27
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/Material/Dtos/MaterialDto.cs
  25. +18
    -7
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/Material/MaterialServices.cs
  26. +12
    -5
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/Material/Services/IMaterialServices.cs
  27. +280
    -181
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/Material/Services/MaterialService.cs
  28. +33
    -0
      BPA.SAAS.Manage.Application/DataBase/Dtos/Goods/GoodsClassifyDto.cs
  29. +0
    -17
      BPA.SAAS.Manage.Application/DataBase/Dtos/Goods/GoodsDto.cs
  30. +101
    -1
      BPA.SAAS.Manage.Application/DataBase/Dtos/Goods/GoodsTechnologyImportDto.cs
  31. +5
    -12
      BPA.SAAS.Manage.Application/DataBase/Dtos/Goods/GoodsTechnologyImportModel.cs
  32. +18
    -0
      BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsResultDto.cs
  33. +76
    -0
      BPA.SAAS.Manage.Application/DataBase/GoodsClassifyService.cs
  34. +51
    -11
      BPA.SAAS.Manage.Application/DataBase/GoodsServices.cs
  35. +5
    -5
      BPA.SAAS.Manage.Application/DataBase/GoodsTypeServices.cs
  36. +48
    -0
      BPA.SAAS.Manage.Application/DataBase/Interface/IGoodsClassifyService.cs
  37. +30
    -6
      BPA.SAAS.Manage.Application/DataBase/Interface/IGoodsService.cs
  38. +4
    -4
      BPA.SAAS.Manage.Application/DataBase/Interface/IGoodsTypeService.cs
  39. +5
    -4
      BPA.SAAS.Manage.Application/DataBase/Services/BatchingService.cs
  40. +2
    -2
      BPA.SAAS.Manage.Application/DataBase/Services/BomService.cs
  41. +1
    -1
      BPA.SAAS.Manage.Application/DataBase/Services/GoodsAttributePriceService.cs
  42. +1
    -1
      BPA.SAAS.Manage.Application/DataBase/Services/GoodsAttributeService.cs
  43. +169
    -0
      BPA.SAAS.Manage.Application/DataBase/Services/GoodsClassifyService.cs
  44. +1161
    -93
      BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs
  45. +9
    -7
      BPA.SAAS.Manage.Application/DataBase/Services/GoodsTechnologyService.cs
  46. +9
    -9
      BPA.SAAS.Manage.Application/DataBase/Services/GoodsTypeService.cs
  47. +1
    -0
      BPA.SAAS.Manage.Application/Device/Dtos/Device/ProductVesionView.cs
  48. +6
    -0
      BPA.SAAS.Manage.Application/Device/Dtos/Device/TechnologyView.cs
  49. +4
    -0
      BPA.SAAS.Manage.Application/Device/Dtos/DeviceVesion/DeviceVesionBaseDto.cs
  50. +5
    -0
      BPA.SAAS.Manage.Application/Device/Dtos/DeviceVesion/DeviceVesionModel.cs
  51. +1
    -0
      BPA.SAAS.Manage.Application/Device/Dtos/WarehouseTemplate/WarehouseTemplatDto.cs
  52. +1
    -0
      BPA.SAAS.Manage.Application/Device/Dtos/WarehouseTemplate/WarehouseTemplateView.cs
  53. +6
    -0
      BPA.SAAS.Manage.Application/Device/Interface/ITechnologyService.cs
  54. +14
    -11
      BPA.SAAS.Manage.Application/Device/Services/DeviceVesionService.cs
  55. +28
    -19
      BPA.SAAS.Manage.Application/Device/Services/TechnologyService.cs
  56. +6
    -3
      BPA.SAAS.Manage.Application/Device/Services/WarehouseTemplateService.cs
  57. +10
    -0
      BPA.SAAS.Manage.Application/Device/TechnologyServices.cs
  58. +2
    -3
      BPA.SAAS.Manage.Comm/Util/ReadExcel.cs
  59. +0
    -1
      BPA.SAAS.Manage.Core/Base/IBaseEntity.cs
  60. +19
    -0
      BPA.SAAS.Manage.Core/DataBase/BPA_GoodsClassify.cs
  61. +18
    -0
      BPA.SAAS.Manage.Core/DataBase/BPA_GoodsClassifyRelation.cs
  62. +4
    -0
      BPA.SAAS.Manage.Core/Device/BPA_TechnologyExportRecode.cs
  63. +1
    -0
      BPA.SAAS.Manage.Core/Device/BPA_WarehouseTemplate.cs
  64. +5
    -0
      BPA.SAAS.Manage.Core/Product/BPA_ProductVesion.cs
  65. +0
    -3
      BPA.SAAS.Manage.Core/SqlSugarDb.cs

+ 0
- 2
BPA.SAAS.Manage.Application/AExternalPlatform/BaseDto/BaseRequestDto.cs Просмотреть файл

@@ -23,7 +23,5 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.BaseDto
public List<string> DeviceIdList { get; set; }

public List<T> DataInfo { get; set; }

}

}

+ 8
- 0
BPA.SAAS.Manage.Application/AExternalPlatform/BaseDto/ResponDataBase.cs Просмотреть файл

@@ -13,4 +13,12 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.BaseDto
public string succeeded { get; set; }
public string errors { get; set; }
}

public class ResponseMessageDto
{
public int Code { get; set; }
public string Message { get;set; }
public string Id { get; set; }
public string Name { get; set; }
}
}

+ 9
- 1
BPA.SAAS.Manage.Application/AExternalPlatform/Service/CheckService/CheckServices.cs Просмотреть файл

@@ -33,6 +33,14 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.CheckService
await _checkServices.CheckSign( key, signStr, signMd5);
}


/// <summary>
/// 通过key获取用户Id
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public async Task<string> GetUserId(string key)
{
return await _checkServices.GetUserId(key);
}
}
}

+ 13
- 0
BPA.SAAS.Manage.Application/AExternalPlatform/Service/CheckService/Services/CheckServices.cs Просмотреть файл

@@ -81,5 +81,18 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.CheckService.Ser

CurrentUser.GroupId = tenantId;
}

/// <summary>
/// 通过key获取用户Id
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public async Task<string> GetUserId(string key)
{
var data = await SqlSugarDb.Db.Queryable<BPA_PlatformAuthorization>().FirstAsync(t => t.Key == key);
if(data == null)
return null;
return data.CreateBy;
}
}
}

+ 7
- 0
BPA.SAAS.Manage.Application/AExternalPlatform/Service/CheckService/Services/ICheckServices.cs Просмотреть файл

@@ -18,5 +18,12 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.CheckService.Ser
///检查Sign
/// </summary>
Task CheckSign(string key, string signStr, string signMd5);

/// <summary>
/// 通过key获取用户Id
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
Task<string> GetUserId(string key);
}
}

+ 10
- 0
BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/DeviceServices.cs Просмотреть файл

@@ -59,5 +59,15 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Device
{
return await _deviceService.DeleteDevice(ids);
}
/// <summary>
/// 设备autoKey获取工艺
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("/api/ExternalPlatform/Device/GetDeviceTechnology")]
public async Task<List<DeviceTechnogolyDateDto>> GetDeviceTechnology(DeviceTechnogolyRequestDto dto)
{
return await _deviceService.GetDeviceTechnology(dto);
}
}
}

+ 32
- 0
BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Dtos/DeviceTechnogolyDto.cs Просмотреть файл

@@ -0,0 +1,32 @@
using BPA.SAAS.Manage.Comm.Enum;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Device.Dtos
{
public class DeviceTechnogolyRequestDto
{
public int AutoKey { get;set; }
}

public class DeviceTechnogolyDateDto
{
public string Id { get; set; }
public string Name { get; set; }
public List<DeviceTechnogolyActionDateDto> ActionList { get;set;}
}

public class DeviceTechnogolyActionDateDto
{
public string Id { get; set; }
public string TechnologyId { get; set; }
public string ActionName { get; set; }
public string ActionValue { get; set; }
public string ActionType { get; set; }
public TechnologyEnums TechnologyType { get; set; }
public int Sort { get; set; }
}
}

+ 30
- 0
BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Services/DeviceService.cs Просмотреть файл

@@ -164,5 +164,35 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Device.Services
var checkProductVesion = SqlSugarDb.Db.Queryable<BPA_ProductVesion>().Where(x => x.Id == dto.ProductVersionId).Any();
if (!checkProductVesion) throw Oops.Oh(ErrorCodeEnum.Code10011);
}

public async Task<List<DeviceTechnogolyDateDto>> GetDeviceTechnology(DeviceTechnogolyRequestDto dto)
{
var deviceInfo = await SqlSugarDb.Db.Queryable<BPA_DeviceInfo>().FirstAsync(t => t.AutoKey == dto.AutoKey);
if (deviceInfo == null)
throw Oops.Oh("该设备不存在");
var technologyList = await SqlSugarDb.Db.Queryable<BPA_Technology>().Where(t => t.DeviceVersionId == deviceInfo.ProductVersionId).ToListAsync();
var technologyActionList = await SqlSugarDb.Db.Queryable<BPA_TechnologyAction>().Where(t => technologyList.Select(a => a.Id).Contains(t.TechnologyId)).ToListAsync();
var result = new List<DeviceTechnogolyDateDto>();
foreach (var technology in technologyList)
{
var item = new DeviceTechnogolyDateDto { Id = technology.Id, Name = technology.Name, ActionList = new List<DeviceTechnogolyActionDateDto>() };
var actionList = technologyActionList.Where(t => t.TechnologyId == technology.Id).ToList();
foreach (var action in actionList)
{
item.ActionList.Add(new DeviceTechnogolyActionDateDto
{
Id = action.Id,
TechnologyId = action.TechnologyId,
ActionName = action.ActionName,
ActionValue = action.ActionValue,
ActionType = action.ActionType,
TechnologyType = action.TechnologyType,
Sort = action.Sort
});
}
result.Add(item);
}
return result;
}
}
}

+ 7
- 0
BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Services/IDeviceService.cs Просмотреть файл

@@ -38,5 +38,12 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Device.Services
/// <param name="ids"></param>
/// <returns></returns>
Task<bool> DeleteDevice(DeviceInfoDelDto ids);

/// <summary>
/// 设备autoKey获取工艺
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
Task<List<DeviceTechnogolyDateDto>> GetDeviceTechnology(DeviceTechnogolyRequestDto dto);
}
}

+ 10
- 3
BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsAttributeinsertDto.cs Просмотреть файл

@@ -6,20 +6,27 @@ using System.Threading.Tasks;

namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos
{
public class GoodsAttributeinsertDto
public class GoodsAttributeInsertDto
{
public string Id { get; set; }
/// <summary>
/// 属性名称
/// </summary>
public string AttributeName { get; set; }
/// <summary>
/// 商品分类
/// 工艺分类Id
/// </summary>
public string GoodsTypeId { get; set; }
/// <summary>
/// 工艺分类名称
/// </summary>
public string GoodsTypeName { get; set; }
public List<GoodsAttributeInsertValue> GoodsAttributeValue { get; set; }
public int Sort { get; set; }
public List<GoodsAttributeInsertValue> GoodsAttributeValueList { get; set; }
}
public class GoodsAttributeInsertValue
{
public string Id { get; set; }
/// <summary>
/// 属性值
/// </summary>


+ 23
- 0
BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsClassifyInsertDto.cs Просмотреть файл

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos
{
public class GoodsClassifyInsertDto
{
public string Id { get;set; }
public string Name { get;set; }
public int Sort { get;set; }
public string Remark { get; set; }
public List<ClassifyGoodsInfoDto> GoodsList { get;set;}
}

public class ClassifyGoodsInfoDto
{
public string GoodsId { get;set; }
public string GoodsName { get;set; }
}
}

+ 14
- 0
BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsClassifyQueryDto.cs Просмотреть файл

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos
{
public class GoodsClassifyQueryDto
{
public int Current { get; set; }
public int PageSize { get; set; }
}
}

+ 17
- 0
BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsClassifyViewDto.cs Просмотреть файл

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos
{
public class GoodsClassifyViewDto
{
public string Id { get;set; }
public string Name { get;set; }
public int Sort { get;set; }
public string Remark { get;set; }
public List<string> GoodsIdList { get;set; }
}
}

+ 14
- 1
BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsInsertDto.cs Просмотреть файл

@@ -8,6 +8,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos
{
public class GoodsInsertDto
{
public string Id { get; set; }
/// <summary>
/// 商品名称
/// </summary>
@@ -29,12 +30,24 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos
/// </summary>
public bool IsWeigh { get; set; }
/// <summary>
/// 商品分类id
/// 工艺分类id
/// </summary>
public string GoodsTypeId { get; set; }
/// <summary>
/// 工艺分类名称
/// </summary>
public string GoodsTypeName { get; set; }
/// <summary>
/// 商品单位id
/// </summary>
public string GoodsUintId { get; set; }
/// <summary>
/// 商品单位名称
/// </summary>
public string GoodsUintName { get; set; }
/// <summary>
/// 序号
/// </summary>
public int Sort { get; set; }
}
}

+ 13
- 0
BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsTechnologyActionDelDto.cs Просмотреть файл

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos
{
public class GoodsTechnologyActionDelDto
{
public List<string> Ids { get; set; }
}
}

+ 8
- 1
BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsTechnologyActionListViewDto.cs Просмотреть файл

@@ -13,6 +13,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos
public string WarehousrTemplateId { get; set; }
public string GoodsAttributeId { get; set; }
public string TechnologyName { get; set; }
public int Order { get; set; }
public List<GoodsTechnologyActionViewDto> Data { get; set; }
}
public class GoodsTechnologyActionViewDto
@@ -30,15 +31,21 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos
/// 商品属性id集合
/// </summary>
public string GoodsAttributeId { get; set; }

/// <summary>
/// 是否物料
/// </summary>
public bool IsBatch { get; set; }
/// <summary>
/// 动作value
/// </summary>
public string ChnologyId { get; set; }
public DateTime CreateAt { get; set; }
public string GroupId { get; set; }
public int IsDeleted { get; set; }
public int Sort { get; set; }
public string GoodsId { get; set; }
public string DeviceId { get; set; }
public string WarehousrTemplateId { get; set; }
public int Order { get; set; }
}
}

+ 36
- 0
BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsTechnologyActionUpdateDto.cs Просмотреть файл

@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos
{
public class GoodsTechnologyActionUpdateDto
{
public string GoodsId { get; set; }
public string GoodsName { get; set; }
public int DeviceId { get; set; }
public string DeviceName { get; set; }
public string WarehouseTemplateId { get; set; }
public string WarehouseTemplateName { get; set; }
public List<GoodsTechnologyActionDto> TechnologyActionList { get; set; }
}
public class GoodsTechnologyActionDto
{
public string Id { get;set; }
public string StepName { get; set; }
public List<ActionJsonDto> ActionJson { get; set; }
public string GoodsAttributeId { get; set; }
public string ChnologyId { get; set; }
public int Sort { get; set; }
}

public class ActionJsonDto
{
public string actionName { get; set; }
public string actionValue { get; set; }
public string technologyactionId { get; set; }
public string index { get; set; }
}
}

+ 1
- 0
BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsUintInsertDto.cs Просмотреть файл

@@ -8,6 +8,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos
{
public class GoodsUintInsertDto
{
public string Id { get;set; }
public string Name { get; set; }
public string Remark { get; set; }
}


+ 10
- 1
BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsUpdateDto.cs Просмотреть файл

@@ -30,12 +30,21 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos
/// </summary>
public bool IsWeigh { get; set; }
/// <summary>
/// 商品分类id
/// 工艺分类id
/// </summary>
public string GoodsTypeId { get; set; }
/// <summary>
/// 工艺分类id
/// </summary>
public string GoodsTypeName { get; set; }
/// <summary>
/// 商品单位id
/// </summary>
public string GoodsUintId { get; set; }

/// <summary>
/// 商品单位id
/// </summary>
public string GoodsUintName { get; set; }
}
}

+ 2
- 0
BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodstypeInsertDto.cs Просмотреть файл

@@ -8,8 +8,10 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos
{
public class GoodstypeInsertDto
{
public string Id { get;set;}
public string Pid { get; set; }
public string Name { get; set; }
public int Sort { get; set; }
public string Remark { get; set; }
}
}

+ 51
- 9
BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/GoodsServices.cs Просмотреть файл

@@ -38,7 +38,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("/api/ExternalPlatform/Goods/AddGoods")]
public async Task<bool> AddGoods(BaseRequestDto<GoodsInsertDto> dto)
public async Task<List<ResponseMessageDto>> AddGoods(List<GoodsInsertDto> dto)
{
return await _goodsService.AddGoods(dto);
}
@@ -48,7 +48,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("/api/ExternalPlatform/Goods/UpdateGoods")]
public async Task<bool> UpdateGoods(BaseRequestDto<GoodsUpdateDto> dto)
public async Task<bool> UpdateGoods(List<GoodsUpdateDto> dto)
{
return await _goodsService.UpdateGoods(dto);
}
@@ -68,7 +68,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("/api/ExternalPlatform/Goods/AddGoodsAttribute")]
public async Task<bool> AddGoodsAttribute(GoodsAttributeinsertDto dto)
public async Task<List<ResponseMessageDto>> AddGoodsAttribute(List<GoodsAttributeInsertDto> dto)
{
return await _goodsService.AddGoodsAttribute(dto);
}
@@ -102,7 +102,27 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods
return await _goodsService.GetGoodsTechnologyAction(goodsId);
}
/// <summary>
/// 查询商品分类
/// 添加商品工艺
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("/api/ExternalPlatform/Goods/AddGoodsTechnologyAction")]
public async Task<List<ResponseMessageDto>> AddGoodsTechnologyAction(List<GoodsTechnologyActionUpdateDto> dto)
{
return await _goodsService.AddGoodsTechnologyAction(dto);
}
/// <summary>
/// 删除商品工艺
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("/api/ExternalPlatform/Goods/DeleteGoodsTechnologyAction")]
public async Task<bool> DeleteGoodsTechnologyAction(GoodsTechnologyActionDelDto dto)
{
return await _goodsService.DeleteGoodsTechnologyAction(dto);
}
/// <summary>
/// 查询工艺分类
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
@@ -112,17 +132,17 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods
return await _goodsService.GetGoodsTypePage(dto);
}
/// <summary>
/// 添加商品分类
/// 添加工艺分类
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("/api/ExternalPlatform/Goods/AddGoodsType")]
public async Task<bool> AddGoodsType(List<GoodstypeInsertDto> dto)
public async Task<List<ResponseMessageDto>> AddGoodsType(List<GoodstypeInsertDto> dto)
{
return await _goodsService.AddGoodsType(dto);
}
/// <summary>
/// 修改商品分类
/// 修改工艺分类
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
@@ -132,7 +152,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods
return await _goodsService.UpdateGoodsType(dto);
}
/// <summary>
/// 删除商品分类
/// 删除工艺分类
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
@@ -157,7 +177,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("/api/ExternalPlatform/Goods/AddGoodsUint")]
public async Task<bool> AddGoodsUint(List<GoodsUintInsertDto> dto)
public async Task<List<ResponseMessageDto>> AddGoodsUint(List<GoodsUintInsertDto> dto)
{
return await _goodsService.AddGoodsUint(dto);
}
@@ -181,5 +201,27 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods
{
return await _goodsService.DelGoodsUint(dto);
}

/// <summary>
/// 查询商品分类
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("/api/ExternalPlatform/Goods/GetGoodsClassify")]
public async Task<PageUtil> GetGoodsClassify(GoodsClassifyQueryDto dto)
{
return await _goodsService.GetGoodsClassify(dto);
}

/// <summary>
/// 添加商品分类
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("/api/ExternalPlatform/Goods/AddGoodsClassify")]
public async Task<List<ResponseMessageDto>> AddGoodsClassify(List<GoodsClassifyInsertDto> dto)
{
return await _goodsService.AddGoodsClassify(dto);
}
}
}

+ 650
- 239
BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Services/GoodsService.cs
Разница между файлами не показана из-за своего большого размера
Просмотреть файл


+ 34
- 5
BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Services/IGoodsService.cs Просмотреть файл

@@ -22,13 +22,13 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
Task<bool> AddGoods(BaseRequestDto<GoodsInsertDto> dto);
Task<List<ResponseMessageDto>> AddGoods(List<GoodsInsertDto> dto);
/// <summary>
/// 更新商品
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
Task<bool> UpdateGoods(BaseRequestDto<GoodsUpdateDto> dto);
Task<bool> UpdateGoods(List<GoodsUpdateDto> dto);
/// <summary>
/// 删除商品
/// </summary>
@@ -40,7 +40,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
Task<bool> AddGoodsAttribute(GoodsAttributeinsertDto dto);
Task<List<ResponseMessageDto>> AddGoodsAttribute(List<GoodsAttributeInsertDto> dto);
Task<bool> AddGoodsAttributeValue(List<GoodsAttributeValue> dto);
/// <summary>
/// 查询商品属性
@@ -53,13 +53,42 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services
/// <param name="goodsId"></param>
/// <returns></returns>
Task<List<GoodsTechnologyActionListViewDto>> GetGoodsTechnologyAction(GoodsIdDto goodsId);

/// <summary>
/// 添加商品工艺
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
Task<List<ResponseMessageDto>> AddGoodsTechnologyAction(List<GoodsTechnologyActionUpdateDto> dto);

/// <summary>
/// 删除商品工艺
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
Task<bool> DeleteGoodsTechnologyAction(GoodsTechnologyActionDelDto dto);

Task<PageUtil> GetGoodsTypePage(GoodstypeQueryDto dto);
Task<bool> AddGoodsType(List<GoodstypeInsertDto> dto);
Task<List<ResponseMessageDto>> AddGoodsType(List<GoodstypeInsertDto> dto);
Task<bool> UpdateGoodsType(GoodstypeUpdateDto dto);
Task<bool> DelGoodsType(GoodstypeDelDto dto);
Task<PageUtil> GetGoodsUintPage(GoodsUintQueryDto dto);
Task<bool> AddGoodsUint(List<GoodsUintInsertDto> dto);
Task<List<ResponseMessageDto>> AddGoodsUint(List<GoodsUintInsertDto> dto);
Task<bool> UpdateGoodsUint(GoodsUintUpdateDto dto);
Task<bool> DelGoodsUint(GoodsUintDelDto dto);

/// <summary>
/// 查询商品分类
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
Task<PageUtil> GetGoodsClassify(GoodsClassifyQueryDto dto);

/// <summary>
/// 添加商品分类
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
Task<List<ResponseMessageDto>> AddGoodsClassify(List<GoodsClassifyInsertDto> dto);
}
}

+ 37
- 27
BPA.SAAS.Manage.Application/AExternalPlatform/Service/Material/Dtos/MaterialDto.cs Просмотреть файл

@@ -67,20 +67,20 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Dtos
/// </summary>
public string Name { get; set; }

///// <summary>
///// 原料类型
///// </summary>
//public string TypeId { get; set; }
/// <summary>
/// 原料类型Id
/// </summary>
public string TypeId { get; set; }

/// <summary>
/// 原料类型名称
/// </summary>
public string TypeName { get; set; }

///// <summary>
///// 物料单位
///// </summary>
//public string UintId { get; set; }
/// <summary>
/// 物料单位Id
/// </summary>
public string UintId { get; set; }


/// <summary>
@@ -92,37 +92,33 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Dtos

public class DelMaterialDto
{
public string MaterialId { get; set; }
public List<string> Ids { get; set; }

}

public class MaterialCreateDto
public class MaterialCreateDto
{
/// <summary>
/// 原料编码
/// </summary>
public string Code { get; set; }

public string Id { get; set; }
/// <summary>
/// 原料名称
/// </summary>
/// </summary>
public string Name { get; set; }


/// <summary>
/// 原料类型名称
/// </summary>
/// 物料类型Id
/// </summary>
public string TypeId { get; set; }
/// <summary>
/// 物料类型名称
/// </summary>
public string TypeName { get; set; }


/// <summary>
/// 物料单位Id
/// </summary>
public string UintId { get; set; }
/// <summary>
/// 物料单位名称
/// </summary>
public string UintName { get; set; }

}

public class MaterialUpdateDto
@@ -154,5 +150,19 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Dtos

}

public class MaterialTypeDto
{
public string Id { get; set; }

/// <summary>
/// 原料名称
/// </summary>
public string Name { get; set; }
}

public class DefaultUintDto
{
public string Id { get; set; }
public string Name { get; set; }
}
}

+ 18
- 7
BPA.SAAS.Manage.Application/AExternalPlatform/Service/Material/MaterialServices.cs Просмотреть файл

@@ -39,18 +39,18 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Service
/// <summary>
/// 添加物料
/// </summary>
/// <param name="InputDto"></param>
/// <param name="inputDto"></param>
/// <returns></returns>
[HttpPost("/api/ExternalPlatform/Material/AddMaterial")]
public async Task<string> AddMaterial(BaseRequestDto<MaterialCreateDto> InputDto)
public async Task<List<ResponseMessageDto>> AddMaterial(List<MaterialCreateDto> inputDto)
{
return await _materialServices.AddMaterial(InputDto);
return await _materialServices.AddMaterial(inputDto);
}

/// <summary>
/// 删除物料
/// </summary>
/// <param name="MaterialId"></param>
/// <param name="inputDto"></param>
/// <returns></returns>
[HttpPost("/api/ExternalPlatform/Material/DelMaterial")]
public async Task<bool> DelMaterial(DelMaterialDto inputDto)
@@ -62,12 +62,23 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Service
/// <summary>
/// 修改物料
/// </summary>
/// <param name="InputDto"></param>
/// <param name="inputDto"></param>
/// <returns></returns>
[HttpPost("/api/ExternalPlatform/Material/UpdateMateria")]
public async Task<bool> UpdateMateria(BaseRequestDto<MaterialUpdateDto> InputDto)
public async Task<bool> UpdateMateria(List<MaterialUpdateDto> inputDto)
{
return await _materialServices.UpdateMateria(inputDto);
}

/// <summary>
/// 分页查询物料分类
/// </summary>
/// <param name="inputDto"></param>
/// <returns></returns>
[HttpPost("/api/ExternalPlatform/Material/GetMaterialTypePageList")]
public async Task<PageUtil<List<MaterialTypeDto>>> GetMaterialTypePageList(MaterialPageInputDto inputDto)
{
return await _materialServices.UpdateMateria(InputDto);
return await _materialServices.GetMaterialTypePageList(inputDto);
}
}
}

+ 12
- 5
BPA.SAAS.Manage.Application/AExternalPlatform/Service/Material/Services/IMaterialServices.cs Просмотреть файл

@@ -26,14 +26,14 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Service
/// <summary>
/// 添加物料
/// </summary>
/// <param name="InputDto"></param>
/// <param name="inputDto"></param>
/// <returns></returns>
Task<string> AddMaterial(BaseRequestDto<MaterialCreateDto> inputDto);
Task<List<ResponseMessageDto>> AddMaterial(List<MaterialCreateDto> inputDto);

/// <summary>
/// 删除物料
/// </summary>
/// <param name="MaterialId"></param>
/// <param name="inputDto"></param>
/// <returns></returns>
Task<bool> DelMaterial(DelMaterialDto inputDto);

@@ -41,8 +41,15 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Service
/// <summary>
/// 修改物料
/// </summary>
/// <param name="InputDto"></param>
/// <param name="inputDto"></param>
/// <returns></returns>
Task<bool> UpdateMateria(List<MaterialUpdateDto> inputDto);

/// <summary>
/// 分页查询物料分类
/// </summary>
/// <param name="inputDto"></param>
/// <returns></returns>
Task<bool> UpdateMateria(BaseRequestDto<MaterialUpdateDto> inputDto);
Task<PageUtil<List<MaterialTypeDto>>> GetMaterialTypePageList(MaterialPageInputDto inputDto);
}
}

+ 280
- 181
BPA.SAAS.Manage.Application/AExternalPlatform/Service/Material/Services/MaterialService.cs Просмотреть файл

@@ -17,6 +17,7 @@ using Microsoft.AspNetCore.Components.Forms;
using Newtonsoft.Json;
using NPOI.SS.Formula.Functions;
using System.Drawing.Drawing2D;
using System.Text;

namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Services
{
@@ -40,7 +41,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Service


int total = new RefAsync<int>();
var data = SqlSugarDb.Db.Queryable<BPA_Batching, BPA_BatchingType, BPA_BatchingUint>((a, b, c) =>
var data = await SqlSugarDb.Db.Queryable<BPA_Batching, BPA_BatchingType, BPA_BatchingUint>((a, b, c) =>
new JoinQueryInfos(JoinType.Left, a.Batching_Type == b.Id,
JoinType.Left, a.StockUint == c.Id))
.Where((a, b, c) => a.IsDeleted == 0)
@@ -50,12 +51,12 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Service
Id = a.Id,
Code = a.Code,
Name = a.Batching_Name,
//TypeId = b.Id,
TypeId = b.Id,
TypeName = b.Name,
// UintId = c.Id,
UintId = c.Id,
UintName = c.Name,

}).ToPageList(inputDto.Current, inputDto.PageSize, ref total);
}).ToPageListAsync(inputDto.Current, inputDto.PageSize, total);

return new PageUtil<List<MaterialDto>>()
{
@@ -68,112 +69,186 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Service
/// <summary>
/// 添加物料
/// </summary>
/// <param name="InputDto"></param>
/// <param name="inputDto"></param>
/// <returns></returns>
public async Task<string> AddMaterial(BaseRequestDto<MaterialCreateDto> inputDto)
public async Task<List<ResponseMessageDto>> AddMaterial(List<MaterialCreateDto> inputDto)
{
try
{

var list=new List<BPA_Batching>();

SqlSugarDb.Db.Ado.BeginTran();

foreach (var item in inputDto.DataInfo)
var userId = await _checkServices.GetUserId(App.HttpContext.Request.Headers["key"].ToString());
var batchingList = await SqlSugarDb.Db.Queryable<BPA_Batching>().ToListAsync();
var typeList = await SqlSugarDb.Db.Queryable<BPA_BatchingType>().ToListAsync();
var uintList = await SqlSugarDb.Db.Queryable<BPA_BatchingUint>().ToListAsync();
var typeIdList = new List<string>();
var uintIdList = new List<string>();
var repeatList = new List<ResponseMessageDto>();
var successList = new List<ResponseMessageDto>();
var defaultUintData = uintList.FirstOrDefault(t => t.Name == "g");
var defaultUint = new DefaultUintDto();
if (defaultUintData != null)
{
//1.物料单位查询
var typeData = await SqlSugarDb.Db.Queryable<BPA_BatchingType>().FirstAsync(x => x.Name == item.TypeName);
if (typeData == null)
defaultUint.Id = defaultUintData.Id;
defaultUint.Name = defaultUintData.Name;
}
else
{
var dUint = new BPA_BatchingUint
{

typeData = new BPA_BatchingType()
Id = Guid.NewGuid().ToString(),
Name = "默认单位",
CreateBy = userId
};
await SqlSugarDb.Db.Insertable(dUint).ExecuteCommandAsync();
defaultUint.Id = dUint.Id;
defaultUint.Name = dUint.Name;
}
var typeAddList = new List<BPA_BatchingType>();
var typeUpdateList = new List<BPA_BatchingType>();
var uintAddList = new List<BPA_BatchingUint>();
var uintUpdateList = new List<BPA_BatchingUint>();
var batchingAddList = new List<BPA_Batching>();
var batchingUpdateList = new List<BPA_Batching>();
foreach (var item in inputDto)
{
var batchingData = batchingList.FirstOrDefault(t => t.Batching_Name == item.Name && t.Id != item.Id);
if (batchingData != null)
repeatList.Add(new ResponseMessageDto { Code = 30001, Message = "物料上传失败:重复物料数据", Id = item.Id, Name = item.Name });
var typeData = typeList.FirstOrDefault(t => t.Name == item.TypeName && t.Id != item.TypeId);
if (typeData != null)
repeatList.Add(new ResponseMessageDto { Code = 30001, Message = "物料类型上传失败:重复物料类型数据", Id = item.TypeId, Name = item.TypeName });
if (string.IsNullOrWhiteSpace(item.UintId))
{
item.UintId = defaultUint.Id;
item.UintName = defaultUint.Name;
}
else
{
var uintData = uintList.FirstOrDefault(t => t.Name == item.UintName && t.Id != item.UintId);
if (uintData != null)
repeatList.Add(new ResponseMessageDto { Code = 30001, Message = "物料单位上传失败:重复物料单位数据", Id = item.UintId, Name = item.UintName });
}
var typeInfo = typeList.FirstOrDefault(x => x.Id == item.TypeId);
if (typeInfo == null)
{
if (!typeIdList.Contains(item.TypeId))
{
GroupId = CurrentUser.GroupId,
Id = Guid.NewGuid().ToString(),
Name = string.IsNullOrEmpty(item.TypeName) ? "默认分类" : item.TypeName,
};
SqlSugarDb.Db.Insertable(typeData).ExecuteCommand();
typeInfo = new BPA_BatchingType()
{
Id = item.TypeId,
Name = item.TypeName,
CreateBy = userId
};
typeAddList.Add(typeInfo);
typeIdList.Add(item.TypeId);
}
}

//2.单位查询
var uintData = await SqlSugarDb.Db.Queryable<BPA_BatchingUint>()
.FirstAsync(x => x.Name == item.UintName);
if (uintData == null)
else
{
uintData = new BPA_BatchingUint()
typeInfo.Name = item.TypeName;
typeUpdateList.Add(typeInfo);
}
successList.Add(new ResponseMessageDto { Code = 30000, Message = "物料类型上传成功", Id = item.TypeId, Name = item.TypeName });
var uintInfo = uintList.FirstOrDefault(x => x.Id == item.UintId);
if (uintInfo == null)
{
if (!uintIdList.Contains(item.UintId))
{
GroupId = CurrentUser.GroupId,
Id = Guid.NewGuid().ToString(),
Name = string.IsNullOrEmpty(item.UintName) ? "默认分类" : item.UintName,
};
SqlSugarDb.Db.Insertable(uintData).ExecuteCommand();
uintInfo = new BPA_BatchingUint()
{
Id = item.UintId,
Name = item.UintName,
CreateBy = userId
};
uintAddList.Add(uintInfo);
uintIdList.Add(item.UintId);
}
}
//3.物料查询
var materialData = await SqlSugarDb.Db.Queryable<BPA_Batching>().FirstAsync(x => x.Batching_Name == item.Name || x.Code == item.Code);
if (materialData == null)
else
{
uintInfo.Name = item.UintName;
uintUpdateList.Add(uintInfo);
}
successList.Add(new ResponseMessageDto { Code = 30000, Message = "物料单位上传成功", Id = item.UintId, Name = item.UintName });
var code = GenerateRandomString();
while (batchingList.Any(t => t.Code == code))
{
materialData = new BPA_Batching()
code = GenerateRandomString();
}
var batchingInfo = batchingList.FirstOrDefault(t => t.Id == item.Id);
if (batchingInfo == null)
{
batchingInfo = new BPA_Batching()
{
Id = Guid.NewGuid().ToString(),
GroupId = CurrentUser.GroupId,
Id = item.Id,
Aittribute = 0,
Batching_Name = item.Name,
Batching_Type = typeData.Id,
Code = item.Code,
Batching_Type = item.TypeId,
Code = code,
Price = 0,
Specs = "",
outstockUint = uintData.Id,
outstockUint = item.UintId,
Status = CommonStatus.ENABLE,
StockUint = uintData.Id,
TypeID = typeData.Id,
StockUint = item.UintId,
TypeID = item.TypeId,
IsDeleted = 0,
CreateBy = userId
};

SqlSugarDb.Db.Insertable(materialData).ExecuteCommand();
batchingAddList.Add(batchingInfo);
}
else
{
throw Oops.Oh(ErrorCodeEnum.Code1002);
batchingInfo.Batching_Name = item.Name;
batchingInfo.Batching_Type = item.TypeId;
batchingInfo.TypeID = item.TypeId;
batchingInfo.outstockUint = item.UintId;
batchingInfo.StockUint = item.UintId;
batchingUpdateList.Add(batchingInfo);
}
list.Add(materialData);
successList.Add(new ResponseMessageDto { Code = 30000, Message = "物料上传成功", Id = item.Id, Name = item.Name });
}

if (repeatList.Count > 0)
return repeatList;
await SqlSugarDb.Db.Insertable(typeAddList).ExecuteCommandAsync();
await SqlSugarDb.Db.Updateable(typeUpdateList).ExecuteCommandAsync();
await SqlSugarDb.Db.Insertable(uintAddList).ExecuteCommandAsync();
await SqlSugarDb.Db.Updateable(uintUpdateList).ExecuteCommandAsync();
await SqlSugarDb.Db.Insertable(batchingAddList).ExecuteCommandAsync();
await SqlSugarDb.Db.Updateable(batchingUpdateList).ExecuteCommandAsync();
SqlSugarDb.Db.Ado.CommitTran();

#region 下发数据到设备

var data = new List<PushDataBatchingDto>();
foreach (var item in list)
{
data.Add(new PushDataBatchingDto()
{
Aittribute = item.Aittribute,
AutoKey = item.AutoKey,
Code = item.Code,
ForeignKeyRe = item.ForeignKeyRe,
Id = item.Id,
Name = item.Batching_Name,
netrecovery = item.netrecovery,
outstockUint = item.outstockUint,
Price = item.Price,
proportion = item.proportion,
Specs = item.Specs,
StockUint = item.StockUint,
StockUintName = item.StockUint,
TypeID = item.TypeID,
});
}
if (inputDto.IsPush)
{
await _thirdpartyPushService.AddPushRecordAndPushDevice<MaterialCreateDto>(inputDto, 2, JsonConvert.SerializeObject(list.Select(x => x.Id).ToList()),
JsonConvert.SerializeObject(data));
}
return successList;
#region 下发数据到设备(后厨弃用)
//var data = new List<PushDataBatchingDto>();
//foreach (var item in list)
//{
// data.Add(new PushDataBatchingDto()
// {
// Aittribute = item.Aittribute,
// AutoKey = item.AutoKey,
// Code = item.Code,
// ForeignKeyRe = item.ForeignKeyRe,
// Id = item.Id,
// Name = item.Batching_Name,
// netrecovery = item.netrecovery,
// outstockUint = item.outstockUint,
// Price = item.Price,
// proportion = item.proportion,
// Specs = item.Specs,
// StockUint = item.StockUint,
// StockUintName = item.StockUint,
// TypeID = item.TypeID,
// });
//}
//if (inputDto.IsPush)
//{
// await _thirdpartyPushService.AddPushRecordAndPushDevice<MaterialCreateDto>(inputDto, 2, JsonConvert.SerializeObject(list.Select(x => x.Id).ToList()),
// JsonConvert.SerializeObject(data));
//}


#endregion

return JsonConvert.SerializeObject(list.Select(x => x.Id).ToList());
}
catch (Exception e)
{
@@ -185,17 +260,15 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Service
/// <summary>
/// 删除物料
/// </summary>
/// <param name="MaterialId"></param>
/// <param name="inputDto"></param>
/// <returns></returns>
public async Task<bool> DelMaterial(DelMaterialDto inputDto)
{
try
{
var materialData = await SqlSugarDb.Db.Queryable<BPA_Batching>().FirstAsync(x => x.Id == inputDto.MaterialId);
var materialData = await SqlSugarDb.Db.Queryable<BPA_Batching>().Where(x => inputDto.Ids.Contains(x.Id)).ToListAsync();
if (materialData == null)
{
throw Oops.Oh(ErrorCodeEnum.Code1003);
}
throw Oops.Oh("物料不存在");
var res = await SqlSugarDb.Db.Deleteable(materialData).ExecuteCommandAsync();
return res > 0;
}
@@ -203,118 +276,105 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Service
{
throw Oops.Oh(e.Message);
}


}

/// <summary>
/// 修改物料
/// </summary>
/// <param name="InputDto"></param>
/// <param name="inputDto"></param>
/// <returns></returns>
public async Task<bool> UpdateMateria(BaseRequestDto<MaterialUpdateDto> inputDto)
public async Task<bool> UpdateMateria(List<MaterialUpdateDto> inputDto)
{
try
{
SqlSugarDb.Db.Ado.BeginTran();

if (inputDto.DataInfo.Count>1)
{
throw Oops.Oh("不支持多物料修改");
}

var materia = inputDto.DataInfo.FirstOrDefault();


//1.物料单位查询
var typeData = await SqlSugarDb.Db.Queryable<BPA_BatchingType>().FirstAsync(x => x.Name == materia.TypeName);
if (typeData == null)
var batchingList = await SqlSugarDb.Db.Queryable<BPA_Batching>().ToListAsync();
var typeList = await SqlSugarDb.Db.Queryable<BPA_BatchingType>().ToListAsync();
var uintList = await SqlSugarDb.Db.Queryable<BPA_BatchingUint>().ToListAsync();
var typeIdList = new Dictionary<string, string>();
var uintIdList = new Dictionary<string, string>();
foreach (var item in inputDto)
{

typeData = new BPA_BatchingType()
{
GroupId = CurrentUser.GroupId,
Id = Guid.NewGuid().ToString(),
Name = string.IsNullOrEmpty(materia.TypeName) ? "默认分类" : materia.TypeName,
};
SqlSugarDb.Db.Insertable(typeData).ExecuteCommand();
}

//2.单位查询
var uintData = await SqlSugarDb.Db.Queryable<BPA_BatchingUint>()
.FirstAsync(x => x.Name == materia.UintName);
if (uintData == null)
{
uintData = new BPA_BatchingUint()
{
GroupId = CurrentUser.GroupId,
Id = Guid.NewGuid().ToString(),
Name = string.IsNullOrEmpty(materia.UintName) ? "默认分类" : materia.UintName,
};
SqlSugarDb.Db.Insertable(uintData).ExecuteCommand();
}
//3.物料查询
var material = await SqlSugarDb.Db.Queryable<BPA_Batching>().FirstAsync(x => x.Code == materia.Code || x.Batching_Name == materia.Name);
// if(material==null) throw Oops.Oh(ErrorCodeEnum.Code1003);
var materialData = await SqlSugarDb.Db.Queryable<BPA_Batching>().FirstAsync(x => x.Id == materia.Id);

if (materialData == null)
{
throw Oops.Oh(ErrorCodeEnum.Code1003);
}
else
{
if (material != null && material.Id == materialData.Id)
//1.物料单位查询
var typeId = string.Empty;
var typeData = typeList.FirstOrDefault(x => x.Name == item.TypeName);
if (typeData == null)
{
throw Oops.Oh(ErrorCodeEnum.Code10017);
if (!typeIdList.ContainsKey(item.TypeName))
{
typeData = new BPA_BatchingType()
{
Id = Guid.NewGuid().ToString(),
Name = item.TypeName
};
SqlSugarDb.Db.Insertable(typeData).ExecuteCommand();
typeIdList.Add(item.TypeName, typeData.Id);
typeId = typeData.Id;
}
else
typeId = typeIdList[item.TypeName];
}

materialData = new BPA_Batching()
else
typeId = typeData.Id;
//2.单位查询
var uintId = string.Empty;
var uintData = uintList.FirstOrDefault(x => x.Name == item.UintName);
if (uintData == null)
{
Id = materia.Id,
GroupId = CurrentUser.GroupId,
Aittribute = 0,
Batching_Name = materia.Name,
Batching_Type = typeData.Id,
Code = materia.Code,
Price = 0,
Specs = "",
outstockUint = uintData.Id,
Status = CommonStatus.ENABLE,
StockUint = uintData.Id,
TypeID = typeData.Id,
IsDeleted = 0,
};
SqlSugarDb.Db.Updateable(materialData).ExecuteCommand();
if (!uintIdList.ContainsKey(item.UintName))
{
uintData = new BPA_BatchingUint()
{
Id = Guid.NewGuid().ToString(),
Name = item.UintName
};
SqlSugarDb.Db.Insertable(uintData).ExecuteCommand();
uintIdList.Add(item.UintName, uintData.Id);
uintId = uintData.Id;
}
else
uintId = uintIdList[item.UintName];
}
else
uintId = uintData.Id;
var bathingData = batchingList.FirstOrDefault(t => t.Id == item.Id);
if (bathingData == null)
throw Oops.Oh($"物料“{item.Name}”不存在");
bathingData.Batching_Name = item.Name;
bathingData.Batching_Type = typeId;
bathingData.outstockUint = uintId;
bathingData.StockUint = uintId;
bathingData.TypeID = typeId;
SqlSugarDb.Db.Updateable(bathingData).ExecuteCommand();
#region 下发数据到设备(后厨弃用)

//var data = new PushDataBatchingDto()
//{
// Aittribute = materialData.Aittribute,
// AutoKey = materialData.AutoKey,
// Code = materialData.Code,
// ForeignKeyRe = materialData.ForeignKeyRe,
// Id = materialData.Id,
// Name = materialData.Batching_Name,
// netrecovery = materialData.netrecovery,
// outstockUint = materialData.outstockUint,
// Price = materialData.Price,
// proportion = materialData.proportion,
// Specs = materialData.Specs,
// StockUint = materialData.StockUint,
// StockUintName = materialData.StockUint,
// TypeID = materialData.TypeID,
//};
//if (inputDto.IsPush)
//{
// await _thirdpartyPushService.AddPushRecordAndPushDevice<MaterialUpdateDto>(inputDto, 2, materialData.Id,
// JsonConvert.SerializeObject(data));
//}


#endregion
}
SqlSugarDb.Db.Ado.CommitTran();
#region 下发数据到设备

var data = new PushDataBatchingDto()
{
Aittribute = materialData.Aittribute,
AutoKey = materialData.AutoKey,
Code = materialData.Code,
ForeignKeyRe = materialData.ForeignKeyRe,
Id = materialData.Id,
Name = materialData.Batching_Name,
netrecovery = materialData.netrecovery,
outstockUint = materialData.outstockUint,
Price = materialData.Price,
proportion = materialData.proportion,
Specs = materialData.Specs,
StockUint = materialData.StockUint,
StockUintName = materialData.StockUint,
TypeID = materialData.TypeID,
};
if (inputDto.IsPush)
{
await _thirdpartyPushService.AddPushRecordAndPushDevice<MaterialUpdateDto>(inputDto, 2, materialData.Id,
JsonConvert.SerializeObject(data));
}


#endregion
return true;
}
catch (Exception e)
@@ -323,5 +383,44 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Service
throw Oops.Oh(e.Message);
}
}

private static Random random = new();
public static string GenerateRandomString()
{
const string letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string digits = "0123456789";
StringBuilder result = new();
for (int i = 0; i < 4; i++)
{
result.Append(letters[random.Next(letters.Length)]);
}
for (int i = 0; i < 4; i++)
{
result.Append(digits[random.Next(digits.Length)]);
}
return result.ToString();
}

/// <summary>
/// 分页查询物料分类
/// </summary>
/// <param name="inputDto"></param>
/// <returns></returns>
public async Task<PageUtil<List<MaterialTypeDto>>> GetMaterialTypePageList(MaterialPageInputDto inputDto)
{
int total = new RefAsync<int>();
var data = await SqlSugarDb.Db.Queryable<BPA_BatchingType>()
.WhereIF(!string.IsNullOrEmpty(inputDto.Name), a => a.Name.Contains(inputDto.Name))
.Select(a => new MaterialTypeDto()
{
Id = a.Id,
Name = a.Name
}).ToPageListAsync(inputDto.Current, inputDto.PageSize, total);
return new PageUtil<List<MaterialTypeDto>>()
{
Total = total,
Data = data
};
}
}
}

+ 33
- 0
BPA.SAAS.Manage.Application/DataBase/Dtos/Goods/GoodsClassifyDto.cs Просмотреть файл

@@ -0,0 +1,33 @@
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.Goods
{
public class GoodsClassifyDto : PageInputBase
{
public string Name { get; set; }
}

public class GoodsClassifyDataDto
{
public string Id { get; set; }
public string Name { get; set; }
public int Sort { get; set; }
public string Remark { get; set; }
}

public class RelationDto
{
public string ClassifyId { get; set; }
public List<RelationGoodsIdDto> GoodsIdList { get;set; }
}

public class RelationGoodsIdDto
{
public string GoodsId { get; set; }
}
}

+ 0
- 17
BPA.SAAS.Manage.Application/DataBase/Dtos/Goods/GoodsDto.cs Просмотреть файл

@@ -25,21 +25,4 @@ namespace BPA.SAAS.Manage.Application.DataBase.Dtos.Goods
public string GoodsTypeId { get; set; }
public string Status { get; set; }
}
public class GoodsImportDto
{
[Column("商品名称")]
public string Name { get; set; }
[Column("商品分类")]
public string Type { get; set; }
[Column("商品单位")]
public string Uint { get; set; }
[Column("商品价格")]
public decimal Price { get; set; }
[Column("是否称重")]
public string IsWeigh { get; set; }
[Column("备注")]
public string Descritption { get; set; }
[Column("图片")]
public object ImgUrl { get; set; }
}
}

+ 101
- 1
BPA.SAAS.Manage.Application/DataBase/Dtos/Goods/GoodsTechnologyImportDto.cs Просмотреть файл

@@ -1,4 +1,5 @@
using System;
using Npoi.Mapper.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -41,4 +42,103 @@ namespace BPA.SAAS.Manage.Application.DataBase.Dtos.Goods
/// </summary>
public IFormFile File { get; set; }
}

public class GoodsExportDto
{
/// <summary>
/// 商品Id
/// </summary>
public string GoodId { get; set; }
/// <summary>
/// 设备Id
/// </summary>
public string DeviceId { get; set; }
/// <summary>
/// 多个商品Id
/// </summary>
public List<string> GoodsId { get; set; }
}

public class AttrDto
{
public string Attr { get; set; }
public string AttrValue { get; set; }
}

public class GoodsChooseDto
{
public string GoodsName { get; set; }
public bool IsSkip { get;set; }
}

public class GoodsImportDto
{
/// <summary>
/// 文件
/// </summary>
public IFormFile File { get; set; }
public string Json { get; set; }
public string DeviceId { get;set;}
}

public class GoodsImportJsonDto
{
public string key { get; set; }
public bool Value { get; set; }
}


public class GoodsImportDataDto
{
[Column("商品名称")]
public string Name { get; set; }
[Column("工艺分类")]
public string Type { get; set; }
[Column("商品单位")]
public string Uint { get; set; }
[Column("商品价格(¥)")]
public decimal Price { get; set; }
[Column("是否称重")]
public string IsWeigh { get; set; }
[Column("备注")]
public string Descritption { get; set; }
[Column("图片")]
public object ImgUrl { 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 AttributeDataDto
{
public string AttrName { get;set; }
public string AttrValue { get; set; }
}

public class TechnologyImportModel
{
public string StepName { get; set; }

public List<TechnologyImportChildModel> Child { get; set; }
}

public class TechnologyImportChildModel
{
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; }
}
}

+ 5
- 12
BPA.SAAS.Manage.Application/DataBase/Dtos/Goods/GoodsTechnologyImportModel.cs Просмотреть файл

@@ -13,19 +13,12 @@ namespace BPA.SAAS.Manage.Application.DataBase.Dtos.Goods
public string Names { get; set; }
public List<GoodsTechnologyValueModel> 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 class NewActionJsonModel
{
public string actionName { get;set; }
public string actionValue { get;set; }
public string technologyactionId { get;set; }
public string index { get;set;}
public string actionName { get; set; }
public string actionValue { get; set; }
public string batchingId { get; set; }
public string technologyactionId { get; set; }
}
}

+ 18
- 0
BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsResultDto.cs Просмотреть файл

@@ -18,6 +18,21 @@ namespace BPA.SAAS.Manage.Application.DataBase.Dtos
public List<GoodsInfoResultDto> GoodsInfoList{ get; set; }
}

public class GoodsClassifyResultDto
{
public string GoodsClassifyId { get; set; }
public string GoodsClassifyName { get; set; }
public List<GoodsDataResultDto> GoodsList { get; set; }
}

public class GoodsDataResultDto
{
public string GoodsId { get; set; }

public string GoodsName { get; set; }

public string ImgUrl { get; set; }
}

public class GoodsAttributeResultDto
{
@@ -25,6 +40,8 @@ namespace BPA.SAAS.Manage.Application.DataBase.Dtos

public string GoodsAttributeName { get; set; }

public int Sort { get; set; }

public List<GoodsAttributeValueResultDto> GoodsAttributeValueList { get; set; }
}

@@ -33,6 +50,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Dtos
public string GoodsAttributeId { get; set; }
public string GoodsAttributeValueId { get; set; }
public string AttributeValue { get; set; }
public int Sort { get; set; }
}

public class GoodsResultDto


+ 76
- 0
BPA.SAAS.Manage.Application/DataBase/GoodsClassifyService.cs Просмотреть файл

@@ -0,0 +1,76 @@
using BPA.SAAS.Manage.Application.DataBase.Dtos.Goods;
using BPA.SAAS.Manage.Application.DataBase.Interface;
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
{
[ApiDescriptionSettings("GoodsClassify", Tag = "商品分类管理")]
public class GoodsClassifyService : IDynamicApiController, ITransient
{
IGoodsClassifyService _goodsClassifyService;
public GoodsClassifyService(IGoodsClassifyService goodsClassifyService)
{
_goodsClassifyService = goodsClassifyService;
}

/// <summary>
/// 分页获取商品分类
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("/api/goodsClassify/getGoodsClassifyPage")]
public async Task<PageUtil<List<GoodsClassifyDataDto>>> GetGoodsClassifyPage(GoodsClassifyDto dto)
{
return await _goodsClassifyService.GetGoodsClassifyPage(dto);
}

/// <summary>
/// 更新商品分类
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("/api/goodsClassify/updateGoodsClassify")]
public async Task<bool> UpdateGoodsClassify(GoodsClassifyDataDto dto)
{
return await _goodsClassifyService.UpdateGoodsClassify(dto);
}

/// <summary>
/// 删除商品分类
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
[HttpGet("/api/goodsClassify/deleteGoodsClassify")]
public async Task<bool> DeleteGoodsClassify(string ids)
{
return await _goodsClassifyService.DeleteGoodsClassify(ids);
}

/// <summary>
/// 根据分类获取商品
/// </summary>
/// <param name="classifyId"></param>
/// <returns></returns>
[HttpGet("/api/goodsClassify/getRelation")]
public async Task<List<RelationGoodsIdDto>> GetRelation(string classifyId)
{
return await _goodsClassifyService.GetRelation(classifyId);
}

/// <summary>
/// 设置商品的分类
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("/api/goodsClassify/setRelation")]
public async Task<bool> SetRelation(RelationDto dto)
{
return await _goodsClassifyService.SetRelation(dto);
}
}
}

+ 51
- 11
BPA.SAAS.Manage.Application/DataBase/GoodsServices.cs Просмотреть файл

@@ -33,14 +33,25 @@ namespace BPA.SAAS.Manage.Application.DataBase
}

/// <summary>
/// 获取商品信息(更具商品id)
/// 获取商品信息(根据设备id)
/// </summary>
/// <param name="GoodsIds"></param>
/// <param name="autoKey"></param>
/// <returns></returns>
[HttpPost("/api/goods/GetGoodsListByIds")]
public async Task<object> GetGoodsListByIds(List<string> goodsIds)
[HttpGet("/api/goods/GetGoodsListByIds")]
public async Task<object> GetGoodsListByIds(string autoKey)
{
return await _goodsService.GetGoodsListByIds(goodsIds);
return await _goodsService.GetGoodsListByIds(autoKey);
}

/// <summary>
/// 获取商品分类信息(根据设备id)
/// </summary>
/// <param name="autoKey"></param>
/// <returns></returns>
[HttpGet("/api/goods/GetGoodsClassifyByIds")]
public async Task<object> GetGoodsClassifyByIds(string autoKey)
{
return await _goodsService.GetGoodsClassifyByIds(autoKey);
}

/// <summary>
@@ -225,26 +236,55 @@ namespace BPA.SAAS.Manage.Application.DataBase
return await _goodsService.GoodsTechnologyExport(exportDto);
}

/// <summary>
/// 商品工艺导出
/// </summary>
/// <param name="exportDto"></param>
/// <returns></returns>
[HttpPost("/api/goods/goodsSimpleExport"), NonUnify]
public async Task<string> GoodsSimpleExport(GoodsTechnologyExportDto exportDto)
{
return await _goodsService.GoodsSimpleExport(exportDto);
}

/// <summary>
/// 读取上传文件
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("/api/goods/getFileToChoose")]
public async Task<List<GoodsChooseDto>> GetFileToChoose([FromForm] GoodsInfoImportDto dto)
{
return await _goodsService.GetFileToChoose(dto);
}


/// <summary>
/// 商品导入
/// </summary>
/// <param name="importDto"></param>
/// <returns></returns>
[HttpPost("/api/goods/goodsImport"), NonUnify]
public async Task<bool> GoodsImport([FromForm] GoodsInfoImportDto importDto)
[HttpPost("/api/goods/goodsImport")]
public async Task<bool> GoodsImport([FromForm] GoodsImportDto importDto)
{
return await _goodsService.GoodsImport(importDto);
}

/// <summary>
/// 商品工艺导出
/// 下载商品
/// </summary>
/// <param name="exportDto"></param>
/// <returns></returns>
[HttpPost("/api/goods/goodsSimpleExport"), NonUnify]
public async Task<string> GoodsSimpleExport(GoodsTechnologyExportDto exportDto)
[HttpPost("/api/goods/goodsExport")]
public async Task<string> GoodsExport(GoodsExportDto exportDto)
{
return await _goodsService.GoodsSimpleExport(exportDto);
return await _goodsService.GoodsExport(exportDto);
}

[HttpPost("/api/goods/UpdateAction")]
public async Task<bool> UpdateAction()
{
return await _goodsService.UpdateAction();
}
}
}

+ 5
- 5
BPA.SAAS.Manage.Application/DataBase/GoodsTypeServices.cs Просмотреть файл

@@ -9,7 +9,7 @@ using System.Threading.Tasks;

namespace BPA.SAAS.Manage.Application.DataBase
{
[ApiDescriptionSettings("Goods", Tag = "商品类型管理")]
[ApiDescriptionSettings("Goods", Tag = "工艺分类管理")]
public class GoodsTypeServices: IDynamicApiController, ITransient
{
IGoodsTypeService _goodsTypeService;
@@ -38,7 +38,7 @@ namespace BPA.SAAS.Manage.Application.DataBase
return await _goodsTypeService.GetGoodsTypeList_alm();
}
/// <summary>
/// 添加商品类型
/// 添加工艺分类
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
@@ -48,7 +48,7 @@ namespace BPA.SAAS.Manage.Application.DataBase
return await _goodsTypeService.AddGoodsType(dto);
}
/// <summary>
/// 更新商品类型
/// 更新工艺分类
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
@@ -58,7 +58,7 @@ namespace BPA.SAAS.Manage.Application.DataBase
return await _goodsTypeService.UpdateGoodsType(dto);
}
/// <summary>
/// 删除商品类型
/// 删除工艺分类
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
@@ -68,7 +68,7 @@ namespace BPA.SAAS.Manage.Application.DataBase
return await _goodsTypeService.DelGoodsType(Id);
}
/// <summary>
/// 查询商品类型树结构
/// 查询工艺分类树结构
/// </summary>
/// <returns></returns>
[HttpGet("/api/goodstype/tree")]


+ 48
- 0
BPA.SAAS.Manage.Application/DataBase/Interface/IGoodsClassifyService.cs Просмотреть файл

@@ -0,0 +1,48 @@
using BPA.SAAS.Manage.Application.DataBase.Dtos.Goods;
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.Interface
{
public interface IGoodsClassifyService
{
/// <summary>
/// 分页获取商品分类
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
Task<PageUtil<List<GoodsClassifyDataDto>>> GetGoodsClassifyPage(GoodsClassifyDto dto);

/// <summary>
/// 更新商品分类
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
Task<bool> UpdateGoodsClassify(GoodsClassifyDataDto dto);

/// <summary>
/// 删除商品分类
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
Task<bool> DeleteGoodsClassify(string ids);

/// <summary>
/// 根据分类获取商品
/// </summary>
/// <param name="classifyId"></param>
/// <returns></returns>
Task<List<RelationGoodsIdDto>> GetRelation(string classifyId);

/// <summary>
/// 设置商品的分类
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
Task<bool> SetRelation(RelationDto dto);
}
}

+ 30
- 6
BPA.SAAS.Manage.Application/DataBase/Interface/IGoodsService.cs Просмотреть файл

@@ -22,11 +22,18 @@ namespace BPA.SAAS.Manage.Application.DataBase.Interface


/// <summary>
/// 获取商品信息(更具商品id)
/// 获取商品信息(根据设备id)
/// </summary>
/// <param name="GoodsIds"></param>
/// <param name="autoKey"></param>
/// <returns></returns>
Task<object> GetGoodsListByIds(List<string> GoodsIds);
Task<object> GetGoodsListByIds(string autoKey);

/// <summary>
/// 获取商品分类信息(根据设备id)
/// </summary>
/// <param name="autoKey"></param>
/// <returns></returns>
Task<object> GetGoodsClassifyByIds(string autoKey);

/// <summary>
/// 添加商品
@@ -122,18 +129,35 @@ namespace BPA.SAAS.Manage.Application.DataBase.Interface
/// <returns></returns>
Task<string> GoodsTechnologyExport(GoodsTechnologyExportDto exportDto);

/// <summary>
/// 商品工艺导出
/// </summary>
/// <param name="exportDto"></param>
/// <returns></returns>
Task<string> GoodsSimpleExport(GoodsTechnologyExportDto exportDto);

/// <summary>
/// 读取上传文件
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
Task<List<GoodsChooseDto>> GetFileToChoose([FromForm] GoodsInfoImportDto dto);

/// <summary>
/// 商品导入
/// </summary>
/// <param name="importDto"></param>
/// <returns></returns>
Task<bool> GoodsImport([FromForm] GoodsInfoImportDto importDto);
Task<bool> GoodsImport([FromForm] GoodsImportDto importDto);

/// <summary>
/// 商品工艺导出
/// 下载商品
/// </summary>
/// <param name="exportDto"></param>
/// <returns></returns>
Task<string> GoodsSimpleExport(GoodsTechnologyExportDto exportDto);
Task<string> GoodsExport(GoodsExportDto exportDto);


Task<bool> UpdateAction();
}
}

+ 4
- 4
BPA.SAAS.Manage.Application/DataBase/Interface/IGoodsTypeService.cs Просмотреть файл

@@ -18,25 +18,25 @@ namespace BPA.SAAS.Manage.Application.DataBase.Interface
Task<PageUtil> GetGoodsTypePage(GoodsTypeQueryDto dto);
Task<List<dynamic>> GetGoodsTypeList_alm();
/// <summary>
/// 添加商品类型
/// 添加工艺分类
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
Task<bool> AddGoodsType(GoodsTypeDto dto);
/// <summary>
/// 更新商品类型
/// 更新工艺分类
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
Task<bool> UpdateGoodsType(GoodsTypeDto dto);
/// <summary>
/// 删除商品类型
/// 删除工艺分类
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
Task<bool> DelGoodsType(string Id);
/// <summary>
/// 查询商品类型树结构
/// 查询工艺分类树结构
/// </summary>
/// <returns></returns>
Task<dynamic> GetGoodsTypeTree();


+ 5
- 4
BPA.SAAS.Manage.Application/DataBase/Services/BatchingService.cs Просмотреть файл

@@ -130,11 +130,12 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
/// <returns></returns>
public async Task<bool> AddBatching(BatchingInfoDto dto)
{
var productCode = _db.Queryable<BPA_Batching>().Where(x => x.IsDeleted == 0 && x.Code == dto.code).ToList();
if (productCode.Count() > 0)
{
var productCode = _db.Queryable<BPA_Batching>().First(x => x.Code == dto.code);
if (productCode != null)
throw Oops.Oh("编码已存在");
}
var productName = _db.Queryable<BPA_Batching>().First(t => t.Batching_Name == dto.Name);
if (productName != null)
throw Oops.Oh($"{dto.Name}已存在");
try
{
BPA_Batching bPA_Product = new BPA_Batching();


+ 2
- 2
BPA.SAAS.Manage.Application/DataBase/Services/BomService.cs Просмотреть файл

@@ -85,7 +85,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
try
{
_db.Ado.BeginTran();
// 查询数据库中是否存在未删除的商品类型
// 查询数据库中是否存在未删除的工艺分类
var resEntity = _db.Queryable<BPA_Bom>().Where(it => it.IsDeleted == 0).First(it => it.Id == dto.Id);
if (null == resEntity)
{
@@ -129,7 +129,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
try
{
_db.Ado.BeginTran();
// 查询数据库中是否存在未删除的商品类型
// 查询数据库中是否存在未删除的工艺分类
var resEntity = _db.Queryable<BPA_Bom>().Where(it => it.IsDeleted == 0).First(it => it.Id == dto.BomId);
if (null == resEntity)
{


+ 1
- 1
BPA.SAAS.Manage.Application/DataBase/Services/GoodsAttributePriceService.cs Просмотреть файл

@@ -83,7 +83,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
/// <returns></returns>
public async Task<bool> UpdateGoodsAttributePrice(GoodsAttributePriceDto dto)
{
// 查询数据库中是否存在未删除的商品类型
// 查询数据库中是否存在未删除的工艺分类
var resEntity = _db.Queryable<BPA_GoodsAttributePrice>().First(it => it.Id == dto.Id);
if (null == resEntity)
{


+ 1
- 1
BPA.SAAS.Manage.Application/DataBase/Services/GoodsAttributeService.cs Просмотреть файл

@@ -369,7 +369,7 @@ namespace BPA.Franchisee.Application.FranchiseeCenter.GoodsServices
public async Task<List<GoodsAttributeView>> GetGoodsAttributeViewList(string id)
{
var goodType = await _db.Queryable<BPA_GoodsType>().Where(x => x.Id == id).FirstAsync();
if (goodType == null) throw Oops.Oh("商品分类不存在");
if (goodType == null) throw Oops.Oh("工艺分类不存在");
var res = await _db.Queryable<BPA_GoodsAttribute>()
.Where(a => a.IsDeleted == 0)
.WhereIF(!id.IsNullOrWhiteSpace(), x => x.GoodsTypeId.Contains(id))


+ 169
- 0
BPA.SAAS.Manage.Application/DataBase/Services/GoodsClassifyService.cs Просмотреть файл

@@ -0,0 +1,169 @@
using BPA.SAAS.Manage.Application.DataBase.Dtos.Goods;
using BPA.SAAS.Manage.Application.DataBase.Interface;
using BPA.SAAS.Manage.Core.Base;
using BPA.SAAS.Manage.Core.DataBase;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.SAAS.Manage.Application.DataBase.Services
{
public class GoodsClassifyService : IGoodsClassifyService, ITransient
{
private readonly ISqlSugarClient _db;
public GoodsClassifyService(ISqlSugarClient db)
{
_db = db;
}

/// <summary>
/// 分页获取商品分类
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
public async Task<PageUtil<List<GoodsClassifyDataDto>>> GetGoodsClassifyPage(GoodsClassifyDto dto)
{
List<IConditionalModel> conModels = new List<IConditionalModel>();
if (!string.IsNullOrEmpty(dto.Name))
{
conModels.Add(new ConditionalModel() { FieldName = "Name", ConditionalType = ConditionalType.Like, FieldValue = dto.Name });
}
RefAsync<int> total = 0;
var data = await _db.Queryable<BPA_GoodsClassify>()
.Where(conModels)
.OrderBy(t => t.Sort)
.Select(t => new GoodsClassifyDataDto
{
Id = t.Id,
Name = t.Name,
Sort = t.Sort,
Remark = t.Remark,
}).ToPageListAsync(dto.Current, dto.PageSize, total);
return new PageUtil<List<GoodsClassifyDataDto>>()
{
Total = total,
Data = data
};
}

/// <summary>
/// 更新商品分类
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
public async Task<bool> UpdateGoodsClassify(GoodsClassifyDataDto dto)
{
var res = 0;
var classify = await _db.Queryable<BPA_GoodsClassify>().FirstAsync(t => t.Id == dto.Id);
if(classify == null)
{
var check = await _db.Queryable<BPA_GoodsClassify>().AnyAsync(t => t.Name == dto.Name);
if (check)
throw Oops.Oh("已存在该分类");
classify = new BPA_GoodsClassify
{
Name = dto.Name,
Sort = dto.Sort,
Remark = dto.Remark
};
res = await _db.Insertable(classify).CallEntityMethod(m => m.Create()).ExecuteCommandAsync();
}
else
{
classify.Name = dto.Name;
classify.Sort = dto.Sort;
classify.Remark = dto.Remark;
res = await _db.Updateable(classify).ExecuteCommandAsync();
}
return res > 0;
}

/// <summary>
/// 删除商品分类
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
public async Task<bool> DeleteGoodsClassify(string ids)
{
var res = 0;
try
{
_db.Ado.BeginTran();
var idList = ids.Split(",");
var classifyList = await _db.Queryable<BPA_GoodsClassify>().Where(t => idList.Contains(t.Id)).ToListAsync();
var relationList = await _db.Queryable<BPA_GoodsClassifyRelation>().Where(t => idList.Contains(t.ClassifyId)).ToListAsync();
var classifyDelList = new List<BPA_GoodsClassify>();
var relationDelList = new List<BPA_GoodsClassifyRelation>();
foreach (var id in idList)
{
var classify = classifyList.FirstOrDefault(t => t.Id == id);
if (classify == null)
throw Oops.Oh("商品分类不存在或已删除");
classifyDelList.Add(classify);
var relation = relationList.Where(t => t.ClassifyId == id).ToList();
relationDelList.AddRange(relation);
}
await _db.Deleteable(classifyDelList).ExecuteCommandAsync();
await _db.Deleteable(relationDelList).ExecuteCommandAsync();
_db.Ado.CommitTran();
return res > 0;
}
catch (Exception e)
{
_db.Ado.RollbackTran();
throw Oops.Oh(e.Message);
}
}

/// <summary>
/// 根据分类获取商品
/// </summary>
/// <param name="classifyId"></param>
/// <returns></returns>
public async Task<List<RelationGoodsIdDto>> GetRelation(string classifyId)
{
var result = await _db.Queryable<BPA_GoodsClassifyRelation>().Where(t => t.ClassifyId == classifyId)
.Select(a => new RelationGoodsIdDto
{
GoodsId = a.GoodsId,
}).ToListAsync();
return result;
}

/// <summary>
/// 设置商品的分类
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
public async Task<bool> SetRelation(RelationDto dto)
{
try
{
var res = 0;
_db.Ado.BeginTran();
await _db.Deleteable<BPA_GoodsClassifyRelation>().Where(t => t.ClassifyId == dto.ClassifyId).ExecuteCommandAsync();
var relationList = new List<BPA_GoodsClassifyRelation>();
foreach (var item in dto.GoodsIdList)
{
relationList.Add(new BPA_GoodsClassifyRelation
{
ClassifyId = dto.ClassifyId,
GoodsId = item.GoodsId
});
}
if (relationList.Count <= 0)
return true;
res = await _db.Insertable(relationList).CallEntityMethod(m => m.Create()).ExecuteCommandAsync();
_db.Ado.CommitTran();
return res > 0;
}
catch(Exception e)
{
_db.Ado.RollbackTran();
throw Oops.Oh(e.Message);
}
}
}
}

+ 1161
- 93
BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs
Разница между файлами не показана из-за своего большого размера
Просмотреть файл


+ 9
- 7
BPA.SAAS.Manage.Application/DataBase/Services/GoodsTechnologyService.cs Просмотреть файл

@@ -24,7 +24,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
}
#region 商品工艺(新版本工艺制作)
/// <summary>
/// 添加商品工艺
/// 更新商品工艺
/// </summary>
/// <param name="inputDto"></param>
/// <returns></returns>
@@ -37,8 +37,6 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
var list = _db.Queryable<BPA_GoodsTechnologyAction>().Where(x => x.DeviceId == inputDto[0].DeviceId && x.GoodsId == inputDto[0].GoodsId && x.GoodsAttributeId == inputDto[0].GoodsAttributeId && x.WarehousrTemplateId == inputDto[0].WarehousrTemplateId).ToList();
_db.Ado.BeginTran();
_db.Deleteable(list).ExecuteCommand();
//var list = _db.Queryable<BPA_GoodsTechnologyAction>().Where(x => x.GroupId == groupId && x.IsDeleted == 0).ToList();

for (int i = 0; i < inputDto.Count; i++)
{
var goodsinfo = _db.Queryable<BPA_GoodsInfo>().Where(x => x.Id == inputDto[i].GoodsId).First();
@@ -71,13 +69,17 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
_db.Ado.CommitTran();
return res > 0;
}
catch (Exception e)
catch (Exception)
{
_db.Ado.RollbackTran();
throw Oops.Oh("保存失败");
}

}
/// <summary>
/// 添加商品工艺
/// </summary>
/// <param name="inputDto"></param>
/// <returns></returns>
public async Task<bool> AddGoodsTechnologyAction(List<GoodsTechnologyActionBaseDto> inputDto)
{
try
@@ -121,9 +123,9 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
}
catch (Exception e)
{
_db.Ado.RollbackTran();
throw Oops.Oh("保存失败");
}

}
public async Task<List<GoodsTechnologyActionListView>> GetGoodsTechnologyAction(string goodsId)
{
@@ -400,7 +402,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
action.Id = Guid.NewGuid().ToString();
action.GoodsId = param.NewgoodsId;
action.GoodsAttributeId = param.NewgoodsAttributeId;
rum = await _db.Insertable(action).ExecuteCommandAsync();
rum = await _db.Insertable(action).CallEntityMethod(m => m.Create()).ExecuteCommandAsync();
}
_db.Ado.CommitTran();
return rum > 0;


+ 9
- 9
BPA.SAAS.Manage.Application/DataBase/Services/GoodsTypeService.cs Просмотреть файл

@@ -85,7 +85,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
return util;
}
/// <summary>
/// 添加商品类型
/// 添加工艺分类
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
@@ -156,7 +156,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
var oldValueList = attributeValueList.Where(it => it.GoodsAttributeId == oldAttribute.Id).ToList();
foreach (var _ in oldValueList.SelectMany(oldValue => actionList.Where(action => action.Contains(oldValue.Id)).Select(action => new { }).Select(_ => new { })))
{
throw Oops.Oh("该商品分类属性已存在工艺,请删除对应工艺才能修改!");
throw Oops.Oh("该工艺分类属性已存在工艺,请删除对应工艺才能修改!");
}

if (oldValueList.Count > 0)
@@ -201,13 +201,13 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
}
}
/// <summary>
/// 更新商品类型
/// 更新工艺分类
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
public async Task<bool> UpdateGoodsType(GoodsTypeDto dto)
{
// 查询数据库中是否存在未删除的商品类型
// 查询数据库中是否存在未删除的工艺分类
var resEntity = _db.Queryable<BPA_GoodsType>().First(it => it.Id == dto.Id);
if (null == resEntity)
{
@@ -238,7 +238,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
return res;
}
/// <summary>
/// 删除商品类型
/// 删除工艺分类
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
@@ -249,7 +249,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
_db.Ado.BeginTran();
var res = 0;
var ids = Id.Split(",");
// 查询数据库中是否存在未删除的商品类型
// 查询数据库中是否存在未删除的工艺分类
var check = _db.Queryable<BPA_GoodsInfo>().Any(it => ids.Contains(it.GoodsTypeId));
if (check)
{
@@ -275,14 +275,14 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
_db.Ado.CommitTran();
return res > 0;
}
catch (Exception)
catch (Exception e)
{
_db.Ado.RollbackTran();
throw Oops.Oh("删除失败!");
throw Oops.Oh(e.Message);
}
}
/// <summary>
/// 查询商品类型树结构
/// 查询工艺分类树结构
/// </summary>
/// <returns></returns>
public async Task<dynamic> GetGoodsTypeTree()


+ 1
- 0
BPA.SAAS.Manage.Application/Device/Dtos/Device/ProductVesionView.cs Просмотреть файл

@@ -15,6 +15,7 @@ namespace BPA.SAAS.Manage.Application.Device.Dtos.Device
public DateTime CreateAt { get; set; }
public string DeviceVersionId { get; set; }
public string TemplatePath { get; set; }
public string Remark { get; set; }
public List<TechnologyInfo> TechnologyInfo { get; set; }

}


+ 6
- 0
BPA.SAAS.Manage.Application/Device/Dtos/Device/TechnologyView.cs Просмотреть файл

@@ -17,4 +17,10 @@ namespace BPA.SAAS.Manage.Application.Device.Dtos.Device
public DateTime CreateAt { get; set; }
public List<BPA_TechnologyAction> TechnologyActionInfo { get; set; }
}

public class RecordRemarkDto
{
public string Id { get; set; }
public string Remark { get; set; }
}
}

+ 4
- 0
BPA.SAAS.Manage.Application/Device/Dtos/DeviceVesion/DeviceVesionBaseDto.cs Просмотреть файл

@@ -26,5 +26,9 @@ namespace BPA.SAAS.Manage.Application.Device.Dtos.DeviceVesion
/// </summary>
public string TemplatePath { get; set; }
public int Status { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
}
}

+ 5
- 0
BPA.SAAS.Manage.Application/Device/Dtos/DeviceVesion/DeviceVesionModel.cs Просмотреть файл

@@ -46,5 +46,10 @@ namespace BPA.SAAS.Manage.Application.Device.Dtos.DeviceVesion
/// 是否使用
/// </summary>
public bool IsUse { get;set; }

/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
}
}

+ 1
- 0
BPA.SAAS.Manage.Application/Device/Dtos/WarehouseTemplate/WarehouseTemplatDto.cs Просмотреть файл

@@ -11,6 +11,7 @@ namespace BPA.SAAS.Manage.Application.Device.Dtos.WarehouseTemplate
public string Id { get; set; }
public string DeviceId { get; set; }
public string TemplateName { get; set; }
public int Sort { get; set; }
public List<WarehousePostion> WarehousePostionData { get; set; }
}
public class WarehousePostion


+ 1
- 0
BPA.SAAS.Manage.Application/Device/Dtos/WarehouseTemplate/WarehouseTemplateView.cs Просмотреть файл

@@ -16,6 +16,7 @@ namespace BPA.SAAS.Manage.Application.Device.Dtos.WarehouseTemplate
public DateTime CreateAt { get; set; }
public int ProductNumber{ get; set; }
public string ProductUrl { get; set; }
public int Sort { get; set; }
public List<BPA_WarehousePostion> WarehousePostion { get; set; }
}
}

+ 6
- 0
BPA.SAAS.Manage.Application/Device/Interface/ITechnologyService.cs Просмотреть файл

@@ -19,5 +19,11 @@ namespace BPA.SAAS.Manage.Application.Device.Interface
/// <returns></returns>
Task<List<TechnologyView>> GetTechnologyList(string deviceId);
Task<List<TechnologyView>> GetTechnologyList_alm(string deviceId);
/// <summary>
/// 更新设备版本备注
/// </summary>
/// <param name="inputDto"></param>
/// <returns></returns>
Task<bool> UpdateRecodeRemark(RecordRemarkDto inputDto);
}
}

+ 14
- 11
BPA.SAAS.Manage.Application/Device/Services/DeviceVesionService.cs Просмотреть файл

@@ -30,21 +30,22 @@ namespace BPA.SAAS.Manage.Application.Device.Services
{
var total = new RefAsync<int>();
var deviceInfoList = await _db.Queryable<BPA_DeviceInfo>().ToListAsync();
var data = await _db.Queryable<BPA_ProductVesion,BPA_Product>((a, b) => new JoinQueryInfos(JoinType.Left, b.Id == a.ProductId))
var data = await _db.Queryable<BPA_ProductVesion, BPA_Product>((a, b) => new JoinQueryInfos(JoinType.Left, b.Id == a.ProductId))
.WhereIF(!string.IsNullOrWhiteSpace(inputDto.ProductName), (a, b) => b.Name.Contains(inputDto.ProductName))
.WhereIF(!string.IsNullOrWhiteSpace(inputDto.Vesion), (a, b) => a.Vesion.Contains(inputDto.Vesion))
.OrderBy(a => a.CreateAt, OrderByType.Desc)
.Select((a,b)=>new DeviceVesionModel()
.Select((a, b) => new DeviceVesionModel()
{
Id=a.Id.SelectAll(),
ProductName=b.Name,
ProductCode=b.Code,
ProductNumber=a.ProductNumber,
ProductUrl=a.ProductUrl,
Id = a.Id.SelectAll(),
ProductName = b.Name,
ProductCode = b.Code,
ProductNumber = a.ProductNumber,
ProductUrl = a.ProductUrl,
Remark = a.Remark,
})
.Mapper(x =>
{
var productList = deviceInfoList.Where(t=>t.ProductVersionId == x.Id).ToList();
var productList = deviceInfoList.Where(t => t.ProductVersionId == x.Id).ToList();
if (productList.Any())
x.IsUse = true;
})
@@ -62,7 +63,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services
/// 新增
/// </summary>
/// <returns></returns>
public async Task<bool> AddDeviceVesionAsync(DeviceVesionBaseDto inputDto)
{
try
@@ -78,7 +79,8 @@ namespace BPA.SAAS.Manage.Application.Device.Services
TemplatePath = inputDto.TemplatePath,
ProductNumber = inputDto.ProductNumber,
ProductUrl = inputDto.ProductUrl,
Status = CommonStatus.ENABLE
Status = CommonStatus.ENABLE,
Remark = inputDto.Remark
}).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync();
var Product = _db.Queryable<BPA_Product>().Where(x => x.Id == inputDto.ProductId).First();
#region 添加默认功能和topics
@@ -341,7 +343,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services
{
var data = await _db.Queryable<BPA_ProductVesion>().Where(x => x.Id == inputDto.Id).FirstAsync();
var old = await _db.Queryable<BPA_ProductVesion>().FirstAsync(t => t.ProductId == inputDto.ProductId && t.Vesion == inputDto.Vesion);
if(old != null && old.Id!=data.Id)
if (old != null && old.Id != data.Id)
throw Oops.Oh("已存在该版本的设备!");
var deviceInfo = await _db.Queryable<BPA_DeviceInfo>().Where(x => x.ProductVersionId == inputDto.Id).ToListAsync();
if (deviceInfo.Count > 0)
@@ -356,6 +358,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services
.SetColumns(t => t.ProductUrl == inputDto.ProductUrl)
.SetColumns(t => t.ProductId == inputDto.ProductId)
.SetColumns(t => t.Status == (CommonStatus)inputDto.Status).Where(t => t.Id == inputDto.Id)
.SetColumns(t => t.Remark == inputDto.Remark)
.ExecuteCommandHasChange();

return res;


+ 28
- 19
BPA.SAAS.Manage.Application/Device/Services/TechnologyService.cs Просмотреть файл

@@ -31,34 +31,33 @@ namespace BPA.SAAS.Manage.Application.Device.Services
public async Task<PageUtil> GetTechnologyExportRecodePage(TechnologyQueryInputDto inputDto)
{
var total = new RefAsync<int>();
var data = await _db.Queryable<BPA_TechnologyExportRecode,BPA_ProductVesion, BPA_Product>((a, b,c) => new JoinQueryInfos(
JoinType.Left, a.DeviceVersionId == b.Id,
JoinType.Left, a.ProductId == c.Id
))
var data = await _db.Queryable<BPA_TechnologyExportRecode, BPA_ProductVesion, BPA_Product>((a, b, c) => new JoinQueryInfos(
JoinType.Left, a.DeviceVersionId == b.Id,
JoinType.Left, a.ProductId == c.Id
))
.WhereIF(!string.IsNullOrWhiteSpace(inputDto.Vesion), (a, b, c) => b.Vesion == inputDto.Vesion)
.WhereIF(!string.IsNullOrWhiteSpace(inputDto.ProductName), (a, b, c) => inputDto.ProductName.Contains(c.Name))
.Select((a, b,c) => new ProductVesionView
{
Id =a.Id,
Vesion = b.Vesion,
ProductName = c.Name,
CreateAt = a.CreateAt,
DeviceVersionId = b.Id,
TemplatePath=a.TemplatePath
.Select((a, b, c) => new ProductVesionView
{
Id = a.Id,
Vesion = b.Vesion,
ProductName = c.Name,
CreateAt = a.CreateAt,
DeviceVersionId = b.Id,
TemplatePath = a.TemplatePath,
Remark = a.Remark
})
.OrderBy(a=>a.CreateAt, OrderByType.Desc)
.OrderBy(a => a.CreateAt, OrderByType.Desc)
.Mapper(x =>
{
//var TechnologyInfo1 = _db.Queryable<BPA_Technology>().Where(p => p.DeviceVersionId == x.DeviceVersionId).Select(f => new TechnologyInfo() { Id = f.Id, Name = f.Name, DeviceVersionId = f.DeviceVersionId }).ToList();
var TechnologyInfo = _db.Queryable<BPA_Technology>().Where(p => p.DeviceVersionId == x.DeviceVersionId).Select(f => new TechnologyInfo() { Id = f.Id, Name = f.Name, DeviceVersionId = f.DeviceVersionId,CreateAt=f.CreateAt }).Mapper(g =>
{
g.TechnologyActionInfo= _db.Queryable<BPA_TechnologyAction>().Where(d=>d.TechnologyId==g.Id).ToList();
}).ToList();
var TechnologyInfo = _db.Queryable<BPA_Technology>().Where(p => p.DeviceVersionId == x.DeviceVersionId).Select(f => new TechnologyInfo() { Id = f.Id, Name = f.Name, DeviceVersionId = f.DeviceVersionId, CreateAt = f.CreateAt }).Mapper(g =>
{
g.TechnologyActionInfo = _db.Queryable<BPA_TechnologyAction>().Where(d => d.TechnologyId == g.Id).ToList();
}).ToList();
x.TechnologyInfo = TechnologyInfo;
})
.ToPageListAsync(inputDto.Current, inputDto.PageSize, total);

return new PageUtil()
{
Data = data,
@@ -136,5 +135,15 @@ namespace BPA.SAAS.Manage.Application.Device.Services
throw Oops.Oh(e.Message);
}
}

public async Task<bool> UpdateRecodeRemark(RecordRemarkDto inputDto)
{
var data = await _db.Queryable<BPA_TechnologyExportRecode>().FirstAsync(t => t.Id == inputDto.Id);
if (data == null)
throw Oops.Oh("该设备版本不存在!");
data.Remark = inputDto.Remark;
var res = await _db.Updateable(data).ExecuteCommandAsync();
return res > 0;
}
}
}

+ 6
- 3
BPA.SAAS.Manage.Application/Device/Services/WarehouseTemplateService.cs Просмотреть файл

@@ -36,7 +36,8 @@ namespace BPA.SAAS.Manage.Application.Device.Services
TemplateName =a.TemplateName,
CreateAt =a.CreateAt,
ProductNumber=c.ProductNumber,
ProductUrl=c.ProductUrl
ProductUrl=c.ProductUrl,
Sort=a.Sort
})
.Mapper(x =>
{
@@ -65,7 +66,8 @@ namespace BPA.SAAS.Manage.Application.Device.Services
TemplateName = a.TemplateName,
CreateAt = a.CreateAt,
ProductNumber = c.ProductNumber,
ProductUrl = c.ProductUrl
ProductUrl = c.ProductUrl,
Sort = a.Sort
})
.Mapper(x =>
{
@@ -92,7 +94,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services
{
DeviceId = inputDto.DeviceId,
TemplateName = inputDto.TemplateName,
Sort = inputDto.Sort
}).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync();
List<BPA_WarehousePostion> list = new();
for (int i = 0; i < inputDto.WarehousePostionData.Count; i++)
@@ -159,6 +161,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services
var model = _db.Queryable<BPA_WarehouseTemplate>().Where(x => x.Id == inputDto.Id).First();
model.DeviceId= inputDto.DeviceId;
model.TemplateName= inputDto.TemplateName;
model.Sort = inputDto.Sort;
var res = await _db.Updateable(model).ExecuteCommandAsync();
var warehousePostion = _db.Queryable<BPA_WarehousePostion>().Where(x => x.TemplateId == inputDto.Id).ToList();
await _db.Deleteable(warehousePostion).ExecuteCommandAsync();


+ 10
- 0
BPA.SAAS.Manage.Application/Device/TechnologyServices.cs Просмотреть файл

@@ -54,5 +54,15 @@ namespace BPA.SAAS.Manage.Application.Device
{
return await _technologyService.GetTechnologyList_alm(deviceId);
}
/// <summary>
/// 更新设备版本备注
/// </summary>
/// <param name="inputDto"></param>
/// <returns></returns>
[HttpPost("/api/technology/UpdateRecodeRemark")]
public async Task<bool> UpdateRecodeRemark(RecordRemarkDto inputDto)
{
return await _technologyService.UpdateRecodeRemark(inputDto);
}
}
}

+ 2
- 3
BPA.SAAS.Manage.Comm/Util/ReadExcel.cs Просмотреть файл

@@ -62,13 +62,12 @@ namespace BPA.SAAS.Manage.Comm.Util
/// Excel转为List
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="fileStream"></param>
/// <param name="mapper"></param>
/// <param name="sheetname"></param>
/// <returns></returns>
public List<T> ExcelToList(Stream fileStream, Mapper mapper, string sheetname = "")
public List<T> ExcelToList(Mapper mapper, string sheetname = "")
{
List<T> ModelList = new List<T>();
// var mapper = new Mapper(fileStream);
List<RowInfo<T>> DataList = new List<RowInfo<T>>();
if (!string.IsNullOrEmpty(sheetname))
{


+ 0
- 1
BPA.SAAS.Manage.Core/Base/IBaseEntity.cs Просмотреть файл

@@ -40,6 +40,5 @@ namespace BPA.SAAS.Manage.Core.Base
this.CreateBy = "admin";
}
}

}
}

+ 19
- 0
BPA.SAAS.Manage.Core/DataBase/BPA_GoodsClassify.cs Просмотреть файл

@@ -0,0 +1,19 @@
using BPA.SAAS.Manage.Core.Base;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.SAAS.Manage.Core.DataBase
{
[SugarTable("bpa_goodsclassify")]
public class BPA_GoodsClassify : IBaseEntity, IGroupId
{
public string Name { get; set; }
public int Sort { get; set; }
public string Remark { get; set; }
public string GroupId { get; set; }
}
}

+ 18
- 0
BPA.SAAS.Manage.Core/DataBase/BPA_GoodsClassifyRelation.cs Просмотреть файл

@@ -0,0 +1,18 @@
using BPA.SAAS.Manage.Core.Base;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.SAAS.Manage.Core.DataBase
{
[SugarTable("bpa_goodsclassifyrelation")]
public class BPA_GoodsClassifyRelation : IBaseEntity, IGroupId
{
public string GoodsId { get; set; }
public string ClassifyId { get; set; }
public string GroupId { get; set; }
}
}

+ 4
- 0
BPA.SAAS.Manage.Core/Device/BPA_TechnologyExportRecode.cs Просмотреть файл

@@ -18,5 +18,9 @@ namespace BPA.SAAS.Manage.Core.Device
public string ProductId { get; set; }
public DateTime CreateAt { get; set; }
public string TemplatePath { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
}
}

+ 1
- 0
BPA.SAAS.Manage.Core/Device/BPA_WarehouseTemplate.cs Просмотреть файл

@@ -13,6 +13,7 @@ namespace BPA.SAAS.Manage.Core.Device
{
public string DeviceId { get; set; }
public string TemplateName { get; set; }
public int Sort { get; set; }
public string GroupId { get; set; }
}
}

+ 5
- 0
BPA.SAAS.Manage.Core/Product/BPA_ProductVesion.cs Просмотреть файл

@@ -37,5 +37,10 @@ namespace BPA.SAAS.Manage.Core.Product
/// 状态 0启用 1禁用
/// </summary>
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;

/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
}
}

+ 0
- 3
BPA.SAAS.Manage.Core/SqlSugarDb.cs Просмотреть файл

@@ -80,9 +80,6 @@ namespace BPA.KitChen.GroupMeal.SqlSugar
case "CreateAt":
entityInfo.SetValue(DateTime.Now);
break;
case "CreateBy":
entityInfo.SetValue("");
break;
case "GroupId":
entityInfo.SetValue(CurrentUser.GroupId);
break;


Загрузка…
Отмена
Сохранить