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

218 lines
7.3 KiB

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