| | |
| | | <groupId>com.deepoove</groupId> |
| | | <artifactId>poi-tl</artifactId> |
| | | </dependency> |
| | | |
| | | <!--word转pdf--> |
| | | <!--D:\JavaWork\center-lims-after\inspect-server\src\main\resources\lib--> |
| | | <!--mvn install:install-file -Dfile=aspose-words-15.12.0-jdk16.jar -DgroupId=com.aspose -DartifactId=aspose-words -Dversion=15.12.0 -Dpackaging=jar--> |
| | | <dependency> |
| | | <groupId>com.aspose</groupId> |
| | | <artifactId>aspose-words</artifactId> |
| | | <version>15.12.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.itextpdf</groupId> |
| | | <artifactId>itextpdf</artifactId> |
| | | <version>5.0.6</version> |
| | | </dependency> |
| | | |
| | | |
| | | </dependencies> |
| | | |
| | | <properties> |
| | |
| | | //package com.ruoyi.basic.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.mapper.IfsInventoryQuantityMapper; |
| | | //import com.ruoyi.common.core.domain.Result; |
| | | //import com.ruoyi.inspect.dto.OmitOrderProductDto; |
| | | //import com.ruoyi.inspect.dto.SampleOrderDto; |
| | | //import com.ruoyi.inspect.service.InsOrderService; |
| | | //import io.swagger.annotations.Api; |
| | | //import io.swagger.annotations.ApiImplicitParam; |
| | | //import io.swagger.annotations.ApiImplicitParams; |
| | | //import io.swagger.annotations.ApiOperation; |
| | | //import lombok.AllArgsConstructor; |
| | | //import org.springframework.scheduling.annotation.Scheduled; |
| | | //import org.springframework.web.bind.annotation.*; |
| | | // |
| | | //import javax.servlet.http.HttpServletResponse; |
| | | //import java.time.LocalDateTime; |
| | | //import java.time.format.DateTimeFormatter; |
| | | //import java.util.List; |
| | | //import java.util.Map; |
| | | //import java.util.Objects; |
| | | // |
| | | //@RestController |
| | | //@AllArgsConstructor |
| | | //@RequestMapping("/insOrder") |
| | | //@Api(tags="æ£éªå模å") |
| | | //public class InsOrderController { |
| | | // |
| | | // private InsOrderService insOrderService; |
| | | // |
| | | // private InsSampleService insSampleService; |
| | | // |
| | | // private InsProductService insProductService; |
| | | // |
| | | // private IfsInventoryQuantityMapper ifsInventoryQuantityMapper; |
| | | // |
| | | // private InsOrderTemplateService insOrderTemplateService; |
| | | // |
| | | // //è·åæ£éªä¸åæ°æ® |
| | | // @ApiOperation(value = "æ¥è¯¢å使£éªå") |
| | | // @PostMapping("/selectInsOrderParameter") |
| | | // public Result selectInsOrderParameter(@RequestBody Map<String, Object> data) throws Exception { |
| | | // Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class); |
| | | // SampleOrderDto sampleOrderDto = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), SampleOrderDto.class); |
| | | // return Result.success(insOrderService.selectInsOrderParameter(page, sampleOrderDto)); |
| | | // } |
| | | // |
| | | // //ç¨äºæ£éªä¸ååºå«æ¥çææè®¢åååªæ¥çåä¸ä¸ªå§æåä½ç订å |
| | | // @ApiOperation(value = "æ¥è¯¢æææ£éªå") |
| | | // @PostMapping("/selectAllInsOrderParameter") |
| | | // public Result selectAllInsOrderParameter() { |
| | | // return Result.success(); |
| | | // } |
| | | // |
| | | // |
| | | // @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)); |
| | | // } |
| | | // |
| | | // @ApiOperation(value = "æ·»å æ£éªä¸åæ°æ®") |
| | | // @PostMapping("/addInsOrder") |
| | | // public Result<?> addInsOrder(String str) { |
| | | // Map<String, Object> map = JSON.parseObject(str, Map.class); |
| | | // JSONArray jsonArray = JSON.parseArray(map.get("list")+""); |
| | | // List<SampleProductDto> list = jsonArray.toJavaList(SampleProductDto.class); |
| | | // InsOrder insOrder = JSON.parseObject(JSON.toJSONString(map.get("insOrder")), InsOrder.class); |
| | | // List<List<Integer>> pairing = JSON.parseArray(map.get("pairing")+""); |
| | | // return Result.success(insOrderService.addInsOrder(list, insOrder, pairing)); |
| | | // } |
| | | // |
| | | // @ApiOperation(value = "æ¥è¯¢è®¢åæé¿é¢è®¡æ¶é´") |
| | | // @PostMapping("/selectOrderManDay") |
| | | // public Result<?> selectOrderManDay(Integer id) { |
| | | // int day = insProductService.selectOrderManDay(id); |
| | | // return Result.success("æå", LocalDateTime.now().plusHours(day).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); |
| | | // } |
| | | // |
| | | // @ApiOperation(value = "æ¥è¯¢æ£éªä¸åå
容详æ
") |
| | | // @PostMapping("/getInsOrder") |
| | | // public Result<?> getInsOrder(Integer orderId) { |
| | | // return Result.success(insOrderService.getInsOrder(orderId)); |
| | | // } |
| | | // @ValueClassify("æ£éªä¸å") |
| | | // @ApiOperation(value = "å®¡æ ¸æ£éªåè¿è¡ç¶æä¿®æ¹") |
| | | // @ApiImplicitParams({ |
| | | // @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 = "æ·»å æ£éªå模æ¿") |
| | | // @PostMapping("/addInsOrderTemplate") |
| | | // public Result<?> addInsOrderTemplate(@RequestBody InsOrderTemplate insOrderTemplate) { |
| | | // return Result.success(insOrderTemplateService.addInsOrderTemplate(insOrderTemplate)); |
| | | // } |
| | | // |
| | | // @ApiOperation(value = "æ¥è¯¢æ£éªå模æ¿") |
| | | // @GetMapping("/selectInsOrderTemplate") |
| | | // public Result<?> selectInsOrderTemplate(String company) { |
| | | // return Result.success(insOrderTemplateService.selectInsOrderTemplate(company)); |
| | | // } |
| | | // |
| | | // @ApiOperation(value = "éè¿æ£éªå模æ¿idè·åæ£éªå模æ¿å
容") |
| | | // @PostMapping("/selectInsOrderTemplateById") |
| | | // public Result<?> selectInsOrderTemplateById(Integer id) { |
| | | // return Result.success("æå", insOrderTemplateService.selectInsOrderTemplateById(id)); |
| | | // } |
| | | // |
| | | // @ApiOperation(value = "å 餿£éªå模æ¿") |
| | | // @PostMapping("/delInsOrderTemplate") |
| | | // public Result<?> delInsOrderTemplate(Integer id) { |
| | | // return Result.success(insOrderTemplateService.delInsOrderTemplate(id)); |
| | | // } |
| | | // |
| | | // @ApiOperation(value = "éè¿æ£éªåæ¥è¯¢æ£éªæ°æ®ï¼æ°æ®æ¥çï¼") |
| | | // @PostMapping("/selectSampleAndProductByOrderId") |
| | | // public Result<?> selectSampleAndProductByOrderId(@RequestBody Map<String, Object> data) throws Exception { |
| | | // Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class); |
| | | // SampleProductDto2 sampleProductDto = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), SampleProductDto2.class); |
| | | // return Result.success(insOrderService.selectSampleAndProductByOrderId(page, sampleProductDto)); |
| | | // } |
| | | // |
| | | // @ApiOperation(value = "è´¹ç¨ç»è®¡") |
| | | // @PostMapping("/costStatistics") |
| | | // public Result<?> costStatistics(@RequestBody Map<String, Object> data) throws Exception { |
| | | // Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class); |
| | | // CostStatisticsDto costStatisticsDto = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), CostStatisticsDto.class); |
| | | // return Result.success(insOrderService.costStatistics(page, costStatisticsDto)); |
| | | // } |
| | | // |
| | | // @ApiOperation(value = "è´¹ç¨ç»è®¡è·åæ»ä»·") |
| | | // @PostMapping("/costStatistics2") |
| | | // public Result<?> costStatistics2(@RequestBody Map<String, Object> data) throws Exception { |
| | | // CostStatisticsDto costStatisticsDto = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), CostStatisticsDto.class); |
| | | // return Result.success(insOrderService.costStatistics2(costStatisticsDto)); |
| | | // } |
| | | // |
| | | // |
| | | // @ApiOperation(value = "æ ·åç¼ºé·ææ°") |
| | | // @PostMapping("/selectSampleDefects") |
| | | // public Result selectSampleDefects(Integer size, Integer current, String inspectionItems, String orderNumber) { |
| | | // return Result.success(insOrderService.selectSampleDefects(new Page<>(current, size),inspectionItems, orderNumber)); |
| | | // } |
| | | // |
| | | // |
| | | // @ApiOperation(value = "æ¤é") |
| | | // @PutMapping("/updateStatus") |
| | | // public Result<?> updateStatus(Integer id) { |
| | | // insOrderService.updateStatus(id); |
| | | // return Result.success(); |
| | | // } |
| | | // |
| | | // //å¾
æ£çæ¤éçæ¥è¯¢å¾
æ£é¡¹ç® |
| | | // @PostMapping("/selectNoProducts") |
| | | // public Result<?> selectNoProducts(@RequestBody Map<String, Object> data,Integer orderId ,String ids) throws Exception { |
| | | // Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class); |
| | | // InsProduct insProduct = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), InsProduct.class); |
| | | // return Result.success(insProductService.selectNoProducts(page, insProduct,orderId,ids)); |
| | | // } |
| | | // |
| | | // |
| | | // @ApiOperation(value = "å¾
æ£çæ¤é") |
| | | // @PutMapping("/updateInspected") |
| | | // public Result<?> updateInspected(Integer orderId, String ids, |
| | | // @RequestParam(value = "typeSource",required = false) Integer typeSource, |
| | | // @RequestParam(value = "ifsInventoryId",required = false) Integer 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)); // æ¤é |
| | | // } |
| | | // insProductService.updateInspected(orderId,ids); |
| | | // return Result.success(); |
| | | // } |
| | | // |
| | | // @ApiOperation(value = "å®¡æ ¸å¾
æ£æ¤é") |
| | | // @PostMapping("/checkUpdate") |
| | | // public Result<?> checkUpdate(Integer orderId,Integer state){ |
| | | // insProductService.checkUpdate(orderId,state); |
| | | // return Result.success(); |
| | | // } |
| | | // |
| | | // @ApiOperation(value = "æ ç¾æå°") |
| | | // @PostMapping("/labelPrinting") |
| | | // public Result<?> labelPrinting(String ids) { |
| | | // return Result.success(insOrderService.labelPrinting(ids)); |
| | | // } |
| | | // |
| | | // |
| | | // @ApiOperation(value = "è´¹ç¨ç»è®¡å¯¼åº") |
| | | // @PostMapping("/export") |
| | | // public void export(@RequestBody Map<String, Object> data,HttpServletResponse response) throws Exception { |
| | | // CostStatisticsDto costStatisticsDto = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), CostStatisticsDto.class); |
| | | // insOrderService.export(costStatisticsDto,response); |
| | | // } |
| | | // |
| | | // |
| | | // @ApiOperation(value = "è·åifs订å") |
| | | // @PostMapping("/getIfsOrder") |
| | | // public Result<?> getIfsOrder() { |
| | | // insOrderService.getIfsOrder(); |
| | | // return Result.success(); |
| | | // } |
| | | // |
| | | // @Scheduled(fixedDelay = 1200000) |
| | | // public void getIfsOrderTiming() { |
| | | // insOrderService.getIfsOrder(); |
| | | // } |
| | | // |
| | | // |
| | | // @ApiOperation(value = "ä¿®æ¹è®¢ååå·") |
| | | // @PostMapping("/updateEntrustCode") |
| | | // public Result<?> updateEntrustCode(@RequestBody InsOrder insOrder) { |
| | | // insOrderService.updateEntrustCode(insOrder); |
| | | // return Result.success(); |
| | | // } |
| | | // |
| | | // @ApiOperation("æ¥è¯¢ä¸åæ ¼å¤æµä¿¡æ¯") |
| | | // @GetMapping("/getRetestResult") |
| | | // public Result<?> getRetestResult(Integer insProductId) { |
| | | // return Result.success(insOrderService.getRetestResult(insProductId)); |
| | | // } |
| | | // |
| | | // |
| | | // |
| | | // @ApiOperation(value = "éåä¸ä¸å") |
| | | // @PostMapping("/addRawCopperOrder") |
| | | // public Result<?> addRawCopperOrder(String str) { |
| | | // Map<String, Object> map = JSON.parseObject(str, Map.class); |
| | | // JSONArray jsonArray = JSON.parseArray(map.get("list")+""); |
| | | // List<SampleProductDto> list = jsonArray.toJavaList(SampleProductDto.class); |
| | | // CopperInsOrderDto CopperInsOrder = JSON.parseObject(JSON.toJSONString(map.get("insOrder")), CopperInsOrderDto.class); |
| | | // return Result.success(insOrderService.addRawCopperOrder(list, CopperInsOrder)); |
| | | // } |
| | | // |
| | | // |
| | | // @ApiOperation(value = "ä¿®æ¹å§æç¼å·") |
| | | // @PostMapping("/updateOrderEntrustCode") |
| | | // public Result<?> updateOrderEntrustCode(@RequestBody InsOrder insOrder) { |
| | | // insOrderService.updateOrderEntrustCode(insOrder); |
| | | // return Result.success(); |
| | | // } |
| | | // |
| | | // @ApiOperation(value = "ä¿®æ¹æ£éªä¸åå
容") |
| | | // @PostMapping("/updateInsOrder") |
| | | // public Result<?> updateInsOrder(@RequestBody InsOrderUpdateDto insOrderUpdateDto) { |
| | | // return Result.success(insOrderService.updateInsOrder(insOrderUpdateDto)); |
| | | // } |
| | | // |
| | | // @ApiOperation(value = "å é¤éå订å") |
| | | // @GetMapping("/delInsOrder") |
| | | // public Result<?> delInsOrder(Integer insOrderId) { |
| | | // // æ¥è¯¢è®¢å |
| | | // InsOrder order = insOrderService.getById(insOrderId); |
| | | // if (!order.getState().equals(2)) { |
| | | // throw new ErrorException("åªæéå订åæè½å é¤"); |
| | | // } |
| | | // |
| | | // return Result.success(insOrderService.removeById(insOrderId)); |
| | | // } |
| | | // |
| | | // @ApiOperation(value = "æåæ ç¾æå°") |
| | | // @PostMapping("/labelOrderPrinting") |
| | | // public Result<List<InsOrderPrintingVo>> labelOrderPrinting(@RequestBody Map<String, Object> param) { |
| | | // List<Integer> ids = (List<Integer>) param.get("ids"); |
| | | // return Result.success(insOrderService.labelOrderPrinting(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))); |
| | | // } |
| | | // |
| | | // @ApiOperation(value = "æ ¹æ®æ ·åidæ¥è¯¢æ£éªé¡¹æ ") |
| | | // @GetMapping("/getProductTreeBySampleId") |
| | | // public Result<List<StandardProductList>> getProductTreeBySampleId(Integer insSampleId) { |
| | | // return Result.success(insOrderService.getProductTreeBySampleId(insSampleId)); |
| | | // } |
| | | // |
| | | // |
| | | // @ApiOperation(value = "æ·»å éæ¼çæ£éªé¡¹") |
| | | // @PostMapping("/addOmitOrderProduct") |
| | | // public Result addOmitOrderProduct(@RequestBody OmitOrderProductDto omitOrderProductDto) { |
| | | // return Result.success(insOrderService.addOmitOrderProduct(omitOrderProductDto)); |
| | | // } |
| | | // |
| | | // @ApiOperation(value = "æåæ£éªåå
¨é¨ä¿¡æ¯å¯¼åº") |
| | | // @PostMapping("/rawAllInsOrderExport") |
| | | // public void rawAllInsOrderExport(@RequestBody SampleOrderDto sampleOrderDto, HttpServletResponse response){ |
| | | // insOrderService.rawAllInsOrderExport(sampleOrderDto,response); |
| | | // } |
| | | // |
| | | //} |
| | | package com.ruoyi.basic.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.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 com.ruoyi.inspect.pojo.InsOrderTemplate; |
| | | import com.ruoyi.inspect.pojo.InsProduct; |
| | | import com.ruoyi.inspect.pojo.InsSample; |
| | | import com.ruoyi.inspect.service.InsOrderService; |
| | | import com.ruoyi.inspect.service.InsOrderTemplateService; |
| | | import com.ruoyi.inspect.service.InsProductService; |
| | | import com.ruoyi.inspect.service.InsSampleService; |
| | | import com.ruoyi.inspect.vo.InsOrderPrintingVo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | 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.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @RequestMapping("/insOrder") |
| | | @Api(tags="æ£éªå模å") |
| | | public class InsOrderController { |
| | | |
| | | private InsOrderService insOrderService; |
| | | |
| | | private InsSampleService insSampleService; |
| | | |
| | | private InsProductService insProductService; |
| | | |
| | | private IfsInventoryQuantityMapper ifsInventoryQuantityMapper; |
| | | |
| | | private InsOrderTemplateService insOrderTemplateService; |
| | | |
| | | //è·åæ£éªä¸åæ°æ® |
| | | @ApiOperation(value = "æ¥è¯¢å使£éªå") |
| | | @GetMapping("/selectInsOrderParameter") |
| | | public Result selectInsOrderParameter(Page page, SampleOrderDto sampleOrderDto) throws Exception { |
| | | return Result.success(insOrderService.selectInsOrderParameter(page, sampleOrderDto)); |
| | | } |
| | | |
| | | //ç¨äºæ£éªä¸ååºå«æ¥çææè®¢åååªæ¥çåä¸ä¸ªå§æåä½ç订å |
| | | @ApiOperation(value = "æ¥è¯¢æææ£éªå") |
| | | @GetMapping("/selectAllInsOrderParameter") |
| | | public Result selectAllInsOrderParameter() { |
| | | return Result.success(); |
| | | } |
| | | |
| | | |
| | | @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)); |
| | | } |
| | | |
| | | //todo: ä¸åéè¦ä¿®æ¹ |
| | | @ApiOperation(value = "æ·»å æ£éªä¸åæ°æ®") |
| | | @PostMapping("/addInsOrder") |
| | | public Result<?> addInsOrder(String str) { |
| | | Map<String, Object> map = JSON.parseObject(str, Map.class); |
| | | JSONArray jsonArray = JSON.parseArray(map.get("list")+""); |
| | | List<SampleProductDto> list = jsonArray.toJavaList(SampleProductDto.class); |
| | | InsOrder insOrder = JSON.parseObject(JSON.toJSONString(map.get("insOrder")), InsOrder.class); |
| | | List<List<Integer>> pairing = JSON.parseArray(map.get("pairing")+""); |
| | | return Result.success(insOrderService.addInsOrder(list, insOrder, pairing)); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ¥è¯¢è®¢åæé¿é¢è®¡æ¶é´") |
| | | @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"))); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ¥è¯¢æ£éªä¸åå
容详æ
") |
| | | @GetMapping("/getInsOrder") |
| | | public Result<?> getInsOrder(Integer orderId) { |
| | | return Result.success(insOrderService.getInsOrder(orderId)); |
| | | } |
| | | |
| | | @ApiOperation(value = "å®¡æ ¸æ£éªåè¿è¡ç¶æä¿®æ¹") |
| | | @ApiImplicitParams({ |
| | | @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 = "æ·»å æ£éªå模æ¿") |
| | | @PostMapping("/addInsOrderTemplate") |
| | | public Result<?> addInsOrderTemplate(@RequestBody InsOrderTemplate insOrderTemplate) { |
| | | return Result.success(insOrderTemplateService.addInsOrderTemplate(insOrderTemplate)); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ¥è¯¢æ£éªå模æ¿") |
| | | @GetMapping("/selectInsOrderTemplate") |
| | | public Result<?> selectInsOrderTemplate(String company) { |
| | | return Result.success(insOrderTemplateService.selectInsOrderTemplate(company)); |
| | | } |
| | | |
| | | @ApiOperation(value = "éè¿æ£éªå模æ¿idè·åæ£éªå模æ¿å
容") |
| | | @GetMapping("/selectInsOrderTemplateById") |
| | | public Result<?> selectInsOrderTemplateById(Integer id) { |
| | | return Result.success("æå", insOrderTemplateService.selectInsOrderTemplateById(id)); |
| | | } |
| | | |
| | | @ApiOperation(value = "å 餿£éªå模æ¿") |
| | | @DeleteMapping("/delInsOrderTemplate") |
| | | public Result<?> delInsOrderTemplate(Integer id) { |
| | | return Result.success(insOrderTemplateService.delInsOrderTemplate(id)); |
| | | } |
| | | |
| | | @ApiOperation(value = "éè¿æ£éªåæ¥è¯¢æ£éªæ°æ®ï¼æ°æ®æ¥çï¼") |
| | | @GetMapping("/selectSampleAndProductByOrderId") |
| | | 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)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "æ¤é") |
| | | @PostMapping("/updateStatus") |
| | | public Result<?> updateStatus(@RequestBody Map<String, Object> param) { |
| | | Integer id = (Integer) param.get("id"); |
| | | insOrderService.updateStatus(id); |
| | | return Result.success(); |
| | | } |
| | | |
| | | //å¾
æ£çæ¤éçæ¥è¯¢å¾
æ£é¡¹ç® |
| | | @GetMapping("/selectNoProducts") |
| | | 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){ |
| | | 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)); // æ¤é |
| | | } |
| | | insProductService.updateInspected(orderId,ids); |
| | | return Result.success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "å®¡æ ¸å¾
æ£æ¤é") |
| | | @PostMapping("/checkUpdate") |
| | | public Result<?> checkUpdate(@RequestBody Map<String, Object> param){ |
| | | Integer orderId = (Integer) param.get("orderId"); |
| | | Integer state = (Integer) param.get("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(); |
| | | return Result.success(); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1200000) |
| | | public void getIfsOrderTiming() { |
| | | insOrderService.getIfsOrder(); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "ä¿®æ¹è®¢ååå·") |
| | | @PostMapping("/updateEntrustCode") |
| | | public Result<?> updateEntrustCode(@RequestBody InsOrder insOrder) { |
| | | insOrderService.updateEntrustCode(insOrder); |
| | | return Result.success(); |
| | | } |
| | | |
| | | @ApiOperation("æ¥è¯¢ä¸åæ ¼å¤æµä¿¡æ¯") |
| | | @GetMapping("/getRetestResult") |
| | | public Result<?> getRetestResult(Integer insProductId) { |
| | | return Result.success(insOrderService.getRetestResult(insProductId)); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "éåä¸ä¸å") |
| | | @PostMapping("/addRawCopperOrder") |
| | | public Result<?> addRawCopperOrder(String str) { |
| | | Map<String, Object> map = JSON.parseObject(str, Map.class); |
| | | JSONArray jsonArray = JSON.parseArray(map.get("list")+""); |
| | | List<SampleProductDto> list = jsonArray.toJavaList(SampleProductDto.class); |
| | | CopperInsOrderDto CopperInsOrder = JSON.parseObject(JSON.toJSONString(map.get("insOrder")), CopperInsOrderDto.class); |
| | | return Result.success(insOrderService.addRawCopperOrder(list, CopperInsOrder)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "ä¿®æ¹å§æç¼å·") |
| | | @PostMapping("/updateOrderEntrustCode") |
| | | public Result<?> updateOrderEntrustCode(@RequestBody InsOrder insOrder) { |
| | | insOrderService.updateOrderEntrustCode(insOrder); |
| | | return Result.success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "ä¿®æ¹æ£éªä¸åå
容") |
| | | @PostMapping("/updateInsOrder") |
| | | public Result<?> updateInsOrder(@RequestBody InsOrderUpdateDto insOrderUpdateDto) { |
| | | return Result.success(insOrderService.updateInsOrder(insOrderUpdateDto)); |
| | | } |
| | | |
| | | @ApiOperation(value = "å é¤éå订å") |
| | | @GetMapping("/delInsOrder") |
| | | public Result<?> delInsOrder(Integer insOrderId) { |
| | | // æ¥è¯¢è®¢å |
| | | InsOrder order = insOrderService.getById(insOrderId); |
| | | if (!order.getState().equals(2)) { |
| | | throw new ErrorException("åªæéå订åæè½å é¤"); |
| | | } |
| | | |
| | | return Result.success(insOrderService.removeById(insOrderId)); |
| | | } |
| | | |
| | | @ApiOperation(value = "æåæ ç¾æå°") |
| | | @PostMapping("/labelOrderPrinting") |
| | | public Result<List<InsOrderPrintingVo>> labelOrderPrinting(@RequestBody Map<String, Object> param) { |
| | | List<Integer> ids = (List<Integer>) param.get("ids"); |
| | | return Result.success(insOrderService.labelOrderPrinting(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))); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ ¹æ®æ ·åidæ¥è¯¢æ£éªé¡¹æ ") |
| | | @GetMapping("/getProductTreeBySampleId") |
| | | public Result<List<StandardProductList>> getProductTreeBySampleId(Integer insSampleId) { |
| | | return Result.success(insOrderService.getProductTreeBySampleId(insSampleId)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "æ·»å éæ¼çæ£éªé¡¹") |
| | | @PostMapping("/addOmitOrderProduct") |
| | | public Result addOmitOrderProduct(@RequestBody OmitOrderProductDto omitOrderProductDto) { |
| | | return Result.success(insOrderService.addOmitOrderProduct(omitOrderProductDto)); |
| | | } |
| | | |
| | | @ApiOperation(value = "æåæ£éªåå
¨é¨ä¿¡æ¯å¯¼åº") |
| | | @PostMapping("/rawAllInsOrderExport") |
| | | public void rawAllInsOrderExport(@RequestBody SampleOrderDto sampleOrderDto, HttpServletResponse response){ |
| | | insOrderService.rawAllInsOrderExport(sampleOrderDto,response); |
| | | } |
| | | |
| | | } |
| | |
| | | //package com.ruoyi.inspect.controller; |
| | | // |
| | | //import com.alibaba.fastjson.JSON; |
| | | //import com.alibaba.fastjson.JSONArray; |
| | | //import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | //import com.ruoyi.basic.dto.*; |
| | | //import com.ruoyi.basic.pojo.IfsInventoryQuantity; |
| | | //import com.ruoyi.inspect.dto.SampleProductDto; |
| | | //import com.ruoyi.inspect.pojo.InsOrder; |
| | | //import com.ruoyi.inspect.pojo.RawMaterialOrderTemplate; |
| | | //import com.ruoyi.inspect.service.RawMaterialOrderService; |
| | | //import com.ruoyi.inspect.service.RawMaterialOrderTemplateService; |
| | | //import com.ruoyi.common.core.domain.Result; |
| | | //import com.ruoyi.common.utils.JackSonUtil; |
| | | //import com.ruoyi.common.utils.WxCpUtils; |
| | | //import com.ruoyi.inspect.dto.CopperInsOrderDto; |
| | | //import io.swagger.annotations.Api; |
| | | //import io.swagger.annotations.ApiOperation; |
| | | //import lombok.AllArgsConstructor; |
| | | //import org.springframework.web.bind.annotation.*; |
| | | // |
| | | //import javax.servlet.http.HttpServletResponse; |
| | | //import java.io.File; |
| | | //import java.util.List; |
| | | //import java.util.Map; |
| | | // |
| | | ///** |
| | | // * @Author zhuo |
| | | // * @Date 2024/7/31 |
| | | // */ |
| | | //@RequestMapping("/rawMaterialOrder") |
| | | //@RestController |
| | | //@AllArgsConstructor |
| | | //@Api(tags = "åææä¸å") |
| | | //public class RawMaterialOrderController { |
| | | // |
| | | // private RawMaterialOrderService rawMaterialOrderService; |
| | | // private RawMaterialOrderTemplateService rawMaterialOrderTemplateService; |
| | | // |
| | | // @ApiOperation(value = "æ´å
·é¶ä»¶å·è·åæ åæ ") |
| | | // @GetMapping("/selectStandardTreeListByPartNo") |
| | | // public Result selectStandardTreeListByPartNo(String partNo) { |
| | | // return Result.success(rawMaterialOrderService.selectStandardTreeListByPartNo(partNo)); |
| | | // } |
| | | // |
| | | // @ApiOperation(value = "åæææ£éªæ¥è¯¢ä»£ä¸å") |
| | | // @GetMapping("/getPurchaseOrder") |
| | | // public Result getPurchaseOrder(Page page, IfsInventoryQuantityCheckDto ifsInventoryQuantity){ |
| | | // return Result.success(rawMaterialOrderService.selectIfsInventoryQuantity(page, ifsInventoryQuantity)); |
| | | // } |
| | | // |
| | | // @ApiOperation(value = "åæææ£éªæ¥è¯¢æ£éªä¸") |
| | | // @GetMapping("/getIfsByStateOne") |
| | | // public Result getIfsByStateOne(Page page, IfsInventoryQuantityDto ifsInventoryQuantityDto) throws Exception { |
| | | // return Result.success(rawMaterialOrderService.getIfsByStateOne(page, ifsInventoryQuantityDto)); |
| | | // } |
| | | // |
| | | // @ApiOperation(value = "åæææ£éªæ¥è¯¢å·²æ£éª") |
| | | // @GetMapping("/getIfsByOver") |
| | | // public Result getIfsByOver(Page page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto) throws Exception { |
| | | // return Result.success(rawMaterialOrderService.getIfsByOver(page, ifsInventoryQuantityDto)); |
| | | // } |
| | | // |
| | | // @ApiOperation(value = "æ·»å åæææ£éªå模æ¿") |
| | | // @PostMapping("/addRawMaterOrderTemplate") |
| | | // public Result<?> addRawMaterOrderTemplate(@RequestBody RawMaterialOrderTemplate rawMaterialOrderTemplate) { |
| | | // return Result.success(rawMaterialOrderTemplateService.addRawMaterOrderTemplate(rawMaterialOrderTemplate)); |
| | | // } |
| | | // @ApiOperation(value = "æ¥è¯¢åæææ£éªå模æ¿å表") |
| | | // @GetMapping("/selectRawMaterOrderTemplate") |
| | | // public Result<?> selectRawMaterOrderTemplate(String partNo) { |
| | | // return Result.success(rawMaterialOrderTemplateService.selectRawMaterOrderTemplate(partNo)); |
| | | // } |
| | | // |
| | | // @ApiOperation(value = "éè¿åæææ£éªå模æ¿idè·åæ£éªå模æ¿å
容") |
| | | // @GetMapping("/selectRawMaterOrderTemplateById") |
| | | // public Result<?> selectRawMaterOrderTemplateById(Integer id) { |
| | | // return Result.success("æå", rawMaterialOrderTemplateService.selectRawMaterOrderTemplateById(id)); |
| | | // } |
| | | // |
| | | // @ApiOperation(value = "å é¤åæææ£éªå模æ¿") |
| | | // @PostMapping("/delRawMaterOrderTemplate") |
| | | // public Result<?> delRawMaterOrderTemplate(Integer id) { |
| | | // return Result.success(rawMaterialOrderTemplateService.delRawMaterOrderTemplate(id)); |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * æ¥æ£æ¹é |
| | | // * @param param åææid |
| | | // * @return |
| | | // */ |
| | | // @ApiOperation(value = "æ¥æ£æ¹é") |
| | | // @PostMapping("/inspectionReport") |
| | | // public Result<?> inspectionReport(@RequestBody Map<String, Object> param) { |
| | | // List<Integer> ids = (List<Integer>) param.get("ids"); |
| | | // return Result.success(rawMaterialOrderService.inspectionReport(ids)); |
| | | // } |
| | | // |
| | | // /** |
| | | // * åæ¶æ¥æ£ |
| | | // * @param id åææä¸å |
| | | // * @return |
| | | // */ |
| | | // @ApiOperation(value = "æ¤éæ¥æ£") |
| | | // @PostMapping("/revokeInspectionReport") |
| | | // public Result<?> revokeInspectionReport(Integer id) { |
| | | // return Result.success(rawMaterialOrderService.revokeInspectionReport(id)); |
| | | // } |
| | | // |
| | | // /** |
| | | // * æå°æ ç¾æ¥è¯¢ |
| | | // * @param param åææid |
| | | // * @return |
| | | // */ |
| | | // @ApiOperation(value = "æå°æ ç¾æ¥è¯¢") |
| | | // @PostMapping("/printLabel") |
| | | // public Result<?> printLabel(@RequestBody Map<String, Object> param) { |
| | | // List<Integer> ids = (List<Integer>) param.get("ids"); |
| | | // return Result.success(rawMaterialOrderService.printLabel(ids)); |
| | | // } |
| | | // |
| | | // /** |
| | | // * æ¥æ£ |
| | | // * @param ifsInventoryQuantity åææ |
| | | // * @return |
| | | // */ |
| | | // @ApiOperation(value = "æ¥æ£") |
| | | // @PostMapping("/inspectionReportOne") |
| | | // public Result<?> inspectionReportOne(@RequestBody IfsInventoryQuantity ifsInventoryQuantity) { |
| | | // |
| | | // return Result.success(rawMaterialOrderService.inspectionReportOne(ifsInventoryQuantity)); |
| | | // } |
| | | // |
| | | // /** |
| | | // * è·åé产ä¸é¾æ£æµæ°æ® |
| | | // * @param id åææid |
| | | // * @return |
| | | // */ |
| | | // @ApiOperation(value = "è·åé产ä¸é¾æ£æµæ°æ®") |
| | | // @GetMapping("/getIndustryChain") |
| | | // public Result<?> getIndustryChain(Integer id) { |
| | | // return Result.success("æå", rawMaterialOrderService.getIndustryChain(id)); |
| | | // } |
| | | // |
| | | // /** |
| | | // * åæææ¤é |
| | | // * @param ifsInventoryId |
| | | // * @return |
| | | // */ |
| | | // @ApiOperation(value = "åæææ¤éä¸å") |
| | | // @PutMapping("/repealRawOrder") |
| | | // public Result<?> repealRawOrder(Integer ifsInventoryId){ |
| | | // return Result.success(rawMaterialOrderService.repealRawOrder(ifsInventoryId)); |
| | | // } |
| | | // |
| | | // |
| | | // @ApiOperation(value = "åææä¸åå
æ£") |
| | | // @PostMapping("/addExemptionOrder") |
| | | // public Result<?> addExemptionOrder(String str) { |
| | | // Map<String, Object> map = JSON.parseObject(str, Map.class); |
| | | // JSONArray jsonArray = JSON.parseArray(map.get("list")+""); |
| | | // List<SampleProductDto> list = jsonArray.toJavaList(SampleProductDto.class); |
| | | // InsOrder insOrder = JSON.parseObject(JSON.toJSONString(map.get("insOrder")), InsOrder.class); |
| | | // return Result.success(rawMaterialOrderService.addExemptionOrder(list, insOrder)); |
| | | // } |
| | | // |
| | | // |
| | | // @ApiOperation(value = "ä»åºæ¥æ£æ¥è¯¢") |
| | | // @PostMapping("/getWarehouseSubmit") |
| | | // public Result getWarehouseSubmit(Page page, IfsInventoryQuantity ifsInventoryQuantity) throws Exception { |
| | | // return Result.success(rawMaterialOrderService.getWarehouseSubmit(page, ifsInventoryQuantity)); |
| | | // } |
| | | // |
| | | // /** |
| | | // * åæ¶æ¥æ£ |
| | | // * @param id åææä¸å |
| | | // * @return |
| | | // */ |
| | | // @ApiOperation(value = "å é¤åæææ¥æ£ä¿¡æ¯") |
| | | // @PostMapping("/delIfsInventory") |
| | | // public Result<?> delIfsInventory(Integer id) { |
| | | // return Result.success(rawMaterialOrderService.delIfsInventory(id)); |
| | | // } |
| | | // |
| | | // /** |
| | | // * åææä¸åæ¾è¡ |
| | | // * @param param |
| | | // * @return |
| | | // */ |
| | | // @ApiOperation(value = "åææä¸åæ¾è¡å
æ£") |
| | | // @PostMapping("/rawOrderRelease") |
| | | // public Result<?> rawOrderRelease(@RequestBody Map<String, Object> param){ |
| | | // Integer ifsInventoryId = (Integer) param.get("ifsInventoryId"); |
| | | // String partDetail = (String) param.get("partDetail"); |
| | | // return Result.success(rawMaterialOrderService.rawOrderRelease(ifsInventoryId, partDetail)); |
| | | // } |
| | | // |
| | | // /** |
| | | // * åææä¸åéç¥å
æ£æè
夿¬¡æ£éª |
| | | // * @param ifsInventoryId |
| | | // * @return |
| | | // */ |
| | | // @ApiOperation(value = "åææä¸åéç¥å
æ£æè
夿¬¡æ£éª") |
| | | // @GetMapping("/notificationRawOrder") |
| | | // public Result<?> notificationRawOrder(Integer ifsInventoryId){ |
| | | // return Result.success(rawMaterialOrderService.notificationRawOrder(ifsInventoryId)); |
| | | // } |
| | | // |
| | | // |
| | | // @ApiOperation(value = "åæææ¥æ£æ¥è¯¢å
¨é¨") |
| | | // @PostMapping("/getIfsByAll") |
| | | // public Result getIfsByAll(@RequestBody Map<String, Object> data) throws Exception { |
| | | // Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class); |
| | | // IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), IfsInventoryQuantitySupplierDto.class); |
| | | // return Result.success(rawMaterialOrderService.getIfsByOver(page, ifsInventoryQuantityDto)); |
| | | // } |
| | | // |
| | | // |
| | | // @ApiOperation(value = "æ°å¢åæææ¥æ£ä¿¡æ¯") |
| | | // @PostMapping("/addIfsInventoryQuantity") |
| | | // public Result addIfsInventoryQuantity(@RequestBody IfsInventoryQuantity ifsInventoryQuantity) { |
| | | // rawMaterialOrderService.addIfsInventoryQuantity(ifsInventoryQuantity); |
| | | // return Result.success(); |
| | | // } |
| | | // |
| | | // @ApiOperation(value = "åææä¸åæ¥çå·²å®æä¿¡æ¯") |
| | | // @PostMapping("/getIfsByFinish") |
| | | // public Result getIfsByFinish(@RequestBody Map<String, Object> data) throws Exception { |
| | | // Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class); |
| | | // IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), IfsInventoryQuantitySupplierDto.class); |
| | | // ifsInventoryQuantityDto.setIsFinish(1); |
| | | // return Result.success(rawMaterialOrderService.getIfsByOver(page, ifsInventoryQuantityDto)); |
| | | // } |
| | | // |
| | | // @ApiOperation(value = "æµè¯ç§»åº") |
| | | // @PostMapping("/shiftingParking") |
| | | // public Result shiftingParking(@RequestBody List<Integer> ids){ |
| | | // rawMaterialOrderService.shiftingParking(ids); |
| | | // return Result.success(); |
| | | // } |
| | | // |
| | | // @ApiOperation(value = "微信åéæä»¶æµè¯") |
| | | // @GetMapping("/wxSend") |
| | | // public Result wxSend(String user, String content, String filePath) throws Exception { |
| | | // WxCpUtils.inform(user, content, new File(filePath)); |
| | | // return Result.success(); |
| | | // } |
| | | // |
| | | // @ApiOperation(value = "éåä¸ä¸åå
æ£") |
| | | // @PostMapping("/addRawCopperOrderExemptionOrder") |
| | | // public Result<?> addRawCopperOrderExemptionOrder(String str) { |
| | | // Map<String, Object> map = JSON.parseObject(str, Map.class); |
| | | // JSONArray jsonArray = JSON.parseArray(map.get("list")+""); |
| | | // List<SampleProductDto> list = jsonArray.toJavaList(SampleProductDto.class); |
| | | // CopperInsOrderDto CopperInsOrder = JSON.parseObject(JSON.toJSONString(map.get("insOrder")), CopperInsOrderDto.class); |
| | | // return Result.success(rawMaterialOrderService.addRawCopperOrderExemptionOrder(list, CopperInsOrder)); |
| | | // } |
| | | // |
| | | // /** |
| | | // * è®©æ¥æ¾è¡ |
| | | // * @param ifsInventoryId |
| | | // * @return |
| | | // */ |
| | | // @ApiOperation(value = "è®©æ¥æ¾è¡") |
| | | // @PostMapping("/concessionRelease") |
| | | // public Result<?> concessionRelease(Integer ifsInventoryId){ |
| | | // return Result.success(rawMaterialOrderService.concessionRelease(ifsInventoryId)); |
| | | // } |
| | | // |
| | | // /** |
| | | // * åææè¿åæ¤éä¸å |
| | | // * @param enterOrderId |
| | | // * @return |
| | | // */ |
| | | // @ApiOperation(value = "åææè¿åæ¤éä¸å") |
| | | // @PostMapping("/repealEnterRawOrder") |
| | | // public Result<?> repealEnterRawOrder(Integer enterOrderId){ |
| | | // return Result.success(rawMaterialOrderService.repealEnterRawOrder(enterOrderId)); |
| | | // } |
| | | // |
| | | // /** |
| | | // * åææå£åº¦æ¤éä¸å |
| | | // * @param quarterOrderId |
| | | // * @return |
| | | // */ |
| | | // @ApiOperation(value = "åææå£åº¦æ¤éä¸å") |
| | | // @PostMapping("/repealQuarterRawOrder") |
| | | // public Result<?> repealQuarterRawOrder(Integer quarterOrderId){ |
| | | // return Result.success(rawMaterialOrderService.repealQuarterRawOrder(quarterOrderId)); |
| | | // } |
| | | // |
| | | // @ApiOperation(value = "å
¨é¨ä¿¡æ¯å¯¼åº") |
| | | // @PostMapping("/rawAllExport") |
| | | // public void rawAllExport(@RequestBody Map<String, Object> data, HttpServletResponse response) throws Exception { |
| | | // IfsInventoryQuantitySupplierDto dto = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), IfsInventoryQuantitySupplierDto.class); |
| | | // rawMaterialOrderService.rawAllExport(dto,response); |
| | | // } |
| | | // |
| | | // @ApiOperation(value = "åæææ£éªæ¥è¯¢å£åº¦æ£éª") |
| | | // @GetMapping("/getIfsByQuarter") |
| | | // public Result getIfsByQuarter(Page page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto){ |
| | | // return Result.success(rawMaterialOrderService.getIfsByQuarter(page, ifsInventoryQuantityDto)); |
| | | // } |
| | | // |
| | | // /** |
| | | // * æåå
¥åº |
| | | // * @param ifsInventoryId |
| | | // * @return |
| | | // */ |
| | | // @ApiOperation(value = "æåå
¥åº") |
| | | // @PostMapping("/advancedGodown") |
| | | // public Result<?> advancedGodown(Integer ifsInventoryId){ |
| | | // return Result.success(rawMaterialOrderService.advancedGodown(ifsInventoryId)); |
| | | // } |
| | | // |
| | | //} |
| | | package com.ruoyi.inspect.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.dto.*; |
| | | import com.ruoyi.basic.pojo.IfsInventoryQuantity; |
| | | import com.ruoyi.inspect.dto.SampleProductDto; |
| | | import com.ruoyi.inspect.pojo.InsOrder; |
| | | import com.ruoyi.inspect.pojo.RawMaterialOrderTemplate; |
| | | import com.ruoyi.inspect.service.RawMaterialOrderService; |
| | | import com.ruoyi.inspect.service.RawMaterialOrderTemplateService; |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.common.utils.JackSonUtil; |
| | | import com.ruoyi.common.utils.WxCpUtils; |
| | | import com.ruoyi.inspect.dto.CopperInsOrderDto; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.File; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Author zhuo |
| | | * @Date 2024/7/31 |
| | | */ |
| | | @RequestMapping("/rawMaterialOrder") |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @Api(tags = "åææä¸å") |
| | | public class RawMaterialOrderController { |
| | | |
| | | private RawMaterialOrderService rawMaterialOrderService; |
| | | private RawMaterialOrderTemplateService rawMaterialOrderTemplateService; |
| | | |
| | | @ApiOperation(value = "æ´å
·é¶ä»¶å·è·åæ åæ ") |
| | | @GetMapping("/selectStandardTreeListByPartNo") |
| | | public Result selectStandardTreeListByPartNo(String partNo) { |
| | | return Result.success(rawMaterialOrderService.selectStandardTreeListByPartNo(partNo)); |
| | | } |
| | | |
| | | @ApiOperation(value = "åæææ£éªæ¥è¯¢ä»£ä¸å") |
| | | @GetMapping("/getPurchaseOrder") |
| | | public Result getPurchaseOrder(Page page, IfsInventoryQuantityCheckDto ifsInventoryQuantity){ |
| | | return Result.success(rawMaterialOrderService.selectIfsInventoryQuantity(page, ifsInventoryQuantity)); |
| | | } |
| | | |
| | | @ApiOperation(value = "åæææ£éªæ¥è¯¢æ£éªä¸") |
| | | @GetMapping("/getIfsByStateOne") |
| | | public Result getIfsByStateOne(Page page, IfsInventoryQuantityDto ifsInventoryQuantityDto){ |
| | | return Result.success(rawMaterialOrderService.getIfsByStateOne(page, ifsInventoryQuantityDto)); |
| | | } |
| | | |
| | | @ApiOperation(value = "åæææ£éªæ¥è¯¢å·²æ£éª") |
| | | @GetMapping("/getIfsByOver") |
| | | public Result getIfsByOver(Page page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto){ |
| | | return Result.success(rawMaterialOrderService.getIfsByOver(page, ifsInventoryQuantityDto)); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ·»å åæææ£éªå模æ¿") |
| | | @PostMapping("/addRawMaterOrderTemplate") |
| | | public Result<?> addRawMaterOrderTemplate(@RequestBody RawMaterialOrderTemplate rawMaterialOrderTemplate) { |
| | | return Result.success(rawMaterialOrderTemplateService.addRawMaterOrderTemplate(rawMaterialOrderTemplate)); |
| | | } |
| | | @ApiOperation(value = "æ¥è¯¢åæææ£éªå模æ¿å表") |
| | | @GetMapping("/selectRawMaterOrderTemplate") |
| | | public Result<?> selectRawMaterOrderTemplate(String partNo) { |
| | | return Result.success(rawMaterialOrderTemplateService.selectRawMaterOrderTemplate(partNo)); |
| | | } |
| | | |
| | | @ApiOperation(value = "éè¿åæææ£éªå模æ¿idè·åæ£éªå模æ¿å
容") |
| | | @GetMapping("/selectRawMaterOrderTemplateById") |
| | | public Result<?> selectRawMaterOrderTemplateById(Integer id) { |
| | | return Result.success("æå", rawMaterialOrderTemplateService.selectRawMaterOrderTemplateById(id)); |
| | | } |
| | | |
| | | @ApiOperation(value = "å é¤åæææ£éªå模æ¿") |
| | | @DeleteMapping("/delRawMaterOrderTemplate") |
| | | public Result<?> delRawMaterOrderTemplate(Integer id) { |
| | | return Result.success(rawMaterialOrderTemplateService.delRawMaterOrderTemplate(id)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ¥æ£æ¹é |
| | | * @param param åææid |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "æ¥æ£æ¹é") |
| | | @PostMapping("/inspectionReport") |
| | | public Result<?> inspectionReport(@RequestBody Map<String, Object> param) { |
| | | List<Integer> ids = (List<Integer>) param.get("ids"); |
| | | return Result.success(rawMaterialOrderService.inspectionReport(ids)); |
| | | } |
| | | |
| | | /** |
| | | * åæ¶æ¥æ£ |
| | | * @param param åææä¸å |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "æ¤éæ¥æ£") |
| | | @PostMapping("/revokeInspectionReport") |
| | | public Result<?> revokeInspectionReport(@RequestBody Map<String, Object> param) { |
| | | Integer id = (Integer) param.get("id"); |
| | | return Result.success(rawMaterialOrderService.revokeInspectionReport(id)); |
| | | } |
| | | |
| | | /** |
| | | * æå°æ ç¾æ¥è¯¢ |
| | | * @param param åææid |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "æå°æ ç¾æ¥è¯¢") |
| | | @PostMapping("/printLabel") |
| | | public Result<?> printLabel(@RequestBody Map<String, Object> param) { |
| | | List<Integer> ids = (List<Integer>) param.get("ids"); |
| | | return Result.success(rawMaterialOrderService.printLabel(ids)); |
| | | } |
| | | |
| | | /** |
| | | * æ¥æ£ |
| | | * @param ifsInventoryQuantity åææ |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "æ¥æ£") |
| | | @PostMapping("/inspectionReportOne") |
| | | public Result<?> inspectionReportOne(@RequestBody IfsInventoryQuantity ifsInventoryQuantity) { |
| | | |
| | | return Result.success(rawMaterialOrderService.inspectionReportOne(ifsInventoryQuantity)); |
| | | } |
| | | |
| | | /** |
| | | * è·åé产ä¸é¾æ£æµæ°æ® |
| | | * @param id åææid |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "è·åé产ä¸é¾æ£æµæ°æ®") |
| | | @GetMapping("/getIndustryChain") |
| | | public Result<?> getIndustryChain(Integer id) { |
| | | return Result.success("æå", rawMaterialOrderService.getIndustryChain(id)); |
| | | } |
| | | |
| | | /** |
| | | * åæææ¤é |
| | | * @param param |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "åæææ¤éä¸å") |
| | | @GetMapping("/repealRawOrder") |
| | | public Result<?> repealRawOrder(@RequestBody Map<String, Object> param){ |
| | | Integer ifsInventoryId = (Integer) param.get("ifsInventoryId"); |
| | | return Result.success(rawMaterialOrderService.repealRawOrder(ifsInventoryId)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "åææä¸åå
æ£") |
| | | @PostMapping("/addExemptionOrder") |
| | | public Result<?> addExemptionOrder(String str) { |
| | | Map<String, Object> map = JSON.parseObject(str, Map.class); |
| | | JSONArray jsonArray = JSON.parseArray(map.get("list")+""); |
| | | List<SampleProductDto> list = jsonArray.toJavaList(SampleProductDto.class); |
| | | InsOrder insOrder = JSON.parseObject(JSON.toJSONString(map.get("insOrder")), InsOrder.class); |
| | | return Result.success(rawMaterialOrderService.addExemptionOrder(list, insOrder)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "ä»åºæ¥æ£æ¥è¯¢") |
| | | @GetMapping("/getWarehouseSubmit") |
| | | public Result getWarehouseSubmit(Page page, IfsInventoryQuantity ifsInventoryQuantity) throws Exception { |
| | | return Result.success(rawMaterialOrderService.getWarehouseSubmit(page, ifsInventoryQuantity)); |
| | | } |
| | | |
| | | /** |
| | | * åæ¶æ¥æ£ |
| | | * @param id åææä¸å |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "å é¤åæææ¥æ£ä¿¡æ¯") |
| | | @DeleteMapping("/delIfsInventory") |
| | | public Result<?> delIfsInventory(Integer id) { |
| | | return Result.success(rawMaterialOrderService.delIfsInventory(id)); |
| | | } |
| | | |
| | | /** |
| | | * åææä¸åæ¾è¡ |
| | | * @param param |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "åææä¸åæ¾è¡å
æ£") |
| | | @PostMapping("/rawOrderRelease") |
| | | public Result<?> rawOrderRelease(@RequestBody Map<String, Object> param){ |
| | | Integer ifsInventoryId = (Integer) param.get("ifsInventoryId"); |
| | | String partDetail = (String) param.get("partDetail"); |
| | | return Result.success(rawMaterialOrderService.rawOrderRelease(ifsInventoryId, partDetail)); |
| | | } |
| | | |
| | | /** |
| | | * åææä¸åéç¥å
æ£æè
夿¬¡æ£éª |
| | | * @param ifsInventoryId |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "åææä¸åéç¥å
æ£æè
夿¬¡æ£éª") |
| | | @GetMapping("/notificationRawOrder") |
| | | public Result<?> notificationRawOrder(Integer ifsInventoryId){ |
| | | return Result.success(rawMaterialOrderService.notificationRawOrder(ifsInventoryId)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "åæææ¥æ£æ¥è¯¢å
¨é¨") |
| | | @GetMapping("/getIfsByAll") |
| | | public Result getIfsByAll(Page page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto){ |
| | | return Result.success(rawMaterialOrderService.getIfsByOver(page, ifsInventoryQuantityDto)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "æ°å¢åæææ¥æ£ä¿¡æ¯") |
| | | @PostMapping("/addIfsInventoryQuantity") |
| | | public Result addIfsInventoryQuantity(@RequestBody IfsInventoryQuantity ifsInventoryQuantity) { |
| | | rawMaterialOrderService.addIfsInventoryQuantity(ifsInventoryQuantity); |
| | | return Result.success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "åææä¸åæ¥çå·²å®æä¿¡æ¯") |
| | | @GetMapping("/getIfsByFinish") |
| | | public Result getIfsByFinish(Page page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto) throws Exception { |
| | | ifsInventoryQuantityDto.setIsFinish(1); |
| | | return Result.success(rawMaterialOrderService.getIfsByOver(page, ifsInventoryQuantityDto)); |
| | | } |
| | | |
| | | @ApiOperation(value = "微信åéæä»¶æµè¯") |
| | | @GetMapping("/wxSend") |
| | | public Result wxSend(String user, String content, String filePath) throws Exception { |
| | | WxCpUtils.inform(user, content, new File(filePath)); |
| | | return Result.success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "éåä¸ä¸åå
æ£") |
| | | @PostMapping("/addRawCopperOrderExemptionOrder") |
| | | public Result<?> addRawCopperOrderExemptionOrder(String str) { |
| | | Map<String, Object> map = JSON.parseObject(str, Map.class); |
| | | JSONArray jsonArray = JSON.parseArray(map.get("list")+""); |
| | | List<SampleProductDto> list = jsonArray.toJavaList(SampleProductDto.class); |
| | | CopperInsOrderDto CopperInsOrder = JSON.parseObject(JSON.toJSONString(map.get("insOrder")), CopperInsOrderDto.class); |
| | | return Result.success(rawMaterialOrderService.addRawCopperOrderExemptionOrder(list, CopperInsOrder)); |
| | | } |
| | | |
| | | /** |
| | | * è®©æ¥æ¾è¡ |
| | | * @param param |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "è®©æ¥æ¾è¡") |
| | | @PostMapping("/concessionRelease") |
| | | public Result<?> concessionRelease(@RequestBody Map<String, Object> param){ |
| | | Integer ifsInventoryId = (Integer) param.get("ifsInventoryId"); |
| | | return Result.success(rawMaterialOrderService.concessionRelease(ifsInventoryId)); |
| | | } |
| | | |
| | | /** |
| | | * åææè¿åæ¤éä¸å |
| | | * @param param |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "åææè¿åæ¤éä¸å") |
| | | @PostMapping("/repealEnterRawOrder") |
| | | public Result<?> repealEnterRawOrder(@RequestBody Map<String, Object> param){ |
| | | Integer enterOrderId = (Integer) param.get("enterOrderId"); |
| | | return Result.success(rawMaterialOrderService.repealEnterRawOrder(enterOrderId)); |
| | | } |
| | | |
| | | /** |
| | | * åææå£åº¦æ¤éä¸å |
| | | * @param param |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "åææå£åº¦æ¤éä¸å") |
| | | @PostMapping("/repealQuarterRawOrder") |
| | | public Result<?> repealQuarterRawOrder(@RequestBody Map<String, Object> param){ |
| | | Integer quarterOrderId = (Integer) param.get("quarterOrderId"); |
| | | return Result.success(rawMaterialOrderService.repealQuarterRawOrder(quarterOrderId)); |
| | | } |
| | | |
| | | @ApiOperation(value = "å
¨é¨ä¿¡æ¯å¯¼åº") |
| | | @GetMapping("/rawAllExport") |
| | | public void rawAllExport(IfsInventoryQuantitySupplierDto dto, HttpServletResponse response) throws Exception { |
| | | rawMaterialOrderService.rawAllExport(dto,response); |
| | | } |
| | | |
| | | @ApiOperation(value = "åæææ£éªæ¥è¯¢å£åº¦æ£éª") |
| | | @GetMapping("/getIfsByQuarter") |
| | | public Result getIfsByQuarter(Page page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto){ |
| | | return Result.success(rawMaterialOrderService.getIfsByQuarter(page, ifsInventoryQuantityDto)); |
| | | } |
| | | |
| | | /** |
| | | * æåå
¥åº |
| | | * @param param |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "æåå
¥åº") |
| | | @PostMapping("/advancedGodown") |
| | | public Result<?> advancedGodown(@RequestBody Map<String, Object> param){ |
| | | Integer ifsInventoryId = (Integer) param.get("ifsInventoryId"); |
| | | return Result.success(rawMaterialOrderService.advancedGodown(ifsInventoryId)); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.inspect.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.inspect.pojo.InsUnqualifiedHandler; |
| | | import com.ruoyi.inspect.pojo.InsUnqualifiedHandlerFile; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class UnqualifiedHandlerDto extends InsUnqualifiedHandler implements Serializable { |
| | | |
| | | @ApiModelProperty("å") |
| | | private String contract; |
| | | |
| | | @ApiModelProperty("订åå·") |
| | | private String orderNo; |
| | | |
| | | @ApiModelProperty("è¡å·") |
| | | private String lineNo; |
| | | |
| | | @ApiModelProperty("ä¸è¾¾å·") |
| | | private String releaseNo; |
| | | |
| | | @ApiModelProperty("æ¥æ¶å·") |
| | | private Integer receiptNo; |
| | | |
| | | @ApiModelProperty("é¶ä»¶å·") |
| | | private String partNo; |
| | | |
| | | @ApiModelProperty("é¶ä»¶æè¿°") |
| | | private String partDesc; |
| | | |
| | | @ApiModelProperty("ç¶ææè¿°") |
| | | private String status; |
| | | |
| | | @ApiModelProperty("ç¶æ") |
| | | private String statusDB; |
| | | |
| | | @ApiModelProperty("æµè¾¾çéè´æ°é") |
| | | private BigDecimal qtyArrived; |
| | | |
| | | @ApiModelProperty("å·²æ£éªçè´ä¹°æ°é") |
| | | private BigDecimal qtyInspected; |
| | | |
| | | @ApiModelProperty("è¦æ£éªçéè´æ°é") |
| | | private BigDecimal qtyToInspect; |
| | | |
| | | @ApiModelProperty("ä¾åºåç¼å·") |
| | | private String supplierId; |
| | | |
| | | @ApiModelProperty("ä¾åºååç§°") |
| | | private String supplierName; |
| | | |
| | | @ApiModelProperty("æµè¾¾çåºåæ°é") |
| | | private BigDecimal invQtyInStore; |
| | | |
| | | @ApiModelProperty("æµè¾¾çéè´æ°é") |
| | | private BigDecimal purQtyInStore; |
| | | |
| | | @ApiModelProperty("é
ç½®æ è¯") |
| | | private String configurationId; |
| | | |
| | | @ApiModelProperty("æ¹å·") |
| | | private String lotBatchNo; |
| | | |
| | | @ApiModelProperty("wdrå·") |
| | | private String waivDevRejNo; |
| | | |
| | | @ApiModelProperty("æ´»å¨åºå") |
| | | private String activitySeq; |
| | | |
| | | @ApiModelProperty("åºåå·") |
| | | private String serialNo; |
| | | |
| | | @ApiModelProperty("åºä½å·") |
| | | private String locationNo; |
| | | |
| | | @ApiModelProperty("çæ¬å·") |
| | | private String engChgLevel; |
| | | |
| | | @ApiModelProperty("æ¥æ¶äºº") |
| | | private String receiver; |
| | | |
| | | @ApiModelProperty("æ¥æ¶äººå§å") |
| | | private String receiverName; |
| | | |
| | | @ApiModelProperty("éè´å") |
| | | private String buyerCode; |
| | | |
| | | @ApiModelProperty("éè´åå§å") |
| | | private String buyerName; |
| | | |
| | | @ApiModelProperty("å®é
å°è´§æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private LocalDateTime arriveDate; |
| | | |
| | | @ApiModelProperty("å®é
äº¤è´§æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private LocalDateTime deliveryDate; |
| | | |
| | | @ApiModelProperty("çäº§æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private LocalDateTime productDate; |
| | | |
| | | @ApiModelProperty("å¤±ææ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private LocalDateTime invalidDate; |
| | | |
| | | |
| | | @ApiModelProperty("å®¡æ¹æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private LocalDateTime approvedDate; |
| | | |
| | | @ApiModelProperty("éè´ç³è¯·å建人") |
| | | private String reqCeater; |
| | | |
| | | @ApiModelProperty("éè´ç³è¯·å建人å§å") |
| | | private String reqCeaterName; |
| | | |
| | | @ApiModelProperty("éè´è®¢åè¡å¤æ³¨") |
| | | private String lineRemarks; |
| | | |
| | | @ApiModelProperty("éè´åä½") |
| | | private String buyUnitMeas; |
| | | |
| | | |
| | | private Integer isSource; |
| | | |
| | | private Integer number; |
| | | |
| | | private Integer state; |
| | | |
| | | @ApiModelProperty("æ¥æ¶æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private LocalDateTime receiverDate; |
| | | |
| | | |
| | | @ApiModelProperty("éä»¶å表") |
| | | private List<InsUnqualifiedHandlerFile> unqualifiedHandlerFiles; |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | Long getCount(@Param("inspectionItems") String inspectionItems, @Param("orderNumber") String orderNumber); |
| | | |
| | | String getEnumLabelByValue(String value); |
| | | |
| | | String getStandardMethodCode(Integer id); |
| | | |
| | | int updateStatus( Integer id); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.inspect.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.inspect.pojo.InsOrderTemplate; |
| | | |
| | | /** |
| | | * @author Administrator |
| | | * @description é对表ãins_order_templateãçæ°æ®åºæä½Mapper |
| | | * @createDate 2024-03-18 14:14:54 |
| | | * @Entity com.yuanchu.mom.pojo.InsOrderTemplate |
| | | */ |
| | | public interface InsOrderTemplateMapper extends BaseMapper<InsOrderTemplate> { |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.inspect.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.ruoyi.inspect.dto.UnqualifiedHandlerDto; |
| | | import com.ruoyi.inspect.pojo.CommonOa; |
| | | import com.ruoyi.inspect.pojo.InsUnqualifiedHandler; |
| | | import com.ruoyi.inspect.vo.UnqualifiedHandlerVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author 27233 |
| | | * @description é对表ãins_unqualified_handler(ä¸åæ ¼å¤ç表)ãçæ°æ®åºæä½Mapper |
| | | * @createDate 2024-07-31 13:38:14 |
| | | * @Entity com.yuanchu.mom.pojo.InsUnqualifiedHandler |
| | | */ |
| | | @Mapper |
| | | public interface InsUnqualifiedHandlerMapper extends BaseMapper<InsUnqualifiedHandler> { |
| | | |
| | | IPage<UnqualifiedHandlerVO> selectPageList(IPage<UnqualifiedHandlerVO> page, @Param("ew")QueryWrapper<UnqualifiedHandlerDto> ew); |
| | | |
| | | UnqualifiedHandlerVO findById(Long id); |
| | | |
| | | /** |
| | | * æ¥çoaæµç¨ |
| | | * @param id |
| | | * @return |
| | | */ |
| | | List<CommonOa> getOaFlow(@Param("id") Integer id); |
| | | } |
| | | |
| | | |
| | | |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.inspect.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * oaå®¡æ ¸æµç¨ä¿¡æ¯è®°å½è¡¨ |
| | | * @TableName common_oa |
| | | */ |
| | | @TableName(value ="common_oa") |
| | | @Data |
| | | public class CommonOa implements Serializable { |
| | | /** |
| | | * 主é®id |
| | | */ |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * èç¹åç§° |
| | | */ |
| | | private String nodeName; |
| | | |
| | | /** |
| | | * æä½ |
| | | */ |
| | | private String operation; |
| | | |
| | | /** |
| | | * 审æ¹äºº |
| | | */ |
| | | private String approver; |
| | | |
| | | /** |
| | | * å®¡æ¹æ¥æ |
| | | */ |
| | | private String approvalDate; |
| | | |
| | | /** |
| | | * å®¡æ¹æ¶é´ |
| | | */ |
| | | private String approvalTime; |
| | | |
| | | /** |
| | | * å®¡æ¹æè§ |
| | | */ |
| | | private String approvalOpinion; |
| | | |
| | | /** |
| | | * æµç¨id |
| | | */ |
| | | private Long workflowId; |
| | | |
| | | @TableField(exist = false) |
| | | private static final long serialVersionUID = 1L; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.inspect.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.inspect.pojo.InsOrderTemplate; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Administrator |
| | | * @description é对表ãins_order_templateãçæ°æ®åºæä½Service |
| | | * @createDate 2024-03-18 14:14:54 |
| | | */ |
| | | public interface InsOrderTemplateService extends IService<InsOrderTemplate> { |
| | | |
| | | int addInsOrderTemplate(InsOrderTemplate insOrderTemplate); |
| | | |
| | | List<InsOrderTemplate> selectInsOrderTemplate(String company); |
| | | |
| | | String selectInsOrderTemplateById(Integer id); |
| | | |
| | | int delInsOrderTemplate(Integer id); |
| | | |
| | | } |
| | |
| | | package com.ruoyi.inspect.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.inspect.dto.InsProductBindingDto; |
| | |
| | | |
| | | boolean write(InsOrder insOrder); |
| | | |
| | | Map<String,Object> selectNoProducts(Page page, InsProduct insProduct,Integer orderId,String ids); |
| | | IPage<InsProduct> selectNoProducts(Page page, InsProduct insProduct, Integer orderId, String ids); |
| | | |
| | | void checkUpdate(Integer orderId,Integer state); |
| | | |
| | |
| | | */ |
| | | void addIfsInventoryQuantity(IfsInventoryQuantity ifsInventoryQuantity); |
| | | |
| | | void shiftingParking(List<Integer> ids); |
| | | |
| | | /** |
| | | * éåä¸ä¸åå
æ£ |
| | |
| | | //package com.ruoyi.inspect.service.impl; |
| | | // |
| | | //import cn.hutool.core.collection.CollUtil; |
| | | //import cn.hutool.core.util.ObjectUtil; |
| | | //import cn.hutool.core.util.StrUtil; |
| | | //import cn.hutool.json.JSONUtil; |
| | | //import com.alibaba.excel.EasyExcel; |
| | | //import com.alibaba.excel.ExcelWriter; |
| | | //import com.alibaba.excel.write.metadata.WriteSheet; |
| | | //import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; |
| | | //import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy; |
| | | //import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | //import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | //import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | //import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | //import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | //import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | //import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | //import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | //import com.ruoyi.basic.mapper.IfsInventoryQuantityMapper; |
| | | //import com.ruoyi.basic.mapper.StandardProductListMapper; |
| | | //import com.ruoyi.basic.pojo.IfsInventoryQuantity; |
| | | //import com.ruoyi.basic.pojo.StandardProductList; |
| | | //import com.ruoyi.basic.pojo.StructureTestObject; |
| | | //import com.ruoyi.common.constant.InsOrderTypeConstants; |
| | | //import com.ruoyi.common.core.domain.entity.User; |
| | | //import com.ruoyi.common.numgen.NumberGenerator; |
| | | //import com.ruoyi.common.utils.*; |
| | | //import com.ruoyi.framework.exception.ErrorException; |
| | | //import com.ruoyi.inspect.dto.*; |
| | | //import com.ruoyi.inspect.mapper.*; |
| | | //import com.ruoyi.inspect.pojo.*; |
| | | //import com.ruoyi.inspect.service.InsOrderService; |
| | | //import com.ruoyi.inspect.service.InsProductService; |
| | | //import com.ruoyi.inspect.service.InsSampleService; |
| | | //import com.ruoyi.inspect.vo.InsOrderPrintingVo; |
| | | //import com.ruoyi.inspect.vo.SampleDefectsFatherVo; |
| | | //import com.ruoyi.system.mapper.CustomMapper; |
| | | //import com.ruoyi.system.mapper.UserMapper; |
| | | //import lombok.AllArgsConstructor; |
| | | //import org.apache.commons.lang3.StringUtils; |
| | | //import org.springframework.beans.BeanUtils; |
| | | //import org.springframework.stereotype.Service; |
| | | //import org.springframework.transaction.annotation.Transactional; |
| | | // |
| | | //import javax.servlet.http.HttpServletResponse; |
| | | //import java.io.IOException; |
| | | //import java.math.BigDecimal; |
| | | //import java.net.URLEncoder; |
| | | //import java.time.LocalDate; |
| | | //import java.time.LocalDateTime; |
| | | //import java.time.Month; |
| | | //import java.time.format.DateTimeFormatter; |
| | | //import java.util.*; |
| | | //import java.util.concurrent.atomic.AtomicInteger; |
| | | //import java.util.stream.Collectors; |
| | | // |
| | | ///** |
| | | // * @author gaoaoy |
| | | // * @description é对表ãins_order(æ£éªä¸å)ãçæ°æ®åºæä½Serviceå®ç° |
| | | // * @createDate 2024-03-12 16:17:55 |
| | | // */ |
| | | //@Service |
| | | //@AllArgsConstructor |
| | | //public class InsOrderServiceImpl extends ServiceImpl<InsOrderMapper, InsOrder> |
| | | // implements InsOrderService { |
| | | // |
| | | // private InsOrderMapper insOrderMapper; |
| | | // private InsSampleService insSampleService; |
| | | // private InsSampleMapper insSampleMapper; |
| | | // private InsProductService insProductService; |
| | | // private InsProductMapper insProductMapper; |
| | | // private InsProductUserMapper insProductUserMapper; |
| | | // private InsSampleUserMapper insSampleUserMapper; |
| | | // private InsOrderStateMapper insOrderStateMapper; |
| | | // private UserMapper userMapper; |
| | | // private IfsInventoryQuantityMapper ifsInventoryQuantityMapper; |
| | | // private CustomMapper customMapper; |
| | | // private final NumberGenerator<InsOrder> numberGenerator; |
| | | // private InsReportMapper insReportMapper; |
| | | // private InsUnqualifiedRetestProductMapper insUnqualifiedRetestProductMapper; |
| | | // private IfsApiUtils ifsApiUtils; |
| | | // private SpotCheckQuarterItemMapper spotCheckQuarterItemMapper; |
| | | // private StandardProductListMapper standardProductListMapper; |
| | | // |
| | | // |
| | | // |
| | | // //è·åæ£éªä¸åæ°æ® |
| | | // @Override |
| | | // public IPage<SampleOrderDto> selectInsOrderParameter(IPage<InsOrder> page, SampleOrderDto sampleOrderDto) { |
| | | // //todo: åªçæå¤æå
¨é¨,个人,ç»ç»çæé |
| | | // String laboratory = null; |
| | | // // 夿æ¯å¦æ¯å
¨é¨ |
| | | // String isOrderAll = null; |
| | | // if (sampleOrderDto.getState() != null && sampleOrderDto.getState() == -2) { |
| | | // isOrderAll = "1"; |
| | | // sampleOrderDto.setState(null); |
| | | // } |
| | | // IPage<SampleOrderDto> sampleOrderDtoIPage = insOrderMapper.selectInsOrderPage(page, QueryWrappers.queryWrappers(sampleOrderDto), laboratory, isOrderAll); |
| | | // return insOrderMapper.selectInsOrderPage(page, QueryWrappers.queryWrappers(sampleOrderDto), laboratory, isOrderAll); |
| | | // } |
| | | // |
| | | // |
| | | // @Override |
| | | // @Transactional(rollbackFor = Exception.class) |
| | | // public int upInsOrder(Integer orderId, Integer sampleId, String appointed, Integer userId, String sonLaboratory) { |
| | | // InsOrder insOrder = new InsOrder(); |
| | | // insOrder.setId(orderId); |
| | | // insOrder.setAppointed(StringUtils.isNotEmpty(appointed) ? LocalDate.parse(appointed) : null); |
| | | // insOrder.setSendTime(LocalDateTime.now()); |
| | | // insOrderMapper.updateById(insOrder); |
| | | // List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId).select(InsSample::getId)); |
| | | // List<Integer> ids = insSamples.stream().map(a -> a.getId()).collect(Collectors.toList()); |
| | | // List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() |
| | | // .in(InsProduct::getInsSampleId, ids) |
| | | // .eq(InsProduct::getState, 1) |
| | | // .select(InsProduct::getSonLaboratory).groupBy(InsProduct::getSonLaboratory)); |
| | | // for (InsProduct insProduct : insProducts) { |
| | | // InsOrderState insOrderState = new InsOrderState(); |
| | | // insOrderState.setInsOrderId(orderId); |
| | | // try { |
| | | // insOrderState.setLaboratory(insProduct.getSonLaboratory()); |
| | | // } catch (NullPointerException e) { |
| | | // throw new ErrorException("该æ£éªåææªç»´æ¤å®éªå®¤çæ£éªé¡¹ç®"); |
| | | // } |
| | | // insOrderState.setInsState(0); |
| | | // insOrderStateMapper.insert(insOrderState); |
| | | // } |
| | | // if (userId != null) { |
| | | // InsSampleUser insSampleUser = new InsSampleUser(); |
| | | // insSampleUser.setState(0); |
| | | // insSampleUser.setUserId(userId); |
| | | // insSampleUser.setInsSampleId(orderId); |
| | | // insSampleUser.setSonLaboratory(sonLaboratory); |
| | | // insSampleUserMapper.insert(insSampleUser); |
| | | // } |
| | | // |
| | | // // å¤æè®¢åææ²¡æç»å®æ½æ ·è®¡å |
| | | // InsOrder order = insOrderMapper.selectById(orderId); |
| | | // if (order.getQuarterItemId() != null) { |
| | | // // éè¦æ·»å ä¸åæ¶é´å°æ½æ ·æ¶é´, åæ ·äººåå°±æ¯æ£æµäºº |
| | | // SpotCheckQuarterItem spotCheckQuarterItem = spotCheckQuarterItemMapper.selectById(order.getQuarterItemId()); |
| | | // spotCheckQuarterItem.setSpotCheckTime(order.getSendTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); |
| | | // User user = userMapper.selectById(userId); |
| | | // spotCheckQuarterItem.setSamplingUser(user.getName()); |
| | | // spotCheckQuarterItemMapper.updateById(spotCheckQuarterItem); |
| | | // } |
| | | // return 1; |
| | | // } |
| | | // |
| | | // @Override |
| | | // @Transactional(rollbackFor = Exception.class) |
| | | // public int addInsOrder(List<SampleProductDto> list, InsOrder insOrder, List<List<Integer>> pairing) { |
| | | // // todo: ä¸åå¤ææ½æ ·è®¡åçå¯ä¸æ§ |
| | | // if (insOrder.getQuarterItemId() != null) { |
| | | // Long quarterItemCount = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery() |
| | | // .eq(InsOrder::getQuarterItemId, insOrder.getQuarterItemId()) |
| | | // .notIn(InsOrder::getState, -1 ,2 ,3)); |
| | | // if (quarterItemCount > 0) { |
| | | // throw new ErrorException("è¯¥æ½æ ·è®¡å已被ç»å®è¿"); |
| | | // } |
| | | // } |
| | | // |
| | | // insOrder.setState(0); |
| | | // |
| | | // LocalDate appointed = insOrder.getAppointed(); |
| | | // |
| | | // insOrderMapper.insert(insOrder); // 主表 |
| | | // |
| | | // list.forEach(a -> { |
| | | // a.setId(null); |
| | | // a.setInsOrderId(insOrder.getId()); |
| | | // insSampleMapper.insert(a); |
| | | // if (ObjectUtil.isNotEmpty(a.getInsProduct())) { |
| | | // // 夿æ¯å¦å¡«åå¾
æ£é¡¹æ°é |
| | | // if (a.getQuantity() != null) { |
| | | // List<InsProduct> ip2 = new ArrayList<>(); |
| | | // for (Integer i = 1; i <= a.getQuantity(); i++) { |
| | | // // éæ°æ·è´ å建æ°å¯¹è±¡ |
| | | // AtomicInteger atomicInteger = new AtomicInteger(i); |
| | | // List<InsProduct> insProducts = a.getInsProduct().stream().map(insProduct -> { |
| | | // insProduct.setRawMaterialTag(String.valueOf(atomicInteger.get())); |
| | | // InsProduct product = new InsProduct(); |
| | | // BeanUtils.copyProperties(insProduct, product); |
| | | // return product; |
| | | // }).collect(Collectors.toList()); |
| | | // |
| | | // ip2.addAll(insProducts); |
| | | // } |
| | | // addInsProductMethod(a.getId(), ip2); |
| | | // } else { |
| | | // addInsProductMethod(a.getId(), a.getInsProduct()); |
| | | // } |
| | | // } |
| | | // // 夿æ¯å¦æçµç¼é
ç½® |
| | | // if (ObjectUtil.isNotEmpty(a.getInsulating())) { |
| | | // // 夿æ¯å¦æè¾
å©çº¿è¯ |
| | | // if (ObjectUtil.isNotEmpty(a.getAuxiliaryWireCore())) { |
| | | // if (a.getAuxiliaryWireCore().getInsProduct().stream().filter(insProduct -> insProduct.getState() == 1).count() != |
| | | // a.getInsulating().getInsProduct().stream().filter(insProduct -> insProduct.getState() == 1).count()) { |
| | | // throw new ErrorException("çµç¼é
ç½®è¾
å©çº¿è¯æ£éªé¡¹æ°éä¸ç»ä¸, è¯·æ£æ¥"); |
| | | // } |
| | | // } |
| | | // List<InsProduct> ip2 = new ArrayList<>(); |
| | | // for (String s : a.getInsulating().getNum()) { |
| | | // // éæ°æ·è´ å建æ°å¯¹è±¡ |
| | | // List<InsProduct> insProducts = a.getInsulating().getInsProduct().stream().map(insProduct -> { |
| | | // insProduct.setCableTag(s); |
| | | // InsProduct product = new InsProduct(); |
| | | // BeanUtils.copyProperties(insProduct, product); |
| | | // return product; |
| | | // }).collect(Collectors.toList()); |
| | | // ip2.addAll(insProducts); |
| | | // } |
| | | // for (InsProduct product : ip2) { |
| | | // product.setStandardMethodListId(a.getInsulating().getStandardMethodListId()); |
| | | // } |
| | | // addInsProductMethod(a.getId(), ip2); |
| | | // } |
| | | // // 夿æ¯å¦æè¾
å©çº¿è¯ |
| | | // if (ObjectUtil.isNotEmpty(a.getAuxiliaryWireCore())) { |
| | | // List<InsProduct> ip2 = new ArrayList<>(); |
| | | // for (String s : a.getAuxiliaryWireCore().getNum()) { |
| | | // // éæ°æ·è´ å建æ°å¯¹è±¡ |
| | | // List<InsProduct> insProducts = a.getAuxiliaryWireCore().getInsProduct().stream().map(insProduct -> { |
| | | // insProduct.setCableTag(s); |
| | | // InsProduct product = new InsProduct(); |
| | | // BeanUtils.copyProperties(insProduct, product); |
| | | // return product; |
| | | // }).collect(Collectors.toList()); |
| | | // ip2.addAll(insProducts); |
| | | // } |
| | | // for (InsProduct product : ip2) { |
| | | // product.setStandardMethodListId(a.getAuxiliaryWireCore().getStandardMethodListId()); |
| | | // } |
| | | // addInsProductMethod(a.getId(), ip2); |
| | | // } |
| | | // // åæ ·åé
ç½® |
| | | // if (ObjectUtil.isNotEmpty(a.getChildSampleList())) { |
| | | // for (SampleProductDto b : a.getChildSampleList()) { |
| | | // for (int i = 0; i < b.getNum(); i++) { |
| | | // b.setId(null); |
| | | // b.setInsOrderId(insOrder.getId()); |
| | | // b.setParentId(a.getId()); |
| | | // insSampleMapper.insert(b); |
| | | // if (ObjectUtil.isNotEmpty(b.getInsProduct())) { |
| | | // addInsProductMethod(b.getId(), b.getInsProduct()); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // }); |
| | | // //æ¯å¦ä¸ºåææä¸å |
| | | // if (insOrder.getTypeSource() != null && insOrder.getTypeSource().equals(1)) { |
| | | // // åææä¸å: å§æäººå°±æ¯æ¥æ£äºº, ç产åä½å°±æ¯ä¾åºååä½ |
| | | // IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(insOrder.getIfsInventoryId()); |
| | | // Integer declareUserId = ifsInventoryQuantity.getDeclareUserId(); |
| | | // User user = userMapper.selectById(declareUserId); |
| | | // if (user == null) { |
| | | // throw new ErrorException("ç¼ºå°æ¥æ£äººä¿¡æ¯"); |
| | | // } |
| | | // // ä¾åºååç§° |
| | | // insOrder.setProduction(ifsInventoryQuantity.getSupplierName()); |
| | | // insOrder.setProductionEn(""); |
| | | // // å§æäººåç§° |
| | | // insOrder.setPrepareUserId(user.getId()); |
| | | // insOrder.setPrepareUser(user.getName()); |
| | | // insOrder.setPrepareUserEn(user.getNameEn()); |
| | | // insOrder.setPhone(user.getPhone()); |
| | | // insOrder.setState(1); |
| | | // Long count1 = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery() |
| | | // .eq(InsOrder::getIfsInventoryId, insOrder.getIfsInventoryId()) |
| | | // .ne(InsOrder::getState, -1) |
| | | // .eq(InsOrder::getOrderType, InsOrderTypeConstants.ENTER_THE_FACTORY) |
| | | // .ne(InsOrder::getId, insOrder.getId())); |
| | | // // 夿ä¹åæ¯å¦æè¿åæ£éª |
| | | // if (count1 == 0) { |
| | | // ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>().set(IfsInventoryQuantity::getState, 1) |
| | | // .eq(IfsInventoryQuantity::getId, insOrder.getIfsInventoryId())); |
| | | // } |
| | | // |
| | | // // å¤æç»æç¶æä¿®æ¹åæ ¼ç¶æ |
| | | // if (ifsInventoryQuantity.getIsFinish().equals(0)) { |
| | | // ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate() |
| | | // .eq(IfsInventoryQuantity::getId, insOrder.getIfsInventoryId()) |
| | | // .set(IfsInventoryQuantity::getInspectStatus, 0)); |
| | | // } |
| | | // |
| | | // upInsOrderOfState(insOrder); |
| | | // upInsOrder(insOrder.getId(), null, appointed != null ? appointed.toString() : null, SecurityUtils.getUserId().intValue(), "åææ"); |
| | | // |
| | | // |
| | | // // æ ¹æ®é¶ä»¶å·å¤ææ¯å¦æ¯è¾
æ |
| | | // boolean isRaw = false; |
| | | // StructureTestObject productObject = insOrderMapper.selectProductByPartNo(ifsInventoryQuantity.getPartNo()); |
| | | // // æ¥è¯¢äº§å |
| | | // if (productObject != null && StrUtil.isNotBlank(productObject.getObjectType()) && productObject.getObjectType().equals("1")) { |
| | | // isRaw = true; |
| | | // } else { |
| | | // // æ¥è¯¢å¯¹è±¡ |
| | | // StructureTestObject testObject = insOrderMapper.selectByPartNo(ifsInventoryQuantity.getPartNo()); |
| | | // if (testObject != null && StrUtil.isNotBlank(testObject.getObjectType()) && testObject.getObjectType().equals("1")) { |
| | | // isRaw = true; |
| | | // } |
| | | // } |
| | | // |
| | | // if (isRaw) { |
| | | // // è·åå½åå£åº¦çå¼å§æ¶é´åç»ææ¶é´ |
| | | // LocalDateTime now = LocalDateTime.now(); |
| | | // // è·åå½åæä»½ |
| | | // int month = now.getMonthValue(); |
| | | // // ç¡®å®å½åå£åº¦çå¼å§æä»½ |
| | | // int startMonth = (month - 1) / 3 * 3 + 1; |
| | | // // æé å£åº¦çå¼å§æ¶é´ |
| | | // LocalDateTime startOfQuarter = LocalDateTime.of(now.getYear(), Month.of(startMonth), 1, 0, 0); |
| | | // // 计ç®ä¸ä¸ä¸ªå£åº¦çå¼å§æ¶é´ |
| | | // LocalDateTime startOfNextQuarter = startOfQuarter.plusMonths(3); |
| | | // // 计ç®å½åå£åº¦çç»ææ¶é´ |
| | | // LocalDateTime endOfQuarter = startOfNextQuarter.minusSeconds(1); |
| | | // |
| | | // // æ ¹æ®ä¸åçè§æ ¼åå·å¤ææ¯å¦ä¸ºå£åº¦é¦æ¬¡åºç° |
| | | // Integer count = ifsInventoryQuantityMapper.selectIsFirst(insOrder.getPartDetail(), |
| | | // ifsInventoryQuantity.getSupplierName(), |
| | | // startOfNextQuarter, |
| | | // endOfQuarter); |
| | | // |
| | | // if(count == 0) { |
| | | // ifsInventoryQuantity.setIsFirst(1); |
| | | // ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate() |
| | | // .eq(IfsInventoryQuantity::getId, insOrder.getIfsInventoryId()) |
| | | // .set(IfsInventoryQuantity::getIsFirst, 1)); |
| | | // } |
| | | // } |
| | | // } |
| | | // return insOrder.getId(); |
| | | // } |
| | | // |
| | | // /** |
| | | // * æ·»å æ£éªé¡¹ |
| | | // * @param sampleId |
| | | // * @param productList |
| | | // */ |
| | | // private void addInsProductMethod(Integer sampleId, List<InsProduct> productList) { |
| | | // for (InsProduct product : productList) { |
| | | // if (product.getState() == 1) { |
| | | // product.setId(null); |
| | | // product.setCreateTime(null); |
| | | // product.setCreateUser(null); |
| | | // product.setUpdateTime(null); |
| | | // product.setUpdateUser(null); |
| | | // product.setInsSampleId(sampleId); |
| | | // if (product.getInspectionItemSubclass() == null) { |
| | | // product.setInspectionItemSubclass(""); |
| | | // } |
| | | // if (StringUtils.isBlank(product.getAsk()) || StringUtils.isBlank(product.getTell())) { |
| | | // throw new ErrorException("ææ£éªé¡¹çè¦æ±å¼æè¦æ±æè¿°ä¸ºç©º, 请å
廿 ååºé
ç½®è¦æ±å¼æè¦æ±æè¿°"); |
| | | // } |
| | | // insProductMapper.insert(product); |
| | | // } |
| | | // } |
| | | // } |
| | | // |
| | | // |
| | | // @Override |
| | | // public Map<String, Object> getInsOrder(Integer id) { |
| | | // Map<String, Object> map = new HashMap<>(); |
| | | // InsOrder insOrder = insOrderMapper.selectById(id); |
| | | // List<SampleProductDto> list; |
| | | // // 夿æ¯å¦æ¯è¿åæ¥åå
æ£ |
| | | // if (insOrder.getIsExemption().equals(1)) { |
| | | // list = insSampleMapper.selectExemptionByOrderId(id); |
| | | // } else { |
| | | // list = insSampleMapper.selectSampleProductListByOrderId2(id); |
| | | // } |
| | | // Map<String, Object> map1 = insSampleMapper.selectInsOrder(id); |
| | | // map.put("insOrder", insOrder); |
| | | // map.put("sampleProduct", list); |
| | | // map.put("insOrderTemplate", map1); |
| | | // return map; |
| | | // } |
| | | // |
| | | // @Override |
| | | // public int upInsOrderOfState(InsOrder insOrder) { |
| | | // insOrder.setExamineTime(LocalDateTime.now()); |
| | | // if (insOrder.getState() == 1) { |
| | | // //å®¡æ ¸éè¿æä¼çæå§æç¼å· |
| | | // // todo: æ£éªç±»åç¼å· |
| | | // InsOrder order = this.getById(insOrder.getId()); |
| | | // String code = ""; |
| | | // switch (order.getOrderType()) { |
| | | // case InsOrderTypeConstants.SPOT_CHECK: |
| | | // code = "C"; |
| | | // break; |
| | | // case InsOrderTypeConstants.CUSTOMER_ORDERED: |
| | | // code = "W"; |
| | | // break; |
| | | // case InsOrderTypeConstants.ENTER_THE_FACTORY: |
| | | // case InsOrderTypeConstants.QUARTERLY_TEST: |
| | | // code = "Y"; |
| | | // break; |
| | | // } |
| | | // // çæç¼å· |
| | | // String no = numberGenerator.generateNumberWithPrefix(3, |
| | | // "JCZX/ZB-" + code + LimsDateUtil.resetDate(LocalDateTime.now()), |
| | | // InsOrder::getEntrustCode); |
| | | // // 夿æ¯å¦æ¯å£åº¦æ£éª, æ¯å£åº¦æ£éªåæ¶åææå£åº¦æ£éªä¸å |
| | | // if (InsOrderTypeConstants.QUARTERLY_TEST.equals(order.getOrderType())) { |
| | | // ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate() |
| | | // .eq(IfsInventoryQuantity::getId, order.getIfsInventoryId()) |
| | | // .set(IfsInventoryQuantity::getIsQuarter, 0)); |
| | | // |
| | | // // æ¥è¯¢æ¯å¦æè¿è¿åæ£éª, æè·åéé¢çç¼å· |
| | | // InsOrder order1 = insOrderMapper.selectOne(Wrappers.<InsOrder>lambdaQuery() |
| | | // .eq(InsOrder::getIfsInventoryId, order.getIfsInventoryId()) |
| | | // .ne(InsOrder::getState, -1) |
| | | // .eq(InsOrder::getOrderType, InsOrderTypeConstants.ENTER_THE_FACTORY)); |
| | | // if (order1 != null) { |
| | | // no = order1.getEntrustCode(); |
| | | // } |
| | | // } |
| | | // |
| | | // int count = 1; |
| | | // // æ¥è¯¢æ ·å表 |
| | | // List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery() |
| | | // .eq(InsSample::getInsOrderId, insOrder.getId())); |
| | | // for (InsSample insSample : insSamples) { |
| | | // if (StringUtils.isBlank(insSample.getSampleCode())) { |
| | | // // å¦æåªæä¸ä¸ªæ ·åå°±ä¸éè¦æ¼æ¥æ°å |
| | | // if (insSamples.size() != 1) { |
| | | // insSample.setSampleCode(no + "-" + count); |
| | | // count++; |
| | | // } else { |
| | | // insSample.setSampleCode(no); |
| | | // } |
| | | // } |
| | | // } |
| | | // insSampleService.updateBatchById(insSamples); |
| | | // |
| | | // insOrder.setEntrustCode(no); |
| | | // } |
| | | // return insOrderMapper.updateById(insOrder); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public Map<String, Object> getInsOrderAndSample(Integer id, String laboratory) { |
| | | // Map<String, Object> map = new HashMap<>(); |
| | | // InsOrder insOrder = insOrderMapper.selectById(id); |
| | | // List<SampleProductDto> list = insSampleMapper.getInsOrderAndSample(id, laboratory); |
| | | // for (SampleProductDto sampleProductDto : list) { |
| | | // List<Integer> ids = sampleProductDto.getInsProduct().stream().map(InsProduct::getId).collect(Collectors.toList()); |
| | | // List<InsProductUser> insProductUsers = insProductUserMapper.selectList(Wrappers.<InsProductUser>lambdaQuery() |
| | | // .in(InsProductUser::getInsProductId, ids)); |
| | | // if (CollectionUtils.isNotEmpty(insProductUsers)) { |
| | | // List<Integer> userIds = insProductUsers.stream().map(InsProductUser::getCreateUser).distinct().collect(Collectors.toList()); |
| | | // String collect = userMapper.selectBatchIds(userIds).stream().map(User::getName).collect(Collectors.joining(",")); |
| | | // sampleProductDto.setCheckName(collect); |
| | | // } |
| | | // } |
| | | // map.put("insOrder", insOrder); |
| | | // map.put("sampleProduct", list); |
| | | // //æ¥è¯¢ææè®°å½æ¨¡çå»é |
| | | // List<Map<Integer, Object>> list2 = insOrderMapper.selectReportModelByOrderId(id, laboratory); |
| | | // map.put("reportModel", list2); |
| | | // return map; |
| | | // } |
| | | // |
| | | // @Override |
| | | // public IPage<SampleProductDto2> selectSampleAndProductByOrderId(IPage<SampleProductDto2> page, SampleProductDto2 sampleProductDto) { |
| | | // IPage<SampleProductDto2> productDto2IPage = insOrderMapper.selectSampleAndProductByOrderId(page, |
| | | // QueryWrappers.queryWrappers(sampleProductDto) |
| | | // .orderByAsc("sample_code") |
| | | // .orderByAsc("cable_tag") |
| | | // .orderByAsc("sort"), |
| | | // sampleProductDto.getId()); |
| | | // return productDto2IPage; |
| | | // } |
| | | // |
| | | // @Override |
| | | // public IPage<CostStatisticsDto> costStatistics(IPage<CostStatisticsDto> page, CostStatisticsDto costStatisticsDto) { |
| | | // String dates = costStatisticsDto.getDates(); |
| | | // String[] split = dates.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); |
| | | // costStatisticsDto.setDates(null); |
| | | // |
| | | // //todo:ä»
çèªå·± |
| | | // |
| | | // IPage<CostStatisticsDto> dtoIPage = insOrderMapper.selectCostStatistics(page, QueryWrappers.queryWrappers(costStatisticsDto).ge("create_time", split[0]).le("create_time", split[1] + " 23:59:59")); |
| | | // List<CostStatisticsDto> collect = dtoIPage.getRecords().stream().map(dto -> { |
| | | // Set<String> uniqueTags = new HashSet<>(); |
| | | // if (dto.getInspectionItem().contains(",")) { |
| | | // for (String s : dto.getInspectionItem().split(",")) { |
| | | // uniqueTags.add(s.split("@")[0]); |
| | | // } |
| | | // } else { |
| | | // uniqueTags.add(dto.getInspectionItem().split("@")[0]); |
| | | // } |
| | | // dto.setInspectionItem(uniqueTags.toString()); |
| | | // return dto; |
| | | // }).collect(Collectors.toList()); |
| | | // dtoIPage.setRecords(collect); |
| | | // return dtoIPage; |
| | | // } |
| | | // |
| | | // @Override |
| | | // public Map<String, Object> costStatistics2(CostStatisticsDto costStatisticsDto) { |
| | | // Map<String, Object> map = new HashMap<>(); |
| | | // String dates = costStatisticsDto.getDates(); |
| | | // String[] split = dates.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); |
| | | // costStatisticsDto.setDates(null); |
| | | // List<CostStatisticsDto> costStatisticsDtos = insOrderMapper.selectCostStatistics2(QueryWrappers.queryWrappers(costStatisticsDto).ge("create_time", split[0]).le("create_time", split[1] + " 23:59:59")); |
| | | // double totalPrice = costStatisticsDtos.stream() |
| | | // .filter(dto -> dto.getPrice() != null) // è¿æ»¤æä»·æ ¼ä¸º null ç对象 |
| | | // .mapToDouble(value -> value.getPrice().doubleValue() * value.getNum()) |
| | | // .sum(); |
| | | // map.put("total", totalPrice); |
| | | // return map; |
| | | // } |
| | | // |
| | | // @Override |
| | | // public Map<String, Object> selectSampleDefects(Page page, String inspectionItems, String orderNumber) { |
| | | // List<SampleDefectsFatherVo> sampleDefectsFatherVos = insOrderMapper.selectSampleDefects(page, inspectionItems, orderNumber); |
| | | // Map<String, Object> map = new HashMap<>(); |
| | | // map.put("records", sampleDefectsFatherVos); |
| | | // Long aLong = insOrderMapper.getCount(inspectionItems, orderNumber); |
| | | // map.put("total", aLong); |
| | | // return map; |
| | | // } |
| | | // |
| | | // @Override |
| | | // public int updateStatus(Integer id) { |
| | | // return insOrderMapper.updateStatus(id); |
| | | // } |
| | | // |
| | | // |
| | | // @Override |
| | | // public void export(CostStatisticsDto costStatisticsDto, HttpServletResponse response) throws IOException { |
| | | // //æ¥è¯¢å¯¼åºçè´¹ç¨ç»è®¡æ°æ® |
| | | // String dates = costStatisticsDto.getDates(); |
| | | // String[] split = dates.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); |
| | | // costStatisticsDto.setDates(null); |
| | | // List<CostStatisticsDto> costStatisticsDtos = insOrderMapper.selectCostStatistics2(QueryWrappers.queryWrappers(costStatisticsDto).ge("create_time", split[0]).le("create_time", split[1] + " 23:59:59")); |
| | | // costStatisticsDtos = costStatisticsDtos.stream().map(dto -> { |
| | | // Set<String> uniqueTags = new HashSet<>(); |
| | | // if (dto.getInspectionItem().contains(",")) { |
| | | // for (String s : dto.getInspectionItem().split(",")) { |
| | | // uniqueTags.add(s.split("@")[0]); |
| | | // } |
| | | // } else { |
| | | // uniqueTags.add(dto.getInspectionItem().split("@")[0]); |
| | | // } |
| | | // dto.setInspectionItem(uniqueTags.toString()); |
| | | // return dto; |
| | | // }).collect(Collectors.toList()); |
| | | // |
| | | // response.setContentType("application/vnd.ms-excel"); |
| | | // response.setCharacterEncoding("UTF-8"); |
| | | // // è¿éURLEncoder.encodeå¯ä»¥é²æ¢ä¸æä¹±ç å½ç¶åeasyexcel没æå
³ç³» |
| | | // String fileName = URLEncoder.encode("æ ·åè´¹ç¨ç»è®¡å¯¼åº", "UTF-8"); |
| | | // response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); |
| | | // Map<String, List<CostStatisticsDto>> groupByCompany = |
| | | // costStatisticsDtos.stream().filter(e -> StrUtil.isNotEmpty(e.getCompany())) |
| | | // .collect(Collectors.groupingBy(CostStatisticsDto::getCompany)); |
| | | // try { |
| | | // // æ°å»ºExcelWriter |
| | | // // æ°å»ºExcelWriter |
| | | // ExcelWriter excelWriter = |
| | | // EasyExcel.write(response.getOutputStream()) |
| | | // .registerWriteHandler(new SimpleColumnWidthStyleStrategy(25)) |
| | | // .build(); |
| | | // for (Map.Entry<String, List<CostStatisticsDto>> companyDataEntry : groupByCompany.entrySet()) { |
| | | // String sheetName = companyDataEntry.getKey(); |
| | | // List<CostStatisticsDto> dataList = companyDataEntry.getValue(); |
| | | // WriteSheet mainSheet = EasyExcel.writerSheet(sheetName) |
| | | // .head(CostStatisticsDto.class) |
| | | // .registerWriteHandler(new SimpleColumnWidthStyleStrategy(25)) |
| | | // .build(); |
| | | // excelWriter.write(dataList, mainSheet); |
| | | // } |
| | | // // å
³éæµ |
| | | // excelWriter.finish(); |
| | | // } catch (IOException e) { |
| | | // throw new RuntimeException("导åºå¤±è´¥"); |
| | | // } |
| | | // } |
| | | // |
| | | // /** |
| | | // * è·åifsåºåä¿¡æ¯ |
| | | // * @param |
| | | // * @return |
| | | // */ |
| | | // @Override |
| | | // public void getIfsOrder() { |
| | | // HashMap<String, Object> map = new HashMap<>(); |
| | | // map.put("LOCATION_NO","1302"); |
| | | // map.put("STATE_DB","To be Inspected"); |
| | | // List<Map<String, Object>> inventory = ifsApiUtils.getInventory(JSONUtil.toJsonStr(map)); |
| | | // if(inventory.size() == 0) { |
| | | // return; |
| | | // } |
| | | // // è¿è¡ä¿å |
| | | // for (Map<String, Object> map1 : inventory) { |
| | | // DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); // æ¶é´æ ¼å¼å |
| | | // IfsInventoryQuantity ifsInventoryQuantity = new IfsInventoryQuantity(); |
| | | // ifsInventoryQuantity.setContract(map1.get("CONTRACT") == null ? "" : map1.get("CONTRACT").toString()); // å |
| | | // ifsInventoryQuantity.setPartNo(map1.get("PART_NO") == null ? "" : map1.get("PART_NO").toString() ); // é¶ä»¶å· |
| | | // ifsInventoryQuantity.setPartDesc(map1.get("PART_DESC") == null ? "" : map1.get("PART_DESC").toString()); // é¶ä»¶æè¿° |
| | | // ifsInventoryQuantity.setOrderNo(map1.get("ORDER_NO") == null ? "" : map1.get("ORDER_NO").toString()); // 订åå· |
| | | // ifsInventoryQuantity.setLineNo(map1.get("LINE_NO") == null ? "" : map1.get("LINE_NO").toString()); // è¡å· |
| | | // ifsInventoryQuantity.setReleaseNo(map1.get("RELEASE_NO") == null ? "" : map1.get("RELEASE_NO").toString()); // ä¸è¾¾å· |
| | | // ifsInventoryQuantity.setReceiptNo(Integer.parseInt(map1.get("RECEIPT_NO") == null ? "" : map1.get("RECEIPT_NO").toString())); // æ¥æ¶å· |
| | | // ifsInventoryQuantity.setStatus(map1.get("STATE") == null ? "" : map1.get("STATE").toString()); // ç¶ææè¿° |
| | | // ifsInventoryQuantity.setStatusDb(map1.get("STATE_DB") == null ? "" : map1.get("STATE_DB").toString()); // ç¶æ |
| | | // if(map1.get("QTY_ARRIVED") != null) { |
| | | // ifsInventoryQuantity.setQtyArrived(new BigDecimal(map1.get("QTY_ARRIVED").toString())); // æµè¾¾çéè´æ°é |
| | | // } |
| | | // if(map1.get("QTY_INSPECTED") != null) { |
| | | // ifsInventoryQuantity.setQtyInspected(new BigDecimal(map1.get("QTY_INSPECTED").toString())); // å·²æ£éªçè´ä¹°æ°é |
| | | // } |
| | | // if(map1.get("QTY_TO_INSPECT") != null) { |
| | | // ifsInventoryQuantity.setQtyToInspect(new BigDecimal(map1.get("QTY_TO_INSPECT").toString())); // è¦æ£éªçéè´æ°é |
| | | // } |
| | | // if(map1.get("INV_QTY_IN_STORE") != null) { |
| | | // ifsInventoryQuantity.setInvQtyInStore(new BigDecimal(map1.get("INV_QTY_IN_STORE").toString())); // æµè¾¾çåºåæ°é |
| | | // } |
| | | // if(map1.get("PUR_QTY_IN_STORE") != null) { |
| | | // ifsInventoryQuantity.setPurQtyInStore(new BigDecimal( map1.get("PUR_QTY_IN_STORE").toString())); // æµè¾¾çéè´æ°é |
| | | // |
| | | // } |
| | | // ifsInventoryQuantity.setSupplierId(map1.get("SUPPLIER_ID") == null ? "" : map1.get("SUPPLIER_ID").toString()); // ä¾åºåID |
| | | // ifsInventoryQuantity.setSupplierName(map1.get("SUPPLIER_NAME") == null ? "" : map1.get("SUPPLIER_NAME").toString()); // ä¾åºååç§° |
| | | // ifsInventoryQuantity.setConfigurationId(map1.get("CONFIGURATION_ID") == null ? "" : map1.get("CONFIGURATION_ID").toString()); // é
ç½®æ è¯ |
| | | // ifsInventoryQuantity.setLotBatchNo(map1.get("LOT_BATCH_NO") == null ? "" : map1.get("LOT_BATCH_NO").toString()); // æ¹æ¬¡å· |
| | | // ifsInventoryQuantity.setUpdateBatchNo(map1.get("LOT_BATCH_NO") == null ? "" : map1.get("LOT_BATCH_NO").toString()); // æ¹æ¬¡å· |
| | | // ifsInventoryQuantity.setWaivDevRejNo(map1.get("WAIV_DEV_REJ_NO") == null ? "" : map1.get("WAIV_DEV_REJ_NO").toString()); // WDRå· |
| | | // ifsInventoryQuantity.setActivitySeq(map1.get("ACTIVITY_SEQ") == null ? null : Integer.parseInt(map1.get("ACTIVITY_SEQ").toString())); // æ´»å¨åºå |
| | | // ifsInventoryQuantity.setSerialNo(map1.get("SERIAL_NO") == null ? "" : map1.get("SERIAL_NO").toString()); // åºåå· |
| | | // ifsInventoryQuantity.setLocationNo(map1.get("LOCATION_NO") == null ? "" : map1.get("LOCATION_NO").toString()); // åºä½å· |
| | | // ifsInventoryQuantity.setEngChgLevel(map1.get("ENG_CHG_LEVEL") == null ? "" : map1.get("ENG_CHG_LEVEL").toString()); // çæ¬å· |
| | | // ifsInventoryQuantity.setReceiver(map1.get("RECEIVER") == null ? "" : map1.get("RECEIVER").toString()); // æ¥æ¶äºº |
| | | // ifsInventoryQuantity.setReceiverName(map1.get("RECEIVER_NAME") == null ? "" : map1.get("RECEIVER_NAME").toString()); // æ¥æ¶äººåç§° |
| | | // ifsInventoryQuantity.setBuyerCode(map1.get("BUYER_CODE") == null ? "" : map1.get("BUYER_CODE").toString()); // éè´å |
| | | // ifsInventoryQuantity.setBuyerName(map1.get("BUYER_NAME") == null ? "" : map1.get("BUYER_NAME").toString()); // éè´ååç§° |
| | | // |
| | | // if(map1.get("ARRIVE_DATE") != null) { |
| | | // ifsInventoryQuantity.setArriveDate(LocalDateTime.parse(map1.get("ARRIVE_DATE").toString(),dateTimeFormatter)); // å®é
å°è´§æ¥æ |
| | | // } |
| | | // if(map1.get("DELIVERY_DATE") != null) { |
| | | // ifsInventoryQuantity.setDeliveryDate(LocalDateTime.parse(map1.get("DELIVERY_DATE").toString(),dateTimeFormatter)); // å®é
äº¤è´§æ¥æ |
| | | // } |
| | | // if(map1.get("PRODUCT_DATE") != null) { |
| | | // ifsInventoryQuantity.setProductDate(LocalDateTime.parse(map1.get("PRODUCT_DATE").toString(),dateTimeFormatter)); // çäº§æ¥æ |
| | | // |
| | | // } |
| | | // if(map1.get("INVALID_DATE") != null) { |
| | | // ifsInventoryQuantity.setInvalidDate(LocalDateTime.parse(map1.get("INVALID_DATE").toString(),dateTimeFormatter)); // å¤±ææ¥æ |
| | | // } |
| | | // if(map1.get("APPROVED_DATE") != null) { |
| | | // ifsInventoryQuantity.setApprovedDate(LocalDateTime.parse(map1.get("APPROVED_DATE").toString(),dateTimeFormatter)); // å®¡æ¹æ¥æ |
| | | // } |
| | | // ifsInventoryQuantity.setReqCeater(map1.get("REQ_CEATER") == null ? "" : map1.get("REQ_CEATER").toString()); // éè´ç³è¯·å建人 |
| | | // ifsInventoryQuantity.setReqCeaterName(map1.get("REQ_CEATER_NAME") == null ? "" : map1.get("REQ_CEATER_NAME").toString()); // éè´ç³è¯·å建人åç§° |
| | | // ifsInventoryQuantity.setLineRemarks(map1.get("LINE_REMARKS") == null ? "" : map1.get("LINE_REMARKS").toString()); // éè´è®¢åè¡å¤æ³¨ |
| | | // ifsInventoryQuantity.setBuyUnitMeas(map1.get("BUY_UNIT_MEAS") == null ? "" : map1.get("BUY_UNIT_MEAS").toString()); // éè´åä½ |
| | | // ifsInventoryQuantity.setReceiverDate(LocalDateTime.now()); // æ¥æ¶æ¥æ |
| | | // ifsInventoryQuantity.setIsSource(1); |
| | | // ifsInventoryQuantity.setState(0); |
| | | // |
| | | // IfsInventoryQuantity one = ifsInventoryQuantityMapper.selectOne(new LambdaQueryWrapper<IfsInventoryQuantity>() |
| | | // .eq(IfsInventoryQuantity::getOrderNo, ifsInventoryQuantity.getOrderNo()) |
| | | // .eq(IfsInventoryQuantity::getLineNo, ifsInventoryQuantity.getLineNo()) |
| | | // .eq(IfsInventoryQuantity::getReleaseNo, ifsInventoryQuantity.getReleaseNo()) |
| | | // .eq(IfsInventoryQuantity::getReceiptNo, ifsInventoryQuantity.getReceiptNo()) |
| | | // .eq(IfsInventoryQuantity::getLocationNo, ifsInventoryQuantity.getLocationNo()) |
| | | // .eq(IfsInventoryQuantity::getLotBatchNo, ifsInventoryQuantity.getLotBatchNo()) |
| | | // .eq(IfsInventoryQuantity::getSerialNo, ifsInventoryQuantity.getSerialNo()) |
| | | // .eq(IfsInventoryQuantity::getEngChgLevel, ifsInventoryQuantity.getEngChgLevel()) |
| | | // .eq(IfsInventoryQuantity::getWaivDevRejNo, ifsInventoryQuantity.getWaivDevRejNo()) |
| | | // .eq(IfsInventoryQuantity::getActivitySeq, ifsInventoryQuantity.getActivitySeq()) |
| | | // ); |
| | | // if(Objects.isNull(one)) { |
| | | // |
| | | // ifsInventoryQuantity.setIsFirst(0); |
| | | // // æ¥è¯¢äº§ä¸é¾æ£æµæ°æ® |
| | | // String industryChainAttrFields = IndustryChainUtils.getIndustryChainAttrFields(ifsInventoryQuantity.getOrderNo(), |
| | | // ifsInventoryQuantity.getLineNo(), |
| | | // ifsInventoryQuantity.getReleaseNo()); |
| | | // ifsInventoryQuantity.setIndustryChain(industryChainAttrFields); |
| | | // |
| | | // ifsInventoryQuantityMapper.insert(ifsInventoryQuantity); |
| | | // } |
| | | // } |
| | | // } |
| | | // |
| | | // /** |
| | | // * idæ¯åææçid |
| | | // * |
| | | // * ä¿®æ¹è®¢ååå· |
| | | // * @param insOrder |
| | | // */ |
| | | // @Override |
| | | // @Transactional(rollbackFor = Exception.class) |
| | | // public void updateEntrustCode(InsOrder insOrder) { |
| | | // // 夿å½åè®¢åæ¯å¦çæäºæ¥å, çæäºæ¥åä¸è½ä¿®æ¹åå· |
| | | // List<InsOrder> insOrders = insOrderMapper.selectList(Wrappers.<InsOrder>lambdaQuery() |
| | | // .eq(InsOrder::getIfsInventoryId, insOrder.getId()) |
| | | // .ne(InsOrder::getState, -1)); |
| | | // List<Integer> insOrderIds = insOrders.stream().map(InsOrder::getId).collect(Collectors.toList()); |
| | | // Long count = insReportMapper.selectCount(Wrappers.<InsReport>lambdaQuery() |
| | | // .in(InsReport::getInsOrderId, insOrderIds)); |
| | | // if (count > 0 ) { |
| | | // throw new ErrorException("å½å订åå·²ç»çæäºæ¥åä¸è½ä¿®æ¹ç¼å·"); |
| | | // } |
| | | // |
| | | // |
| | | // Long count1 = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery() |
| | | // .eq(InsOrder::getEntrustCode, insOrder.getEntrustCode()) |
| | | // .ne(InsOrder::getIfsInventoryId, insOrder.getId()) |
| | | // .ne(InsOrder::getInsState, -1)); |
| | | // if (count1 > 0) { |
| | | // throw new ErrorException("该ç¼å·éå¤"); |
| | | // } |
| | | // |
| | | // //ä¿®æ¹æ¥åçç¼å· |
| | | // insOrderMapper.update(null, Wrappers.<InsOrder>lambdaUpdate() |
| | | // .eq(InsOrder::getIfsInventoryId, insOrder.getId()) |
| | | // .set(InsOrder::getEntrustCode, insOrder.getEntrustCode())); |
| | | // |
| | | // // ä¿®æ¹æ ·åçç¼å· |
| | | // // æ¥è¯¢ææçæ ·å |
| | | // List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery() |
| | | // .in(InsSample::getInsOrderId, insOrderIds)); |
| | | // for (InsSample insSample : insSamples) { |
| | | // String sampleCode = insSample.getSampleCode(); |
| | | // String updateCode = insOrder.getEntrustCode(); |
| | | // // æ¥æ¾æåä¸ä¸ª'-'çä½ç½® |
| | | // int lastDashIndex = sampleCode.lastIndexOf('-'); |
| | | // if (lastDashIndex != -1) { |
| | | // int secondLastDashIndex = sampleCode.lastIndexOf('-', lastDashIndex - 1); |
| | | // // å¤çæåä¸ä¸ª'-'åçé¨å |
| | | // if (secondLastDashIndex != -1) { |
| | | // // å¤çæåä¸ä¸ª'-'åä¹åçé¨å |
| | | // String afterLastDash = sampleCode.substring(lastDashIndex); |
| | | // |
| | | // updateCode = updateCode + afterLastDash; |
| | | // } |
| | | // } |
| | | // insSampleMapper.update(null, Wrappers.<InsSample>lambdaUpdate() |
| | | // .eq(InsSample::getId, insSample.getId()) |
| | | // .set(InsSample::getSampleCode, updateCode)); |
| | | // |
| | | // } |
| | | // } |
| | | // |
| | | // @Override |
| | | // public List<InsUnqualifiedRetestProduct> getRetestResult(Integer insProductId) { |
| | | // return insUnqualifiedRetestProductMapper.selectList(Wrappers.<InsUnqualifiedRetestProduct>lambdaQuery() |
| | | // .eq(InsUnqualifiedRetestProduct::getInsProductId, insProductId)); |
| | | // } |
| | | // |
| | | // /** |
| | | // * ä¿®æ¹éè´è®¢åæ¥æ¶ç¶æ, é¿å
åæ» |
| | | // * @param id |
| | | // */ |
| | | // @Transactional |
| | | // public void updateIfsInventoryQuantity(Integer id) { |
| | | // ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate() |
| | | // .set(IfsInventoryQuantity::getIsRegister, 1) |
| | | // .eq(IfsInventoryQuantity::getId, id)); |
| | | // } |
| | | // |
| | | // /** |
| | | // * æ°å¢éåä¸ä¸å |
| | | // * @param list |
| | | // * @param insOrder |
| | | // * @return |
| | | // */ |
| | | // @Override |
| | | // public int addRawCopperOrder(List<SampleProductDto> list, CopperInsOrderDto insOrder) { |
| | | // insOrder.setState(1); |
| | | // insOrder.setTypeSource(1); |
| | | // |
| | | // LocalDate appointed = insOrder.getAppointed(); |
| | | // |
| | | // insOrderMapper.insert(insOrder); // 主表 |
| | | // |
| | | // list.forEach(a -> { |
| | | // a.setId(null); |
| | | // a.setInsOrderId(insOrder.getId()); |
| | | // insSampleMapper.insert(a); |
| | | // if (ObjectUtil.isNotEmpty(a.getInsProduct())) { |
| | | // // 夿æ¯å¦å¡«åå¾
æ£é¡¹æ°é |
| | | // if (a.getQuantity() != null) { |
| | | // List<InsProduct> ip2 = new ArrayList<>(); |
| | | // for (Integer i = 1; i <= a.getQuantity(); i++) { |
| | | // // éæ°æ·è´ å建æ°å¯¹è±¡ |
| | | // AtomicInteger atomicInteger = new AtomicInteger(i); |
| | | // List<InsProduct> insProducts = a.getInsProduct().stream().map(insProduct -> { |
| | | // insProduct.setRawMaterialTag(String.valueOf(atomicInteger.get())); |
| | | // InsProduct product = new InsProduct(); |
| | | // BeanUtils.copyProperties(insProduct, product); |
| | | // return product; |
| | | // }).collect(Collectors.toList()); |
| | | // |
| | | // ip2.addAll(insProducts); |
| | | // } |
| | | // addInsProductMethod(a.getId(), ip2); |
| | | // } else { |
| | | // addInsProductMethod(a.getId(), a.getInsProduct()); |
| | | // } |
| | | // } |
| | | // if (ObjectUtil.isNotEmpty(a.getChildSampleList())) { |
| | | // for (SampleProductDto b : a.getChildSampleList()) { |
| | | // for (int i = 0; i < b.getNum(); i++) { |
| | | // b.setId(null); |
| | | // b.setInsOrderId(insOrder.getId()); |
| | | // b.setParentId(a.getId()); |
| | | // insSampleMapper.insert(b); |
| | | // if (ObjectUtil.isNotEmpty(b.getInsProduct())) { |
| | | // addInsProductMethod(b.getId(), b.getInsProduct()); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // }); |
| | | // |
| | | // // æ·»å åææä¿¡æ¯ |
| | | // IfsInventoryQuantity ifsInventoryQuantity = new IfsInventoryQuantity(); |
| | | // // åºæ¬ä¿¡æ¯ |
| | | // ifsInventoryQuantity.setIsSource(0); |
| | | // ifsInventoryQuantity.setIsInspect(1); |
| | | // ifsInventoryQuantity.setState(1); |
| | | // ifsInventoryQuantity.setIsFinish(0); |
| | | // ifsInventoryQuantity.setIsCopper(1); |
| | | // ifsInventoryQuantity.setIsQuarter(0); |
| | | // ifsInventoryQuantity.setInspectStatus(0); |
| | | // |
| | | // ifsInventoryQuantity.setQtyArrived(insOrder.getQtyArrived()); |
| | | // ifsInventoryQuantity.setBuyUnitMeas(insOrder.getBuyUnitMeas()); |
| | | // ifsInventoryQuantity.setSupplierName(insOrder.getSupplierName()); |
| | | // ifsInventoryQuantity.setUpdateBatchNo(insOrder.getUpdateBatchNo()); |
| | | // ifsInventoryQuantity.setDeclareDate(insOrder.getDeclareDate()); |
| | | // |
| | | // ifsInventoryQuantityMapper.insert(ifsInventoryQuantity); |
| | | // |
| | | // |
| | | // insOrder.setIfsInventoryId(ifsInventoryQuantity.getId()); |
| | | // insOrder.setState(1); |
| | | // |
| | | // |
| | | // upInsOrderOfState(insOrder); |
| | | // upInsOrder(insOrder.getId(), null, appointed != null ? appointed.toString() : null, SecurityUtils.getUserId().intValue(), "åææ"); |
| | | // |
| | | // return insOrder.getId(); |
| | | // } |
| | | // |
| | | // /** |
| | | // * ä¿®æ¹å§æä¸åç¼å· |
| | | // * @param insOrder |
| | | // */ |
| | | // @Override |
| | | // public void updateOrderEntrustCode(InsOrder insOrder) { |
| | | // // 夿å½åè®¢åæ¯å¦çæäºæ¥å, çæäºæ¥åä¸è½ä¿®æ¹åå· |
| | | // Long count = insReportMapper.selectCount(Wrappers.<InsReport>lambdaQuery() |
| | | // .eq(InsReport::getInsOrderId, insOrder.getId())); |
| | | // if (count > 0 ) { |
| | | // throw new ErrorException("å½å订åå·²ç»çæäºæ¥åä¸è½ä¿®æ¹ç¼å·"); |
| | | // } |
| | | // |
| | | // Long count1 = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery() |
| | | // .eq(InsOrder::getEntrustCode, insOrder.getEntrustCode())); |
| | | // if (count1 > 0) { |
| | | // throw new ErrorException("该ç¼å·éå¤"); |
| | | // } |
| | | // |
| | | // //ä¿®æ¹æ¥åçç¼å· |
| | | // insOrderMapper.update(null, Wrappers.<InsOrder>lambdaUpdate() |
| | | // .eq(InsOrder::getId, insOrder.getId()) |
| | | // .set(InsOrder::getEntrustCode, insOrder.getEntrustCode())); |
| | | // |
| | | // // ä¿®æ¹æ ·åçç¼å· |
| | | // // æ¥è¯¢ææçæ ·å |
| | | // List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery() |
| | | // .eq(InsSample::getInsOrderId, insOrder.getId())); |
| | | // for (InsSample insSample : insSamples) { |
| | | // String sampleCode = insSample.getSampleCode(); |
| | | // String updateCode = insOrder.getEntrustCode(); |
| | | // // æ¥æ¾æåä¸ä¸ª'-'çä½ç½® |
| | | // int lastDashIndex = sampleCode.lastIndexOf('-'); |
| | | // if (lastDashIndex != -1) { |
| | | // int secondLastDashIndex = sampleCode.lastIndexOf('-', lastDashIndex - 1); |
| | | // // å¤çæåä¸ä¸ª'-'åçé¨å |
| | | // if (secondLastDashIndex != -1) { |
| | | // // å¤çæåä¸ä¸ª'-'åä¹åçé¨å |
| | | // String afterLastDash = sampleCode.substring(lastDashIndex); |
| | | // |
| | | // updateCode = updateCode + afterLastDash; |
| | | // } |
| | | // } |
| | | // insSampleMapper.update(null, Wrappers.<InsSample>lambdaUpdate() |
| | | // .eq(InsSample::getId, insSample.getId()) |
| | | // .set(InsSample::getSampleCode, updateCode)); |
| | | // |
| | | // } |
| | | // } |
| | | // |
| | | // /** |
| | | // * ä¿®æ¹æ£éªä¸åå
容 |
| | | // * @param insOrderUpdateDto |
| | | // * @return |
| | | // */ |
| | | // @Override |
| | | // @Transactional(rollbackFor = Exception.class) |
| | | // public Boolean updateInsOrder(InsOrderUpdateDto insOrderUpdateDto) { |
| | | // // ä¿®æ¹è®¢å |
| | | // insOrderUpdateDto.getInsOrder().setState(0); |
| | | // insOrderUpdateDto.getInsOrder().setTell(""); |
| | | // insOrderMapper.updateById(insOrderUpdateDto.getInsOrder()); |
| | | // |
| | | // // ä¿®æ¹æ£éªé¡¹ |
| | | // for (SampleProductDto sampleProductDto : insOrderUpdateDto.getSampleProduct()) { |
| | | // insProductService.updateBatchById(sampleProductDto.getInsProduct()); |
| | | // } |
| | | // |
| | | // return true; |
| | | // } |
| | | // |
| | | // /** |
| | | // * æåæ ç¾æå° |
| | | // * @param ids |
| | | // * @return |
| | | // */ |
| | | // @Override |
| | | // public List<InsOrderPrintingVo> labelOrderPrinting(List<Integer> ids) { |
| | | // return insOrderMapper.labelOrderPrinting(ids); |
| | | // } |
| | | // |
| | | // /** |
| | | // * æ ¹æ®æ ·åidæ¥è¯¢æ£éªé¡¹æ |
| | | // * @param insSampleId |
| | | // * @return |
| | | // */ |
| | | // @Override |
| | | // public List<StandardProductList> getProductTreeBySampleId(Integer insSampleId) { |
| | | // // æ¥è¯¢ç¬¬ä¸ä¸ªæ£éªé¡¹è·åæ£éªé¡¹æ |
| | | // InsProduct insProduct = insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery() |
| | | // .eq(InsProduct::getInsSampleId, insSampleId) |
| | | // .last("limit 1")); |
| | | // String tree = insProduct.getFactory() + " - " + |
| | | // insProduct.getLaboratory() + " - " + |
| | | // insProduct.getSampleType() + " - " + |
| | | // insProduct.getSample() + " - " + |
| | | // insProduct.getModel(); |
| | | // // æ¥è¯¢æ åæ |
| | | // List<StandardProductList> standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery() |
| | | // .eq(StandardProductList::getStandardMethodListId, insProduct.getStandardMethodListId()) |
| | | // .eq(StandardProductList::getTree, tree)); |
| | | // for (StandardProductList standardProductList : standardProductLists) { |
| | | // standardProductList.setId(null); |
| | | // } |
| | | // |
| | | // return standardProductLists; |
| | | // } |
| | | // |
| | | // /** |
| | | // * æ·»å éæ¼çæ£éªé¡¹ |
| | | // * @param omitOrderProductDto |
| | | // * @return |
| | | // */ |
| | | // @Override |
| | | // public boolean addOmitOrderProduct(OmitOrderProductDto omitOrderProductDto) { |
| | | // if (omitOrderProductDto.getInsSampleId() == null) { |
| | | // throw new ErrorException("ç¼ºå°æ ·åId"); |
| | | // } |
| | | // for (InsProduct product : omitOrderProductDto.getInsProductBindingList()) { |
| | | // if (product.getState() == 1) { |
| | | // product.setId(null); |
| | | // product.setCreateTime(null); |
| | | // product.setCreateUser(null); |
| | | // product.setUpdateTime(null); |
| | | // product.setUpdateUser(null); |
| | | // product.setInsSampleId(omitOrderProductDto.getInsSampleId()); |
| | | // if (StringUtils.isBlank(product.getCableTag())) { |
| | | // product.setCableTag(null); |
| | | // } |
| | | // if (product.getInspectionItemSubclass() == null) { |
| | | // product.setInspectionItemSubclass(""); |
| | | // } |
| | | // if (StringUtils.isBlank(product.getAsk()) || StringUtils.isBlank(product.getTell())) { |
| | | // throw new ErrorException("ææ£éªé¡¹çè¦æ±å¼æè¦æ±æè¿°ä¸ºç©º, 请填åè¦æ±å¼æè¦æ±æè¿°"); |
| | | // } |
| | | // insProductMapper.insert(product); |
| | | // } |
| | | // } |
| | | // |
| | | // return true; |
| | | // } |
| | | // |
| | | // /** |
| | | // * æåæ£éªåå¯¼åº |
| | | // * @param sampleOrderDto |
| | | // * @param response |
| | | // */ |
| | | // @Override |
| | | // public void rawAllInsOrderExport(SampleOrderDto sampleOrderDto, HttpServletResponse response) { |
| | | // //夿å
¨é¨,个人,ç»ç»çæé |
| | | // //todo:ä»
çæè·åå½å人æå±å®éªå®¤id |
| | | // String laboratory = null; |
| | | // // 夿æ¯å¦æ¯å
¨é¨ |
| | | // String isOrderAll = null; |
| | | // if (sampleOrderDto.getState() != null && sampleOrderDto.getState() == -2) { |
| | | // isOrderAll = "1"; |
| | | // sampleOrderDto.setState(null); |
| | | // } |
| | | // List<SampleOrderDto> sampleOrderDtoList = insOrderMapper.rawAllInsOrderExport(QueryWrappers.queryWrappers(sampleOrderDto), laboratory, isOrderAll); |
| | | // |
| | | // // 夿æ¯å¦æ¯ä¸åæ ¼, ä¸åæ ¼æ¥è¯¢ä¸åæ ¼é¡¹ |
| | | // for (SampleOrderDto orderDto : sampleOrderDtoList) { |
| | | // if (orderDto.getInsResult() != null && orderDto.getInsResult() == 0){ |
| | | // // æ¥è¯¢ä¸åæ ¼é¡¹ |
| | | // List<String> unqualifiedList = insProductMapper.selectUnqualifiedList(orderDto.getId()); |
| | | // orderDto.setUnqualifiedItem(CollUtil.join(unqualifiedList, ",")); |
| | | // } |
| | | // orderDto.setCreateTimeString(orderDto.getCreateTime() == null ? "" : orderDto.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | // |
| | | // } |
| | | // |
| | | // response.setContentType("application/vnd.ms-excel"); |
| | | // response.setCharacterEncoding("UTF-8"); |
| | | // try { |
| | | // // è¿éURLEncoder.encodeå¯ä»¥é²æ¢ä¸æä¹±ç å½ç¶åeasyexcel没æå
³ç³» |
| | | // String fileName = URLEncoder.encode("å§ææ£æµä¿¡æ¯å¯¼åº", "UTF-8"); |
| | | // response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); |
| | | // //æ°å»ºExcelWriter |
| | | // ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).build(); |
| | | // //è·åsheet0对象 |
| | | // WriteSheet mainSheet = EasyExcel.writerSheet(0, "å§ææ£æµä¿¡æ¯å¯¼åº").head(SampleOrderDto.class).build(); |
| | | // |
| | | // //åsheet0åå
¥æ°æ® ä¼ å
¥ç©ºlistè¿æ ·åªå¯¼åºè¡¨å¤´ |
| | | // excelWriter.write(sampleOrderDtoList, mainSheet); |
| | | // //å
³éæµ |
| | | // excelWriter.finish(); |
| | | // } catch (IOException e) { |
| | | // throw new RuntimeException("导åºå¤±è´¥"); |
| | | // } |
| | | // } |
| | | // |
| | | //} |
| | | // |
| | | // |
| | | // |
| | | // |
| | | package com.ruoyi.inspect.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.alibaba.excel.ExcelWriter; |
| | | import com.alibaba.excel.write.metadata.WriteSheet; |
| | | import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; |
| | | import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.mapper.IfsInventoryQuantityMapper; |
| | | import com.ruoyi.basic.mapper.StandardProductListMapper; |
| | | import com.ruoyi.basic.pojo.IfsInventoryQuantity; |
| | | import com.ruoyi.basic.pojo.StandardProductList; |
| | | import com.ruoyi.basic.pojo.StructureTestObject; |
| | | import com.ruoyi.common.constant.InsOrderTypeConstants; |
| | | import com.ruoyi.common.core.domain.entity.User; |
| | | import com.ruoyi.common.numgen.NumberGenerator; |
| | | import com.ruoyi.common.utils.*; |
| | | import com.ruoyi.framework.exception.ErrorException; |
| | | import com.ruoyi.inspect.dto.*; |
| | | import com.ruoyi.inspect.mapper.*; |
| | | import com.ruoyi.inspect.pojo.*; |
| | | import com.ruoyi.inspect.service.InsOrderService; |
| | | import com.ruoyi.inspect.service.InsProductService; |
| | | import com.ruoyi.inspect.service.InsSampleService; |
| | | import com.ruoyi.inspect.vo.InsOrderPrintingVo; |
| | | import com.ruoyi.inspect.vo.SampleDefectsFatherVo; |
| | | import com.ruoyi.system.mapper.CustomMapper; |
| | | import com.ruoyi.system.mapper.UserMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.net.URLEncoder; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.Month; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author gaoaoy |
| | | * @description é对表ãins_order(æ£éªä¸å)ãçæ°æ®åºæä½Serviceå®ç° |
| | | * @createDate 2024-03-12 16:17:55 |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class InsOrderServiceImpl extends ServiceImpl<InsOrderMapper, InsOrder> |
| | | implements InsOrderService { |
| | | |
| | | private InsOrderMapper insOrderMapper; |
| | | private InsSampleService insSampleService; |
| | | private InsSampleMapper insSampleMapper; |
| | | private InsProductService insProductService; |
| | | private InsProductMapper insProductMapper; |
| | | private InsProductUserMapper insProductUserMapper; |
| | | private InsSampleUserMapper insSampleUserMapper; |
| | | private InsOrderStateMapper insOrderStateMapper; |
| | | private UserMapper userMapper; |
| | | private IfsInventoryQuantityMapper ifsInventoryQuantityMapper; |
| | | private CustomMapper customMapper; |
| | | private final NumberGenerator<InsOrder> numberGenerator; |
| | | private InsReportMapper insReportMapper; |
| | | private InsUnqualifiedRetestProductMapper insUnqualifiedRetestProductMapper; |
| | | private IfsApiUtils ifsApiUtils; |
| | | private SpotCheckQuarterItemMapper spotCheckQuarterItemMapper; |
| | | private StandardProductListMapper standardProductListMapper; |
| | | |
| | | |
| | | |
| | | //è·åæ£éªä¸åæ°æ® |
| | | @Override |
| | | public IPage<SampleOrderDto> selectInsOrderParameter(IPage<InsOrder> page, SampleOrderDto sampleOrderDto) { |
| | | //todo: åªçæå¤æå
¨é¨,个人,ç»ç»çæé |
| | | String laboratory = null; |
| | | // 夿æ¯å¦æ¯å
¨é¨ |
| | | String isOrderAll = null; |
| | | if (sampleOrderDto.getState() != null && sampleOrderDto.getState() == -2) { |
| | | isOrderAll = "1"; |
| | | sampleOrderDto.setState(null); |
| | | } |
| | | IPage<SampleOrderDto> sampleOrderDtoIPage = insOrderMapper.selectInsOrderPage(page, QueryWrappers.queryWrappers(sampleOrderDto), laboratory, isOrderAll); |
| | | return insOrderMapper.selectInsOrderPage(page, QueryWrappers.queryWrappers(sampleOrderDto), laboratory, isOrderAll); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int upInsOrder(Integer orderId, Integer sampleId, String appointed, Integer userId, String sonLaboratory) { |
| | | InsOrder insOrder = new InsOrder(); |
| | | insOrder.setId(orderId); |
| | | insOrder.setAppointed(StringUtils.isNotEmpty(appointed) ? LocalDate.parse(appointed) : null); |
| | | insOrder.setSendTime(LocalDateTime.now()); |
| | | insOrderMapper.updateById(insOrder); |
| | | List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId).select(InsSample::getId)); |
| | | List<Integer> ids = insSamples.stream().map(a -> a.getId()).collect(Collectors.toList()); |
| | | List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() |
| | | .in(InsProduct::getInsSampleId, ids) |
| | | .eq(InsProduct::getState, 1) |
| | | .select(InsProduct::getSonLaboratory).groupBy(InsProduct::getSonLaboratory)); |
| | | for (InsProduct insProduct : insProducts) { |
| | | InsOrderState insOrderState = new InsOrderState(); |
| | | insOrderState.setInsOrderId(orderId); |
| | | try { |
| | | insOrderState.setLaboratory(insProduct.getSonLaboratory()); |
| | | } catch (NullPointerException e) { |
| | | throw new ErrorException("该æ£éªåææªç»´æ¤å®éªå®¤çæ£éªé¡¹ç®"); |
| | | } |
| | | insOrderState.setInsState(0); |
| | | insOrderStateMapper.insert(insOrderState); |
| | | } |
| | | if (userId != null) { |
| | | InsSampleUser insSampleUser = new InsSampleUser(); |
| | | insSampleUser.setState(0); |
| | | insSampleUser.setUserId(userId); |
| | | insSampleUser.setInsSampleId(orderId); |
| | | insSampleUser.setSonLaboratory(sonLaboratory); |
| | | insSampleUserMapper.insert(insSampleUser); |
| | | } |
| | | |
| | | // å¤æè®¢åææ²¡æç»å®æ½æ ·è®¡å |
| | | InsOrder order = insOrderMapper.selectById(orderId); |
| | | if (order.getQuarterItemId() != null) { |
| | | // éè¦æ·»å ä¸åæ¶é´å°æ½æ ·æ¶é´, åæ ·äººåå°±æ¯æ£æµäºº |
| | | SpotCheckQuarterItem spotCheckQuarterItem = spotCheckQuarterItemMapper.selectById(order.getQuarterItemId()); |
| | | spotCheckQuarterItem.setSpotCheckTime(order.getSendTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); |
| | | User user = userMapper.selectById(userId); |
| | | spotCheckQuarterItem.setSamplingUser(user.getName()); |
| | | spotCheckQuarterItemMapper.updateById(spotCheckQuarterItem); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int addInsOrder(List<SampleProductDto> list, InsOrder insOrder, List<List<Integer>> pairing) { |
| | | // todo: ä¸åå¤ææ½æ ·è®¡åçå¯ä¸æ§ |
| | | if (insOrder.getQuarterItemId() != null) { |
| | | Long quarterItemCount = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery() |
| | | .eq(InsOrder::getQuarterItemId, insOrder.getQuarterItemId()) |
| | | .notIn(InsOrder::getState, -1 ,2 ,3)); |
| | | if (quarterItemCount > 0) { |
| | | throw new ErrorException("è¯¥æ½æ ·è®¡å已被ç»å®è¿"); |
| | | } |
| | | } |
| | | |
| | | insOrder.setState(0); |
| | | |
| | | LocalDate appointed = insOrder.getAppointed(); |
| | | |
| | | insOrderMapper.insert(insOrder); // 主表 |
| | | |
| | | list.forEach(a -> { |
| | | a.setId(null); |
| | | a.setInsOrderId(insOrder.getId()); |
| | | insSampleMapper.insert(a); |
| | | if (ObjectUtil.isNotEmpty(a.getInsProduct())) { |
| | | // 夿æ¯å¦å¡«åå¾
æ£é¡¹æ°é |
| | | if (a.getQuantity() != null) { |
| | | List<InsProduct> ip2 = new ArrayList<>(); |
| | | for (Integer i = 1; i <= a.getQuantity(); i++) { |
| | | // éæ°æ·è´ å建æ°å¯¹è±¡ |
| | | AtomicInteger atomicInteger = new AtomicInteger(i); |
| | | List<InsProduct> insProducts = a.getInsProduct().stream().map(insProduct -> { |
| | | insProduct.setRawMaterialTag(String.valueOf(atomicInteger.get())); |
| | | InsProduct product = new InsProduct(); |
| | | BeanUtils.copyProperties(insProduct, product); |
| | | return product; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | ip2.addAll(insProducts); |
| | | } |
| | | addInsProductMethod(a.getId(), ip2); |
| | | } else { |
| | | addInsProductMethod(a.getId(), a.getInsProduct()); |
| | | } |
| | | } |
| | | // 夿æ¯å¦æçµç¼é
ç½® |
| | | if (ObjectUtil.isNotEmpty(a.getInsulating())) { |
| | | // 夿æ¯å¦æè¾
å©çº¿è¯ |
| | | if (ObjectUtil.isNotEmpty(a.getAuxiliaryWireCore())) { |
| | | if (a.getAuxiliaryWireCore().getInsProduct().stream().filter(insProduct -> insProduct.getState() == 1).count() != |
| | | a.getInsulating().getInsProduct().stream().filter(insProduct -> insProduct.getState() == 1).count()) { |
| | | throw new ErrorException("çµç¼é
ç½®è¾
å©çº¿è¯æ£éªé¡¹æ°éä¸ç»ä¸, è¯·æ£æ¥"); |
| | | } |
| | | } |
| | | List<InsProduct> ip2 = new ArrayList<>(); |
| | | for (String s : a.getInsulating().getNum()) { |
| | | // éæ°æ·è´ å建æ°å¯¹è±¡ |
| | | List<InsProduct> insProducts = a.getInsulating().getInsProduct().stream().map(insProduct -> { |
| | | insProduct.setCableTag(s); |
| | | InsProduct product = new InsProduct(); |
| | | BeanUtils.copyProperties(insProduct, product); |
| | | return product; |
| | | }).collect(Collectors.toList()); |
| | | ip2.addAll(insProducts); |
| | | } |
| | | for (InsProduct product : ip2) { |
| | | product.setStandardMethodListId(a.getInsulating().getStandardMethodListId()); |
| | | } |
| | | addInsProductMethod(a.getId(), ip2); |
| | | } |
| | | // 夿æ¯å¦æè¾
å©çº¿è¯ |
| | | if (ObjectUtil.isNotEmpty(a.getAuxiliaryWireCore())) { |
| | | List<InsProduct> ip2 = new ArrayList<>(); |
| | | for (String s : a.getAuxiliaryWireCore().getNum()) { |
| | | // éæ°æ·è´ å建æ°å¯¹è±¡ |
| | | List<InsProduct> insProducts = a.getAuxiliaryWireCore().getInsProduct().stream().map(insProduct -> { |
| | | insProduct.setCableTag(s); |
| | | InsProduct product = new InsProduct(); |
| | | BeanUtils.copyProperties(insProduct, product); |
| | | return product; |
| | | }).collect(Collectors.toList()); |
| | | ip2.addAll(insProducts); |
| | | } |
| | | for (InsProduct product : ip2) { |
| | | product.setStandardMethodListId(a.getAuxiliaryWireCore().getStandardMethodListId()); |
| | | } |
| | | addInsProductMethod(a.getId(), ip2); |
| | | } |
| | | // åæ ·åé
ç½® |
| | | if (ObjectUtil.isNotEmpty(a.getChildSampleList())) { |
| | | for (SampleProductDto b : a.getChildSampleList()) { |
| | | for (int i = 0; i < b.getNum(); i++) { |
| | | b.setId(null); |
| | | b.setInsOrderId(insOrder.getId()); |
| | | b.setParentId(a.getId()); |
| | | insSampleMapper.insert(b); |
| | | if (ObjectUtil.isNotEmpty(b.getInsProduct())) { |
| | | addInsProductMethod(b.getId(), b.getInsProduct()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | //æ¯å¦ä¸ºåææä¸å |
| | | if (insOrder.getTypeSource() != null && insOrder.getTypeSource().equals(1)) { |
| | | // åææä¸å: å§æäººå°±æ¯æ¥æ£äºº, ç产åä½å°±æ¯ä¾åºååä½ |
| | | IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(insOrder.getIfsInventoryId()); |
| | | Integer declareUserId = ifsInventoryQuantity.getDeclareUserId(); |
| | | User user = userMapper.selectById(declareUserId); |
| | | if (user == null) { |
| | | throw new ErrorException("ç¼ºå°æ¥æ£äººä¿¡æ¯"); |
| | | } |
| | | // ä¾åºååç§° |
| | | insOrder.setProduction(ifsInventoryQuantity.getSupplierName()); |
| | | insOrder.setProductionEn(""); |
| | | // å§æäººåç§° |
| | | insOrder.setPrepareUserId(user.getId()); |
| | | insOrder.setPrepareUser(user.getName()); |
| | | insOrder.setPrepareUserEn(user.getNameEn()); |
| | | insOrder.setPhone(user.getPhone()); |
| | | insOrder.setState(1); |
| | | Long count1 = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery() |
| | | .eq(InsOrder::getIfsInventoryId, insOrder.getIfsInventoryId()) |
| | | .ne(InsOrder::getState, -1) |
| | | .eq(InsOrder::getOrderType, InsOrderTypeConstants.ENTER_THE_FACTORY) |
| | | .ne(InsOrder::getId, insOrder.getId())); |
| | | // 夿ä¹åæ¯å¦æè¿åæ£éª |
| | | if (count1 == 0) { |
| | | ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>().set(IfsInventoryQuantity::getState, 1) |
| | | .eq(IfsInventoryQuantity::getId, insOrder.getIfsInventoryId())); |
| | | } |
| | | |
| | | // å¤æç»æç¶æä¿®æ¹åæ ¼ç¶æ |
| | | if (ifsInventoryQuantity.getIsFinish().equals(0)) { |
| | | ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate() |
| | | .eq(IfsInventoryQuantity::getId, insOrder.getIfsInventoryId()) |
| | | .set(IfsInventoryQuantity::getInspectStatus, 0)); |
| | | } |
| | | |
| | | upInsOrderOfState(insOrder); |
| | | upInsOrder(insOrder.getId(), null, appointed != null ? appointed.toString() : null, SecurityUtils.getUserId().intValue(), "åææ"); |
| | | |
| | | |
| | | // æ ¹æ®é¶ä»¶å·å¤ææ¯å¦æ¯è¾
æ |
| | | boolean isRaw = false; |
| | | StructureTestObject productObject = insOrderMapper.selectProductByPartNo(ifsInventoryQuantity.getPartNo()); |
| | | // æ¥è¯¢äº§å |
| | | if (productObject != null && StrUtil.isNotBlank(productObject.getObjectType()) && productObject.getObjectType().equals("1")) { |
| | | isRaw = true; |
| | | } else { |
| | | // æ¥è¯¢å¯¹è±¡ |
| | | StructureTestObject testObject = insOrderMapper.selectByPartNo(ifsInventoryQuantity.getPartNo()); |
| | | if (testObject != null && StrUtil.isNotBlank(testObject.getObjectType()) && testObject.getObjectType().equals("1")) { |
| | | isRaw = true; |
| | | } |
| | | } |
| | | |
| | | if (isRaw) { |
| | | // è·åå½åå£åº¦çå¼å§æ¶é´åç»ææ¶é´ |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | // è·åå½åæä»½ |
| | | int month = now.getMonthValue(); |
| | | // ç¡®å®å½åå£åº¦çå¼å§æä»½ |
| | | int startMonth = (month - 1) / 3 * 3 + 1; |
| | | // æé å£åº¦çå¼å§æ¶é´ |
| | | LocalDateTime startOfQuarter = LocalDateTime.of(now.getYear(), Month.of(startMonth), 1, 0, 0); |
| | | // 计ç®ä¸ä¸ä¸ªå£åº¦çå¼å§æ¶é´ |
| | | LocalDateTime startOfNextQuarter = startOfQuarter.plusMonths(3); |
| | | // 计ç®å½åå£åº¦çç»ææ¶é´ |
| | | LocalDateTime endOfQuarter = startOfNextQuarter.minusSeconds(1); |
| | | |
| | | // æ ¹æ®ä¸åçè§æ ¼åå·å¤ææ¯å¦ä¸ºå£åº¦é¦æ¬¡åºç° |
| | | Integer count = ifsInventoryQuantityMapper.selectIsFirst(insOrder.getPartDetail(), |
| | | ifsInventoryQuantity.getSupplierName(), |
| | | startOfNextQuarter, |
| | | endOfQuarter); |
| | | |
| | | if(count == 0) { |
| | | ifsInventoryQuantity.setIsFirst(1); |
| | | ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate() |
| | | .eq(IfsInventoryQuantity::getId, insOrder.getIfsInventoryId()) |
| | | .set(IfsInventoryQuantity::getIsFirst, 1)); |
| | | } |
| | | } |
| | | } |
| | | return insOrder.getId(); |
| | | } |
| | | |
| | | /** |
| | | * æ·»å æ£éªé¡¹ |
| | | * @param sampleId |
| | | * @param productList |
| | | */ |
| | | private void addInsProductMethod(Integer sampleId, List<InsProduct> productList) { |
| | | for (InsProduct product : productList) { |
| | | if (product.getState() == 1) { |
| | | product.setId(null); |
| | | product.setCreateTime(null); |
| | | product.setCreateUser(null); |
| | | product.setUpdateTime(null); |
| | | product.setUpdateUser(null); |
| | | product.setInsSampleId(sampleId); |
| | | if (product.getInspectionItemSubclass() == null) { |
| | | product.setInspectionItemSubclass(""); |
| | | } |
| | | if (StringUtils.isBlank(product.getAsk()) || StringUtils.isBlank(product.getTell())) { |
| | | throw new ErrorException("ææ£éªé¡¹çè¦æ±å¼æè¦æ±æè¿°ä¸ºç©º, 请å
廿 ååºé
ç½®è¦æ±å¼æè¦æ±æè¿°"); |
| | | } |
| | | insProductMapper.insert(product); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public Map<String, Object> getInsOrder(Integer id) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | InsOrder insOrder = insOrderMapper.selectById(id); |
| | | List<SampleProductDto> list; |
| | | // 夿æ¯å¦æ¯è¿åæ¥åå
æ£ |
| | | if (insOrder.getIsExemption().equals(1)) { |
| | | list = insSampleMapper.selectExemptionByOrderId(id); |
| | | } else { |
| | | list = insSampleMapper.selectSampleProductListByOrderId2(id); |
| | | } |
| | | Map<String, Object> map1 = insSampleMapper.selectInsOrder(id); |
| | | map.put("insOrder", insOrder); |
| | | map.put("sampleProduct", list); |
| | | map.put("insOrderTemplate", map1); |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | public int upInsOrderOfState(InsOrder insOrder) { |
| | | insOrder.setExamineTime(LocalDateTime.now()); |
| | | if (insOrder.getState() == 1) { |
| | | //å®¡æ ¸éè¿æä¼çæå§æç¼å· |
| | | // todo: æ£éªç±»åç¼å· |
| | | InsOrder order = this.getById(insOrder.getId()); |
| | | String code = ""; |
| | | switch (order.getOrderType()) { |
| | | case InsOrderTypeConstants.SPOT_CHECK: |
| | | code = "C"; |
| | | break; |
| | | case InsOrderTypeConstants.CUSTOMER_ORDERED: |
| | | code = "W"; |
| | | break; |
| | | case InsOrderTypeConstants.ENTER_THE_FACTORY: |
| | | case InsOrderTypeConstants.QUARTERLY_TEST: |
| | | code = "Y"; |
| | | break; |
| | | } |
| | | // çæç¼å· |
| | | String no = numberGenerator.generateNumberWithPrefix(3, |
| | | "JCZX/ZB-" + code + LimsDateUtil.resetDate(LocalDateTime.now()), |
| | | InsOrder::getEntrustCode); |
| | | // 夿æ¯å¦æ¯å£åº¦æ£éª, æ¯å£åº¦æ£éªåæ¶åææå£åº¦æ£éªä¸å |
| | | if (InsOrderTypeConstants.QUARTERLY_TEST.equals(order.getOrderType())) { |
| | | ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate() |
| | | .eq(IfsInventoryQuantity::getId, order.getIfsInventoryId()) |
| | | .set(IfsInventoryQuantity::getIsQuarter, 0)); |
| | | |
| | | // æ¥è¯¢æ¯å¦æè¿è¿åæ£éª, æè·åéé¢çç¼å· |
| | | InsOrder order1 = insOrderMapper.selectOne(Wrappers.<InsOrder>lambdaQuery() |
| | | .eq(InsOrder::getIfsInventoryId, order.getIfsInventoryId()) |
| | | .ne(InsOrder::getState, -1) |
| | | .eq(InsOrder::getOrderType, InsOrderTypeConstants.ENTER_THE_FACTORY)); |
| | | if (order1 != null) { |
| | | no = order1.getEntrustCode(); |
| | | } |
| | | } |
| | | |
| | | int count = 1; |
| | | // æ¥è¯¢æ ·å表 |
| | | List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery() |
| | | .eq(InsSample::getInsOrderId, insOrder.getId())); |
| | | for (InsSample insSample : insSamples) { |
| | | if (StringUtils.isBlank(insSample.getSampleCode())) { |
| | | // å¦æåªæä¸ä¸ªæ ·åå°±ä¸éè¦æ¼æ¥æ°å |
| | | if (insSamples.size() != 1) { |
| | | insSample.setSampleCode(no + "-" + count); |
| | | count++; |
| | | } else { |
| | | insSample.setSampleCode(no); |
| | | } |
| | | } |
| | | } |
| | | insSampleService.updateBatchById(insSamples); |
| | | |
| | | insOrder.setEntrustCode(no); |
| | | } |
| | | return insOrderMapper.updateById(insOrder); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getInsOrderAndSample(Integer id, String laboratory) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | InsOrder insOrder = insOrderMapper.selectById(id); |
| | | List<SampleProductDto> list = insSampleMapper.getInsOrderAndSample(id, laboratory); |
| | | for (SampleProductDto sampleProductDto : list) { |
| | | List<Integer> ids = sampleProductDto.getInsProduct().stream().map(InsProduct::getId).collect(Collectors.toList()); |
| | | List<InsProductUser> insProductUsers = insProductUserMapper.selectList(Wrappers.<InsProductUser>lambdaQuery() |
| | | .in(InsProductUser::getInsProductId, ids)); |
| | | if (CollectionUtils.isNotEmpty(insProductUsers)) { |
| | | List<Integer> userIds = insProductUsers.stream().map(InsProductUser::getCreateUser).distinct().collect(Collectors.toList()); |
| | | String collect = userMapper.selectBatchIds(userIds).stream().map(User::getName).collect(Collectors.joining(",")); |
| | | sampleProductDto.setCheckName(collect); |
| | | } |
| | | } |
| | | map.put("insOrder", insOrder); |
| | | map.put("sampleProduct", list); |
| | | //æ¥è¯¢ææè®°å½æ¨¡çå»é |
| | | List<Map<Integer, Object>> list2 = insOrderMapper.selectReportModelByOrderId(id, laboratory); |
| | | map.put("reportModel", list2); |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | public IPage<SampleProductDto2> selectSampleAndProductByOrderId(IPage<SampleProductDto2> page, SampleProductDto2 sampleProductDto) { |
| | | IPage<SampleProductDto2> productDto2IPage = insOrderMapper.selectSampleAndProductByOrderId(page, |
| | | QueryWrappers.queryWrappers(sampleProductDto) |
| | | .orderByAsc("sample_code") |
| | | .orderByAsc("cable_tag") |
| | | .orderByAsc("sort"), |
| | | sampleProductDto.getId()); |
| | | return productDto2IPage; |
| | | } |
| | | |
| | | @Override |
| | | public IPage<CostStatisticsDto> costStatistics(IPage<CostStatisticsDto> page, CostStatisticsDto costStatisticsDto) { |
| | | String dates = costStatisticsDto.getDates(); |
| | | String[] split = dates.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); |
| | | costStatisticsDto.setDates(null); |
| | | |
| | | //todo:ä»
çèªå·± |
| | | |
| | | IPage<CostStatisticsDto> dtoIPage = insOrderMapper.selectCostStatistics(page, QueryWrappers.queryWrappers(costStatisticsDto).ge("create_time", split[0]).le("create_time", split[1] + " 23:59:59")); |
| | | List<CostStatisticsDto> collect = dtoIPage.getRecords().stream().map(dto -> { |
| | | Set<String> uniqueTags = new HashSet<>(); |
| | | if (dto.getInspectionItem().contains(",")) { |
| | | for (String s : dto.getInspectionItem().split(",")) { |
| | | uniqueTags.add(s.split("@")[0]); |
| | | } |
| | | } else { |
| | | uniqueTags.add(dto.getInspectionItem().split("@")[0]); |
| | | } |
| | | dto.setInspectionItem(uniqueTags.toString()); |
| | | return dto; |
| | | }).collect(Collectors.toList()); |
| | | dtoIPage.setRecords(collect); |
| | | return dtoIPage; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> costStatistics2(CostStatisticsDto costStatisticsDto) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | String dates = costStatisticsDto.getDates(); |
| | | String[] split = dates.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); |
| | | costStatisticsDto.setDates(null); |
| | | List<CostStatisticsDto> costStatisticsDtos = insOrderMapper.selectCostStatistics2(QueryWrappers.queryWrappers(costStatisticsDto).ge("create_time", split[0]).le("create_time", split[1] + " 23:59:59")); |
| | | double totalPrice = costStatisticsDtos.stream() |
| | | .filter(dto -> dto.getPrice() != null) // è¿æ»¤æä»·æ ¼ä¸º null ç对象 |
| | | .mapToDouble(value -> value.getPrice().doubleValue() * value.getNum()) |
| | | .sum(); |
| | | map.put("total", totalPrice); |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> selectSampleDefects(Page page, String inspectionItems, String orderNumber) { |
| | | List<SampleDefectsFatherVo> sampleDefectsFatherVos = insOrderMapper.selectSampleDefects(page, inspectionItems, orderNumber); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("records", sampleDefectsFatherVos); |
| | | Long aLong = insOrderMapper.getCount(inspectionItems, orderNumber); |
| | | map.put("total", aLong); |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | public int updateStatus(Integer id) { |
| | | return insOrderMapper.updateStatus(id); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void export(CostStatisticsDto costStatisticsDto, HttpServletResponse response) throws IOException { |
| | | //æ¥è¯¢å¯¼åºçè´¹ç¨ç»è®¡æ°æ® |
| | | String dates = costStatisticsDto.getDates(); |
| | | String[] split = dates.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); |
| | | costStatisticsDto.setDates(null); |
| | | List<CostStatisticsDto> costStatisticsDtos = insOrderMapper.selectCostStatistics2(QueryWrappers.queryWrappers(costStatisticsDto).ge("create_time", split[0]).le("create_time", split[1] + " 23:59:59")); |
| | | costStatisticsDtos = costStatisticsDtos.stream().map(dto -> { |
| | | Set<String> uniqueTags = new HashSet<>(); |
| | | if (dto.getInspectionItem().contains(",")) { |
| | | for (String s : dto.getInspectionItem().split(",")) { |
| | | uniqueTags.add(s.split("@")[0]); |
| | | } |
| | | } else { |
| | | uniqueTags.add(dto.getInspectionItem().split("@")[0]); |
| | | } |
| | | dto.setInspectionItem(uniqueTags.toString()); |
| | | return dto; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setCharacterEncoding("UTF-8"); |
| | | // è¿éURLEncoder.encodeå¯ä»¥é²æ¢ä¸æä¹±ç å½ç¶åeasyexcel没æå
³ç³» |
| | | String fileName = URLEncoder.encode("æ ·åè´¹ç¨ç»è®¡å¯¼åº", "UTF-8"); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); |
| | | Map<String, List<CostStatisticsDto>> groupByCompany = |
| | | costStatisticsDtos.stream().filter(e -> StrUtil.isNotEmpty(e.getCompany())) |
| | | .collect(Collectors.groupingBy(CostStatisticsDto::getCompany)); |
| | | try { |
| | | // æ°å»ºExcelWriter |
| | | // æ°å»ºExcelWriter |
| | | ExcelWriter excelWriter = |
| | | EasyExcel.write(response.getOutputStream()) |
| | | .registerWriteHandler(new SimpleColumnWidthStyleStrategy(25)) |
| | | .build(); |
| | | for (Map.Entry<String, List<CostStatisticsDto>> companyDataEntry : groupByCompany.entrySet()) { |
| | | String sheetName = companyDataEntry.getKey(); |
| | | List<CostStatisticsDto> dataList = companyDataEntry.getValue(); |
| | | WriteSheet mainSheet = EasyExcel.writerSheet(sheetName) |
| | | .head(CostStatisticsDto.class) |
| | | .registerWriteHandler(new SimpleColumnWidthStyleStrategy(25)) |
| | | .build(); |
| | | excelWriter.write(dataList, mainSheet); |
| | | } |
| | | // å
³éæµ |
| | | excelWriter.finish(); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·åifsåºåä¿¡æ¯ |
| | | * @param |
| | | * @return |
| | | */ |
| | | @Override |
| | | public void getIfsOrder() { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("LOCATION_NO","1302"); |
| | | map.put("STATE_DB","To be Inspected"); |
| | | List<Map<String, Object>> inventory = ifsApiUtils.getInventory(JSONUtil.toJsonStr(map)); |
| | | if(inventory.size() == 0) { |
| | | return; |
| | | } |
| | | // è¿è¡ä¿å |
| | | for (Map<String, Object> map1 : inventory) { |
| | | DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); // æ¶é´æ ¼å¼å |
| | | IfsInventoryQuantity ifsInventoryQuantity = new IfsInventoryQuantity(); |
| | | ifsInventoryQuantity.setContract(map1.get("CONTRACT") == null ? "" : map1.get("CONTRACT").toString()); // å |
| | | ifsInventoryQuantity.setPartNo(map1.get("PART_NO") == null ? "" : map1.get("PART_NO").toString() ); // é¶ä»¶å· |
| | | ifsInventoryQuantity.setPartDesc(map1.get("PART_DESC") == null ? "" : map1.get("PART_DESC").toString()); // é¶ä»¶æè¿° |
| | | ifsInventoryQuantity.setOrderNo(map1.get("ORDER_NO") == null ? "" : map1.get("ORDER_NO").toString()); // 订åå· |
| | | ifsInventoryQuantity.setLineNo(map1.get("LINE_NO") == null ? "" : map1.get("LINE_NO").toString()); // è¡å· |
| | | ifsInventoryQuantity.setReleaseNo(map1.get("RELEASE_NO") == null ? "" : map1.get("RELEASE_NO").toString()); // ä¸è¾¾å· |
| | | ifsInventoryQuantity.setReceiptNo(Integer.parseInt(map1.get("RECEIPT_NO") == null ? "" : map1.get("RECEIPT_NO").toString())); // æ¥æ¶å· |
| | | ifsInventoryQuantity.setStatus(map1.get("STATE") == null ? "" : map1.get("STATE").toString()); // ç¶ææè¿° |
| | | ifsInventoryQuantity.setStatusDb(map1.get("STATE_DB") == null ? "" : map1.get("STATE_DB").toString()); // ç¶æ |
| | | if(map1.get("QTY_ARRIVED") != null) { |
| | | ifsInventoryQuantity.setQtyArrived(new BigDecimal(map1.get("QTY_ARRIVED").toString())); // æµè¾¾çéè´æ°é |
| | | } |
| | | if(map1.get("QTY_INSPECTED") != null) { |
| | | ifsInventoryQuantity.setQtyInspected(new BigDecimal(map1.get("QTY_INSPECTED").toString())); // å·²æ£éªçè´ä¹°æ°é |
| | | } |
| | | if(map1.get("QTY_TO_INSPECT") != null) { |
| | | ifsInventoryQuantity.setQtyToInspect(new BigDecimal(map1.get("QTY_TO_INSPECT").toString())); // è¦æ£éªçéè´æ°é |
| | | } |
| | | if(map1.get("INV_QTY_IN_STORE") != null) { |
| | | ifsInventoryQuantity.setInvQtyInStore(new BigDecimal(map1.get("INV_QTY_IN_STORE").toString())); // æµè¾¾çåºåæ°é |
| | | } |
| | | if(map1.get("PUR_QTY_IN_STORE") != null) { |
| | | ifsInventoryQuantity.setPurQtyInStore(new BigDecimal( map1.get("PUR_QTY_IN_STORE").toString())); // æµè¾¾çéè´æ°é |
| | | |
| | | } |
| | | ifsInventoryQuantity.setSupplierId(map1.get("SUPPLIER_ID") == null ? "" : map1.get("SUPPLIER_ID").toString()); // ä¾åºåID |
| | | ifsInventoryQuantity.setSupplierName(map1.get("SUPPLIER_NAME") == null ? "" : map1.get("SUPPLIER_NAME").toString()); // ä¾åºååç§° |
| | | ifsInventoryQuantity.setConfigurationId(map1.get("CONFIGURATION_ID") == null ? "" : map1.get("CONFIGURATION_ID").toString()); // é
ç½®æ è¯ |
| | | ifsInventoryQuantity.setLotBatchNo(map1.get("LOT_BATCH_NO") == null ? "" : map1.get("LOT_BATCH_NO").toString()); // æ¹æ¬¡å· |
| | | ifsInventoryQuantity.setUpdateBatchNo(map1.get("LOT_BATCH_NO") == null ? "" : map1.get("LOT_BATCH_NO").toString()); // æ¹æ¬¡å· |
| | | ifsInventoryQuantity.setWaivDevRejNo(map1.get("WAIV_DEV_REJ_NO") == null ? "" : map1.get("WAIV_DEV_REJ_NO").toString()); // WDRå· |
| | | ifsInventoryQuantity.setActivitySeq(map1.get("ACTIVITY_SEQ") == null ? null : Integer.parseInt(map1.get("ACTIVITY_SEQ").toString())); // æ´»å¨åºå |
| | | ifsInventoryQuantity.setSerialNo(map1.get("SERIAL_NO") == null ? "" : map1.get("SERIAL_NO").toString()); // åºåå· |
| | | ifsInventoryQuantity.setLocationNo(map1.get("LOCATION_NO") == null ? "" : map1.get("LOCATION_NO").toString()); // åºä½å· |
| | | ifsInventoryQuantity.setEngChgLevel(map1.get("ENG_CHG_LEVEL") == null ? "" : map1.get("ENG_CHG_LEVEL").toString()); // çæ¬å· |
| | | ifsInventoryQuantity.setReceiver(map1.get("RECEIVER") == null ? "" : map1.get("RECEIVER").toString()); // æ¥æ¶äºº |
| | | ifsInventoryQuantity.setReceiverName(map1.get("RECEIVER_NAME") == null ? "" : map1.get("RECEIVER_NAME").toString()); // æ¥æ¶äººåç§° |
| | | ifsInventoryQuantity.setBuyerCode(map1.get("BUYER_CODE") == null ? "" : map1.get("BUYER_CODE").toString()); // éè´å |
| | | ifsInventoryQuantity.setBuyerName(map1.get("BUYER_NAME") == null ? "" : map1.get("BUYER_NAME").toString()); // éè´ååç§° |
| | | |
| | | if(map1.get("ARRIVE_DATE") != null) { |
| | | ifsInventoryQuantity.setArriveDate(LocalDateTime.parse(map1.get("ARRIVE_DATE").toString(),dateTimeFormatter)); // å®é
å°è´§æ¥æ |
| | | } |
| | | if(map1.get("DELIVERY_DATE") != null) { |
| | | ifsInventoryQuantity.setDeliveryDate(LocalDateTime.parse(map1.get("DELIVERY_DATE").toString(),dateTimeFormatter)); // å®é
äº¤è´§æ¥æ |
| | | } |
| | | if(map1.get("PRODUCT_DATE") != null) { |
| | | ifsInventoryQuantity.setProductDate(LocalDateTime.parse(map1.get("PRODUCT_DATE").toString(),dateTimeFormatter)); // çäº§æ¥æ |
| | | |
| | | } |
| | | if(map1.get("INVALID_DATE") != null) { |
| | | ifsInventoryQuantity.setInvalidDate(LocalDateTime.parse(map1.get("INVALID_DATE").toString(),dateTimeFormatter)); // å¤±ææ¥æ |
| | | } |
| | | if(map1.get("APPROVED_DATE") != null) { |
| | | ifsInventoryQuantity.setApprovedDate(LocalDateTime.parse(map1.get("APPROVED_DATE").toString(),dateTimeFormatter)); // å®¡æ¹æ¥æ |
| | | } |
| | | ifsInventoryQuantity.setReqCeater(map1.get("REQ_CEATER") == null ? "" : map1.get("REQ_CEATER").toString()); // éè´ç³è¯·å建人 |
| | | ifsInventoryQuantity.setReqCeaterName(map1.get("REQ_CEATER_NAME") == null ? "" : map1.get("REQ_CEATER_NAME").toString()); // éè´ç³è¯·å建人åç§° |
| | | ifsInventoryQuantity.setLineRemarks(map1.get("LINE_REMARKS") == null ? "" : map1.get("LINE_REMARKS").toString()); // éè´è®¢åè¡å¤æ³¨ |
| | | ifsInventoryQuantity.setBuyUnitMeas(map1.get("BUY_UNIT_MEAS") == null ? "" : map1.get("BUY_UNIT_MEAS").toString()); // éè´åä½ |
| | | ifsInventoryQuantity.setReceiverDate(LocalDateTime.now()); // æ¥æ¶æ¥æ |
| | | ifsInventoryQuantity.setIsSource(1); |
| | | ifsInventoryQuantity.setState(0); |
| | | |
| | | IfsInventoryQuantity one = ifsInventoryQuantityMapper.selectOne(new LambdaQueryWrapper<IfsInventoryQuantity>() |
| | | .eq(IfsInventoryQuantity::getOrderNo, ifsInventoryQuantity.getOrderNo()) |
| | | .eq(IfsInventoryQuantity::getLineNo, ifsInventoryQuantity.getLineNo()) |
| | | .eq(IfsInventoryQuantity::getReleaseNo, ifsInventoryQuantity.getReleaseNo()) |
| | | .eq(IfsInventoryQuantity::getReceiptNo, ifsInventoryQuantity.getReceiptNo()) |
| | | .eq(IfsInventoryQuantity::getLocationNo, ifsInventoryQuantity.getLocationNo()) |
| | | .eq(IfsInventoryQuantity::getLotBatchNo, ifsInventoryQuantity.getLotBatchNo()) |
| | | .eq(IfsInventoryQuantity::getSerialNo, ifsInventoryQuantity.getSerialNo()) |
| | | .eq(IfsInventoryQuantity::getEngChgLevel, ifsInventoryQuantity.getEngChgLevel()) |
| | | .eq(IfsInventoryQuantity::getWaivDevRejNo, ifsInventoryQuantity.getWaivDevRejNo()) |
| | | .eq(IfsInventoryQuantity::getActivitySeq, ifsInventoryQuantity.getActivitySeq()) |
| | | ); |
| | | if(Objects.isNull(one)) { |
| | | |
| | | ifsInventoryQuantity.setIsFirst(0); |
| | | // æ¥è¯¢äº§ä¸é¾æ£æµæ°æ® |
| | | String industryChainAttrFields = IndustryChainUtils.getIndustryChainAttrFields(ifsInventoryQuantity.getOrderNo(), |
| | | ifsInventoryQuantity.getLineNo(), |
| | | ifsInventoryQuantity.getReleaseNo()); |
| | | ifsInventoryQuantity.setIndustryChain(industryChainAttrFields); |
| | | |
| | | ifsInventoryQuantityMapper.insert(ifsInventoryQuantity); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * idæ¯åææçid |
| | | * |
| | | * ä¿®æ¹è®¢ååå· |
| | | * @param insOrder |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateEntrustCode(InsOrder insOrder) { |
| | | // 夿å½åè®¢åæ¯å¦çæäºæ¥å, çæäºæ¥åä¸è½ä¿®æ¹åå· |
| | | List<InsOrder> insOrders = insOrderMapper.selectList(Wrappers.<InsOrder>lambdaQuery() |
| | | .eq(InsOrder::getIfsInventoryId, insOrder.getId()) |
| | | .ne(InsOrder::getState, -1)); |
| | | List<Integer> insOrderIds = insOrders.stream().map(InsOrder::getId).collect(Collectors.toList()); |
| | | Long count = insReportMapper.selectCount(Wrappers.<InsReport>lambdaQuery() |
| | | .in(InsReport::getInsOrderId, insOrderIds)); |
| | | if (count > 0 ) { |
| | | throw new ErrorException("å½å订åå·²ç»çæäºæ¥åä¸è½ä¿®æ¹ç¼å·"); |
| | | } |
| | | |
| | | |
| | | Long count1 = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery() |
| | | .eq(InsOrder::getEntrustCode, insOrder.getEntrustCode()) |
| | | .ne(InsOrder::getIfsInventoryId, insOrder.getId()) |
| | | .ne(InsOrder::getInsState, -1)); |
| | | if (count1 > 0) { |
| | | throw new ErrorException("该ç¼å·éå¤"); |
| | | } |
| | | |
| | | //ä¿®æ¹æ¥åçç¼å· |
| | | insOrderMapper.update(null, Wrappers.<InsOrder>lambdaUpdate() |
| | | .eq(InsOrder::getIfsInventoryId, insOrder.getId()) |
| | | .set(InsOrder::getEntrustCode, insOrder.getEntrustCode())); |
| | | |
| | | // ä¿®æ¹æ ·åçç¼å· |
| | | // æ¥è¯¢ææçæ ·å |
| | | List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery() |
| | | .in(InsSample::getInsOrderId, insOrderIds)); |
| | | for (InsSample insSample : insSamples) { |
| | | String sampleCode = insSample.getSampleCode(); |
| | | String updateCode = insOrder.getEntrustCode(); |
| | | // æ¥æ¾æåä¸ä¸ª'-'çä½ç½® |
| | | int lastDashIndex = sampleCode.lastIndexOf('-'); |
| | | if (lastDashIndex != -1) { |
| | | int secondLastDashIndex = sampleCode.lastIndexOf('-', lastDashIndex - 1); |
| | | // å¤çæåä¸ä¸ª'-'åçé¨å |
| | | if (secondLastDashIndex != -1) { |
| | | // å¤çæåä¸ä¸ª'-'åä¹åçé¨å |
| | | String afterLastDash = sampleCode.substring(lastDashIndex); |
| | | |
| | | updateCode = updateCode + afterLastDash; |
| | | } |
| | | } |
| | | insSampleMapper.update(null, Wrappers.<InsSample>lambdaUpdate() |
| | | .eq(InsSample::getId, insSample.getId()) |
| | | .set(InsSample::getSampleCode, updateCode)); |
| | | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public List<InsUnqualifiedRetestProduct> getRetestResult(Integer insProductId) { |
| | | return insUnqualifiedRetestProductMapper.selectList(Wrappers.<InsUnqualifiedRetestProduct>lambdaQuery() |
| | | .eq(InsUnqualifiedRetestProduct::getInsProductId, insProductId)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹éè´è®¢åæ¥æ¶ç¶æ, é¿å
åæ» |
| | | * @param id |
| | | */ |
| | | @Transactional |
| | | public void updateIfsInventoryQuantity(Integer id) { |
| | | ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate() |
| | | .set(IfsInventoryQuantity::getIsRegister, 1) |
| | | .eq(IfsInventoryQuantity::getId, id)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢éåä¸ä¸å |
| | | * @param list |
| | | * @param insOrder |
| | | * @return |
| | | */ |
| | | @Override |
| | | public int addRawCopperOrder(List<SampleProductDto> list, CopperInsOrderDto insOrder) { |
| | | insOrder.setState(1); |
| | | insOrder.setTypeSource(1); |
| | | |
| | | LocalDate appointed = insOrder.getAppointed(); |
| | | |
| | | insOrderMapper.insert(insOrder); // 主表 |
| | | |
| | | list.forEach(a -> { |
| | | a.setId(null); |
| | | a.setInsOrderId(insOrder.getId()); |
| | | insSampleMapper.insert(a); |
| | | if (ObjectUtil.isNotEmpty(a.getInsProduct())) { |
| | | // 夿æ¯å¦å¡«åå¾
æ£é¡¹æ°é |
| | | if (a.getQuantity() != null) { |
| | | List<InsProduct> ip2 = new ArrayList<>(); |
| | | for (Integer i = 1; i <= a.getQuantity(); i++) { |
| | | // éæ°æ·è´ å建æ°å¯¹è±¡ |
| | | AtomicInteger atomicInteger = new AtomicInteger(i); |
| | | List<InsProduct> insProducts = a.getInsProduct().stream().map(insProduct -> { |
| | | insProduct.setRawMaterialTag(String.valueOf(atomicInteger.get())); |
| | | InsProduct product = new InsProduct(); |
| | | BeanUtils.copyProperties(insProduct, product); |
| | | return product; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | ip2.addAll(insProducts); |
| | | } |
| | | addInsProductMethod(a.getId(), ip2); |
| | | } else { |
| | | addInsProductMethod(a.getId(), a.getInsProduct()); |
| | | } |
| | | } |
| | | if (ObjectUtil.isNotEmpty(a.getChildSampleList())) { |
| | | for (SampleProductDto b : a.getChildSampleList()) { |
| | | for (int i = 0; i < b.getNum(); i++) { |
| | | b.setId(null); |
| | | b.setInsOrderId(insOrder.getId()); |
| | | b.setParentId(a.getId()); |
| | | insSampleMapper.insert(b); |
| | | if (ObjectUtil.isNotEmpty(b.getInsProduct())) { |
| | | addInsProductMethod(b.getId(), b.getInsProduct()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | |
| | | // æ·»å åææä¿¡æ¯ |
| | | IfsInventoryQuantity ifsInventoryQuantity = new IfsInventoryQuantity(); |
| | | // åºæ¬ä¿¡æ¯ |
| | | ifsInventoryQuantity.setIsSource(0); |
| | | ifsInventoryQuantity.setIsInspect(1); |
| | | ifsInventoryQuantity.setState(1); |
| | | ifsInventoryQuantity.setIsFinish(0); |
| | | ifsInventoryQuantity.setIsCopper(1); |
| | | ifsInventoryQuantity.setIsQuarter(0); |
| | | ifsInventoryQuantity.setInspectStatus(0); |
| | | |
| | | ifsInventoryQuantity.setQtyArrived(insOrder.getQtyArrived()); |
| | | ifsInventoryQuantity.setBuyUnitMeas(insOrder.getBuyUnitMeas()); |
| | | ifsInventoryQuantity.setSupplierName(insOrder.getSupplierName()); |
| | | ifsInventoryQuantity.setUpdateBatchNo(insOrder.getUpdateBatchNo()); |
| | | ifsInventoryQuantity.setDeclareDate(insOrder.getDeclareDate()); |
| | | |
| | | ifsInventoryQuantityMapper.insert(ifsInventoryQuantity); |
| | | |
| | | |
| | | insOrder.setIfsInventoryId(ifsInventoryQuantity.getId()); |
| | | insOrder.setState(1); |
| | | |
| | | |
| | | upInsOrderOfState(insOrder); |
| | | upInsOrder(insOrder.getId(), null, appointed != null ? appointed.toString() : null, SecurityUtils.getUserId().intValue(), "åææ"); |
| | | |
| | | return insOrder.getId(); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹å§æä¸åç¼å· |
| | | * @param insOrder |
| | | */ |
| | | @Override |
| | | public void updateOrderEntrustCode(InsOrder insOrder) { |
| | | // 夿å½åè®¢åæ¯å¦çæäºæ¥å, çæäºæ¥åä¸è½ä¿®æ¹åå· |
| | | Long count = insReportMapper.selectCount(Wrappers.<InsReport>lambdaQuery() |
| | | .eq(InsReport::getInsOrderId, insOrder.getId())); |
| | | if (count > 0 ) { |
| | | throw new ErrorException("å½å订åå·²ç»çæäºæ¥åä¸è½ä¿®æ¹ç¼å·"); |
| | | } |
| | | |
| | | Long count1 = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery() |
| | | .eq(InsOrder::getEntrustCode, insOrder.getEntrustCode())); |
| | | if (count1 > 0) { |
| | | throw new ErrorException("该ç¼å·éå¤"); |
| | | } |
| | | |
| | | //ä¿®æ¹æ¥åçç¼å· |
| | | insOrderMapper.update(null, Wrappers.<InsOrder>lambdaUpdate() |
| | | .eq(InsOrder::getId, insOrder.getId()) |
| | | .set(InsOrder::getEntrustCode, insOrder.getEntrustCode())); |
| | | |
| | | // ä¿®æ¹æ ·åçç¼å· |
| | | // æ¥è¯¢ææçæ ·å |
| | | List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery() |
| | | .eq(InsSample::getInsOrderId, insOrder.getId())); |
| | | for (InsSample insSample : insSamples) { |
| | | String sampleCode = insSample.getSampleCode(); |
| | | String updateCode = insOrder.getEntrustCode(); |
| | | // æ¥æ¾æåä¸ä¸ª'-'çä½ç½® |
| | | int lastDashIndex = sampleCode.lastIndexOf('-'); |
| | | if (lastDashIndex != -1) { |
| | | int secondLastDashIndex = sampleCode.lastIndexOf('-', lastDashIndex - 1); |
| | | // å¤çæåä¸ä¸ª'-'åçé¨å |
| | | if (secondLastDashIndex != -1) { |
| | | // å¤çæåä¸ä¸ª'-'åä¹åçé¨å |
| | | String afterLastDash = sampleCode.substring(lastDashIndex); |
| | | |
| | | updateCode = updateCode + afterLastDash; |
| | | } |
| | | } |
| | | insSampleMapper.update(null, Wrappers.<InsSample>lambdaUpdate() |
| | | .eq(InsSample::getId, insSample.getId()) |
| | | .set(InsSample::getSampleCode, updateCode)); |
| | | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹æ£éªä¸åå
容 |
| | | * @param insOrderUpdateDto |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean updateInsOrder(InsOrderUpdateDto insOrderUpdateDto) { |
| | | // ä¿®æ¹è®¢å |
| | | insOrderUpdateDto.getInsOrder().setState(0); |
| | | insOrderUpdateDto.getInsOrder().setTell(""); |
| | | insOrderMapper.updateById(insOrderUpdateDto.getInsOrder()); |
| | | |
| | | // ä¿®æ¹æ£éªé¡¹ |
| | | for (SampleProductDto sampleProductDto : insOrderUpdateDto.getSampleProduct()) { |
| | | insProductService.updateBatchById(sampleProductDto.getInsProduct()); |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * æåæ ç¾æå° |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<InsOrderPrintingVo> labelOrderPrinting(List<Integer> ids) { |
| | | return insOrderMapper.labelOrderPrinting(ids); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®æ ·åidæ¥è¯¢æ£éªé¡¹æ |
| | | * @param insSampleId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<StandardProductList> getProductTreeBySampleId(Integer insSampleId) { |
| | | // æ¥è¯¢ç¬¬ä¸ä¸ªæ£éªé¡¹è·åæ£éªé¡¹æ |
| | | InsProduct insProduct = insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery() |
| | | .eq(InsProduct::getInsSampleId, insSampleId) |
| | | .last("limit 1")); |
| | | String tree = insProduct.getFactory() + " - " + |
| | | insProduct.getLaboratory() + " - " + |
| | | insProduct.getSampleType() + " - " + |
| | | insProduct.getSample() + " - " + |
| | | insProduct.getModel(); |
| | | // æ¥è¯¢æ åæ |
| | | List<StandardProductList> standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery() |
| | | .eq(StandardProductList::getStandardMethodListId, insProduct.getStandardMethodListId()) |
| | | .eq(StandardProductList::getTree, tree)); |
| | | for (StandardProductList standardProductList : standardProductLists) { |
| | | standardProductList.setId(null); |
| | | } |
| | | |
| | | return standardProductLists; |
| | | } |
| | | |
| | | /** |
| | | * æ·»å éæ¼çæ£éªé¡¹ |
| | | * @param omitOrderProductDto |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean addOmitOrderProduct(OmitOrderProductDto omitOrderProductDto) { |
| | | if (omitOrderProductDto.getInsSampleId() == null) { |
| | | throw new ErrorException("ç¼ºå°æ ·åId"); |
| | | } |
| | | for (InsProduct product : omitOrderProductDto.getInsProductBindingList()) { |
| | | if (product.getState() == 1) { |
| | | product.setId(null); |
| | | product.setCreateTime(null); |
| | | product.setCreateUser(null); |
| | | product.setUpdateTime(null); |
| | | product.setUpdateUser(null); |
| | | product.setInsSampleId(omitOrderProductDto.getInsSampleId()); |
| | | if (StringUtils.isBlank(product.getCableTag())) { |
| | | product.setCableTag(null); |
| | | } |
| | | if (product.getInspectionItemSubclass() == null) { |
| | | product.setInspectionItemSubclass(""); |
| | | } |
| | | if (StringUtils.isBlank(product.getAsk()) || StringUtils.isBlank(product.getTell())) { |
| | | throw new ErrorException("ææ£éªé¡¹çè¦æ±å¼æè¦æ±æè¿°ä¸ºç©º, 请填åè¦æ±å¼æè¦æ±æè¿°"); |
| | | } |
| | | insProductMapper.insert(product); |
| | | } |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * æåæ£éªåå¯¼åº |
| | | * @param sampleOrderDto |
| | | * @param response |
| | | */ |
| | | @Override |
| | | public void rawAllInsOrderExport(SampleOrderDto sampleOrderDto, HttpServletResponse response) { |
| | | //夿å
¨é¨,个人,ç»ç»çæé |
| | | //todo:ä»
çæè·åå½å人æå±å®éªå®¤id |
| | | String laboratory = null; |
| | | // 夿æ¯å¦æ¯å
¨é¨ |
| | | String isOrderAll = null; |
| | | if (sampleOrderDto.getState() != null && sampleOrderDto.getState() == -2) { |
| | | isOrderAll = "1"; |
| | | sampleOrderDto.setState(null); |
| | | } |
| | | List<SampleOrderDto> sampleOrderDtoList = insOrderMapper.rawAllInsOrderExport(QueryWrappers.queryWrappers(sampleOrderDto), laboratory, isOrderAll); |
| | | |
| | | // 夿æ¯å¦æ¯ä¸åæ ¼, ä¸åæ ¼æ¥è¯¢ä¸åæ ¼é¡¹ |
| | | for (SampleOrderDto orderDto : sampleOrderDtoList) { |
| | | if (orderDto.getInsResult() != null && orderDto.getInsResult() == 0){ |
| | | // æ¥è¯¢ä¸åæ ¼é¡¹ |
| | | List<String> unqualifiedList = insProductMapper.selectUnqualifiedList(orderDto.getId()); |
| | | orderDto.setUnqualifiedItem(CollUtil.join(unqualifiedList, ",")); |
| | | } |
| | | orderDto.setCreateTimeString(orderDto.getCreateTime() == null ? "" : orderDto.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | |
| | | } |
| | | |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setCharacterEncoding("UTF-8"); |
| | | try { |
| | | // è¿éURLEncoder.encodeå¯ä»¥é²æ¢ä¸æä¹±ç å½ç¶åeasyexcel没æå
³ç³» |
| | | String fileName = URLEncoder.encode("å§ææ£æµä¿¡æ¯å¯¼åº", "UTF-8"); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); |
| | | //æ°å»ºExcelWriter |
| | | ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).build(); |
| | | //è·åsheet0对象 |
| | | WriteSheet mainSheet = EasyExcel.writerSheet(0, "å§ææ£æµä¿¡æ¯å¯¼åº").head(SampleOrderDto.class).build(); |
| | | |
| | | //åsheet0åå
¥æ°æ® ä¼ å
¥ç©ºlistè¿æ ·åªå¯¼åºè¡¨å¤´ |
| | | excelWriter.write(sampleOrderDtoList, mainSheet); |
| | | //å
³éæµ |
| | | excelWriter.finish(); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.inspect.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.inspect.mapper.InsOrderTemplateMapper; |
| | | import com.ruoyi.inspect.pojo.InsOrderTemplate; |
| | | import com.ruoyi.inspect.service.InsOrderTemplateService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Administrator |
| | | * @description é对表ãins_order_templateãçæ°æ®åºæä½Serviceå®ç° |
| | | * @createDate 2024-03-18 14:14:54 |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class InsOrderTemplateServiceImpl extends ServiceImpl<InsOrderTemplateMapper, InsOrderTemplate> |
| | | implements InsOrderTemplateService { |
| | | |
| | | private InsOrderTemplateMapper insOrderTemplateMapper; |
| | | |
| | | @Override |
| | | public int addInsOrderTemplate(InsOrderTemplate insOrderTemplate) { |
| | | return insOrderTemplateMapper.insert(insOrderTemplate); |
| | | } |
| | | |
| | | @Override |
| | | public List<InsOrderTemplate> selectInsOrderTemplate(String company) { |
| | | if (ObjectUtils.isEmpty(company) || company.equals("")) { |
| | | return insOrderTemplateMapper.selectList(Wrappers.<InsOrderTemplate>lambdaQuery() |
| | | .select(InsOrderTemplate.class, info -> !info.getColumn().equals("thing"))); |
| | | } else { |
| | | //æ ¹æ®å§æåä½è¿è¡çé |
| | | return insOrderTemplateMapper.selectList(Wrappers.<InsOrderTemplate>lambdaQuery() |
| | | .like(InsOrderTemplate::getThing,"\"company\":\""+ company+"\"") |
| | | .select(InsOrderTemplate.class, info -> !info.getColumn().equals("thing"))); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String selectInsOrderTemplateById(Integer id) { |
| | | return insOrderTemplateMapper.selectById(id).getThing(); |
| | | } |
| | | |
| | | @Override |
| | | public int delInsOrderTemplate(Integer id) { |
| | | return insOrderTemplateMapper.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.inspect.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.mapper.StandardProductListMapper; |
| | | import com.ruoyi.basic.pojo.StandardProductList; |
| | | import com.ruoyi.framework.exception.ErrorException; |
| | | import com.ruoyi.inspect.dto.InsProductBindingDto; |
| | | import com.ruoyi.inspect.mapper.InsOrderMapper; |
| | | import com.ruoyi.inspect.mapper.InsProductMapper; |
| | | import com.ruoyi.inspect.mapper.InsSampleMapper; |
| | | import com.ruoyi.inspect.pojo.InsOrder; |
| | | import com.ruoyi.inspect.pojo.InsProduct; |
| | | import com.ruoyi.inspect.pojo.InsSample; |
| | | import com.ruoyi.inspect.service.InsProductService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | @AllArgsConstructor |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public class InsProductServiceImpl extends ServiceImpl<InsProductMapper, InsProduct> |
| | | implements InsProductService { |
| | | |
| | | private InsProductMapper insProductMapper; |
| | | |
| | | private InsOrderMapper insOrderMapper; |
| | | |
| | | private InsSampleMapper insSampleMapper; |
| | | |
| | | private StandardProductListMapper standardProductListMapper; |
| | | |
| | | @Override |
| | | public int selectOrderManDay(Integer orderId) { |
| | | return insProductMapper.selectOrderManDay(orderId); |
| | | } |
| | | |
| | | @Override |
| | | public int updateInspected(Integer id, String ids) { |
| | | InsOrder insOrder = new InsOrder(); |
| | | insOrder.setId(id); |
| | | insOrder.setIsRevocation(1);//éè¦å®¡æ ¸ |
| | | insOrder.setRevocationInsProductIds(ids); |
| | | return insOrderMapper.updateById(insOrder); |
| | | } |
| | | |
| | | @Override |
| | | public boolean write(InsOrder insOrder) { |
| | | insOrderMapper.updateById(insOrder); |
| | | return true; |
| | | } |
| | | |
| | | //æ¥è¯¢å¾
æ£é¡¹ç® |
| | | @Override |
| | | public IPage<InsProduct> selectNoProducts(Page page, InsProduct insProduct, Integer orderId, String ids) { |
| | | List<Integer> noIds = null; |
| | | if (StringUtils.isNotBlank(ids)) { |
| | | noIds = Arrays.asList(ids.split(",")).stream() |
| | | .map(Integer::parseInt) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | IPage<InsProduct> insProductIPage = baseMapper.selectNoProducts(page, orderId, noIds); |
| | | return insProductIPage; |
| | | } |
| | | |
| | | //å®¡æ ¸å¾
æ£æ¤é |
| | | @Override |
| | | public void checkUpdate(Integer orderId, Integer state) { |
| | | InsOrder insOrder = insOrderMapper.selectById(orderId); |
| | | if (state == 1) { |
| | | List<String> list = new ArrayList<>(); |
| | | try { |
| | | list = Arrays.asList(insOrder.getRevocationInsProductIds().split(",")); |
| | | } catch (Exception e) { |
| | | throw new ErrorException("è¿æ²¡æéæ©åºè¯¥è¦æ¤éçæ£éªé¡¹ç®"); |
| | | } |
| | | List<Integer> ids = list.stream() |
| | | .map(Integer::parseInt) |
| | | .collect(Collectors.toList()); |
| | | List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId)); |
| | | List<Integer> collect = insSamples.stream().map(InsSample::getId).collect(Collectors.toList()); |
| | | List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getState, 1).in(InsProduct::getInsSampleId, collect)); |
| | | if (insProducts.stream().map(InsProduct::getId).collect(Collectors.toList()).equals(ids)) { |
| | | //å¦æè¯¥æ£éªåä¸çææé¡¹ç®å
¨é¨é½æ¤é,é£ä¹è¿ä¸ªååä¹éè¦æ¤é |
| | | insOrder.setState(3); |
| | | } else { |
| | | List<InsProduct> products = insProductMapper.selectBatchIds(ids); |
| | | //é¦å
æ ¹æ®éæ©ç项ç®idè¿è¡æ¤éé¡¹ç® |
| | | updateBatchById(products.stream().map(insProduct -> { |
| | | insProduct.setState(0); |
| | | return insProduct; |
| | | }).collect(Collectors.toList())); |
| | | } |
| | | //insProductMapper.updateInspected(id); |
| | | } |
| | | //ä¸éè¿ |
| | | insOrder.setIsRevocation(0); |
| | | insOrderMapper.updateById(insOrder); |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ ¹æ®æ£éªé¡¹idæ¥è¯¢æ£éªé¡¹æ ä¿¡æ¯ |
| | | * @param productId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<InsProduct> getProductTreeByProductId(Integer productId) { |
| | | // æ¥è¯¢æ£éªé¡¹ä¿¡æ¯ |
| | | InsProduct insProduct = insProductMapper.selectById(productId); |
| | | String tree = insProduct.getFactory() + " - " + |
| | | insProduct.getLaboratory() + " - " + |
| | | insProduct.getSampleType() + " - " + |
| | | insProduct.getSample() + " - " + |
| | | insProduct.getModel(); |
| | | // æ¥è¯¢æ åæ |
| | | List<StandardProductList> standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery() |
| | | .eq(StandardProductList::getStandardMethodListId, insProduct.getStandardMethodListId()) |
| | | .eq(StandardProductList::getTree, tree)); |
| | | |
| | | List<InsProduct> insProducts = standardProductLists.stream().map(standardProductList -> { |
| | | InsProduct product = new InsProduct(); |
| | | BeanUtils.copyProperties(standardProductList, product); |
| | | // 鲿¢åºååé误 |
| | | product.setTemplate(null); |
| | | product.setStyle(null); |
| | | return product; |
| | | }).collect(Collectors.toList()); |
| | | return insProducts; |
| | | } |
| | | |
| | | /** |
| | | * ç¹æ®æ£éªé¡¹ç»å® |
| | | * @param insProductBindingDto |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean bindingProductTreeByProductId(InsProductBindingDto insProductBindingDto) { |
| | | if (insProductBindingDto.getInsProductId() == null) { |
| | | throw new ErrorException("ç¼ºå°æ£éªé¡¹ç»å®id"); |
| | | } |
| | | |
| | | List<InsProduct> insProductBindingList = insProductBindingDto.getInsProductBindingList(); |
| | | // æ¥è¯¢åæ¬æ£éªé¡¹ |
| | | InsProduct insProduct = insProductMapper.selectById(insProductBindingDto.getInsProductId()); |
| | | |
| | | for (InsProduct product : insProductBindingList) { |
| | | product.setBindingProductId(insProductBindingDto.getInsProductId()); |
| | | product.setAsk(null); |
| | | product.setTell(null); |
| | | product.setPrice(null); |
| | | product.setManHour(null); |
| | | product.setSection(null); |
| | | // å
³èæ è¯ |
| | | product.setRawMaterialTag(insProduct.getRawMaterialTag()); |
| | | product.setRepetitionTag(insProduct.getRepetitionTag()); |
| | | product.setInsSampleId(insProduct.getInsSampleId()); |
| | | product.setIsBinding(1); |
| | | product.setState(1); |
| | | } |
| | | |
| | | // 夿æ¯å¦æ¯çµç¼æ¯çµç¼éè¦æ·»å ææçµç¼å
³èå
³ç³» |
| | | if (StringUtils.isNotBlank(insProduct.getCableTag())) { |
| | | // æ¥è¯¢å
¶ä»çµç¼ |
| | | List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() |
| | | .eq(InsProduct::getInsSampleId, insProduct.getInsSampleId()) |
| | | .eq(InsProduct::getStructureItemParameterId, insProduct.getStructureItemParameterId()) |
| | | .isNotNull(InsProduct::getCableTag)); |
| | | for (InsProduct product : insProducts) { |
| | | for (InsProduct insProduct1 : insProductBindingList) { |
| | | insProduct1.setId(null); |
| | | insProduct1.setBindingProductId(product.getId()); |
| | | insProduct1.setCableTag(product.getCableTag()); |
| | | } |
| | | this.saveBatch(insProductBindingList); |
| | | } |
| | | } else { |
| | | this.saveBatch(insProductBindingList); |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * å é¤ç¹æ®æ£éªé¡¹ç»å®ä¿¡æ¯ |
| | | * @param productId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean removeBindingProductTree(Integer productId) { |
| | | // æ¥è¯¢æ£éªé¡¹ |
| | | InsProduct insProduct = insProductMapper.selectById(productId); |
| | | // 夿æ¯å¦æ¯çµç¼é
ç½®, éè¦å é¤å
³èçææçæ£éªé¡¹ |
| | | if (StringUtils.isNotBlank(insProduct.getCableTag())) { |
| | | insProductMapper.delete(Wrappers.<InsProduct>lambdaQuery() |
| | | .eq(InsProduct::getInsSampleId, insProduct.getInsSampleId()) |
| | | .eq(InsProduct::getIsBinding, 1) |
| | | .isNotNull(InsProduct::getBindingProductId) |
| | | .eq(InsProduct::getStructureItemParameterId, insProduct.getStructureItemParameterId()) |
| | | .isNotNull(InsProduct::getCableTag)); |
| | | } else { |
| | | insProductMapper.deleteById(productId); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | //package com.ruoyi.inspect.service.impl; |
| | | // |
| | | //import cn.hutool.core.util.StrUtil; |
| | | //import cn.hutool.json.JSONUtil; |
| | | //import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | //import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | //import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | //import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | //import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | //import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | //import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | //import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | //import com.deepoove.poi.XWPFTemplate; |
| | | //import com.deepoove.poi.data.Pictures; |
| | | //import com.ruoyi.common.properties.WechatProperty; |
| | | //import com.ruoyi.common.utils.QueryWrappers; |
| | | //import com.ruoyi.inspect.dto.ReportPageDto; |
| | | //import com.ruoyi.inspect.mapper.InsOrderStateMapper; |
| | | //import com.ruoyi.inspect.mapper.InsProductMapper; |
| | | //import com.ruoyi.inspect.mapper.InsReportMapper; |
| | | //import com.ruoyi.inspect.mapper.InsUnqualifiedRetestProductMapper; |
| | | //import com.ruoyi.inspect.pojo.InsReport; |
| | | //import com.ruoyi.inspect.service.InsOrderService; |
| | | //import com.ruoyi.inspect.service.InsReportService; |
| | | //import com.ruoyi.system.mapper.UserMapper; |
| | | //import org.apache.poi.xwpf.usermodel.*; |
| | | //import org.springframework.beans.factory.annotation.Value; |
| | | //import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| | | //import org.springframework.stereotype.Service; |
| | | //import org.springframework.transaction.annotation.Transactional; |
| | | //import org.springframework.web.multipart.MultipartFile; |
| | | // |
| | | //import javax.annotation.Resource; |
| | | //import javax.imageio.ImageIO; |
| | | //import java.awt.image.BufferedImage; |
| | | //import java.io.*; |
| | | //import java.nio.file.Files; |
| | | //import java.nio.file.Path; |
| | | //import java.nio.file.Paths; |
| | | //import java.nio.file.StandardCopyOption; |
| | | //import java.time.LocalDateTime; |
| | | //import java.time.format.DateTimeFormatter; |
| | | //import java.util.*; |
| | | //import java.util.stream.Collectors; |
| | | //import java.util.zip.ZipEntry; |
| | | //import java.util.zip.ZipFile; |
| | | //import java.util.zip.ZipOutputStream; |
| | | // |
| | | ///** |
| | | // * @author Administrator |
| | | // * @description é对表ãins_report(æ£éªæ¥å)ãçæ°æ®åºæä½Serviceå®ç° |
| | | // * @createDate 2024-03-17 22:10:02 |
| | | // */ |
| | | //@Service |
| | | //public class InsReportServiceImpl extends ServiceImpl<InsReportMapper, InsReport> |
| | | // implements InsReportService { |
| | | // |
| | | // @Resource |
| | | // private GetLook getLook; |
| | | // @Resource |
| | | // private UserMapper userMapper; |
| | | // @Resource |
| | | // private InsReportMapper insReportMapper; |
| | | // @Resource |
| | | // private InsOrderStateMapper insOrderStateMapper; |
| | | // @Resource |
| | | // private InsProductMapper insProductMapper; |
| | | // @Resource |
| | | // private InformationNotificationService informationNotificationService; |
| | | // @Value("${wordUrl}") |
| | | // private String wordUrl; |
| | | // @Value("${file.path}") |
| | | // private String imgUrl; |
| | | // @Value("${file.licenseUrl}") |
| | | // private String licenseUrl; |
| | | // @Resource |
| | | // private InsOrderMapper insOrderMapper; |
| | | // @Resource |
| | | // private IfsInventoryQuantityMapper ifsInventoryQuantityMapper; |
| | | // @Resource |
| | | // private InsUnqualifiedHandlerMapper insUnqualifiedHandlerMapper; |
| | | // @Resource |
| | | // private InsSampleMapper insSampleMapper; |
| | | // @Resource |
| | | // private ThreadPoolTaskExecutor threadPoolTaskExecutor; |
| | | // @Resource |
| | | // private InsOrderService insOrderService; |
| | | // @Resource |
| | | // private WechatProperty wechatProperty; |
| | | // @Resource |
| | | // private InsUnqualifiedRetestProductMapper insUnqualifiedRetestProductMapper; |
| | | // @Resource |
| | | // private IfsApiUtils ifsApiUtils; |
| | | // @Resource |
| | | // private InsSampleUserMapper insSampleUserMapper; |
| | | // |
| | | // |
| | | // @Override |
| | | // public Map<String, Object> pageInsReport(Page page, ReportPageDto reportPageDto) { |
| | | // Map<String, Object> map = new HashMap<>(); |
| | | // map.put("head", PrintChina.printChina(ReportPageDto.class)); |
| | | // Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId("pageInsReport"); |
| | | // User user = userMapper.selectById(map1.get("userId"));//å½åç»å½ç人 |
| | | // //è·åå½å人æå±å®éªå®¤id |
| | | // String departLimsId = user.getDepartLimsId(); |
| | | // String laboratory = null; |
| | | //// if (ObjectUtils.isNotEmpty(departLimsId) && !departLimsId.equals("")) { |
| | | //// String[] split = departLimsId.split(","); |
| | | //// //æ¥è¯¢å¯¹åºæ¶æåç§°(éä¿¡å®éªå®¤,çµåå®éªå®¤,æ£æµå) |
| | | //// String departLims = insOrderMapper.seldepLimsId(Integer.parseInt(split[split.length - 1])); |
| | | //// if (departLims.contains("å®éªå®¤")) { |
| | | //// laboratory = departLims; |
| | | //// } |
| | | //// } |
| | | // |
| | | // Integer createOrderUser = null; |
| | | // if (map1.get("look") == 1) { |
| | | // //个人 |
| | | // createOrderUser = map1.get("userId"); |
| | | // } |
| | | // String queryStatus = reportPageDto.getQueryStatus(); |
| | | // reportPageDto.setQueryStatus(null); |
| | | // |
| | | // map.put("body", insReportMapper.pageInsReport(page, |
| | | // QueryWrappers.queryWrappers(reportPageDto), |
| | | // laboratory, |
| | | // map1.get("userId"), |
| | | // queryStatus, |
| | | // createOrderUser)); |
| | | // return map; |
| | | // } |
| | | // |
| | | // @Override |
| | | // public int inReport(String url, Integer id) { |
| | | // InsReport insReport = new InsReport(); |
| | | // insReport.setId(id); |
| | | // insReport.setUrlS(url); |
| | | // // è¿åpdf |
| | | // String tempUrlPdf = wordToPdfTemp(insReport.getUrlS().replace("/word", wordUrl)); |
| | | // insReport.setTempUrlPdf("/word/" + tempUrlPdf); |
| | | // return insReportMapper.updateById(insReport); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public int upReportUrl(Integer id) { |
| | | // InsReport report = insReportMapper.selectById(id); |
| | | // // è¿åpdf |
| | | // String tempUrlPdf = wordToPdfTemp(report.getUrl().replace("/word", wordUrl)); |
| | | // |
| | | // return insReportMapper.update(null, Wrappers.<InsReport>lambdaUpdate() |
| | | // .eq(InsReport::getId, id) |
| | | // .set(InsReport::getUrlS, null) |
| | | // .set(InsReport::getTempUrlPdf, "/word/" + tempUrlPdf)); |
| | | // } |
| | | // |
| | | // //æäº¤ |
| | | // @Override |
| | | // @Transactional(rollbackFor = Exception.class) |
| | | // public int writeReport(Integer id, Integer userId, Integer submitUserId) { |
| | | // submitUserId = submitUserId == null ? getLook.selectPowerByMethodAndUserId(null).get("userId") : submitUserId; |
| | | // InsReport insReport = insReportMapper.selectById(id); |
| | | // insReport.setId(id); |
| | | // insReport.setState(1); |
| | | // insReport.setWriteUserId(submitUserId);//æäº¤äºº |
| | | // if (userId == null) { |
| | | // throw new ErrorException("缺å°å®¡æ ¸äºº"); |
| | | // } |
| | | // insReport.setExamineUserId(userId);//å®¡æ ¸äºº |
| | | // insReport.setWriteTime(LocalDateTime.now());//æäº¤æ¶é´ |
| | | // //è·åæäº¤äººçç¾åå°å |
| | | // String signatureUrl; |
| | | // try { |
| | | // signatureUrl = userMapper.selectById(insReport.getWriteUserId()).getSignatureUrl(); |
| | | // } catch (Exception e) { |
| | | // throw new ErrorException("æ¾ä¸å°ç¼å¶äººçç¾å"); |
| | | // } |
| | | // if (ObjectUtils.isEmpty(signatureUrl) || signatureUrl.equals("")) { |
| | | // throw new ErrorException("æ¾ä¸å°æ£éªäººçç¾å"); |
| | | // } |
| | | // |
| | | // Integer insOrderId = insReportMapper.selectById(id).getInsOrderId(); |
| | | // InsOrder order = insOrderMapper.selectById(insOrderId); |
| | | // boolean isRawMater = order.getTypeSource() != null && order.getTypeSource().equals(1); |
| | | // |
| | | // //åéæ¶æ¯ |
| | | // InformationNotification info = new InformationNotification(); |
| | | // info.setCreateUser(insProductMapper.selectUserById(userId).get("name")); |
| | | // info.setMessageType("3"); |
| | | // info.setTheme("å®¡æ ¸éç¥"); |
| | | // info.setContent("æ¨æä¸æ¡æ¥åç¼å¶å¾
å®¡æ ¸æ¶æ¯, ç¼å·:" + insReport.getCode()); |
| | | // info.setSenderId(submitUserId); //åé人 |
| | | // info.setConsigneeId(userId); //æ¶ä»¶äºº |
| | | // info.setViewStatus(false); |
| | | // info.setJumpPath("b1-report-preparation"); |
| | | // informationNotificationService.addInformationNotification(info); |
| | | // //ç³»ç»çææ¥åå°å |
| | | // String url = insReport.getUrl(); |
| | | // //æå¨ä¸ä¼ æ¥åå°å |
| | | // String urlS = insReport.getUrlS(); |
| | | // |
| | | // // 夿æ¯å¦æ¯åææ éè¦æ¿æ¢****æä¾åºå |
| | | // IfsInventoryQuantity one = ifsInventoryQuantityMapper.selectOne(new LambdaQueryWrapper<IfsInventoryQuantity>() |
| | | // .eq(IfsInventoryQuantity::getId, order.getIfsInventoryId())); |
| | | // if (one != null) { |
| | | // if (isRawMater && order.getOrderType().equals(InsOrderTypeConstants.ENTER_THE_FACTORY)) { |
| | | // changeText(new HashMap<String, String>() {{ |
| | | // put("**********", one.getSupplierName()); |
| | | // }}, (StrUtil.isBlank(urlS) ? url : urlS).replace("/word", wordUrl)); |
| | | // } |
| | | // } |
| | | // |
| | | // wordInsertUrl(new HashMap<String, Object>() {{ |
| | | // put("writeUrl", Pictures.ofLocal(imgUrl + "/" + signatureUrl).create()); |
| | | // put("writeDateUrl", Pictures.ofStream(DateImageUtil.createDateImage(null)).create()); |
| | | // put("insUrl", Pictures.ofLocal(imgUrl + "/" + signatureUrl).create()); |
| | | // }}, (StrUtil.isBlank(urlS) ? url : urlS).replace("/word", wordUrl)); |
| | | // |
| | | // // ä¿®æ¹ä¸´æ¶pdf |
| | | // String tempUrlPdf = wordToPdfTemp((StrUtil.isBlank(urlS) ? url : urlS).replace("/word", wordUrl)); |
| | | // insReport.setTempUrlPdf("/word/" + tempUrlPdf); |
| | | // |
| | | // insReportMapper.updateById(insReport); |
| | | // |
| | | // // æ¸
ç©ºå®¡æ ¸æ¶é´, å®¡æ ¸ç¶æ |
| | | // insReportMapper.update(null, Wrappers.<InsReport>lambdaUpdate() |
| | | // .eq(InsReport::getId, insReport.getId()) |
| | | // .set(InsReport::getRatifyTime, null) |
| | | // .set(InsReport::getIsRatify, null) |
| | | // .set(InsReport::getExamineTime, null) |
| | | // .set(InsReport::getIsExamine, null)); |
| | | // |
| | | // return 1; |
| | | // } |
| | | // |
| | | // //å®¡æ ¸ |
| | | // @Override |
| | | // @Transactional(rollbackFor = Exception.class) |
| | | // public int examineReport(Integer id, Integer isExamine, String examineTell, Integer userId) { |
| | | // InsReport insReport = insReportMapper.selectById(id); |
| | | // insReport.setIsExamine(isExamine); |
| | | // if (ObjectUtils.isNotEmpty(examineTell)) { |
| | | // insReport.setExamineTell(examineTell); |
| | | // } |
| | | // |
| | | // // æ£éªäºº |
| | | // String userName = insProductMapper.selectUserById(insReport.getWriteUserId()).get("name"); |
| | | // String userAccount = insProductMapper.selectUserById(insReport.getWriteUserId()).get("account"); |
| | | // |
| | | // // å®¡æ ¸äºº |
| | | // Integer checkUserId = getLook.selectPowerByMethodAndUserId(null).get("userId"); |
| | | // String checkUserName = insProductMapper.selectUserById(checkUserId).get("name"); |
| | | // |
| | | // insReport.setExamineTime(LocalDateTime.now());//å®¡æ ¸æ¶é´ |
| | | // if (isExamine == 0) { |
| | | // // åéä¼ä¸å¾®ä¿¡éç¥(å®¡æ ¸éå) |
| | | // threadPoolTaskExecutor.execute(() -> { |
| | | // // æ¥è¯¢è®¢å |
| | | // InsOrder order = insOrderMapper.selectById(insReport.getInsOrderId()); |
| | | // InsSample insSample = insSampleMapper.selectOne(Wrappers.<InsSample>lambdaQuery() |
| | | // .eq(InsSample::getInsOrderId, insReport.getInsOrderId()) |
| | | // .last("limit 1")); |
| | | // // æ¥è¯¢åææ |
| | | // IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(order.getIfsInventoryId()); |
| | | // |
| | | // String message = ""; |
| | | // message += "æ¥åç¼å¶å®¡æ ¸éåéç¥"; |
| | | // message += "\nå®¡æ ¸äºº: " + checkUserName; |
| | | // message += "\nå§æç¼å·: " + order.getEntrustCode(); |
| | | // message += "\næ ·ååç§°: " + insSample.getModel(); |
| | | // message += "\nè§æ ¼åå·: " + order.getPartDetail(); |
| | | // if (ifsInventoryQuantity != null) { |
| | | // message += "\næ¹æ¬¡å·: " + ifsInventoryQuantity.getUpdateBatchNo(); |
| | | // } |
| | | // message += "\néååå : " + examineTell; |
| | | // //åéä¼ä¸å¾®ä¿¡æ¶æ¯éç¥ æäº¤å¤æ ¸ |
| | | // try { |
| | | // WxCpUtils.inform(userAccount, message, null); |
| | | // } catch (Exception e) { |
| | | // throw new RuntimeException(e); |
| | | // } |
| | | // }); |
| | | // |
| | | // //å¦æå®¡æ ¸ä¸éè¿ |
| | | // insReport.setState(0);//æäº¤ç¶ææ¹ä¸ºå¾
æäº¤ |
| | | // return insReportMapper.updateById(insReport); |
| | | // } else { |
| | | // if (userId == null) { |
| | | // throw new ErrorException("ç¼ºå°æ¹å人"); |
| | | // } |
| | | // } |
| | | // insReport.setRatifyUserId(userId);//æ¹å人 |
| | | // //è·åå®¡æ ¸äººçç¾åå°å |
| | | // String signatureUrl; |
| | | // try { |
| | | // signatureUrl = userMapper.selectById(insReport.getExamineUserId()).getSignatureUrl(); |
| | | // } catch (Exception e) { |
| | | // throw new ErrorException("æ¾ä¸å°å®¡æ ¸äººçç¾å"); |
| | | // } |
| | | // if (StringUtils.isBlank(signatureUrl)) { |
| | | // throw new ErrorException("æ¾ä¸å°å®¡æ ¸äººçç¾å"); |
| | | // } |
| | | // |
| | | // // æ¹å人 |
| | | // String sendUserAccount = insProductMapper.selectUserById(userId).get("account"); |
| | | // |
| | | // //åéæ¶æ¯ |
| | | // //å½åç¨æ· |
| | | // Integer currentUser = getLook.selectPowerByMethodAndUserId(null).get("userId"); |
| | | // InformationNotification info = new InformationNotification(); |
| | | // info.setCreateUser(insProductMapper.selectUserById(userId).get("name")); |
| | | // info.setMessageType("3"); |
| | | // info.setTheme("æ¹åéç¥"); |
| | | // info.setContent("æ¨æä¸æ¡æ¥åç¼å¶å¾
æ¹åæ¶æ¯, ç¼å·:" + insReport.getCode()); |
| | | // info.setSenderId(currentUser); //åé人 |
| | | // info.setConsigneeId(userId); //æ¶ä»¶äºº |
| | | // info.setViewStatus(false); |
| | | // info.setJumpPath("b1-report-preparation"); |
| | | // informationNotificationService.addInformationNotification(info); |
| | | // //ç³»ç»çææ¥åå°å |
| | | // String url = insReport.getUrl(); |
| | | // //æå¨ä¸ä¼ æ¥åå°å |
| | | // String urlS = insReport.getUrlS(); |
| | | // wordInsertUrl(new HashMap<String, Object>() {{ |
| | | // put("examineUrl", Pictures.ofLocal(imgUrl + "/" + signatureUrl).create()); |
| | | // put("examineDateUrl", Pictures.ofStream(DateImageUtil.createDateImage(null)).create()); |
| | | // }}, (StrUtil.isBlank(urlS) ? url : urlS).replace("/word", wordUrl)); |
| | | // |
| | | // // ä¿®æ¹ä¸´æ¶pdf |
| | | // String tempUrlPdf = wordToPdfTemp((StrUtil.isBlank(urlS) ? url : urlS).replace("/word", wordUrl)); |
| | | // insReport.setTempUrlPdf("/word/" + tempUrlPdf); |
| | | // |
| | | // // åéä¼ä¸å¾®ä¿¡éç¥(éç¥æ¹å人审æ¹) |
| | | // threadPoolTaskExecutor.execute(() -> { |
| | | // // æ¥è¯¢è®¢å |
| | | // InsOrder order = insOrderMapper.selectById(insReport.getInsOrderId()); |
| | | // InsSample insSample = insSampleMapper.selectOne(Wrappers.<InsSample>lambdaQuery() |
| | | // .eq(InsSample::getInsOrderId, insReport.getInsOrderId()) |
| | | // .last("limit 1")); |
| | | // // æ¥è¯¢åææ |
| | | // IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(order.getIfsInventoryId()); |
| | | // |
| | | // String message = ""; |
| | | // message += "æ¥åç¼å¶æ¹åéç¥"; |
| | | // message += "\næ£éªäºº: " + userName; |
| | | // message += "\n夿 ¸äºº: " + checkUserName; |
| | | // message += "\nå§æç¼å·: " + order.getEntrustCode(); |
| | | // message += "\næ ·ååç§°: " + insSample.getModel(); |
| | | // message += "\nè§æ ¼åå·: " + order.getPartDetail(); |
| | | // if (ifsInventoryQuantity != null) { |
| | | // message += "\nç产åå®¶: " + ifsInventoryQuantity.getSupplierName(); |
| | | // message += "\næ¹æ¬¡å·: " + ifsInventoryQuantity.getUpdateBatchNo(); |
| | | // } |
| | | // //åéä¼ä¸å¾®ä¿¡æ¶æ¯éç¥ æäº¤å¤æ ¸ |
| | | // try { |
| | | // WxCpUtils.inform(sendUserAccount, message, null); |
| | | // } catch (Exception e) { |
| | | // throw new RuntimeException(e); |
| | | // } |
| | | // }); |
| | | // insReportMapper.updateById(insReport); |
| | | // |
| | | // // æ¸
空æ¹å夿³¨, æ¹åæ¶é´, æ¹åç¶æ |
| | | // insReportMapper.update(null, Wrappers.<InsReport>lambdaUpdate() |
| | | // .eq(InsReport::getId, insReport.getId()) |
| | | // .set(InsReport::getExamineTell, null) |
| | | // .set(InsReport::getRatifyTime, null) |
| | | // .set(InsReport::getIsRatify, null)); |
| | | // return 1; |
| | | // } |
| | | // |
| | | // //æ¹å |
| | | // @Override |
| | | // @Transactional(rollbackFor = Exception.class) |
| | | // public int ratifyReport(Integer id, Integer isRatify, String ratifyTell) { |
| | | // InsReport insReport = insReportMapper.selectById(id); |
| | | // insReport.setIsRatify(isRatify); |
| | | // if (ObjectUtils.isNotEmpty(ratifyTell)) { |
| | | // insReport.setRatifyTell(ratifyTell); |
| | | // } |
| | | // insReport.setRatifyTime(LocalDateTime.now());//æ¹åæ¶é´ |
| | | // if (isRatify == 0) { |
| | | // |
| | | // // æ¹å人 |
| | | // Integer ratifyUserId = getLook.selectPowerByMethodAndUserId(null).get("userId"); |
| | | // String ratifyUserName = insProductMapper.selectUserById(ratifyUserId).get("name"); |
| | | // |
| | | // // åé人(å®¡æ ¸äºº)(æ£éªäºº) |
| | | // // æ£éªäºº |
| | | // String userAccount = insProductMapper.selectUserById(insReport.getWriteUserId()).get("account"); |
| | | // // å®¡æ ¸äºº |
| | | // String checkUserAccount = insProductMapper.selectUserById(insReport.getExamineUserId()).get("account"); |
| | | // |
| | | // |
| | | // // åéä¼ä¸å¾®ä¿¡éç¥(æ¹åéå) |
| | | // threadPoolTaskExecutor.execute(() -> { |
| | | // // æ¥è¯¢è®¢å |
| | | // InsOrder order = insOrderMapper.selectById(insReport.getInsOrderId()); |
| | | // InsSample insSample = insSampleMapper.selectOne(Wrappers.<InsSample>lambdaQuery() |
| | | // .eq(InsSample::getInsOrderId, insReport.getInsOrderId()) |
| | | // .last("limit 1")); |
| | | // // æ¥è¯¢åææ |
| | | // IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(order.getIfsInventoryId()); |
| | | // |
| | | // String message = ""; |
| | | // message += "æ¥åç¼å¶æ¹åéåéç¥"; |
| | | // message += "\næ¹å人: " + ratifyUserName; |
| | | // message += "\nå§æç¼å·: " + order.getEntrustCode(); |
| | | // message += "\næ ·ååç§°: " + insSample.getModel(); |
| | | // message += "\nè§æ ¼åå·: " + order.getPartDetail(); |
| | | // if (ifsInventoryQuantity != null) { |
| | | // message += "\næ¹æ¬¡å·: " + ifsInventoryQuantity.getUpdateBatchNo(); |
| | | // } |
| | | // message += "\néååå : " + ratifyTell; |
| | | // //åéä¼ä¸å¾®ä¿¡æ¶æ¯éç¥ æäº¤å¤æ ¸ |
| | | // try { |
| | | // // 审æ¹äºº |
| | | // WxCpUtils.inform(checkUserAccount, message, null); |
| | | // |
| | | // // æ£éªäºº |
| | | // WxCpUtils.inform(userAccount, message, null); |
| | | // } catch (Exception e) { |
| | | // throw new RuntimeException(e); |
| | | // } |
| | | // }); |
| | | // |
| | | // //妿æ¹åä¸éè¿ ç´æ¥éåå°æäº¤äººé£è¾¹å» |
| | | // insReport.setState(0); |
| | | // insReport.setIsExamine(0); |
| | | // return insReportMapper.updateById(insReport); |
| | | // } |
| | | // //è·åæ¹å人çç¾åå°å |
| | | // String signatureUrl; |
| | | // try { |
| | | // signatureUrl = userMapper.selectById(insReport.getRatifyUserId()).getSignatureUrl(); |
| | | // } catch (Exception e) { |
| | | // throw new ErrorException("æ¾ä¸å°æ¹å人çç¾å"); |
| | | // } |
| | | // if (StringUtils.isBlank(signatureUrl)) { |
| | | // throw new ErrorException("æ¾ä¸å°æ¹å人çç¾å"); |
| | | // } |
| | | // Integer insOrderId = insReportMapper.selectById(id).getInsOrderId(); |
| | | // InsOrder order = insOrderMapper.selectById(insOrderId); |
| | | // boolean isRawMater = order.getTypeSource() != null && order.getTypeSource().equals(1); |
| | | // |
| | | // //è·ååºæçæ¥åä¸ç¨ç« |
| | | // String sealUrl; |
| | | // String laboratory = insOrderMapper.selectById(insReport.getInsOrderId()).getLaboratory(); |
| | | // try { |
| | | // String type = ""; |
| | | // if (isRawMater && order.getOrderType().equals(InsOrderTypeConstants.ENTER_THE_FACTORY)) { |
| | | // type = "è¿åæ¥å"; |
| | | // } else { |
| | | // type = "å§ææ¥å"; |
| | | // } |
| | | // sealUrl = insReportMapper.getLaboratoryByName(laboratory, type); |
| | | // } catch (Exception e) { |
| | | // throw new ErrorException(laboratory + "æ¾ä¸å°æ¥åä¸ç¨ç« "); |
| | | // } |
| | | // if (StringUtils.isBlank(sealUrl)) { |
| | | // throw new ErrorException(laboratory + "æ¾ä¸å°æ¥åä¸ç¨ç« "); |
| | | // } |
| | | // //ç³»ç»çææ¥åå°å |
| | | // String url = insReport.getUrl(); |
| | | // //æå¨ä¸ä¼ æ¥åå°å |
| | | // String urlS = insReport.getUrlS(); |
| | | // String finalUrl = (StrUtil.isBlank(urlS) ? url : urlS).replace("/word", wordUrl); |
| | | // |
| | | // wordInsertUrl(new HashMap<String, Object>() {{ |
| | | // put("ratifyUrl", Pictures.ofLocal(imgUrl + "/" + signatureUrl).create()); |
| | | // put("ratifyDateUrl", Pictures.ofStream(DateImageUtil.createDateImage(null)).create()); |
| | | // put("seal1", Pictures.ofLocal(imgUrl + "/" + sealUrl).create()); |
| | | // put("seal2", Pictures.ofLocal(imgUrl + "/" + sealUrl).create()); |
| | | // }}, finalUrl); |
| | | // |
| | | // // ä¿®æ¹ä¸´æ¶pdf |
| | | // insReport.setTempUrlPdf((StrUtil.isBlank(urlS) ? url : urlS).replace(".docx", ".pdf")); |
| | | // |
| | | // InsOrder insOrder = new InsOrder(); |
| | | // insOrder.setId(insOrderId); |
| | | // insOrder.setState(4); |
| | | // insOrderMapper.updateById(insOrder); |
| | | // |
| | | // wordToPdf(finalUrl, sealUrl, isRawMater && order.getOrderType().equals(InsOrderTypeConstants.ENTER_THE_FACTORY)); |
| | | // |
| | | // // 夿æ¯å¦ä¸ºåææ |
| | | // if (isRawMater) { |
| | | // // ä¿®æ¹ifsåºåç¶æ |
| | | // ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>() |
| | | // .set(IfsInventoryQuantity::getState, 2) |
| | | // .eq(IfsInventoryQuantity::getId, order.getIfsInventoryId())); |
| | | // } |
| | | // insReport.setRatifyTell(""); |
| | | // |
| | | // // åéæä»¶å°å§æäºº |
| | | // if (StringUtils.isNotBlank(order.getPrepareCode())) { |
| | | // threadPoolTaskExecutor.execute(() -> { |
| | | // String message = ""; |
| | | // message += "å§æç¼å·: " + order.getEntrustCode(); |
| | | // message += "å§ææ ·å: " + order.getSampleView(); |
| | | // message += "å·²æ£æµç»æ, è¯·æ¥æ¶"; |
| | | // try { |
| | | // WxCpUtils.inform(order.getPrepareCode(), message, new File(finalUrl.replace(".docx", ".pdf"))); |
| | | // } catch (Exception e) { |
| | | // throw new RuntimeException(e); |
| | | // } |
| | | // }); |
| | | // } |
| | | // |
| | | // return insReportMapper.updateById(insReport); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public int wordInsertUrl(Map<String, Object> map, String url) { |
| | | // XWPFTemplate template = XWPFTemplate.compile(url).render(map); |
| | | // try { |
| | | // template.writeAndClose(Files.newOutputStream(Paths.get(url))); |
| | | // } catch (IOException e) { |
| | | // throw new RuntimeException(e); |
| | | // } |
| | | // return 1; |
| | | // } |
| | | // |
| | | // |
| | | // //æ¥åæ¹éä¸è½½ |
| | | // @Override |
| | | // @Transactional(rollbackFor = Exception.class) |
| | | // public String downAll(String ids) { |
| | | // List<Long> list = Arrays.stream(ids.split(",")).map(Long::parseLong).collect(Collectors.toList()); |
| | | // List<InsReport> insReports = insReportMapper.selectBatchIds(list); |
| | | // String zipFilePath = null; |
| | | // // ä¸´æ¶æä»¶å¤¹è·¯å¾ |
| | | // try { |
| | | // String tempFolderPath = wordUrl + "/tempFolder"; |
| | | // File tempFolder = new File(tempFolderPath); |
| | | // if (tempFolder.exists()) { |
| | | // deleteDirectory(tempFolder); // å 餿§çä¸´æ¶æä»¶å¤¹ |
| | | // } |
| | | // tempFolder.mkdirs(); // å建æ°çä¸´æ¶æä»¶å¤¹ |
| | | // for (InsReport insReport : insReports) { |
| | | // File sourceFile = new File((ObjectUtils.isNotEmpty(insReport.getUrlS()) ? insReport.getUrlS() : insReport.getUrl()).replace("/word", wordUrl)); |
| | | // File destinationFile = new File(tempFolder, sourceFile.getName()); |
| | | // Files.copy(sourceFile.toPath(), destinationFile.toPath(), StandardCopyOption.REPLACE_EXISTING); |
| | | // } |
| | | // // åç¼©ä¸´æ¶æä»¶å¤¹ |
| | | // zipFilePath = wordUrl + "/zip/output.zip"; |
| | | // zipDirectory(tempFolderPath, zipFilePath); |
| | | // |
| | | // // æ¸
çä¸´æ¶æä»¶å¤¹ |
| | | // deleteDirectory(tempFolder); |
| | | // |
| | | // System.out.println("ZIPæä»¶åå»ºå®æï¼"); |
| | | // } catch (IOException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // return "/word/zip/output.zip"; |
| | | // } |
| | | // |
| | | // //æ¹éä¸ä¼ |
| | | // @Override |
| | | // @Transactional(rollbackFor = Exception.class) |
| | | // public int upAll(MultipartFile file) throws IOException { |
| | | // File tempFile = null; |
| | | // File unzipDir = null; |
| | | // try { |
| | | // tempFile = File.createTempFile(wordUrl, ".zip"); |
| | | // file.transferTo(tempFile); |
| | | // |
| | | // unzipDir = new File("uploaded_files"); |
| | | // if (!unzipDir.exists()) { |
| | | // unzipDir.mkdir(); |
| | | // } |
| | | // unzip(tempFile, unzipDir); |
| | | // // å¤çè§£ååçæä»¶ |
| | | // File[] files = unzipDir.listFiles(); |
| | | // if (files != null) { |
| | | // for (File f : files) { |
| | | // // æ ¹æ®æä»¶åæ¥è¯¢id |
| | | // String name = f.getName(); |
| | | // InsReport insReport = insReportMapper.selectOne(Wrappers.<InsReport>lambdaQuery().like(InsReport::getCode, f.getName().replace(".docx", "").replace("JCZX", "JCZX/"))); |
| | | // if (ObjectUtils.isEmpty(insReport)) { |
| | | // throw new ErrorException("æ²¡ææ¾å° " + f.getName() + " è¿ä¸ªæä»¶å¯¹åºçæ¥åæ°æ®"); |
| | | // } |
| | | // String urlString; |
| | | // String pathName; |
| | | // try { |
| | | // String path = wordUrl; |
| | | // File realpath = new File(path); |
| | | // if (!realpath.exists()) { |
| | | // realpath.mkdirs(); |
| | | // } |
| | | // pathName = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyMMddHHmmss")) + "_" + f.getName(); |
| | | // urlString = realpath + "/" + pathName; |
| | | // // å¤å¶æä»¶å°æå®è·¯å¾ |
| | | // Files.copy(f.toPath(), new File(urlString).toPath(), StandardCopyOption.REPLACE_EXISTING); |
| | | // inReport("/word/" + pathName, insReport.getId()); |
| | | // } catch (IOException e) { |
| | | // throw new ErrorException("æä»¶ä¸ä¼ 失败"); |
| | | // } |
| | | // } |
| | | // } |
| | | // } catch (IOException e) { |
| | | // throw new ErrorException("æä»¶å¤ç失败"); |
| | | // } finally { |
| | | // if (tempFile != null && tempFile.exists()) { |
| | | // tempFile.delete(); |
| | | // } |
| | | // // éå½å é¤è§£åç®å½åå
¶ä¸çæä»¶ |
| | | // if (unzipDir.exists()) { |
| | | // deleteDirectory(unzipDir); // å 餿§çä¸´æ¶æä»¶å¤¹ |
| | | // } |
| | | // } |
| | | // return 0; |
| | | // } |
| | | // |
| | | // |
| | | // //è§£åæä»¶å¤¹ |
| | | // private void unzip(File zipFile, File destDir) throws IOException { |
| | | // try (ZipFile zip = new ZipFile(zipFile)) { |
| | | // Enumeration<? extends ZipEntry> entries = zip.entries(); |
| | | // while (entries.hasMoreElements()) { |
| | | // ZipEntry entry = entries.nextElement(); |
| | | // File file = new File(destDir, entry.getName()); |
| | | // if (entry.isDirectory()) { |
| | | // file.mkdirs(); |
| | | // } else { |
| | | // file.getParentFile().mkdirs(); |
| | | // try (InputStream in = zip.getInputStream(entry); |
| | | // OutputStream out = new FileOutputStream(file)) { |
| | | // byte[] buffer = new byte[1024]; |
| | | // int len; |
| | | // while ((len = in.read(buffer)) > 0) { |
| | | // out.write(buffer, 0, len); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // |
| | | // // å缩æä»¶å¤¹ |
| | | // public static void zipDirectory(String sourceDirPath, String zipFilePath) throws IOException { |
| | | // try (ZipOutputStream zipOut = new ZipOutputStream(new FileOutputStream(zipFilePath))) { |
| | | // Path sourceDir = Paths.get(sourceDirPath); |
| | | // Files.walk(sourceDir) |
| | | // .filter(path -> !Files.isDirectory(path)) |
| | | // .forEach(path -> { |
| | | // ZipEntry zipEntry = new ZipEntry(sourceDir.relativize(path).toString()); |
| | | // try { |
| | | // zipOut.putNextEntry(zipEntry); |
| | | // Files.copy(path, zipOut); |
| | | // zipOut.closeEntry(); |
| | | // } catch (IOException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // }); |
| | | // } |
| | | // } |
| | | // |
| | | // // å 餿件夹åå
¶å
容 |
| | | // public static void deleteDirectory(File directory) throws IOException { |
| | | // if (directory.isDirectory()) { |
| | | // File[] files = directory.listFiles(); |
| | | // if (files != null) { |
| | | // for (File file : files) { |
| | | // deleteDirectory(file); |
| | | // } |
| | | // } |
| | | // } |
| | | // Files.delete(directory.toPath()); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void wordToPdf(String path, String sealUrl, boolean isRawMater) { |
| | | // try { |
| | | // wordToPdf(path, path.replace(".docx", ".pdf"), sealUrl, isRawMater); |
| | | // } catch (Exception e) { |
| | | // throw new ErrorException("转æ¢å¤±è´¥"); |
| | | // } |
| | | // } |
| | | // |
| | | // |
| | | // public String wordToPdf(String wordPath, String pdfPath, String sealUrl, boolean isRawMater) { |
| | | // FileOutputStream os = null; |
| | | // try { |
| | | // //åè¯ ä¸ç¶åæ¢åææ°´å° |
| | | //// InputStream is = this.getClass().getResourceAsStream("/lib/license.xml"); |
| | | //// InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("license.xml"); |
| | | // InputStream is = Files.newInputStream(new File(licenseUrl).toPath()); |
| | | // License license = new License(); |
| | | // license.setLicense(is); |
| | | // if (!license.getIsLicensed()) { |
| | | // System.out.println("Licenseéªè¯ä¸éè¿..."); |
| | | // return null; |
| | | // } |
| | | // //çæä¸ä¸ªç©ºçPDFæä»¶ |
| | | // File file; |
| | | // //夿æ¯å¦æ¯è¿åæ¥å |
| | | // if (!isRawMater) { |
| | | // file = new File(pdfPath.replace(".pdf", "-1.pdf")); |
| | | // } else { |
| | | // file = new File(pdfPath.replace(".pdf", ".pdf")); |
| | | // } |
| | | // os = new FileOutputStream(file); |
| | | // //è¦è½¬æ¢çwordæä»¶ |
| | | // com.aspose.words.Document doc = new com.aspose.words.Document(wordPath); |
| | | // doc.save(os, SaveFormat.PDF); |
| | | // |
| | | // //æ·»å éªç¼ç« |
| | | // if (!isRawMater) { |
| | | // stamperCheckMarkPDF(pdfPath.replace(".pdf", "-1.pdf"), pdfPath, imgUrl + "/" + sealUrl); |
| | | // } |
| | | // |
| | | // |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } finally { |
| | | // if (os != null) { |
| | | // try { |
| | | // os.close(); |
| | | // } catch (IOException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | // } |
| | | // return null; |
| | | // } |
| | | // |
| | | // /** |
| | | // * åå²å¾ç |
| | | // * |
| | | // * @param Path å¾çè·¯å¾ |
| | | // * @param n åå²ä»½æ° |
| | | // */ |
| | | // public static com.itextpdf.text.Image[] slicingImages(String Path, int n) throws IOException, BadElementException { |
| | | // com.itextpdf.text.Image[] nImage = new com.itextpdf.text.Image[n]; |
| | | // BufferedImage img = ImageIO.read(new File(Path)); |
| | | // |
| | | // int h = img.getHeight(); |
| | | // int w = img.getWidth(); |
| | | // |
| | | // int sw = w / n; |
| | | // for (int i = 0; i < n; i++) { |
| | | // BufferedImage subImg; |
| | | // if (i == n - 1) {//æåå©ä½é¨å |
| | | // subImg = img.getSubimage(i * sw, 0, w - i * sw, h); |
| | | // } else {//ån-1åååå |
| | | // subImg = img.getSubimage(i * sw, 0, sw, h); |
| | | // } |
| | | // ByteArrayOutputStream out = new ByteArrayOutputStream(); |
| | | // ImageIO.write(subImg, Path.substring(Path.lastIndexOf('.') + 1), out); |
| | | // nImage[i] = com.itextpdf.text.Image.getInstance(out.toByteArray()); |
| | | // |
| | | // } |
| | | // return nImage; |
| | | // } |
| | | // |
| | | // /** |
| | | // * çéªç¼ç« |
| | | // * |
| | | // * @param infilePath åPDFè·¯å¾ |
| | | // * @param outFilePath è¾åºPDFè·¯å¾ |
| | | // */ |
| | | // public static void stamperCheckMarkPDF(String infilePath, String outFilePath, String picPath) throws IOException, DocumentException { |
| | | // PdfReader reader = new PdfReader(infilePath);//éæ©éè¦å°ç« çpdf |
| | | // PdfStamper stamp = new PdfStamper(reader, new FileOutputStream(outFilePath));//å å®å°ç« åçpdf |
| | | // |
| | | // |
| | | // com.itextpdf.text.Rectangle pageSize = reader.getPageSize(1);//è·å¾ç¬¬ä¸é¡µ |
| | | // float height = pageSize.getHeight(); |
| | | // float width = pageSize.getWidth(); |
| | | // |
| | | // int nums = reader.getNumberOfPages(); |
| | | // com.itextpdf.text.Image[] nImage = slicingImages(picPath, nums);//çæéªç¼ç« åå²å¾ç |
| | | // |
| | | // for (int n = 1; n <= nums; n++) { |
| | | // PdfContentByte over = stamp.getOverContent(n);//设置å¨ç¬¬å 页æå°å°ç« |
| | | // com.itextpdf.text.Image img = nImage[n - 1];//éæ©å¾ç |
| | | // float newHeight = 100f; |
| | | // float newWidth = img.getWidth() / (img.getHeight() / 100); |
| | | // img.scaleAbsolute(newWidth, newHeight);//æ§å¶å¾çå¤§å° |
| | | // img.setAbsolutePosition(width - newWidth, height / 2 - newHeight / 2);//æ§å¶å¾çä½ç½® |
| | | // over.addImage(img); |
| | | // } |
| | | // stamp.close(); |
| | | // } |
| | | // |
| | | // @Transactional(rollbackFor = Exception.class) |
| | | // public void isRawMaterial(InsOrder insOrder) { |
| | | // IfsInventoryQuantity one = ifsInventoryQuantityMapper.selectOne(new LambdaQueryWrapper<IfsInventoryQuantity>() |
| | | // .eq(IfsInventoryQuantity::getId, insOrder.getIfsInventoryId())); |
| | | // if (Objects.isNull(one)) { |
| | | // throw new ErrorException("æ¾ä¸å°åææä¿¡æ¯"); |
| | | // } |
| | | // // 夿æ¯å¦æä¸åæ ¼ä¿¡æ¯ |
| | | // Long count = insUnqualifiedHandlerMapper.selectCount(Wrappers.<InsUnqualifiedHandler>lambdaQuery() |
| | | // .eq(InsUnqualifiedHandler::getInventoryQuantityId, one.getId())); |
| | | // String toLocation = null; |
| | | // |
| | | // // 夿æ¯å¦æä¸åæ ¼ |
| | | // Long unqualifiedCount = getUnqualifiedCount(insOrder); |
| | | // |
| | | // if (count.equals(0L) && unqualifiedCount.equals(0L) && one.getIsFinish().equals(0) && one.getIsSource().equals(1)) { |
| | | // // åææç§»åº |
| | | // toLocation = this.moveRawMaterial(one); |
| | | // } |
| | | // |
| | | // // å¤æç»æç¶æä¿®æ¹åæ ¼ç¶æ |
| | | // int inspectStatus = (count == 0 && unqualifiedCount == 0) ? 1 : 2; |
| | | // insOrderMapper.update(null, Wrappers.<InsOrder>lambdaUpdate() |
| | | // .eq(InsOrder::getId, insOrder.getId()) |
| | | // .set(InsOrder::getInsResult, inspectStatus)); |
| | | // |
| | | // if (one.getIsFinish().equals(0)) { |
| | | // ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate() |
| | | // .eq(IfsInventoryQuantity::getId, insOrder.getIfsInventoryId()) |
| | | // .set(IfsInventoryQuantity::getInspectStatus, inspectStatus)); |
| | | // |
| | | // // ä¿®æ¹ifsåºåç¶æ |
| | | // if (StringUtils.isBlank(toLocation)) { |
| | | // ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>() |
| | | // .set(IfsInventoryQuantity::getIsFinish, 1) |
| | | // .eq(IfsInventoryQuantity::getId, insOrder.getIfsInventoryId())); |
| | | // } else { |
| | | // ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>() |
| | | // .set(IfsInventoryQuantity::getIsFinish, 1) |
| | | // .set(IfsInventoryQuantity::getToLocation, toLocation) |
| | | // .eq(IfsInventoryQuantity::getId, insOrder.getIfsInventoryId())); |
| | | // } |
| | | // |
| | | // threadPoolTaskExecutor.execute(() -> { |
| | | // // ä¼ä¸å¾®ä¿¡éç¥ |
| | | // String message = ""; |
| | | // message += "æ£æµç»ææäº¤éç¥"; |
| | | // message += "\næ¹æ¬¡å·: " + one.getUpdateBatchNo(); |
| | | // message += "\né¶ä»¶å·: " + one.getPartNo(); |
| | | // message += "\né¶ä»¶æè¿°: " + one.getPartDesc(); |
| | | // message += "\nä¾åºååç§°: " + one.getSupplierName(); |
| | | // message += "\næµè¾¾æ°é: " + one.getQtyArrived().stripTrailingZeros().toPlainString() + one.getBuyUnitMeas(); |
| | | // // åéä¼ä¸inspectStatusä¿¡éç¥ |
| | | // if (inspectStatus == 1) { |
| | | // message += "\næ£æµç»æ: åæ ¼"; |
| | | // } else { |
| | | // message += "\næ£æµç»æ: ä¸åæ ¼"; |
| | | // } |
| | | // WxCpUtils.informWebHook(wechatProperty.getExaminingUrl(), message); |
| | | // }); |
| | | // |
| | | // } |
| | | // |
| | | // |
| | | // } |
| | | // |
| | | // /** |
| | | // * 夿æ¯å¦æä¸åæ ¼ |
| | | // * @param insOrder |
| | | // * @return |
| | | // */ |
| | | // @Override |
| | | // public Long getUnqualifiedCount(InsOrder insOrder) { |
| | | // Long unqualifiedCount = 0L; |
| | | // List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery() |
| | | // .eq(InsSample::getInsOrderId, insOrder.getId())); |
| | | // if (CollectionUtils.isNotEmpty(insSamples)) { |
| | | // unqualifiedCount = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery() |
| | | // .in(InsProduct::getInsSampleId, insSamples.stream().map(InsSample::getId).collect(Collectors.toList())) |
| | | // .eq(InsProduct::getInsResult, 0)); |
| | | // |
| | | // // 夿妿æä¸åæ ¼çæ£éªé¡¹, å¤æææ²¡ææ£éªé¡¹å¤æµ, 夿 ¸åæ ¼ä¹ç®åæ ¼éè¿ |
| | | // if (!unqualifiedCount.equals(0L)) { |
| | | // List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() |
| | | // .in(InsProduct::getInsSampleId, insSamples.stream().map(InsSample::getId).collect(Collectors.toList())) |
| | | // .eq(InsProduct::getInsResult, 0)); |
| | | // |
| | | // boolean flag = true; |
| | | // for (InsProduct insProduct : insProducts) { |
| | | // Long unqualifiedProductCount = insUnqualifiedRetestProductMapper.selectCount(Wrappers.<InsUnqualifiedRetestProduct>lambdaQuery() |
| | | // .eq(InsUnqualifiedRetestProduct::getInsProductId, insProduct.getId()) |
| | | // .ne(InsUnqualifiedRetestProduct::getInsResult, 0)); |
| | | // if (unqualifiedProductCount != 2) { |
| | | // flag = false; |
| | | // } |
| | | // } |
| | | // if (flag) { |
| | | // unqualifiedCount = 0L; |
| | | // } |
| | | // } |
| | | // } |
| | | // return unqualifiedCount; |
| | | // } |
| | | // |
| | | // /** |
| | | // * ifsç§»åºæä½ |
| | | // * @param one |
| | | // * @return |
| | | // */ |
| | | // @Override |
| | | // public String moveRawMaterial(IfsInventoryQuantity one) { |
| | | // String toLocation; |
| | | // // ç»è®°éè´æ£éªç»æSTD |
| | | // if (one.getIsRegister().equals(0)) { |
| | | // Map<String, Object> resultMap = new HashMap<>(); |
| | | // List<Map<String, Object>> resultList = new ArrayList<>(); |
| | | // Map<String, Object> map = new HashMap<>(); |
| | | // map.put("ORDER_NO", one.getOrderNo()); // éè´è®¢åå· |
| | | // map.put("LINE_NO", one.getLineNo()); // è¡å· |
| | | // map.put("RELEASE_NO", one.getReleaseNo()); // ä¸è¾¾å· |
| | | // map.put("RECEIPT_NO", one.getReceiptNo()); // æ¥æ¶å· |
| | | // map.put("PURCH_QTY", one.getQtyToInspect()); // è¦æ£éªçéè´æ°é |
| | | // resultList.add(map); |
| | | // resultMap.put("RECORD_ID", UUID.randomUUID().toString()); |
| | | // resultMap.put("SYSCODE", "LIMS"); |
| | | // resultMap.put("SYSMODEL", "ç»è®°éè´æ£éªç»æ"); |
| | | // resultMap.put("BATCH_INFO", resultList); |
| | | // Result result = ifsApiUtils.getProcurementResults(JSONUtil.toJsonStr(resultMap)); |
| | | // if (result.getCode() != 200) { |
| | | // throw new ErrorException("IFSç»è®°éè´æ£éªç»æå¤±è´¥: " + result.getMessage()); |
| | | // } |
| | | // } |
| | | // insOrderService.updateIfsInventoryQuantity(one.getId()); |
| | | // /** |
| | | // * TODO åç»éè¦è°ç¨IFSçæ¥å£ ç§»å
¥çåºä½å· toLocation |
| | | // */ |
| | | // // æ£éªåç§»åº |
| | | // toLocation = "1301"; |
| | | // Map<String, Object> moveResultMap = new HashMap<>(); |
| | | // List<Map<String, Object>> moveResultList = new ArrayList<>(); |
| | | // Map<String, Object> moveMap = new HashMap<>(); |
| | | // moveMap.put("ORDER_NO", one.getOrderNo()); // éè´è®¢åå· |
| | | // moveMap.put("LINE_NO", one.getLineNo()); |
| | | // moveMap.put("RELEASE_NO", one.getReleaseNo()); |
| | | // moveMap.put("RECEIPT_NO", one.getReceiptNo()); |
| | | // moveMap.put("PART_NO", one.getPartNo()); |
| | | // moveMap.put("QTY", one.getQtyArrived()); |
| | | // moveMap.put("LOCATION_NO", one.getLocationNo()); |
| | | // moveMap.put("TO_LOCATION_NO", toLocation); |
| | | // moveMap.put("LOT_BATCH_NO", one.getLotBatchNo()); |
| | | // moveMap.put("SERIAL_NO", one.getSerialNo()); |
| | | // moveMap.put("WAIV_DEV_REJ_NO", one.getWaivDevRejNo()); |
| | | // moveMap.put("ENG_CHG_LEVEL", one.getEngChgLevel()); |
| | | // moveMap.put("ACTIVITY_SEQ", one.getActivitySeq()); |
| | | // moveResultList.add(moveMap); |
| | | // moveResultMap.put("RECORD_ID", UUID.randomUUID().toString()); |
| | | // moveResultMap.put("SYSCODE", "LIMS"); |
| | | // moveResultMap.put("SYSMODEL", "æ£éªåç§»åº"); |
| | | // moveResultMap.put("BATCH_INFO", moveResultList); |
| | | // |
| | | // Result result1 = ifsApiUtils.moveReceipt(JSONUtil.toJsonStr(moveResultMap)); |
| | | // // 妿æå¿
须为é¶ä»¶æå®æ¹å·æ¥ééè¦éæ°æäº¤ç§»åºä¿¡æ¯å»æå®æ¹å· |
| | | // if (result1.getCode() != 200) { |
| | | // String message = result1.getMessage(); |
| | | // if (message.contains("å¿
须为é¶ä»¶") && message.contains("æå®æ¹å·")) { |
| | | // updaeBatch(one, toLocation); |
| | | // } else { |
| | | // throw new ErrorException("IFSæ£éªåç§»åºå¤±è´¥: " + result1.getMessage()); |
| | | // } |
| | | // } |
| | | // return toLocation; |
| | | // } |
| | | // |
| | | // /** |
| | | // * éåå°æ£éªä»»å¡ |
| | | // * @param id |
| | | // * @return |
| | | // */ |
| | | // @Override |
| | | // @Transactional(rollbackFor = Exception.class) |
| | | // public boolean sendBackTask(Integer id) { |
| | | // InsReport report = insReportMapper.selectById(id); |
| | | // // æ ¹æ®è®¢åæ¥è¯¢è¯éªå®¤ |
| | | // String laboratory = insOrderMapper.selectLaboratoryByOrderId(report.getInsOrderId()); |
| | | // |
| | | // // ä¿®æ¹è®¢åç¶æ |
| | | // insOrderStateMapper.update(null, Wrappers.<InsOrderState>lambdaUpdate() |
| | | // .eq(InsOrderState::getInsOrderId, report.getInsOrderId()) |
| | | // .eq(InsOrderState::getLaboratory, laboratory) |
| | | // .set(InsOrderState::getInsState, 4)); |
| | | // |
| | | // Integer insSampleId = insSampleUserMapper.selectOne(Wrappers.<InsSampleUser>lambdaQuery() |
| | | // .eq(InsSampleUser::getInsSampleId, report.getInsOrderId()) |
| | | // .orderByDesc(InsSampleUser::getId) |
| | | // .last("limit 1")).getId(); |
| | | // insSampleUserMapper.deleteById(insSampleId); |
| | | // |
| | | // // ä¿®æ¹æ¥åè¡ä¸ºæªæ¾ç¤º |
| | | // insReportMapper.update(null, Wrappers.<InsReport>lambdaUpdate() |
| | | // .eq(InsReport::getId, id) |
| | | // .set(InsReport::getIsPass, 0)); |
| | | // |
| | | // return false; |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * å
ä¿®æ¹éè´è®¢åæ¹æ¬¡å·, åè¿è¡ç§»åºæä½ |
| | | // * @param one |
| | | // * @param toLocation |
| | | // */ |
| | | // private void updaeBatch(IfsInventoryQuantity one, String toLocation) { |
| | | // if (one.getIsUpdateBatch().equals(0)) { |
| | | // // å
ä¿®æ¹æ¹æ¬¡å·åè¿è¡ç§»åº |
| | | // Map<String, Object> resultMap = new HashMap<>(); |
| | | // List<Map<String, Object>> resultList = new ArrayList<>(); |
| | | // Map<String, Object> map = new HashMap<>(); |
| | | // map.put("ORDER_NO", one.getOrderNo()); // éè´è®¢åå· |
| | | // map.put("LINE_NO", one.getLineNo()); // è¡å· |
| | | // map.put("RELEASE_NO", one.getReleaseNo()); // ä¸è¾¾å· |
| | | // map.put("RECEIPT_NO", one.getReceiptNo()); // æ¥æ¶å· |
| | | // map.put("PART_NO", one.getPartNo()); //é¶ä»¶å· |
| | | // map.put("CONFIGURATION_ID", one.getConfigurationId()); // é
ç½®æ è¯ |
| | | // map.put("LOCATION_NO", one.getLocationNo()); // åºä½å· |
| | | // map.put("LOT_BATCH_NO", one.getLotBatchNo());// æ¹æ¬¡å· |
| | | // map.put("NEW_LOT_BATCH_NO", one.getUpdateBatchNo()); // ç®æ æ¹æ¬¡å· |
| | | // map.put("SERIAL_NO", one.getSerialNo()); // åºåå· |
| | | // map.put("ENG_CHG_LEVEL", one.getEngChgLevel()); // çæ¬å· |
| | | // map.put("WAIV_DEV_REJ_NO", one.getWaivDevRejNo()); // wdrå· |
| | | // map.put("ACTIVITY_SEQ", one.getActivitySeq()); // æ´»å¨åºå· |
| | | // map.put("QTY_TO_CHANGE", one.getQtyArrived()); // åæ´æ°é |
| | | // resultList.add(map); |
| | | // resultMap.put("RECORD_ID", UUID.randomUUID().toString()); |
| | | // resultMap.put("SYSCODE", "LIMS"); |
| | | // resultMap.put("SYSMODEL", "ä¿®æ¹éè´è®¢åæ¹æ¬¡å·"); |
| | | // resultMap.put("BATCH_INFO", resultList); |
| | | // |
| | | // Result result = ifsApiUtils.updateMoveReceiptLot(JSONUtil.toJsonStr(resultMap)); |
| | | // |
| | | // if (result.getCode() != 200) { |
| | | // throw new ErrorException("IFSä¿®æ¹æ¹æ¬¡å·å¤±è´¥: " + result.getMessage()); |
| | | // } |
| | | // ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate() |
| | | // .set(IfsInventoryQuantity::getIsUpdateBatch, 1) |
| | | // .eq(IfsInventoryQuantity::getId, one.getId())); |
| | | // } |
| | | // |
| | | // Map<String, Object> moveResultMap = new HashMap<>(); |
| | | // List<Map<String, Object>> moveResultList = new ArrayList<>(); |
| | | // Map<String, Object> moveMap = new HashMap<>(); |
| | | // moveMap.put("ORDER_NO", one.getOrderNo()); // éè´è®¢åå· |
| | | // moveMap.put("LINE_NO", one.getLineNo()); |
| | | // moveMap.put("RELEASE_NO", one.getReleaseNo()); |
| | | // moveMap.put("RECEIPT_NO", one.getReceiptNo()); |
| | | // moveMap.put("PART_NO", one.getPartNo()); |
| | | // moveMap.put("QTY", one.getQtyArrived()); |
| | | // moveMap.put("LOCATION_NO", one.getLocationNo()); |
| | | // moveMap.put("TO_LOCATION_NO", toLocation); |
| | | // moveMap.put("LOT_BATCH_NO", one.getUpdateBatchNo()); |
| | | // moveMap.put("SERIAL_NO", one.getSerialNo()); |
| | | // moveMap.put("WAIV_DEV_REJ_NO", one.getWaivDevRejNo()); |
| | | // moveMap.put("ENG_CHG_LEVEL", one.getEngChgLevel()); |
| | | // moveMap.put("ACTIVITY_SEQ", one.getActivitySeq()); |
| | | // moveResultList.add(moveMap); |
| | | // moveResultMap.put("RECORD_ID", UUID.randomUUID().toString()); |
| | | // moveResultMap.put("SYSCODE", "LIMS"); |
| | | // moveResultMap.put("SYSMODEL", "æ£éªåç§»åº"); |
| | | // moveResultMap.put("BATCH_INFO", moveResultList); |
| | | // |
| | | // Result result1 = ifsApiUtils.moveReceipt(JSONUtil.toJsonStr(moveResultMap)); |
| | | // if (result1.getCode() != 200) { |
| | | // throw new ErrorException("IFSæ£éªåç§»åºå¤±è´¥: " + result1.getMessage()); |
| | | // } |
| | | // |
| | | // } |
| | | // |
| | | // /** |
| | | // * æ¿æ¢æ®µè½ææ¬ |
| | | // * @param filePath docxè§£æå¯¹è±¡ |
| | | // * @param textMap éè¦æ¿æ¢çä¿¡æ¯éå |
| | | // */ |
| | | // public static void changeText(Map<String, String> textMap, String filePath) { |
| | | // try { |
| | | // FileInputStream stream = new FileInputStream(filePath); |
| | | // XWPFDocument document = new XWPFDocument(stream); |
| | | // List<XWPFTable> tables = document.getTables(); |
| | | // for (XWPFTable table : tables) { |
| | | // for (XWPFTableRow row : table.getRows()) { |
| | | // for (XWPFTableCell cell : row.getTableCells()) { |
| | | // |
| | | // textMap.forEach((s, s2) -> { |
| | | // if (cell.getText().equals(s)) { |
| | | // XWPFParagraph paragraph = cell.getParagraphs().get(0); |
| | | // XWPFRun oldRun = paragraph.getRuns().get(0); |
| | | // // ä¿ååæ ·å¼ |
| | | // String fontFamily = oldRun.getFontFamily(); |
| | | // int fontSize = oldRun.getFontSize(); |
| | | // String color = oldRun.getColor(); |
| | | // ParagraphAlignment alignment = paragraph.getAlignment(); |
| | | // // æ¿æ¢å
容 |
| | | // paragraph.removeRun(0); // ç§»é¤åæç run |
| | | // XWPFRun newRun = paragraph.createRun(); |
| | | // newRun.setText(s2); |
| | | // // åºç¨åæ ·å¼ |
| | | // newRun.setFontFamily(fontFamily); |
| | | // newRun.setFontSize(fontSize); |
| | | // newRun.setColor(color); |
| | | // paragraph.setAlignment(alignment); |
| | | // } |
| | | // }); |
| | | // } |
| | | // } |
| | | // } |
| | | // FileOutputStream fileOutputStream = new FileOutputStream(filePath); |
| | | // document.write(fileOutputStream); |
| | | // fileOutputStream.close(); |
| | | // |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // throw new ErrorException(e.getMessage()); |
| | | // } |
| | | // } |
| | | // |
| | | // /** |
| | | // * word转æ¢pdf |
| | | // * @param path |
| | | // * @return |
| | | // */ |
| | | // private String wordToPdfTemp(String path) { |
| | | // try { |
| | | // return wordToPdf(path, path.replace(".docx", "-临æ¶.pdf")); |
| | | // } catch (Exception e) { |
| | | // throw new ErrorException("转æ¢å¤±è´¥"); |
| | | // } |
| | | // } |
| | | // |
| | | // private String wordToPdf(String wordPath, String pdfPath) { |
| | | // FileOutputStream os = null; |
| | | // try { |
| | | // //åè¯ ä¸ç¶åæ¢åææ°´å° |
| | | // InputStream is = Files.newInputStream(new File(licenseUrl).toPath()); |
| | | // License license = new License(); |
| | | // license.setLicense(is); |
| | | // if (!license.getIsLicensed()) { |
| | | // System.out.println("Licenseéªè¯ä¸éè¿..."); |
| | | // return null; |
| | | // } |
| | | // //çæä¸ä¸ªç©ºçPDFæä»¶ |
| | | // File file; |
| | | // //夿æ¯å¦æ¯è¿åæ¥å |
| | | // file = new File(pdfPath); |
| | | // os = new FileOutputStream(file); |
| | | // //è¦è½¬æ¢çwordæä»¶ |
| | | // com.aspose.words.Document doc = new com.aspose.words.Document(wordPath); |
| | | // doc.save(os, SaveFormat.PDF); |
| | | // String name = file.getName(); |
| | | // return file.getName(); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } finally { |
| | | // if (os != null) { |
| | | // try { |
| | | // os.close(); |
| | | // } catch (IOException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | // } |
| | | // return null; |
| | | // } |
| | | //} |
| | | // |
| | | // |
| | | // |
| | | // |
| | | // |
| | | // |
| | | package com.ruoyi.inspect.service.impl; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.aspose.words.License; |
| | | import com.aspose.words.SaveFormat; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.deepoove.poi.XWPFTemplate; |
| | | import com.deepoove.poi.data.Pictures; |
| | | import com.itextpdf.text.BadElementException; |
| | | import com.itextpdf.text.DocumentException; |
| | | import com.itextpdf.text.pdf.PdfContentByte; |
| | | import com.itextpdf.text.pdf.PdfReader; |
| | | import com.itextpdf.text.pdf.PdfStamper; |
| | | import com.ruoyi.basic.mapper.IfsInventoryQuantityMapper; |
| | | import com.ruoyi.basic.pojo.IfsInventoryQuantity; |
| | | import com.ruoyi.common.constant.InsOrderTypeConstants; |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.common.core.domain.entity.InformationNotification; |
| | | import com.ruoyi.common.core.domain.entity.User; |
| | | import com.ruoyi.common.properties.WechatProperty; |
| | | import com.ruoyi.common.utils.*; |
| | | import com.ruoyi.framework.exception.ErrorException; |
| | | import com.ruoyi.inspect.dto.ReportPageDto; |
| | | import com.ruoyi.inspect.mapper.*; |
| | | import com.ruoyi.inspect.pojo.*; |
| | | import com.ruoyi.inspect.service.InsOrderService; |
| | | import com.ruoyi.inspect.service.InsReportService; |
| | | import com.ruoyi.inspect.mapper.InsUnqualifiedHandlerMapper; |
| | | import com.ruoyi.system.mapper.UserMapper; |
| | | import com.ruoyi.system.service.InformationNotificationService; |
| | | import org.apache.poi.xwpf.usermodel.*; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.imageio.ImageIO; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.*; |
| | | import java.nio.file.Files; |
| | | import java.nio.file.Path; |
| | | import java.nio.file.Paths; |
| | | import java.nio.file.StandardCopyOption; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import java.util.zip.ZipEntry; |
| | | import java.util.zip.ZipFile; |
| | | import java.util.zip.ZipOutputStream; |
| | | |
| | | /** |
| | | * @author Administrator |
| | | * @description é对表ãins_report(æ£éªæ¥å)ãçæ°æ®åºæä½Serviceå®ç° |
| | | * @createDate 2024-03-17 22:10:02 |
| | | */ |
| | | @Service |
| | | public class InsReportServiceImpl extends ServiceImpl<InsReportMapper, InsReport> |
| | | implements InsReportService { |
| | | @Resource |
| | | private UserMapper userMapper; |
| | | @Resource |
| | | private InsReportMapper insReportMapper; |
| | | @Resource |
| | | private InsOrderStateMapper insOrderStateMapper; |
| | | @Resource |
| | | private InsProductMapper insProductMapper; |
| | | @Resource |
| | | private InformationNotificationService informationNotificationService; |
| | | @Value("${wordUrl}") |
| | | private String wordUrl; |
| | | @Value("${file.path}") |
| | | private String imgUrl; |
| | | @Value("${file.licenseUrl}") |
| | | private String licenseUrl; |
| | | @Resource |
| | | private InsOrderMapper insOrderMapper; |
| | | @Resource |
| | | private IfsInventoryQuantityMapper ifsInventoryQuantityMapper; |
| | | @Resource |
| | | private InsUnqualifiedHandlerMapper insUnqualifiedHandlerMapper; |
| | | @Resource |
| | | private InsSampleMapper insSampleMapper; |
| | | @Resource |
| | | private ThreadPoolTaskExecutor threadPoolTaskExecutor; |
| | | @Resource |
| | | private InsOrderService insOrderService; |
| | | @Resource |
| | | private WechatProperty wechatProperty; |
| | | @Resource |
| | | private InsUnqualifiedRetestProductMapper insUnqualifiedRetestProductMapper; |
| | | @Resource |
| | | private IfsApiUtils ifsApiUtils; |
| | | @Resource |
| | | private InsSampleUserMapper insSampleUserMapper; |
| | | |
| | | |
| | | @Override |
| | | public Map<String, Object> pageInsReport(Page page, ReportPageDto reportPageDto) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | // todo: ä»
çèªå·± |
| | | //è·åå½å人æå±å®éªå®¤id |
| | | String laboratory = null; |
| | | Integer createOrderUser = null; |
| | | String queryStatus = reportPageDto.getQueryStatus(); |
| | | reportPageDto.setQueryStatus(null); |
| | | |
| | | map.put("body", insReportMapper.pageInsReport(page, |
| | | QueryWrappers.queryWrappers(reportPageDto), |
| | | laboratory, |
| | | SecurityUtils.getUserId().intValue(), |
| | | queryStatus, |
| | | createOrderUser)); |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | public int inReport(String url, Integer id) { |
| | | InsReport insReport = new InsReport(); |
| | | insReport.setId(id); |
| | | insReport.setUrlS(url); |
| | | // è¿åpdf |
| | | String tempUrlPdf = wordToPdfTemp(insReport.getUrlS().replace("/word", wordUrl)); |
| | | insReport.setTempUrlPdf("/word/" + tempUrlPdf); |
| | | return insReportMapper.updateById(insReport); |
| | | } |
| | | |
| | | @Override |
| | | public int upReportUrl(Integer id) { |
| | | InsReport report = insReportMapper.selectById(id); |
| | | // è¿åpdf |
| | | String tempUrlPdf = wordToPdfTemp(report.getUrl().replace("/word", wordUrl)); |
| | | |
| | | return insReportMapper.update(null, Wrappers.<InsReport>lambdaUpdate() |
| | | .eq(InsReport::getId, id) |
| | | .set(InsReport::getUrlS, null) |
| | | .set(InsReport::getTempUrlPdf, "/word/" + tempUrlPdf)); |
| | | } |
| | | |
| | | //æäº¤ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int writeReport(Integer id, Integer userId, Integer submitUserId) { |
| | | submitUserId = submitUserId == null ? SecurityUtils.getUserId().intValue() : submitUserId; |
| | | InsReport insReport = insReportMapper.selectById(id); |
| | | insReport.setId(id); |
| | | insReport.setState(1); |
| | | insReport.setWriteUserId(submitUserId);//æäº¤äºº |
| | | if (userId == null) { |
| | | throw new ErrorException("缺å°å®¡æ ¸äºº"); |
| | | } |
| | | insReport.setExamineUserId(userId);//å®¡æ ¸äºº |
| | | insReport.setWriteTime(LocalDateTime.now());//æäº¤æ¶é´ |
| | | //è·åæäº¤äººçç¾åå°å |
| | | String signatureUrl; |
| | | try { |
| | | signatureUrl = userMapper.selectById(insReport.getWriteUserId()).getSignatureUrl(); |
| | | } catch (Exception e) { |
| | | throw new ErrorException("æ¾ä¸å°ç¼å¶äººçç¾å"); |
| | | } |
| | | if (ObjectUtils.isEmpty(signatureUrl) || signatureUrl.equals("")) { |
| | | throw new ErrorException("æ¾ä¸å°æ£éªäººçç¾å"); |
| | | } |
| | | |
| | | Integer insOrderId = insReportMapper.selectById(id).getInsOrderId(); |
| | | InsOrder order = insOrderMapper.selectById(insOrderId); |
| | | boolean isRawMater = order.getTypeSource() != null && order.getTypeSource().equals(1); |
| | | |
| | | //åéæ¶æ¯ |
| | | InformationNotification info = new InformationNotification(); |
| | | info.setCreateUser(insProductMapper.selectUserById(userId).get("name")); |
| | | info.setMessageType("3"); |
| | | info.setTheme("å®¡æ ¸éç¥"); |
| | | info.setContent("æ¨æä¸æ¡æ¥åç¼å¶å¾
å®¡æ ¸æ¶æ¯, ç¼å·:" + insReport.getCode()); |
| | | info.setSenderId(submitUserId); //åé人 |
| | | info.setConsigneeId(userId); //æ¶ä»¶äºº |
| | | info.setViewStatus(false); |
| | | info.setJumpPath("b1-report-preparation"); |
| | | informationNotificationService.addInformationNotification(info); |
| | | //ç³»ç»çææ¥åå°å |
| | | String url = insReport.getUrl(); |
| | | //æå¨ä¸ä¼ æ¥åå°å |
| | | String urlS = insReport.getUrlS(); |
| | | |
| | | // 夿æ¯å¦æ¯åææ éè¦æ¿æ¢****æä¾åºå |
| | | IfsInventoryQuantity one = ifsInventoryQuantityMapper.selectOne(new LambdaQueryWrapper<IfsInventoryQuantity>() |
| | | .eq(IfsInventoryQuantity::getId, order.getIfsInventoryId())); |
| | | if (one != null) { |
| | | if (isRawMater && order.getOrderType().equals(InsOrderTypeConstants.ENTER_THE_FACTORY)) { |
| | | changeText(new HashMap<String, String>() {{ |
| | | put("**********", one.getSupplierName()); |
| | | }}, (StrUtil.isBlank(urlS) ? url : urlS).replace("/word", wordUrl)); |
| | | } |
| | | } |
| | | |
| | | wordInsertUrl(new HashMap<String, Object>() {{ |
| | | put("writeUrl", Pictures.ofLocal(imgUrl + "/" + signatureUrl).create()); |
| | | put("writeDateUrl", Pictures.ofStream(DateImageUtil.createDateImage(null)).create()); |
| | | put("insUrl", Pictures.ofLocal(imgUrl + "/" + signatureUrl).create()); |
| | | }}, (StrUtil.isBlank(urlS) ? url : urlS).replace("/word", wordUrl)); |
| | | |
| | | // ä¿®æ¹ä¸´æ¶pdf |
| | | String tempUrlPdf = wordToPdfTemp((StrUtil.isBlank(urlS) ? url : urlS).replace("/word", wordUrl)); |
| | | insReport.setTempUrlPdf("/word/" + tempUrlPdf); |
| | | |
| | | insReportMapper.updateById(insReport); |
| | | |
| | | // æ¸
ç©ºå®¡æ ¸æ¶é´, å®¡æ ¸ç¶æ |
| | | insReportMapper.update(null, Wrappers.<InsReport>lambdaUpdate() |
| | | .eq(InsReport::getId, insReport.getId()) |
| | | .set(InsReport::getRatifyTime, null) |
| | | .set(InsReport::getIsRatify, null) |
| | | .set(InsReport::getExamineTime, null) |
| | | .set(InsReport::getIsExamine, null)); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | //å®¡æ ¸ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int examineReport(Integer id, Integer isExamine, String examineTell, Integer userId) { |
| | | InsReport insReport = insReportMapper.selectById(id); |
| | | insReport.setIsExamine(isExamine); |
| | | if (ObjectUtils.isNotEmpty(examineTell)) { |
| | | insReport.setExamineTell(examineTell); |
| | | } |
| | | |
| | | // æ£éªäºº |
| | | String userName = insProductMapper.selectUserById(insReport.getWriteUserId()).get("name"); |
| | | String userAccount = insProductMapper.selectUserById(insReport.getWriteUserId()).get("account"); |
| | | |
| | | // å®¡æ ¸äºº |
| | | Integer checkUserId = SecurityUtils.getUserId().intValue(); |
| | | String checkUserName = insProductMapper.selectUserById(checkUserId).get("name"); |
| | | |
| | | insReport.setExamineTime(LocalDateTime.now());//å®¡æ ¸æ¶é´ |
| | | if (isExamine == 0) { |
| | | // åéä¼ä¸å¾®ä¿¡éç¥(å®¡æ ¸éå) |
| | | threadPoolTaskExecutor.execute(() -> { |
| | | // æ¥è¯¢è®¢å |
| | | InsOrder order = insOrderMapper.selectById(insReport.getInsOrderId()); |
| | | InsSample insSample = insSampleMapper.selectOne(Wrappers.<InsSample>lambdaQuery() |
| | | .eq(InsSample::getInsOrderId, insReport.getInsOrderId()) |
| | | .last("limit 1")); |
| | | // æ¥è¯¢åææ |
| | | IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(order.getIfsInventoryId()); |
| | | |
| | | String message = ""; |
| | | message += "æ¥åç¼å¶å®¡æ ¸éåéç¥"; |
| | | message += "\nå®¡æ ¸äºº: " + checkUserName; |
| | | message += "\nå§æç¼å·: " + order.getEntrustCode(); |
| | | message += "\næ ·ååç§°: " + insSample.getModel(); |
| | | message += "\nè§æ ¼åå·: " + order.getPartDetail(); |
| | | if (ifsInventoryQuantity != null) { |
| | | message += "\næ¹æ¬¡å·: " + ifsInventoryQuantity.getUpdateBatchNo(); |
| | | } |
| | | message += "\néååå : " + examineTell; |
| | | //åéä¼ä¸å¾®ä¿¡æ¶æ¯éç¥ æäº¤å¤æ ¸ |
| | | try { |
| | | WxCpUtils.inform(userAccount, message, null); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | }); |
| | | |
| | | //å¦æå®¡æ ¸ä¸éè¿ |
| | | insReport.setState(0);//æäº¤ç¶ææ¹ä¸ºå¾
æäº¤ |
| | | return insReportMapper.updateById(insReport); |
| | | } else { |
| | | if (userId == null) { |
| | | throw new ErrorException("ç¼ºå°æ¹å人"); |
| | | } |
| | | } |
| | | insReport.setRatifyUserId(userId);//æ¹å人 |
| | | //è·åå®¡æ ¸äººçç¾åå°å |
| | | String signatureUrl; |
| | | try { |
| | | signatureUrl = userMapper.selectById(insReport.getExamineUserId()).getSignatureUrl(); |
| | | } catch (Exception e) { |
| | | throw new ErrorException("æ¾ä¸å°å®¡æ ¸äººçç¾å"); |
| | | } |
| | | if (StringUtils.isBlank(signatureUrl)) { |
| | | throw new ErrorException("æ¾ä¸å°å®¡æ ¸äººçç¾å"); |
| | | } |
| | | |
| | | // æ¹å人 |
| | | String sendUserAccount = insProductMapper.selectUserById(userId).get("account"); |
| | | |
| | | //åéæ¶æ¯ |
| | | InformationNotification info = new InformationNotification(); |
| | | info.setCreateUser(insProductMapper.selectUserById(userId).get("name")); |
| | | info.setMessageType("3"); |
| | | info.setTheme("æ¹åéç¥"); |
| | | info.setContent("æ¨æä¸æ¡æ¥åç¼å¶å¾
æ¹åæ¶æ¯, ç¼å·:" + insReport.getCode()); |
| | | info.setSenderId(checkUserId); //åé人 |
| | | info.setConsigneeId(userId); //æ¶ä»¶äºº |
| | | info.setViewStatus(false); |
| | | info.setJumpPath("b1-report-preparation"); |
| | | informationNotificationService.addInformationNotification(info); |
| | | //ç³»ç»çææ¥åå°å |
| | | String url = insReport.getUrl(); |
| | | //æå¨ä¸ä¼ æ¥åå°å |
| | | String urlS = insReport.getUrlS(); |
| | | wordInsertUrl(new HashMap<String, Object>() {{ |
| | | put("examineUrl", Pictures.ofLocal(imgUrl + "/" + signatureUrl).create()); |
| | | put("examineDateUrl", Pictures.ofStream(DateImageUtil.createDateImage(null)).create()); |
| | | }}, (StrUtil.isBlank(urlS) ? url : urlS).replace("/word", wordUrl)); |
| | | |
| | | // ä¿®æ¹ä¸´æ¶pdf |
| | | String tempUrlPdf = wordToPdfTemp((StrUtil.isBlank(urlS) ? url : urlS).replace("/word", wordUrl)); |
| | | insReport.setTempUrlPdf("/word/" + tempUrlPdf); |
| | | |
| | | // åéä¼ä¸å¾®ä¿¡éç¥(éç¥æ¹å人审æ¹) |
| | | threadPoolTaskExecutor.execute(() -> { |
| | | // æ¥è¯¢è®¢å |
| | | InsOrder order = insOrderMapper.selectById(insReport.getInsOrderId()); |
| | | InsSample insSample = insSampleMapper.selectOne(Wrappers.<InsSample>lambdaQuery() |
| | | .eq(InsSample::getInsOrderId, insReport.getInsOrderId()) |
| | | .last("limit 1")); |
| | | // æ¥è¯¢åææ |
| | | IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(order.getIfsInventoryId()); |
| | | |
| | | String message = ""; |
| | | message += "æ¥åç¼å¶æ¹åéç¥"; |
| | | message += "\næ£éªäºº: " + userName; |
| | | message += "\n夿 ¸äºº: " + checkUserName; |
| | | message += "\nå§æç¼å·: " + order.getEntrustCode(); |
| | | message += "\næ ·ååç§°: " + insSample.getModel(); |
| | | message += "\nè§æ ¼åå·: " + order.getPartDetail(); |
| | | if (ifsInventoryQuantity != null) { |
| | | message += "\nç产åå®¶: " + ifsInventoryQuantity.getSupplierName(); |
| | | message += "\næ¹æ¬¡å·: " + ifsInventoryQuantity.getUpdateBatchNo(); |
| | | } |
| | | //åéä¼ä¸å¾®ä¿¡æ¶æ¯éç¥ æäº¤å¤æ ¸ |
| | | try { |
| | | WxCpUtils.inform(sendUserAccount, message, null); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | }); |
| | | insReportMapper.updateById(insReport); |
| | | |
| | | // æ¸
空æ¹å夿³¨, æ¹åæ¶é´, æ¹åç¶æ |
| | | insReportMapper.update(null, Wrappers.<InsReport>lambdaUpdate() |
| | | .eq(InsReport::getId, insReport.getId()) |
| | | .set(InsReport::getExamineTell, null) |
| | | .set(InsReport::getRatifyTime, null) |
| | | .set(InsReport::getIsRatify, null)); |
| | | return 1; |
| | | } |
| | | |
| | | //æ¹å |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int ratifyReport(Integer id, Integer isRatify, String ratifyTell) { |
| | | InsReport insReport = insReportMapper.selectById(id); |
| | | insReport.setIsRatify(isRatify); |
| | | if (ObjectUtils.isNotEmpty(ratifyTell)) { |
| | | insReport.setRatifyTell(ratifyTell); |
| | | } |
| | | insReport.setRatifyTime(LocalDateTime.now());//æ¹åæ¶é´ |
| | | if (isRatify == 0) { |
| | | |
| | | // æ¹å人 |
| | | Integer ratifyUserId = SecurityUtils.getUserId().intValue(); |
| | | String ratifyUserName = insProductMapper.selectUserById(ratifyUserId).get("name"); |
| | | |
| | | // åé人(å®¡æ ¸äºº)(æ£éªäºº) |
| | | // æ£éªäºº |
| | | String userAccount = insProductMapper.selectUserById(insReport.getWriteUserId()).get("account"); |
| | | // å®¡æ ¸äºº |
| | | String checkUserAccount = insProductMapper.selectUserById(insReport.getExamineUserId()).get("account"); |
| | | |
| | | |
| | | // åéä¼ä¸å¾®ä¿¡éç¥(æ¹åéå) |
| | | threadPoolTaskExecutor.execute(() -> { |
| | | // æ¥è¯¢è®¢å |
| | | InsOrder order = insOrderMapper.selectById(insReport.getInsOrderId()); |
| | | InsSample insSample = insSampleMapper.selectOne(Wrappers.<InsSample>lambdaQuery() |
| | | .eq(InsSample::getInsOrderId, insReport.getInsOrderId()) |
| | | .last("limit 1")); |
| | | // æ¥è¯¢åææ |
| | | IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(order.getIfsInventoryId()); |
| | | |
| | | String message = ""; |
| | | message += "æ¥åç¼å¶æ¹åéåéç¥"; |
| | | message += "\næ¹å人: " + ratifyUserName; |
| | | message += "\nå§æç¼å·: " + order.getEntrustCode(); |
| | | message += "\næ ·ååç§°: " + insSample.getModel(); |
| | | message += "\nè§æ ¼åå·: " + order.getPartDetail(); |
| | | if (ifsInventoryQuantity != null) { |
| | | message += "\næ¹æ¬¡å·: " + ifsInventoryQuantity.getUpdateBatchNo(); |
| | | } |
| | | message += "\néååå : " + ratifyTell; |
| | | //åéä¼ä¸å¾®ä¿¡æ¶æ¯éç¥ æäº¤å¤æ ¸ |
| | | try { |
| | | // 审æ¹äºº |
| | | WxCpUtils.inform(checkUserAccount, message, null); |
| | | |
| | | // æ£éªäºº |
| | | WxCpUtils.inform(userAccount, message, null); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | }); |
| | | |
| | | //妿æ¹åä¸éè¿ ç´æ¥éåå°æäº¤äººé£è¾¹å» |
| | | insReport.setState(0); |
| | | insReport.setIsExamine(0); |
| | | return insReportMapper.updateById(insReport); |
| | | } |
| | | //è·åæ¹å人çç¾åå°å |
| | | String signatureUrl; |
| | | try { |
| | | signatureUrl = userMapper.selectById(insReport.getRatifyUserId()).getSignatureUrl(); |
| | | } catch (Exception e) { |
| | | throw new ErrorException("æ¾ä¸å°æ¹å人çç¾å"); |
| | | } |
| | | if (StringUtils.isBlank(signatureUrl)) { |
| | | throw new ErrorException("æ¾ä¸å°æ¹å人çç¾å"); |
| | | } |
| | | Integer insOrderId = insReportMapper.selectById(id).getInsOrderId(); |
| | | InsOrder order = insOrderMapper.selectById(insOrderId); |
| | | boolean isRawMater = order.getTypeSource() != null && order.getTypeSource().equals(1); |
| | | |
| | | //è·ååºæçæ¥åä¸ç¨ç« |
| | | String sealUrl; |
| | | String laboratory = insOrderMapper.selectById(insReport.getInsOrderId()).getLaboratory(); |
| | | try { |
| | | String type = ""; |
| | | if (isRawMater && order.getOrderType().equals(InsOrderTypeConstants.ENTER_THE_FACTORY)) { |
| | | type = "è¿åæ¥å"; |
| | | } else { |
| | | type = "å§ææ¥å"; |
| | | } |
| | | sealUrl = insReportMapper.getLaboratoryByName(laboratory, type); |
| | | } catch (Exception e) { |
| | | throw new ErrorException(laboratory + "æ¾ä¸å°æ¥åä¸ç¨ç« "); |
| | | } |
| | | if (StringUtils.isBlank(sealUrl)) { |
| | | throw new ErrorException(laboratory + "æ¾ä¸å°æ¥åä¸ç¨ç« "); |
| | | } |
| | | //ç³»ç»çææ¥åå°å |
| | | String url = insReport.getUrl(); |
| | | //æå¨ä¸ä¼ æ¥åå°å |
| | | String urlS = insReport.getUrlS(); |
| | | String finalUrl = (StrUtil.isBlank(urlS) ? url : urlS).replace("/word", wordUrl); |
| | | |
| | | wordInsertUrl(new HashMap<String, Object>() {{ |
| | | put("ratifyUrl", Pictures.ofLocal(imgUrl + "/" + signatureUrl).create()); |
| | | put("ratifyDateUrl", Pictures.ofStream(DateImageUtil.createDateImage(null)).create()); |
| | | put("seal1", Pictures.ofLocal(imgUrl + "/" + sealUrl).create()); |
| | | put("seal2", Pictures.ofLocal(imgUrl + "/" + sealUrl).create()); |
| | | }}, finalUrl); |
| | | |
| | | // ä¿®æ¹ä¸´æ¶pdf |
| | | insReport.setTempUrlPdf((StrUtil.isBlank(urlS) ? url : urlS).replace(".docx", ".pdf")); |
| | | |
| | | InsOrder insOrder = new InsOrder(); |
| | | insOrder.setId(insOrderId); |
| | | insOrder.setState(4); |
| | | insOrderMapper.updateById(insOrder); |
| | | |
| | | wordToPdf(finalUrl, sealUrl, isRawMater && order.getOrderType().equals(InsOrderTypeConstants.ENTER_THE_FACTORY)); |
| | | |
| | | // 夿æ¯å¦ä¸ºåææ |
| | | if (isRawMater) { |
| | | // ä¿®æ¹ifsåºåç¶æ |
| | | ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>() |
| | | .set(IfsInventoryQuantity::getState, 2) |
| | | .eq(IfsInventoryQuantity::getId, order.getIfsInventoryId())); |
| | | } |
| | | insReport.setRatifyTell(""); |
| | | |
| | | // åéæä»¶å°å§æäºº |
| | | if (StringUtils.isNotBlank(order.getPrepareCode())) { |
| | | threadPoolTaskExecutor.execute(() -> { |
| | | String message = ""; |
| | | message += "å§æç¼å·: " + order.getEntrustCode(); |
| | | message += "å§ææ ·å: " + order.getSampleView(); |
| | | message += "å·²æ£æµç»æ, è¯·æ¥æ¶"; |
| | | try { |
| | | WxCpUtils.inform(order.getPrepareCode(), message, new File(finalUrl.replace(".docx", ".pdf"))); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | return insReportMapper.updateById(insReport); |
| | | } |
| | | |
| | | @Override |
| | | public int wordInsertUrl(Map<String, Object> map, String url) { |
| | | XWPFTemplate template = XWPFTemplate.compile(url).render(map); |
| | | try { |
| | | template.writeAndClose(Files.newOutputStream(Paths.get(url))); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | //æ¥åæ¹éä¸è½½ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public String downAll(String ids) { |
| | | List<Long> list = Arrays.stream(ids.split(",")).map(Long::parseLong).collect(Collectors.toList()); |
| | | List<InsReport> insReports = insReportMapper.selectBatchIds(list); |
| | | String zipFilePath = null; |
| | | // ä¸´æ¶æä»¶å¤¹è·¯å¾ |
| | | try { |
| | | String tempFolderPath = wordUrl + "/tempFolder"; |
| | | File tempFolder = new File(tempFolderPath); |
| | | if (tempFolder.exists()) { |
| | | deleteDirectory(tempFolder); // å 餿§çä¸´æ¶æä»¶å¤¹ |
| | | } |
| | | tempFolder.mkdirs(); // å建æ°çä¸´æ¶æä»¶å¤¹ |
| | | for (InsReport insReport : insReports) { |
| | | File sourceFile = new File((ObjectUtils.isNotEmpty(insReport.getUrlS()) ? insReport.getUrlS() : insReport.getUrl()).replace("/word", wordUrl)); |
| | | File destinationFile = new File(tempFolder, sourceFile.getName()); |
| | | Files.copy(sourceFile.toPath(), destinationFile.toPath(), StandardCopyOption.REPLACE_EXISTING); |
| | | } |
| | | // åç¼©ä¸´æ¶æä»¶å¤¹ |
| | | zipFilePath = wordUrl + "/zip/output.zip"; |
| | | zipDirectory(tempFolderPath, zipFilePath); |
| | | |
| | | // æ¸
çä¸´æ¶æä»¶å¤¹ |
| | | deleteDirectory(tempFolder); |
| | | |
| | | System.out.println("ZIPæä»¶åå»ºå®æï¼"); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return "/word/zip/output.zip"; |
| | | } |
| | | |
| | | //æ¹éä¸ä¼ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int upAll(MultipartFile file) throws IOException { |
| | | File tempFile = null; |
| | | File unzipDir = null; |
| | | try { |
| | | tempFile = File.createTempFile(wordUrl, ".zip"); |
| | | file.transferTo(tempFile); |
| | | |
| | | unzipDir = new File("uploaded_files"); |
| | | if (!unzipDir.exists()) { |
| | | unzipDir.mkdir(); |
| | | } |
| | | unzip(tempFile, unzipDir); |
| | | // å¤çè§£ååçæä»¶ |
| | | File[] files = unzipDir.listFiles(); |
| | | if (files != null) { |
| | | for (File f : files) { |
| | | // æ ¹æ®æä»¶åæ¥è¯¢id |
| | | String name = f.getName(); |
| | | InsReport insReport = insReportMapper.selectOne(Wrappers.<InsReport>lambdaQuery().like(InsReport::getCode, f.getName().replace(".docx", "").replace("JCZX", "JCZX/"))); |
| | | if (ObjectUtils.isEmpty(insReport)) { |
| | | throw new ErrorException("æ²¡ææ¾å° " + f.getName() + " è¿ä¸ªæä»¶å¯¹åºçæ¥åæ°æ®"); |
| | | } |
| | | String urlString; |
| | | String pathName; |
| | | try { |
| | | String path = wordUrl; |
| | | File realpath = new File(path); |
| | | if (!realpath.exists()) { |
| | | realpath.mkdirs(); |
| | | } |
| | | pathName = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyMMddHHmmss")) + "_" + f.getName(); |
| | | urlString = realpath + "/" + pathName; |
| | | // å¤å¶æä»¶å°æå®è·¯å¾ |
| | | Files.copy(f.toPath(), new File(urlString).toPath(), StandardCopyOption.REPLACE_EXISTING); |
| | | inReport("/word/" + pathName, insReport.getId()); |
| | | } catch (IOException e) { |
| | | throw new ErrorException("æä»¶ä¸ä¼ 失败"); |
| | | } |
| | | } |
| | | } |
| | | } catch (IOException e) { |
| | | throw new ErrorException("æä»¶å¤ç失败"); |
| | | } finally { |
| | | if (tempFile != null && tempFile.exists()) { |
| | | tempFile.delete(); |
| | | } |
| | | // éå½å é¤è§£åç®å½åå
¶ä¸çæä»¶ |
| | | if (unzipDir.exists()) { |
| | | deleteDirectory(unzipDir); // å 餿§çä¸´æ¶æä»¶å¤¹ |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | //è§£åæä»¶å¤¹ |
| | | private void unzip(File zipFile, File destDir) throws IOException { |
| | | try (ZipFile zip = new ZipFile(zipFile)) { |
| | | Enumeration<? extends ZipEntry> entries = zip.entries(); |
| | | while (entries.hasMoreElements()) { |
| | | ZipEntry entry = entries.nextElement(); |
| | | File file = new File(destDir, entry.getName()); |
| | | if (entry.isDirectory()) { |
| | | file.mkdirs(); |
| | | } else { |
| | | file.getParentFile().mkdirs(); |
| | | try (InputStream in = zip.getInputStream(entry); |
| | | OutputStream out = new FileOutputStream(file)) { |
| | | byte[] buffer = new byte[1024]; |
| | | int len; |
| | | while ((len = in.read(buffer)) > 0) { |
| | | out.write(buffer, 0, len); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // å缩æä»¶å¤¹ |
| | | public static void zipDirectory(String sourceDirPath, String zipFilePath) throws IOException { |
| | | try (ZipOutputStream zipOut = new ZipOutputStream(new FileOutputStream(zipFilePath))) { |
| | | Path sourceDir = Paths.get(sourceDirPath); |
| | | Files.walk(sourceDir) |
| | | .filter(path -> !Files.isDirectory(path)) |
| | | .forEach(path -> { |
| | | ZipEntry zipEntry = new ZipEntry(sourceDir.relativize(path).toString()); |
| | | try { |
| | | zipOut.putNextEntry(zipEntry); |
| | | Files.copy(path, zipOut); |
| | | zipOut.closeEntry(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | // å 餿件夹åå
¶å
容 |
| | | public static void deleteDirectory(File directory) throws IOException { |
| | | if (directory.isDirectory()) { |
| | | File[] files = directory.listFiles(); |
| | | if (files != null) { |
| | | for (File file : files) { |
| | | deleteDirectory(file); |
| | | } |
| | | } |
| | | } |
| | | Files.delete(directory.toPath()); |
| | | } |
| | | |
| | | @Override |
| | | public void wordToPdf(String path, String sealUrl, boolean isRawMater) { |
| | | try { |
| | | wordToPdf(path, path.replace(".docx", ".pdf"), sealUrl, isRawMater); |
| | | } catch (Exception e) { |
| | | throw new ErrorException("转æ¢å¤±è´¥"); |
| | | } |
| | | } |
| | | |
| | | |
| | | public String wordToPdf(String wordPath, String pdfPath, String sealUrl, boolean isRawMater) { |
| | | FileOutputStream os = null; |
| | | try { |
| | | //åè¯ ä¸ç¶åæ¢åææ°´å° |
| | | // InputStream is = this.getClass().getResourceAsStream("/lib/license.xml"); |
| | | // InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("license.xml"); |
| | | InputStream is = Files.newInputStream(new File(licenseUrl).toPath()); |
| | | License license = new License(); |
| | | license.setLicense(is); |
| | | if (!license.getIsLicensed()) { |
| | | System.out.println("Licenseéªè¯ä¸éè¿..."); |
| | | return null; |
| | | } |
| | | //çæä¸ä¸ªç©ºçPDFæä»¶ |
| | | File file; |
| | | //夿æ¯å¦æ¯è¿åæ¥å |
| | | if (!isRawMater) { |
| | | file = new File(pdfPath.replace(".pdf", "-1.pdf")); |
| | | } else { |
| | | file = new File(pdfPath.replace(".pdf", ".pdf")); |
| | | } |
| | | os = new FileOutputStream(file); |
| | | //è¦è½¬æ¢çwordæä»¶ |
| | | com.aspose.words.Document doc = new com.aspose.words.Document(wordPath); |
| | | doc.save(os, SaveFormat.PDF); |
| | | |
| | | //æ·»å éªç¼ç« |
| | | if (!isRawMater) { |
| | | stamperCheckMarkPDF(pdfPath.replace(".pdf", "-1.pdf"), pdfPath, imgUrl + "/" + sealUrl); |
| | | } |
| | | |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | if (os != null) { |
| | | try { |
| | | os.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * åå²å¾ç |
| | | * |
| | | * @param Path å¾çè·¯å¾ |
| | | * @param n åå²ä»½æ° |
| | | */ |
| | | public static com.itextpdf.text.Image[] slicingImages(String Path, int n) throws IOException, BadElementException { |
| | | com.itextpdf.text.Image[] nImage = new com.itextpdf.text.Image[n]; |
| | | BufferedImage img = ImageIO.read(new File(Path)); |
| | | |
| | | int h = img.getHeight(); |
| | | int w = img.getWidth(); |
| | | |
| | | int sw = w / n; |
| | | for (int i = 0; i < n; i++) { |
| | | BufferedImage subImg; |
| | | if (i == n - 1) {//æåå©ä½é¨å |
| | | subImg = img.getSubimage(i * sw, 0, w - i * sw, h); |
| | | } else {//ån-1åååå |
| | | subImg = img.getSubimage(i * sw, 0, sw, h); |
| | | } |
| | | ByteArrayOutputStream out = new ByteArrayOutputStream(); |
| | | ImageIO.write(subImg, Path.substring(Path.lastIndexOf('.') + 1), out); |
| | | nImage[i] = com.itextpdf.text.Image.getInstance(out.toByteArray()); |
| | | |
| | | } |
| | | return nImage; |
| | | } |
| | | |
| | | /** |
| | | * çéªç¼ç« |
| | | * |
| | | * @param infilePath åPDFè·¯å¾ |
| | | * @param outFilePath è¾åºPDFè·¯å¾ |
| | | */ |
| | | public static void stamperCheckMarkPDF(String infilePath, String outFilePath, String picPath) throws IOException, DocumentException { |
| | | PdfReader reader = new PdfReader(infilePath);//éæ©éè¦å°ç« çpdf |
| | | PdfStamper stamp = new PdfStamper(reader, new FileOutputStream(outFilePath));//å å®å°ç« åçpdf |
| | | |
| | | |
| | | com.itextpdf.text.Rectangle pageSize = reader.getPageSize(1);//è·å¾ç¬¬ä¸é¡µ |
| | | float height = pageSize.getHeight(); |
| | | float width = pageSize.getWidth(); |
| | | |
| | | int nums = reader.getNumberOfPages(); |
| | | com.itextpdf.text.Image[] nImage = slicingImages(picPath, nums);//çæéªç¼ç« åå²å¾ç |
| | | |
| | | for (int n = 1; n <= nums; n++) { |
| | | PdfContentByte over = stamp.getOverContent(n);//设置å¨ç¬¬å 页æå°å°ç« |
| | | com.itextpdf.text.Image img = nImage[n - 1];//éæ©å¾ç |
| | | float newHeight = 100f; |
| | | float newWidth = img.getWidth() / (img.getHeight() / 100); |
| | | img.scaleAbsolute(newWidth, newHeight);//æ§å¶å¾çå¤§å° |
| | | img.setAbsolutePosition(width - newWidth, height / 2 - newHeight / 2);//æ§å¶å¾çä½ç½® |
| | | over.addImage(img); |
| | | } |
| | | stamp.close(); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void isRawMaterial(InsOrder insOrder) { |
| | | IfsInventoryQuantity one = ifsInventoryQuantityMapper.selectOne(new LambdaQueryWrapper<IfsInventoryQuantity>() |
| | | .eq(IfsInventoryQuantity::getId, insOrder.getIfsInventoryId())); |
| | | if (Objects.isNull(one)) { |
| | | throw new ErrorException("æ¾ä¸å°åææä¿¡æ¯"); |
| | | } |
| | | // 夿æ¯å¦æä¸åæ ¼ä¿¡æ¯ |
| | | Long count = insUnqualifiedHandlerMapper.selectCount(Wrappers.<InsUnqualifiedHandler>lambdaQuery() |
| | | .eq(InsUnqualifiedHandler::getInventoryQuantityId, one.getId())); |
| | | String toLocation = null; |
| | | |
| | | // 夿æ¯å¦æä¸åæ ¼ |
| | | Long unqualifiedCount = getUnqualifiedCount(insOrder); |
| | | |
| | | if (count.equals(0L) && unqualifiedCount.equals(0L) && one.getIsFinish().equals(0) && one.getIsSource().equals(1)) { |
| | | // åææç§»åº |
| | | toLocation = this.moveRawMaterial(one); |
| | | } |
| | | |
| | | // å¤æç»æç¶æä¿®æ¹åæ ¼ç¶æ |
| | | int inspectStatus = (count == 0 && unqualifiedCount == 0) ? 1 : 2; |
| | | insOrderMapper.update(null, Wrappers.<InsOrder>lambdaUpdate() |
| | | .eq(InsOrder::getId, insOrder.getId()) |
| | | .set(InsOrder::getInsResult, inspectStatus)); |
| | | |
| | | if (one.getIsFinish().equals(0)) { |
| | | ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate() |
| | | .eq(IfsInventoryQuantity::getId, insOrder.getIfsInventoryId()) |
| | | .set(IfsInventoryQuantity::getInspectStatus, inspectStatus)); |
| | | |
| | | // ä¿®æ¹ifsåºåç¶æ |
| | | if (StringUtils.isBlank(toLocation)) { |
| | | ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>() |
| | | .set(IfsInventoryQuantity::getIsFinish, 1) |
| | | .eq(IfsInventoryQuantity::getId, insOrder.getIfsInventoryId())); |
| | | } else { |
| | | ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>() |
| | | .set(IfsInventoryQuantity::getIsFinish, 1) |
| | | .set(IfsInventoryQuantity::getToLocation, toLocation) |
| | | .eq(IfsInventoryQuantity::getId, insOrder.getIfsInventoryId())); |
| | | } |
| | | |
| | | threadPoolTaskExecutor.execute(() -> { |
| | | // ä¼ä¸å¾®ä¿¡éç¥ |
| | | String message = ""; |
| | | message += "æ£æµç»ææäº¤éç¥"; |
| | | message += "\næ¹æ¬¡å·: " + one.getUpdateBatchNo(); |
| | | message += "\né¶ä»¶å·: " + one.getPartNo(); |
| | | message += "\né¶ä»¶æè¿°: " + one.getPartDesc(); |
| | | message += "\nä¾åºååç§°: " + one.getSupplierName(); |
| | | message += "\næµè¾¾æ°é: " + one.getQtyArrived().stripTrailingZeros().toPlainString() + one.getBuyUnitMeas(); |
| | | // åéä¼ä¸inspectStatusä¿¡éç¥ |
| | | if (inspectStatus == 1) { |
| | | message += "\næ£æµç»æ: åæ ¼"; |
| | | } else { |
| | | message += "\næ£æµç»æ: ä¸åæ ¼"; |
| | | } |
| | | WxCpUtils.informWebHook(wechatProperty.getExaminingUrl(), message); |
| | | }); |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 夿æ¯å¦æä¸åæ ¼ |
| | | * @param insOrder |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Long getUnqualifiedCount(InsOrder insOrder) { |
| | | Long unqualifiedCount = 0L; |
| | | List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery() |
| | | .eq(InsSample::getInsOrderId, insOrder.getId())); |
| | | if (CollectionUtils.isNotEmpty(insSamples)) { |
| | | unqualifiedCount = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery() |
| | | .in(InsProduct::getInsSampleId, insSamples.stream().map(InsSample::getId).collect(Collectors.toList())) |
| | | .eq(InsProduct::getInsResult, 0)); |
| | | |
| | | // 夿妿æä¸åæ ¼çæ£éªé¡¹, å¤æææ²¡ææ£éªé¡¹å¤æµ, 夿 ¸åæ ¼ä¹ç®åæ ¼éè¿ |
| | | if (!unqualifiedCount.equals(0L)) { |
| | | List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() |
| | | .in(InsProduct::getInsSampleId, insSamples.stream().map(InsSample::getId).collect(Collectors.toList())) |
| | | .eq(InsProduct::getInsResult, 0)); |
| | | |
| | | boolean flag = true; |
| | | for (InsProduct insProduct : insProducts) { |
| | | Long unqualifiedProductCount = insUnqualifiedRetestProductMapper.selectCount(Wrappers.<InsUnqualifiedRetestProduct>lambdaQuery() |
| | | .eq(InsUnqualifiedRetestProduct::getInsProductId, insProduct.getId()) |
| | | .ne(InsUnqualifiedRetestProduct::getInsResult, 0)); |
| | | if (unqualifiedProductCount != 2) { |
| | | flag = false; |
| | | } |
| | | } |
| | | if (flag) { |
| | | unqualifiedCount = 0L; |
| | | } |
| | | } |
| | | } |
| | | return unqualifiedCount; |
| | | } |
| | | |
| | | /** |
| | | * ifsç§»åºæä½ |
| | | * @param one |
| | | * @return |
| | | */ |
| | | @Override |
| | | public String moveRawMaterial(IfsInventoryQuantity one) { |
| | | String toLocation; |
| | | // ç»è®°éè´æ£éªç»æSTD |
| | | if (one.getIsRegister().equals(0)) { |
| | | Map<String, Object> resultMap = new HashMap<>(); |
| | | List<Map<String, Object>> resultList = new ArrayList<>(); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("ORDER_NO", one.getOrderNo()); // éè´è®¢åå· |
| | | map.put("LINE_NO", one.getLineNo()); // è¡å· |
| | | map.put("RELEASE_NO", one.getReleaseNo()); // ä¸è¾¾å· |
| | | map.put("RECEIPT_NO", one.getReceiptNo()); // æ¥æ¶å· |
| | | map.put("PURCH_QTY", one.getQtyToInspect()); // è¦æ£éªçéè´æ°é |
| | | resultList.add(map); |
| | | resultMap.put("RECORD_ID", UUID.randomUUID().toString()); |
| | | resultMap.put("SYSCODE", "LIMS"); |
| | | resultMap.put("SYSMODEL", "ç»è®°éè´æ£éªç»æ"); |
| | | resultMap.put("BATCH_INFO", resultList); |
| | | Result result = ifsApiUtils.getProcurementResults(JSONUtil.toJsonStr(resultMap)); |
| | | if (result.getCode() != 200) { |
| | | throw new ErrorException("IFSç»è®°éè´æ£éªç»æå¤±è´¥: " + result.getMessage()); |
| | | } |
| | | } |
| | | insOrderService.updateIfsInventoryQuantity(one.getId()); |
| | | /** |
| | | * TODO åç»éè¦è°ç¨IFSçæ¥å£ ç§»å
¥çåºä½å· toLocation |
| | | */ |
| | | // æ£éªåç§»åº |
| | | toLocation = "1301"; |
| | | Map<String, Object> moveResultMap = new HashMap<>(); |
| | | List<Map<String, Object>> moveResultList = new ArrayList<>(); |
| | | Map<String, Object> moveMap = new HashMap<>(); |
| | | moveMap.put("ORDER_NO", one.getOrderNo()); // éè´è®¢åå· |
| | | moveMap.put("LINE_NO", one.getLineNo()); |
| | | moveMap.put("RELEASE_NO", one.getReleaseNo()); |
| | | moveMap.put("RECEIPT_NO", one.getReceiptNo()); |
| | | moveMap.put("PART_NO", one.getPartNo()); |
| | | moveMap.put("QTY", one.getQtyArrived()); |
| | | moveMap.put("LOCATION_NO", one.getLocationNo()); |
| | | moveMap.put("TO_LOCATION_NO", toLocation); |
| | | moveMap.put("LOT_BATCH_NO", one.getLotBatchNo()); |
| | | moveMap.put("SERIAL_NO", one.getSerialNo()); |
| | | moveMap.put("WAIV_DEV_REJ_NO", one.getWaivDevRejNo()); |
| | | moveMap.put("ENG_CHG_LEVEL", one.getEngChgLevel()); |
| | | moveMap.put("ACTIVITY_SEQ", one.getActivitySeq()); |
| | | moveResultList.add(moveMap); |
| | | moveResultMap.put("RECORD_ID", UUID.randomUUID().toString()); |
| | | moveResultMap.put("SYSCODE", "LIMS"); |
| | | moveResultMap.put("SYSMODEL", "æ£éªåç§»åº"); |
| | | moveResultMap.put("BATCH_INFO", moveResultList); |
| | | |
| | | Result result1 = ifsApiUtils.moveReceipt(JSONUtil.toJsonStr(moveResultMap)); |
| | | // 妿æå¿
须为é¶ä»¶æå®æ¹å·æ¥ééè¦éæ°æäº¤ç§»åºä¿¡æ¯å»æå®æ¹å· |
| | | if (result1.getCode() != 200) { |
| | | String message = result1.getMessage(); |
| | | if (message.contains("å¿
须为é¶ä»¶") && message.contains("æå®æ¹å·")) { |
| | | updaeBatch(one, toLocation); |
| | | } else { |
| | | throw new ErrorException("IFSæ£éªåç§»åºå¤±è´¥: " + result1.getMessage()); |
| | | } |
| | | } |
| | | return toLocation; |
| | | } |
| | | |
| | | /** |
| | | * éåå°æ£éªä»»å¡ |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean sendBackTask(Integer id) { |
| | | InsReport report = insReportMapper.selectById(id); |
| | | // æ ¹æ®è®¢åæ¥è¯¢è¯éªå®¤ |
| | | String laboratory = insOrderMapper.selectLaboratoryByOrderId(report.getInsOrderId()); |
| | | |
| | | // ä¿®æ¹è®¢åç¶æ |
| | | insOrderStateMapper.update(null, Wrappers.<InsOrderState>lambdaUpdate() |
| | | .eq(InsOrderState::getInsOrderId, report.getInsOrderId()) |
| | | .eq(InsOrderState::getLaboratory, laboratory) |
| | | .set(InsOrderState::getInsState, 4)); |
| | | |
| | | Integer insSampleId = insSampleUserMapper.selectOne(Wrappers.<InsSampleUser>lambdaQuery() |
| | | .eq(InsSampleUser::getInsSampleId, report.getInsOrderId()) |
| | | .orderByDesc(InsSampleUser::getId) |
| | | .last("limit 1")).getId(); |
| | | insSampleUserMapper.deleteById(insSampleId); |
| | | |
| | | // ä¿®æ¹æ¥åè¡ä¸ºæªæ¾ç¤º |
| | | insReportMapper.update(null, Wrappers.<InsReport>lambdaUpdate() |
| | | .eq(InsReport::getId, id) |
| | | .set(InsReport::getIsPass, 0)); |
| | | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * å
ä¿®æ¹éè´è®¢åæ¹æ¬¡å·, åè¿è¡ç§»åºæä½ |
| | | * @param one |
| | | * @param toLocation |
| | | */ |
| | | private void updaeBatch(IfsInventoryQuantity one, String toLocation) { |
| | | if (one.getIsUpdateBatch().equals(0)) { |
| | | // å
ä¿®æ¹æ¹æ¬¡å·åè¿è¡ç§»åº |
| | | Map<String, Object> resultMap = new HashMap<>(); |
| | | List<Map<String, Object>> resultList = new ArrayList<>(); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("ORDER_NO", one.getOrderNo()); // éè´è®¢åå· |
| | | map.put("LINE_NO", one.getLineNo()); // è¡å· |
| | | map.put("RELEASE_NO", one.getReleaseNo()); // ä¸è¾¾å· |
| | | map.put("RECEIPT_NO", one.getReceiptNo()); // æ¥æ¶å· |
| | | map.put("PART_NO", one.getPartNo()); //é¶ä»¶å· |
| | | map.put("CONFIGURATION_ID", one.getConfigurationId()); // é
ç½®æ è¯ |
| | | map.put("LOCATION_NO", one.getLocationNo()); // åºä½å· |
| | | map.put("LOT_BATCH_NO", one.getLotBatchNo());// æ¹æ¬¡å· |
| | | map.put("NEW_LOT_BATCH_NO", one.getUpdateBatchNo()); // ç®æ æ¹æ¬¡å· |
| | | map.put("SERIAL_NO", one.getSerialNo()); // åºåå· |
| | | map.put("ENG_CHG_LEVEL", one.getEngChgLevel()); // çæ¬å· |
| | | map.put("WAIV_DEV_REJ_NO", one.getWaivDevRejNo()); // wdrå· |
| | | map.put("ACTIVITY_SEQ", one.getActivitySeq()); // æ´»å¨åºå· |
| | | map.put("QTY_TO_CHANGE", one.getQtyArrived()); // åæ´æ°é |
| | | resultList.add(map); |
| | | resultMap.put("RECORD_ID", UUID.randomUUID().toString()); |
| | | resultMap.put("SYSCODE", "LIMS"); |
| | | resultMap.put("SYSMODEL", "ä¿®æ¹éè´è®¢åæ¹æ¬¡å·"); |
| | | resultMap.put("BATCH_INFO", resultList); |
| | | |
| | | Result result = ifsApiUtils.updateMoveReceiptLot(JSONUtil.toJsonStr(resultMap)); |
| | | |
| | | if (result.getCode() != 200) { |
| | | throw new ErrorException("IFSä¿®æ¹æ¹æ¬¡å·å¤±è´¥: " + result.getMessage()); |
| | | } |
| | | ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate() |
| | | .set(IfsInventoryQuantity::getIsUpdateBatch, 1) |
| | | .eq(IfsInventoryQuantity::getId, one.getId())); |
| | | } |
| | | |
| | | Map<String, Object> moveResultMap = new HashMap<>(); |
| | | List<Map<String, Object>> moveResultList = new ArrayList<>(); |
| | | Map<String, Object> moveMap = new HashMap<>(); |
| | | moveMap.put("ORDER_NO", one.getOrderNo()); // éè´è®¢åå· |
| | | moveMap.put("LINE_NO", one.getLineNo()); |
| | | moveMap.put("RELEASE_NO", one.getReleaseNo()); |
| | | moveMap.put("RECEIPT_NO", one.getReceiptNo()); |
| | | moveMap.put("PART_NO", one.getPartNo()); |
| | | moveMap.put("QTY", one.getQtyArrived()); |
| | | moveMap.put("LOCATION_NO", one.getLocationNo()); |
| | | moveMap.put("TO_LOCATION_NO", toLocation); |
| | | moveMap.put("LOT_BATCH_NO", one.getUpdateBatchNo()); |
| | | moveMap.put("SERIAL_NO", one.getSerialNo()); |
| | | moveMap.put("WAIV_DEV_REJ_NO", one.getWaivDevRejNo()); |
| | | moveMap.put("ENG_CHG_LEVEL", one.getEngChgLevel()); |
| | | moveMap.put("ACTIVITY_SEQ", one.getActivitySeq()); |
| | | moveResultList.add(moveMap); |
| | | moveResultMap.put("RECORD_ID", UUID.randomUUID().toString()); |
| | | moveResultMap.put("SYSCODE", "LIMS"); |
| | | moveResultMap.put("SYSMODEL", "æ£éªåç§»åº"); |
| | | moveResultMap.put("BATCH_INFO", moveResultList); |
| | | |
| | | Result result1 = ifsApiUtils.moveReceipt(JSONUtil.toJsonStr(moveResultMap)); |
| | | if (result1.getCode() != 200) { |
| | | throw new ErrorException("IFSæ£éªåç§»åºå¤±è´¥: " + result1.getMessage()); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * æ¿æ¢æ®µè½ææ¬ |
| | | * @param filePath docxè§£æå¯¹è±¡ |
| | | * @param textMap éè¦æ¿æ¢çä¿¡æ¯éå |
| | | */ |
| | | public static void changeText(Map<String, String> textMap, String filePath) { |
| | | try { |
| | | FileInputStream stream = new FileInputStream(filePath); |
| | | XWPFDocument document = new XWPFDocument(stream); |
| | | List<XWPFTable> tables = document.getTables(); |
| | | for (XWPFTable table : tables) { |
| | | for (XWPFTableRow row : table.getRows()) { |
| | | for (XWPFTableCell cell : row.getTableCells()) { |
| | | |
| | | textMap.forEach((s, s2) -> { |
| | | if (cell.getText().equals(s)) { |
| | | XWPFParagraph paragraph = cell.getParagraphs().get(0); |
| | | XWPFRun oldRun = paragraph.getRuns().get(0); |
| | | // ä¿ååæ ·å¼ |
| | | String fontFamily = oldRun.getFontFamily(); |
| | | int fontSize = oldRun.getFontSize(); |
| | | String color = oldRun.getColor(); |
| | | ParagraphAlignment alignment = paragraph.getAlignment(); |
| | | // æ¿æ¢å
容 |
| | | paragraph.removeRun(0); // ç§»é¤åæç run |
| | | XWPFRun newRun = paragraph.createRun(); |
| | | newRun.setText(s2); |
| | | // åºç¨åæ ·å¼ |
| | | newRun.setFontFamily(fontFamily); |
| | | newRun.setFontSize(fontSize); |
| | | newRun.setColor(color); |
| | | paragraph.setAlignment(alignment); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | FileOutputStream fileOutputStream = new FileOutputStream(filePath); |
| | | document.write(fileOutputStream); |
| | | fileOutputStream.close(); |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new ErrorException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * word转æ¢pdf |
| | | * @param path |
| | | * @return |
| | | */ |
| | | private String wordToPdfTemp(String path) { |
| | | try { |
| | | return wordToPdf(path, path.replace(".docx", "-临æ¶.pdf")); |
| | | } catch (Exception e) { |
| | | throw new ErrorException("转æ¢å¤±è´¥"); |
| | | } |
| | | } |
| | | |
| | | private String wordToPdf(String wordPath, String pdfPath) { |
| | | FileOutputStream os = null; |
| | | try { |
| | | //åè¯ ä¸ç¶åæ¢åææ°´å° |
| | | InputStream is = Files.newInputStream(new File(licenseUrl).toPath()); |
| | | License license = new License(); |
| | | license.setLicense(is); |
| | | if (!license.getIsLicensed()) { |
| | | System.out.println("Licenseéªè¯ä¸éè¿..."); |
| | | return null; |
| | | } |
| | | //çæä¸ä¸ªç©ºçPDFæä»¶ |
| | | File file; |
| | | //夿æ¯å¦æ¯è¿åæ¥å |
| | | file = new File(pdfPath); |
| | | os = new FileOutputStream(file); |
| | | //è¦è½¬æ¢çwordæä»¶ |
| | | com.aspose.words.Document doc = new com.aspose.words.Document(wordPath); |
| | | doc.save(os, SaveFormat.PDF); |
| | | String name = file.getName(); |
| | | return file.getName(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | if (os != null) { |
| | | try { |
| | | os.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | //package com.ruoyi.inspect.service.impl; |
| | | // |
| | | //import cn.hutool.core.collection.CollUtil; |
| | | //import cn.hutool.core.collection.CollectionUtil; |
| | | //import cn.hutool.core.date.DateTime; |
| | | //import cn.hutool.core.date.DateUtil; |
| | | //import cn.hutool.core.util.StrUtil; |
| | | //import com.alibaba.excel.EasyExcel; |
| | | //import com.alibaba.excel.ExcelWriter; |
| | | //import com.alibaba.excel.write.metadata.WriteSheet; |
| | | //import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; |
| | | //import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | //import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | //import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | //import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | //import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | //import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | //import com.ruoyi.basic.dto.*; |
| | | //import com.ruoyi.basic.pojo.IfsInventoryQuantity; |
| | | //import com.ruoyi.common.constant.InsOrderTypeConstants; |
| | | //import com.ruoyi.common.core.domain.entity.User; |
| | | //import com.ruoyi.common.utils.LimsDateUtil; |
| | | //import com.ruoyi.common.utils.QueryWrappers; |
| | | //import com.ruoyi.common.utils.SecurityUtils; |
| | | //import com.ruoyi.common.utils.WxCpUtils; |
| | | //import com.ruoyi.framework.properties.WechatProperty; |
| | | //import com.ruoyi.inspect.dto.CopperInsOrderDto; |
| | | //import com.ruoyi.inspect.dto.RawMaterialStandardTreeDto; |
| | | //import com.ruoyi.basic.mapper.IfsInventoryQuantityMapper; |
| | | //import com.ruoyi.basic.mapper.StandardTreeMapper; |
| | | //import com.ruoyi.inspect.dto.SampleProductDto; |
| | | //import com.ruoyi.inspect.mapper.InsOrderMapper; |
| | | //import com.ruoyi.inspect.mapper.InsProductMapper; |
| | | //import com.ruoyi.inspect.mapper.InsSampleMapper; |
| | | //import com.ruoyi.inspect.pojo.InsOrder; |
| | | //import com.ruoyi.inspect.pojo.InsReport; |
| | | //import com.ruoyi.inspect.service.InsOrderService; |
| | | //import com.ruoyi.inspect.service.InsReportService; |
| | | //import com.ruoyi.inspect.service.RawMaterialOrderService; |
| | | //import com.ruoyi.common.numgen.NumberGenerator; |
| | | //import com.ruoyi.framework.exception.ErrorException; |
| | | //import com.ruoyi.performance.mapper.AuxiliaryOutputWorkingHoursMapper; |
| | | //import com.ruoyi.performance.pojo.AuxiliaryOutputWorkingHours; |
| | | //import com.ruoyi.system.mapper.UserMapper; |
| | | //import lombok.AllArgsConstructor; |
| | | //import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| | | //import org.springframework.stereotype.Service; |
| | | //import org.springframework.transaction.annotation.Transactional; |
| | | // |
| | | //import javax.servlet.http.HttpServletResponse; |
| | | //import java.io.IOException; |
| | | //import java.io.UnsupportedEncodingException; |
| | | //import java.math.BigDecimal; |
| | | //import java.net.URLEncoder; |
| | | //import java.text.SimpleDateFormat; |
| | | //import java.time.LocalDateTime; |
| | | //import java.time.format.DateTimeFormatter; |
| | | //import java.util.*; |
| | | //import java.util.concurrent.atomic.AtomicInteger; |
| | | // |
| | | ///** |
| | | // * @Author zhuo |
| | | // * @Date 2024/7/31 |
| | | // */ |
| | | //@Service |
| | | //@AllArgsConstructor |
| | | //public class RawMaterialOrderServiceImpl implements RawMaterialOrderService { |
| | | // |
| | | // private StandardTreeMapper standardTreeMapper; |
| | | // private IfsInventoryQuantityMapper ifsInventoryQuantityMapper; |
| | | // private UserMapper userMapper; |
| | | // private InsOrderService insOrderService; |
| | | // private InsOrderMapper insOrderMapper; |
| | | // private InsSampleMapper insSampleMapper; |
| | | // private final NumberGenerator<InsOrder> numberGenerator; |
| | | // private InsReportService insReportService; |
| | | // private WechatProperty wechatProperty; |
| | | // private ThreadPoolTaskExecutor threadPoolTaskExecutor; |
| | | // private InsProductMapper insProductMapper; |
| | | // private AuxiliaryOutputWorkingHoursMapper auxiliaryOutputWorkingHoursMapper; |
| | | // |
| | | // |
| | | // @Override |
| | | // public RawMaterialStandardTreeDto selectStandardTreeListByPartNo(String partNo) { |
| | | // if (StringUtils.isBlank(partNo)) { |
| | | // throw new ErrorException("é¶ä»¶å·ä¸¢å¤±"); |
| | | // } |
| | | // List<FactoryDto> factoryDtos = standardTreeMapper.selectStandardTreeListByPartNo(partNo); |
| | | // if (CollectionUtil.isEmpty(factoryDtos)) { |
| | | // throw new ErrorException("é¶ä»¶å·ä¸º" + partNo + "çåæææ²¡æå¯¹åºçæ ååºé
ç½®"); |
| | | // } |
| | | // RawMaterialStandardTreeDto rawMaterialStandardTreeDto = new RawMaterialStandardTreeDto(); |
| | | // for (FactoryDto factoryDto : factoryDtos) { |
| | | // for (LaboratoryDto laboratoryDto : factoryDto.getChildren()) { |
| | | // for (SampleTypeDto sampleTypeDto : laboratoryDto.getChildren()) { |
| | | // if (sampleTypeDto.getChildren().size() == 0) { |
| | | // sampleTypeDto.setChildren(standardTreeMapper.getStandardTree3(sampleTypeDto.getValue())); |
| | | // } |
| | | // // 夿ç»å®çæ¯å¦æ¯å½åé¶ä»¶å· |
| | | // if (sampleTypeDto.getPartNo() != null && sampleTypeDto.getPartNo().equals(partNo)) { |
| | | // // æ·»å 对象 |
| | | // rawMaterialStandardTreeDto.setTreeName(factoryDto.getValue() + "-" |
| | | // + laboratoryDto.getValue() + "-" |
| | | // + sampleTypeDto.getValue()); |
| | | // rawMaterialStandardTreeDto.setCode(sampleTypeDto.getCode()); |
| | | // rawMaterialStandardTreeDto.setLabel(sampleTypeDto.getLabel()); |
| | | // rawMaterialStandardTreeDto.setValue(sampleTypeDto.getValue()); |
| | | // rawMaterialStandardTreeDto.setChildren1(sampleTypeDto.getChildren()); |
| | | // } else { |
| | | // for (SampleDto sampleDto : sampleTypeDto.getChildren()) { |
| | | // if (sampleDto.getPartNo() != null && sampleDto.getPartNo().equals(partNo)) { |
| | | // // æ·»å 对象 |
| | | // rawMaterialStandardTreeDto.setTreeName(factoryDto.getValue() + "-" |
| | | // + laboratoryDto.getValue() + "-" |
| | | // + sampleTypeDto.getValue() + "-" |
| | | // + sampleDto.getValue()); |
| | | // rawMaterialStandardTreeDto.setCode(sampleDto.getCode()); |
| | | // rawMaterialStandardTreeDto.setLabel(sampleDto.getLabel()); |
| | | // rawMaterialStandardTreeDto.setValue(sampleDto.getValue()); |
| | | // rawMaterialStandardTreeDto.setChildren2(sampleDto.getChildren()); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // return rawMaterialStandardTreeDto; |
| | | // } |
| | | // |
| | | // @Override |
| | | // public IPage<IfsInventoryQuantity> getWarehouseSubmit(IPage<IfsInventoryQuantity> page, IfsInventoryQuantity ifsInventoryQuantity) { |
| | | // return standardTreeMapper.selectIfsPage(page, QueryWrappers.queryWrappers(ifsInventoryQuantity)); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public IPage<IfsInventoryQuantityDto> getIfsByStateOne(IPage<IfsInventoryQuantityDto> page, IfsInventoryQuantityDto ifsInventoryQuantityDto) { |
| | | // return standardTreeMapper.getIfsByStateOne(page, QueryWrappers.queryWrappers(ifsInventoryQuantityDto)); |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * æ¥æ£ |
| | | // * @param ids |
| | | // * @return |
| | | // */ |
| | | // @Override |
| | | // public int inspectionReport(List<Integer> ids) { |
| | | // Integer userId = SecurityUtils.getUserId().intValue(); |
| | | // ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate() |
| | | // .in(IfsInventoryQuantity::getId, ids) |
| | | // .set(IfsInventoryQuantity::getDeclareUser, userMapper.selectById(userId).getName()) |
| | | // .set(IfsInventoryQuantity::getDeclareUserId, userId) |
| | | // .set(IfsInventoryQuantity::getIsInspect, 1) |
| | | // .set(IfsInventoryQuantity::getDeclareDate, LocalDateTime.now()) |
| | | // ); |
| | | // threadPoolTaskExecutor.execute(() -> { |
| | | // List<IfsInventoryQuantity> quantityList = ifsInventoryQuantityMapper.selectList(Wrappers.<IfsInventoryQuantity>lambdaQuery() |
| | | // .in(IfsInventoryQuantity::getId, ids)); |
| | | // // ä¼ä¸å¾®ä¿¡éç¥ |
| | | // String message = ""; |
| | | // message += "æ°å¢æ¥æ£éç¥"; |
| | | // for (IfsInventoryQuantity inventoryQuantity : quantityList) { |
| | | // message += "\næ¹æ¬¡å·: " + inventoryQuantity.getUpdateBatchNo(); |
| | | // message += "\né¶ä»¶æè¿°: " + inventoryQuantity.getPartDesc(); |
| | | // message += "\næµè¾¾æ°é: " + inventoryQuantity.getQtyArrived().stripTrailingZeros().toPlainString() + inventoryQuantity.getBuyUnitMeas(); |
| | | // |
| | | // // å¤æææ²¡æå°20å¨. æè
è½å¦å
æ£ |
| | | // int result = notificationRawOrder(inventoryQuantity.getId()); |
| | | // switch (result) { |
| | | // case 1: |
| | | // message += "\nå½åæ ·åå·²æ£éªè¿, å¯ä»¥å
æ£"; |
| | | // break; |
| | | // case 2: |
| | | // message += "\nå½åæ ·åå·²è¶
è¿20å¨"; |
| | | // break; |
| | | // } |
| | | // message += "\n"; |
| | | // } |
| | | // WxCpUtils.informWebHook(wechatProperty.getExaminingUrl(), message); |
| | | // }); |
| | | // return 1; |
| | | // } |
| | | // |
| | | // /** |
| | | // * æ¤éæ¥æ£ |
| | | // * @param id |
| | | // * @return |
| | | // */ |
| | | // @Override |
| | | // public int revokeInspectionReport(Integer id) { |
| | | // return ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate() |
| | | // .eq(IfsInventoryQuantity::getId, id) |
| | | // .set(IfsInventoryQuantity::getIsInspect, 0) |
| | | // ); |
| | | // } |
| | | // |
| | | // /** |
| | | // * æå°æ ç¾æ¥è¯¢ |
| | | // * @param ids |
| | | // * @return |
| | | // */ |
| | | // @Override |
| | | // public List<IfsInventoryQuantityDto> printLabel(List<Integer> ids) { |
| | | // return ifsInventoryQuantityMapper.printLabel(ids); |
| | | // } |
| | | // |
| | | // /** |
| | | // * æ¥æ£ |
| | | // * @param ifsInventoryQuantity |
| | | // * @return |
| | | // */ |
| | | // @Override |
| | | // public int inspectionReportOne(IfsInventoryQuantity ifsInventoryQuantity) { |
| | | // Integer userId = SecurityUtils.getUserId().intValue(); |
| | | // ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate() |
| | | // .eq(IfsInventoryQuantity::getId, ifsInventoryQuantity.getId()) |
| | | // .set(IfsInventoryQuantity::getDeclareUser, userMapper.selectById(userId).getName()) |
| | | // .set(IfsInventoryQuantity::getDeclareUserId, userId) |
| | | // .set(IfsInventoryQuantity::getIsInspect, 1) |
| | | // .set(IfsInventoryQuantity::getDeclareDate, LocalDateTime.now()) |
| | | // .set(IfsInventoryQuantity::getUpdateBatchNo, ifsInventoryQuantity.getUpdateBatchNo()) |
| | | // ); |
| | | // |
| | | // threadPoolTaskExecutor.execute(() -> { |
| | | // IfsInventoryQuantity inventoryQuantity = ifsInventoryQuantityMapper.selectById(ifsInventoryQuantity.getId()); |
| | | // // ä¼ä¸å¾®ä¿¡éç¥ |
| | | // String message = ""; |
| | | // message += "æ°å¢æ¥æ£éç¥"; |
| | | // message += "\næ¹æ¬¡å·: " + inventoryQuantity.getUpdateBatchNo(); |
| | | // message += "\né¶ä»¶æè¿°: " + inventoryQuantity.getPartDesc(); |
| | | // message += "\næµè¾¾æ°é: " + inventoryQuantity.getQtyArrived().stripTrailingZeros().toPlainString() + inventoryQuantity.getBuyUnitMeas(); |
| | | // WxCpUtils.informWebHook(wechatProperty.getExaminingUrl(), message); |
| | | // }); |
| | | // return 1; |
| | | // } |
| | | // |
| | | // /** |
| | | // * è·åé产ä¸é¾æ£æµæ°æ® |
| | | // * @param id |
| | | // * @return |
| | | // */ |
| | | // @Override |
| | | // public String getIndustryChain(Integer id) { |
| | | // return ifsInventoryQuantityMapper.selectById(id).getIndustryChain(); |
| | | // } |
| | | // |
| | | // /** |
| | | // * åæææ¤éæ¥å£ |
| | | // * @param ifsInventoryId |
| | | // * @return |
| | | // */ |
| | | // @Override |
| | | // public boolean repealRawOrder(Integer ifsInventoryId) { |
| | | // // æ¥è¯¢å¤ææ¯å¦æ¯éåä¸ |
| | | // IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(ifsInventoryId); |
| | | // if (ifsInventoryQuantity.getIsCopper() != null && ifsInventoryQuantity.getIsCopper().equals(1)) { |
| | | // // éåä¸ç´æ¥å é¤å°±è¡ |
| | | // ifsInventoryQuantityMapper.deleteById(ifsInventoryId); |
| | | // } else { |
| | | // ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>() |
| | | // .set(IfsInventoryQuantity::getState, 0) |
| | | // .set(IfsInventoryQuantity::getIsQuarter, 1) |
| | | // .eq(IfsInventoryQuantity::getId, ifsInventoryId)); |
| | | // } |
| | | // |
| | | // insOrderService.update(Wrappers.<InsOrder>lambdaUpdate() |
| | | // .eq(InsOrder::getIfsInventoryId, ifsInventoryId) |
| | | // .set(InsOrder::getState, -1) |
| | | // .set(InsOrder::getEntrustCode, ""));// æ¤é |
| | | // return true; |
| | | // } |
| | | // |
| | | // /** |
| | | // * åææå
æ£ä¸å |
| | | // * @param list |
| | | // * @param insOrder |
| | | // * @return |
| | | // */ |
| | | // @Override |
| | | // @Transactional(rollbackFor = Exception.class) |
| | | // public int addExemptionOrder(List<SampleProductDto> list, InsOrder insOrder) { |
| | | // if (!insOrder.getOrderType().equals(InsOrderTypeConstants.ENTER_THE_FACTORY)) { |
| | | // throw new ErrorException("åªæè¿åæ£éªæè½å
æ£"); |
| | | // } |
| | | // insOrder.setSendTime(LocalDateTime.now()); |
| | | // // ä¿®æ¹è®¢åè¡¨ç´æ¥ä¸ºå·²æ£éª |
| | | // insOrder.setState(4); |
| | | // insOrder.setTypeSource(1); |
| | | // |
| | | // String code = "Y"; |
| | | // // çæç¼å· |
| | | // String no = numberGenerator.generateNumberWithPrefix(3, |
| | | // "JCZX/ZB-" + code + LimsDateUtil.resetDate(LocalDateTime.now()), |
| | | // InsOrder::getEntrustCode); |
| | | // |
| | | // insOrderMapper.insert(insOrder); // 主表 |
| | | // |
| | | // AtomicInteger count = new AtomicInteger(); |
| | | // list.forEach(a -> { |
| | | // count.getAndIncrement(); |
| | | // a.setId(null); |
| | | // a.setInsOrderId(insOrder.getId()); |
| | | // if (StrUtil.isEmpty(a.getSampleCode())) { |
| | | // // å¦æåªæä¸ä¸ªæ ·åå°±ä¸éè¦æ¼æ¥æ°å |
| | | // if (list.size() != 1) { |
| | | // a.setSampleCode(no + "-" + count.get()); |
| | | // } else { |
| | | // a.setSampleCode(no); |
| | | // } |
| | | // } |
| | | // insSampleMapper.insert(a); |
| | | // |
| | | // if (!CollectionUtil.isEmpty(a.getInsProduct())) { |
| | | // throw new ErrorException("å
æ£ä¸éè¦å¡«åæ£éªé¡¹"); |
| | | // } |
| | | // }); |
| | | // |
| | | // // åææä¸å: å§æäººå°±æ¯æ¥æ£äºº, ç产åä½å°±æ¯ä¾åºååä½ |
| | | // IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(insOrder.getIfsInventoryId()); |
| | | // Integer declareUserId = ifsInventoryQuantity.getDeclareUserId(); |
| | | // User user = userMapper.selectById(declareUserId); |
| | | // // ä¾åºååç§° |
| | | // insOrder.setProduction(ifsInventoryQuantity.getSupplierName()); |
| | | // // å§æäººåç§° |
| | | // insOrder.setPrepareUser(user.getName()); |
| | | // insOrder.setPhone(user.getPhone()); |
| | | // |
| | | // // ä¿®æ¹åæææ°æ®ç´æ¥ä¸ºå·²æ£éª |
| | | // ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>().set(IfsInventoryQuantity::getState, 2) |
| | | // .eq(IfsInventoryQuantity::getId, insOrder.getIfsInventoryId())); |
| | | // |
| | | // insOrder.setExamineTime(LocalDateTime.now()); |
| | | // |
| | | // insOrder.setEntrustCode(no); |
| | | // insOrder.setIsExemption(1); |
| | | // |
| | | // insOrderMapper.updateById(insOrder); |
| | | // |
| | | // // æ·»å å·¥æ¶ |
| | | // addAuxiliary(insOrder, ifsInventoryQuantity); |
| | | // |
| | | // // todo: ifsç´æ¥ç§»åº |
| | | // insReportService.isRawMaterial(insOrder); |
| | | // |
| | | // return insOrder.getId(); |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * æ¥è¯¢å¾
ä¸å |
| | | // * @param page |
| | | // * @param ifsInventoryQuantity |
| | | // * @return |
| | | // */ |
| | | // @Override |
| | | // public IPage<IfsInventoryQuantityCheckDto> selectIfsInventoryQuantity(Page<IfsInventoryQuantityCheckDto> page, IfsInventoryQuantityCheckDto ifsInventoryQuantity) { |
| | | // return standardTreeMapper.selectIfsInventoryQuantity(page, QueryWrappers.queryWrappers(ifsInventoryQuantity)); |
| | | // } |
| | | // |
| | | // /** |
| | | // * æ¥è¯¢å·²æ£éª |
| | | // * @param page |
| | | // * @param ifsInventoryQuantityDto |
| | | // * @return |
| | | // */ |
| | | // @Override |
| | | // public IPage<IfsInventoryQuantitySupplierDto> getIfsByOver(Page<IfsInventoryQuantitySupplierDto> page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto) { |
| | | // // todo: åªçæ |
| | | // String beginDeclareDate = ifsInventoryQuantityDto.getBeginDeclareDate(); |
| | | // String endDeclareDate = ifsInventoryQuantityDto.getEndDeclareDate(); |
| | | // ifsInventoryQuantityDto.setBeginDeclareDate(null); |
| | | // ifsInventoryQuantityDto.setEndDeclareDate(null); |
| | | // |
| | | // return standardTreeMapper.getIfsByOver(page, QueryWrappers.queryWrappers(ifsInventoryQuantityDto), beginDeclareDate, endDeclareDate); |
| | | // } |
| | | // |
| | | // /** |
| | | // * å é¤åæææ¥æ£ä¿¡æ¯ |
| | | // * @param id |
| | | // * @return |
| | | // */ |
| | | // @Override |
| | | // public int delIfsInventory(Integer id) { |
| | | // return ifsInventoryQuantityMapper.deleteById(id); |
| | | // } |
| | | // |
| | | // /** |
| | | // * åæææ¾è¡å
æ£ |
| | | // * @param ifsInventoryId |
| | | // * @return |
| | | // */ |
| | | // @Override |
| | | // @Transactional(rollbackFor = Exception.class) |
| | | // public boolean rawOrderRelease(Integer ifsInventoryId, String partDetail) { |
| | | // // ä¿®æ¹åæææ°æ®ç´æ¥ä¸ºå·²æ£éª |
| | | // ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>() |
| | | // .set(IfsInventoryQuantity::getState, 2) |
| | | // .set(IfsInventoryQuantity::getIsQuarter, 0) |
| | | // .eq(IfsInventoryQuantity::getId, ifsInventoryId)); |
| | | // |
| | | // // æ¥è¯¢åææä¿¡æ¯ |
| | | // IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(ifsInventoryId); |
| | | // // å§æäººå°±æ¯æ¥æ£äºº, ç产åä½å°±æ¯ä¾åºååä½ |
| | | // Integer declareUserId = ifsInventoryQuantity.getDeclareUserId(); |
| | | // User user = userMapper.selectById(declareUserId); |
| | | // |
| | | // InsOrder insOrder = new InsOrder(); |
| | | // insOrder.setState(4); |
| | | // insOrder.setTypeSource(1); |
| | | // String code = "Y"; |
| | | // // çæç¼å· |
| | | // String no = numberGenerator.generateNumberWithPrefix(3, |
| | | // "JCZX/ZB-" + code + LimsDateUtil.resetDate(LocalDateTime.now()), |
| | | // InsOrder::getEntrustCode); |
| | | // insOrder.setExamineTime(LocalDateTime.now()); |
| | | // insOrder.setEntrustCode(no); |
| | | // insOrder.setIsExemption(1); |
| | | // // ä¾åºååç§° |
| | | // insOrder.setProduction(ifsInventoryQuantity.getSupplierName()); |
| | | // // å§æäººåç§° |
| | | // insOrder.setPrepareUser(user.getName()); |
| | | // insOrder.setPhone(user.getPhone()); |
| | | // insOrder.setIfsInventoryId(ifsInventoryId); |
| | | // insOrder.setPartDetail(partDetail); |
| | | // insOrder.setSendTime(LocalDateTime.now()); |
| | | // insOrder.setSample(ifsInventoryQuantity.getPartDesc()); |
| | | // // è¿åæ£éª |
| | | // insOrder.setOrderType(InsOrderTypeConstants.ENTER_THE_FACTORY); |
| | | // |
| | | // insOrderMapper.insert(insOrder); |
| | | // |
| | | // // æ·»å å·¥æ¶ |
| | | // addAuxiliary(insOrder, ifsInventoryQuantity); |
| | | // |
| | | // // todo: ifsç´æ¥ç§»åº |
| | | // insReportService.isRawMaterial(insOrder); |
| | | // return true; |
| | | // } |
| | | // |
| | | // /** |
| | | // * 0, æ æç¤º, 1æç¤º å½åæ¹æ¬¡çæ ·åå·²æ£éªè¿, å¯ä»¥å
æ£, 2 æç¤º å½åæ¹æ¬¡çæ ·åå·²è¶
20å¨, éè¦å¤çº§å¤æ¬¡æ£éª |
| | | // * |
| | | // * åææä¸åéç¥å
æ£æè
夿¬¡æ£éª |
| | | // * @param ifsInventoryId |
| | | // * @return |
| | | // */ |
| | | // @Override |
| | | // public int notificationRawOrder(Integer ifsInventoryId) { |
| | | // IfsInventoryQuantity ifsInventory = ifsInventoryQuantityMapper.selectById(ifsInventoryId); |
| | | // // æ¥è¯¢å½åæ¹æ¬¡, ä¾åºå, é¶ä»¶å·çåæææ¯å¦è¶
è¿äº20å¨, è¶
è¿äº20å¨éè¦è¿è¡å¤æ¬¡æ£éªæé |
| | | // List<IfsInventoryQuantity> quantityList = ifsInventoryQuantityMapper.selectList(Wrappers.<IfsInventoryQuantity>lambdaQuery() |
| | | // .eq(IfsInventoryQuantity::getPartNo, ifsInventory.getPartNo()) |
| | | // .eq(IfsInventoryQuantity::getUpdateBatchNo, ifsInventory.getUpdateBatchNo()) |
| | | // .eq(IfsInventoryQuantity::getSupplierId, ifsInventory.getSupplierId()) |
| | | // .eq(IfsInventoryQuantity::getSupplierName, ifsInventory.getSupplierName())); |
| | | // |
| | | // // 夿æ¯å¦å¤§äº20å¨ |
| | | // BigDecimal bigDecimal = new BigDecimal("20000"); |
| | | // BigDecimal count = BigDecimal.ZERO; |
| | | // for (IfsInventoryQuantity inventoryQuantity : quantityList) { |
| | | // // 夿å使¯kgæè
t |
| | | // if (inventoryQuantity.getBuyUnitMeas().equalsIgnoreCase("t")) { |
| | | // count = count.add(inventoryQuantity.getQtyArrived().multiply(new BigDecimal("1000"))); |
| | | // } else if (inventoryQuantity.getBuyUnitMeas().equalsIgnoreCase("kg")) { |
| | | // count = count.add(inventoryQuantity.getQtyArrived()); |
| | | // } |
| | | // } |
| | | // |
| | | // if (count.compareTo(bigDecimal) >= 0) { |
| | | // return 2; |
| | | // } else { |
| | | // // 夿ä¹åæ¯å¦åºè¿æ¥å, åºè¿æ¥åå¯ä»¥å
æ£ |
| | | // int reportCount = ifsInventoryQuantityMapper.selectReportCountById(ifsInventoryId); |
| | | // if (reportCount > 0) { |
| | | // return 1; |
| | | // } |
| | | // } |
| | | // return 0; |
| | | // } |
| | | // |
| | | // /** |
| | | // * æ¥æ£å¯ä»¥æ°å¢æ¥æ£ä¿¡æ¯ |
| | | // * @param ifsInventoryQuantity |
| | | // */ |
| | | // @Override |
| | | // public void addIfsInventoryQuantity(IfsInventoryQuantity ifsInventoryQuantity) { |
| | | // ifsInventoryQuantity.setIsSource(0); |
| | | // ifsInventoryQuantity.setState(0); |
| | | // ifsInventoryQuantity.setIsFinish(0); |
| | | // ifsInventoryQuantityMapper.insert(ifsInventoryQuantity); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void shiftingParking(List<Integer> ids) { |
| | | // for (Integer id : ids) { |
| | | // InsOrder order = insOrderService.getById(id); |
| | | // // todo: ifsç´æ¥ç§»åº |
| | | // insReportService.isRawMaterial(order); |
| | | // } |
| | | // } |
| | | // |
| | | // /** |
| | | // * éåä¸ä¸åå
æ£ |
| | | // * @param list |
| | | // * @param insOrder |
| | | // */ |
| | | // @Override |
| | | // @Transactional(rollbackFor = Exception.class) |
| | | // public int addRawCopperOrderExemptionOrder(List<SampleProductDto> list, CopperInsOrderDto insOrder) { |
| | | // if (!insOrder.getOrderType().equals(InsOrderTypeConstants.ENTER_THE_FACTORY)) { |
| | | // throw new ErrorException("åªæè¿åæ£éªæè½å
æ£"); |
| | | // } |
| | | // insOrder.setSendTime(LocalDateTime.now()); |
| | | // // ä¿®æ¹è®¢åè¡¨ç´æ¥ä¸ºå·²æ£éª |
| | | // insOrder.setState(4); |
| | | // insOrder.setTypeSource(1); |
| | | // |
| | | // String code = "Y"; |
| | | // // çæç¼å· |
| | | // String no = numberGenerator.generateNumberWithPrefix(3, |
| | | // "JCZX/ZB-" + code + LimsDateUtil.resetDate(LocalDateTime.now()), |
| | | // InsOrder::getEntrustCode); |
| | | // |
| | | // insOrderMapper.insert(insOrder); // 主表 |
| | | // |
| | | // AtomicInteger count = new AtomicInteger(); |
| | | // list.forEach(a -> { |
| | | // count.getAndIncrement(); |
| | | // a.setId(null); |
| | | // a.setInsOrderId(insOrder.getId()); |
| | | // if (StrUtil.isEmpty(a.getSampleCode())) { |
| | | // // å¦æåªæä¸ä¸ªæ ·åå°±ä¸éè¦æ¼æ¥æ°å |
| | | // if (list.size() != 1) { |
| | | // a.setSampleCode(no + "-" + count.get()); |
| | | // } else { |
| | | // a.setSampleCode(no); |
| | | // } |
| | | // } |
| | | // insSampleMapper.insert(a); |
| | | // |
| | | // if (!CollectionUtil.isEmpty(a.getInsProduct())) { |
| | | // throw new ErrorException("å
æ£ä¸éè¦å¡«åæ£éªé¡¹"); |
| | | // } |
| | | // }); |
| | | // // æ·»å åææä¿¡æ¯ |
| | | // IfsInventoryQuantity ifsInventoryQuantity = new IfsInventoryQuantity(); |
| | | // // åºæ¬ä¿¡æ¯ |
| | | // ifsInventoryQuantity.setIsSource(0); |
| | | // ifsInventoryQuantity.setState(2); |
| | | // ifsInventoryQuantity.setIsInspect(1); |
| | | // ifsInventoryQuantity.setIsFinish(1); |
| | | // ifsInventoryQuantity.setIsCopper(1); |
| | | // ifsInventoryQuantity.setInspectStatus(1); |
| | | // ifsInventoryQuantity.setIsQuarter(0); |
| | | // |
| | | // ifsInventoryQuantity.setQtyArrived(insOrder.getQtyArrived()); |
| | | // ifsInventoryQuantity.setBuyUnitMeas(insOrder.getBuyUnitMeas()); |
| | | // ifsInventoryQuantity.setSupplierName(insOrder.getSupplierName()); |
| | | // ifsInventoryQuantity.setUpdateBatchNo(insOrder.getUpdateBatchNo()); |
| | | // ifsInventoryQuantity.setDeclareDate(insOrder.getDeclareDate()); |
| | | // |
| | | // ifsInventoryQuantityMapper.insert(ifsInventoryQuantity); |
| | | // |
| | | // insOrder.setIfsInventoryId(ifsInventoryQuantity.getId()); |
| | | // insOrder.setExamineTime(LocalDateTime.now()); |
| | | // |
| | | // insOrder.setEntrustCode(no); |
| | | // insOrder.setIsExemption(1); |
| | | // |
| | | // insOrderMapper.updateById(insOrder); |
| | | // |
| | | // // æ·»å å·¥æ¶ |
| | | // addAuxiliary(insOrder, ifsInventoryQuantity); |
| | | // |
| | | // return insOrder.getId(); |
| | | // } |
| | | // |
| | | // @Override |
| | | // @Transactional(rollbackFor = Exception.class) |
| | | // public boolean concessionRelease(Integer ifsInventoryId) { |
| | | // // æ¥è¯¢åææä¿¡æ¯ |
| | | // IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(ifsInventoryId); |
| | | // if (!ifsInventoryQuantity.getInspectStatus().equals(2)) { |
| | | // throw new ErrorException("ä¸åæ ¼çåæææè½è®©æ¥æ¾è¡"); |
| | | // } |
| | | // |
| | | // // todo:éè¦å¤æoaæµç¨æ¯å¦æ¯è®©æ¥æ¾è¡ |
| | | // String toLocation = insReportService.moveRawMaterial(ifsInventoryQuantity); |
| | | // |
| | | // ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>() |
| | | // .set(IfsInventoryQuantity::getInspectStatus, 4) |
| | | // .set(IfsInventoryQuantity::getToLocation, toLocation) |
| | | // .eq(IfsInventoryQuantity::getId, ifsInventoryId)); |
| | | // |
| | | // return true; |
| | | // } |
| | | // |
| | | // /** |
| | | // * åææè¿åæ¤éä¸å |
| | | // * @param enterOrderId |
| | | // * @return |
| | | // */ |
| | | // @Override |
| | | // @Transactional(rollbackFor = Exception.class) |
| | | // public boolean repealEnterRawOrder(Integer enterOrderId) { |
| | | // // æ¥è¯¢è®¢å |
| | | // InsOrder order = insOrderMapper.selectById(enterOrderId); |
| | | // |
| | | // // æ¥è¯¢å¤ææ¯å¦æ¯éåä¸ |
| | | // IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(order.getIfsInventoryId()); |
| | | // if (ifsInventoryQuantity.getIsCopper() != null && ifsInventoryQuantity.getIsCopper().equals(1)) { |
| | | // // éåä¸ç´æ¥å é¤å°±è¡ |
| | | // ifsInventoryQuantityMapper.deleteById(order.getIfsInventoryId()); |
| | | // } else { |
| | | // ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>() |
| | | // .set(IfsInventoryQuantity::getState, 0) |
| | | // .set(IfsInventoryQuantity::getIsQuarter, 1) |
| | | // .eq(IfsInventoryQuantity::getId, order.getIfsInventoryId())); |
| | | // } |
| | | // insOrderService.update(Wrappers.<InsOrder>lambdaUpdate() |
| | | // .eq(InsOrder::getId, enterOrderId) |
| | | // .set(InsOrder::getState, -1) |
| | | // .set(InsOrder::getEntrustCode, ""));// æ¤é |
| | | // |
| | | // // æ¸
é¤ä¹åçå·¥æ¶ |
| | | // auxiliaryOutputWorkingHoursMapper.delete(Wrappers.<AuxiliaryOutputWorkingHours>lambdaQuery() |
| | | // .eq(AuxiliaryOutputWorkingHours::getOrderId, enterOrderId)); |
| | | // |
| | | // // æ¸
é¤ä¹åæ¥å |
| | | // insReportService.remove(Wrappers.<InsReport>lambdaQuery() |
| | | // .eq(InsReport::getInsOrderId, enterOrderId)); |
| | | // |
| | | // return true; |
| | | // } |
| | | // |
| | | // /** |
| | | // * åææå£åº¦æ¤éä¸å |
| | | // * @param quarterOrderId |
| | | // * @return |
| | | // */ |
| | | // @Override |
| | | // @Transactional(rollbackFor = Exception.class) |
| | | // public boolean repealQuarterRawOrder(Integer quarterOrderId) { |
| | | // // æ¥è¯¢è®¢å |
| | | // InsOrder order = insOrderMapper.selectById(quarterOrderId); |
| | | // |
| | | // Long count = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery() |
| | | // .eq(InsOrder::getIfsInventoryId, order.getIfsInventoryId()) |
| | | // .ne(InsOrder::getState, -1) |
| | | // .eq(InsOrder::getOrderType, InsOrderTypeConstants.ENTER_THE_FACTORY) |
| | | // .ne(InsOrder::getId, order.getId())); |
| | | // // 夿ä¹åæ¯å¦æè¿åæ£éª, 没æéè¦ä¿®æ¹åææä¿¡æ¯ |
| | | // if (count == 0) { |
| | | // ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>() |
| | | // .set(IfsInventoryQuantity::getState, 0) |
| | | // .set(IfsInventoryQuantity::getIsQuarter, 1) |
| | | // .eq(IfsInventoryQuantity::getId, order.getIfsInventoryId())); |
| | | // } else { |
| | | // ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>() |
| | | // .set(IfsInventoryQuantity::getIsQuarter, 1) |
| | | // .eq(IfsInventoryQuantity::getId, order.getIfsInventoryId())); |
| | | // } |
| | | // |
| | | // insOrderService.update(Wrappers.<InsOrder>lambdaUpdate() |
| | | // .eq(InsOrder::getId, quarterOrderId) |
| | | // .set(InsOrder::getState, -1) |
| | | // .set(InsOrder::getEntrustCode, ""));// æ¤é |
| | | // auxiliaryOutputWorkingHoursMapper.delete(Wrappers.<AuxiliaryOutputWorkingHours>lambdaQuery() |
| | | // .eq(AuxiliaryOutputWorkingHours::getOrderId, quarterOrderId)); |
| | | // // æ¸
é¤ä¹åæ¥å |
| | | // insReportService.remove(Wrappers.<InsReport>lambdaQuery() |
| | | // .eq(InsReport::getInsOrderId, quarterOrderId)); |
| | | // return true; |
| | | // } |
| | | // |
| | | // /** |
| | | // * åæææ¥æ£å
¨é¨ä¿¡æ¯å¯¼åº |
| | | // * @param ifsInventoryQuantityDto |
| | | // * @param response |
| | | // */ |
| | | // @Override |
| | | // public void rawAllExport(IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto, HttpServletResponse response) throws UnsupportedEncodingException { |
| | | // //æ¥è¯¢å¯¼åºçè´¹ç¨ç»è®¡æ°æ® |
| | | // String beginDeclareDate = ifsInventoryQuantityDto.getBeginDeclareDate(); |
| | | // String endDeclareDate = ifsInventoryQuantityDto.getEndDeclareDate(); |
| | | // ifsInventoryQuantityDto.setBeginDeclareDate(null); |
| | | // ifsInventoryQuantityDto.setEndDeclareDate(null); |
| | | // List<IfsInventoryQuantitySupplierDto> ifsByOverList = standardTreeMapper.getIfsByOverList(QueryWrappers.queryWrappers(ifsInventoryQuantityDto), beginDeclareDate, endDeclareDate); |
| | | // |
| | | // for (IfsInventoryQuantitySupplierDto dto : ifsByOverList) { |
| | | // dto.setSendTimeString(dto.getSendTime() == null ? "" : dto.getSendTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | // dto.setReceiverDateString(dto.getReceiverDate() == null ? "" : dto.getReceiverDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | // dto.setDeclareDateString(dto.getDeclareDate() == null ? "" : dto.getDeclareDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | // switch (dto.getInspectStatus()) { |
| | | // case 1: |
| | | // dto.setInspectStatusString("åæ ¼"); |
| | | // break; |
| | | // case 2: |
| | | // dto.setInspectStatusString("ä¸åæ ¼"); |
| | | // // æ¥è¯¢ä¸åæ ¼é¡¹ |
| | | // List<String> unqualifiedList = insProductMapper.selectUnqualifiedList(dto.getEnterOrderId() == null ? dto.getQuarterOrderId() : dto.getEnterOrderId()); |
| | | // dto.setUnqualifiedItem(CollUtil.join(unqualifiedList, ",")); |
| | | // break; |
| | | // case 3: |
| | | // dto.setInspectStatusString("æªä¸å"); |
| | | // break; |
| | | // case 4: |
| | | // dto.setInspectStatusString("è®©æ¥æ¾è¡"); |
| | | // break; |
| | | // case 0: |
| | | // dto.setInspectStatusString("æ£éªä¸"); |
| | | // break; |
| | | // |
| | | // } |
| | | // } |
| | | // |
| | | // |
| | | // response.setContentType("application/vnd.ms-excel"); |
| | | // response.setCharacterEncoding("UTF-8"); |
| | | // // è¿éURLEncoder.encodeå¯ä»¥é²æ¢ä¸æä¹±ç å½ç¶åeasyexcel没æå
³ç³» |
| | | // String fileName = URLEncoder.encode("åæææ£æµä¿¡æ¯å¯¼åº", "UTF-8"); |
| | | // response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); |
| | | // try { |
| | | // //æ°å»ºExcelWriter |
| | | // ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).build(); |
| | | // //è·åsheet0对象 |
| | | // WriteSheet mainSheet = EasyExcel.writerSheet(0, "åæææ£æµä¿¡æ¯å¯¼åº").head(IfsInventoryQuantitySupplierDto.class).build(); |
| | | // |
| | | // //åsheet0åå
¥æ°æ® ä¼ å
¥ç©ºlistè¿æ ·åªå¯¼åºè¡¨å¤´ |
| | | // excelWriter.write(ifsByOverList, mainSheet); |
| | | // //å
³éæµ |
| | | // excelWriter.finish(); |
| | | // } catch (IOException e) { |
| | | // throw new RuntimeException("导åºå¤±è´¥"); |
| | | // } |
| | | // } |
| | | // |
| | | // /** |
| | | // * åæææ¥è¯¢å¯ä»¥å£åº¦æ£éªçå
容 |
| | | // * @param page |
| | | // * @param ifsInventoryQuantityDto |
| | | // * @return |
| | | // */ |
| | | // @Override |
| | | // public IPage<IfsInventoryQuantitySupplierDto> getIfsByQuarter(Page page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto) { |
| | | // |
| | | // // todo: åªçæ |
| | | // String beginDeclareDate = ifsInventoryQuantityDto.getBeginDeclareDate(); |
| | | // String endDeclareDate = ifsInventoryQuantityDto.getEndDeclareDate(); |
| | | // ifsInventoryQuantityDto.setBeginDeclareDate(null); |
| | | // ifsInventoryQuantityDto.setEndDeclareDate(null); |
| | | // |
| | | // return standardTreeMapper.getIfsByQuarter(page, QueryWrappers.queryWrappers(ifsInventoryQuantityDto), beginDeclareDate, endDeclareDate); |
| | | // } |
| | | // |
| | | // /** |
| | | // * æåå
¥åº |
| | | // * @param ifsInventoryId |
| | | // * @return |
| | | // */ |
| | | // @Override |
| | | // public boolean advancedGodown(Integer ifsInventoryId) { |
| | | // // æ¥è¯¢åææä¿¡æ¯ |
| | | // IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(ifsInventoryId); |
| | | // if (!ifsInventoryQuantity.getInspectStatus().equals(0) |
| | | // && !ifsInventoryQuantity.getInspectStatus().equals(3)) { |
| | | // throw new ErrorException("æªæ£æµå®ææ°æ®æè½æåå
¥åº"); |
| | | // } |
| | | // |
| | | // // todo:éè¦å¤æoaæµç¨æ¯å¦æ¯è®©æ¥æ¾è¡ |
| | | // String toLocation = insReportService.moveRawMaterial(ifsInventoryQuantity); |
| | | // |
| | | // ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>() |
| | | // .set(IfsInventoryQuantity::getInspectStatus, 1) |
| | | // .set(IfsInventoryQuantity::getIsFinish, 1) |
| | | // .set(IfsInventoryQuantity::getToLocation, toLocation) |
| | | // .eq(IfsInventoryQuantity::getId, ifsInventoryId)); |
| | | // |
| | | // return true; |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * æ·»å å·¥æ¶ |
| | | // * @param insOrder |
| | | // * @param ifsInventoryQuantity |
| | | // */ |
| | | // private void addAuxiliary(InsOrder insOrder, IfsInventoryQuantity ifsInventoryQuantity) { |
| | | // AuxiliaryOutputWorkingHours auxiliaryOutputWorkingHours = new AuxiliaryOutputWorkingHours(); |
| | | // auxiliaryOutputWorkingHours.setInspectionItemClass(ifsInventoryQuantity.getUpdateBatchNo() + "å
æ£");//æ£æµé¡¹åç±» |
| | | // auxiliaryOutputWorkingHours.setSample(insOrder.getEntrustCode());//æ ·åç¼å· |
| | | // auxiliaryOutputWorkingHours.setOrderId(insOrder.getId());//订åid |
| | | // auxiliaryOutputWorkingHours.setOrderNo(insOrder.getEntrustCode());//éå çå§æåå· |
| | | // |
| | | // // å
æ£é»è®¤2 |
| | | // auxiliaryOutputWorkingHours.setWorkTime(new BigDecimal("2"));//éå çå·¥æ¶ |
| | | // auxiliaryOutputWorkingHours.setAmount(1);//éå çæ°é |
| | | // auxiliaryOutputWorkingHours.setOutputWorkTime((ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getOvertimeWorkTime()) ? auxiliaryOutputWorkingHours.getOvertimeWorkTime() : BigDecimal.ZERO).add(ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getWorkTime()) ? auxiliaryOutputWorkingHours.getWorkTime() : BigDecimal.ZERO));//产éå·¥æ¶ |
| | | // DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | // DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | // auxiliaryOutputWorkingHours.setDateTime(LocalDateTime.now().toLocalDate().atStartOfDay().format(formatters));//æ¥æ |
| | | // LocalDateTime localDateTime = LocalDateTime.now(); |
| | | // DateTime parse = DateUtil.parse(localDateTime.format(formatter)); |
| | | // auxiliaryOutputWorkingHours.setWeekDay(getWeek(localDateTime.format(formatters)));//ææ |
| | | // auxiliaryOutputWorkingHours.setWeek(String.valueOf(DateUtil.weekOfYear(DateUtil.offsetDay(parse, 1))));//卿¬¡ |
| | | // auxiliaryOutputWorkingHours.setCheck(SecurityUtils.getUserId().intValue());//æ£æµäºº |
| | | // auxiliaryOutputWorkingHours.setPrice(new BigDecimal("1"));//åä»· |
| | | // |
| | | // auxiliaryOutputWorkingHoursMapper.insert(auxiliaryOutputWorkingHours); |
| | | // } |
| | | // |
| | | // public static String getWeek(String dayStr) { |
| | | // SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | // try { |
| | | // Date date = sdf.parse(dayStr); |
| | | // Calendar calendar = Calendar.getInstance(); |
| | | // calendar.setTime(date); |
| | | // int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); |
| | | // int day = calendar.get(Calendar.DAY_OF_MONTH); |
| | | // return getWeekDay(dayOfWeek); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // return null; |
| | | // } |
| | | // |
| | | // public static String getWeekDay(int dayOfWeek) { |
| | | // switch (dayOfWeek) { |
| | | // case Calendar.MONDAY: |
| | | // return "å¨ä¸"; |
| | | // case Calendar.TUESDAY: |
| | | // return "å¨äº"; |
| | | // case Calendar.WEDNESDAY: |
| | | // return "å¨ä¸"; |
| | | // case Calendar.THURSDAY: |
| | | // return "å¨å"; |
| | | // case Calendar.FRIDAY: |
| | | // return "å¨äº"; |
| | | // case Calendar.SATURDAY: |
| | | // return "å¨å
"; |
| | | // case Calendar.SUNDAY: |
| | | // return "卿¥"; |
| | | // default: |
| | | // return "æªç¥"; |
| | | // } |
| | | // } |
| | | //} |
| | | package com.ruoyi.inspect.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.alibaba.excel.ExcelWriter; |
| | | import com.alibaba.excel.write.metadata.WriteSheet; |
| | | import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.dto.*; |
| | | import com.ruoyi.basic.pojo.IfsInventoryQuantity; |
| | | import com.ruoyi.common.constant.InsOrderTypeConstants; |
| | | import com.ruoyi.common.core.domain.entity.User; |
| | | import com.ruoyi.common.properties.WechatProperty; |
| | | import com.ruoyi.common.utils.LimsDateUtil; |
| | | import com.ruoyi.common.utils.QueryWrappers; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.WxCpUtils; |
| | | import com.ruoyi.inspect.dto.CopperInsOrderDto; |
| | | import com.ruoyi.inspect.dto.RawMaterialStandardTreeDto; |
| | | import com.ruoyi.basic.mapper.IfsInventoryQuantityMapper; |
| | | import com.ruoyi.basic.mapper.StandardTreeMapper; |
| | | import com.ruoyi.inspect.dto.SampleProductDto; |
| | | import com.ruoyi.inspect.mapper.InsOrderMapper; |
| | | import com.ruoyi.inspect.mapper.InsProductMapper; |
| | | import com.ruoyi.inspect.mapper.InsSampleMapper; |
| | | import com.ruoyi.inspect.pojo.InsOrder; |
| | | import com.ruoyi.inspect.pojo.InsReport; |
| | | import com.ruoyi.inspect.service.InsOrderService; |
| | | import com.ruoyi.inspect.service.InsReportService; |
| | | import com.ruoyi.inspect.service.RawMaterialOrderService; |
| | | import com.ruoyi.common.numgen.NumberGenerator; |
| | | import com.ruoyi.framework.exception.ErrorException; |
| | | import com.ruoyi.performance.mapper.AuxiliaryOutputWorkingHoursMapper; |
| | | import com.ruoyi.performance.pojo.AuxiliaryOutputWorkingHours; |
| | | import com.ruoyi.system.mapper.UserMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.math.BigDecimal; |
| | | import java.net.URLEncoder; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | |
| | | /** |
| | | * @Author zhuo |
| | | * @Date 2024/7/31 |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class RawMaterialOrderServiceImpl implements RawMaterialOrderService { |
| | | |
| | | private StandardTreeMapper standardTreeMapper; |
| | | private IfsInventoryQuantityMapper ifsInventoryQuantityMapper; |
| | | private UserMapper userMapper; |
| | | private InsOrderService insOrderService; |
| | | private InsOrderMapper insOrderMapper; |
| | | private InsSampleMapper insSampleMapper; |
| | | private final NumberGenerator<InsOrder> numberGenerator; |
| | | private InsReportService insReportService; |
| | | private WechatProperty wechatProperty; |
| | | private ThreadPoolTaskExecutor threadPoolTaskExecutor; |
| | | private InsProductMapper insProductMapper; |
| | | private AuxiliaryOutputWorkingHoursMapper auxiliaryOutputWorkingHoursMapper; |
| | | |
| | | |
| | | @Override |
| | | public RawMaterialStandardTreeDto selectStandardTreeListByPartNo(String partNo) { |
| | | if (StringUtils.isBlank(partNo)) { |
| | | throw new ErrorException("é¶ä»¶å·ä¸¢å¤±"); |
| | | } |
| | | List<FactoryDto> factoryDtos = standardTreeMapper.selectStandardTreeListByPartNo(partNo); |
| | | if (CollectionUtil.isEmpty(factoryDtos)) { |
| | | throw new ErrorException("é¶ä»¶å·ä¸º" + partNo + "çåæææ²¡æå¯¹åºçæ ååºé
ç½®"); |
| | | } |
| | | RawMaterialStandardTreeDto rawMaterialStandardTreeDto = new RawMaterialStandardTreeDto(); |
| | | for (FactoryDto factoryDto : factoryDtos) { |
| | | for (LaboratoryDto laboratoryDto : factoryDto.getChildren()) { |
| | | for (SampleTypeDto sampleTypeDto : laboratoryDto.getChildren()) { |
| | | if (sampleTypeDto.getChildren().size() == 0) { |
| | | sampleTypeDto.setChildren(standardTreeMapper.getStandardTree3(sampleTypeDto.getValue())); |
| | | } |
| | | // 夿ç»å®çæ¯å¦æ¯å½åé¶ä»¶å· |
| | | if (sampleTypeDto.getPartNo() != null && sampleTypeDto.getPartNo().equals(partNo)) { |
| | | // æ·»å 对象 |
| | | rawMaterialStandardTreeDto.setTreeName(factoryDto.getValue() + "-" |
| | | + laboratoryDto.getValue() + "-" |
| | | + sampleTypeDto.getValue()); |
| | | rawMaterialStandardTreeDto.setCode(sampleTypeDto.getCode()); |
| | | rawMaterialStandardTreeDto.setLabel(sampleTypeDto.getLabel()); |
| | | rawMaterialStandardTreeDto.setValue(sampleTypeDto.getValue()); |
| | | rawMaterialStandardTreeDto.setChildren1(sampleTypeDto.getChildren()); |
| | | } else { |
| | | for (SampleDto sampleDto : sampleTypeDto.getChildren()) { |
| | | if (sampleDto.getPartNo() != null && sampleDto.getPartNo().equals(partNo)) { |
| | | // æ·»å 对象 |
| | | rawMaterialStandardTreeDto.setTreeName(factoryDto.getValue() + "-" |
| | | + laboratoryDto.getValue() + "-" |
| | | + sampleTypeDto.getValue() + "-" |
| | | + sampleDto.getValue()); |
| | | rawMaterialStandardTreeDto.setCode(sampleDto.getCode()); |
| | | rawMaterialStandardTreeDto.setLabel(sampleDto.getLabel()); |
| | | rawMaterialStandardTreeDto.setValue(sampleDto.getValue()); |
| | | rawMaterialStandardTreeDto.setChildren2(sampleDto.getChildren()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return rawMaterialStandardTreeDto; |
| | | } |
| | | |
| | | @Override |
| | | public IPage<IfsInventoryQuantity> getWarehouseSubmit(IPage<IfsInventoryQuantity> page, IfsInventoryQuantity ifsInventoryQuantity) { |
| | | return standardTreeMapper.selectIfsPage(page, QueryWrappers.queryWrappers(ifsInventoryQuantity)); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<IfsInventoryQuantityDto> getIfsByStateOne(IPage<IfsInventoryQuantityDto> page, IfsInventoryQuantityDto ifsInventoryQuantityDto) { |
| | | return standardTreeMapper.getIfsByStateOne(page, QueryWrappers.queryWrappers(ifsInventoryQuantityDto)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ¥æ£ |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @Override |
| | | public int inspectionReport(List<Integer> ids) { |
| | | Integer userId = SecurityUtils.getUserId().intValue(); |
| | | ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate() |
| | | .in(IfsInventoryQuantity::getId, ids) |
| | | .set(IfsInventoryQuantity::getDeclareUser, userMapper.selectById(userId).getName()) |
| | | .set(IfsInventoryQuantity::getDeclareUserId, userId) |
| | | .set(IfsInventoryQuantity::getIsInspect, 1) |
| | | .set(IfsInventoryQuantity::getDeclareDate, LocalDateTime.now()) |
| | | ); |
| | | threadPoolTaskExecutor.execute(() -> { |
| | | List<IfsInventoryQuantity> quantityList = ifsInventoryQuantityMapper.selectList(Wrappers.<IfsInventoryQuantity>lambdaQuery() |
| | | .in(IfsInventoryQuantity::getId, ids)); |
| | | // ä¼ä¸å¾®ä¿¡éç¥ |
| | | String message = ""; |
| | | message += "æ°å¢æ¥æ£éç¥"; |
| | | for (IfsInventoryQuantity inventoryQuantity : quantityList) { |
| | | message += "\næ¹æ¬¡å·: " + inventoryQuantity.getUpdateBatchNo(); |
| | | message += "\né¶ä»¶æè¿°: " + inventoryQuantity.getPartDesc(); |
| | | message += "\næµè¾¾æ°é: " + inventoryQuantity.getQtyArrived().stripTrailingZeros().toPlainString() + inventoryQuantity.getBuyUnitMeas(); |
| | | |
| | | // å¤æææ²¡æå°20å¨. æè
è½å¦å
æ£ |
| | | int result = notificationRawOrder(inventoryQuantity.getId()); |
| | | switch (result) { |
| | | case 1: |
| | | message += "\nå½åæ ·åå·²æ£éªè¿, å¯ä»¥å
æ£"; |
| | | break; |
| | | case 2: |
| | | message += "\nå½åæ ·åå·²è¶
è¿20å¨"; |
| | | break; |
| | | } |
| | | message += "\n"; |
| | | } |
| | | WxCpUtils.informWebHook(wechatProperty.getExaminingUrl(), message); |
| | | }); |
| | | return 1; |
| | | } |
| | | |
| | | /** |
| | | * æ¤éæ¥æ£ |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public int revokeInspectionReport(Integer id) { |
| | | return ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate() |
| | | .eq(IfsInventoryQuantity::getId, id) |
| | | .set(IfsInventoryQuantity::getIsInspect, 0) |
| | | ); |
| | | } |
| | | |
| | | /** |
| | | * æå°æ ç¾æ¥è¯¢ |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<IfsInventoryQuantityDto> printLabel(List<Integer> ids) { |
| | | return ifsInventoryQuantityMapper.printLabel(ids); |
| | | } |
| | | |
| | | /** |
| | | * æ¥æ£ |
| | | * @param ifsInventoryQuantity |
| | | * @return |
| | | */ |
| | | @Override |
| | | public int inspectionReportOne(IfsInventoryQuantity ifsInventoryQuantity) { |
| | | Integer userId = SecurityUtils.getUserId().intValue(); |
| | | ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate() |
| | | .eq(IfsInventoryQuantity::getId, ifsInventoryQuantity.getId()) |
| | | .set(IfsInventoryQuantity::getDeclareUser, userMapper.selectById(userId).getName()) |
| | | .set(IfsInventoryQuantity::getDeclareUserId, userId) |
| | | .set(IfsInventoryQuantity::getIsInspect, 1) |
| | | .set(IfsInventoryQuantity::getDeclareDate, LocalDateTime.now()) |
| | | .set(IfsInventoryQuantity::getUpdateBatchNo, ifsInventoryQuantity.getUpdateBatchNo()) |
| | | ); |
| | | |
| | | threadPoolTaskExecutor.execute(() -> { |
| | | IfsInventoryQuantity inventoryQuantity = ifsInventoryQuantityMapper.selectById(ifsInventoryQuantity.getId()); |
| | | // ä¼ä¸å¾®ä¿¡éç¥ |
| | | String message = ""; |
| | | message += "æ°å¢æ¥æ£éç¥"; |
| | | message += "\næ¹æ¬¡å·: " + inventoryQuantity.getUpdateBatchNo(); |
| | | message += "\né¶ä»¶æè¿°: " + inventoryQuantity.getPartDesc(); |
| | | message += "\næµè¾¾æ°é: " + inventoryQuantity.getQtyArrived().stripTrailingZeros().toPlainString() + inventoryQuantity.getBuyUnitMeas(); |
| | | WxCpUtils.informWebHook(wechatProperty.getExaminingUrl(), message); |
| | | }); |
| | | return 1; |
| | | } |
| | | |
| | | /** |
| | | * è·åé产ä¸é¾æ£æµæ°æ® |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public String getIndustryChain(Integer id) { |
| | | return ifsInventoryQuantityMapper.selectById(id).getIndustryChain(); |
| | | } |
| | | |
| | | /** |
| | | * åæææ¤éæ¥å£ |
| | | * @param ifsInventoryId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean repealRawOrder(Integer ifsInventoryId) { |
| | | // æ¥è¯¢å¤ææ¯å¦æ¯éåä¸ |
| | | IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(ifsInventoryId); |
| | | if (ifsInventoryQuantity.getIsCopper() != null && ifsInventoryQuantity.getIsCopper().equals(1)) { |
| | | // éåä¸ç´æ¥å é¤å°±è¡ |
| | | ifsInventoryQuantityMapper.deleteById(ifsInventoryId); |
| | | } else { |
| | | ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>() |
| | | .set(IfsInventoryQuantity::getState, 0) |
| | | .set(IfsInventoryQuantity::getIsQuarter, 1) |
| | | .eq(IfsInventoryQuantity::getId, ifsInventoryId)); |
| | | } |
| | | |
| | | insOrderService.update(Wrappers.<InsOrder>lambdaUpdate() |
| | | .eq(InsOrder::getIfsInventoryId, ifsInventoryId) |
| | | .set(InsOrder::getState, -1) |
| | | .set(InsOrder::getEntrustCode, ""));// æ¤é |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * åææå
æ£ä¸å |
| | | * @param list |
| | | * @param insOrder |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int addExemptionOrder(List<SampleProductDto> list, InsOrder insOrder) { |
| | | if (!insOrder.getOrderType().equals(InsOrderTypeConstants.ENTER_THE_FACTORY)) { |
| | | throw new ErrorException("åªæè¿åæ£éªæè½å
æ£"); |
| | | } |
| | | insOrder.setSendTime(LocalDateTime.now()); |
| | | // ä¿®æ¹è®¢åè¡¨ç´æ¥ä¸ºå·²æ£éª |
| | | insOrder.setState(4); |
| | | insOrder.setTypeSource(1); |
| | | |
| | | String code = "Y"; |
| | | // çæç¼å· |
| | | String no = numberGenerator.generateNumberWithPrefix(3, |
| | | "JCZX/ZB-" + code + LimsDateUtil.resetDate(LocalDateTime.now()), |
| | | InsOrder::getEntrustCode); |
| | | |
| | | insOrderMapper.insert(insOrder); // 主表 |
| | | |
| | | AtomicInteger count = new AtomicInteger(); |
| | | list.forEach(a -> { |
| | | count.getAndIncrement(); |
| | | a.setId(null); |
| | | a.setInsOrderId(insOrder.getId()); |
| | | if (StrUtil.isEmpty(a.getSampleCode())) { |
| | | // å¦æåªæä¸ä¸ªæ ·åå°±ä¸éè¦æ¼æ¥æ°å |
| | | if (list.size() != 1) { |
| | | a.setSampleCode(no + "-" + count.get()); |
| | | } else { |
| | | a.setSampleCode(no); |
| | | } |
| | | } |
| | | insSampleMapper.insert(a); |
| | | |
| | | if (!CollectionUtil.isEmpty(a.getInsProduct())) { |
| | | throw new ErrorException("å
æ£ä¸éè¦å¡«åæ£éªé¡¹"); |
| | | } |
| | | }); |
| | | |
| | | // åææä¸å: å§æäººå°±æ¯æ¥æ£äºº, ç产åä½å°±æ¯ä¾åºååä½ |
| | | IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(insOrder.getIfsInventoryId()); |
| | | Integer declareUserId = ifsInventoryQuantity.getDeclareUserId(); |
| | | User user = userMapper.selectById(declareUserId); |
| | | // ä¾åºååç§° |
| | | insOrder.setProduction(ifsInventoryQuantity.getSupplierName()); |
| | | // å§æäººåç§° |
| | | insOrder.setPrepareUser(user.getName()); |
| | | insOrder.setPhone(user.getPhone()); |
| | | |
| | | // ä¿®æ¹åæææ°æ®ç´æ¥ä¸ºå·²æ£éª |
| | | ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>().set(IfsInventoryQuantity::getState, 2) |
| | | .eq(IfsInventoryQuantity::getId, insOrder.getIfsInventoryId())); |
| | | |
| | | insOrder.setExamineTime(LocalDateTime.now()); |
| | | |
| | | insOrder.setEntrustCode(no); |
| | | insOrder.setIsExemption(1); |
| | | |
| | | insOrderMapper.updateById(insOrder); |
| | | |
| | | // æ·»å å·¥æ¶ |
| | | addAuxiliary(insOrder, ifsInventoryQuantity); |
| | | |
| | | // todo: ifsç´æ¥ç§»åº |
| | | insReportService.isRawMaterial(insOrder); |
| | | |
| | | return insOrder.getId(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ¥è¯¢å¾
ä¸å |
| | | * @param page |
| | | * @param ifsInventoryQuantity |
| | | * @return |
| | | */ |
| | | @Override |
| | | public IPage<IfsInventoryQuantityCheckDto> selectIfsInventoryQuantity(Page<IfsInventoryQuantityCheckDto> page, IfsInventoryQuantityCheckDto ifsInventoryQuantity) { |
| | | return standardTreeMapper.selectIfsInventoryQuantity(page, QueryWrappers.queryWrappers(ifsInventoryQuantity)); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å·²æ£éª |
| | | * @param page |
| | | * @param ifsInventoryQuantityDto |
| | | * @return |
| | | */ |
| | | @Override |
| | | public IPage<IfsInventoryQuantitySupplierDto> getIfsByOver(Page<IfsInventoryQuantitySupplierDto> page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto) { |
| | | // todo: åªçæ |
| | | String beginDeclareDate = ifsInventoryQuantityDto.getBeginDeclareDate(); |
| | | String endDeclareDate = ifsInventoryQuantityDto.getEndDeclareDate(); |
| | | ifsInventoryQuantityDto.setBeginDeclareDate(null); |
| | | ifsInventoryQuantityDto.setEndDeclareDate(null); |
| | | |
| | | return standardTreeMapper.getIfsByOver(page, QueryWrappers.queryWrappers(ifsInventoryQuantityDto), beginDeclareDate, endDeclareDate); |
| | | } |
| | | |
| | | /** |
| | | * å é¤åæææ¥æ£ä¿¡æ¯ |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public int delIfsInventory(Integer id) { |
| | | return ifsInventoryQuantityMapper.deleteById(id); |
| | | } |
| | | |
| | | /** |
| | | * åæææ¾è¡å
æ£ |
| | | * @param ifsInventoryId |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean rawOrderRelease(Integer ifsInventoryId, String partDetail) { |
| | | // ä¿®æ¹åæææ°æ®ç´æ¥ä¸ºå·²æ£éª |
| | | ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>() |
| | | .set(IfsInventoryQuantity::getState, 2) |
| | | .set(IfsInventoryQuantity::getIsQuarter, 0) |
| | | .eq(IfsInventoryQuantity::getId, ifsInventoryId)); |
| | | |
| | | // æ¥è¯¢åææä¿¡æ¯ |
| | | IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(ifsInventoryId); |
| | | // å§æäººå°±æ¯æ¥æ£äºº, ç产åä½å°±æ¯ä¾åºååä½ |
| | | Integer declareUserId = ifsInventoryQuantity.getDeclareUserId(); |
| | | User user = userMapper.selectById(declareUserId); |
| | | |
| | | InsOrder insOrder = new InsOrder(); |
| | | insOrder.setState(4); |
| | | insOrder.setTypeSource(1); |
| | | String code = "Y"; |
| | | // çæç¼å· |
| | | String no = numberGenerator.generateNumberWithPrefix(3, |
| | | "JCZX/ZB-" + code + LimsDateUtil.resetDate(LocalDateTime.now()), |
| | | InsOrder::getEntrustCode); |
| | | insOrder.setExamineTime(LocalDateTime.now()); |
| | | insOrder.setEntrustCode(no); |
| | | insOrder.setIsExemption(1); |
| | | // ä¾åºååç§° |
| | | insOrder.setProduction(ifsInventoryQuantity.getSupplierName()); |
| | | // å§æäººåç§° |
| | | insOrder.setPrepareUser(user.getName()); |
| | | insOrder.setPhone(user.getPhone()); |
| | | insOrder.setIfsInventoryId(ifsInventoryId); |
| | | insOrder.setPartDetail(partDetail); |
| | | insOrder.setSendTime(LocalDateTime.now()); |
| | | insOrder.setSample(ifsInventoryQuantity.getPartDesc()); |
| | | // è¿åæ£éª |
| | | insOrder.setOrderType(InsOrderTypeConstants.ENTER_THE_FACTORY); |
| | | |
| | | insOrderMapper.insert(insOrder); |
| | | |
| | | // æ·»å å·¥æ¶ |
| | | addAuxiliary(insOrder, ifsInventoryQuantity); |
| | | |
| | | // todo: ifsç´æ¥ç§»åº |
| | | insReportService.isRawMaterial(insOrder); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 0, æ æç¤º, 1æç¤º å½åæ¹æ¬¡çæ ·åå·²æ£éªè¿, å¯ä»¥å
æ£, 2 æç¤º å½åæ¹æ¬¡çæ ·åå·²è¶
20å¨, éè¦å¤çº§å¤æ¬¡æ£éª |
| | | * |
| | | * åææä¸åéç¥å
æ£æè
夿¬¡æ£éª |
| | | * @param ifsInventoryId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public int notificationRawOrder(Integer ifsInventoryId) { |
| | | IfsInventoryQuantity ifsInventory = ifsInventoryQuantityMapper.selectById(ifsInventoryId); |
| | | // æ¥è¯¢å½åæ¹æ¬¡, ä¾åºå, é¶ä»¶å·çåæææ¯å¦è¶
è¿äº20å¨, è¶
è¿äº20å¨éè¦è¿è¡å¤æ¬¡æ£éªæé |
| | | List<IfsInventoryQuantity> quantityList = ifsInventoryQuantityMapper.selectList(Wrappers.<IfsInventoryQuantity>lambdaQuery() |
| | | .eq(IfsInventoryQuantity::getPartNo, ifsInventory.getPartNo()) |
| | | .eq(IfsInventoryQuantity::getUpdateBatchNo, ifsInventory.getUpdateBatchNo()) |
| | | .eq(IfsInventoryQuantity::getSupplierId, ifsInventory.getSupplierId()) |
| | | .eq(IfsInventoryQuantity::getSupplierName, ifsInventory.getSupplierName())); |
| | | |
| | | // 夿æ¯å¦å¤§äº20å¨ |
| | | BigDecimal bigDecimal = new BigDecimal("20000"); |
| | | BigDecimal count = BigDecimal.ZERO; |
| | | for (IfsInventoryQuantity inventoryQuantity : quantityList) { |
| | | // 夿å使¯kgæè
t |
| | | if (inventoryQuantity.getBuyUnitMeas().equalsIgnoreCase("t")) { |
| | | count = count.add(inventoryQuantity.getQtyArrived().multiply(new BigDecimal("1000"))); |
| | | } else if (inventoryQuantity.getBuyUnitMeas().equalsIgnoreCase("kg")) { |
| | | count = count.add(inventoryQuantity.getQtyArrived()); |
| | | } |
| | | } |
| | | |
| | | if (count.compareTo(bigDecimal) >= 0) { |
| | | return 2; |
| | | } else { |
| | | // 夿ä¹åæ¯å¦åºè¿æ¥å, åºè¿æ¥åå¯ä»¥å
æ£ |
| | | int reportCount = ifsInventoryQuantityMapper.selectReportCountById(ifsInventoryId); |
| | | if (reportCount > 0) { |
| | | return 1; |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | /** |
| | | * æ¥æ£å¯ä»¥æ°å¢æ¥æ£ä¿¡æ¯ |
| | | * @param ifsInventoryQuantity |
| | | */ |
| | | @Override |
| | | public void addIfsInventoryQuantity(IfsInventoryQuantity ifsInventoryQuantity) { |
| | | ifsInventoryQuantity.setIsSource(0); |
| | | ifsInventoryQuantity.setState(0); |
| | | ifsInventoryQuantity.setIsFinish(0); |
| | | ifsInventoryQuantityMapper.insert(ifsInventoryQuantity); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * éåä¸ä¸åå
æ£ |
| | | * @param list |
| | | * @param insOrder |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int addRawCopperOrderExemptionOrder(List<SampleProductDto> list, CopperInsOrderDto insOrder) { |
| | | if (!insOrder.getOrderType().equals(InsOrderTypeConstants.ENTER_THE_FACTORY)) { |
| | | throw new ErrorException("åªæè¿åæ£éªæè½å
æ£"); |
| | | } |
| | | insOrder.setSendTime(LocalDateTime.now()); |
| | | // ä¿®æ¹è®¢åè¡¨ç´æ¥ä¸ºå·²æ£éª |
| | | insOrder.setState(4); |
| | | insOrder.setTypeSource(1); |
| | | |
| | | String code = "Y"; |
| | | // çæç¼å· |
| | | String no = numberGenerator.generateNumberWithPrefix(3, |
| | | "JCZX/ZB-" + code + LimsDateUtil.resetDate(LocalDateTime.now()), |
| | | InsOrder::getEntrustCode); |
| | | |
| | | insOrderMapper.insert(insOrder); // 主表 |
| | | |
| | | AtomicInteger count = new AtomicInteger(); |
| | | list.forEach(a -> { |
| | | count.getAndIncrement(); |
| | | a.setId(null); |
| | | a.setInsOrderId(insOrder.getId()); |
| | | if (StrUtil.isEmpty(a.getSampleCode())) { |
| | | // å¦æåªæä¸ä¸ªæ ·åå°±ä¸éè¦æ¼æ¥æ°å |
| | | if (list.size() != 1) { |
| | | a.setSampleCode(no + "-" + count.get()); |
| | | } else { |
| | | a.setSampleCode(no); |
| | | } |
| | | } |
| | | insSampleMapper.insert(a); |
| | | |
| | | if (!CollectionUtil.isEmpty(a.getInsProduct())) { |
| | | throw new ErrorException("å
æ£ä¸éè¦å¡«åæ£éªé¡¹"); |
| | | } |
| | | }); |
| | | // æ·»å åææä¿¡æ¯ |
| | | IfsInventoryQuantity ifsInventoryQuantity = new IfsInventoryQuantity(); |
| | | // åºæ¬ä¿¡æ¯ |
| | | ifsInventoryQuantity.setIsSource(0); |
| | | ifsInventoryQuantity.setState(2); |
| | | ifsInventoryQuantity.setIsInspect(1); |
| | | ifsInventoryQuantity.setIsFinish(1); |
| | | ifsInventoryQuantity.setIsCopper(1); |
| | | ifsInventoryQuantity.setInspectStatus(1); |
| | | ifsInventoryQuantity.setIsQuarter(0); |
| | | |
| | | ifsInventoryQuantity.setQtyArrived(insOrder.getQtyArrived()); |
| | | ifsInventoryQuantity.setBuyUnitMeas(insOrder.getBuyUnitMeas()); |
| | | ifsInventoryQuantity.setSupplierName(insOrder.getSupplierName()); |
| | | ifsInventoryQuantity.setUpdateBatchNo(insOrder.getUpdateBatchNo()); |
| | | ifsInventoryQuantity.setDeclareDate(insOrder.getDeclareDate()); |
| | | |
| | | ifsInventoryQuantityMapper.insert(ifsInventoryQuantity); |
| | | |
| | | insOrder.setIfsInventoryId(ifsInventoryQuantity.getId()); |
| | | insOrder.setExamineTime(LocalDateTime.now()); |
| | | |
| | | insOrder.setEntrustCode(no); |
| | | insOrder.setIsExemption(1); |
| | | |
| | | insOrderMapper.updateById(insOrder); |
| | | |
| | | // æ·»å å·¥æ¶ |
| | | addAuxiliary(insOrder, ifsInventoryQuantity); |
| | | |
| | | return insOrder.getId(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean concessionRelease(Integer ifsInventoryId) { |
| | | // æ¥è¯¢åææä¿¡æ¯ |
| | | IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(ifsInventoryId); |
| | | if (!ifsInventoryQuantity.getInspectStatus().equals(2)) { |
| | | throw new ErrorException("ä¸åæ ¼çåæææè½è®©æ¥æ¾è¡"); |
| | | } |
| | | |
| | | // todo:éè¦å¤æoaæµç¨æ¯å¦æ¯è®©æ¥æ¾è¡ |
| | | String toLocation = insReportService.moveRawMaterial(ifsInventoryQuantity); |
| | | |
| | | ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>() |
| | | .set(IfsInventoryQuantity::getInspectStatus, 4) |
| | | .set(IfsInventoryQuantity::getToLocation, toLocation) |
| | | .eq(IfsInventoryQuantity::getId, ifsInventoryId)); |
| | | |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * åææè¿åæ¤éä¸å |
| | | * @param enterOrderId |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean repealEnterRawOrder(Integer enterOrderId) { |
| | | // æ¥è¯¢è®¢å |
| | | InsOrder order = insOrderMapper.selectById(enterOrderId); |
| | | |
| | | // æ¥è¯¢å¤ææ¯å¦æ¯éåä¸ |
| | | IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(order.getIfsInventoryId()); |
| | | if (ifsInventoryQuantity.getIsCopper() != null && ifsInventoryQuantity.getIsCopper().equals(1)) { |
| | | // éåä¸ç´æ¥å é¤å°±è¡ |
| | | ifsInventoryQuantityMapper.deleteById(order.getIfsInventoryId()); |
| | | } else { |
| | | ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>() |
| | | .set(IfsInventoryQuantity::getState, 0) |
| | | .set(IfsInventoryQuantity::getIsQuarter, 1) |
| | | .eq(IfsInventoryQuantity::getId, order.getIfsInventoryId())); |
| | | } |
| | | insOrderService.update(Wrappers.<InsOrder>lambdaUpdate() |
| | | .eq(InsOrder::getId, enterOrderId) |
| | | .set(InsOrder::getState, -1) |
| | | .set(InsOrder::getEntrustCode, ""));// æ¤é |
| | | |
| | | // æ¸
é¤ä¹åçå·¥æ¶ |
| | | auxiliaryOutputWorkingHoursMapper.delete(Wrappers.<AuxiliaryOutputWorkingHours>lambdaQuery() |
| | | .eq(AuxiliaryOutputWorkingHours::getOrderId, enterOrderId)); |
| | | |
| | | // æ¸
é¤ä¹åæ¥å |
| | | insReportService.remove(Wrappers.<InsReport>lambdaQuery() |
| | | .eq(InsReport::getInsOrderId, enterOrderId)); |
| | | |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * åææå£åº¦æ¤éä¸å |
| | | * @param quarterOrderId |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean repealQuarterRawOrder(Integer quarterOrderId) { |
| | | // æ¥è¯¢è®¢å |
| | | InsOrder order = insOrderMapper.selectById(quarterOrderId); |
| | | |
| | | Long count = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery() |
| | | .eq(InsOrder::getIfsInventoryId, order.getIfsInventoryId()) |
| | | .ne(InsOrder::getState, -1) |
| | | .eq(InsOrder::getOrderType, InsOrderTypeConstants.ENTER_THE_FACTORY) |
| | | .ne(InsOrder::getId, order.getId())); |
| | | // 夿ä¹åæ¯å¦æè¿åæ£éª, 没æéè¦ä¿®æ¹åææä¿¡æ¯ |
| | | if (count == 0) { |
| | | ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>() |
| | | .set(IfsInventoryQuantity::getState, 0) |
| | | .set(IfsInventoryQuantity::getIsQuarter, 1) |
| | | .eq(IfsInventoryQuantity::getId, order.getIfsInventoryId())); |
| | | } else { |
| | | ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>() |
| | | .set(IfsInventoryQuantity::getIsQuarter, 1) |
| | | .eq(IfsInventoryQuantity::getId, order.getIfsInventoryId())); |
| | | } |
| | | |
| | | insOrderService.update(Wrappers.<InsOrder>lambdaUpdate() |
| | | .eq(InsOrder::getId, quarterOrderId) |
| | | .set(InsOrder::getState, -1) |
| | | .set(InsOrder::getEntrustCode, ""));// æ¤é |
| | | auxiliaryOutputWorkingHoursMapper.delete(Wrappers.<AuxiliaryOutputWorkingHours>lambdaQuery() |
| | | .eq(AuxiliaryOutputWorkingHours::getOrderId, quarterOrderId)); |
| | | // æ¸
é¤ä¹åæ¥å |
| | | insReportService.remove(Wrappers.<InsReport>lambdaQuery() |
| | | .eq(InsReport::getInsOrderId, quarterOrderId)); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * åæææ¥æ£å
¨é¨ä¿¡æ¯å¯¼åº |
| | | * @param ifsInventoryQuantityDto |
| | | * @param response |
| | | */ |
| | | @Override |
| | | public void rawAllExport(IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto, HttpServletResponse response) throws UnsupportedEncodingException { |
| | | //æ¥è¯¢å¯¼åºçè´¹ç¨ç»è®¡æ°æ® |
| | | String beginDeclareDate = ifsInventoryQuantityDto.getBeginDeclareDate(); |
| | | String endDeclareDate = ifsInventoryQuantityDto.getEndDeclareDate(); |
| | | ifsInventoryQuantityDto.setBeginDeclareDate(null); |
| | | ifsInventoryQuantityDto.setEndDeclareDate(null); |
| | | List<IfsInventoryQuantitySupplierDto> ifsByOverList = standardTreeMapper.getIfsByOverList(QueryWrappers.queryWrappers(ifsInventoryQuantityDto), beginDeclareDate, endDeclareDate); |
| | | |
| | | for (IfsInventoryQuantitySupplierDto dto : ifsByOverList) { |
| | | dto.setSendTimeString(dto.getSendTime() == null ? "" : dto.getSendTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | dto.setReceiverDateString(dto.getReceiverDate() == null ? "" : dto.getReceiverDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | dto.setDeclareDateString(dto.getDeclareDate() == null ? "" : dto.getDeclareDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | switch (dto.getInspectStatus()) { |
| | | case 1: |
| | | dto.setInspectStatusString("åæ ¼"); |
| | | break; |
| | | case 2: |
| | | dto.setInspectStatusString("ä¸åæ ¼"); |
| | | // æ¥è¯¢ä¸åæ ¼é¡¹ |
| | | List<String> unqualifiedList = insProductMapper.selectUnqualifiedList(dto.getEnterOrderId() == null ? dto.getQuarterOrderId() : dto.getEnterOrderId()); |
| | | dto.setUnqualifiedItem(CollUtil.join(unqualifiedList, ",")); |
| | | break; |
| | | case 3: |
| | | dto.setInspectStatusString("æªä¸å"); |
| | | break; |
| | | case 4: |
| | | dto.setInspectStatusString("è®©æ¥æ¾è¡"); |
| | | break; |
| | | case 0: |
| | | dto.setInspectStatusString("æ£éªä¸"); |
| | | break; |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setCharacterEncoding("UTF-8"); |
| | | // è¿éURLEncoder.encodeå¯ä»¥é²æ¢ä¸æä¹±ç å½ç¶åeasyexcel没æå
³ç³» |
| | | String fileName = URLEncoder.encode("åæææ£æµä¿¡æ¯å¯¼åº", "UTF-8"); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); |
| | | try { |
| | | //æ°å»ºExcelWriter |
| | | ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).build(); |
| | | //è·åsheet0对象 |
| | | WriteSheet mainSheet = EasyExcel.writerSheet(0, "åæææ£æµä¿¡æ¯å¯¼åº").head(IfsInventoryQuantitySupplierDto.class).build(); |
| | | |
| | | //åsheet0åå
¥æ°æ® ä¼ å
¥ç©ºlistè¿æ ·åªå¯¼åºè¡¨å¤´ |
| | | excelWriter.write(ifsByOverList, mainSheet); |
| | | //å
³éæµ |
| | | excelWriter.finish(); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * åæææ¥è¯¢å¯ä»¥å£åº¦æ£éªçå
容 |
| | | * @param page |
| | | * @param ifsInventoryQuantityDto |
| | | * @return |
| | | */ |
| | | @Override |
| | | public IPage<IfsInventoryQuantitySupplierDto> getIfsByQuarter(Page page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto) { |
| | | |
| | | // todo: åªçæ |
| | | String beginDeclareDate = ifsInventoryQuantityDto.getBeginDeclareDate(); |
| | | String endDeclareDate = ifsInventoryQuantityDto.getEndDeclareDate(); |
| | | ifsInventoryQuantityDto.setBeginDeclareDate(null); |
| | | ifsInventoryQuantityDto.setEndDeclareDate(null); |
| | | |
| | | return standardTreeMapper.getIfsByQuarter(page, QueryWrappers.queryWrappers(ifsInventoryQuantityDto), beginDeclareDate, endDeclareDate); |
| | | } |
| | | |
| | | /** |
| | | * æåå
¥åº |
| | | * @param ifsInventoryId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean advancedGodown(Integer ifsInventoryId) { |
| | | // æ¥è¯¢åææä¿¡æ¯ |
| | | IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(ifsInventoryId); |
| | | if (!ifsInventoryQuantity.getInspectStatus().equals(0) |
| | | && !ifsInventoryQuantity.getInspectStatus().equals(3)) { |
| | | throw new ErrorException("æªæ£æµå®ææ°æ®æè½æåå
¥åº"); |
| | | } |
| | | |
| | | // todo:éè¦å¤æoaæµç¨æ¯å¦æ¯è®©æ¥æ¾è¡ |
| | | String toLocation = insReportService.moveRawMaterial(ifsInventoryQuantity); |
| | | |
| | | ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>() |
| | | .set(IfsInventoryQuantity::getInspectStatus, 1) |
| | | .set(IfsInventoryQuantity::getIsFinish, 1) |
| | | .set(IfsInventoryQuantity::getToLocation, toLocation) |
| | | .eq(IfsInventoryQuantity::getId, ifsInventoryId)); |
| | | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ·»å å·¥æ¶ |
| | | * @param insOrder |
| | | * @param ifsInventoryQuantity |
| | | */ |
| | | private void addAuxiliary(InsOrder insOrder, IfsInventoryQuantity ifsInventoryQuantity) { |
| | | AuxiliaryOutputWorkingHours auxiliaryOutputWorkingHours = new AuxiliaryOutputWorkingHours(); |
| | | auxiliaryOutputWorkingHours.setInspectionItemClass(ifsInventoryQuantity.getUpdateBatchNo() + "å
æ£");//æ£æµé¡¹åç±» |
| | | auxiliaryOutputWorkingHours.setSample(insOrder.getEntrustCode());//æ ·åç¼å· |
| | | auxiliaryOutputWorkingHours.setOrderId(insOrder.getId());//订åid |
| | | auxiliaryOutputWorkingHours.setOrderNo(insOrder.getEntrustCode());//éå çå§æåå· |
| | | |
| | | // å
æ£é»è®¤2 |
| | | auxiliaryOutputWorkingHours.setWorkTime(new BigDecimal("2"));//éå çå·¥æ¶ |
| | | auxiliaryOutputWorkingHours.setAmount(1);//éå çæ°é |
| | | auxiliaryOutputWorkingHours.setOutputWorkTime((ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getOvertimeWorkTime()) ? auxiliaryOutputWorkingHours.getOvertimeWorkTime() : BigDecimal.ZERO).add(ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getWorkTime()) ? auxiliaryOutputWorkingHours.getWorkTime() : BigDecimal.ZERO));//产éå·¥æ¶ |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | auxiliaryOutputWorkingHours.setDateTime(LocalDateTime.now().toLocalDate().atStartOfDay().format(formatters));//æ¥æ |
| | | LocalDateTime localDateTime = LocalDateTime.now(); |
| | | DateTime parse = DateUtil.parse(localDateTime.format(formatter)); |
| | | auxiliaryOutputWorkingHours.setWeekDay(getWeek(localDateTime.format(formatters)));//ææ |
| | | auxiliaryOutputWorkingHours.setWeek(String.valueOf(DateUtil.weekOfYear(DateUtil.offsetDay(parse, 1))));//卿¬¡ |
| | | auxiliaryOutputWorkingHours.setCheck(SecurityUtils.getUserId().intValue());//æ£æµäºº |
| | | auxiliaryOutputWorkingHours.setPrice(new BigDecimal("1"));//åä»· |
| | | |
| | | auxiliaryOutputWorkingHoursMapper.insert(auxiliaryOutputWorkingHours); |
| | | } |
| | | |
| | | public static String getWeek(String dayStr) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | try { |
| | | Date date = sdf.parse(dayStr); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(date); |
| | | int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); |
| | | int day = calendar.get(Calendar.DAY_OF_MONTH); |
| | | return getWeekDay(dayOfWeek); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static String getWeekDay(int dayOfWeek) { |
| | | switch (dayOfWeek) { |
| | | case Calendar.MONDAY: |
| | | return "å¨ä¸"; |
| | | case Calendar.TUESDAY: |
| | | return "å¨äº"; |
| | | case Calendar.WEDNESDAY: |
| | | return "å¨ä¸"; |
| | | case Calendar.THURSDAY: |
| | | return "å¨å"; |
| | | case Calendar.FRIDAY: |
| | | return "å¨äº"; |
| | | case Calendar.SATURDAY: |
| | | return "å¨å
"; |
| | | case Calendar.SUNDAY: |
| | | return "卿¥"; |
| | | default: |
| | | return "æªç¥"; |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.inspect.mapper.InsOrderMapper"> |
| | | |
| | | <resultMap id="selectSampleDefectsMap" type="com.ruoyi.inspect.vo.SampleDefectsFatherVo"> |
| | | <id column="id" property="id"/> |
| | | <result column="sample" property="sample"/> |
| | | <association property="children" resultMap="SampleDefectsChildrenMap" javaType="java.util.List"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="SampleDefectsChildrenMap" type="com.ruoyi.inspect.vo.SampleDefectsChildrenVo"> |
| | | <result column="entrust_code" property="entrust_code"/> |
| | | <result column="inspection_item" property="inspection_item"/> |
| | | <result column="name" property="name"/> |
| | | <result column="create_time" property="create_time"/> |
| | | </resultMap> |
| | | |
| | | <sql id="selectSampleProductDto2"> |
| | | i.id, |
| | | isa.sample_code, |
| | | isa.sample, |
| | | isa.model, |
| | | isa.ins_state, |
| | | ip.id insProductId, |
| | | ip.state, |
| | | ip.unit, |
| | | ip.inspection_item_class, |
| | | ip.inspection_item_class_en, |
| | | ip.inspection_item, |
| | | ip.inspection_item_en, |
| | | ip.inspection_item_subclass, |
| | | ip.inspection_item_subclass_en, |
| | | ip.son_laboratory, |
| | | ip.inspection_item_type, |
| | | ip.inspection_value_type, |
| | | ip.ask, |
| | | ip.tell, |
| | | ip.`last_value`, |
| | | ip.ins_result, |
| | | ip.radius, |
| | | isa.quantity, |
| | | ip.sort, |
| | | ip.cable_tag |
| | | </sql> |
| | | |
| | | <select id="selectInsOrderPage" resultType="com.ruoyi.inspect.dto.SampleOrderDto"> |
| | | select * |
| | | from ( |
| | | SELECT |
| | | io.*, |
| | | isau.user_id assign, |
| | | ir.id report_id, |
| | | ir.url, |
| | | ir.url_s, |
| | | sample_counts.sample_num, |
| | | CONCAT(ROUND(approved_product_counts.approved_count / total_product_counts.total_count * 100, 2), '%') AS insProgress, |
| | | io.sample_view AS sample_name, |
| | | GROUP_CONCAT(DISTINCT isa.model SEPARATOR ' ') AS sample_model, |
| | | u.name, |
| | | testing_name, |
| | | ip.son_laboratory |
| | | FROM |
| | | ins_order io |
| | | LEFT JOIN |
| | | ins_sample isa ON io.id = isa.ins_order_id |
| | | left join ins_product ip on ip.ins_sample_id = isa.id |
| | | LEFT JOIN |
| | | ins_sample_user isau ON isau.ins_sample_id = io.id |
| | | LEFT JOIN |
| | | (SELECT id, ins_order_id, is_ratify, url, url_s FROM ins_report WHERE is_ratify = 1) ir ON io.id = ir.ins_order_id |
| | | LEFT JOIN |
| | | user u ON io.create_user = u.id |
| | | LEFT JOIN |
| | | (SELECT ins_order_id, COUNT(*) AS sample_num |
| | | FROM ins_sample |
| | | WHERE id in(select id1 from (select is2.id id1 ,ip.id from ins_sample is2 left join ins_product ip on is2.id = ip.ins_sample_id where ip.id is not null)s ) |
| | | GROUP BY ins_order_id) sample_counts ON io.id = sample_counts.ins_order_id |
| | | LEFT JOIN |
| | | (SELECT ins_sample.ins_order_id, COUNT(*) AS total_count |
| | | FROM ins_product |
| | | JOIN ins_sample ON ins_product.ins_sample_id = ins_sample.id |
| | | WHERE ins_product.state = 1 |
| | | GROUP BY ins_sample.ins_order_id) total_product_counts ON io.id = total_product_counts.ins_order_id |
| | | LEFT JOIN |
| | | (SELECT ins_sample.ins_order_id, COUNT(*) AS approved_count |
| | | FROM ins_product |
| | | JOIN ins_sample ON ins_product.ins_sample_id = ins_sample.id |
| | | WHERE ins_product.state = 1 AND ins_product.ins_result IS NOT NULL |
| | | GROUP BY ins_sample.ins_order_id) approved_product_counts ON io.id = approved_product_counts.ins_order_id |
| | | LEFT JOIN (SELECT ins_sample_id, GROUP_CONCAT(DISTINCT uu.name SEPARATOR ',') AS testing_name |
| | | FROM ins_sample_user u |
| | | LEFT JOIN user uu ON u.user_id = uu.id |
| | | WHERE u.state = 0 |
| | | GROUP BY ins_sample_id |
| | | ORDER BY ins_sample_id) isu ON isu.ins_sample_id = io.id |
| | | where (io.ifs_inventory_id IS NULL OR TRIM(io.ifs_inventory_id) = '') |
| | | <if test="isOrderAll != null and isOrderAll != ''"> |
| | | AND io.state in (1, 4) |
| | | </if> |
| | | <if test="laboratory!=null and laboratory!=''"> |
| | | AND io.laboratory=#{laboratory} |
| | | </if> |
| | | GROUP BY io.id,type |
| | | order by type desc,io.id desc |
| | | ) a |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="selectInsOrderParameter" resultType="com.ruoyi.inspect.pojo.InsOrder"> |
| | | select * |
| | | from ( |
| | | select |
| | | id, |
| | | appointed, |
| | | user_id, |
| | | create_user, |
| | | otc_code, |
| | | code, |
| | | custom, |
| | | update_user, |
| | | update_time, |
| | | type, |
| | | entrust_code, |
| | | company, |
| | | remark, |
| | | create_time, |
| | | state |
| | | from ins_order |
| | | ) a |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | </select> |
| | | <select id="getLaboratoryCode" resultType="java.lang.String"> |
| | | select laboratory_number |
| | | from laboratory |
| | | where laboratory_name = #{name} |
| | | </select> |
| | | <select id="selectSampleAndProductByOrderId" resultType="com.ruoyi.inspect.dto.SampleProductDto2"> |
| | | select * |
| | | from ( |
| | | select |
| | | i.id, |
| | | isa.sample_code, |
| | | isa.sample, |
| | | isa.model, |
| | | isa.ins_state, |
| | | ip.id insProductId, |
| | | ip.state, |
| | | ip.unit, |
| | | ip.inspection_item, |
| | | ip.inspection_item_subclass, |
| | | ip.son_laboratory, |
| | | ip.inspection_item_type, |
| | | ip.inspection_value_type, |
| | | ip.tell, |
| | | ip.ask, |
| | | ip.`last_value`, |
| | | ip.ins_result, |
| | | ip.inspection_item_class, |
| | | i.ifs_inventory_id, |
| | | i.order_type, |
| | | ip.sort, |
| | | ip.cable_tag, |
| | | ip.radius |
| | | from ins_sample isa |
| | | left join ins_order i on isa.ins_order_id = i.id |
| | | left join ins_product ip on isa.id = ip.ins_sample_id |
| | | where ip.state = 1 |
| | | and i.id=#{id} |
| | | and ip.is_binding != 1 |
| | | ) a |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | </select> |
| | | <select id="selectCostStatistics" resultType="com.ruoyi.inspect.dto.CostStatisticsDto"> |
| | | select * from ( |
| | | SELECT A.id, |
| | | A.entrust_code, |
| | | A.create_time, |
| | | A.sample, |
| | | A.model, |
| | | A.inspection_item, |
| | | A.company, |
| | | A.`name`, |
| | | COUNT(1) num, |
| | | SUM(A.price) price, |
| | | SUM(A.cost) cost |
| | | FROM |
| | | (SELECT |
| | | i.id, |
| | | i.entrust_code, |
| | | i.create_time, |
| | | isa.sample, |
| | | isa.sample_code, |
| | | isa.model, |
| | | c.price, |
| | | c.cost, |
| | | c.inspection_item, |
| | | i.company, |
| | | u.`name`, |
| | | i.create_user, |
| | | c.ins_sample_id |
| | | FROM |
| | | ins_order i |
| | | LEFT JOIN ins_sample isa ON isa.ins_order_id = i.id |
| | | LEFT JOIN `user` u ON u.id = i.user_id |
| | | left join custom cus on cus.id = u.company |
| | | LEFT JOIN (select SUM(b.price) price, sum(b.man_hour) cost,b.ins_sample_id, |
| | | GROUP_CONCAT(b.inspection_item2 |
| | | SEPARATOR ',') |
| | | inspection_item from (select * , |
| | | GROUP_CONCAT(CONCAT(inspection_item,'@',inspection_item_subclass) SEPARATOR ',')inspection_item2 from ins_product where state = 1 and template_id IS NOT NULL GROUP BY ins_sample_id,man_hour_group) b GROUP |
| | | BY b.ins_sample_id) c ON c.ins_sample_id = isa.id |
| | | where (i.state = 1 or i.state = 3 or i.state = 4) and c.ins_sample_id IS not NULL)A |
| | | GROUP BY |
| | | A.id, |
| | | A.entrust_code, |
| | | A.create_time, |
| | | A.sample, |
| | | A.model, |
| | | A.inspection_item, |
| | | A.company, |
| | | A.`name` |
| | | ) B |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | </select> |
| | | <select id="selectDeviceList" resultType="java.util.Map"> |
| | | select device_name, |
| | | en_device_name, |
| | | specification_model, |
| | | management_number, |
| | | date_format(activation_date,'%Y-%m-%d') |
| | | latest_traceability |
| | | from device |
| | | where device.management_number in |
| | | <foreach collection="names" index="index" open="(" separator="," close=")" item="val"> |
| | | #{val} |
| | | </foreach> |
| | | </select> |
| | | |
| | | <update id="updateStatus"> |
| | | update ins_order |
| | | set state=3 |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | <select id="selectSampleDefects" resultMap="selectSampleDefectsMap"> |
| | | SELECT io.entrust_code,sam.sample,ip.inspection_item,u.name,b.create_time, sam.id |
| | | from ins_order io |
| | | left JOIN ins_sample sam on io.id=sam.ins_order_id |
| | | LEFT JOIN ins_product ip on ip.ins_sample_id=sam.id |
| | | LEFT JOIN |
| | | (SELECT create_time,create_user,ins_product_id FROM |
| | | (select * FROM ins_product_user ORDER BY ins_product_user.create_time DESC) a |
| | | GROUP BY a.ins_product_id) b |
| | | on b.ins_product_id=ip.id |
| | | left JOIN `user` u on u.id=b.create_user |
| | | WHERE (ip.ins_result=0 OR ip.state=0) |
| | | <if test="inspectionItems != null and inspectionItems != ''"> |
| | | and inspection_item like concat('%', #{inspectionItems}, '%') |
| | | </if> |
| | | <if test="orderNumber != null and orderNumber != ''"> |
| | | and io.entrust_code like concat('%', #{orderNumber}, '%') |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="getCount" resultType="long"> |
| | | select count(1) |
| | | from ( |
| | | SELECT io.entrust_code,sam.sample,ip.inspection_item,u.name,b.create_time, sam.id |
| | | from ins_order io |
| | | left JOIN ins_sample sam on io.id=sam.ins_order_id |
| | | LEFT JOIN ins_product ip on ip.ins_sample_id=sam.id |
| | | LEFT JOIN |
| | | (SELECT create_time,create_user,ins_product_id FROM (select * FROM ins_product_user ORDER BY |
| | | ins_product_user.create_time DESC) a GROUP BY a.ins_product_id) b |
| | | on b.ins_product_id=ip.id |
| | | left JOIN `user` u on u.id=b.create_user |
| | | where (ip.ins_result=0 OR ip.state=0) |
| | | <if test="inspectionItems != null and inspectionItems != ''"> |
| | | and inspection_item like concat('%', #{inspectionItems}, '%') |
| | | </if> |
| | | <if test="orderNumber != null and orderNumber != ''"> |
| | | and io.entrust_code like concat('%', #{orderNumber}, '%') |
| | | </if> |
| | | ) temp |
| | | </select> |
| | | |
| | | <select id="getStandardMethodCode" resultType="java.lang.String"> |
| | | select code |
| | | from standard_method |
| | | where id = #{id} |
| | | </select> |
| | | <select id="selLaboratoryCode" resultType="java.lang.String"> |
| | | select laboratory_code |
| | | from laboratory |
| | | where laboratory_name = #{laboratory} |
| | | </select> |
| | | <select id="selectReportModelByOrderId" resultType="java.util.Map"> |
| | | select distinct id, name |
| | | from standard_template |
| | | where id in (select template_id |
| | | from ins_product |
| | | where son_laboratory = #{laboratory} |
| | | and ins_sample_id in |
| | | (select id from ins_sample where ins_order_id = #{id})) |
| | | </select> |
| | | |
| | | <select id="selectCostStatistics2" resultType="com.ruoyi.inspect.dto.CostStatisticsDto"> |
| | | select * from ( |
| | | SELECT A.id, |
| | | A.entrust_code, |
| | | A.create_time, |
| | | A.sample, |
| | | A.model, |
| | | A.inspection_item, |
| | | A.company, |
| | | A.`name`, |
| | | production, |
| | | engineering, |
| | | COUNT(1) num, |
| | | SUM(A.price) price, |
| | | SUM(A.cost) cost |
| | | FROM |
| | | (SELECT |
| | | i.id, |
| | | i.entrust_code, |
| | | i.create_time, |
| | | isa.sample, |
| | | isa.sample_code, |
| | | isa.model, |
| | | c.price, |
| | | c.cost, |
| | | c.inspection_item, |
| | | i.company, |
| | | u.`name`, |
| | | i.create_user, |
| | | c.ins_sample_id, |
| | | production, |
| | | engineering |
| | | FROM |
| | | ins_order i |
| | | LEFT JOIN ins_sample isa ON isa.ins_order_id = i.id |
| | | LEFT JOIN `user` u ON u.id = i.user_id |
| | | left join custom cus on cus.id = u.company |
| | | LEFT JOIN (select SUM(b.price) price, sum(b.man_hour) cost,b.ins_sample_id, |
| | | GROUP_CONCAT(b.inspection_item2 |
| | | SEPARATOR ',') |
| | | inspection_item from (select * , |
| | | GROUP_CONCAT(CONCAT(inspection_item,'@',inspection_item_subclass) SEPARATOR ',')inspection_item2 from ins_product where state = 1 and template_id IS NOT NULL GROUP BY ins_sample_id,man_hour_group) b GROUP |
| | | BY b.ins_sample_id) c ON c.ins_sample_id = isa.id |
| | | where (i.state = 1 or i.state = 3 or i.state = 4) and c.ins_sample_id IS not NULL)A |
| | | GROUP BY |
| | | A.id, |
| | | A.entrust_code, |
| | | A.create_time, |
| | | A.sample, |
| | | A.model, |
| | | A.inspection_item, |
| | | A.company, |
| | | A.`name`, |
| | | production, |
| | | engineering |
| | | ORDER BY |
| | | A.id, |
| | | A.entrust_code, |
| | | A.create_time, |
| | | A.sample, |
| | | A.model, |
| | | A.inspection_item, |
| | | A.company, |
| | | A.`name`, |
| | | production, |
| | | engineering) B |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="seldepLimsId" resultType="java.lang.String"> |
| | | select name |
| | | from department_lims |
| | | where id = #{depLimsId} |
| | | </select> |
| | | <select id="selectSampleBySampleId" resultType="com.ruoyi.inspect.dto.SampleProductExportDto"> |
| | | select <include refid="selectSampleProductDto2"/> |
| | | from ins_sample isa |
| | | left join ins_order i on isa.ins_order_id = i.id |
| | | left join ins_product ip on isa.id = ip.ins_sample_id |
| | | where ip.state = 1 |
| | | and ip.is_binding != 1 |
| | | and isa.id in |
| | | <foreach collection="ids" index="index" open="(" separator="," close=")" item="val"> |
| | | #{val} |
| | | </foreach> |
| | | order by ip.sort asc |
| | | </select> |
| | | <select id="selectSampleMax" resultType="java.lang.Integer"> |
| | | SELECT COUNT(*) |
| | | FROM ins_sample isa |
| | | LEFT JOIN ins_order i ON isa.ins_order_id = i.id |
| | | LEFT JOIN ins_product ip ON isa.id = ip.ins_sample_id |
| | | WHERE ip.state = 1 |
| | | AND isa.id = #{id} |
| | | GROUP BY ip.inspection_item, |
| | | ip.inspection_item_subclass, |
| | | ip.inspection_item_class |
| | | ORDER BY COUNT(*) DESC |
| | | LIMIT 1; |
| | | </select> |
| | | <select id="selectSampleCableTag" resultType="java.lang.String"> |
| | | SELECT ip.cable_tag |
| | | FROM ins_sample isa |
| | | LEFT JOIN ins_order i ON isa.ins_order_id = i.id |
| | | LEFT JOIN ins_product ip ON isa.id = ip.ins_sample_id |
| | | WHERE ip.state = 1 |
| | | AND isa.id = #{id} |
| | | and ip.cable_tag is not null |
| | | GROUP BY ip.cable_tag |
| | | order by ip.cable_tag |
| | | </select> |
| | | <select id="selectSampleItemS" resultType="java.lang.Integer"> |
| | | select count(*) |
| | | from (select distinct ip.inspection_item |
| | | from ins_sample isa |
| | | left join ins_order i on isa.ins_order_id = i.id |
| | | left join ins_product ip on isa.id = ip.ins_sample_id |
| | | where ip.state = 1 |
| | | and i.id = #{id}) a |
| | | </select> |
| | | <select id="selectSampleBySampleIdOne" resultType="com.ruoyi.inspect.dto.SampleProductExportDto"> |
| | | select <include refid="selectSampleProductDto2"/> |
| | | from ins_sample isa |
| | | left join ins_order i on isa.ins_order_id = i.id |
| | | left join ins_product ip on isa.id = ip.ins_sample_id |
| | | where ip.state = 1 |
| | | and isa.id = #{id} |
| | | and ip.raw_material_tag = 1 |
| | | order by ip.sort asc |
| | | </select> |
| | | <select id="selectCalendarWorkByWeek" resultType="java.util.Map"> |
| | | select io2.entrust_code text, |
| | | io2.type type, |
| | | ios.ins_state insState, |
| | | u.name name |
| | | from ins_order io2 |
| | | left join ins_order_state ios on ios.ins_order_id = io2.id |
| | | left join user u on u.id = io2.create_user |
| | | where DATE(io2.create_time) = CURDATE() - INTERVAL #{day} DAY |
| | | </select> |
| | | <select id="selectProductByPartNo" resultType="com.ruoyi.basic.pojo.StructureTestObject"> |
| | | select sto.id, |
| | | object_type |
| | | from product_part pp |
| | | left join product p on p.id = pp.product_id |
| | | left join structure_test_object sto on sto.id = p.object_id |
| | | where pp.part_no = #{partNo} |
| | | </select> |
| | | <select id="selectByPartNo" resultType="com.ruoyi.basic.pojo.StructureTestObject"> |
| | | select sto.id, |
| | | object_type |
| | | from structure_test_object_part stop |
| | | left join structure_test_object sto on sto.id = stop.test_object_id |
| | | where stop.part_no = #{partNo} |
| | | </select> |
| | | |
| | | <!-- æåæ ç¾æå° --> |
| | | <select id="labelOrderPrinting" resultType="com.ruoyi.inspect.vo.InsOrderPrintingVo"> |
| | | select * |
| | | from (select io2.id insOrderId, |
| | | io2.sample_view, |
| | | io2.production, |
| | | io2.send_time, |
| | | GROUP_CONCAT(DISTINCT isa.model SEPARATOR ' ') AS sample_model, |
| | | io2.prepare_user, |
| | | io2.entrust_code, |
| | | io2.test_quantity, |
| | | io2.ins_state, |
| | | JSON_OBJECT( |
| | | 'sample_name', io2.sample_view, |
| | | 'entrust_code', io2.entrust_code |
| | | ) labelBarCode |
| | | from ins_order io2 |
| | | LEFT JOIN ins_sample isa ON io2.id = isa.ins_order_id |
| | | where type_source = 0 |
| | | GROUP BY io2.id) a |
| | | where insOrderId in |
| | | <foreach collection="ids" index="index" open="(" separator="," close=")" item="val"> |
| | | #{val} |
| | | </foreach> |
| | | </select> |
| | | |
| | | <!-- æ¥è¯¢æ£éªåæ°æ® --> |
| | | <select id="rawAllInsOrderExport" resultType="com.ruoyi.inspect.dto.SampleOrderDto"> |
| | | select * |
| | | from ( |
| | | SELECT |
| | | io.*, |
| | | isau.user_id assign, |
| | | ir.id report_id, |
| | | ir.url, |
| | | ir.url_s, |
| | | sample_counts.sample_num, |
| | | CONCAT(ROUND(approved_product_counts.approved_count / total_product_counts.total_count * 100, 2), '%') AS insProgress, |
| | | io.sample_view AS sample_name, |
| | | GROUP_CONCAT(DISTINCT isa.model SEPARATOR ' ') AS sample_model, |
| | | u.name, |
| | | testing_name, |
| | | case when io.type = 0 then 'æ®é' |
| | | when io.type = 1 then 'ä¼å
' |
| | | when io.type = 2 then 'ç´§æ¥' |
| | | end typeString, |
| | | case when io.ins_result = 1 then 'åæ ¼' |
| | | when io.ins_result = 0 then 'ä¸åæ ¼' |
| | | else 'å¾
æ£éª' end insResultString |
| | | FROM |
| | | ins_order io |
| | | LEFT JOIN |
| | | ins_sample isa ON io.id = isa.ins_order_id |
| | | LEFT JOIN |
| | | ins_sample_user isau ON isau.ins_sample_id = io.id |
| | | LEFT JOIN |
| | | (SELECT id, ins_order_id, is_ratify, url, url_s FROM ins_report WHERE is_ratify = 1) ir ON io.id = ir.ins_order_id |
| | | LEFT JOIN |
| | | user u ON io.create_user = u.id |
| | | LEFT JOIN |
| | | (SELECT ins_order_id, COUNT(*) AS sample_num |
| | | FROM ins_sample |
| | | WHERE id in(select id1 from (select is2.id id1 ,ip.id from ins_sample is2 left join ins_product ip on is2.id = ip.ins_sample_id where ip.id is not null)s ) |
| | | GROUP BY ins_order_id) sample_counts ON io.id = sample_counts.ins_order_id |
| | | LEFT JOIN |
| | | (SELECT ins_sample.ins_order_id, COUNT(*) AS total_count |
| | | FROM ins_product |
| | | JOIN ins_sample ON ins_product.ins_sample_id = ins_sample.id |
| | | WHERE ins_product.state = 1 |
| | | GROUP BY ins_sample.ins_order_id) total_product_counts ON io.id = total_product_counts.ins_order_id |
| | | LEFT JOIN |
| | | (SELECT ins_sample.ins_order_id, COUNT(*) AS approved_count |
| | | FROM ins_product |
| | | JOIN ins_sample ON ins_product.ins_sample_id = ins_sample.id |
| | | WHERE ins_product.state = 1 AND ins_product.ins_result IS NOT NULL |
| | | GROUP BY ins_sample.ins_order_id) approved_product_counts ON io.id = approved_product_counts.ins_order_id |
| | | LEFT JOIN (SELECT ins_sample_id, GROUP_CONCAT(DISTINCT uu.name SEPARATOR ',') AS testing_name |
| | | FROM ins_sample_user u |
| | | LEFT JOIN user uu ON u.user_id = uu.id |
| | | WHERE u.state = 0 |
| | | GROUP BY ins_sample_id |
| | | ORDER BY ins_sample_id) isu ON isu.ins_sample_id = io.id |
| | | where (io.ifs_inventory_id IS NULL OR TRIM(io.ifs_inventory_id) = '') |
| | | <if test="isOrderAll != null and isOrderAll != ''"> |
| | | AND io.state in (1, 4) |
| | | </if> |
| | | <if test="laboratory!=null and laboratory!=''"> |
| | | AND io.laboratory=#{laboratory} |
| | | </if> |
| | | GROUP BY io.id,type |
| | | order by type desc,io.id desc |
| | | ) a |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | </select> |
| | | |
| | | <!-- æ ¹æ®è®¢åæ¥è¯¢è¯éªå®¤ --> |
| | | <select id="selectLaboratoryByOrderId" resultType="java.lang.String"> |
| | | select ip.son_laboratory |
| | | from ins_product ip |
| | | left join ins_sample is2 on is2.id = ip.ins_sample_id |
| | | where is2.ins_order_id = #{insOrderId} |
| | | limit 1 |
| | | </select> |
| | | |
| | | <select id="selectFirstSubmit" resultType="com.ruoyi.inspect.pojo.InsOrder"> |
| | | select io.id, |
| | | io.is_first_submit |
| | | from ins_order io |
| | | left join ins_sample is2 on is2.ins_order_id = io.id |
| | | where is2.id = #{insSampleId} |
| | | </select> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
| | | <mapper namespace="com.ruoyi.inspect.mapper.InsOrderStateMapper"> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
| | | <mapper namespace="com.ruoyi.inspect.mapper.InsOrderTemplateMapper"> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.inspect.mapper.InsProductMapper"> |
| | | |
| | | <update id="updateInspected"> |
| | | UPDATE ins_product p |
| | | SET p.state=0 |
| | | WHERE EXISTS( |
| | | SELECT 1 |
| | | FROM ins_sample s |
| | | WHERE s.ins_order_id IN ( |
| | | SELECT o.id |
| | | FROM ins_order o |
| | | WHERE o.id = #{id} |
| | | ) |
| | | AND p.ins_sample_id = s.id |
| | | AND p.state = 1 |
| | | AND p.ins_result IS NULL |
| | | ); |
| | | </update> |
| | | |
| | | <select id="selectOrderManDay" resultType="java.lang.Integer"> |
| | | select coalesce(max(ip.man_day), 0) |
| | | from ins_order io |
| | | left join ins_sample isa on io.id = isa.ins_order_id |
| | | left join ins_product ip on isa.id = ip.ins_sample_id |
| | | where io.id = #{orderId} |
| | | </select> |
| | | <select id="selectUserById" resultType="java.util.Map"> |
| | | select account, name, company, phone, name_en |
| | | from user |
| | | where id = #{userId} |
| | | </select> |
| | | <select id="getProductAndResult" resultType="com.ruoyi.inspect.dto.ProductResultDto2"> |
| | | select ip.id, |
| | | ip.inspection_item, |
| | | ip.inspection_item_subclass, |
| | | ip.laboratory, |
| | | ip.unit, |
| | | ipr.equip_name equipValue, |
| | | io.entrust_code, |
| | | ipr.update_time, |
| | | ip.ins_result, |
| | | u.name updateUserName |
| | | from ins_product ip |
| | | left join ins_product_result ipr on ip.id = ipr.ins_product_id |
| | | left join ins_sample isa on isa.id = ip.ins_sample_id |
| | | left join ins_order io on io.id = isa.ins_order_id |
| | | left join user u on u.id = ipr.update_user |
| | | where ip.ins_sample_id = #{sampleId} |
| | | and ip.ins_result is not null |
| | | and template_id is not null |
| | | </select> |
| | | <select id="selectFiberInsProduct" resultType="com.ruoyi.inspect.pojo.InsProduct"> |
| | | select * from ins_product |
| | | where state = 1 |
| | | and is_binding != 1 |
| | | and (ins_fibers_id is not null or ins_fiber_id is not null) |
| | | and ins_result is null |
| | | and son_laboratory = #{laboratory} |
| | | and ins_sample_id in |
| | | <foreach collection="ids" index="index" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </select> |
| | | <select id="selectNoProducts" resultType="com.ruoyi.inspect.pojo.InsProduct"> |
| | | select * |
| | | from (select ip.*, sample_code |
| | | from ins_product ip |
| | | left join ins_sample is2 on ip.ins_sample_id = is2.id |
| | | where state = 1 |
| | | and is2.ins_order_id = #{orderId} |
| | | <if test="noIds != null and noIds.size() > 0"> |
| | | and ip.id in |
| | | <foreach collection="noIds" index="index" open="(" separator="," close=")" item="val"> |
| | | #{val} |
| | | </foreach> |
| | | </if> |
| | | ) A |
| | | </select> |
| | | <select id="selectInsProductCountByOrderId" resultType="java.lang.Integer"> |
| | | select COUNT(1) |
| | | from ins_product ip |
| | | left join ins_sample isa on ip.ins_sample_id = isa.id |
| | | left join ins_order io on isa.ins_order_id = io.id |
| | | where io.id = #{orderId} |
| | | and (ip.ins_result is null or ip.ins_result = 2) |
| | | and ip.state = 1 |
| | | </select> |
| | | <select id="selectListBySampleIds" resultType="com.ruoyi.inspect.dto.SampleProductRawAnalysisDto"> |
| | | select ins.id ins_sample_id, |
| | | ins.sample_code, |
| | | ip.id ins_product_id, |
| | | concat(ip.inspection_item, ip.inspection_item_subclass) inspection_item, |
| | | ip.`last_value`, |
| | | iiq.update_batch_no, |
| | | iiq.supplier_name, |
| | | ins.sample, |
| | | ip.ins_result |
| | | from ins_product ip |
| | | left join ins_sample ins on ins.id = ip.ins_sample_id |
| | | left join ins_order io1 on io1.id = ins.ins_order_id |
| | | left join ifs_inventory_quantity iiq on iiq.id = io1.ifs_inventory_id |
| | | where ip.inspection_value_type = 1 |
| | | and ip.ins_sample_id in |
| | | <foreach collection="sampleIds" index="index" open="(" separator="," close=")" item="val"> |
| | | #{val} |
| | | </foreach> |
| | | </select> |
| | | <select id="selectItemNameBySampleIds" resultType="java.lang.String"> |
| | | select concat(ip.inspection_item, ip.inspection_item_subclass) |
| | | from ins_product ip |
| | | left join ins_sample ins on ins.id = ip.ins_sample_id |
| | | where ip.inspection_value_type = 1 |
| | | and ip.ins_sample_id in |
| | | <foreach collection="sampleIds" index="index" open="(" separator="," close=")" item="val"> |
| | | #{val} |
| | | </foreach> |
| | | |
| | | group by concat(ip.inspection_item, ip.inspection_item_subclass) |
| | | </select> |
| | | <select id="selectUnqualifiedList" resultType="java.lang.String"> |
| | | select distinct concat(ip.inspection_item_class, ip.inspection_item, ip.inspection_item_subclass) |
| | | from ins_product ip |
| | | left join ins_sample is2 on is2.id = ip.ins_sample_id |
| | | left join ins_order io2 on io2.id = is2.ins_order_id |
| | | where io2.id = #{orderId} |
| | | </select> |
| | | |
| | | <!--æ¥è¯¢å¤ææ¯å¦æä¸å¤å®é¡¹ç®,åå
¨é½æ¯å¤å®é¡¹--> |
| | | <select id="selectNoJudge" resultType="java.lang.Integer"> |
| | | select CASE |
| | | WHEN SUM(CASE WHEN ip.ins_result = 3 THEN 1 ELSE 0 END) = COUNT(*) THEN 3 |
| | | WHEN SUM(CASE WHEN ip.ins_result = 3 THEN 1 ELSE 0 END) > 0 THEN 2 |
| | | ELSE 1 END AS result_flag |
| | | from ins_product ip |
| | | left join ins_sample is2 on is2.id = ip.ins_sample_id |
| | | left join ins_order io2 on io2.id = is2.ins_order_id |
| | | where io2.id = #{orderId} |
| | | and ip.is_binding != 1 |
| | | </select> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
| | | <mapper namespace="com.ruoyi.inspect.mapper.InsProductUserMapper"> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.inspect.mapper.InsReportMapper"> |
| | | |
| | | <select id="pageInsReport" resultType="com.ruoyi.inspect.dto.ReportPageDto"> |
| | | select * |
| | | from ( |
| | | select |
| | | ir.*, |
| | | io.entrust_code, |
| | | u.name write_user_name, |
| | | u1.name ratify_user, |
| | | u2.name examine_user, |
| | | io.type_source, |
| | | io.order_type, |
| | | io.laboratory, |
| | | io.ifs_inventory_id, |
| | | iiq.is_copper, |
| | | ip.son_laboratory |
| | | from ins_report ir |
| | | left join ins_order io on io.id = ir.ins_order_id |
| | | LEFT JOIN ifs_inventory_quantity iiq ON iiq.id = io.ifs_inventory_id |
| | | left join user u on u.id = ir.write_user_id |
| | | left join user u1 on u1.id = ir.ratify_user_id |
| | | left join user u2 on u2.id = ir.examine_user_id |
| | | left join ins_sample is2 on is2.ins_order_id = io.id |
| | | left join ins_product ip on ip.ins_sample_id = is2.id |
| | | where 1=1 |
| | | and ir.is_pass = 1 |
| | | <if test="createOrderUser != null and createOrderUser != ''"> |
| | | and (ir.write_user_id = #{createOrderUser} or ir.examine_user_id = #{createOrderUser} or ir.ratify_user_id = #{createOrderUser}) |
| | | </if> |
| | | <if test="laboratory!=null and laboratory!=''"> |
| | | and laboratory=#{laboratory} |
| | | </if> |
| | | <if test="queryStatus != null and queryStatus != ''"> |
| | | <!-- å¾
æäº¤--> |
| | | <if test='queryStatus == 0'> |
| | | and ir.state = 0 |
| | | </if> |
| | | <!-- å¾
审æ¹--> |
| | | <if test='queryStatus == 1'> |
| | | and ir.state = 1 and (ir.is_examine != 1 or ir.is_examine is null) |
| | | </if> |
| | | <!-- å¾
æ¹å--> |
| | | <if test='queryStatus == 2'> |
| | | and ir.state = 1 and ir.is_examine = 1 and (ir.is_ratify != 1 or ir.is_ratify is null) |
| | | </if> |
| | | </if> |
| | | group by ir.id |
| | | ) a |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | </select> |
| | | <select id="getLaboratoryByName" resultType="java.lang.String"> |
| | | select s.address from seal s |
| | | left join laboratory l on s.lab_id = l.id |
| | | where l.laboratory_name = #{name} |
| | | and s.type = #{type} |
| | | order by s.create_time desc |
| | | limit 1 |
| | | </select> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.inspect.mapper.InsSampleMapper"> |
| | | |
| | | <resultMap id="sampleDto" type="com.ruoyi.inspect.dto.SampleProductDto"> |
| | | <id property="id" column="id" jdbcType="INTEGER"/> |
| | | <result property="insResult" column="ins_result" jdbcType="INTEGER"/> |
| | | <result property="insOrderId" column="ins_order_id" jdbcType="INTEGER"/> |
| | | <result property="joinModel" column="join_model" jdbcType="VARCHAR"/> |
| | | <result property="joinName" column="join_name" jdbcType="VARCHAR"/> |
| | | <result property="sampleCode" column="sample_code" jdbcType="VARCHAR"/> |
| | | <result property="factory" column="factory" jdbcType="VARCHAR"/> |
| | | <result property="laboratory" column="laboratory" jdbcType="VARCHAR"/> |
| | | <result property="sampleType" column="sample_type" jdbcType="VARCHAR"/> |
| | | <result property="sample" column="sample" jdbcType="VARCHAR"/> |
| | | <result property="model" column="model" jdbcType="VARCHAR"/> |
| | | <result property="insState" column="ins_state" jdbcType="INTEGER"/> |
| | | <result property="joinNum" column="join_num" jdbcType="INTEGER"/> |
| | | <result property="remark" column="remark" jdbcType="VARCHAR"/> |
| | | <result property="createUser" column="create_user" jdbcType="INTEGER"/> |
| | | <result property="updateUser" column="update_user" jdbcType="INTEGER"/> |
| | | <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> |
| | | <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> |
| | | <result property="standardMethodListId" column="standard_method_list_id"/> |
| | | <result property="unit" column="unit"/> |
| | | <result property="quantity" column="quantity"/> |
| | | <result property="specialStandardMethod" column="special_standard_method"/> |
| | | <collection property="insProduct" resultMap="product"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="product" type="com.ruoyi.inspect.pojo.InsProduct"> |
| | | <id property="id" column="ip_id" jdbcType="INTEGER"/> |
| | | <result property="inspectionItem" column="inspection_item" jdbcType="VARCHAR"/> |
| | | <result property="inspectionItemEn" column="inspection_item_en" jdbcType="VARCHAR"/> |
| | | <result property="inspectionItemSubclass" column="inspection_item_subclass" jdbcType="VARCHAR"/> |
| | | <result property="inspectionItemSubclassEn" column="inspection_item_subclass_en" jdbcType="VARCHAR"/> |
| | | <result property="inspectionItemClass" column="inspection_item_class" jdbcType="VARCHAR"/> |
| | | <result property="inspectionItemClassEn" column="inspection_item_class_en" jdbcType="VARCHAR"/> |
| | | <result property="factory" column="ip_factory" jdbcType="VARCHAR"/> |
| | | <result property="laboratory" column="ip_laboratory" jdbcType="VARCHAR"/> |
| | | <result property="sampleType" column="ip_sample_type" jdbcType="VARCHAR"/> |
| | | <result property="sample" column="ip_sample" jdbcType="VARCHAR"/> |
| | | <result property="model" column="ip_model" jdbcType="VARCHAR"/> |
| | | <result property="sonLaboratory" column="son_laboratory" jdbcType="VARCHAR"/> |
| | | <result property="unit" column="ip_unit" jdbcType="VARCHAR"/> |
| | | <result property="price" column="price" jdbcType="DECIMAL"/> |
| | | <result property="manHour" column="man_hour" jdbcType="DOUBLE"/> |
| | | <result property="manHourGroup" column="man_hour_group" jdbcType="VARCHAR"/> |
| | | <result property="inspectionItemType" column="inspection_item_type" jdbcType="VARCHAR"/> |
| | | <result property="inspectionValueType" column="inspection_value_type" jdbcType="VARCHAR"/> |
| | | <result property="deviceGroup" column="device_group" jdbcType="VARCHAR"/> |
| | | <result property="checkoutNumber" column="checkout_number" jdbcType="INTEGER"/> |
| | | <result property="section" column="section" jdbcType="VARCHAR"/> |
| | | <result property="valueType" column="value_type" jdbcType="VARCHAR"/> |
| | | <result property="method" column="method" jdbcType="VARCHAR"/> |
| | | <result property="manDay" column="man_day" jdbcType="INTEGER"/> |
| | | <result property="bsm" column="bsm" jdbcType="VARCHAR"/> |
| | | <result property="ask" column="ask" jdbcType="VARCHAR"/> |
| | | <result property="tell" column="tell" jdbcType="VARCHAR"/> |
| | | <result property="lastValue" column="last_value" jdbcType="VARCHAR"/> |
| | | <result property="insResult" column="ip_ins_result" jdbcType="INTEGER"/> |
| | | <result property="state" column="state" jdbcType="INTEGER"/> |
| | | <result property="insBushId" column="ins_bush_id" jdbcType="INTEGER"/> |
| | | <result property="insSampleId" column="ins_sample_id" jdbcType="INTEGER"/> |
| | | <result property="createUser" column="ip_create_user" jdbcType="INTEGER"/> |
| | | <result property="updateUser" column="ip_update_user" jdbcType="INTEGER"/> |
| | | <result property="createTime" column="ip_create_time" jdbcType="TIMESTAMP"/> |
| | | <result property="updateTime" column="ip_update_time" jdbcType="TIMESTAMP"/> |
| | | <result property="templateId" column="template_id" jdbcType="INTEGER"/> |
| | | <result property="methodS" column="method_s"/> |
| | | <result property="tell" column="tell"/> |
| | | <result property="dic" column="dic"/> |
| | | <result property="sort" column="sort"/> |
| | | <result property="temperature" column="temperature"/> |
| | | <result property="humidity" column="humidity"/> |
| | | <result property="radius" column="radius"/> |
| | | <result property="cableTag" column="cable_tag"/> |
| | | <result property="structureItemParameterId" column="structure_item_parameter_id"/> |
| | | <collection property="insProductResult" resultMap="insProductResult"/> |
| | | </resultMap> |
| | | |
| | | |
| | | <resultMap id="insProductResult" type="com.ruoyi.inspect.pojo.InsProductResult"> |
| | | <result property="insValue" column="ins_value" jdbcType="VARCHAR"/> |
| | | <result property="comValue" column="com_value" jdbcType="VARCHAR"/> |
| | | <result property="equipValue" column="equip_value" jdbcType="VARCHAR"/> |
| | | <result property="equipName" column="equip_name" jdbcType="VARBINARY"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="sampleVo" type="com.ruoyi.inspect.vo.SampleVo"> |
| | | <id property="id" column="id" jdbcType="INTEGER"/> |
| | | <result property="insResult" column="ins_result" jdbcType="INTEGER"/> |
| | | <result property="insOrderId" column="ins_order_id" jdbcType="INTEGER"/> |
| | | <result property="joinModel" column="join_model" jdbcType="VARCHAR"/> |
| | | <result property="joinName" column="join_name" jdbcType="VARCHAR"/> |
| | | <result property="sampleCode" column="sample_code" jdbcType="VARCHAR"/> |
| | | <result property="factory" column="factory" jdbcType="VARCHAR"/> |
| | | <result property="laboratory" column="laboratory" jdbcType="VARCHAR"/> |
| | | <result property="sampleType" column="sample_type" jdbcType="VARCHAR"/> |
| | | <result property="sample" column="sample" jdbcType="VARCHAR"/> |
| | | <result property="model" column="model" jdbcType="VARCHAR"/> |
| | | <result property="insState" column="ins_state" jdbcType="INTEGER"/> |
| | | <result property="joinNum" column="join_num" jdbcType="INTEGER"/> |
| | | <result property="remark" column="remark" jdbcType="VARCHAR"/> |
| | | <result property="createUser" column="create_user" jdbcType="INTEGER"/> |
| | | <result property="updateUser" column="update_user" jdbcType="INTEGER"/> |
| | | <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> |
| | | <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> |
| | | <result property="standardMethodListId" column="standard_method_list_id"/> |
| | | <result property="methodName" column="methodName" jdbcType="VARCHAR"/> |
| | | <result property="unit" column="unit"/> |
| | | </resultMap> |
| | | |
| | | <sql id="getInsProducSql"> |
| | | ip.id ip_id, |
| | | inspection_item, |
| | | inspection_item_en, |
| | | inspection_item_class, |
| | | inspection_item_class_en, |
| | | inspection_item_subclass, |
| | | inspection_item_subclass_en, |
| | | ip.factory ip_factory, |
| | | ip.laboratory ip_laboratory, |
| | | ip.sample_type ip_sample_type, |
| | | ip.sample ip_sample, |
| | | ip.model ip_model, |
| | | son_laboratory, |
| | | ip.unit ip_unit, |
| | | price, |
| | | man_hour, |
| | | man_hour_group, |
| | | inspection_item_type, |
| | | inspection_value_type, |
| | | device_group, |
| | | checkout_number, |
| | | section, |
| | | value_type, |
| | | method, |
| | | man_day, |
| | | bsm, |
| | | ask, |
| | | `last_value`, |
| | | ip.ins_result ip_ins_result, |
| | | state, |
| | | ins_sample_id, |
| | | ip.create_user ip_create_user, |
| | | ip.update_user ip_update_user, |
| | | ip.create_time ip_create_time, |
| | | ip.update_time ip_update_time, |
| | | template_id, |
| | | ipr.ins_value, |
| | | ipr.com_value, |
| | | ipr.equip_value, |
| | | ipr.equip_name, |
| | | ip.method_s, |
| | | ip.tell, |
| | | ip.dic, |
| | | ip.sort, |
| | | ip.cable_tag, |
| | | ip.structure_item_parameter_id |
| | | </sql> |
| | | |
| | | |
| | | <select id="findInsSampleAndOrder" resultType="com.ruoyi.inspect.vo.InsOrderPlanVO"> |
| | | select * from(select * from( |
| | | SELECT |
| | | a.*,ios.ins_state,ios.verify_tell,verify_user |
| | | FROM |
| | | ( |
| | | SELECT |
| | | io.id, |
| | | io.entrust_code, |
| | | io.type, |
| | | io.appointed, |
| | | io.send_time, |
| | | io.order_type, |
| | | case when |
| | | io.type_source = 0 |
| | | then io.sample_view |
| | | else io.sample end sample, |
| | | GROUP_CONCAT(DISTINCT isa.model SEPARATOR ' ') AS sample_model, |
| | | userName, |
| | | checkName, |
| | | ip.son_laboratory, |
| | | io.ins_time, |
| | | io.laboratory, |
| | | io.type_source, |
| | | io.ifs_inventory_id, |
| | | ira.id ins_report_id, |
| | | ira.url, |
| | | ira.url_s, |
| | | ira.temp_url_pdf, |
| | | iiq.is_copper |
| | | FROM |
| | | ins_order io |
| | | LEFT JOIN ins_sample isa ON isa.ins_order_id = io.id |
| | | LEFT JOIN ins_report ira ON ira.ins_order_id = io.id |
| | | LEFT JOIN ifs_inventory_quantity iiq ON iiq.id = io.ifs_inventory_id |
| | | LEFT JOIN ( |
| | | SELECT ins_sample_id,GROUP_CONCAT( DISTINCT uu.name SEPARATOR ',') AS userName |
| | | FROM ins_sample_user u LEFT JOIN user uu ON u.user_id = uu.id |
| | | WHERE u.state=0 |
| | | <if test="sonLaboratory!= null and sonLaboratory != ''"> |
| | | and son_laboratory=#{sonLaboratory} |
| | | </if> |
| | | GROUP BY ins_sample_id |
| | | ORDER BY ins_sample_id |
| | | ) isu ON isu.ins_sample_id = io.id |
| | | LEFT JOIN ( |
| | | SELECT ins_sample_id,uu.name checkName |
| | | FROM ins_sample_user u LEFT JOIN user uu ON u.user_id = uu.id |
| | | WHERE u.state=1 |
| | | <if test="sonLaboratory!= null and sonLaboratory != ''"> |
| | | and son_laboratory=#{sonLaboratory} |
| | | </if> |
| | | GROUP BY ins_sample_id |
| | | ORDER BY ins_sample_id |
| | | )isu2 ON isu2.ins_sample_id = io.id |
| | | LEFT JOIN ins_product ip ON ip.ins_sample_id = isa.id |
| | | WHERE io.state = 1 and send_time is not null |
| | | <if test="isCheck != null"> |
| | | <if test="userName !=null and userName!=''"> |
| | | and checkName like CONCAT ('%', #{userName},'%') |
| | | </if> |
| | | </if> |
| | | <if test="isCheck == null"> |
| | | <if test="userName !=null and userName!=''"> |
| | | and userName like CONCAT ('%', #{userName},'%') |
| | | </if> |
| | | </if> |
| | | <if test="sonLaboratory!= null and sonLaboratory != ''"> |
| | | and ip.son_laboratory = #{sonLaboratory} |
| | | </if> |
| | | GROUP BY |
| | | ip.son_laboratory, |
| | | io.id |
| | | ) a |
| | | LEFT JOIN ins_order_state ios ON ios.ins_order_id = a.id AND ios.laboratory = a.son_laboratory |
| | | ORDER BY |
| | | a.type DESC, |
| | | a.id |
| | | ) b |
| | | where ins_state is not null |
| | | <if test="laboratory!=null and laboratory!=''"> |
| | | and laboratory=#{laboratory} |
| | | </if> |
| | | )A |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="inspectionOrderDetailsTaskSwitching" resultType="com.ruoyi.inspect.vo.InsOrderPlanTaskSwitchVo"> |
| | | select * from( |
| | | SELECT |
| | | a.*,ios.ins_state,ios.verify_tell,isu2.order_user_id,<!--(ios.verify_user = #{userId})--> verify_user |
| | | FROM |
| | | ( |
| | | SELECT |
| | | io.id, |
| | | io.entrust_code, |
| | | io.type, |
| | | io.appointed, |
| | | io.send_time, |
| | | group_concat(distinct isa.sample,' ') sampleType, |
| | | isu.user_id, |
| | | user.name userName, |
| | | ip.son_laboratory, |
| | | io.ins_time, |
| | | io.laboratory |
| | | FROM |
| | | ins_order io |
| | | LEFT JOIN ins_sample isa ON isa.ins_order_id = io.id |
| | | LEFT JOIN ( <!--SELECT * FROM ins_sample_user GROUP BY ins_sample_id, user_id --> |
| | | SELECT * |
| | | FROM ins_sample_user u |
| | | WHERE son_laboratory=#{sonLaboratory} and (ins_sample_id, id) IN ( |
| | | SELECT ins_sample_id, MAX(id) |
| | | FROM ins_sample_user |
| | | WHERE son_laboratory=#{sonLaboratory} |
| | | GROUP BY ins_sample_id |
| | | ) |
| | | ORDER BY ins_sample_id, id |
| | | ) isu ON isu.ins_sample_id = io.id |
| | | LEFT JOIN ins_product ip ON ip.ins_sample_id = isa.id |
| | | LEFT JOIN user ON isu.user_id = user.id |
| | | WHERE |
| | | io.state = 1 |
| | | -- # AND io.ins_state != 5 |
| | | and send_time is not null |
| | | <if test="userId !=null and userId!=''"> |
| | | and (isu.user_id = #{userId} OR isu.user_id is NULL ) |
| | | </if> |
| | | OR isu.user_id is NULL |
| | | GROUP BY |
| | | ip.son_laboratory, |
| | | io.id |
| | | ) a |
| | | LEFT JOIN ins_order_state ios ON ios.ins_order_id = a.id AND ios.laboratory = a.son_laboratory |
| | | left join (SELECT td.user_id order_user_id, td.ins_sample_id FROM ins_sample_user td,(SELECT max(id) id FROM |
| | | ins_sample_user where son_laboratory=#{sonLaboratory} GROUP BY ins_sample_id) md where td.id = md.id |
| | | <if test="userId !=null and userId!=''"> |
| | | and user_id = #{userId} OR user_id is NULL |
| | | </if> |
| | | OR user_id is NULL |
| | | ) isu2 on |
| | | isu2.ins_sample_id = a.id |
| | | where ins_state is not null |
| | | <if test="laboratory != null and laboratory != ''"> |
| | | and a.laboratory=#{laboratory} |
| | | </if> |
| | | ORDER BY |
| | | <!--a.user_id DESC,--> |
| | | a.type DESC, |
| | | a.id |
| | | ) b |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="selectSampleProductListByOrderId" resultMap="sampleDto"> |
| | | select isa.*, |
| | | ip.id ip_id, |
| | | inspection_item, |
| | | inspection_item_en, |
| | | inspection_item_class, |
| | | inspection_item_class_en, |
| | | inspection_item_subclass, |
| | | inspection_item_subclass_en, |
| | | ip.factory ip_factory, |
| | | ip.laboratory ip_laboratory, |
| | | ip.sample_type ip_sample_type, |
| | | ip.sample ip_sample, |
| | | ip.model ip_model, |
| | | son_laboratory, |
| | | ip.unit ip_unit, |
| | | price, |
| | | man_hour, |
| | | man_hour_group, |
| | | inspection_item_type, |
| | | inspection_value_type, |
| | | device_group, |
| | | checkout_number, |
| | | section, |
| | | value_type, |
| | | method, |
| | | man_day, |
| | | bsm, |
| | | ask, |
| | | tell, |
| | | `last_value`, |
| | | ip.ins_result ip_ins_result, |
| | | state, |
| | | ins_sample_id, |
| | | ip.create_user ip_create_user, |
| | | ip.update_user ip_update_user, |
| | | ip.create_time ip_create_time, |
| | | ip.update_time ip_update_time, |
| | | template_id, |
| | | ipr.ins_value, |
| | | ipr.com_value, |
| | | ipr.equip_value, |
| | | ip.method_s |
| | | from ins_sample isa |
| | | left join ins_product ip on isa.id = ip.ins_sample_id |
| | | left join ins_product_result ipr on ip.id = ipr.ins_product_id |
| | | where ins_order_id = #{id} |
| | | and state = 1 |
| | | -- and ins_fiber_id is null |
| | | -- and ins_fibers_id is null |
| | | and <!--isa.sample_code NOT REGEXP '/'--> |
| | | isa.id in(select id1 from (select is2.id id1 ,ip.id from ins_sample is2 left join ins_product ip on is2.id = ip.ins_sample_id where ip.id is not null)s ) |
| | | order by ip.sort asc, |
| | | case when man_hour_group is NULL then 1 |
| | | when man_hour_group ='' then 1 else 0 end, |
| | | CASE |
| | | WHEN man_hour_group REGEXP '^[0-9]' THEN CAST(man_hour_group AS UNSIGNED) -- 妿以æ°åå¼å¤´ï¼åæç
§æ°åå¤§å°æåº |
| | | WHEN man_hour_group REGEXP '[0-9]+' THEN CAST(SUBSTRING(man_hour_group, 2)AS UNSIGNED) END -- æå忝åé¢çæ°åé¨å |
| | | ,id asc |
| | | </select> |
| | | <select id="getInsOrderAndSample" resultMap="sampleDto"> |
| | | select isa.*, |
| | | ip.id ip_id, |
| | | inspection_item, |
| | | inspection_item_en, |
| | | inspection_item_class, |
| | | inspection_item_class_en, |
| | | inspection_item_subclass, |
| | | inspection_item_subclass_en, |
| | | ip.factory ip_factory, |
| | | ip.laboratory ip_laboratory, |
| | | ip.sample_type ip_sample_type, |
| | | ip.sample ip_sample, |
| | | ip.model ip_model, |
| | | son_laboratory, |
| | | ip.unit ip_unit, |
| | | price, |
| | | man_hour, |
| | | man_hour_group, |
| | | inspection_item_type, |
| | | inspection_value_type, |
| | | device_group, |
| | | checkout_number, |
| | | section, |
| | | value_type, |
| | | method, |
| | | man_day, |
| | | bsm, |
| | | ask, |
| | | `last_value`, |
| | | ip.ins_result ip_ins_result, |
| | | state, |
| | | ins_sample_id, |
| | | ip.create_user ip_create_user, |
| | | ip.update_user ip_update_user, |
| | | ip.create_time ip_create_time, |
| | | ip.update_time ip_update_time, |
| | | template_id, |
| | | ipr.ins_value, |
| | | ipr.com_value, |
| | | ipr.equip_value, |
| | | ipr.equip_name, |
| | | ip.method_s, |
| | | ip.tell, |
| | | ip.dic, |
| | | ip.temperature, |
| | | ip.humidity |
| | | from ins_sample isa |
| | | left join ins_product ip on isa.id = ip.ins_sample_id |
| | | left join ins_product_result ipr on ip.id = ipr.ins_product_id |
| | | where ins_order_id = #{id} |
| | | and state = 1 |
| | | and ip.son_laboratory = #{laboratory} |
| | | </select> |
| | | <select id="getSampleEn" resultType="java.lang.String"> |
| | | select name_en |
| | | from product |
| | | where name = #{sample} |
| | | limit 1 |
| | | </select> |
| | | <select id="getSampleEnByObject" resultType="java.lang.String"> |
| | | select specimen_name_en |
| | | from structure_test_object |
| | | where specimen_name = #{sample} |
| | | limit 1 |
| | | </select> |
| | | <select id="selectInsOrder" resultType="map"> |
| | | SELECT |
| | | ifs.order_no AS orderNo, |
| | | ifs.supplier_id AS supplierId, |
| | | ifs.supplier_name AS supplierName, |
| | | ifs.part_no AS partNo, |
| | | ifs.qty_arrived AS qtyArrived, |
| | | ifs.receiver_date AS receiverDate, |
| | | ifs.update_batch_no AS updateBatchNo, |
| | | ifs.part_desc AS partDesc, |
| | | io.send_time AS sendTime, |
| | | ifs.declare_user declareUser, |
| | | ifs.id inventoryQuantityId, |
| | | ifs.buy_unit_meas buyUnitMeas, |
| | | io.test_quantity testQuantity, |
| | | ifs.buy_unit_meas buyUnitMeas |
| | | FROM |
| | | ifs_inventory_quantity ifs |
| | | LEFT JOIN ins_order io ON ifs.id = io.ifs_inventory_id |
| | | WHERE |
| | | io.id = #{id} |
| | | </select> |
| | | <select id="selectSampleProductListByOrderId2" resultMap="sampleDto"> |
| | | select isa.*, |
| | | ip.id ip_id, |
| | | inspection_item, |
| | | inspection_item_en, |
| | | inspection_item_subclass, |
| | | inspection_item_subclass_en, |
| | | inspection_item_class, |
| | | inspection_item_class_en, |
| | | ip.factory ip_factory, |
| | | ip.laboratory ip_laboratory, |
| | | ip.sample_type ip_sample_type, |
| | | ip.sample ip_sample, |
| | | ip.model ip_model, |
| | | son_laboratory, |
| | | ip.unit ip_unit, |
| | | price, |
| | | man_hour, |
| | | man_hour_group, |
| | | inspection_item_type, |
| | | inspection_value_type, |
| | | device_group, |
| | | checkout_number, |
| | | section, |
| | | value_type, |
| | | method, |
| | | man_day, |
| | | bsm, |
| | | ask, |
| | | tell, |
| | | `last_value`, |
| | | ip.ins_result ip_ins_result, |
| | | state, |
| | | ins_sample_id, |
| | | ip.create_user ip_create_user, |
| | | ip.update_user ip_update_user, |
| | | ip.create_time ip_create_time, |
| | | ip.update_time ip_update_time, |
| | | template_id, |
| | | ipr.ins_value, |
| | | ipr.com_value, |
| | | ipr.equip_value, |
| | | ip.method_s, |
| | | ip.radius, |
| | | isa.special_standard_method |
| | | from ins_sample isa |
| | | left join ins_product ip on isa.id = ip.ins_sample_id |
| | | left join ins_product_result ipr on ip.id = ipr.ins_product_id |
| | | where ins_order_id = #{id} |
| | | and ip.standard_method_list_id is not null |
| | | and state = 1 |
| | | and ip.is_binding != 1 |
| | | order by ip.sort asc, |
| | | case when man_hour_group is NULL then 1 |
| | | when man_hour_group ='' then 1 else 0 end, |
| | | CASE |
| | | WHEN man_hour_group REGEXP '^[0-9]' THEN CAST(man_hour_group AS UNSIGNED) -- 妿以æ°åå¼å¤´ï¼åæç
§æ°åå¤§å°æåº |
| | | WHEN man_hour_group REGEXP '[0-9]+' THEN CAST(SUBSTRING(man_hour_group, 2)AS UNSIGNED) END -- æå忝åé¢çæ°åé¨å |
| | | ,id asc |
| | | </select> |
| | | |
| | | <select id="getInsProduct1" resultMap="product"> |
| | | select <include refid="getInsProducSql"/> |
| | | from ins_product ip |
| | | left join ins_product_result ipr on ip.id = ipr.ins_product_id |
| | | where ins_sample_id = #{id} |
| | | and state = 1 |
| | | and ip.son_laboratory = #{laboratory} |
| | | and ins_fiber_id is null |
| | | and ins_fibers_id is null |
| | | and standard_method_list_id is not null |
| | | /* çµç¼é
ç½®æ è¯ */ |
| | | <if test="cableTag == null or cableTag == ''"> |
| | | and ip.cable_tag is null |
| | | </if> |
| | | <if test="cableTag != null and cableTag != ''"> |
| | | and ip.cable_tag = #{cableTag} |
| | | </if> |
| | | /* éå¤å¼æ è¯ */ |
| | | <if test="repetitionTag == null or repetitionTag == ''"> |
| | | and ip.repetition_tag is null |
| | | </if> |
| | | <if test="repetitionTag != null and repetitionTag != ''"> |
| | | and ip.repetition_tag = #{repetitionTag} |
| | | </if> |
| | | <if test="isDisqualification != null and isDisqualification != ''"> |
| | | and ip.ins_result = 0 |
| | | </if> |
| | | order by sort asc |
| | | </select> |
| | | |
| | | <select id="getInsProduct6" resultMap="product"> |
| | | select <include refid="getInsProducSql"/> |
| | | from ins_product ip |
| | | left join ins_product_result ipr on ip.id = ipr.ins_product_id |
| | | where ins_sample_id = #{id} |
| | | and state = 1 |
| | | and ip.son_laboratory = #{laboratory} |
| | | and ins_fiber_id is null |
| | | and ins_fibers_id is null |
| | | and standard_method_list_id is not null |
| | | and ip.raw_material_tag = #{rawMaterialTag} |
| | | <if test="isDisqualification != null and isDisqualification != ''"> |
| | | and ip.ins_result = 0 |
| | | </if> |
| | | order by sort asc |
| | | </select> |
| | | |
| | | <select id="getDetailById" resultMap="sampleVo"> |
| | | select is2.*, |
| | | code methodName |
| | | from ins_sample is2 |
| | | inner join standard_method sm on standard_method_list_id = sm.id |
| | | where is2.id = #{sampleId} |
| | | </select> |
| | | |
| | | <select id="selMethodById" resultType="java.lang.String"> |
| | | select code |
| | | from standard_method |
| | | where id = (select standard_method_list_id from ins_sample where id = #{sampleId}) |
| | | </select> |
| | | |
| | | <!-- æ¥ççµç¼é
ç½®æ è¯ --> |
| | | <select id="getCableTag" resultType="java.util.Map"> |
| | | select ip.cable_tag cableTag, |
| | | CASE |
| | | WHEN COUNT(ip.last_value) = 0 THEN '0' |
| | | WHEN COUNT(CASE WHEN ip.last_value = '' OR ip.last_value IS NULL THEN 1 END) = 0 THEN '2' |
| | | ELSE '2' |
| | | END AS status |
| | | from ins_product ip |
| | | where ins_sample_id = #{id} |
| | | and state = 1 |
| | | and ip.son_laboratory = #{laboratory} |
| | | and ins_fiber_id is null |
| | | and ins_fibers_id is null |
| | | and standard_method_list_id is not null |
| | | and ip.cable_tag is not null |
| | | group by ip.cable_tag |
| | | </select> |
| | | |
| | | <!-- åæææ¥çé
ç½®æ è¯ --> |
| | | <select id="getRawMaterialTag" resultType="java.util.Map"> |
| | | select ip.raw_material_tag rawMaterialTag, |
| | | CASE |
| | | WHEN COUNT(ip.last_value) = 0 THEN '0' |
| | | WHEN COUNT(CASE WHEN ip.last_value = '' OR ip.last_value IS NULL THEN 1 END) = 0 THEN '2' |
| | | ELSE '1' |
| | | END AS status |
| | | from ins_product ip |
| | | where ins_sample_id = #{id} |
| | | and state = 1 |
| | | and ip.son_laboratory = #{laboratory} |
| | | and ins_fiber_id is null |
| | | and ins_fibers_id is null |
| | | and standard_method_list_id is not null |
| | | and ip.raw_material_tag is not null |
| | | group by ip.raw_material_tag |
| | | </select> |
| | | |
| | | <!-- æ¥çé夿 è¯ --> |
| | | <select id="getRepetitionTag" resultType="java.util.Map"> |
| | | select ip.repetition_tag repetitionTag, |
| | | CASE |
| | | WHEN COUNT(ip.last_value) = 0 THEN '0' |
| | | WHEN COUNT(CASE WHEN ip.last_value = '' OR ip.last_value IS NULL THEN 1 END) = 0 THEN '2' |
| | | ELSE '1' |
| | | END AS status, |
| | | GROUP_CONCAT(DISTINCT ip.radius SEPARATOR 'ï¼') AS radius |
| | | from ins_product ip |
| | | where ins_sample_id = #{id} |
| | | and state = 1 |
| | | and ip.son_laboratory = #{laboratory} |
| | | and ins_fiber_id is null |
| | | and ins_fibers_id is null |
| | | and standard_method_list_id is not null |
| | | and ip.repetition_tag is not null |
| | | /* çµç¼é
ç½®æ è¯ */ |
| | | <if test="cableTag == null or cableTag == ''"> |
| | | and ip.cable_tag is null |
| | | </if> |
| | | <if test="cableTag != null and cableTag != ''"> |
| | | and ip.cable_tag = #{cableTag} |
| | | </if> |
| | | group by ip.repetition_tag |
| | | </select> |
| | | |
| | | <select id="selectExemptionByOrderId" resultType="com.ruoyi.inspect.dto.SampleProductDto"> |
| | | select * |
| | | from ins_sample |
| | | where ins_order_id = #{id} |
| | | </select> |
| | | <select id="selectSupplierDensityModel" resultType="java.lang.String"> |
| | | select psd.density_value densityValue |
| | | from product_supplier_density psd |
| | | where psd.product_id = (select id |
| | | from product |
| | | where name = #{sample} |
| | | limit 1) |
| | | and psd.supplier_name = #{production} |
| | | and psd.model = #{model} |
| | | limit 1 |
| | | </select> |
| | | <select id="selectSupplierDensity" resultType="java.lang.String"> |
| | | select psd.density_value densityValue |
| | | from product_supplier_density psd |
| | | where psd.product_id = (select id |
| | | from product |
| | | where name = #{sample} |
| | | limit 1) |
| | | and psd.supplier_name = #{production} |
| | | and (psd.model = '' or psd.model is null) |
| | | limit 1 |
| | | </select> |
| | | |
| | | <!-- æ¥è¯¢æ£éªé¡¹æ£éªç»æ --> |
| | | <select id="selectProductResult" resultMap="product"> |
| | | select <include refid="getInsProducSql"/> |
| | | from ins_product ip |
| | | left join ins_product_result ipr on ip.id = ipr.ins_product_id |
| | | where ip.id in |
| | | <foreach collection="itemIds" index="index" open="(" separator="," close=")" item="val"> |
| | | #{val} |
| | | </foreach> |
| | | order by ip.sort asc |
| | | </select> |
| | | |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
| | | <mapper namespace="com.ruoyi.inspect.mapper.InsSampleUserMapper"> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.inspect.mapper.InsUnqualifiedHandlerMapper"> |
| | | |
| | | <sql id="Base_Column_List"> |
| | | id,no,supplier_name, |
| | | material_name,production_batch,cargo_quantity, |
| | | specs_models,inspect_time,feedback_user, |
| | | feedback_time,classification,off_grade_ascription, |
| | | unqualified_desc,inventory_quantity_id |
| | | </sql> |
| | | <select id="selectPageList" resultType="com.ruoyi.inspect.vo.UnqualifiedHandlerVO"> |
| | | select * from (select |
| | | iiq.*, |
| | | iuh.id as handler_id, |
| | | iuh.no, |
| | | iuh.material_name, |
| | | iuh.production_batch, |
| | | iuh.cargo_quantity, |
| | | iuh.specs_models, |
| | | iuh.inspect_time, |
| | | iuh.feedback_user, |
| | | iuh.feedback_time, |
| | | iuh.classification, |
| | | iuh.off_grade_ascription, |
| | | iuh.unqualified_desc, |
| | | iuh.inventory_quantity_id, |
| | | iuh.oa_state, |
| | | iuh.request_id, |
| | | iuh.file_url, |
| | | iuh.headline |
| | | from |
| | | ins_unqualified_handler iuh |
| | | inner join |
| | | ifs_inventory_quantity iiq |
| | | on |
| | | iuh.inventory_quantity_id = iiq.id)tempA |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | </select> |
| | | <select id="findById" resultType="com.ruoyi.inspect.vo.UnqualifiedHandlerVO"> |
| | | select * from (select |
| | | iiq.*, |
| | | iuh.id as handler_id, |
| | | iuh.no, |
| | | iuh.headline, |
| | | iuh.material_name, |
| | | iuh.production_batch, |
| | | iuh.cargo_quantity, |
| | | iuh.specs_models, |
| | | iuh.inspect_time, |
| | | iuh.feedback_user, |
| | | iuh.feedback_time, |
| | | iuh.classification, |
| | | iuh.off_grade_ascription, |
| | | iuh.unqualified_desc, |
| | | iuh.inventory_quantity_id, |
| | | iuh.request_id, |
| | | iuh.oa_state, |
| | | iuh.file_url |
| | | from |
| | | ins_unqualified_handler iuh |
| | | inner join |
| | | ifs_inventory_quantity iiq |
| | | on |
| | | iuh.inventory_quantity_id = iiq.id)tempA |
| | | where tempA.handler_id = #{id} |
| | | </select> |
| | | <select id="getOaFlow" resultType="com.ruoyi.inspect.pojo.CommonOa"> |
| | | select co.id, |
| | | co.node_name, |
| | | co.operation, |
| | | co.approver, |
| | | co.approval_date, |
| | | co.approval_time, |
| | | co.approval_opinion, |
| | | co.workflow_id |
| | | from common_oa co |
| | | left join ins_unqualified_handler iuh on iuh.request_id = co.workflow_id |
| | | where iuh.id = #{id} |
| | | and operation != 'æé' |
| | | group by co.node_name |
| | | </select> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
| | | <mapper namespace="com.ruoyi.inspect.mapper.InsUnqualifiedRetestProductMapper"> |
| | | <resultMap id="product" type="com.ruoyi.inspect.pojo.InsProduct"> |
| | | <id property="id" column="ip_id" jdbcType="INTEGER"/> |
| | | <result property="inspectionItem" column="inspection_item" jdbcType="VARCHAR"/> |
| | | <result property="inspectionItemEn" column="inspection_item_en" jdbcType="VARCHAR"/> |
| | | <result property="inspectionItemSubclass" column="inspection_item_subclass" jdbcType="VARCHAR"/> |
| | | <result property="inspectionItemSubclassEn" column="inspection_item_subclass_en" jdbcType="VARCHAR"/> |
| | | <result property="inspectionItemClass" column="inspection_item_class" jdbcType="VARCHAR"/> |
| | | <result property="inspectionItemClassEn" column="inspection_item_class_en" jdbcType="VARCHAR"/> |
| | | <result property="factory" column="ip_factory" jdbcType="VARCHAR"/> |
| | | <result property="laboratory" column="ip_laboratory" jdbcType="VARCHAR"/> |
| | | <result property="sampleType" column="ip_sample_type" jdbcType="VARCHAR"/> |
| | | <result property="sample" column="ip_sample" jdbcType="VARCHAR"/> |
| | | <result property="model" column="ip_model" jdbcType="VARCHAR"/> |
| | | <result property="sonLaboratory" column="son_laboratory" jdbcType="VARCHAR"/> |
| | | <result property="unit" column="ip_unit" jdbcType="VARCHAR"/> |
| | | <result property="price" column="price" jdbcType="DECIMAL"/> |
| | | <result property="manHour" column="man_hour" jdbcType="DOUBLE"/> |
| | | <result property="manHourGroup" column="man_hour_group" jdbcType="VARCHAR"/> |
| | | <result property="inspectionItemType" column="inspection_item_type" jdbcType="VARCHAR"/> |
| | | <result property="inspectionValueType" column="inspection_value_type" jdbcType="VARCHAR"/> |
| | | <result property="deviceGroup" column="device_group" jdbcType="VARCHAR"/> |
| | | <result property="checkoutNumber" column="checkout_number" jdbcType="INTEGER"/> |
| | | <result property="section" column="section" jdbcType="VARCHAR"/> |
| | | <result property="valueType" column="value_type" jdbcType="VARCHAR"/> |
| | | <result property="method" column="method" jdbcType="VARCHAR"/> |
| | | <result property="manDay" column="man_day" jdbcType="INTEGER"/> |
| | | <result property="bsm" column="bsm" jdbcType="VARCHAR"/> |
| | | <result property="ask" column="ask" jdbcType="VARCHAR"/> |
| | | <result property="tell" column="tell" jdbcType="VARCHAR"/> |
| | | <result property="lastValue" column="last_value" jdbcType="VARCHAR"/> |
| | | <result property="insResult" column="ip_ins_result" jdbcType="INTEGER"/> |
| | | <result property="state" column="state" jdbcType="INTEGER"/> |
| | | <result property="insBushId" column="ins_bush_id" jdbcType="INTEGER"/> |
| | | <result property="insSampleId" column="ins_sample_id" jdbcType="INTEGER"/> |
| | | <result property="createUser" column="ip_create_user" jdbcType="INTEGER"/> |
| | | <result property="updateUser" column="ip_update_user" jdbcType="INTEGER"/> |
| | | <result property="createTime" column="ip_create_time" jdbcType="TIMESTAMP"/> |
| | | <result property="updateTime" column="ip_update_time" jdbcType="TIMESTAMP"/> |
| | | <result property="templateId" column="template_id" jdbcType="INTEGER"/> |
| | | <result property="methodS" column="method_s"/> |
| | | <result property="tell" column="tell"/> |
| | | <result property="dic" column="dic"/> |
| | | <result property="temperature" column="temperature"/> |
| | | <result property="humidity" column="humidity"/> |
| | | <result property="cableTag" column="cable_tag"/> |
| | | <collection property="insProductResult" resultMap="insProductResult"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="insProductResult" type="com.ruoyi.inspect.pojo.InsProductResult"> |
| | | <result property="insValue" column="ins_value" jdbcType="VARCHAR"/> |
| | | <result property="comValue" column="com_value" jdbcType="VARCHAR"/> |
| | | <result property="equipValue" column="equip_value" jdbcType="VARCHAR"/> |
| | | <result property="equipName" column="equip_name" jdbcType="VARBINARY"/> |
| | | </resultMap> |
| | | |
| | | <sql id="getInsProducSql"> |
| | | ip.id ip_id, |
| | | inspection_item, |
| | | inspection_item_en, |
| | | inspection_item_class, |
| | | inspection_item_class_en, |
| | | inspection_item_subclass, |
| | | inspection_item_subclass_en, |
| | | ip.factory ip_factory, |
| | | ip.laboratory ip_laboratory, |
| | | ip.sample_type ip_sample_type, |
| | | ip.sample ip_sample, |
| | | ip.model ip_model, |
| | | son_laboratory, |
| | | ip.unit ip_unit, |
| | | price, |
| | | man_hour, |
| | | man_hour_group, |
| | | inspection_item_type, |
| | | inspection_value_type, |
| | | device_group, |
| | | checkout_number, |
| | | section, |
| | | value_type, |
| | | method, |
| | | man_day, |
| | | bsm, |
| | | ask, |
| | | `last_value`, |
| | | ip.ins_result ip_ins_result, |
| | | state, |
| | | ins_sample_id, |
| | | ip.create_user ip_create_user, |
| | | ip.update_user ip_update_user, |
| | | ip.create_time ip_create_time, |
| | | ip.update_time ip_update_time, |
| | | template_id, |
| | | ipr.ins_value, |
| | | ipr.com_value, |
| | | ipr.equip_value, |
| | | ipr.equip_name, |
| | | ip.method_s, |
| | | ip.tell, |
| | | ip.dic, |
| | | ip.cable_tag |
| | | </sql> |
| | | |
| | | <select id="selectRetestProduct" resultType="com.ruoyi.inspect.pojo.InsUnqualifiedRetestProduct"> |
| | | select id ins_product_id, |
| | | inspection_item, |
| | | inspection_item_subclass, |
| | | factory, |
| | | laboratory, |
| | | sample_type, |
| | | sample, |
| | | model, |
| | | son_laboratory, |
| | | unit, |
| | | price, |
| | | man_hour, |
| | | man_hour_group, |
| | | '0' inspection_item_type, |
| | | inspection_value_type, |
| | | device_group, |
| | | checkout_number, |
| | | section, |
| | | value_type, |
| | | method, |
| | | man_day, |
| | | bsm, |
| | | ask, |
| | | tell, |
| | | state, |
| | | ins_sample_id, |
| | | create_user, |
| | | update_user, |
| | | create_time, |
| | | update_time, |
| | | template_id, |
| | | dic, |
| | | method_s, |
| | | ins_fiber_id, |
| | | ins_fibers_id, |
| | | inspection_item_en, |
| | | inspection_item_subclass_en, |
| | | inspection_item_class, |
| | | inspection_item_class_en, |
| | | standard_method_list_id, |
| | | temperature, |
| | | humidity, |
| | | ins_bush_id, |
| | | radius, |
| | | cable_tag, |
| | | raw_material_tag, |
| | | sort, |
| | | '1' retest_tag |
| | | from ins_product |
| | | where id in |
| | | <foreach collection="ids" index="index" open="(" separator="," close=")" item="val"> |
| | | #{val} |
| | | </foreach> |
| | | </select> |
| | | <select id="getInsProductUnqualifiedRetest1" resultMap="product"> |
| | | select <include refid="getInsProducSql"/> |
| | | from ins_unqualified_retest_product ip |
| | | left join ins_unqualified_retest_result ipr on ip.id = ipr.retest_product_id |
| | | where ins_sample_id = #{id} |
| | | and state = 1 |
| | | and ip.son_laboratory = #{laboratory} |
| | | and ins_fiber_id is null |
| | | and ins_fibers_id is null |
| | | and standard_method_list_id is not null |
| | | and ip.cable_tag is null |
| | | and ip.retest_tag = #{retestTag} |
| | | </select> |
| | | <select id="getInsProductUnqualifiedRetest5" resultMap="product"> |
| | | select <include refid="getInsProducSql"/> |
| | | from ins_unqualified_retest_product ip |
| | | left join ins_unqualified_retest_result ipr on ip.id = ipr.retest_product_id |
| | | where ins_sample_id = #{id} |
| | | and state = 1 |
| | | and ip.son_laboratory = #{laboratory} |
| | | and ins_fiber_id is null |
| | | and ins_fibers_id is null |
| | | and standard_method_list_id is not null |
| | | and ip.cable_tag = #{cableTag} |
| | | and ip.retest_tag = #{retestTag} |
| | | </select> |
| | | <select id="getInsProductUnqualifiedRetest6" resultMap="product"> |
| | | select <include refid="getInsProducSql"/> |
| | | from ins_unqualified_retest_product ip |
| | | left join ins_unqualified_retest_result ipr on ip.id = ipr.retest_product_id |
| | | where ins_sample_id = #{id} |
| | | and state = 1 |
| | | and ip.son_laboratory = #{laboratory} |
| | | and ins_fiber_id is null |
| | | and ins_fibers_id is null |
| | | and standard_method_list_id is not null |
| | | and ip.raw_material_tag = #{rawMaterialTag} |
| | | and ip.retest_tag = #{retestTag} |
| | | </select> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
| | | <mapper namespace="com.ruoyi.inspect.mapper.RawMaterialOrderTemplateMapper"> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
| | | <mapper namespace="com.ruoyi.inspect.mapper.SpotCheckQuarterItemMapper"> |
| | | </mapper> |
| | |
| | | |
| | | <select id="performanceShiftPage" resultMap="performanceShiftPageMap"> |
| | | SELECT |
| | | if(u2.department is not null and u2.department != '', CONCAT(u2.name, 'ï¼', u2.department, 'ï¼'), u2.name) name, |
| | | GROUP_CONCAT(s.work_time, 'ï¼', s.shift, 'ï¼', s.id order by s.work_time SEPARATOR ';') AS shift_time, u2.id user_id |
| | | FROM performance_shift s |
| | | LEFT JOIN (SELECT distinct u.* from |
| | | user u |
| | | left join department_lims dl on FIND_IN_SET(dl.id,u.depart_lims_id) |
| | | where state=1 |
| | | where status = '0' |
| | | and del_flag = '0' |
| | | <if test="laboratory != null and laboratory != ''"> |
| | | and dl.name=#{laboratory} |
| | | </if> |
| | |
| | | and u2.name like concat('%', #{userName}, '%') |
| | | </if> |
| | | </where> |
| | | order by s.create_time |
| | | GROUP BY u2.id |
| | | order by s.create_time |
| | | </select> |
| | | |
| | | <select id="performanceShiftYearPage" resultType="map"> |
| | |
| | | LEFT JOIN (SELECT u.* from |
| | | user u |
| | | left join department_lims dl on FIND_IN_SET(dl.id,u.depart_lims_id) |
| | | where state=1 |
| | | where status = '0' |
| | | and del_flag = '0' |
| | | <if test="laboratory != null and laboratory != ''"> |
| | | and dl.name=#{laboratory} |
| | | </if> |
| | |
| | | </select> |
| | | |
| | | <select id="performanceShiftYear" resultType="java.util.Map"> |
| | | SELECT if(u2.department is not null and u2.department != '', CONCAT(u2.name, 'ï¼', u2.department, 'ï¼'), u2.name) name, |
| | | SELECT |
| | | s.user_id, u2.account, |
| | | DATE_FORMAT(s.work_time, '%c') work_time, |
| | | GROUP_CONCAT(DATE_FORMAT(s.work_time, '%c'), 'ï¼', s.shift order by s.work_time SEPARATOR ';') month_str |
| | |
| | | LEFT JOIN (SELECT u.* from |
| | | user u |
| | | left join department_lims dl on FIND_IN_SET(dl.id,u.depart_lims_id) |
| | | where state=1 |
| | | where status = '0' |
| | | and del_flag = '0' |
| | | <if test="laboratory != null and laboratory != ''"> |
| | | and dl.name=#{laboratory} |
| | | </if> |
| | |
| | | </select> |
| | | |
| | | <select id="performanceShiftYearList" resultType="map"> |
| | | SELECT if(u.department is not null and u.department != '', CONCAT(u.name, 'ï¼', u.department, 'ï¼'), u.name) name, |
| | | SELECT |
| | | s.user_id, u.account, |
| | | DATE_FORMAT(s.work_time, '%c') work_time, |
| | | GROUP_CONCAT(DATE_FORMAT(s.work_time, '%c'), 'ï¼', s.shift order by s.work_time SEPARATOR ';') month_str |
| | |
| | | |
| | | <select id="performanceShiftList" resultMap="performanceShiftPageMap"> |
| | | SELECT |
| | | if(u.department is not null and u.department != '', CONCAT(u.name, 'ï¼', u.department, 'ï¼'), u.name) name, |
| | | GROUP_CONCAT(s.work_time, 'ï¼', s.shift, 'ï¼', s.id order by s.work_time SEPARATOR ';') AS shift_time, u.id user_id, u.department |
| | | FROM performance_shift s |
| | | LEFT JOIN user u on u.id = s.user_id |
| | |
| | | <if test="laboratory != null and laboratory != ''"> |
| | | </if> |
| | | </where> |
| | | order by s.create_time |
| | | GROUP BY u.id |
| | | order by s.create_time |
| | | </select> |
| | | |
| | | <select id="seldepLimsId" resultType="java.lang.String"> |
| | |
| | | |
| | | <dependencies> |
| | | |
| | | <!-- spring-boot-devtools --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-devtools</artifactId> |
| | | <optional>true</optional> <!-- 表示ä¾èµä¸ä¼ä¼ é --> |
| | | </dependency> |
| | | <!-- <!– spring-boot-devtools –>--> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>org.springframework.boot</groupId>--> |
| | | <!-- <artifactId>spring-boot-devtools</artifactId>--> |
| | | <!-- <optional>true</optional> <!– 表示ä¾èµä¸ä¼ä¼ é –>--> |
| | | <!-- </dependency>--> |
| | | |
| | | <!-- swagger3--> |
| | | <dependency> |
| | |
| | | { |
| | | public static void main(String[] args) |
| | | { |
| | | System.setProperty("spring.devtools.restart.enabled", "false"); |
| | | // System.setProperty("spring.devtools.restart.enabled", "false"); |
| | | SpringApplication.run(RuoYiApplication.class, args); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.common.core.domain.entity.User; |
| | | import com.ruoyi.system.service.UserService; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Map; |
| | | |
| | | |
| | | /** |
| | |
| | | @Resource |
| | | private UserService userService; |
| | | |
| | | @ApiOperation(value = "æ ¹æ®æ¡ä»¶è·åç¨æ·å表") |
| | | @GetMapping("/selectUserCondition") |
| | | public Result selectUserCondition(User user, String type){ |
| | | return Result.success(userService.selectUserCondition(user, type)); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | # æ°æ®æºé
ç½® |
| | | spring: |
| | | datasource: |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | driverClassName: com.mysql.cj.jdbc.Driver |
| | | druid: |
| | | # ä¸»åºæ°æ®æº |
| | | master: |
| | | url: jdbc:mysql://114.132.189.42:9004/lims-ruoyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | username: root |
| | | password: 123456 |
| | | # ä»åºæ°æ®æº |
| | | slave: |
| | | # 仿°æ®æºå¼å
³/é»è®¤å
³é |
| | | enabled: false |
| | | url: |
| | | username: |
| | | password: |
| | | # åå§è¿æ¥æ° |
| | | initialSize: 5 |
| | | # æå°è¿æ¥æ± æ°é |
| | | minIdle: 10 |
| | | # æå¤§è¿æ¥æ± æ°é |
| | | maxActive: 20 |
| | | # é
ç½®è·åè¿æ¥çå¾
è¶
æ¶çæ¶é´ |
| | | maxWait: 60000 |
| | | # é
ç½®è¿æ¥è¶
æ¶æ¶é´ |
| | | connectTimeout: 30000 |
| | | # é
ç½®ç½ç»è¶
æ¶æ¶é´ |
| | | socketTimeout: 60000 |
| | | # é
ç½®é´éå¤ä¹
æè¿è¡ä¸æ¬¡æ£æµï¼æ£æµéè¦å
³éç空é²è¿æ¥ï¼å使¯æ¯«ç§ |
| | | timeBetweenEvictionRunsMillis: 60000 |
| | | # é
ç½®ä¸ä¸ªè¿æ¥å¨æ± 䏿å°çåçæ¶é´ï¼å使¯æ¯«ç§ |
| | | minEvictableIdleTimeMillis: 300000 |
| | | # é
ç½®ä¸ä¸ªè¿æ¥å¨æ± 䏿大çåçæ¶é´ï¼å使¯æ¯«ç§ |
| | | maxEvictableIdleTimeMillis: 900000 |
| | | # é
ç½®æ£æµè¿æ¥æ¯å¦ææ |
| | | validationQuery: SELECT 1 FROM DUAL |
| | | testWhileIdle: true |
| | | testOnBorrow: false |
| | | testOnReturn: false |
| | | webStatFilter: |
| | | enabled: true |
| | | statViewServlet: |
| | | enabled: true |
| | | # 设置ç½ååï¼ä¸å¡«åå
许ææè®¿é® |
| | | allow: |
| | | url-pattern: /druid/* |
| | | # æ§å¶å°ç®¡çç¨æ·ååå¯ç |
| | | login-username: ruoyi |
| | | login-password: 123456 |
| | | filter: |
| | | stat: |
| | | enabled: true |
| | | # æ
¢SQLè®°å½ |
| | | log-slow-sql: true |
| | | slow-sql-millis: 1000 |
| | | merge-sql: true |
| | | wall: |
| | | config: |
| | | multi-statement-allow: true |
| | | datasource: |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | driverClassName: com.mysql.cj.jdbc.Driver |
| | | druid: |
| | | # ä¸»åºæ°æ®æº |
| | | master: |
| | | url: jdbc:mysql://114.132.189.42:9004/lims-ruoyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | username: root |
| | | password: 123456 |
| | | # ä»åºæ°æ®æº |
| | | slave: |
| | | # 仿°æ®æºå¼å
³/é»è®¤å
³é |
| | | enabled: false |
| | | url: |
| | | username: |
| | | password: |
| | | # åå§è¿æ¥æ° |
| | | initialSize: 5 |
| | | # æå°è¿æ¥æ± æ°é |
| | | minIdle: 10 |
| | | # æå¤§è¿æ¥æ± æ°é |
| | | maxActive: 20 |
| | | # é
ç½®è·åè¿æ¥çå¾
è¶
æ¶çæ¶é´ |
| | | maxWait: 60000 |
| | | # é
ç½®è¿æ¥è¶
æ¶æ¶é´ |
| | | connectTimeout: 30000 |
| | | # é
ç½®ç½ç»è¶
æ¶æ¶é´ |
| | | socketTimeout: 60000 |
| | | # é
ç½®é´éå¤ä¹
æè¿è¡ä¸æ¬¡æ£æµï¼æ£æµéè¦å
³éç空é²è¿æ¥ï¼å使¯æ¯«ç§ |
| | | timeBetweenEvictionRunsMillis: 60000 |
| | | # é
ç½®ä¸ä¸ªè¿æ¥å¨æ± 䏿å°çåçæ¶é´ï¼å使¯æ¯«ç§ |
| | | minEvictableIdleTimeMillis: 300000 |
| | | # é
ç½®ä¸ä¸ªè¿æ¥å¨æ± 䏿大çåçæ¶é´ï¼å使¯æ¯«ç§ |
| | | maxEvictableIdleTimeMillis: 900000 |
| | | # é
ç½®æ£æµè¿æ¥æ¯å¦ææ |
| | | validationQuery: SELECT 1 FROM DUAL |
| | | testWhileIdle: true |
| | | testOnBorrow: false |
| | | testOnReturn: false |
| | | webStatFilter: |
| | | enabled: true |
| | | statViewServlet: |
| | | enabled: true |
| | | # 设置ç½ååï¼ä¸å¡«åå
许ææè®¿é® |
| | | allow: |
| | | url-pattern: /druid/* |
| | | # æ§å¶å°ç®¡çç¨æ·ååå¯ç |
| | | login-username: ruoyi |
| | | login-password: 123456 |
| | | filter: |
| | | stat: |
| | | enabled: true |
| | | # æ
¢SQLè®°å½ |
| | | log-slow-sql: true |
| | | slow-sql-millis: 1000 |
| | | merge-sql: true |
| | | wall: |
| | | config: |
| | | multi-statement-allow: true |
| | | |
| | | |
| | | minio: |
| | | endpoint: http://114.132.189.42/ |
| | | port: 7019 |
| | | secure: false |
| | | accessKey: admin |
| | | secretKey: 12345678 |
| | | preview-expiry: 24 # é¢è§å°åé»è®¤24å°æ¶ |
| | | endpoint: http://114.132.189.42/ |
| | | port: 7019 |
| | | secure: false |
| | | accessKey: admin |
| | | secretKey: 12345678 |
| | | preview-expiry: 24 # é¢è§å°åé»è®¤24å°æ¶ |
| | | |
| | | # ç
§çåå¨è·¯å¾+++++++++++++++++++++++++++è¿ç»´éè¦é
ç½®+++++++++++++++++++++++++++ |
| | | file: |
| | | path: D:\é¡¹ç®æä»¶åå¨\image |
| | | # 转pdfæä»¶è·¯å¾ |
| | | licenseUrl: D:\20892\Desktop\lims\code\center-lims-after\inspect-server\src\main\resources\lib\license.xml |
| | | # ä¸ä¼ æä»¶å
è®¸çæ©å±å |
| | | allowed: png,jpg,jpeg,gif |
| | | |
| | | wordUrl: D:\é¡¹ç®æä»¶åå¨\word |
| | | twoCode: D:\é¡¹ç®æä»¶åå¨\two_code |
| | | |
| | | |
| | | #oa: |
| | | # oaHost: http://192.168.0.49:8000/oa_workflowrequest.asmx?wsdl |
| | | # prodIp: http://192.168.21.53:8081 |
| | | # unqualifiedProcessId: 41974 |
| | | |
| | | wechat: |
| | | # è´¨éæ¥æ£éç¥ |
| | | examiningUrl: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=21993616-9966-4fe4-81b0-68e99a40c964 |
| | | |
| | | ifs: |
| | | contract: ZTZB |
| | | contract-key-get: 4ttDeLKNsZuhstjtROMcRE1USNFXKdFYE7lQ2p1m5Bo= |
| | | contract-key-post: 4ttDeLKNsZuhstjtROMcRE1USNFXKdFYE7lQ2p1m5Bo= |
| | | custorder: http://192.168.20.47/PurchService.ashx? |
| | | custorder-port: http://192.168.20.47:8008/PurchService.ashx? |
| | | erp-services: http://192.168.20.47:8081 |
| | |
| | | basename: i18n/messages |
| | | profiles: |
| | | active: druid |
| | | # å
¨å±æ¶é´å¤ç LocalDateTimeæ¶é´åºåå· |
| | | jackson: |
| | | date-format: yyyy-MM-dd HH:mm:ss |
| | | time-zone: GMT+8 |
| | | # æä»¶ä¸ä¼ |
| | | servlet: |
| | | multipart: |
| | |
| | | # 设置æ»ä¸ä¼ çæä»¶å¤§å° |
| | | max-request-size: 20MB |
| | | # æå¡æ¨¡å |
| | | devtools: |
| | | restart: |
| | | # çé¨ç½²å¼å
³ |
| | | enabled: true |
| | | # devtools: |
| | | # restart: |
| | | # # çé¨ç½²å¼å
³ |
| | | # enabled: false |
| | | # redis é
ç½® |
| | | redis: |
| | | # å°å |
| | |
| | | |
| | | private int code; |
| | | |
| | | private String msg; |
| | | private String message; |
| | | |
| | | private T data; |
| | | |
| | |
| | | Result<T> apiResult = new Result<>(); |
| | | apiResult.setCode(code); |
| | | apiResult.setData(data); |
| | | apiResult.setMsg(msg); |
| | | apiResult.setMessage(msg); |
| | | return apiResult; |
| | | } |
| | | |
| | |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getMsg() |
| | | public String getMessage() |
| | | { |
| | | return msg; |
| | | return message; |
| | | } |
| | | |
| | | public void setMsg(String msg) |
| | | public void setMessage(String message) |
| | | { |
| | | this.msg = msg; |
| | | this.message = message; |
| | | } |
| | | |
| | | public T getData() |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils; |
| | | |
| | | import javax.imageio.ImageIO; |
| | | import java.awt.*; |
| | | import java.awt.font.FontRenderContext; |
| | | import java.awt.geom.Rectangle2D; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | |
| | | /** |
| | | * @Author zhuo |
| | | * @Date 2024/9/28 |
| | | */ |
| | | public class DateImageUtil { |
| | | |
| | | /** |
| | | * çæ å½åæ¥æçç»å¸ |
| | | * @return |
| | | */ |
| | | public static InputStream createDateImage(LocalDateTime date) { |
| | | int width = 80; |
| | | int height = 20; |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy.MM.dd"); |
| | | if (date == null) { |
| | | date = LocalDateTime.now(); |
| | | } |
| | | String s = date.format(formatter); |
| | | |
| | | Font font = new Font("Serif", Font.BOLD, 10); |
| | | // å建ä¸ä¸ªç»å¸ï¼èæ¯éæï¼ |
| | | BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); |
| | | // è·åç»å¸çç»ç¬ |
| | | Graphics2D g2 = (Graphics2D) bi.getGraphics(); |
| | | // å¼å§ç»å¾ |
| | | g2.setComposite(AlphaComposite.Src); // ç¡®ä¿ç»å¾æ¶æ¯éæèæ¯ |
| | | g2.setBackground(new Color(0, 0, 0, 0)); // èæ¯è²ä¸ºéæ |
| | | g2.clearRect(0, 0, width, height); |
| | | g2.setPaint(new Color(0, 0, 0)); // 设置ç»å¶é¢è² |
| | | FontRenderContext context = g2.getFontRenderContext(); |
| | | Rectangle2D bounds = font.getStringBounds(s, context); |
| | | double x = (width - bounds.getWidth()) / 2; |
| | | double y = (height - bounds.getHeight()) / 2; |
| | | double ascent = -bounds.getY(); |
| | | double baseY = y + ascent; |
| | | g2.drawString(s, (int) x, (int) baseY); |
| | | g2.dispose(); // éæ¾ç»ç¬èµæº |
| | | ByteArrayOutputStream os = new ByteArrayOutputStream(); |
| | | |
| | | try { |
| | | ImageIO.write(bi, "png", os); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return new ByteArrayInputStream(os.toByteArray()); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | //package com.ruoyi.framework.config; |
| | | // |
| | | //import com.fasterxml.jackson.databind.DeserializationFeature; |
| | | //import com.fasterxml.jackson.databind.ObjectMapper; |
| | | //import com.fasterxml.jackson.databind.SerializationFeature; |
| | | //import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; |
| | | //import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; |
| | | //import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; |
| | | //import org.springframework.beans.factory.annotation.Value; |
| | | //import org.springframework.context.annotation.Configuration; |
| | | //import org.springframework.http.converter.HttpMessageConverter; |
| | | //import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; |
| | | //import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; |
| | | //import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; |
| | | // |
| | | //import java.text.SimpleDateFormat; |
| | | //import java.time.LocalDateTime; |
| | | //import java.time.format.DateTimeFormatter; |
| | | //import java.util.List; |
| | | // |
| | | //@Configuration |
| | | //public class FormatterConfig extends WebMvcConfigurationSupport { |
| | | // |
| | | // |
| | | // @Value("${spring.jackson.date-format}") |
| | | // private String pattern; |
| | | // |
| | | // // å
¨å±æ ¼å¼åå¤ç |
| | | // @Override |
| | | // protected void extendMessageConverters(List<HttpMessageConverter<?>> converters) { |
| | | // Jackson2ObjectMapperBuilder json = Jackson2ObjectMapperBuilder.json(); |
| | | // MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); |
| | | // |
| | | // //localDateTimeæ ¼å¼å |
| | | // JavaTimeModule module = new JavaTimeModule(); |
| | | // LocalDateTimeDeserializer dateTimeDeserializer = new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern(pattern)); |
| | | // LocalDateTimeSerializer dateTimeSerializer = new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(pattern)); |
| | | // module.addDeserializer(LocalDateTime.class, dateTimeDeserializer); |
| | | // module.addSerializer(LocalDateTime.class, dateTimeSerializer); |
| | | // ObjectMapper objectMapper = json.modules(module) |
| | | // .featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS).build(); |
| | | // |
| | | // //dateæ¶é´æ ¼å¼å |
| | | // objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); |
| | | // objectMapper.setDateFormat(new SimpleDateFormat(pattern.split(" ")[0])); |
| | | // |
| | | // // è®¾ç½®æ ¼å¼åå
容 |
| | | // converter.setObjectMapper(objectMapper); |
| | | // converters.add(0, converter); |
| | | // } |
| | | //} |
| | |
| | | package com.ruoyi.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.common.core.domain.entity.User; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ç¨æ·ä¿¡æ¯è¡¨ |
| | |
| | | */ |
| | | public interface UserMapper extends BaseMapper<User> { |
| | | |
| | | /** |
| | | * æ ¹æ®æ¡ä»¶è·åç¨æ·å表 |
| | | * @param ew |
| | | * @param type |
| | | * @return |
| | | */ |
| | | List<User> selectUserCondition(@Param("ew") QueryWrapper<User> ew, @Param("type") String type); |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.core.domain.entity.User; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ç¨æ·ä¿¡æ¯è¡¨ |
| | | * |
| | |
| | | */ |
| | | public interface UserService extends IService<User> { |
| | | |
| | | |
| | | /** |
| | | * æ ¹æ®æ¡ä»¶è·åç¨æ·å表 |
| | | * @param user |
| | | * @param type |
| | | * @return |
| | | */ |
| | | List<User> selectUserCondition(User user, String type); |
| | | } |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.domain.entity.User; |
| | | import com.ruoyi.common.utils.QueryWrappers; |
| | | import com.ruoyi.system.mapper.UserMapper; |
| | | import com.ruoyi.system.service.UserService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ç¨æ·ä¿¡æ¯è¡¨ |
| | |
| | | @Service |
| | | public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService { |
| | | |
| | | /** |
| | | * æ ¹æ®æ¡ä»¶è·åç¨æ·å表 |
| | | * @param user |
| | | * @param type |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<User> selectUserCondition(User user, String type) { |
| | | return baseMapper.selectUserCondition(QueryWrappers.queryWrappers(user), type); |
| | | } |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
| | | <mapper namespace="com.ruoyi.system.mapper.UserMapper"> |
| | | |
| | | <!--æ ¹æ®æ¡ä»¶è·åç¨æ·å表--> |
| | | <select id="selectUserCondition" resultType="com.ruoyi.common.core.domain.entity.User"> |
| | | select * from (select id, |
| | | dept_id, |
| | | account, |
| | | name, |
| | | name_en, |
| | | user_type, |
| | | email, |
| | | phone, |
| | | sex, |
| | | age, |
| | | signature_url, |
| | | picture_url, |
| | | status, |
| | | del_flag, |
| | | login_ip, |
| | | login_date, |
| | | depart_lims_id, |
| | | company, |
| | | is_custom |
| | | from user |
| | | where del_flag = '0') a |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | </select> |
| | | </mapper> |