| | |
| | | import cn.dev33.satoken.annotation.SaCheckPermission; |
| | | import com.example.erp.common.Constants; |
| | | import com.example.erp.common.Result; |
| | | import com.example.erp.entity.pp.LayoutsData; |
| | | import com.example.erp.entity.pp.OptimizeProjectMange; |
| | | import com.example.erp.exception.ServiceException; |
| | | import com.example.erp.service.pp.GlassOptimizeService; |
| | | import com.example.erp.service.pp.JsonToOptConverter; |
| | | import com.example.erp.service.userInfo.UserService; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.sql.Date; |
| | | import java.util.Map; |
| | | |
| | |
| | | public class GlassOptimizeController { |
| | | @Autowired |
| | | GlassOptimizeService glassOptimizeService; |
| | | |
| | | @Autowired |
| | | private UserService userService; |
| | | //工程信息 |
| | | @ApiOperation("工程信息接口") |
| | | @PostMapping ("/projectInfo/{projectNo}") |
| | | @PostMapping ("/projectInfo/{projectNo}/{username}") |
| | | public Result projectInfo( |
| | | @PathVariable String projectNo,@PathVariable String username){ |
| | | return Result.seccess(glassOptimizeService.projectInfoSv(projectNo,username)); |
| | | } |
| | | |
| | | //工程信息流程卡 |
| | | @ApiOperation("工程信息流程卡接口") |
| | | @PostMapping ("/getProcessCard/{projectNo}") |
| | | public Result getProcessCard( |
| | | @PathVariable String projectNo){ |
| | | return Result.seccess(glassOptimizeService.projectInfoSv(projectNo)); |
| | | return Result.seccess(glassOptimizeService.getProcessCardSv(projectNo)); |
| | | } |
| | | |
| | | //库存信息 |
| | | @ApiOperation("库存信息接口") |
| | | @PostMapping ("/materialStore/{thickness}/{model}") |
| | | @GetMapping ("/materialStore/{thickness}/{model}/{projectNumber}") |
| | | public Result materialStore( |
| | | @PathVariable String thickness, |
| | | @PathVariable String model ){ |
| | | return Result.seccess(glassOptimizeService.materialStoreSv(thickness,model)); |
| | | @PathVariable String model,@PathVariable String projectNumber, |
| | | @RequestParam(name = "type", required = false) Integer type,@RequestParam(name = "username", required = false) String username ){ |
| | | return Result.seccess(glassOptimizeService.materialStoreSv(thickness,model,projectNumber,type,username)); |
| | | } |
| | | |
| | | |
| | |
| | | @PathVariable String optionVal, |
| | | @PathVariable Integer radio){ |
| | | return Result.seccess(glassOptimizeService.getFlowCardList(optionVal,radio)); |
| | | } |
| | | |
| | | //工程查询流程卡 |
| | | @ApiOperation("修改工程查询流程卡接口") |
| | | @PostMapping ("/getUpdateFlowCardList/{type}/{thickness}/{radio}/{projectNo}") |
| | | public Result getUpdateFlowCardList( |
| | | @PathVariable String type,@PathVariable String thickness, |
| | | @PathVariable Integer radio,@PathVariable String projectNo){ |
| | | return Result.seccess(glassOptimizeService.getUpdateFlowCardList(type,thickness,radio,projectNo)); |
| | | } |
| | | |
| | | //工程查询流程卡 |
| | |
| | | |
| | | //修改工程状态 |
| | | @ApiOperation("修改工程状态接口") |
| | | @PostMapping("/updateProjectState/{projectNumber}/{state}") |
| | | @PostMapping("/updateProjectState/{projectNumber}/{state}/{states}/{code}") |
| | | public Result updateProjectState( |
| | | @PathVariable String projectNumber, |
| | | @PathVariable Integer state |
| | | @PathVariable Integer state, |
| | | @PathVariable Integer states, |
| | | @PathVariable Integer code |
| | | ) { |
| | | if (glassOptimizeService.updateProjectState(projectNumber, state)) { |
| | | if (glassOptimizeService.updateProjectState(projectNumber, state,states,code)) { |
| | | return Result.seccess(); |
| | | } else { |
| | | throw new ServiceException(Constants.Code_500, "修改失败"); |
| | |
| | | @PostMapping("/deleteProject/{projectNumber}") |
| | | public Result deleteProject( |
| | | @PathVariable String projectNumber){ |
| | | return Result.seccess(glassOptimizeService.deleteProject(projectNumber)); |
| | | return Result.seccess(glassOptimizeService.deleteProject(projectNumber,1)); |
| | | } |
| | | |
| | | //模拟计算工程号查询 |
| | |
| | | return Result.seccess(glassOptimizeService.selectProjectComputeSv(projectNumber)); |
| | | } |
| | | |
| | | //模拟计算工程号查询 |
| | | @ApiOperation("模拟计算工程数据查询") |
| | | @PostMapping ("/selectProjectComputeAll/{projectNumber}") |
| | | public Result selectProjectComputeAll( |
| | | @PathVariable String projectNumber){ |
| | | return Result.seccess(glassOptimizeService.selectProjectComputeAll(projectNumber)); |
| | | } |
| | | |
| | | //模拟计算流程卡详情 |
| | | @ApiOperation("模拟计算流程卡详情") |
| | | @PostMapping ("/selectComputeDetail/{processId}") |
| | | @PostMapping ("/selectComputeDetail/{processId}/{technologyNumber}/{patchState}") |
| | | public Result selectComputeDetail( |
| | | @PathVariable String processId){ |
| | | return Result.seccess(glassOptimizeService.selectComputeDetailSv(processId)); |
| | | @PathVariable String processId, @PathVariable Integer technologyNumber,@PathVariable String patchState){ |
| | | return Result.seccess(glassOptimizeService.selectComputeDetailSv(processId,technologyNumber,patchState)); |
| | | } |
| | | |
| | | @ApiOperation("模拟计算") |
| | | @PostMapping("/simulationCalculate") |
| | | public Result simulationCalculate(@RequestBody Map<String, Object> object) { |
| | | try { |
| | | return Result.seccess(glassOptimizeService.SimulationCalculation(object)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return Result.error(); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation("模拟计算保存") |
| | | @PostMapping("/simulationSave") |
| | | public Result simulationSave(@RequestBody Map<String, Object> object) { |
| | | try { |
| | | return Result.seccess(glassOptimizeService.addSimulation(object)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return Result.error(); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation("优化设置保存") |
| | | @PostMapping("/optimizeParms/{username}") |
| | | public Result optimizeParmsSave(@RequestBody Map<String, Object> object,@PathVariable String username) { |
| | | try { |
| | | return Result.seccess(glassOptimizeService.optimizeParmsSave(object,username)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return Result.error(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @PostMapping("/selectOptimizeParms/{username}") |
| | | public Result getOptimizeParms(@PathVariable String username) { |
| | | return Result.seccess(userService.getOptimizeParms(username)); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation("模拟计算多流程卡") |
| | | @PostMapping("/selectComputeDetailmore") |
| | | public Result selectComputeDetailmore(@RequestBody Map<String, Object> object) { |
| | | try { |
| | | return Result.seccess(glassOptimizeService.SimulationCalculation(object)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return Result.error(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | //创建工程查询流程卡明细 |
| | | @ApiOperation("创建工程查询流程卡明细") |
| | |
| | | @RequestBody Map<String,Object> object){ |
| | | return Result.seccess(glassOptimizeService.addProjectSv(optionVal,projectId,projectNmae,object)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("保存优化结果接口") |
| | | @PostMapping("/saveOptimizeData/{projectId}") |
| | | public Result saveOptimizeResult( @PathVariable String projectId, |
| | | @RequestBody Map<String,Object> object){ |
| | | return Result.seccess(glassOptimizeService.saveOptimizeResult(object,projectId)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("查询优化结果接口") |
| | | @PostMapping("/selectOptimizeResult/{processId}") |
| | | public Result selectOptimizeResult( |
| | | @PathVariable String processId){ |
| | | return Result.seccess(glassOptimizeService.selectOptimizeResult(processId)); |
| | | } |
| | | |
| | | @ApiOperation("更新优化结果接口") |
| | | @PostMapping("/updateOptimizeResult/{processId}") |
| | | public Result updateOptimizeResult( |
| | | @PathVariable String processId,@RequestBody Map<String,Object> object){ |
| | | |
| | | return Result.seccess(glassOptimizeService.updateOptimizeResult(object,processId)); |
| | | } |
| | | @ApiOperation("OPT文件下载接口") |
| | | @PostMapping("/generateOpt") |
| | | public ResponseEntity<byte[]> generateOptFile(@RequestBody LayoutsData layoutsData) throws IOException { |
| | | // 确保 layoutsData 包含 Layouts 数组 |
| | | if (layoutsData == null || layoutsData.getLayouts() == null) { |
| | | throw new IllegalArgumentException("Layouts 数据不能为空"); |
| | | } |
| | | |
| | | // 生成 OPT 文件内容 |
| | | String optContent = JsonToOptConverter.generateOptContent(layoutsData); |
| | | |
| | | // 创建响应头 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.setContentType(org.springframework.http.MediaType.TEXT_PLAIN); |
| | | headers.setContentDispositionFormData("attachment", "output.opt"); |
| | | |
| | | // 返回文件内容 |
| | | return new ResponseEntity<>(optContent.getBytes(), headers, HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping("/getConfiguration/{type}/{username}") |
| | | public Result getConfiguration(@PathVariable String type,@PathVariable String username) { |
| | | return Result.seccess(glassOptimizeService.getConfiguration(type,username)); |
| | | } |
| | | |
| | | @ApiOperation("修片磨量修改") |
| | | @PostMapping("/saveConfiguration/{type}/{username}") |
| | | public Result saveConfiguration(@PathVariable String type,@PathVariable String username, @RequestBody Map<String,Object> object){ |
| | | return Result.seccess(glassOptimizeService.saveConfiguration(object,type,username)); |
| | | } |
| | | |
| | | @ApiOperation("模拟排版") |
| | | @PostMapping("/simulatedTypesetting") |
| | | public Result simulatedTypesetting(@RequestBody Map<String, Object> object) { |
| | | return Result.seccess(glassOptimizeService.simulatedTypesetting1(object)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | //模拟计算工程号查询第三方 |
| | | @ApiOperation("模拟计算工程号查询") |
| | | @PostMapping ("/selectProjectComputeMpThirdParty/{projectNumber}") |
| | | public Result selectProjectComputeMpThirdParty( @PathVariable String projectNumber){ |
| | | return Result.seccess(glassOptimizeService.selectProjectComputeMpThirdParty(projectNumber)); |
| | | } |
| | | |
| | | //模拟计算流程卡详情第三方 |
| | | @ApiOperation("模拟计算流程卡详情") |
| | | @PostMapping ("/selectComputeDetailThirdParty/{processId}/{technologyNumber}") |
| | | public Result selectComputeDetailThirdParty( |
| | | @PathVariable String processId, @PathVariable Integer technologyNumber){ |
| | | return Result.seccess(glassOptimizeService.selectComputeDetailThirdParty(processId,technologyNumber)); |
| | | } |
| | | |
| | | @ApiOperation("模拟计算保存") |
| | | @PostMapping("/simulationSaveThirdParty") |
| | | public Result simulationSaveThirdParty(@RequestBody Map<String, Object> object) { |
| | | try { |
| | | return Result.seccess(glassOptimizeService.simulationSaveThirdParty(object)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return Result.error(); |
| | | } |
| | | } |
| | | |
| | | //删除工程 |
| | | @ApiOperation("工程管理删除接口") |
| | | @PostMapping("/deleteProjectThirdParty/{projectNumber}") |
| | | public Result deleteProjectThirdParty( |
| | | @PathVariable String projectNumber){ |
| | | return Result.seccess(glassOptimizeService.deleteProjectThirdParty(projectNumber)); |
| | | } |
| | | |
| | | @ApiOperation("工程信息接口") |
| | | @PostMapping ("/projectInfoThirdParty/{projectNo}") |
| | | public Result projectInfoThirdParty( |
| | | @PathVariable String projectNo){ |
| | | return Result.seccess(glassOptimizeService.projectInfoThirdParty(projectNo)); |
| | | } |
| | | |
| | | //库存信息 |
| | | @ApiOperation("库存信息接口") |
| | | @GetMapping ("/materialStoreSvThirdParty/{projectNumber}") |
| | | public Result materialStoreSvThirdParty(@PathVariable String projectNumber ){ |
| | | return Result.seccess(glassOptimizeService.materialStoreSvThirdParty(projectNumber)); |
| | | } |
| | | |
| | | //工程信息流程卡 |
| | | @ApiOperation("工程信息流程卡接口") |
| | | @PostMapping ("/getProcessCardMpThirdParty/{projectNo}") |
| | | public Result getProcessCardMpThirdParty( |
| | | @PathVariable String projectNo){ |
| | | return Result.seccess(glassOptimizeService.getProcessCardMpThirdParty(projectNo)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |