PdaController.java 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. package com.jsh.erp.controller.pda;
  2. import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
  3. import com.jsh.erp.base.AjaxResult;
  4. import com.jsh.erp.base.BaseController;
  5. import com.jsh.erp.base.TableDataInfo;
  6. import com.jsh.erp.datasource.entities.DepotHead;
  7. import com.jsh.erp.datasource.entities.MaterialVo4Unit;
  8. import com.jsh.erp.datasource.entities.Supplier;
  9. import com.jsh.erp.datasource.pda.dto.PDADepotHeadDTO;
  10. import com.jsh.erp.datasource.pda.vo.PDADepotHeadVO;
  11. import com.jsh.erp.datasource.pda.vo.PDADepotItemVO;
  12. import com.jsh.erp.query.LambdaQueryWrapperX;
  13. import com.jsh.erp.service.*;
  14. import io.swagger.annotations.Api;
  15. import io.swagger.annotations.ApiModelProperty;
  16. import io.swagger.annotations.ApiOperation;
  17. import org.springframework.web.bind.annotation.*;
  18. import javax.annotation.Resource;
  19. import java.util.List;
  20. @RestController
  21. @RequestMapping(value = "/pda")
  22. @Api(tags = {"PDA接口"})
  23. public class PdaController extends BaseController {
  24. @Resource
  25. private DepotHeadService depotHeadService;
  26. @Resource
  27. private DepotItemService depotItemService;
  28. @Resource
  29. private SupplierService supplierService;
  30. @Resource
  31. private MaterialService materialService;
  32. /**
  33. * 采购入库
  34. * @return
  35. */
  36. @PostMapping ("/purchaseInventory")
  37. @ApiOperation(value = "采购入库")
  38. public TableDataInfo purchaseInventory(@RequestBody PDADepotHeadDTO pdaDepotHeadDTO) {
  39. pdaDepotHeadDTO.setSubType("采购订单");
  40. startPage();
  41. List<PDADepotHeadVO> pdaDepotHeadVOList = depotHeadService.pdaList(pdaDepotHeadDTO);
  42. return getDataTable(pdaDepotHeadVOList);
  43. }
  44. @PostMapping("/saleOrder")
  45. @ApiOperation(value = "检货任务")
  46. public TableDataInfo saleOrder(@RequestBody PDADepotHeadDTO pdaDepotHeadDTO) {
  47. pdaDepotHeadDTO.setSubType("销售订单");
  48. startPage();
  49. List<PDADepotHeadVO> pdaDepotHeadVOList = depotHeadService.pdaList(pdaDepotHeadDTO);
  50. return getDataTable(pdaDepotHeadVOList);
  51. }
  52. @ApiModelProperty(value = "订单详情")
  53. @GetMapping("/orderInfo/{id}")
  54. public AjaxResult orderInfo(@PathVariable("id") Long id){
  55. DepotHead depotHead = depotHeadService.getOne(new LambdaQueryWrapperX<DepotHead>().eq(DepotHead::getId, id));
  56. depotHead.setSupplierName(supplierService.getOne(new LambdaQueryWrapperX<Supplier>().eq(Supplier::getId, depotHead.getOrganId())).getSupplier());
  57. return AjaxResult.success(depotHead);
  58. }
  59. @GetMapping("/orderDetail/{id}")
  60. @ApiOperation("订单明细")
  61. public TableDataInfo orderDetail(@PathVariable("id") Long id) {
  62. startPage();
  63. List<PDADepotItemVO> list = depotItemService.pdaList(id);
  64. return getDataTable(list);
  65. }
  66. @ApiOperation("订单开始处理")
  67. @GetMapping("/orderStartHandle/{id}")
  68. public AjaxResult orderStartHandle(@PathVariable("id") Long id) {
  69. depotHeadService.update(new UpdateWrapper<DepotHead>().set("status", "4").eq("id", id));
  70. return AjaxResult.success();
  71. }
  72. @ApiOperation("商品详情")
  73. @GetMapping("/materialDetail/{id}")
  74. public AjaxResult materialDetail(@PathVariable("id") Long id) {
  75. return AjaxResult.success(depotItemService.pdaDetail(id));
  76. }
  77. @ApiOperation("商品库存详情")
  78. @GetMapping("/materialDepotDetail/{type}/{materialId}")
  79. public TableDataInfo materialDepotDetail(@PathVariable("type") String type, @PathVariable("materialId") Long materialId) {
  80. startPage();
  81. if ("out".equals(type)) {
  82. type = "入库";
  83. } else {
  84. type = "出库";
  85. }
  86. List<PDADepotItemVO> list = depotItemService.materialDepotDetail(type , materialId);
  87. return getDataTable(list);
  88. }
  89. @ApiOperation("用于返回字段说明")
  90. @GetMapping("test")
  91. public AjaxResult test(PDADepotItemVO pdaDepotItemVO) {
  92. return AjaxResult.success();
  93. }
  94. @PostMapping ("/orderSubmit")
  95. @ApiOperation(value = "订单提交")
  96. public AjaxResult orderSubmit(@RequestBody PDADepotHeadDTO pdaDepotHeadDTO) {
  97. try {
  98. depotHeadService.pdaOrderSubmit(pdaDepotHeadDTO);
  99. } catch (Exception e) {
  100. e.printStackTrace();
  101. return AjaxResult.error();
  102. }
  103. return AjaxResult.success();
  104. }
  105. @ApiOperation("商品存货查询")
  106. @GetMapping("/inventoryInquiry/{type}/{keyword}")
  107. public TableDataInfo inventoryInquiry(@PathVariable("type") String type,@PathVariable("keyword") String keyword){
  108. startPage();
  109. List<PDADepotItemVO> list = materialService.inventoryInquiry(type , keyword);
  110. return getDataTable(list);
  111. }
  112. }