package com.steerinfo.dil.controller; import com.steerinfo.dil.service.impl.PlatformWarehouseServiceImpl; import com.steerinfo.dil.util.BaseRESTfulController; import com.steerinfo.framework.controller.RESTfulResult; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; import java.util.Map; /** * @author luobang * @create 2022-07-18 17:59 */ @RestController @RequestMapping("${api.version}/platformWarehouse") public class platformWarehouseController extends BaseRESTfulController { //该接口针对内转钢材到异地库的站台入库和出库做设计 @Autowired PlatformWarehouseServiceImpl platformWarehouseService; @ApiOperation("站台入库") @PostMapping("platformInbound") public RESTfulResult platformInbound(@RequestBody Map map){ int i = 0; try { i = platformWarehouseService.platformInboundOrOut(map); } catch (Exception e) { return failed(e.getMessage()); } if(i == -1){ return failed("系统未找到仓库,请联系管理员添加"); }else if(i == -2){ return failed("关闭订单失败,请联系管理员"); }else if(i == -3){ return failed("卸货失败"); }else if(i == -5){ return failed("已入库,请勿重复扫描"); } return success(i); } @ApiOperation("事后出库") @PostMapping("afterInwardOutbound") public RESTfulResult afterInwardOutbound(@RequestBody Map map){ int i = 0; try { i = platformWarehouseService.afterInwardOutbound(map); } catch (Exception e) { return failed(e.getMessage()); } return success(i); } @ApiOperation("批量保存事后出库") @PostMapping("listAfterInwardOutbound") public RESTfulResult listAfterInwardOutbound(@RequestBody List>mapList){ int i=0; try { for(Mapmap:mapList){ if(map.get("wagonNo") == null || "".equals(map.get("wagonNo").toString())){ continue; } i += platformWarehouseService.afterInwardOutbound(map); } } catch (Exception e) { return failed(e.getMessage()); } return success(i); } }