package com.ruoyi.production.controller; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.utils.OrderUtils; import com.ruoyi.framework.aspectj.lang.annotation.Log; import com.ruoyi.framework.aspectj.lang.enums.BusinessType; import com.ruoyi.framework.web.controller.BaseController; import com.ruoyi.framework.web.domain.AjaxResult; import com.ruoyi.production.mapper.ProductionOrderMapper; import com.ruoyi.production.pojo.ProductionOrder; import com.ruoyi.production.service.ProductionOrderService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.util.List; /** * @author :yys * @date : 2025/11/26 14:21 */ @RestController @Api(tags = "生产订单") @RequestMapping("/productionOrder") public class ProductionOrderController extends BaseController { @Autowired private ProductionOrderService productionOrderService; @Autowired private ProductionOrderMapper productionOrderMapper; @GetMapping("/listPage") @Log(title = "生产订单-分页查询", businessType = BusinessType.OTHER) @ApiOperation("生产订单-分页查询") public AjaxResult listPage(Page page, ProductionOrder productionOrder) { return AjaxResult.success(productionOrderService.listPage(page, productionOrder)); } @PostMapping("/addProductionOrder") @Log(title = "生产订单-新增", businessType = BusinessType.INSERT) @ApiOperation("生产订单-新增") public AjaxResult addProductionOrder(@RequestBody ProductionOrder productionOrder) { String scdd = OrderUtils.countTodayByCreateTime(productionOrderMapper, "SCDD"); productionOrder.setOrderNo(scdd); return AjaxResult.success(productionOrderService.save(productionOrder)); } @PostMapping("/updateProductionOrder") @Log(title = "生产订单-修改", businessType = BusinessType.UPDATE) @ApiOperation("生产订单-修改") public AjaxResult updateProductionOrder(@RequestBody ProductionOrder productionOrder) { return AjaxResult.success(productionOrderService.updateById(productionOrder)); } @DeleteMapping("/deleteProductionOrder") @Log(title = "生产订单-删除", businessType = BusinessType.DELETE) @ApiOperation("生产订单-删除") public AjaxResult deleteProductionOrder(@RequestBody List ids) { if (CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID"); return AjaxResult.success(productionOrderService.removeBatchByIds(ids)); } /** * 导出 * @param response */ @PostMapping("/export") @ApiOperation("生产管理-生产订单-导出") @Log(title = "生产订单-导出", businessType = BusinessType.EXPORT) public void export(HttpServletResponse response) { productionOrderService.export(response); } /** * 导出 * @param response */ @PostMapping("/exportOne") @ApiOperation("生产管理-生产派工-导出") @Log(title = "生产订单-导出", businessType = BusinessType.EXPORT) public void exportOne(HttpServletResponse response) { productionOrderService.exportOne(response); } }