package com.example.erp.controller.mm; 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.*; import com.example.erp.entity.pp.OptimizeUse; import com.example.erp.exception.ServiceException; import com.example.erp.service.mm.MaterialInventoryService; import com.example.erp.service.mm.MaterialStoreService; import com.example.erp.tools.DownExcel; 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.io.IOException; import java.time.LocalDate; import java.util.List; import java.util.Map; @RestController @RequestMapping("/materialInventory") @Api(value="物料库存controller",tags={"物料库存操作接口"}) public class MaterialInventoryController { @Autowired MaterialInventoryService materialInventoryService; @ApiOperation("物料出库新增接口") @SaCheckPermission("createOutbound.add") @PostMapping("/saveMaterialOutbound") public Result saveMaterialOutbound( @RequestBody Map object){ return Result.seccess(materialInventoryService.saveMaterialOutbound(object)); } @ApiOperation("物料新增接口") @SaCheckPermission("selectIngredientsStock.add") @PostMapping("/saveMaterialInventory") public Result saveMaterialInventory( @RequestBody Map object){ return Result.seccess(materialInventoryService.saveMaterialInventory(object)); } @ApiOperation("物料库存加时间查询接口") @SaCheckPermission("selectIngredientsStock.search") @PostMapping("/getSelectMaterialInventoryDate/{pageNum}/{pageSize}/{selectDate}") public Result getSelectMaterialInventoryDate(@PathVariable Integer pageNum, @PathVariable Integer pageSize, @PathVariable List selectDate, @RequestBody MaterialInventory materialInventory){ return Result.seccess(materialInventoryService.getSelectMaterialInventoryDate(pageNum,pageSize,selectDate,materialInventory)); } @ApiOperation("物料库存工程加时间查询接口") @SaCheckPermission("selectIngredientsStock.search") @PostMapping("/getSelectMaterialInventoryEngineeringDate/{pageNum}/{pageSize}/{selectDate}") public Result getSelectMaterialInventoryEngineeringDate(@PathVariable Integer pageNum, @PathVariable Integer pageSize, @PathVariable List selectDate, @RequestBody MaterialInventory materialInventory){ return Result.seccess(materialInventoryService.getSelectMaterialInventoryEngineeringDate(pageNum,pageSize,selectDate,materialInventory)); } @ApiOperation("物料库存查询接口") @SaCheckPermission("createOutbound.search") @PostMapping("/getSelectMaterialInventory/{pageNum}/{pageSize}") public Result getSelectMaterialInventory(@PathVariable Integer pageNum, @PathVariable Integer pageSize, @RequestBody MaterialInventory materialInventory){ return Result.seccess(materialInventoryService.getSelectMaterialInventory(pageNum,pageSize,materialInventory)); } @ApiOperation("物料库存工程查询接口") @SaCheckPermission("selectIngredientsStock.search") @PostMapping("/getSelectMaterialInventoryEngineering/{pageNum}/{pageSize}") public Result getSelectMaterialInventoryEngineering(@PathVariable Integer pageNum, @PathVariable Integer pageSize, @RequestBody OptimizeUse optimizeUse){ return Result.seccess(materialInventoryService.getSelectMaterialInventoryEngineering(pageNum,pageSize,optimizeUse)); } @ApiOperation("材料出库加时间查询接口") @SaCheckPermission("materialOutbound.search") @PostMapping("/getSelectMaterialOutboundDate/{pageNum}/{pageSize}/{selectDate}") public Result getSelectMaterialOutboundDate(@PathVariable Integer pageNum, @PathVariable Integer pageSize, @PathVariable List selectDate, @RequestBody MaterialOutbound materialOutbound){ return Result.seccess(materialInventoryService.getSelectMaterialOutboundDate(pageNum,pageSize,selectDate, materialOutbound)); } @ApiOperation("材料出库查询接口") @SaCheckPermission("createOutbound.search") @PostMapping("/getSelectMaterialOutbound/{pageNum}/{pageSize}") public Result getSelectMaterialOutbound(@PathVariable Integer pageNum, @PathVariable Integer pageSize, @RequestBody MaterialOutboundDetail materialOutboundDetail){ return Result.seccess(materialInventoryService.getSelectMaterialOutbound(pageNum,pageSize,materialOutboundDetail)); } @ApiOperation("材料出库审核接口") @SaCheckPermission("createOutbound.review") @PostMapping("/updateMaterialOutboundToExamine") public Result updateMaterialOutboundToExamine( @RequestBody Map object){ return Result.seccess(materialInventoryService.updateMaterialOutboundToExamine(object)); } @ApiOperation("材料出库删除接口") @SaCheckPermission("materialOutbound.delete") @PostMapping("/deleteMaterialOutbound") public Result deleteMaterialOutbound( @RequestBody Map object){ return Result.seccess(materialInventoryService.deleteMaterialOutbound(object)); } @ApiOperation("物料返库新增接口") @SaCheckPermission("returnToStorageCreate.add") @PostMapping("/saveReturningWarehouse") public Result saveReturningWarehouse( @RequestBody Map object){ return Result.seccess(materialInventoryService.saveReturningWarehouse(object)); } @ApiOperation("物料返库新增查询接口") @SaCheckPermission("returnToStorageCreate.search") @PostMapping("/getSelectReturningWarehouse/{pageNum}/{pageSize}") public Result getSelectReturningWarehouse(@PathVariable Integer pageNum, @PathVariable Integer pageSize, @RequestBody ReturningWarehouseDetail returningWarehouseDetail){ return Result.seccess(materialInventoryService.getSelectReturningWarehouse(pageNum,pageSize,returningWarehouseDetail)); } @ApiOperation("物料返库删除接口") @SaCheckPermission("returnToStorageCreate.delete") @PostMapping("/deleteReturnToStorage") public Result deleteReturnToStorage( @RequestBody Map object){ return Result.seccess(materialInventoryService.deleteReturnToStorage(object)); } @ApiOperation("物料返库审核接口") @SaCheckPermission("returnToStorageCreate.review") @PostMapping("/updateReturningWarehouseToExamine") public Result updateReturningWarehouseToExamine( @RequestBody Map object){ return Result.seccess(materialInventoryService.updateReturningWarehouseToExamine(object)); } @ApiOperation("物料返库查询接口") @SaCheckPermission("returnToStorage.search") @PostMapping("/getSelectReturningWarehouseDate/{pageNum}/{pageSize}/{selectDate}") public Result getSelectReturningWarehouseDate(@PathVariable Integer pageNum, @PathVariable Integer pageSize, @PathVariable List selectDate, @RequestBody ReturningWarehouse returningWarehouse){ return Result.seccess(materialInventoryService.getSelectReturningWarehouseDate(pageNum,pageSize,selectDate, returningWarehouse)); } @ApiOperation("余料库存查询接口") @SaCheckPermission("selectIngredientsStock.search") @PostMapping("/getSelectSurplusMaterialsDate/{pageNum}/{pageSize}/{selectDate}") public Result getSelectSurplusMaterialsDate(@PathVariable Integer pageNum, @PathVariable Integer pageSize, @PathVariable List selectDate, @RequestBody SurplusMaterials surplusMaterials){ return Result.seccess(materialInventoryService.getSelectSurplusMaterialsDate(pageNum,pageSize,selectDate,surplusMaterials)); } @ApiOperation("余料新增接口") @SaCheckPermission("selectIngredientsStock.search") @PostMapping("/addSelectSurplusMaterialsDate") public Result addSelectSurplusMaterialsDate( @RequestBody Map object){ return Result.seccess(materialInventoryService.addSelectSurplusMaterialsDate(object)); } @ApiOperation("物料出库打印接口") @SaCheckPermission("selectIngredientsStock.search") @GetMapping ("/printCreateOutbound/{materialOutboundId}") public Result printCreateOutbound(@PathVariable String materialOutboundId) { return Result.seccess(materialInventoryService.printCreateOutbound(materialOutboundId)); } @ApiOperation("物料库存记录查询接口") @SaCheckPermission("warehouseReport.search") @PostMapping("/getMaterialLogReport/{type}/{pageNum}/{pageSize}/{selectDate}") public Result getMaterialLogReport(@PathVariable String type,@PathVariable Integer pageNum, @PathVariable Integer pageSize,@PathVariable List selectDate, @RequestBody MaterialLog materialLog){ return Result.seccess(materialInventoryService.getMaterialLogReport(type,pageNum,pageSize,selectDate,materialLog)); } @ApiOperation("物料库存删除") @SaCheckPermission("createOutbound.search") @PostMapping("/deleteMaterialInventory") public Result deleteMaterialInventory(@RequestBody Map object){ return Result.seccess(materialInventoryService.deleteMaterialInventory(object)); } @ApiOperation("物料报表导出") @PostMapping("/exportMaterialLogReport/{type}") public void exportMaterialLogReport(@PathVariable String type, HttpServletResponse response, @RequestBody List dates) throws IOException, IllegalAccessException, InstantiationException { //参数:相应的数据,实体类信息,相应的方法(数据获取),生成的excel名字 DownExcel.download(response, MaterialLog.class, materialInventoryService.exportMaterialLogReport(dates,type),"orderReport"); } @ApiOperation("mes切割报工") @PostMapping ("/mesMaterialOutbound") public Result mesMaterialOutbound(@RequestBody Map reportingWork) { return Result.seccess(materialInventoryService.mesMaterialOutbound(reportingWork)); } @ApiOperation("mes原片查询") @PostMapping ("/mesOriginalSelect") public Result mesOriginalSelect() { return Result.seccess(materialInventoryService.mesOriginalSelect()); } @ApiOperation("物料新增返回接口") @PostMapping("/cancelMaterialAdditionRecord") public Result cancelMaterialAdditionRecord( @RequestBody Map object){ return Result.seccess(materialInventoryService.cancelMaterialAdditionRecord(object)); } @ApiOperation("优化物料库存记录查询接口") @SaCheckPermission("warehouseReport.search") @PostMapping("/getOptimizeOutboundReport/{type}/{pageNum}/{pageSize}/{selectDate}") public Result getOptimizeOutboundReport(@PathVariable String type,@PathVariable Integer pageNum, @PathVariable Integer pageSize,@PathVariable List selectDate, @RequestBody MaterialLog materialLog){ return Result.seccess(materialInventoryService.getOptimizeOutboundReport(type,pageNum,pageSize,selectDate,materialLog)); } @ApiOperation("物料出库保存并审核接口") @SaCheckPermission("createOutbound.add") @PostMapping("/saveToExamineMaterialOutbound") public Result saveToExamineMaterialOutbound( @RequestBody Map object){ return Result.seccess(materialInventoryService.saveToExamineMaterialOutbound(object)); } }