platformWarehouseController.java 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. package com.steerinfo.dil.controller;
  2. import com.steerinfo.dil.service.impl.PlatformWarehouseServiceImpl;
  3. import com.steerinfo.dil.util.BaseRESTfulController;
  4. import com.steerinfo.framework.controller.RESTfulResult;
  5. import io.swagger.annotations.ApiOperation;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.web.bind.annotation.PostMapping;
  8. import org.springframework.web.bind.annotation.RequestBody;
  9. import org.springframework.web.bind.annotation.RequestMapping;
  10. import org.springframework.web.bind.annotation.RestController;
  11. import java.util.List;
  12. import java.util.Map;
  13. /**
  14. * @author luobang
  15. * @create 2022-07-18 17:59
  16. */
  17. @RestController
  18. @RequestMapping("${api.version}/platformWarehouse")
  19. public class platformWarehouseController extends BaseRESTfulController {
  20. //该接口针对内转钢材到异地库的站台入库和出库做设计
  21. @Autowired
  22. PlatformWarehouseServiceImpl platformWarehouseService;
  23. @ApiOperation("站台入库")
  24. @PostMapping("platformInbound")
  25. public RESTfulResult platformInbound(@RequestBody Map<String,Object> map){
  26. int i = 0;
  27. try {
  28. i = platformWarehouseService.platformInboundOrOut(map);
  29. } catch (Exception e) {
  30. return failed(e.getMessage());
  31. }
  32. if(i == -1){
  33. return failed("系统未找到仓库,请联系管理员添加");
  34. }else if(i == -2){
  35. return failed("关闭订单失败,请联系管理员");
  36. }else if(i == -3){
  37. return failed("卸货失败");
  38. }else if(i == -5){
  39. return failed("已入库,请勿重复扫描");
  40. }
  41. return success(i);
  42. }
  43. @ApiOperation("事后出库")
  44. @PostMapping("afterInwardOutbound")
  45. public RESTfulResult afterInwardOutbound(@RequestBody Map<String,Object> map){
  46. int i = 0;
  47. try {
  48. i = platformWarehouseService.afterInwardOutbound(map);
  49. } catch (Exception e) {
  50. return failed(e.getMessage());
  51. }
  52. return success(i);
  53. }
  54. @ApiOperation("批量保存事后出库")
  55. @PostMapping("listAfterInwardOutbound")
  56. public RESTfulResult listAfterInwardOutbound(@RequestBody List<Map<String,Object>>mapList){
  57. int i=0;
  58. try {
  59. for(Map<String,Object>map:mapList){
  60. if(map.get("wagonNo") == null || "".equals(map.get("wagonNo").toString())){
  61. continue;
  62. }
  63. i += platformWarehouseService.afterInwardOutbound(map);
  64. }
  65. } catch (Exception e) {
  66. return failed(e.getMessage());
  67. }
  68. return success(i);
  69. }
  70. }