基础服务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.
 
 

174 rivejä
5.8 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. /// <param name="dto"></param>
  75. /// <returns></returns>
  76. [HttpPost("/api/goods/addgoodsuint")]
  77. public async Task<bool> AddGoodsUint(GoodsUintDto dto)
  78. {
  79. return await _goodsService.AddGoodsUint(dto);
  80. }
  81. /// <summary>
  82. /// 商品配方
  83. /// </summary>
  84. /// <param name="dto"></param>
  85. /// <returns></returns>
  86. [HttpPost("/api/goods/getgoodsbompage")]
  87. public async Task<PageUtil> GetGoodsBomPageAsync(OrtherGoodsQueryDto dto)
  88. {
  89. return await _goodsService.GetGoodsBomPageAsync(dto);
  90. }
  91. /// <summary>
  92. /// 删除商品配方
  93. /// </summary>
  94. /// <param name="Ids"></param>
  95. /// <returns></returns>
  96. [HttpGet("/api/goods/delgoodsbom")]
  97. public async Task<bool> BatchDelGoodsBomAsync(string Ids)
  98. {
  99. return await _goodsService.BatchDelGoodsBomAsync(Ids);
  100. }
  101. /// <summary>
  102. /// 添加商品配方(包含属性关系)
  103. /// </summary>
  104. /// <param name="dto"></param>
  105. /// <returns></returns>
  106. [HttpPost("/api/goods/addgoodsbomattribute")]
  107. public async Task<bool> AddGoodsBomAttribute(GoodsBomAttributeDto dto)
  108. {
  109. return await _goodsService.AddGoodsBomAttribute(dto);
  110. }
  111. /// <summary>
  112. /// 添加商品配方
  113. /// </summary>
  114. /// <param name="dto"></param>
  115. /// <returns></returns>
  116. [HttpPost("/api/goods/addgoodsbom")]
  117. public async Task<bool> AddGoodsBom(GoodsBomDto dto)
  118. {
  119. return await _goodsService.AddGoodsBom(dto);
  120. }
  121. /// <summary>
  122. /// 查询所有商品
  123. /// </summary>
  124. /// <returns></returns>
  125. [HttpGet("/api/goods/getgoodslist")]
  126. public async Task<List<BPA_GoodsInfo>> GetGoodsList()
  127. {
  128. return await _goodsService.GetGoodsList();
  129. }
  130. /// <summary>
  131. /// 根据id查询商品信息
  132. /// </summary>
  133. /// <param name="id"></param>
  134. /// <returns></returns>
  135. [HttpGet("/api/goods/getbyidgoods")]
  136. public async Task<GoodsInfoBaseView> GetGoods(string id)
  137. {
  138. return await _goodsService.GetGoods(id);
  139. }
  140. ///// <summary>
  141. ///// 设备上传商品数据
  142. ///// </summary>
  143. ///// <param name="goodsDatadto"></param>
  144. ///// <returns></returns>
  145. //Task<bool> SendGoodsInfo(GoodsDatadto goodsDatadto);
  146. [HttpPost("/api/goods/exportgood"), ApiDescriptionSettings(SplitCamelCase = false), NonUnify]
  147. public async Task<bool> ExportGood(IFormFile file)
  148. {
  149. return await _goodsService.ExportGood(file);
  150. }
  151. /// <summary>
  152. /// 导出 设备工艺流程
  153. /// </summary>
  154. /// <returns></returns>
  155. [HttpPost("/api/goods/technologytemplateexport"), NonUnify]
  156. public async Task<string> TechnologyTemplateExport(string deviceId)
  157. {
  158. return await _goodsService.TechnologyTemplateExport(deviceId);
  159. }
  160. /// <summary>
  161. /// 设备 版本 工序模型导入
  162. /// </summary>
  163. /// <returns></returns>
  164. [HttpPost("/api/goods/goodstemplateexport"), NonUnify]
  165. public async Task<bool> DeviceVersionTemplateImport(DeviceVersionTemplateImportInputDto inputDto)
  166. {
  167. return await _goodsService.DeviceVersionTemplateImport(inputDto);
  168. }
  169. }
  170. }