基础服务api
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

184 lines
6.1 KiB

  1. using BPA.Franchisee.Application.FranchiseeCenter.GoodsServices;
  2. using BPA.SAAS.Manage.Application.DataBase.Dtos.Goods;
  3. using BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsAttribute;
  4. using BPA.SAAS.Manage.Application.DataBase.Interface;
  5. using BPA.SAAS.Manage.Core.Base;
  6. using BPA.SAAS.Manage.Core.DataBase;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. namespace BPA.SAAS.Manage.Application.DataBase
  13. {
  14. [ApiDescriptionSettings("Goods", Tag = "商品管理")]
  15. public class GoodsServices: IDynamicApiController, ITransient
  16. {
  17. IGoodsService _goodsService;
  18. public GoodsServices(IGoodsService goodsService)
  19. {
  20. _goodsService=goodsService;
  21. }
  22. /// <summary>
  23. /// 分页查询
  24. /// </summary>
  25. /// <param name="dto"></param>
  26. /// <returns></returns>
  27. [HttpPost("/api/goods/page")]
  28. public async Task<PageUtil> GetGoodsPage(GoodsQueryDto dto)
  29. {
  30. return await _goodsService.GetGoodsPage(dto);
  31. }
  32. /// <summary>
  33. /// 添加商品
  34. /// </summary>
  35. /// <param name="dto"></param>
  36. /// <returns></returns>
  37. [HttpPost("/api/goods/add")]
  38. public async Task<bool> AddGoods(GoodsDto dto)
  39. {
  40. return await _goodsService.AddGoods(dto);
  41. }
  42. /// <summary>
  43. /// 更新商品
  44. /// </summary>
  45. /// <param name="dto"></param>
  46. /// <returns></returns>
  47. [HttpPost("/api/goods/update")]
  48. public async Task<bool> UpdateGoods(GoodsDto dto)
  49. {
  50. return await _goodsService.UpdateGoods(dto);
  51. }
  52. /// <summary>
  53. /// 删除商品
  54. /// </summary>
  55. /// <param name="id"></param>
  56. /// <returns></returns>
  57. [HttpGet("/api/goods/delete")]
  58. public async Task<bool> DeleteGoods(string id)
  59. {
  60. return await _goodsService.DeleteGoods(id);
  61. }
  62. /// <summary>
  63. /// 查询商品单位
  64. /// </summary>
  65. /// <returns></returns>
  66. [HttpGet("/api/goods/getgoodsuintlist")]
  67. public async Task<List<dynamic>> GetGoodsUintList()
  68. {
  69. return await _goodsService.GetGoodsUintList();
  70. }
  71. /// <summary>
  72. /// 查询商品单位(外部调用)
  73. /// </summary>
  74. /// <returns></returns>
  75. [HttpGet("/api/goods/getgoodsuintlist_alm")]
  76. [AllowAnonymous]
  77. public async Task<List<dynamic>> GetGoodsUintList_alm()
  78. {
  79. return await _goodsService.GetGoodsUintList_alm();
  80. }
  81. /// <summary>
  82. /// 添加商品单位
  83. /// </summary>
  84. /// <param name="dto"></param>
  85. /// <returns></returns>
  86. [HttpPost("/api/goods/addgoodsuint")]
  87. public async Task<bool> AddGoodsUint(GoodsUintDto dto)
  88. {
  89. return await _goodsService.AddGoodsUint(dto);
  90. }
  91. /// <summary>
  92. /// 商品配方
  93. /// </summary>
  94. /// <param name="dto"></param>
  95. /// <returns></returns>
  96. [HttpPost("/api/goods/getgoodsbompage")]
  97. public async Task<PageUtil> GetGoodsBomPageAsync(GoodsBomQueryDto dto)
  98. {
  99. return await _goodsService.GetGoodsBomPageAsync(dto);
  100. }
  101. /// <summary>
  102. /// 删除商品配方
  103. /// </summary>
  104. /// <param name="Ids"></param>
  105. /// <returns></returns>
  106. [HttpGet("/api/goods/delgoodsbom")]
  107. public async Task<bool> BatchDelGoodsBomAsync(string Ids)
  108. {
  109. return await _goodsService.BatchDelGoodsBomAsync(Ids);
  110. }
  111. /// <summary>
  112. /// 添加商品配方(包含属性关系)
  113. /// </summary>
  114. /// <param name="dto"></param>
  115. /// <returns></returns>
  116. [HttpPost("/api/goods/addgoodsbomattribute")]
  117. public async Task<bool> AddGoodsBomAttribute(GoodsBomAttributeDto dto)
  118. {
  119. return await _goodsService.AddGoodsBomAttribute(dto);
  120. }
  121. /// <summary>
  122. /// 添加商品配方
  123. /// </summary>
  124. /// <param name="dto"></param>
  125. /// <returns></returns>
  126. [HttpPost("/api/goods/addgoodsbom")]
  127. public async Task<bool> AddGoodsBom(GoodsBomDto dto)
  128. {
  129. return await _goodsService.AddGoodsBom(dto);
  130. }
  131. /// <summary>
  132. /// 查询所有商品
  133. /// </summary>
  134. /// <returns></returns>
  135. [HttpGet("/api/goods/getgoodslist")]
  136. public async Task<List<BPA_GoodsInfo>> GetGoodsList()
  137. {
  138. return await _goodsService.GetGoodsList();
  139. }
  140. /// <summary>
  141. /// 根据id查询商品信息
  142. /// </summary>
  143. /// <param name="id"></param>
  144. /// <returns></returns>
  145. [HttpGet("/api/goods/getbyidgoods")]
  146. public async Task<GoodsInfoBaseView> GetGoods(string id)
  147. {
  148. return await _goodsService.GetGoods(id);
  149. }
  150. ///// <summary>
  151. ///// 设备上传商品数据
  152. ///// </summary>
  153. ///// <param name="goodsDatadto"></param>
  154. ///// <returns></returns>
  155. //Task<bool> SendGoodsInfo(GoodsDatadto goodsDatadto);
  156. [HttpPost("/api/goods/exportgood"), ApiDescriptionSettings(SplitCamelCase = false), NonUnify]
  157. public async Task<bool> ExportGood(IFormFile file)
  158. {
  159. return await _goodsService.ExportGood(file);
  160. }
  161. /// <summary>
  162. /// 导出 设备工艺流程
  163. /// </summary>
  164. /// <returns></returns>
  165. [HttpPost("/api/goods/technologytemplateexport"), NonUnify]
  166. public async Task<string> TechnologyTemplateExport(string deviceId)
  167. {
  168. return await _goodsService.TechnologyTemplateExport(deviceId);
  169. }
  170. /// <summary>
  171. /// 设备 版本 工序模型导入
  172. /// </summary>
  173. /// <returns></returns>
  174. [HttpPost("/api/goods/goodstemplateexport"), NonUnify]
  175. public async Task<bool> DeviceVersionTemplateImport([FromForm] DeviceVersionTemplateImportInputDto inputDto)
  176. {
  177. return await _goodsService.DeviceVersionTemplateImport(inputDto);
  178. }
  179. }
  180. }