OWbInveReceiptGoodsController.java 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. package com.emato.biz.controller.warehouse;
  2. import java.util.List;
  3. import com.emato.common.core.domain.entity.SysDept;
  4. import com.emato.common.core.domain.entity.SysUser;
  5. import com.emato.common.core.domain.model.LoginUser;
  6. import com.emato.common.utils.ServletUtils;
  7. import com.emato.common.utils.spring.SpringUtils;
  8. import com.emato.framework.web.service.TokenService;
  9. import com.emato.system.service.ISysDeptService;
  10. import org.springframework.security.access.prepost.PreAuthorize;
  11. import org.springframework.beans.factory.annotation.Autowired;
  12. import org.springframework.web.bind.annotation.GetMapping;
  13. import org.springframework.web.bind.annotation.PostMapping;
  14. import org.springframework.web.bind.annotation.PutMapping;
  15. import org.springframework.web.bind.annotation.DeleteMapping;
  16. import org.springframework.web.bind.annotation.PathVariable;
  17. import org.springframework.web.bind.annotation.RequestBody;
  18. import org.springframework.web.bind.annotation.RequestMapping;
  19. import org.springframework.web.bind.annotation.RestController;
  20. import com.emato.common.annotation.Log;
  21. import com.emato.common.core.controller.BaseController;
  22. import com.emato.common.core.domain.AjaxResult;
  23. import com.emato.common.enums.BusinessType;
  24. import com.emato.biz.domain.warehouse.OWbInveReceiptGoods;
  25. import com.emato.biz.service.warehouse.IOWbInveReceiptGoodsService;
  26. import com.emato.common.utils.poi.ExcelUtil;
  27. import com.emato.common.core.page.TableDataInfo;
  28. /**
  29. * 库存入库货品,发WMS货品数据Controller
  30. *
  31. * @author yangbo
  32. * @date 2021-02-01
  33. */
  34. @RestController
  35. @RequestMapping("/biz/invereceiptgoods")
  36. public class OWbInveReceiptGoodsController extends BaseController
  37. {
  38. @Autowired
  39. private IOWbInveReceiptGoodsService oWbInveReceiptGoodsService;
  40. @Autowired
  41. private ISysDeptService sysDeptService;
  42. /**
  43. * 查询库存入库货品,发WMS货品数据列表
  44. */
  45. @PreAuthorize("@ss.hasPermi('biz:invereceiptgoods:list')")
  46. @GetMapping("/list")
  47. public TableDataInfo list(OWbInveReceiptGoods oWbInveReceiptGoods)
  48. {
  49. startPage();
  50. List<OWbInveReceiptGoods> list = oWbInveReceiptGoodsService.selectOWbInveReceiptGoodsList(oWbInveReceiptGoods);
  51. return getDataTable(list);
  52. }
  53. /**
  54. * 导出库存入库货品,发WMS货品数据列表
  55. */
  56. @PreAuthorize("@ss.hasPermi('biz:invereceiptgoods:export')")
  57. @Log(title = "库存入库货品,发WMS货品数据", businessType = BusinessType.EXPORT)
  58. @GetMapping("/export")
  59. public AjaxResult export(OWbInveReceiptGoods oWbInveReceiptGoods)
  60. {
  61. List<OWbInveReceiptGoods> list = oWbInveReceiptGoodsService.selectOWbInveReceiptGoodsList(oWbInveReceiptGoods);
  62. ExcelUtil<OWbInveReceiptGoods> util = new ExcelUtil<OWbInveReceiptGoods>(OWbInveReceiptGoods.class);
  63. return util.exportExcel(list, "invereceiptgoods");
  64. }
  65. /**
  66. * 获取库存入库货品,发WMS货品数据详细信息
  67. */
  68. @PreAuthorize("@ss.hasPermi('biz:invereceiptgoods:query')")
  69. @GetMapping(value = "/{receiptGoodsSn}")
  70. public AjaxResult getInfo(@PathVariable("receiptGoodsSn") String receiptGoodsSn)
  71. {
  72. return AjaxResult.success(oWbInveReceiptGoodsService.selectOWbInveReceiptGoodsById(receiptGoodsSn));
  73. }
  74. /**
  75. * 新增库存入库货品,发WMS货品数据
  76. */
  77. @PreAuthorize("@ss.hasPermi('biz:invereceiptgoods:add')")
  78. @Log(title = "库存入库货品,发WMS货品数据", businessType = BusinessType.INSERT)
  79. @PostMapping
  80. public AjaxResult add(@RequestBody OWbInveReceiptGoods oWbInveReceiptGoods)
  81. {
  82. return toAjax(oWbInveReceiptGoodsService.insertOWbInveReceiptGoods(oWbInveReceiptGoods));
  83. }
  84. /**
  85. * 修改库存入库货品,发WMS货品数据
  86. */
  87. @PreAuthorize("@ss.hasPermi('biz:invereceiptgoods:edit')")
  88. @Log(title = "库存入库货品,发WMS货品数据", businessType = BusinessType.UPDATE)
  89. @PutMapping
  90. public AjaxResult edit(@RequestBody OWbInveReceiptGoods oWbInveReceiptGoods)
  91. {
  92. return toAjax(oWbInveReceiptGoodsService.updateOWbInveReceiptGoods(oWbInveReceiptGoods));
  93. }
  94. /**
  95. * 删除库存入库货品,发WMS货品数据
  96. */
  97. @PreAuthorize("@ss.hasPermi('biz:invereceiptgoods:remove')")
  98. @Log(title = "库存入库货品,发WMS货品数据", businessType = BusinessType.DELETE)
  99. @DeleteMapping("/{receiptGoodsSns}")
  100. public AjaxResult remove(@PathVariable String[] receiptGoodsSns)
  101. {
  102. return toAjax(oWbInveReceiptGoodsService.deleteOWbInveReceiptGoodsByIds(receiptGoodsSns));
  103. }
  104. @PreAuthorize("@ss.hasPermi('biz:invemng:pull')")
  105. @PostMapping("/pullReceiptGoods")
  106. public AjaxResult pullReceiptGoods()
  107. {
  108. // 获取当前的用户
  109. LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
  110. SysUser user = loginUser.getUser();
  111. // 根据当前登录用户部门查询所属商户
  112. SysDept sysDept = sysDeptService.selectDeptById(user.getDeptId());
  113. // 获取当前商户号
  114. String merchSn = sysDept.getMerchSn();
  115. return toAjax(oWbInveReceiptGoodsService.pullReceiptGoods(merchSn));
  116. }
  117. }