| | |
| | | package com.ruoyi.production.controller; |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.production.bean.dto.ProductionOrderDto; |
| | | import com.ruoyi.production.bean.vo.ProductionOrderPickVo; |
| | | import com.ruoyi.production.bean.vo.ProductionOrderVo; |
| | | import com.ruoyi.production.bean.vo.ProductionPlanVo; |
| | | import com.ruoyi.production.bean.vo.ProductionOrderWorkOrderDetailVo; |
| | | import com.ruoyi.production.pojo.ProductionOrder; |
| | | import com.ruoyi.production.service.ProductionOrderService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | /** |
| | | * <p> |
| | | * 生产订单表 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author 芯导软件(江苏)有限公司 |
| | | * @since 2026-04-21 03:55:52 |
| | | */ |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping("/productionOrder") |
| | | @Tag(name = "生产订单") |
| | | @RequiredArgsConstructor |
| | | public class ProductionOrderController { |
| | | |
| | | private final ProductionOrderService productionOrderService; |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "分页查询") |
| | | public R<IPage<ProductionOrderVo>> page(ProductionOrderDto dto, Page<ProductionOrderDto> page) { |
| | | return R.ok(productionOrderService.pageProductionOrder(page, dto)); |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | @Operation(summary = "生产订单列表") |
| | | public R<List<ProductionOrderVo>> list(ProductionOrderDto dto) { |
| | | return R.ok(productionOrderService.listProductionOrder(dto)); |
| | | } |
| | | |
| | | @GetMapping("/{id}") |
| | | @Operation(summary = "生产订单详情") |
| | | public R<ProductionOrderVo> getInfo(@PathVariable Long id) { |
| | | return R.ok(productionOrderService.getProductionOrderInfo(id)); |
| | | } |
| | | |
| | | @PostMapping("/addOrder") |
| | | @Operation(summary = "新增生产订单", description = "新增下单只支持1种方式:生产计划生成,传 productionPlanIds,系统自动汇总计划得到产品规格和数量;" |
| | | + "technologyRoutingId 为空时会自动匹配该产品规格最新工艺路线,quantity 最终必须大于 0。") |
| | | @io.swagger.v3.oas.annotations.parameters.RequestBody(required = true, description = "前端友好提示:如果是生产计划生成,请传 productionPlanIds;" |
| | | , content = @Content(schema = @Schema(implementation = ProductionOrder.class))) |
| | | public R<Boolean> add(@RequestBody ProductionOrder productionOrder) { |
| | | return R.ok(productionOrderService.saveProductionOrder(productionOrder)); |
| | | } |
| | | |
| | | @Operation(summary = "绑定工艺路线") |
| | | @PostMapping("/bindingRoute") |
| | | public R bindingRoute(@RequestBody ProductionOrderDto productionOrderDto) { |
| | | return R.ok(productionOrderService.bindingRoute(productionOrderDto)); |
| | | } |
| | | |
| | | @PostMapping("/syncSnapshot/{id}") |
| | | @Operation(summary = "同步生产订单工艺/BOM快照") |
| | | public R<Integer> syncSnapshot(@PathVariable Long id) { |
| | | return R.ok(productionOrderService.syncProductionOrderSnapshot(id)); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "删除生产订单") |
| | | public R<Boolean> remove(@RequestBody List<Long> ids) { |
| | | return R.ok(productionOrderService.removeProductionOrder(ids)); |
| | | } |
| | | |
| | | @GetMapping("/source/{id}") |
| | | @Operation(summary = "生产订单查询来源") |
| | | public R<List<ProductionPlanVo>> getSource(@PathVariable Long id) { |
| | | return R.ok(productionOrderService.getSource(id)); |
| | | } |
| | | |
| | | @GetMapping("/pick/{productionOrderId}") |
| | | @Operation(summary = "根据订单id查询bom领料单") |
| | | public R<List<ProductionOrderPickVo>> pick(@PathVariable Long productionOrderId) { |
| | | return R.ok(productionOrderService.pick(productionOrderId)); |
| | | } |
| | | |
| | | @GetMapping("/workOrder/detail/{productionOrderId}") |
| | | @Operation(summary = "Query work orders/reports/inspects by production order id") |
| | | public R<ProductionOrderWorkOrderDetailVo> getWorkOrderReportInspectDetail(@PathVariable Long productionOrderId) { |
| | | return R.ok(productionOrderService.getWorkOrderReportInspectDetail(productionOrderId)); |
| | | } |
| | | |
| | | @Operation(summary = "更新订单状态") |
| | | @PostMapping("/updateOrder") |
| | | public R updateOrder(@RequestBody ProductionOrderDto productionOrderDto) { |
| | | return R.ok(productionOrderService.updateOrder(productionOrderDto)); |
| | | } |
| | | } |