@@ -23,7 +23,5 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.BaseDto | |||||
public List<string> DeviceIdList { get; set; } | public List<string> DeviceIdList { get; set; } | ||||
public List<T> DataInfo { get; set; } | public List<T> DataInfo { get; set; } | ||||
} | } | ||||
} | } |
@@ -13,4 +13,12 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.BaseDto | |||||
public string succeeded { get; set; } | public string succeeded { get; set; } | ||||
public string errors { 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; } | |||||
} | |||||
} | } |
@@ -33,6 +33,14 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.CheckService | |||||
await _checkServices.CheckSign( key, signStr, signMd5); | 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); | |||||
} | |||||
} | } | ||||
} | } |
@@ -81,5 +81,18 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.CheckService.Ser | |||||
CurrentUser.GroupId = tenantId; | 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; | |||||
} | |||||
} | } | ||||
} | } |
@@ -18,5 +18,12 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.CheckService.Ser | |||||
///检查Sign | ///检查Sign | ||||
/// </summary> | /// </summary> | ||||
Task CheckSign(string key, string signStr, string signMd5); | Task CheckSign(string key, string signStr, string signMd5); | ||||
/// <summary> | |||||
/// 通过key获取用户Id | |||||
/// </summary> | |||||
/// <param name="key"></param> | |||||
/// <returns></returns> | |||||
Task<string> GetUserId(string key); | |||||
} | } | ||||
} | } |
@@ -59,5 +59,15 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Device | |||||
{ | { | ||||
return await _deviceService.DeleteDevice(ids); | 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); | |||||
} | |||||
} | } | ||||
} | } |
@@ -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; } | |||||
} | |||||
} |
@@ -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(); | var checkProductVesion = SqlSugarDb.Db.Queryable<BPA_ProductVesion>().Where(x => x.Id == dto.ProductVersionId).Any(); | ||||
if (!checkProductVesion) throw Oops.Oh(ErrorCodeEnum.Code10011); | 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; | |||||
} | |||||
} | } | ||||
} | } |
@@ -38,5 +38,12 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Device.Services | |||||
/// <param name="ids"></param> | /// <param name="ids"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
Task<bool> DeleteDevice(DeviceInfoDelDto ids); | Task<bool> DeleteDevice(DeviceInfoDelDto ids); | ||||
/// <summary> | |||||
/// 设备autoKey获取工艺 | |||||
/// </summary> | |||||
/// <param name="dto"></param> | |||||
/// <returns></returns> | |||||
Task<List<DeviceTechnogolyDateDto>> GetDeviceTechnology(DeviceTechnogolyRequestDto dto); | |||||
} | } | ||||
} | } |
@@ -6,20 +6,27 @@ using System.Threading.Tasks; | |||||
namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos | namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos | ||||
{ | { | ||||
public class GoodsAttributeinsertDto | |||||
public class GoodsAttributeInsertDto | |||||
{ | { | ||||
public string Id { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 属性名称 | /// 属性名称 | ||||
/// </summary> | /// </summary> | ||||
public string AttributeName { get; set; } | public string AttributeName { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 商品分类 | |||||
/// 工艺分类Id | |||||
/// </summary> | |||||
public string GoodsTypeId { get; set; } | |||||
/// <summary> | |||||
/// 工艺分类名称 | |||||
/// </summary> | /// </summary> | ||||
public string GoodsTypeName { get; set; } | 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 class GoodsAttributeInsertValue | ||||
{ | { | ||||
public string Id { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 属性值 | /// 属性值 | ||||
/// </summary> | /// </summary> | ||||
@@ -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; } | |||||
} | |||||
} |
@@ -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; } | |||||
} | |||||
} |
@@ -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; } | |||||
} | |||||
} |
@@ -8,6 +8,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos | |||||
{ | { | ||||
public class GoodsInsertDto | public class GoodsInsertDto | ||||
{ | { | ||||
public string Id { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 商品名称 | /// 商品名称 | ||||
/// </summary> | /// </summary> | ||||
@@ -29,12 +30,24 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos | |||||
/// </summary> | /// </summary> | ||||
public bool IsWeigh { get; set; } | public bool IsWeigh { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 商品分类id | |||||
/// 工艺分类id | |||||
/// </summary> | |||||
public string GoodsTypeId { get; set; } | |||||
/// <summary> | |||||
/// 工艺分类名称 | |||||
/// </summary> | /// </summary> | ||||
public string GoodsTypeName { get; set; } | public string GoodsTypeName { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 商品单位id | /// 商品单位id | ||||
/// </summary> | /// </summary> | ||||
public string GoodsUintId { get; set; } | |||||
/// <summary> | |||||
/// 商品单位名称 | |||||
/// </summary> | |||||
public string GoodsUintName { get; set; } | public string GoodsUintName { get; set; } | ||||
/// <summary> | |||||
/// 序号 | |||||
/// </summary> | |||||
public int Sort { get; set; } | |||||
} | } | ||||
} | } |
@@ -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; } | |||||
} | |||||
} |
@@ -13,6 +13,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos | |||||
public string WarehousrTemplateId { get; set; } | public string WarehousrTemplateId { get; set; } | ||||
public string GoodsAttributeId { get; set; } | public string GoodsAttributeId { get; set; } | ||||
public string TechnologyName { get; set; } | public string TechnologyName { get; set; } | ||||
public int Order { get; set; } | |||||
public List<GoodsTechnologyActionViewDto> Data { get; set; } | public List<GoodsTechnologyActionViewDto> Data { get; set; } | ||||
} | } | ||||
public class GoodsTechnologyActionViewDto | public class GoodsTechnologyActionViewDto | ||||
@@ -30,15 +31,21 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos | |||||
/// 商品属性id集合 | /// 商品属性id集合 | ||||
/// </summary> | /// </summary> | ||||
public string GoodsAttributeId { get; set; } | public string GoodsAttributeId { get; set; } | ||||
/// <summary> | |||||
/// 是否物料 | |||||
/// </summary> | |||||
public bool IsBatch { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 动作value | /// 动作value | ||||
/// </summary> | /// </summary> | ||||
public string ChnologyId { get; set; } | public string ChnologyId { get; set; } | ||||
public DateTime CreateAt { get; set; } | public DateTime CreateAt { get; set; } | ||||
public string GroupId { get; set; } | |||||
public int IsDeleted { get; set; } | |||||
public int Sort { get; set; } | public int Sort { get; set; } | ||||
public string GoodsId { get; set; } | public string GoodsId { get; set; } | ||||
public string DeviceId { get; set; } | public string DeviceId { get; set; } | ||||
public string WarehousrTemplateId { get; set; } | public string WarehousrTemplateId { get; set; } | ||||
public int Order { get; set; } | |||||
} | } | ||||
} | } |
@@ -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; } | |||||
} | |||||
} |
@@ -8,6 +8,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos | |||||
{ | { | ||||
public class GoodsUintInsertDto | public class GoodsUintInsertDto | ||||
{ | { | ||||
public string Id { get;set; } | |||||
public string Name { get; set; } | public string Name { get; set; } | ||||
public string Remark { get; set; } | public string Remark { get; set; } | ||||
} | } | ||||
@@ -30,12 +30,21 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos | |||||
/// </summary> | /// </summary> | ||||
public bool IsWeigh { get; set; } | public bool IsWeigh { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 商品分类id | |||||
/// 工艺分类id | |||||
/// </summary> | /// </summary> | ||||
public string GoodsTypeId { get; set; } | public string GoodsTypeId { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 工艺分类id | |||||
/// </summary> | |||||
public string GoodsTypeName { get; set; } | |||||
/// <summary> | |||||
/// 商品单位id | /// 商品单位id | ||||
/// </summary> | /// </summary> | ||||
public string GoodsUintId { get; set; } | public string GoodsUintId { get; set; } | ||||
/// <summary> | |||||
/// 商品单位id | |||||
/// </summary> | |||||
public string GoodsUintName { get; set; } | |||||
} | } | ||||
} | } |
@@ -8,8 +8,10 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos | |||||
{ | { | ||||
public class GoodstypeInsertDto | public class GoodstypeInsertDto | ||||
{ | { | ||||
public string Id { get;set;} | |||||
public string Pid { get; set; } | public string Pid { get; set; } | ||||
public string Name { get; set; } | public string Name { get; set; } | ||||
public int Sort { get; set; } | public int Sort { get; set; } | ||||
public string Remark { get; set; } | |||||
} | } | ||||
} | } |
@@ -38,7 +38,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods | |||||
/// <param name="dto"></param> | /// <param name="dto"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
[HttpPost("/api/ExternalPlatform/Goods/AddGoods")] | [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); | return await _goodsService.AddGoods(dto); | ||||
} | } | ||||
@@ -48,7 +48,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods | |||||
/// <param name="dto"></param> | /// <param name="dto"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
[HttpPost("/api/ExternalPlatform/Goods/UpdateGoods")] | [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); | return await _goodsService.UpdateGoods(dto); | ||||
} | } | ||||
@@ -68,7 +68,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods | |||||
/// <param name="dto"></param> | /// <param name="dto"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
[HttpPost("/api/ExternalPlatform/Goods/AddGoodsAttribute")] | [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); | return await _goodsService.AddGoodsAttribute(dto); | ||||
} | } | ||||
@@ -102,7 +102,27 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods | |||||
return await _goodsService.GetGoodsTechnologyAction(goodsId); | return await _goodsService.GetGoodsTechnologyAction(goodsId); | ||||
} | } | ||||
/// <summary> | /// <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> | /// </summary> | ||||
/// <param name="dto"></param> | /// <param name="dto"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
@@ -112,17 +132,17 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods | |||||
return await _goodsService.GetGoodsTypePage(dto); | return await _goodsService.GetGoodsTypePage(dto); | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 添加商品分类 | |||||
/// 添加工艺分类 | |||||
/// </summary> | /// </summary> | ||||
/// <param name="dto"></param> | /// <param name="dto"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
[HttpPost("/api/ExternalPlatform/Goods/AddGoodsType")] | [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); | return await _goodsService.AddGoodsType(dto); | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 修改商品分类 | |||||
/// 修改工艺分类 | |||||
/// </summary> | /// </summary> | ||||
/// <param name="dto"></param> | /// <param name="dto"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
@@ -132,7 +152,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods | |||||
return await _goodsService.UpdateGoodsType(dto); | return await _goodsService.UpdateGoodsType(dto); | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 删除商品分类 | |||||
/// 删除工艺分类 | |||||
/// </summary> | /// </summary> | ||||
/// <param name="dto"></param> | /// <param name="dto"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
@@ -157,7 +177,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods | |||||
/// <param name="dto"></param> | /// <param name="dto"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
[HttpPost("/api/ExternalPlatform/Goods/AddGoodsUint")] | [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); | return await _goodsService.AddGoodsUint(dto); | ||||
} | } | ||||
@@ -181,5 +201,27 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods | |||||
{ | { | ||||
return await _goodsService.DelGoodsUint(dto); | 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); | |||||
} | |||||
} | } | ||||
} | } |
@@ -22,13 +22,13 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services | |||||
/// </summary> | /// </summary> | ||||
/// <param name="dto"></param> | /// <param name="dto"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
Task<bool> AddGoods(BaseRequestDto<GoodsInsertDto> dto); | |||||
Task<List<ResponseMessageDto>> AddGoods(List<GoodsInsertDto> dto); | |||||
/// <summary> | /// <summary> | ||||
/// 更新商品 | /// 更新商品 | ||||
/// </summary> | /// </summary> | ||||
/// <param name="dto"></param> | /// <param name="dto"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
Task<bool> UpdateGoods(BaseRequestDto<GoodsUpdateDto> dto); | |||||
Task<bool> UpdateGoods(List<GoodsUpdateDto> dto); | |||||
/// <summary> | /// <summary> | ||||
/// 删除商品 | /// 删除商品 | ||||
/// </summary> | /// </summary> | ||||
@@ -40,7 +40,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services | |||||
/// </summary> | /// </summary> | ||||
/// <param name="dto"></param> | /// <param name="dto"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
Task<bool> AddGoodsAttribute(GoodsAttributeinsertDto dto); | |||||
Task<List<ResponseMessageDto>> AddGoodsAttribute(List<GoodsAttributeInsertDto> dto); | |||||
Task<bool> AddGoodsAttributeValue(List<GoodsAttributeValue> dto); | Task<bool> AddGoodsAttributeValue(List<GoodsAttributeValue> dto); | ||||
/// <summary> | /// <summary> | ||||
/// 查询商品属性 | /// 查询商品属性 | ||||
@@ -53,13 +53,42 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services | |||||
/// <param name="goodsId"></param> | /// <param name="goodsId"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
Task<List<GoodsTechnologyActionListViewDto>> GetGoodsTechnologyAction(GoodsIdDto goodsId); | 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<PageUtil> GetGoodsTypePage(GoodstypeQueryDto dto); | ||||
Task<bool> AddGoodsType(List<GoodstypeInsertDto> dto); | |||||
Task<List<ResponseMessageDto>> AddGoodsType(List<GoodstypeInsertDto> dto); | |||||
Task<bool> UpdateGoodsType(GoodstypeUpdateDto dto); | Task<bool> UpdateGoodsType(GoodstypeUpdateDto dto); | ||||
Task<bool> DelGoodsType(GoodstypeDelDto dto); | Task<bool> DelGoodsType(GoodstypeDelDto dto); | ||||
Task<PageUtil> GetGoodsUintPage(GoodsUintQueryDto 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> UpdateGoodsUint(GoodsUintUpdateDto dto); | ||||
Task<bool> DelGoodsUint(GoodsUintDelDto 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); | |||||
} | } | ||||
} | } |
@@ -67,20 +67,20 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Dtos | |||||
/// </summary> | /// </summary> | ||||
public string Name { get; set; } | public string Name { get; set; } | ||||
///// <summary> | |||||
///// 原料类型 | |||||
///// </summary> | |||||
//public string TypeId { get; set; } | |||||
/// <summary> | |||||
/// 原料类型Id | |||||
/// </summary> | |||||
public string TypeId { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 原料类型名称 | /// 原料类型名称 | ||||
/// </summary> | /// </summary> | ||||
public string TypeName { get; set; } | public string TypeName { get; set; } | ||||
///// <summary> | |||||
///// 物料单位 | |||||
///// </summary> | |||||
//public string UintId { get; set; } | |||||
/// <summary> | |||||
/// 物料单位Id | |||||
/// </summary> | |||||
public string UintId { get; set; } | |||||
/// <summary> | /// <summary> | ||||
@@ -92,37 +92,33 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Dtos | |||||
public class DelMaterialDto | 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> | |||||
/// </summary> | |||||
public string Name { get; set; } | public string Name { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 原料类型名称 | |||||
/// </summary> | |||||
/// 物料类型Id | |||||
/// </summary> | |||||
public string TypeId { get; set; } | |||||
/// <summary> | |||||
/// 物料类型名称 | |||||
/// </summary> | |||||
public string TypeName { get; set; } | public string TypeName { get; set; } | ||||
/// <summary> | |||||
/// 物料单位Id | |||||
/// </summary> | |||||
public string UintId { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 物料单位名称 | /// 物料单位名称 | ||||
/// </summary> | /// </summary> | ||||
public string UintName { get; set; } | public string UintName { get; set; } | ||||
} | } | ||||
public class MaterialUpdateDto | 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; } | |||||
} | |||||
} | } |
@@ -39,18 +39,18 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Service | |||||
/// <summary> | /// <summary> | ||||
/// 添加物料 | /// 添加物料 | ||||
/// </summary> | /// </summary> | ||||
/// <param name="InputDto"></param> | |||||
/// <param name="inputDto"></param> | |||||
/// <returns></returns> | /// <returns></returns> | ||||
[HttpPost("/api/ExternalPlatform/Material/AddMaterial")] | [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> | ||||
/// 删除物料 | /// 删除物料 | ||||
/// </summary> | /// </summary> | ||||
/// <param name="MaterialId"></param> | |||||
/// <param name="inputDto"></param> | |||||
/// <returns></returns> | /// <returns></returns> | ||||
[HttpPost("/api/ExternalPlatform/Material/DelMaterial")] | [HttpPost("/api/ExternalPlatform/Material/DelMaterial")] | ||||
public async Task<bool> DelMaterial(DelMaterialDto inputDto) | public async Task<bool> DelMaterial(DelMaterialDto inputDto) | ||||
@@ -62,12 +62,23 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Service | |||||
/// <summary> | /// <summary> | ||||
/// 修改物料 | /// 修改物料 | ||||
/// </summary> | /// </summary> | ||||
/// <param name="InputDto"></param> | |||||
/// <param name="inputDto"></param> | |||||
/// <returns></returns> | /// <returns></returns> | ||||
[HttpPost("/api/ExternalPlatform/Material/UpdateMateria")] | [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); | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -26,14 +26,14 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Service | |||||
/// <summary> | /// <summary> | ||||
/// 添加物料 | /// 添加物料 | ||||
/// </summary> | /// </summary> | ||||
/// <param name="InputDto"></param> | |||||
/// <param name="inputDto"></param> | |||||
/// <returns></returns> | /// <returns></returns> | ||||
Task<string> AddMaterial(BaseRequestDto<MaterialCreateDto> inputDto); | |||||
Task<List<ResponseMessageDto>> AddMaterial(List<MaterialCreateDto> inputDto); | |||||
/// <summary> | /// <summary> | ||||
/// 删除物料 | /// 删除物料 | ||||
/// </summary> | /// </summary> | ||||
/// <param name="MaterialId"></param> | |||||
/// <param name="inputDto"></param> | |||||
/// <returns></returns> | /// <returns></returns> | ||||
Task<bool> DelMaterial(DelMaterialDto inputDto); | Task<bool> DelMaterial(DelMaterialDto inputDto); | ||||
@@ -41,8 +41,15 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Service | |||||
/// <summary> | /// <summary> | ||||
/// 修改物料 | /// 修改物料 | ||||
/// </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> | /// <returns></returns> | ||||
Task<bool> UpdateMateria(BaseRequestDto<MaterialUpdateDto> inputDto); | |||||
Task<PageUtil<List<MaterialTypeDto>>> GetMaterialTypePageList(MaterialPageInputDto inputDto); | |||||
} | } | ||||
} | } |
@@ -17,6 +17,7 @@ using Microsoft.AspNetCore.Components.Forms; | |||||
using Newtonsoft.Json; | using Newtonsoft.Json; | ||||
using NPOI.SS.Formula.Functions; | using NPOI.SS.Formula.Functions; | ||||
using System.Drawing.Drawing2D; | using System.Drawing.Drawing2D; | ||||
using System.Text; | |||||
namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Services | 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>(); | 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, | new JoinQueryInfos(JoinType.Left, a.Batching_Type == b.Id, | ||||
JoinType.Left, a.StockUint == c.Id)) | JoinType.Left, a.StockUint == c.Id)) | ||||
.Where((a, b, c) => a.IsDeleted == 0) | .Where((a, b, c) => a.IsDeleted == 0) | ||||
@@ -50,12 +51,12 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Service | |||||
Id = a.Id, | Id = a.Id, | ||||
Code = a.Code, | Code = a.Code, | ||||
Name = a.Batching_Name, | Name = a.Batching_Name, | ||||
//TypeId = b.Id, | |||||
TypeId = b.Id, | |||||
TypeName = b.Name, | TypeName = b.Name, | ||||
// UintId = c.Id, | |||||
UintId = c.Id, | |||||
UintName = c.Name, | UintName = c.Name, | ||||
}).ToPageList(inputDto.Current, inputDto.PageSize, ref total); | |||||
}).ToPageListAsync(inputDto.Current, inputDto.PageSize, total); | |||||
return new PageUtil<List<MaterialDto>>() | return new PageUtil<List<MaterialDto>>() | ||||
{ | { | ||||
@@ -68,112 +69,186 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Service | |||||
/// <summary> | /// <summary> | ||||
/// 添加物料 | /// 添加物料 | ||||
/// </summary> | /// </summary> | ||||
/// <param name="InputDto"></param> | |||||
/// <param name="inputDto"></param> | |||||
/// <returns></returns> | /// <returns></returns> | ||||
public async Task<string> AddMaterial(BaseRequestDto<MaterialCreateDto> inputDto) | |||||
public async Task<List<ResponseMessageDto>> AddMaterial(List<MaterialCreateDto> inputDto) | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
var list=new List<BPA_Batching>(); | |||||
SqlSugarDb.Db.Ado.BeginTran(); | 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, | Aittribute = 0, | ||||
Batching_Name = item.Name, | Batching_Name = item.Name, | ||||
Batching_Type = typeData.Id, | |||||
Code = item.Code, | |||||
Batching_Type = item.TypeId, | |||||
Code = code, | |||||
Price = 0, | Price = 0, | ||||
Specs = "", | Specs = "", | ||||
outstockUint = uintData.Id, | |||||
outstockUint = item.UintId, | |||||
Status = CommonStatus.ENABLE, | Status = CommonStatus.ENABLE, | ||||
StockUint = uintData.Id, | |||||
TypeID = typeData.Id, | |||||
StockUint = item.UintId, | |||||
TypeID = item.TypeId, | |||||
IsDeleted = 0, | IsDeleted = 0, | ||||
CreateBy = userId | |||||
}; | }; | ||||
SqlSugarDb.Db.Insertable(materialData).ExecuteCommand(); | |||||
batchingAddList.Add(batchingInfo); | |||||
} | } | ||||
else | 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(); | 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 | #endregion | ||||
return JsonConvert.SerializeObject(list.Select(x => x.Id).ToList()); | |||||
} | } | ||||
catch (Exception e) | catch (Exception e) | ||||
{ | { | ||||
@@ -185,17 +260,15 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Service | |||||
/// <summary> | /// <summary> | ||||
/// 删除物料 | /// 删除物料 | ||||
/// </summary> | /// </summary> | ||||
/// <param name="MaterialId"></param> | |||||
/// <param name="inputDto"></param> | |||||
/// <returns></returns> | /// <returns></returns> | ||||
public async Task<bool> DelMaterial(DelMaterialDto inputDto) | public async Task<bool> DelMaterial(DelMaterialDto inputDto) | ||||
{ | { | ||||
try | 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) | if (materialData == null) | ||||
{ | |||||
throw Oops.Oh(ErrorCodeEnum.Code1003); | |||||
} | |||||
throw Oops.Oh("物料不存在"); | |||||
var res = await SqlSugarDb.Db.Deleteable(materialData).ExecuteCommandAsync(); | var res = await SqlSugarDb.Db.Deleteable(materialData).ExecuteCommandAsync(); | ||||
return res > 0; | return res > 0; | ||||
} | } | ||||
@@ -203,118 +276,105 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Service | |||||
{ | { | ||||
throw Oops.Oh(e.Message); | throw Oops.Oh(e.Message); | ||||
} | } | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 修改物料 | /// 修改物料 | ||||
/// </summary> | /// </summary> | ||||
/// <param name="InputDto"></param> | |||||
/// <param name="inputDto"></param> | |||||
/// <returns></returns> | /// <returns></returns> | ||||
public async Task<bool> UpdateMateria(BaseRequestDto<MaterialUpdateDto> inputDto) | |||||
public async Task<bool> UpdateMateria(List<MaterialUpdateDto> inputDto) | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
SqlSugarDb.Db.Ado.BeginTran(); | 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(); | 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; | return true; | ||||
} | } | ||||
catch (Exception e) | catch (Exception e) | ||||
@@ -323,5 +383,44 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Service | |||||
throw Oops.Oh(e.Message); | 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 | |||||
}; | |||||
} | |||||
} | } | ||||
} | } |
@@ -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; } | |||||
} | |||||
} |
@@ -25,21 +25,4 @@ namespace BPA.SAAS.Manage.Application.DataBase.Dtos.Goods | |||||
public string GoodsTypeId { get; set; } | public string GoodsTypeId { get; set; } | ||||
public string Status { 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; } | |||||
} | |||||
} | } |
@@ -1,4 +1,5 @@ | |||||
using System; | |||||
using Npoi.Mapper.Attributes; | |||||
using System; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Linq; | using System.Linq; | ||||
using System.Text; | using System.Text; | ||||
@@ -41,4 +42,103 @@ namespace BPA.SAAS.Manage.Application.DataBase.Dtos.Goods | |||||
/// </summary> | /// </summary> | ||||
public IFormFile File { get; set; } | 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; } | |||||
} | |||||
} | } |
@@ -13,19 +13,12 @@ namespace BPA.SAAS.Manage.Application.DataBase.Dtos.Goods | |||||
public string Names { get; set; } | public string Names { get; set; } | ||||
public List<GoodsTechnologyValueModel> Values { 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,6 +18,21 @@ namespace BPA.SAAS.Manage.Application.DataBase.Dtos | |||||
public List<GoodsInfoResultDto> GoodsInfoList{ get; set; } | 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 | public class GoodsAttributeResultDto | ||||
{ | { | ||||
@@ -25,6 +40,8 @@ namespace BPA.SAAS.Manage.Application.DataBase.Dtos | |||||
public string GoodsAttributeName { get; set; } | public string GoodsAttributeName { get; set; } | ||||
public int Sort { get; set; } | |||||
public List<GoodsAttributeValueResultDto> GoodsAttributeValueList { 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 GoodsAttributeId { get; set; } | ||||
public string GoodsAttributeValueId { get; set; } | public string GoodsAttributeValueId { get; set; } | ||||
public string AttributeValue { get; set; } | public string AttributeValue { get; set; } | ||||
public int Sort { get; set; } | |||||
} | } | ||||
public class GoodsResultDto | public class GoodsResultDto | ||||
@@ -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); | |||||
} | |||||
} | |||||
} |
@@ -33,14 +33,25 @@ namespace BPA.SAAS.Manage.Application.DataBase | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 获取商品信息(更具商品id) | |||||
/// 获取商品信息(根据设备id) | |||||
/// </summary> | /// </summary> | ||||
/// <param name="GoodsIds"></param> | |||||
/// <param name="autoKey"></param> | |||||
/// <returns></returns> | /// <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> | /// <summary> | ||||
@@ -225,26 +236,55 @@ namespace BPA.SAAS.Manage.Application.DataBase | |||||
return await _goodsService.GoodsTechnologyExport(exportDto); | 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> | ||||
/// 商品导入 | /// 商品导入 | ||||
/// </summary> | /// </summary> | ||||
/// <param name="importDto"></param> | /// <param name="importDto"></param> | ||||
/// <returns></returns> | /// <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); | return await _goodsService.GoodsImport(importDto); | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 商品工艺导出 | |||||
/// 下载商品 | |||||
/// </summary> | /// </summary> | ||||
/// <param name="exportDto"></param> | /// <param name="exportDto"></param> | ||||
/// <returns></returns> | /// <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(); | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -9,7 +9,7 @@ using System.Threading.Tasks; | |||||
namespace BPA.SAAS.Manage.Application.DataBase | namespace BPA.SAAS.Manage.Application.DataBase | ||||
{ | { | ||||
[ApiDescriptionSettings("Goods", Tag = "商品类型管理")] | |||||
[ApiDescriptionSettings("Goods", Tag = "工艺分类管理")] | |||||
public class GoodsTypeServices: IDynamicApiController, ITransient | public class GoodsTypeServices: IDynamicApiController, ITransient | ||||
{ | { | ||||
IGoodsTypeService _goodsTypeService; | IGoodsTypeService _goodsTypeService; | ||||
@@ -38,7 +38,7 @@ namespace BPA.SAAS.Manage.Application.DataBase | |||||
return await _goodsTypeService.GetGoodsTypeList_alm(); | return await _goodsTypeService.GetGoodsTypeList_alm(); | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 添加商品类型 | |||||
/// 添加工艺分类 | |||||
/// </summary> | /// </summary> | ||||
/// <param name="dto"></param> | /// <param name="dto"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
@@ -48,7 +48,7 @@ namespace BPA.SAAS.Manage.Application.DataBase | |||||
return await _goodsTypeService.AddGoodsType(dto); | return await _goodsTypeService.AddGoodsType(dto); | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 更新商品类型 | |||||
/// 更新工艺分类 | |||||
/// </summary> | /// </summary> | ||||
/// <param name="dto"></param> | /// <param name="dto"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
@@ -58,7 +58,7 @@ namespace BPA.SAAS.Manage.Application.DataBase | |||||
return await _goodsTypeService.UpdateGoodsType(dto); | return await _goodsTypeService.UpdateGoodsType(dto); | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 删除商品类型 | |||||
/// 删除工艺分类 | |||||
/// </summary> | /// </summary> | ||||
/// <param name="Id"></param> | /// <param name="Id"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
@@ -68,7 +68,7 @@ namespace BPA.SAAS.Manage.Application.DataBase | |||||
return await _goodsTypeService.DelGoodsType(Id); | return await _goodsTypeService.DelGoodsType(Id); | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 查询商品类型树结构 | |||||
/// 查询工艺分类树结构 | |||||
/// </summary> | /// </summary> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
[HttpGet("/api/goodstype/tree")] | [HttpGet("/api/goodstype/tree")] | ||||
@@ -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); | |||||
} | |||||
} |
@@ -22,11 +22,18 @@ namespace BPA.SAAS.Manage.Application.DataBase.Interface | |||||
/// <summary> | /// <summary> | ||||
/// 获取商品信息(更具商品id) | |||||
/// 获取商品信息(根据设备id) | |||||
/// </summary> | /// </summary> | ||||
/// <param name="GoodsIds"></param> | |||||
/// <param name="autoKey"></param> | |||||
/// <returns></returns> | /// <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> | /// <summary> | ||||
/// 添加商品 | /// 添加商品 | ||||
@@ -122,18 +129,35 @@ namespace BPA.SAAS.Manage.Application.DataBase.Interface | |||||
/// <returns></returns> | /// <returns></returns> | ||||
Task<string> GoodsTechnologyExport(GoodsTechnologyExportDto exportDto); | 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> | ||||
/// 商品导入 | /// 商品导入 | ||||
/// </summary> | /// </summary> | ||||
/// <param name="importDto"></param> | /// <param name="importDto"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
Task<bool> GoodsImport([FromForm] GoodsInfoImportDto importDto); | |||||
Task<bool> GoodsImport([FromForm] GoodsImportDto importDto); | |||||
/// <summary> | /// <summary> | ||||
/// 商品工艺导出 | |||||
/// 下载商品 | |||||
/// </summary> | /// </summary> | ||||
/// <param name="exportDto"></param> | /// <param name="exportDto"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
Task<string> GoodsSimpleExport(GoodsTechnologyExportDto exportDto); | |||||
Task<string> GoodsExport(GoodsExportDto exportDto); | |||||
Task<bool> UpdateAction(); | |||||
} | } | ||||
} | } |
@@ -18,25 +18,25 @@ namespace BPA.SAAS.Manage.Application.DataBase.Interface | |||||
Task<PageUtil> GetGoodsTypePage(GoodsTypeQueryDto dto); | Task<PageUtil> GetGoodsTypePage(GoodsTypeQueryDto dto); | ||||
Task<List<dynamic>> GetGoodsTypeList_alm(); | Task<List<dynamic>> GetGoodsTypeList_alm(); | ||||
/// <summary> | /// <summary> | ||||
/// 添加商品类型 | |||||
/// 添加工艺分类 | |||||
/// </summary> | /// </summary> | ||||
/// <param name="dto"></param> | /// <param name="dto"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
Task<bool> AddGoodsType(GoodsTypeDto dto); | Task<bool> AddGoodsType(GoodsTypeDto dto); | ||||
/// <summary> | /// <summary> | ||||
/// 更新商品类型 | |||||
/// 更新工艺分类 | |||||
/// </summary> | /// </summary> | ||||
/// <param name="dto"></param> | /// <param name="dto"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
Task<bool> UpdateGoodsType(GoodsTypeDto dto); | Task<bool> UpdateGoodsType(GoodsTypeDto dto); | ||||
/// <summary> | /// <summary> | ||||
/// 删除商品类型 | |||||
/// 删除工艺分类 | |||||
/// </summary> | /// </summary> | ||||
/// <param name="Id"></param> | /// <param name="Id"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
Task<bool> DelGoodsType(string Id); | Task<bool> DelGoodsType(string Id); | ||||
/// <summary> | /// <summary> | ||||
/// 查询商品类型树结构 | |||||
/// 查询工艺分类树结构 | |||||
/// </summary> | /// </summary> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
Task<dynamic> GetGoodsTypeTree(); | Task<dynamic> GetGoodsTypeTree(); | ||||
@@ -130,11 +130,12 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||||
/// <returns></returns> | /// <returns></returns> | ||||
public async Task<bool> AddBatching(BatchingInfoDto dto) | 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("编码已存在"); | 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 | try | ||||
{ | { | ||||
BPA_Batching bPA_Product = new BPA_Batching(); | BPA_Batching bPA_Product = new BPA_Batching(); | ||||
@@ -85,7 +85,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||||
try | try | ||||
{ | { | ||||
_db.Ado.BeginTran(); | _db.Ado.BeginTran(); | ||||
// 查询数据库中是否存在未删除的商品类型 | |||||
// 查询数据库中是否存在未删除的工艺分类 | |||||
var resEntity = _db.Queryable<BPA_Bom>().Where(it => it.IsDeleted == 0).First(it => it.Id == dto.Id); | var resEntity = _db.Queryable<BPA_Bom>().Where(it => it.IsDeleted == 0).First(it => it.Id == dto.Id); | ||||
if (null == resEntity) | if (null == resEntity) | ||||
{ | { | ||||
@@ -129,7 +129,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||||
try | try | ||||
{ | { | ||||
_db.Ado.BeginTran(); | _db.Ado.BeginTran(); | ||||
// 查询数据库中是否存在未删除的商品类型 | |||||
// 查询数据库中是否存在未删除的工艺分类 | |||||
var resEntity = _db.Queryable<BPA_Bom>().Where(it => it.IsDeleted == 0).First(it => it.Id == dto.BomId); | var resEntity = _db.Queryable<BPA_Bom>().Where(it => it.IsDeleted == 0).First(it => it.Id == dto.BomId); | ||||
if (null == resEntity) | if (null == resEntity) | ||||
{ | { | ||||
@@ -83,7 +83,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||||
/// <returns></returns> | /// <returns></returns> | ||||
public async Task<bool> UpdateGoodsAttributePrice(GoodsAttributePriceDto dto) | public async Task<bool> UpdateGoodsAttributePrice(GoodsAttributePriceDto dto) | ||||
{ | { | ||||
// 查询数据库中是否存在未删除的商品类型 | |||||
// 查询数据库中是否存在未删除的工艺分类 | |||||
var resEntity = _db.Queryable<BPA_GoodsAttributePrice>().First(it => it.Id == dto.Id); | var resEntity = _db.Queryable<BPA_GoodsAttributePrice>().First(it => it.Id == dto.Id); | ||||
if (null == resEntity) | if (null == resEntity) | ||||
{ | { | ||||
@@ -369,7 +369,7 @@ namespace BPA.Franchisee.Application.FranchiseeCenter.GoodsServices | |||||
public async Task<List<GoodsAttributeView>> GetGoodsAttributeViewList(string id) | public async Task<List<GoodsAttributeView>> GetGoodsAttributeViewList(string id) | ||||
{ | { | ||||
var goodType = await _db.Queryable<BPA_GoodsType>().Where(x => x.Id == id).FirstAsync(); | 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>() | var res = await _db.Queryable<BPA_GoodsAttribute>() | ||||
.Where(a => a.IsDeleted == 0) | .Where(a => a.IsDeleted == 0) | ||||
.WhereIF(!id.IsNullOrWhiteSpace(), x => x.GoodsTypeId.Contains(id)) | .WhereIF(!id.IsNullOrWhiteSpace(), x => x.GoodsTypeId.Contains(id)) | ||||
@@ -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); | |||||
} | |||||
} | |||||
} | |||||
} |
@@ -24,7 +24,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||||
} | } | ||||
#region 商品工艺(新版本工艺制作) | #region 商品工艺(新版本工艺制作) | ||||
/// <summary> | /// <summary> | ||||
/// 添加商品工艺 | |||||
/// 更新商品工艺 | |||||
/// </summary> | /// </summary> | ||||
/// <param name="inputDto"></param> | /// <param name="inputDto"></param> | ||||
/// <returns></returns> | /// <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(); | 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.Ado.BeginTran(); | ||||
_db.Deleteable(list).ExecuteCommand(); | _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++) | for (int i = 0; i < inputDto.Count; i++) | ||||
{ | { | ||||
var goodsinfo = _db.Queryable<BPA_GoodsInfo>().Where(x => x.Id == inputDto[i].GoodsId).First(); | 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(); | _db.Ado.CommitTran(); | ||||
return res > 0; | return res > 0; | ||||
} | } | ||||
catch (Exception e) | |||||
catch (Exception) | |||||
{ | { | ||||
_db.Ado.RollbackTran(); | _db.Ado.RollbackTran(); | ||||
throw Oops.Oh("保存失败"); | throw Oops.Oh("保存失败"); | ||||
} | } | ||||
} | } | ||||
/// <summary> | |||||
/// 添加商品工艺 | |||||
/// </summary> | |||||
/// <param name="inputDto"></param> | |||||
/// <returns></returns> | |||||
public async Task<bool> AddGoodsTechnologyAction(List<GoodsTechnologyActionBaseDto> inputDto) | public async Task<bool> AddGoodsTechnologyAction(List<GoodsTechnologyActionBaseDto> inputDto) | ||||
{ | { | ||||
try | try | ||||
@@ -121,9 +123,9 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||||
} | } | ||||
catch (Exception e) | catch (Exception e) | ||||
{ | { | ||||
_db.Ado.RollbackTran(); | |||||
throw Oops.Oh("保存失败"); | throw Oops.Oh("保存失败"); | ||||
} | } | ||||
} | } | ||||
public async Task<List<GoodsTechnologyActionListView>> GetGoodsTechnologyAction(string goodsId) | 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.Id = Guid.NewGuid().ToString(); | ||||
action.GoodsId = param.NewgoodsId; | action.GoodsId = param.NewgoodsId; | ||||
action.GoodsAttributeId = param.NewgoodsAttributeId; | action.GoodsAttributeId = param.NewgoodsAttributeId; | ||||
rum = await _db.Insertable(action).ExecuteCommandAsync(); | |||||
rum = await _db.Insertable(action).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); | |||||
} | } | ||||
_db.Ado.CommitTran(); | _db.Ado.CommitTran(); | ||||
return rum > 0; | return rum > 0; | ||||
@@ -85,7 +85,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||||
return util; | return util; | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 添加商品类型 | |||||
/// 添加工艺分类 | |||||
/// </summary> | /// </summary> | ||||
/// <param name="dto"></param> | /// <param name="dto"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
@@ -156,7 +156,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||||
var oldValueList = attributeValueList.Where(it => it.GoodsAttributeId == oldAttribute.Id).ToList(); | 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 { }))) | 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) | if (oldValueList.Count > 0) | ||||
@@ -201,13 +201,13 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||||
} | } | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 更新商品类型 | |||||
/// 更新工艺分类 | |||||
/// </summary> | /// </summary> | ||||
/// <param name="dto"></param> | /// <param name="dto"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
public async Task<bool> UpdateGoodsType(GoodsTypeDto dto) | public async Task<bool> UpdateGoodsType(GoodsTypeDto dto) | ||||
{ | { | ||||
// 查询数据库中是否存在未删除的商品类型 | |||||
// 查询数据库中是否存在未删除的工艺分类 | |||||
var resEntity = _db.Queryable<BPA_GoodsType>().First(it => it.Id == dto.Id); | var resEntity = _db.Queryable<BPA_GoodsType>().First(it => it.Id == dto.Id); | ||||
if (null == resEntity) | if (null == resEntity) | ||||
{ | { | ||||
@@ -238,7 +238,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||||
return res; | return res; | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 删除商品类型 | |||||
/// 删除工艺分类 | |||||
/// </summary> | /// </summary> | ||||
/// <param name="Id"></param> | /// <param name="Id"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
@@ -249,7 +249,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||||
_db.Ado.BeginTran(); | _db.Ado.BeginTran(); | ||||
var res = 0; | var res = 0; | ||||
var ids = Id.Split(","); | var ids = Id.Split(","); | ||||
// 查询数据库中是否存在未删除的商品类型 | |||||
// 查询数据库中是否存在未删除的工艺分类 | |||||
var check = _db.Queryable<BPA_GoodsInfo>().Any(it => ids.Contains(it.GoodsTypeId)); | var check = _db.Queryable<BPA_GoodsInfo>().Any(it => ids.Contains(it.GoodsTypeId)); | ||||
if (check) | if (check) | ||||
{ | { | ||||
@@ -275,14 +275,14 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||||
_db.Ado.CommitTran(); | _db.Ado.CommitTran(); | ||||
return res > 0; | return res > 0; | ||||
} | } | ||||
catch (Exception) | |||||
catch (Exception e) | |||||
{ | { | ||||
_db.Ado.RollbackTran(); | _db.Ado.RollbackTran(); | ||||
throw Oops.Oh("删除失败!"); | |||||
throw Oops.Oh(e.Message); | |||||
} | } | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 查询商品类型树结构 | |||||
/// 查询工艺分类树结构 | |||||
/// </summary> | /// </summary> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
public async Task<dynamic> GetGoodsTypeTree() | public async Task<dynamic> GetGoodsTypeTree() | ||||
@@ -15,6 +15,7 @@ namespace BPA.SAAS.Manage.Application.Device.Dtos.Device | |||||
public DateTime CreateAt { get; set; } | public DateTime CreateAt { get; set; } | ||||
public string DeviceVersionId { get; set; } | public string DeviceVersionId { get; set; } | ||||
public string TemplatePath { get; set; } | public string TemplatePath { get; set; } | ||||
public string Remark { get; set; } | |||||
public List<TechnologyInfo> TechnologyInfo { get; set; } | public List<TechnologyInfo> TechnologyInfo { get; set; } | ||||
} | } | ||||
@@ -17,4 +17,10 @@ namespace BPA.SAAS.Manage.Application.Device.Dtos.Device | |||||
public DateTime CreateAt { get; set; } | public DateTime CreateAt { get; set; } | ||||
public List<BPA_TechnologyAction> TechnologyActionInfo { get; set; } | public List<BPA_TechnologyAction> TechnologyActionInfo { get; set; } | ||||
} | } | ||||
public class RecordRemarkDto | |||||
{ | |||||
public string Id { get; set; } | |||||
public string Remark { get; set; } | |||||
} | |||||
} | } |
@@ -26,5 +26,9 @@ namespace BPA.SAAS.Manage.Application.Device.Dtos.DeviceVesion | |||||
/// </summary> | /// </summary> | ||||
public string TemplatePath { get; set; } | public string TemplatePath { get; set; } | ||||
public int Status { get; set; } | public int Status { get; set; } | ||||
/// <summary> | |||||
/// 备注 | |||||
/// </summary> | |||||
public string Remark { get; set; } | |||||
} | } | ||||
} | } |
@@ -46,5 +46,10 @@ namespace BPA.SAAS.Manage.Application.Device.Dtos.DeviceVesion | |||||
/// 是否使用 | /// 是否使用 | ||||
/// </summary> | /// </summary> | ||||
public bool IsUse { get;set; } | public bool IsUse { get;set; } | ||||
/// <summary> | |||||
/// 备注 | |||||
/// </summary> | |||||
public string Remark { get; set; } | |||||
} | } | ||||
} | } |
@@ -11,6 +11,7 @@ namespace BPA.SAAS.Manage.Application.Device.Dtos.WarehouseTemplate | |||||
public string Id { get; set; } | public string Id { get; set; } | ||||
public string DeviceId { get; set; } | public string DeviceId { get; set; } | ||||
public string TemplateName { get; set; } | public string TemplateName { get; set; } | ||||
public int Sort { get; set; } | |||||
public List<WarehousePostion> WarehousePostionData { get; set; } | public List<WarehousePostion> WarehousePostionData { get; set; } | ||||
} | } | ||||
public class WarehousePostion | public class WarehousePostion | ||||
@@ -16,6 +16,7 @@ namespace BPA.SAAS.Manage.Application.Device.Dtos.WarehouseTemplate | |||||
public DateTime CreateAt { get; set; } | public DateTime CreateAt { get; set; } | ||||
public int ProductNumber{ get; set; } | public int ProductNumber{ get; set; } | ||||
public string ProductUrl { get; set; } | public string ProductUrl { get; set; } | ||||
public int Sort { get; set; } | |||||
public List<BPA_WarehousePostion> WarehousePostion { get; set; } | public List<BPA_WarehousePostion> WarehousePostion { get; set; } | ||||
} | } | ||||
} | } |
@@ -19,5 +19,11 @@ namespace BPA.SAAS.Manage.Application.Device.Interface | |||||
/// <returns></returns> | /// <returns></returns> | ||||
Task<List<TechnologyView>> GetTechnologyList(string deviceId); | Task<List<TechnologyView>> GetTechnologyList(string deviceId); | ||||
Task<List<TechnologyView>> GetTechnologyList_alm(string deviceId); | Task<List<TechnologyView>> GetTechnologyList_alm(string deviceId); | ||||
/// <summary> | |||||
/// 更新设备版本备注 | |||||
/// </summary> | |||||
/// <param name="inputDto"></param> | |||||
/// <returns></returns> | |||||
Task<bool> UpdateRecodeRemark(RecordRemarkDto inputDto); | |||||
} | } | ||||
} | } |
@@ -30,21 +30,22 @@ namespace BPA.SAAS.Manage.Application.Device.Services | |||||
{ | { | ||||
var total = new RefAsync<int>(); | var total = new RefAsync<int>(); | ||||
var deviceInfoList = await _db.Queryable<BPA_DeviceInfo>().ToListAsync(); | 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.ProductName), (a, b) => b.Name.Contains(inputDto.ProductName)) | ||||
.WhereIF(!string.IsNullOrWhiteSpace(inputDto.Vesion), (a, b) => a.Vesion.Contains(inputDto.Vesion)) | .WhereIF(!string.IsNullOrWhiteSpace(inputDto.Vesion), (a, b) => a.Vesion.Contains(inputDto.Vesion)) | ||||
.OrderBy(a => a.CreateAt, OrderByType.Desc) | .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 => | .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()) | if (productList.Any()) | ||||
x.IsUse = true; | x.IsUse = true; | ||||
}) | }) | ||||
@@ -62,7 +63,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services | |||||
/// 新增 | /// 新增 | ||||
/// </summary> | /// </summary> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
public async Task<bool> AddDeviceVesionAsync(DeviceVesionBaseDto inputDto) | public async Task<bool> AddDeviceVesionAsync(DeviceVesionBaseDto inputDto) | ||||
{ | { | ||||
try | try | ||||
@@ -78,7 +79,8 @@ namespace BPA.SAAS.Manage.Application.Device.Services | |||||
TemplatePath = inputDto.TemplatePath, | TemplatePath = inputDto.TemplatePath, | ||||
ProductNumber = inputDto.ProductNumber, | ProductNumber = inputDto.ProductNumber, | ||||
ProductUrl = inputDto.ProductUrl, | ProductUrl = inputDto.ProductUrl, | ||||
Status = CommonStatus.ENABLE | |||||
Status = CommonStatus.ENABLE, | |||||
Remark = inputDto.Remark | |||||
}).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync(); | }).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync(); | ||||
var Product = _db.Queryable<BPA_Product>().Where(x => x.Id == inputDto.ProductId).First(); | var Product = _db.Queryable<BPA_Product>().Where(x => x.Id == inputDto.ProductId).First(); | ||||
#region 添加默认功能和topics | #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 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); | 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("已存在该版本的设备!"); | throw Oops.Oh("已存在该版本的设备!"); | ||||
var deviceInfo = await _db.Queryable<BPA_DeviceInfo>().Where(x => x.ProductVersionId == inputDto.Id).ToListAsync(); | var deviceInfo = await _db.Queryable<BPA_DeviceInfo>().Where(x => x.ProductVersionId == inputDto.Id).ToListAsync(); | ||||
if (deviceInfo.Count > 0) | if (deviceInfo.Count > 0) | ||||
@@ -356,6 +358,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services | |||||
.SetColumns(t => t.ProductUrl == inputDto.ProductUrl) | .SetColumns(t => t.ProductUrl == inputDto.ProductUrl) | ||||
.SetColumns(t => t.ProductId == inputDto.ProductId) | .SetColumns(t => t.ProductId == inputDto.ProductId) | ||||
.SetColumns(t => t.Status == (CommonStatus)inputDto.Status).Where(t => t.Id == inputDto.Id) | .SetColumns(t => t.Status == (CommonStatus)inputDto.Status).Where(t => t.Id == inputDto.Id) | ||||
.SetColumns(t => t.Remark == inputDto.Remark) | |||||
.ExecuteCommandHasChange(); | .ExecuteCommandHasChange(); | ||||
return res; | return res; | ||||
@@ -31,34 +31,33 @@ namespace BPA.SAAS.Manage.Application.Device.Services | |||||
public async Task<PageUtil> GetTechnologyExportRecodePage(TechnologyQueryInputDto inputDto) | public async Task<PageUtil> GetTechnologyExportRecodePage(TechnologyQueryInputDto inputDto) | ||||
{ | { | ||||
var total = new RefAsync<int>(); | 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.Vesion), (a, b, c) => b.Vesion == inputDto.Vesion) | ||||
.WhereIF(!string.IsNullOrWhiteSpace(inputDto.ProductName), (a, b, c) => inputDto.ProductName.Contains(c.Name)) | .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 => | .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 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; | x.TechnologyInfo = TechnologyInfo; | ||||
}) | }) | ||||
.ToPageListAsync(inputDto.Current, inputDto.PageSize, total); | .ToPageListAsync(inputDto.Current, inputDto.PageSize, total); | ||||
return new PageUtil() | return new PageUtil() | ||||
{ | { | ||||
Data = data, | Data = data, | ||||
@@ -136,5 +135,15 @@ namespace BPA.SAAS.Manage.Application.Device.Services | |||||
throw Oops.Oh(e.Message); | 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; | |||||
} | |||||
} | } | ||||
} | } |
@@ -36,7 +36,8 @@ namespace BPA.SAAS.Manage.Application.Device.Services | |||||
TemplateName =a.TemplateName, | TemplateName =a.TemplateName, | ||||
CreateAt =a.CreateAt, | CreateAt =a.CreateAt, | ||||
ProductNumber=c.ProductNumber, | ProductNumber=c.ProductNumber, | ||||
ProductUrl=c.ProductUrl | |||||
ProductUrl=c.ProductUrl, | |||||
Sort=a.Sort | |||||
}) | }) | ||||
.Mapper(x => | .Mapper(x => | ||||
{ | { | ||||
@@ -65,7 +66,8 @@ namespace BPA.SAAS.Manage.Application.Device.Services | |||||
TemplateName = a.TemplateName, | TemplateName = a.TemplateName, | ||||
CreateAt = a.CreateAt, | CreateAt = a.CreateAt, | ||||
ProductNumber = c.ProductNumber, | ProductNumber = c.ProductNumber, | ||||
ProductUrl = c.ProductUrl | |||||
ProductUrl = c.ProductUrl, | |||||
Sort = a.Sort | |||||
}) | }) | ||||
.Mapper(x => | .Mapper(x => | ||||
{ | { | ||||
@@ -92,7 +94,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services | |||||
{ | { | ||||
DeviceId = inputDto.DeviceId, | DeviceId = inputDto.DeviceId, | ||||
TemplateName = inputDto.TemplateName, | TemplateName = inputDto.TemplateName, | ||||
Sort = inputDto.Sort | |||||
}).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync(); | }).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync(); | ||||
List<BPA_WarehousePostion> list = new(); | List<BPA_WarehousePostion> list = new(); | ||||
for (int i = 0; i < inputDto.WarehousePostionData.Count; i++) | 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(); | var model = _db.Queryable<BPA_WarehouseTemplate>().Where(x => x.Id == inputDto.Id).First(); | ||||
model.DeviceId= inputDto.DeviceId; | model.DeviceId= inputDto.DeviceId; | ||||
model.TemplateName= inputDto.TemplateName; | model.TemplateName= inputDto.TemplateName; | ||||
model.Sort = inputDto.Sort; | |||||
var res = await _db.Updateable(model).ExecuteCommandAsync(); | var res = await _db.Updateable(model).ExecuteCommandAsync(); | ||||
var warehousePostion = _db.Queryable<BPA_WarehousePostion>().Where(x => x.TemplateId == inputDto.Id).ToList(); | var warehousePostion = _db.Queryable<BPA_WarehousePostion>().Where(x => x.TemplateId == inputDto.Id).ToList(); | ||||
await _db.Deleteable(warehousePostion).ExecuteCommandAsync(); | await _db.Deleteable(warehousePostion).ExecuteCommandAsync(); | ||||
@@ -54,5 +54,15 @@ namespace BPA.SAAS.Manage.Application.Device | |||||
{ | { | ||||
return await _technologyService.GetTechnologyList_alm(deviceId); | 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); | |||||
} | |||||
} | } | ||||
} | } |
@@ -62,13 +62,12 @@ namespace BPA.SAAS.Manage.Comm.Util | |||||
/// Excel转为List | /// Excel转为List | ||||
/// </summary> | /// </summary> | ||||
/// <typeparam name="T"></typeparam> | /// <typeparam name="T"></typeparam> | ||||
/// <param name="fileStream"></param> | |||||
/// <param name="mapper"></param> | |||||
/// <param name="sheetname"></param> | /// <param name="sheetname"></param> | ||||
/// <returns></returns> | /// <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>(); | List<T> ModelList = new List<T>(); | ||||
// var mapper = new Mapper(fileStream); | |||||
List<RowInfo<T>> DataList = new List<RowInfo<T>>(); | List<RowInfo<T>> DataList = new List<RowInfo<T>>(); | ||||
if (!string.IsNullOrEmpty(sheetname)) | if (!string.IsNullOrEmpty(sheetname)) | ||||
{ | { | ||||
@@ -40,6 +40,5 @@ namespace BPA.SAAS.Manage.Core.Base | |||||
this.CreateBy = "admin"; | this.CreateBy = "admin"; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } |
@@ -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; } | |||||
} | |||||
} |
@@ -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; } | |||||
} | |||||
} |
@@ -18,5 +18,9 @@ namespace BPA.SAAS.Manage.Core.Device | |||||
public string ProductId { get; set; } | public string ProductId { get; set; } | ||||
public DateTime CreateAt { get; set; } | public DateTime CreateAt { get; set; } | ||||
public string TemplatePath { get; set; } | public string TemplatePath { get; set; } | ||||
/// <summary> | |||||
/// 备注 | |||||
/// </summary> | |||||
public string Remark { get; set; } | |||||
} | } | ||||
} | } |
@@ -13,6 +13,7 @@ namespace BPA.SAAS.Manage.Core.Device | |||||
{ | { | ||||
public string DeviceId { get; set; } | public string DeviceId { get; set; } | ||||
public string TemplateName { get; set; } | public string TemplateName { get; set; } | ||||
public int Sort { get; set; } | |||||
public string GroupId { get; set; } | public string GroupId { get; set; } | ||||
} | } | ||||
} | } |
@@ -37,5 +37,10 @@ namespace BPA.SAAS.Manage.Core.Product | |||||
/// 状态 0启用 1禁用 | /// 状态 0启用 1禁用 | ||||
/// </summary> | /// </summary> | ||||
public CommonStatus Status { get; set; } = CommonStatus.ENABLE; | public CommonStatus Status { get; set; } = CommonStatus.ENABLE; | ||||
/// <summary> | |||||
/// 备注 | |||||
/// </summary> | |||||
public string Remark { get; set; } | |||||
} | } | ||||
} | } |
@@ -80,9 +80,6 @@ namespace BPA.KitChen.GroupMeal.SqlSugar | |||||
case "CreateAt": | case "CreateAt": | ||||
entityInfo.SetValue(DateTime.Now); | entityInfo.SetValue(DateTime.Now); | ||||
break; | break; | ||||
case "CreateBy": | |||||
entityInfo.SetValue(""); | |||||
break; | |||||
case "GroupId": | case "GroupId": | ||||
entityInfo.SetValue(CurrentUser.GroupId); | entityInfo.SetValue(CurrentUser.GroupId); | ||||
break; | break; | ||||