| | |
| | | package com.ruoyi.inspect.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.dto.InventoryDetailDTO; |
| | | import com.ruoyi.basic.mapper.IfsInventoryQuantityMapper; |
| | | import com.ruoyi.basic.pojo.IfsInventoryQuantity; |
| | | import com.ruoyi.basic.pojo.StandardProductList; |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.common.utils.JackSonUtil; |
| | | import com.ruoyi.framework.exception.ErrorException; |
| | | import com.ruoyi.inspect.dto.*; |
| | | import com.ruoyi.inspect.pojo.InsOrder; |
| | |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.ServletException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @RequestMapping("/insOrder") |
| | | @Api(tags="检验单模块") |
| | | @Api(tags = "检验单模块") |
| | | public class InsOrderController { |
| | | |
| | | private InsOrderService insOrderService; |
| | |
| | | |
| | | @ApiOperation(value = "检验分配") |
| | | @PostMapping("/upInsOrder") |
| | | public Result<?> upInsOrder(Integer orderId, Integer sampleId, String appointed, Integer userId,String sonLaboratory) { |
| | | return Result.success(insOrderService.upInsOrder(orderId, sampleId, appointed, userId,sonLaboratory)); |
| | | public Result<?> upInsOrder(Integer orderId, Integer sampleId, String appointed, Integer userId, String sonLaboratory) { |
| | | return Result.success(insOrderService.upInsOrder(orderId, sampleId, appointed, userId, sonLaboratory)); |
| | | } |
| | | |
| | | @ApiOperation(value = "添加检验下单数据") |
| | | @PreAuthorize("@ss.hasPermi('add:insOrder')") |
| | | @PostMapping("/addInsOrder") |
| | | public Result<?> addInsOrder(@RequestBody InsPlaceOrderDto insPlaceOrderDto) { |
| | | return Result.success(insOrderService.addInsOrder(insPlaceOrderDto.getSampleList(), insPlaceOrderDto.getInsOrder())); |
| | |
| | | @GetMapping("/selectOrderManDay") |
| | | public Result<?> selectOrderManDay(Integer id) { |
| | | int day = insProductService.selectOrderManDay(id); |
| | | return Result.success("成功", LocalDateTime.now().plusHours(day).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); |
| | | return Result.success(LocalDateTime.now().plusHours(day).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); |
| | | } |
| | | |
| | | @ApiOperation(value = "查询检验下单内容详情") |
| | |
| | | @ApiImplicitParam(name = "id", value = "检验单id", dataTypeClass = Integer.class), |
| | | @ApiImplicitParam(name = "state", value = "审核结果 1:通过 2:不通过", dataTypeClass = Integer.class) |
| | | }) |
| | | |
| | | @PostMapping("/upInsOrderOfState") |
| | | public Result<?> upInsOrderOfState(@RequestBody InsOrder insOrder) { |
| | | return Result.success(insOrderService.upInsOrderOfState(insOrder)); |
| | |
| | | @ApiOperation(value = "通过检验单模板id获取检验单模板内容") |
| | | @GetMapping("/selectInsOrderTemplateById") |
| | | public Result<?> selectInsOrderTemplateById(Integer id) { |
| | | return Result.success("成功", insOrderTemplateService.selectInsOrderTemplateById(id)); |
| | | return Result.success(insOrderTemplateService.selectInsOrderTemplateById(id)); |
| | | } |
| | | |
| | | @ApiOperation(value = "删除检验单模板") |
| | |
| | | |
| | | @ApiOperation(value = "通过检验单查询检验数据(数据查看)") |
| | | @GetMapping("/selectSampleAndProductByOrderId") |
| | | public Result<?> selectSampleAndProductByOrderId(Page page, SampleProductDto2 sampleProductDto){ |
| | | public Result<?> selectSampleAndProductByOrderId(Page page, SampleProductDto2 sampleProductDto) { |
| | | return Result.success(insOrderService.selectSampleAndProductByOrderId(page, sampleProductDto)); |
| | | } |
| | | |
| | | @ApiOperation(value = "费用统计") |
| | | @GetMapping("/costStatistics") |
| | | public Result<?> costStatistics(Page page, CostStatisticsDto costStatisticsDto){ |
| | | return Result.success(insOrderService.costStatistics(page, costStatisticsDto)); |
| | | } |
| | | |
| | | @ApiOperation(value = "费用统计获取总价") |
| | | @GetMapping("/costStatistics2") |
| | | public Result<?> costStatistics2(CostStatisticsDto costStatisticsDto){ |
| | | return Result.success(insOrderService.costStatistics2(costStatisticsDto)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "样品缺陷指数") |
| | | @GetMapping("/selectSampleDefects") |
| | | public Result selectSampleDefects(Integer size, Integer current, String inspectionItems, String orderNumber) { |
| | | return Result.success(insOrderService.selectSampleDefects(new Page<>(current, size),inspectionItems, orderNumber)); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | //待检的撤销的查询待检项目 |
| | | @GetMapping("/selectNoProducts") |
| | | public Result<?> selectNoProducts(Page page, InsProduct insProduct,Integer orderId ,String ids){ |
| | | return Result.success(insProductService.selectNoProducts(page, insProduct,orderId,ids)); |
| | | public Result<?> selectNoProducts(Page page, InsProduct insProduct, Integer orderId, String ids) { |
| | | return Result.success(insProductService.selectNoProducts(page, insProduct, orderId, ids)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "待检的撤销") |
| | | @PostMapping("/updateInspected") |
| | | public Result<?> updateInspected(@RequestBody Map<String, Object> param){ |
| | | public Result<?> updateInspected(@RequestBody Map<String, Object> param) { |
| | | Integer orderId = (Integer) param.get("orderId"); |
| | | String ids = (String) param.get("ids"); |
| | | Integer typeSource = (Integer) param.get("typeSource"); |
| | | Integer ifsInventoryId = (Integer) param.get("ifsInventoryId"); |
| | | if(Objects.nonNull(typeSource) && typeSource == 1){ |
| | | ifsInventoryQuantityMapper.update(null,new LambdaUpdateWrapper<IfsInventoryQuantity>() |
| | | .set(IfsInventoryQuantity::getState,0) |
| | | .eq(IfsInventoryQuantity::getId,ifsInventoryId)); |
| | | insOrderService.update(null,new LambdaUpdateWrapper<InsOrder>().set(InsOrder::getState,-1).eq(InsOrder::getId,orderId)); // 撤销 |
| | | Long ifsInventoryId = Long.parseLong(param.get("ifsInventoryId").toString()); |
| | | if (Objects.nonNull(typeSource) && typeSource == 1) { |
| | | ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>() |
| | | .set(IfsInventoryQuantity::getState, 0) |
| | | .eq(IfsInventoryQuantity::getId, ifsInventoryId)); |
| | | insOrderService.update(null, new LambdaUpdateWrapper<InsOrder>().set(InsOrder::getState, -1).eq(InsOrder::getId, orderId)); // 撤销 |
| | | } |
| | | insProductService.updateInspected(orderId,ids); |
| | | insProductService.updateInspected(orderId, ids); |
| | | return Result.success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "审核待检撤销") |
| | | @PostMapping("/checkUpdate") |
| | | public Result<?> checkUpdate(@RequestBody Map<String, Object> param){ |
| | | public Result<?> checkUpdate(@RequestBody Map<String, Object> param) { |
| | | Integer orderId = (Integer) param.get("orderId"); |
| | | Integer state = (Integer) param.get("state"); |
| | | insProductService.checkUpdate(orderId,state); |
| | | insProductService.checkUpdate(orderId, state); |
| | | return Result.success(); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "费用统计导出") |
| | | @GetMapping("/export") |
| | | public void export(CostStatisticsDto costStatisticsDto,HttpServletResponse response) throws ServletException, IOException { |
| | | insOrderService.export(costStatisticsDto,response); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "获取ifs订单") |
| | | @GetMapping("/getIfsOrder") |
| | | public Result<?> getIfsOrder() { |
| | | insOrderService.getIfsOrder(); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("LOCATION_NO", "1302;WG-04-001"); |
| | | map.put("STATE_DB", "To be Inspected"); |
| | | insOrderService.getIfsOrder(map, false); |
| | | return Result.success(); |
| | | } |
| | | |
| | |
| | | public Result<?> delInsOrder(Integer insOrderId) { |
| | | // 查询订单 |
| | | InsOrder order = insOrderService.getById(insOrderId); |
| | | if (!order.getState().equals(2)) { |
| | | if (!(order.getState().equals(2) || order.getState().equals(3))) { |
| | | throw new ErrorException("只有退回订单才能删除"); |
| | | } |
| | | |
| | |
| | | return Result.success(insOrderService.labelOrderPrinting(ids)); |
| | | } |
| | | |
| | | @ApiOperation(value = "外购下单成品标签打印") |
| | | @PostMapping("/labelOutsideOrderPrinting") |
| | | public Result<List<InventoryDetailDTO>> labelOutsideOrderPrinting(@RequestBody Map<String, Object> param) { |
| | | List<Integer> ids = (List<Integer>) param.get("ids"); |
| | | return Result.success(insOrderService.labelOutsideOrderPrinting(ids)); |
| | | } |
| | | |
| | | @ApiOperation(value = "根据订单id查询样品") |
| | | @GetMapping("/getSampleByOrderId") |
| | | public Result<List<InsSample>> getSampleByOrderId(Integer insOrderId) { |
| | | return Result.success(insSampleService.list(Wrappers.<InsSample>lambdaQuery() |
| | | .eq(InsSample::getInsOrderId, insOrderId))); |
| | | return Result.success(insSampleService.getSampleByOrderId(insOrderId)); |
| | | } |
| | | |
| | | @ApiOperation(value = "根据样品id查询检验项树") |
| | |
| | | } |
| | | |
| | | @ApiOperation(value = "成品检验单全部信息导出") |
| | | @PostMapping("/rawAllInsOrderExport") |
| | | public void rawAllInsOrderExport(@RequestBody SampleOrderDto sampleOrderDto, HttpServletResponse response){ |
| | | insOrderService.rawAllInsOrderExport(sampleOrderDto,response); |
| | | @GetMapping("/rawAllInsOrderExport") |
| | | public void rawAllInsOrderExport(SampleOrderDto sampleOrderDto, HttpServletResponse response) { |
| | | insOrderService.rawAllInsOrderExport(sampleOrderDto, response); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "修改样品型号") |
| | | @PostMapping("/updateSampleModel") |
| | | public Result<?> updateSampleModel(@RequestBody List<InsSample> insSampleList) { |
| | | for (InsSample insSample : insSampleList) { |
| | | insOrderService.updateSampleModel(insSample); |
| | | } |
| | | return Result.success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "查询当前时间是否没有该检测项的抽样计划") |
| | | @PostMapping("/judgeNotSpotCheckOrder") |
| | | public Result<?> judgeNotSpotCheckOrder(@RequestBody InsPlaceOrderDto insPlaceOrderDto) { |
| | | return insOrderService.judgeNotSpotCheckOrder(insPlaceOrderDto.getSampleList(), insPlaceOrderDto.getInsOrder()); |
| | | } |
| | | |
| | | } |