From 487473f91c7c28ab4bc48dc4c78ac73c8dc6413a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=98=8E=E6=A2=81?= <2429105222@qq.com> Date: Thu, 8 Jun 2023 15:33:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E6=AC=A1=E5=87=BA=E5=BA=93bug?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inout/IoOrderMutiController.java | 103 +++++++++++------- src/main/java/com/glxp/api/util/IntUtil.java | 5 - .../mapper/inout/IoOrderMutiMapper.xml | 5 +- 3 files changed, 68 insertions(+), 45 deletions(-) diff --git a/src/main/java/com/glxp/api/controller/inout/IoOrderMutiController.java b/src/main/java/com/glxp/api/controller/inout/IoOrderMutiController.java index e434cc596..4ddb006da 100644 --- a/src/main/java/com/glxp/api/controller/inout/IoOrderMutiController.java +++ b/src/main/java/com/glxp/api/controller/inout/IoOrderMutiController.java @@ -74,10 +74,10 @@ public class IoOrderMutiController { //查询物资信息 UdiProductEntity udiProductEntity = udiProductService.selectUdiByName(udiEntity.getUdi()); - if(udiProductEntity.getUseMuti()==null || udiProductEntity.getUseMuti()==false){ + if (udiProductEntity.getUseMuti() == null || udiProductEntity.getUseMuti() == false) { return ResultVOUtils.error(999, "该产品不允许多次出库!"); - }else{ - if(udiProductEntity.getZdcfsycs() == null || udiProductEntity.getZdcfsycs().equals(0)){ + } else { + if (udiProductEntity.getZdcfsycs() == null || udiProductEntity.getZdcfsycs().equals(0)) { return ResultVOUtils.error(999, "该产品库存不足!"); } } @@ -94,6 +94,18 @@ public class IoOrderMutiController { } return ResultVOUtils.success(ioOrderMutiEntityOne.getId()); } else { + + if(StrUtil.isNotBlank(ioOrderMutiEntity.getMark())){ + QueryWrapper ew1=new QueryWrapper<>(); + ew1.eq("mark",ioOrderMutiEntity.getMark()); + long count = ioOrderMutiService.count(ew1); + if(count>0){ + return ResultVOUtils.error(999, "标志位已存在!"); + } + }else{ + return ResultVOUtils.error(999, "标志位不能为空!"); + } + ioOrderMutiEntityOne = new IoOrderMutiEntity(); ioOrderMutiEntityOne.setId(IdUtil.getSnowflakeNextId()); ioOrderMutiEntityOne.setRelIdFk(udiProductEntity.getRelId()); @@ -153,14 +165,26 @@ public class IoOrderMutiController { UdiEntity udiEntity = FilterUdiUtils.getUdi(ioOrderMutiEntity.getUdiCode()); //查询物资信息 UdiProductEntity udiProductEntity = udiProductService.selectUdiByName(udiEntity.getUdi()); - if(udiProductEntity.getUseMuti()==null || udiProductEntity.getUseMuti()==false){ + if (udiProductEntity.getUseMuti() == null || udiProductEntity.getUseMuti() == false) { return ResultVOUtils.error(999, "该产品不允许多次出库!"); - }else{ - if(udiProductEntity.getZdcfsycs() == null || udiProductEntity.getZdcfsycs().equals(0)){ + } else { + if (udiProductEntity.getZdcfsycs() == null || udiProductEntity.getZdcfsycs().equals(0)) { return ResultVOUtils.error(999, "该产品库存不足!"); } } + if(StrUtil.isNotBlank(ioOrderMutiEntity.getMark())){ + QueryWrapper ew=new QueryWrapper<>(); + ew.eq("mark",ioOrderMutiEntity.getMark()); + long count = ioOrderMutiService.count(ew); + if(count>0){ + return ResultVOUtils.error(999, "标志位已存在!"); + } + }else{ + return ResultVOUtils.error(999, "标志位不能为空!"); + } + + IoOrderMutiEntity ioOrderMutiEntity1 = new IoOrderMutiEntity(); ioOrderMutiEntity1.setId(IdUtil.getSnowflakeNextId()); ioOrderMutiEntity1.setRelIdFk(udiProductEntity.getRelId()); @@ -189,18 +213,19 @@ public class IoOrderMutiController { @PostMapping("/udiwms/inout/order/muti/updateOrderMuti") public BaseResponse updateOrderMuti(@RequestBody IoOrderMutiEntity ioOrderMutiEntity) { - String orderNo =ioOrderMutiEntity.getOrderIdFk(); + String orderNo = ioOrderMutiEntity.getOrderIdFk(); //如果是第一次的话就插入 - String mark=ioOrderMutiEntity.getMark(); - int totalCount=ioOrderMutiEntity.getTotalCount(); - int useCount=ioOrderMutiEntity.getUseCount(); - int status=ioOrderMutiEntity.getStatus(); - ioOrderMutiEntity= ioOrderMutiService.getById(ioOrderMutiEntity.getId()); + String mark = ioOrderMutiEntity.getMark(); + int totalCount = ioOrderMutiEntity.getTotalCount(); + int useCount = ioOrderMutiEntity.getUseCount(); + int status = ioOrderMutiEntity.getStatus(); + ioOrderMutiEntity = ioOrderMutiService.getById(ioOrderMutiEntity.getId()); ioOrderMutiEntity.setMark(mark); ioOrderMutiEntity.setTotalCount(totalCount); ioOrderMutiEntity.setUseCount(useCount); ioOrderMutiEntity.setStatus(status); - if (StrUtil.isBlank(ioOrderMutiEntity.getOrderIdFk())) { + System.out.println("1111111111111111"); + if (StrUtil.isBlank(ioOrderMutiEntity.getOrderIdFk()) && ioOrderMutiEntity.getStatus() == 1) { IoOrderEntity orderEntity = new IoOrderEntity(); //查询补单条件 AuthAdmin authAdmin = customerService.getUserBean(); @@ -263,7 +288,7 @@ public class IoOrderMutiController { ioOrderMutiEntity.setUpdateUser(customerService.getUserId() + ""); boolean falg = ioOrderMutiService.updateById(ioOrderMutiEntity); - + System.out.println("22222222222222222222222"); QueryWrapper ew = new QueryWrapper<>(); ew.eq("mutiIdFk", ioOrderMutiEntity.getId()); List ioOrderMutiUseEntityList = ioOrderMutiUseService.list(ew); @@ -271,7 +296,7 @@ public class IoOrderMutiController { ioOrderMutiUseEntity.setStatus(1); } ioOrderMutiUseService.updateBatchById(ioOrderMutiUseEntityList); - + System.out.println("33333333333333333333333"); if (falg) { return ResultVOUtils.success(); } else { @@ -285,24 +310,24 @@ public class IoOrderMutiController { //判断是不是个人使用 AuthAdmin authAdmin = customerService.getUserBean(); - QueryWrapper setEw=new QueryWrapper<>(); - setEw.eq("curInv",authAdmin.getLocInvCode()); - IoOrderMutiSetEntity ioOrderMutiSetEntity=ioOrderMutiSetService.getOne(setEw); - if(ioOrderMutiSetEntity!=null){ - if(ioOrderMutiSetEntity.getCheckUse()==1){ - ioOrderMutiRequest.setCreateUser(authAdmin.getId()+""); + QueryWrapper setEw = new QueryWrapper<>(); + setEw.eq("curInv", authAdmin.getLocInvCode()); + IoOrderMutiSetEntity ioOrderMutiSetEntity = ioOrderMutiSetService.getOne(setEw); + if (ioOrderMutiSetEntity != null) { + if (ioOrderMutiSetEntity.getCheckUse() == 1) { + ioOrderMutiRequest.setCreateUser(authAdmin.getId() + ""); } - }else{ - return ResultVOUtils.error(999,"请先设置多次出库单据类型!"); + } else { + return ResultVOUtils.error(999, "请先设置多次出库单据类型!"); } ioOrderMutiRequest.setStatus(0); List ioOrderMutiEntityList = ioOrderMutiService.filterList(ioOrderMutiRequest); - if(ioOrderMutiEntityList.size()<=0){ - return ResultVOUtils.error(999,"该产品不存在此标识!"); + if (ioOrderMutiEntityList.size() <= 0) { + return ResultVOUtils.error(999, "该产品不存在此标识!"); } - if(ioOrderMutiEntityList.get(0).getReCount()<=0){ - return ResultVOUtils.error(999,"该产品可使用数量不足!"); + if (ioOrderMutiEntityList.get(0).getReCount() <= 0) { + return ResultVOUtils.error(999, "该产品可使用数量不足!"); } return ResultVOUtils.success(ioOrderMutiEntityList.get(0)); } @@ -331,18 +356,18 @@ public class IoOrderMutiController { //判断是不是个人使用 AuthAdmin authAdmin = customerService.getUserBean(); - QueryWrapper setEw=new QueryWrapper<>(); - setEw.eq("curInv",authAdmin.getLocInvCode()); - IoOrderMutiSetEntity ioOrderMutiSetEntity=ioOrderMutiSetService.getOne(setEw); - if(ioOrderMutiSetEntity!=null){ - if(ioOrderMutiSetEntity.getCheckUse()==1){ - IoOrderMutiEntity ioOrderMutiEntity=ioOrderMutiService.getById(ioOrderMutiUseEntity.getMutiIdFk()); - if(!ioOrderMutiEntity.getCreateUser().equals(authAdmin.getId()+"")){ - return ResultVOUtils.error(999,"该单设置了个人使用,添加失败!"); + QueryWrapper setEw = new QueryWrapper<>(); + setEw.eq("curInv", authAdmin.getLocInvCode()); + IoOrderMutiSetEntity ioOrderMutiSetEntity = ioOrderMutiSetService.getOne(setEw); + if (ioOrderMutiSetEntity != null) { + if (ioOrderMutiSetEntity.getCheckUse() == 1) { + IoOrderMutiEntity ioOrderMutiEntity = ioOrderMutiService.getById(ioOrderMutiUseEntity.getMutiIdFk()); + if (!ioOrderMutiEntity.getCreateUser().equals(authAdmin.getId() + "")) { + return ResultVOUtils.error(999, "该单设置了个人使用,添加失败!"); } } - }else{ - return ResultVOUtils.error(999,"请先设置多次出库单据类型!"); + } else { + return ResultVOUtils.error(999, "请先设置多次出库单据类型!"); } int sum = 0; QueryWrapper ew = new QueryWrapper<>(); @@ -391,9 +416,9 @@ public class IoOrderMutiController { @PostMapping("/udiwms/inout/order/muti/auditMuti") public BaseResponse auditMuti(@RequestBody IoOrderMutiEntity ioOrderMutiEntity) { ioOrderMutiEntity.setUpdateTime(new Date()); - ioOrderMutiEntity.setUpdateUser(customerService.getUserId()+""); + ioOrderMutiEntity.setUpdateUser(customerService.getUserId() + ""); ioOrderMutiEntity.setAuditTime(new Date()); - ioOrderMutiEntity.setAuditUser(customerService.getUserId()+""); + ioOrderMutiEntity.setAuditUser(customerService.getUserId() + ""); ioOrderMutiService.updateById(ioOrderMutiEntity); return ResultVOUtils.success(); } diff --git a/src/main/java/com/glxp/api/util/IntUtil.java b/src/main/java/com/glxp/api/util/IntUtil.java index 74bbeae5a..9e8804887 100644 --- a/src/main/java/com/glxp/api/util/IntUtil.java +++ b/src/main/java/com/glxp/api/util/IntUtil.java @@ -23,9 +23,4 @@ public class IntUtil { else return value; } - public static boolean value(Boolean value) { - if (value == null) - return false; - else return value; - } } diff --git a/src/main/resources/mybatis/mapper/inout/IoOrderMutiMapper.xml b/src/main/resources/mybatis/mapper/inout/IoOrderMutiMapper.xml index 1f9c1553e..625cccb2d 100644 --- a/src/main/resources/mybatis/mapper/inout/IoOrderMutiMapper.xml +++ b/src/main/resources/mybatis/mapper/inout/IoOrderMutiMapper.xml @@ -17,6 +17,9 @@ and io.udiCode = #{udiCode} + + and b1.nameCode = #{relIdFk} + and io.mark = #{mark} @@ -43,7 +46,7 @@ '%Y-%m-%d') and date_format(#{endDate}, '%Y-%m-%d') - GROUP BY io.orderIdFk + GROUP BY io.id