XiaoRuby
2023-09-09 4ad61e4c257621124625a89853eaa8334a11b0be
inventory-server/src/main/java/com/yuanchu/mom/controller/ConsignmentController.java
@@ -16,6 +16,7 @@
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.yuanchu.mom.service.ConsignmentService;
@@ -51,17 +52,12 @@
    })
    @GetMapping("/selSale")
    public Result selSale(String orderNumber) {
        //只有销售单审核通过之后才能发货
        Sale sale = saleService.getOne(Wrappers.<Sale>query().eq("order_number", orderNumber));
        if (ObjectUtils.isEmpty(sale.getType()) || sale.getType() != 1  ) {
            return Result.fail("只有销售单审核通过之后才能发货!");
        }
        return Result.success(saleService.selSale(orderNumber));
    }
    @ApiOperation(value = "新增成品发货")
    @PostMapping("/addCon")
    public Result addCon(@RequestHeader("token") String token, @RequestBody ConsignmentDto consignmentDto) throws Exception {
    public Result addCon(@RequestHeader("token") String token, @Validated @RequestBody ConsignmentDto consignmentDto) throws Exception {
        Map<String, String> data = JackSonUtil.unmarshal(jwt.readJWT(token).get("data"), Map.class);
        return Result.success(consignmentService.addCon(data.get("name").replaceAll("\"", ""), consignmentDto));
    }
@@ -84,25 +80,7 @@
        return Result.success(map);
    }
    @ApiOperation(value = "根据发货id删除")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "id", value = "发货id", dataTypeClass = Integer.class, required = true)
    })
    @PostMapping("/delCon")
    public Result delCon(Integer id) {
        consignmentService.delCon(id);
        return Result.success();
    }
    @ApiOperation(value = "批量删除")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "ids", value = "ids", dataTypeClass = Integer.class, dataType = "List", required = true)
    })
    @PostMapping("/delAllCon")
    public Result delAllCon(@RequestParam("ids") List<Integer> ids) {
        consignmentService.delAllCon(ids);
        return Result.success();
    }
}