| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.mom.pojo.FinishedInspect; |
| | | import com.yuanchu.mom.pojo.vo.FinishedInspectVo1; |
| | | import com.yuanchu.mom.pojo.ProcessInspect; |
| | | import com.yuanchu.mom.pojo.vo.FinishedInspectVo; |
| | | import com.yuanchu.mom.service.*; |
| | | import com.yuanchu.mom.utils.JackSonUtil; |
| | | import com.yuanchu.mom.utils.Jwt; |
| | |
| | | |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | @Autowired |
| | | private FinishedInspectService finishedInspectService; |
| | | |
| | | @Autowired |
| | | private UserService userService; |
| | | |
| | | @Autowired |
| | | private SpecificationsService specificationsService; |
| | | |
| | | @Autowired |
| | | private MaterialService materialService; |
| | | |
| | | @Autowired |
| | | Jwt jwt; |
| | | |
| | | @ApiOperation(value = "新增过程检验单-->根据订单号选择产品信息和工艺") |
| | | @ApiOperation(value = "新增成品检验单-->根据订单号选择产品信息和工艺") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "orderNumber", value = "订单编号", dataTypeClass = String.class, required = true) |
| | | }) |
| | |
| | | return Result.success(finishedInspectService.chooseMater(orderNumber)); |
| | | } |
| | | |
| | | @ApiOperation(value = "新增过程检验单-->选择设备") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "technologyId", value = "关联的工艺路线id", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "father", value = "项目父名称", dataTypeClass = String.class, required = true), |
| | | @ApiImplicitParam(name = "name", value = "项目名称", dataTypeClass = String.class, required = true) |
| | | }) |
| | | @GetMapping("/chooseDev") |
| | | public Result<?> chooseDev(Integer technologyId, String father, String name) { |
| | | return Result.success(finishedInspectService.chooseDev(technologyId,father,name)); |
| | | } |
| | | |
| | | @ApiOperation(value = "新增过程检验单") |
| | | @PostMapping("/addProcess") |
| | | public Result<?> addProcess(@RequestHeader("token") String token, @RequestBody FinishedInspectVo1 finishedInspectVo1) throws Exception { |
| | | @ApiOperation(value = "新增成品检验单") |
| | | @PostMapping("/addFinish") |
| | | public Result<?> addFinish(@RequestHeader("token") String token, @Validated @RequestBody FinishedInspectVo finishedInspectVo) throws Exception { |
| | | Map<String, String> data = JackSonUtil.unmarshal(jwt.readJWT(token).get("data"), Map.class); |
| | | return Result.success(finishedInspectService.addProcess(data.get("id").replaceAll("\"", ""), finishedInspectVo1)); |
| | | return Result.success(finishedInspectService.addProcessInspectionSheet(data.get("id").replaceAll("\"", ""), finishedInspectVo)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "新增按钮-->1、新增成品检验单") |
| | | @PostMapping("/add_process_inspection_sheet") |
| | | public Result<?> addProcessInspectionSheet(@Validated @RequestBody FinishedInspect finishedInspect) { |
| | | Integer isInsertSuccess = finishedInspectService.addProcessInspectionSheet(finishedInspect); |
| | | if (isInsertSuccess == 1) { |
| | | return Result.success("新增成功!", finishedInspect.getId()); |
| | | } |
| | | return Result.fail("新增失败!"); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "新增按钮-->1、新增过程检验单-->1、项目名称下拉框") |
| | | @GetMapping("/list_material") |
| | | public Result<?> selectMaterialIdAndNameAndCode() { |
| | | List<Map<String, Object>> maps = materialService.selectMaterialIdAndNameAndCode(); |
| | | return Result.success(maps); |
| | | } |
| | | |
| | | @ApiOperation(value = "新增按钮-->3、检验结论") |
| | | @ApiOperation(value = "上报(更新检验状态)") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "finishedInspectId", value = "检验单Id", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "result", value = "检验结论", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "id", value = "检验单id", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "number", value = "不合格数量", dataTypeClass = Integer.class) |
| | | }) |
| | | @PostMapping("/inspection_conclusion") |
| | | public Result<?> inspectionConclusion(@RequestHeader("token") String token, Integer finishedInspectId, Integer result) throws Exception { |
| | | Map<String, String> data = JackSonUtil.unmarshal(jwt.readJWT(token).get("data"), Map.class); |
| | | Integer isInsertSuccess = finishedInspectService.inspectionConclusion(data.get("name").replaceAll("\"", ""), finishedInspectId, result); |
| | | if (isInsertSuccess == 1) { |
| | | return Result.success("上报成功!"); |
| | | @PostMapping("/updateFinishInspectsById") |
| | | public Result updateFinishInspectsById(@RequestHeader("token") String token, Integer id,Integer number) throws Exception { |
| | | //如果已经上报了不能再一次上报 |
| | | FinishedInspect finishedInspect = finishedInspectService.getById(id); |
| | | if (ObjectUtils.isNotEmpty(finishedInspect.getResult())) { |
| | | return Result.fail("已经上报过了,不能再次上报!"); |
| | | } |
| | | return Result.fail("上报失败!"); |
| | | Map<String, String> data = JackSonUtil.unmarshal(jwt.readJWT(token).get("data"), Map.class); |
| | | return Result.success(finishedInspectService.updateFinishInspectsById(data.get("name").replaceAll("\"", ""), id,number)); |
| | | } |
| | | |
| | | @ApiOperation(value = "4、主页分页") |
| | | @ApiOperation(value = "根据检验单id查询成品检验单详情") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "pageNo", value = "条数/页", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "id", value = "检验单id", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @GetMapping("/selectFinishInspectsListById") |
| | | public Result selectFinishInspectsListById(Integer id) { |
| | | return Result.success(finishedInspectService.selectFinishInspectsListById(id)); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页查询成品检验单列表") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "countSize", value = "条数/页", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "pageSize", value = "页数", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "inspectResult", value = "检验结果", dataTypeClass = Integer.class), |
| | | @ApiImplicitParam(name = "inspectDate", value = "检验日期", dataTypeClass = Date.class, dataType = "date"), |
| | | @ApiImplicitParam(name = "inspectUsername", value = "主机工", dataTypeClass = String.class) |
| | | @ApiImplicitParam(name = "result", value = "检验结果(为空=全部)", dataTypeClass = Integer.class), |
| | | @ApiImplicitParam(name = "material", value = "产品名称", dataTypeClass = String.class) |
| | | }) |
| | | @GetMapping("/list_page") |
| | | public Result<?> selectFinishedInspectPage(Integer pageNo, Integer pageSize, Integer inspectResult, String inspectDate, String inspectUsername) { |
| | | IPage<Map<String, Object>> page = finishedInspectService.selectFinishedInspectPage(new Page<Object>(pageNo, pageSize), inspectResult, inspectDate, inspectUsername); |
| | | public Result<?> list_page(Integer pageSize, Integer countSize, Integer result, String material) { |
| | | IPage<Map<String, Object>> page = finishedInspectService.selectFinishedInspectPage(new Page<Object>(pageSize, countSize), result, material); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("total", page.getTotal()); |
| | | map.put("row", page.getRecords()); |