package com.klp.aps.controller; import com.klp.common.core.controller.BaseController; import com.klp.common.core.domain.R; import com.klp.aps.domain.dto.ApsConvertFromCrmReq; import com.klp.aps.domain.dto.ApsConvertFromCrmResp; import com.klp.aps.domain.dto.ApsConvertFromProductReq; import com.klp.aps.domain.dto.ApsConvertFromProductsReq; import com.klp.aps.service.ApsPlanService; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; 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; @Validated @RequiredArgsConstructor @RestController @RequestMapping("/aps/order") public class ApsOrderController extends BaseController { private final ApsPlanService apsPlanService; @PostMapping("/convert-from-crm") public R convertFromCrm(@Validated @RequestBody ApsConvertFromCrmReq req) { Long wmsOrderId = apsPlanService.convertFromCrmOrderWithItems(req.getCrmOrderId(), req.getCrmItemIds(), getUsername()); return R.ok(new ApsConvertFromCrmResp(wmsOrderId, null)); } @PostMapping("/convert-from-product") public R convertFromProduct(@Validated @RequestBody ApsConvertFromProductReq req) { Long wmsOrderId = apsPlanService.convertFromProduct( req.getProductId(), req.getQuantity(), req.getProductName(), req.getRemark(), getUsername() ); return R.ok(new ApsConvertFromCrmResp(wmsOrderId, null)); } @PostMapping("/convert-from-products") public R convertFromProducts(@Validated @RequestBody ApsConvertFromProductsReq req) { Long wmsOrderId = apsPlanService.convertFromProducts(req.getItems(), req.getRemark(), getUsername()); return R.ok(new ApsConvertFromCrmResp(wmsOrderId, null)); } }