guoyuji
2024-05-31 3ee23fa2bfb5f90863a1e2579c882b4bae875aa3
north-glass-erp/src/main/java/com/example/erp/controller/mm/FinishedGoodsInventoryController.java
@@ -5,11 +5,14 @@
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.example.erp.common.Constants;
import com.example.erp.common.Result;
import com.example.erp.dto.mm.FinishedOperateLogDTO;
import com.example.erp.entity.mm.FinishedOperateLog;
import com.example.erp.entity.pp.FlowCard;
import com.example.erp.entity.sd.Order;
import com.example.erp.entity.sd.OrderDetail;
import com.example.erp.exception.ServiceException;
import com.example.erp.service.mm.FinishedGoodsInventoryService;
import com.example.erp.tools.DownExcel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
@@ -17,6 +20,9 @@
import com.example.erp.entity.mm.FinishedGoodsInventory;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
@@ -48,12 +54,8 @@
    @SaCheckPermission("CreateProductStock.add")
    @PostMapping("/addSelectWarehousing")
    public Result addSelectWarehousing( @RequestBody Map<String,Object>  object){
        if(finishedGoodsInventoryService.addSelectWarehousing(object)){
            return Result.seccess();
        }else {
           throw new ServiceException(Constants.Code_500,"入库失败");
        return Result.seccess(finishedGoodsInventoryService.addSelectWarehousing(object));
        }
    }
    /*查询可发货的成品数据*/
@@ -69,12 +71,7 @@
    @SaCheckPermission("FinishedProductOut.add")
    @PostMapping("/addDeliveryDetail")
    public Result addDeliveryDetail( @RequestBody Map<String,Object>  object){
        if(finishedGoodsInventoryService.addDeliveryDetail(object)){
            return Result.seccess();
        }else {
            throw new ServiceException(Constants.Code_500,"出库失败");
        }
        return Result.seccess(finishedGoodsInventoryService.addDeliveryDetail(object));
    }
    /* 调拨查询*/
@@ -90,14 +87,7 @@
    @SaCheckPermission("OrderAllocation.add")
    @PostMapping("/updateFinishedGoodsInventoryAllocate")
    public Result updateFinishedGoodsInventoryAllocate( @RequestBody Map<String,Object>  object){
        if(finishedGoodsInventoryService.updateFinishedGoodsInventoryAllocate(object)){
            return Result.seccess();
        }else {
            throw new ServiceException(Constants.Code_500,"调拨失败,请检查订单输入是否正确");
        }
        return Result.seccess(finishedGoodsInventoryService.updateFinishedGoodsInventoryAllocate(object));
    }
    /*调拨记录查询*/
@@ -113,14 +103,7 @@
    @SaCheckPermission("FinishedGoodsIssue.add")
    @PostMapping("/updateFinishedGoodsInventoryTakeOut")
    public Result updateFinishedGoodsInventoryTakeOut( @RequestBody Map<String,Object>  object){
        if(finishedGoodsInventoryService.updateFinishedGoodsInventoryTakeOut(object)){
            return Result.seccess();
        }else {
            throw new ServiceException(Constants.Code_500,"领出失败");
        }
        return Result.seccess(finishedGoodsInventoryService.updateFinishedGoodsInventoryTakeOut(object));
    }
    /*领出记录查询*/
@@ -135,14 +118,7 @@
    @ApiOperation("订单返工查询接口")
    @PostMapping("/updateFinishedGoodsInventoryRework")
    public Result updateFinishedGoodsInventoryRework( @RequestBody Map<String,Object>  object){
        if(finishedGoodsInventoryService.updateFinishedGoodsInventoryRework(object)){
            return Result.seccess();
        }else {
            throw new ServiceException(Constants.Code_500,"返工失败");
        }
        return Result.seccess(finishedGoodsInventoryService.updateFinishedGoodsInventoryRework(object));
    }
@@ -152,28 +128,14 @@
    @SaCheckPermission("TakeOutRecord.review")
    @PostMapping("/updateFinishedGoodsInventoryToExamine")
    public Result updateFinishedGoodsInventoryToExamine( @RequestBody Map<String,Object>  object){
        if(finishedGoodsInventoryService.updateFinishedGoodsInventoryToExamine(object,"审核")){
            return Result.seccess();
        }else {
            throw new ServiceException(Constants.Code_500,"领出失败");
        }
        return Result.seccess(finishedGoodsInventoryService.updateFinishedGoodsInventoryToExamine(object,"审核"));
    }
    /*订单反审*/
    @ApiOperation("订单反审接口")
    @SaCheckPermission("TakeOutRecord.review")
    @PostMapping("/updateFinishedGoodsInventoryCounterExamination")
    public Result updateFinishedGoodsInventoryCounterExamination( @RequestBody Map<String,Object>  object){
        if(finishedGoodsInventoryService.updateFinishedGoodsInventoryToExamine(object,"反审")){
            return Result.seccess();
        }else {
            throw new ServiceException(Constants.Code_500,"领出失败");
        }
        return Result.seccess(finishedGoodsInventoryService.updateFinishedGoodsInventoryToExamine(object,"反审"));
    }
    /*订单作废*/
@@ -181,14 +143,7 @@
    @SaCheckPermission("TakeOutRecord.update")
    @PostMapping("/cancelFinishedGoodsInventoryToExamine")
    public Result cancelFinishedGoodsInventoryToExamine( @RequestBody Map<String,Object>  object){
        if(finishedGoodsInventoryService.cancelFinishedGoodsInventoryToExamine(object)){
            return Result.seccess();
        }else {
            throw new ServiceException(Constants.Code_500,"领出失败");
        }
        return Result.seccess(finishedGoodsInventoryService.cancelFinishedGoodsInventoryToExamine(object));
    }
    /*出入库记录查询*/
@@ -204,14 +159,7 @@
    @SaCheckPermission("storageRecord.update")
    @PostMapping("/cancelFinishedGoodsInventoryStorage")
    public Result cancelFinishedGoodsInventoryStorage( @RequestBody Map<String,Object>  object){
        if(finishedGoodsInventoryService.cancelFinishedGoodsInventoryStorage(object)){
            return Result.seccess();
        }else {
            throw new ServiceException(Constants.Code_500,"返回失败");
        }
        return Result.seccess(finishedGoodsInventoryService.cancelFinishedGoodsInventoryStorage(object));
    }
    @ApiOperation("成品库存记录查询接口")
@@ -220,4 +168,11 @@
    public Result getSelectFinishedOperateLogReport(@PathVariable Integer pageNum, @PathVariable Integer pageSize,@PathVariable List<String> selectDate, @RequestBody FinishedOperateLog finishedOperateLog){
        return Result.seccess(finishedGoodsInventoryService.getSelectFinishedOperateLogReport(pageNum,pageSize,selectDate,finishedOperateLog));
    }
    @ApiOperation("成品报表导出")
    @PostMapping("/exportFinishedOperateLogReport")
    public void exportFinishedOperateLogReport(HttpServletResponse response, @RequestBody List<LocalDate> dates) throws IOException, IllegalAccessException, InstantiationException {
        //参数:相应的数据,实体类信息,相应的方法(数据获取),生成的excel名字
        DownExcel.download(response, FinishedOperateLogDTO.class, finishedGoodsInventoryService.exportFinishedOperateLogReport(dates),"orderReport");
    }
}