package org.jeecg.modules.dnc.controller; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.modules.dnc.entity.ProcessStream; import org.jeecg.modules.dnc.response.CommonCode; import org.jeecg.modules.dnc.response.QueryListResponseResult; import org.jeecg.modules.dnc.response.ResponseResult; import org.jeecg.modules.dnc.request.ProcessStreamRequest; import org.jeecg.modules.dnc.service.IProcessStreamService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.Collections; import java.util.List; @Slf4j @Api(tags = "全部工序表") @RestController @RequestMapping("/nc/stream/process") public class ProcessStreamController extends JeecgController { @Autowired private IProcessStreamService processStreamService; @AutoLog(value = "全部工序表-添加工序") @ApiOperation(value = "全部工序表-添加工序", notes = "全部工序表-添加工序") @PostMapping("/add") public ResponseResult addProcessStream(@RequestBody ProcessStream stream) { boolean b = processStreamService.addProcessStream(stream); if(b) { return new ResponseResult(CommonCode.SUCCESS); } return new ResponseResult(CommonCode.FAIL); } @AutoLog(value = "全部工序表-编辑工序信息") @ApiOperation(value = "全部工序表-编辑工序信息", notes = "全部工序表-编辑工序信息") @PutMapping("/edit/{id}") public ResponseResult editProcessStream(@PathVariable("id") String id, @RequestBody ProcessStream stream) { boolean b = processStreamService.editProcessStream(id, stream); if(b) { return new ResponseResult(CommonCode.SUCCESS); } return new ResponseResult(CommonCode.FAIL); } @AutoLog(value = "全部工序表-删除工序信息 逻辑删除") @ApiOperation(value = "全部工序表-删除工序信息 逻辑删除", notes = "全部工序表-删除工序信息 逻辑删除") @DeleteMapping("/delete") public ResponseResult deleteProcessStream(@RequestParam("id") String id) { boolean b = processStreamService.deleteProcessStream(id); if(b) { return new ResponseResult(CommonCode.SUCCESS); } return new ResponseResult(CommonCode.FAIL); } @AutoLog(value = "全部工序表-查询部件/零件节点下的工序列表") @ApiOperation(value = "全部工序表-查询部件/零件节点下的工序列表", notes = "全部工序表-查询部件/零件节点下的工序列表") @GetMapping("/find/list") public QueryListResponseResult findByNodeParams(ProcessStreamRequest request) { List list = processStreamService.findByNodeParams(request); if(list == null) list = Collections.emptyList(); return new QueryListResponseResult<>(CommonCode.SUCCESS, list); } @AutoLog(value = "全部工序表-检查PN码对应的设备是否存在可加工工序") @ApiOperation(value = "全部工序表-检查PN码对应的设备是否存在可加工工序", notes = "全部工序表-检查PN码对应的设备是否存在可加工工序") @GetMapping("/valid/process") public ResponseResult validateDeviceProcessInfo(String pnCode, String deviceNo) { List list = processStreamService.validateDeviceProcessInfo(pnCode, deviceNo); if(list == null || list.isEmpty()) return new ResponseResult(CommonCode.FAIL); return new ResponseResult(CommonCode.FAIL); } }