liyong
昨天 6248c3f2d94debc1633cfcc66496263cef8b18b3
src/main/java/com/ruoyi/production/controller/SalesLedgerWorkController.java
@@ -1,93 +1,92 @@
package com.ruoyi.production.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.utils.poi.ExcelUtil;
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.dto.ProcessSchedulingDto;
import com.ruoyi.production.dto.ProductionReportDto;
import com.ruoyi.production.dto.SalesLedgerSchedulingProcessDto;
import com.ruoyi.production.dto.SalesLedgerWorkDto;
import com.ruoyi.production.pojo.SalesLedgerWork;
import com.ruoyi.production.service.SalesLedgerWorkService;
import com.ruoyi.production.service.impl.SalesLedgerWorkServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
 * @author :yys
 * @date : 2025/7/21 14:43
 */
@RestController
@Api(tags = "生产报工(排产记录)")
@RequestMapping("/salesLedger/work")
@Deprecated // 标记该类已弃用
public class SalesLedgerWorkController extends BaseController {
    @Autowired
    private SalesLedgerWorkServiceImpl salesLedgerWorkService;
    @GetMapping("/listPage")
    @Log(title = "生产报工-分页查询", businessType = BusinessType.OTHER)
    @ApiOperation("生产报工-分页查询")
    public AjaxResult listPage(Page page, SalesLedgerWorkDto salesLedgerWorkDto) {
        IPage<SalesLedgerWorkDto> listPage = salesLedgerWorkService.listPage(page, salesLedgerWorkDto);
        return AjaxResult.success(listPage);
    }
    /**
     * 导出
     * @param response
     */
    @PostMapping("/export")
    @ApiOperation("生产管理-生产报工-导出")
    public void export(HttpServletResponse response) {
        Page page = new Page(-1,-1);
        SalesLedgerWorkDto salesLedgerSchedulingDto = new SalesLedgerWorkDto();
        IPage<SalesLedgerWorkDto> result = salesLedgerWorkService.listPage(page,salesLedgerSchedulingDto);
        result.getRecords().forEach(item -> {
            item.setDaiNum(item.getFinishedNum().subtract(item.getSchedulingNum()));
            item.setStatusName(item.getStatus().toString());
        });
        ExcelUtil<SalesLedgerWorkDto> util = new ExcelUtil<>(SalesLedgerWorkDto.class);
        util.exportExcel(response, result.getRecords(), "工序排产");
    }
    @GetMapping("/list")
    @Log(title = "生产报工-查询", businessType = BusinessType.OTHER)
    @ApiOperation("生产报工-查询")
    public AjaxResult list(@RequestParam("id") Long id) {
        List<ProductionReportDto> list = salesLedgerWorkService.getList(id);
        return AjaxResult.success(list);
    }
    @PostMapping("/productionReport")
    @Log(title = "生产管理-生产报工", businessType = BusinessType.INSERT)
    @ApiOperation("生产管理-生产报工")
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult productionReport(@RequestBody ProductionReportDto productionReportDto) {
        int result = salesLedgerWorkService.productionReport(productionReportDto);
        return AjaxResult.success(result);
    }
    @PostMapping("/productionReportUpdate")
    @Log(title = "生产管理-生产报工-修改", businessType = BusinessType.UPDATE)
    @ApiOperation("生产管理-生产报工-修改")
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult productionReportUpdate(@RequestBody ProductionReportDto productionReportDto) {
        int result = salesLedgerWorkService.productionReportUpdate(productionReportDto);
        return AjaxResult.success(result);
    }
}
//package com.ruoyi.production.controller;
//
//import com.baomidou.mybatisplus.core.metadata.IPage;
//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import com.ruoyi.common.utils.poi.ExcelUtil;
//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.dto.ProcessSchedulingDto;
//import com.ruoyi.production.dto.ProductionReportDto;
//import com.ruoyi.production.dto.SalesLedgerSchedulingProcessDto;
//import com.ruoyi.production.dto.SalesLedgerWorkDto;
//import com.ruoyi.production.pojo.SalesLedgerWork;
//import com.ruoyi.production.service.SalesLedgerWorkService;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.transaction.annotation.Transactional;
//import org.springframework.web.bind.annotation.*;
//
//import javax.servlet.http.HttpServletResponse;
//import java.util.List;
//
///**
// * @author :yys
// * @date : 2025/7/21 14:43
// */
//@RestController
//@Api(tags = "生产报工(排产记录)")
//@RequestMapping("/salesLedger/work")
//@Deprecated // 标记该类已弃用
//public class SalesLedgerWorkController extends BaseController {
//
//
//    @Autowired
//    private SalesLedgerWorkServiceImpl salesLedgerWorkService;
//
//    @GetMapping("/listPage")
//    @Log(title = "生产报工-分页查询", businessType = BusinessType.OTHER)
//    @ApiOperation("生产报工-分页查询")
//    public AjaxResult listPage(Page page, SalesLedgerWorkDto salesLedgerWorkDto) {
//        IPage<SalesLedgerWorkDto> listPage = salesLedgerWorkService.listPage(page, salesLedgerWorkDto);
//        return AjaxResult.success(listPage);
//    }
//
//    /**
//     * 导出
//     * @param response
//     */
//    @PostMapping("/export")
//    @ApiOperation("生产管理-生产报工-导出")
//    public void export(HttpServletResponse response) {
//        Page page = new Page(-1,-1);
//        SalesLedgerWorkDto salesLedgerSchedulingDto = new SalesLedgerWorkDto();
//        IPage<SalesLedgerWorkDto> result = salesLedgerWorkService.listPage(page,salesLedgerSchedulingDto);
//        result.getRecords().forEach(item -> {
//            item.setDaiNum(item.getFinishedNum().subtract(item.getSchedulingNum()));
//            item.setStatusName(item.getStatus().toString());
//        });
//        ExcelUtil<SalesLedgerWorkDto> util = new ExcelUtil<>(SalesLedgerWorkDto.class);
//        util.exportExcel(response, result.getRecords(), "工序排产");
//    }
//
//    @GetMapping("/list")
//    @Log(title = "生产报工-查询", businessType = BusinessType.OTHER)
//    @ApiOperation("生产报工-查询")
//    public AjaxResult list(@RequestParam("id") Long id) {
//        List<ProductionReportDto> list = salesLedgerWorkService.getList(id);
//        return AjaxResult.success(list);
//    }
//
//    @PostMapping("/productionReport")
//    @Log(title = "生产管理-生产报工", businessType = BusinessType.INSERT)
//    @ApiOperation("生产管理-生产报工")
//    @Transactional(rollbackFor = Exception.class)
//    public AjaxResult productionReport(@RequestBody ProductionReportDto productionReportDto) {
//        int result = salesLedgerWorkService.productionReport(productionReportDto);
//        return AjaxResult.success(result);
//    }
//
//
//    @PostMapping("/productionReportUpdate")
//    @Log(title = "生产管理-生产报工-修改", businessType = BusinessType.UPDATE)
//    @ApiOperation("生产管理-生产报工-修改")
//    @Transactional(rollbackFor = Exception.class)
//    public AjaxResult productionReportUpdate(@RequestBody ProductionReportDto productionReportDto) {
//        int result = salesLedgerWorkService.productionReportUpdate(productionReportDto);
//        return AjaxResult.success(result);
//    }
//
//}