src/main/java/com/ruoyi/consumables/controller/ConsumablesOutRecordController.java
@@ -2,14 +2,18 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.consumables.dto.ConsumablesOutRecordDto;
import com.ruoyi.consumables.service.ConsumablesOutRecordService;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.stock.dto.StockInRecordDto;
import com.ruoyi.stock.word.WeighbridgeDocGenerator;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
@@ -30,6 +34,8 @@
public class ConsumablesOutRecordController {
    @Autowired
    private ConsumablesOutRecordService consumablesUnInventoryDto;
    @Autowired
    private WeighbridgeDocGenerator weighbridgeDocGenerator;
    @GetMapping("/listPage")
    @Log(title = "生产出库-出库管理-列表", businessType = BusinessType.OTHER)
@@ -45,13 +51,24 @@
        return AjaxResult.success(consumablesUnInventoryDto.add(consumablesOutRecordDto));
    }
    @PutMapping("/{id}")
    @Log(title = "出库管理-更新出库", businessType = BusinessType.UPDATE)
    public AjaxResult update(@PathVariable("id") Long id, @RequestBody ConsumablesOutRecordDto consumablesOutRecordDto) {
        return AjaxResult.success(consumablesUnInventoryDto.update(id, consumablesOutRecordDto));
    @PostMapping("/editStockOut")
    @PreAuthorize("@ss.hasPermi('c_dispatch_edit')")
    @ApiOperation("编辑出库记录")
    public AjaxResult update(@RequestBody ConsumablesOutRecordDto consumablesOutRecordDto) {
        if (consumablesOutRecordDto.getId() == null) {
            return AjaxResult.error("出库记录ID不能为空");
        }
        StockInRecordDto stockInRecordDto = new StockInRecordDto();
        BeanUtils.copyProperties(consumablesOutRecordDto, stockInRecordDto);
        stockInRecordDto.setStockInNum(consumablesOutRecordDto.getStockOutNum());
        String absoluteDocPath = weighbridgeDocGenerator.generateWeighbridgeDoc(stockInRecordDto);
        consumablesOutRecordDto.setWeighbridgeDocPath(absoluteDocPath);
        consumablesOutRecordDto.setStockOutNum(consumablesOutRecordDto.getQualitity());
        return AjaxResult.success(consumablesUnInventoryDto.updateById(consumablesOutRecordDto));
    }
    @DeleteMapping("")
    @PreAuthorize("@ss.hasPermi('c_dispatch_cancel')")
    @Log(title = "出库管理-删除出库", businessType = BusinessType.DELETE)
    public AjaxResult delete(@RequestBody List<Long> ids) {
        if(CollectionUtils.isEmpty(ids)){