diff --git a/src/main/java/com/glxp/api/controller/inout/IoOrderController.java b/src/main/java/com/glxp/api/controller/inout/IoOrderController.java index 9d7d475b..dec6b676 100644 --- a/src/main/java/com/glxp/api/controller/inout/IoOrderController.java +++ b/src/main/java/com/glxp/api/controller/inout/IoOrderController.java @@ -43,6 +43,7 @@ import com.glxp.api.util.OrderNoTypeBean; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.scheduling.annotation.Async; @@ -798,6 +799,10 @@ public class IoOrderController extends BaseController { List ioOrderInvoiceEntity = orderInvoiceService.list(ew); List orderIds = ioOrderInvoiceEntity.stream().map(IoOrderInvoiceEntity::getOrderIdFk).collect(Collectors.toList()); filterOrderRequest.setOrderIds(orderIds); + if(CollectionUtils.isEmpty(orderIds)){ + PageInfo pageInfo = new PageInfo<>(); + return ResultVOUtils.page(pageInfo); + } } diff --git a/src/main/java/com/glxp/api/controller/inout/IoOrderInvoiceController.java b/src/main/java/com/glxp/api/controller/inout/IoOrderInvoiceController.java index 421176df..ca27b726 100644 --- a/src/main/java/com/glxp/api/controller/inout/IoOrderInvoiceController.java +++ b/src/main/java/com/glxp/api/controller/inout/IoOrderInvoiceController.java @@ -27,6 +27,7 @@ import com.glxp.api.service.auth.CustomerService; import com.glxp.api.service.inout.IoOrderDetailBizService; import com.glxp.api.service.inout.IoOrderDetailCodeService; import com.glxp.api.service.inout.impl.IoOrderInvoiceService; +import org.apache.commons.collections.CollectionUtils; import org.springframework.beans.BeanUtils; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -193,4 +194,20 @@ public class IoOrderInvoiceController { else return ResultVOUtils.error(500, "删除失败!"); } + + @AuthRuleAnnotation("") + @PostMapping("/udiwms/inout/invoice/checkInvoiceCode") + public BaseResponse checkInvoiceCode(@RequestBody DeleteRequest deleteRequest) { + if (StrUtil.isEmpty(deleteRequest.getInvoiceEncode())) + return ResultVOUtils.error(500, "发票编码不能为空"); + + List ioOrderInvoiceEntityList = ioOrderInvoiceService.list(new QueryWrapper().eq("invoiceEncode", deleteRequest.getInvoiceEncode())); + if (CollectionUtils.isNotEmpty(ioOrderInvoiceEntityList) && ioOrderInvoiceEntityList.size()>0){ + return ResultVOUtils.error(999,"发票编码已存在!"); + } + return ResultVOUtils.success(); + + } + + } diff --git a/src/main/java/com/glxp/api/service/inout/IoOrderUtilsService.java b/src/main/java/com/glxp/api/service/inout/IoOrderUtilsService.java index 4d765e11..5fd24c54 100644 --- a/src/main/java/com/glxp/api/service/inout/IoOrderUtilsService.java +++ b/src/main/java/com/glxp/api/service/inout/IoOrderUtilsService.java @@ -80,7 +80,7 @@ public class IoOrderUtilsService { ioCodeTempEntity1.setRelId(null); checkUdi = true; } else { - if(CollectionUtil.isNotEmpty(udiRlSupEntityList)) { + if (CollectionUtil.isNotEmpty(udiRlSupEntityList)) { ioCodeTempEntity1.setRelId(udiRlSupEntityList.get(0).getId()); map.put(ioCodeTempEntity.getRelId(), udiRlSupEntityList.get(0)); } @@ -110,41 +110,44 @@ public class IoOrderUtilsService { //扫码单据生成 IoOrderDetailCodeEntity ioOrderDetailCodeEntity1 = new IoOrderDetailCodeEntity(); List ioOrderDetailCodeEntities = new ArrayList<>(); - for (IoOrderDetailCodeEntity ioOrderDetailCodeEntity : ioOrderDetailCodeEntityList) { - ioOrderDetailCodeEntity1.setOrderIdFk(billNO); + if (CollectionUtil.isNotEmpty(ioOrderDetailCodeEntityList)) { + for (IoOrderDetailCodeEntity ioOrderDetailCodeEntity : ioOrderDetailCodeEntityList) { + ioOrderDetailCodeEntity1.setOrderIdFk(billNO); - ioOrderUploadRequest udiRlSupEntity = map.get(ioOrderDetailCodeEntity.getBindRlFk()); - if (udiRlSupEntity != null) { - ioOrderDetailCodeEntity1.setBindRlFk(udiRlSupEntity.getId()); - ioOrderDetailCodeEntity1.setUuidFk(udiRlSupEntity.getUdiRlIdFk() + ""); - } else { - ioOrderDetailCodeEntity1.setBindRlFk(null); - ioOrderDetailCodeEntity1.setUuidFk(null); + ioOrderUploadRequest udiRlSupEntity = map.get(ioOrderDetailCodeEntity.getBindRlFk()); + if (udiRlSupEntity != null) { + ioOrderDetailCodeEntity1.setBindRlFk(udiRlSupEntity.getId()); + ioOrderDetailCodeEntity1.setUuidFk(udiRlSupEntity.getUdiRlIdFk() + ""); + } else { + ioOrderDetailCodeEntity1.setBindRlFk(null); + ioOrderDetailCodeEntity1.setUuidFk(null); + } + ioOrderDetailCodeEntity1.setId(IdUtil.getSnowflakeNextId()); + ioOrderDetailCodeEntity1.setNameCode(ioOrderDetailCodeEntity.getNameCode()); + ioOrderDetailCodeEntity1.setBatchNo(ioOrderDetailCodeEntity.getBatchNo()); + ioOrderDetailCodeEntity1.setProductDate(ioOrderDetailCodeEntity.getProductDate()); + ioOrderDetailCodeEntity1.setExpireDate(ioOrderDetailCodeEntity.getExpireDate()); + ioOrderDetailCodeEntity1.setCoName(ioOrderDetailCodeEntity.getCoName()); + ioOrderDetailCodeEntity1.setCertCode(ioOrderDetailCodeEntity.getCertCode()); + ioOrderDetailCodeEntity1.setYlqxzcrbarmc(ioOrderDetailCodeEntity.getYlqxzcrbarmc()); + ioOrderDetailCodeEntity1.setManufacturer(ioOrderDetailCodeEntity.getManufacturer()); + ioOrderDetailCodeEntity1.setMeasname(ioOrderDetailCodeEntity.getMeasname()); + ioOrderDetailCodeEntity1.setPrice(ioOrderDetailCodeEntity.getPrice()); + ioOrderDetailCodeEntity1.setSpec(ioOrderDetailCodeEntity.getSpec()); + ioOrderDetailCodeEntity1.setCertCode(ioOrderDetailCodeEntity.getCertCode()); + ioOrderDetailCodeEntity1.setSupId(ioOrderDetailCodeEntity.getSupId()); + ioOrderDetailCodeEntity1.setBindSupStatus(ioOrderDetailCodeEntity.getBindSupStatus()); + ioOrderDetailCodeEntity1.setCount(ioOrderDetailCodeEntity.getCount()); + ioOrderDetailCodeEntity1.setReCount(ioOrderDetailCodeEntity.getReCount()); + ioOrderDetailCodeEntity1.setUpdateTime(new Date()); + ioOrderDetailCodeEntities.add(ioOrderDetailCodeEntity1); } - ioOrderDetailCodeEntity1.setId(IdUtil.getSnowflakeNextId()); - ioOrderDetailCodeEntity1.setNameCode(ioOrderDetailCodeEntity.getNameCode()); - ioOrderDetailCodeEntity1.setBatchNo(ioOrderDetailCodeEntity.getBatchNo()); - ioOrderDetailCodeEntity1.setProductDate(ioOrderDetailCodeEntity.getProductDate()); - ioOrderDetailCodeEntity1.setExpireDate(ioOrderDetailCodeEntity.getExpireDate()); - ioOrderDetailCodeEntity1.setCoName(ioOrderDetailCodeEntity.getCoName()); - ioOrderDetailCodeEntity1.setCertCode(ioOrderDetailCodeEntity.getCertCode()); - ioOrderDetailCodeEntity1.setYlqxzcrbarmc(ioOrderDetailCodeEntity.getYlqxzcrbarmc()); - ioOrderDetailCodeEntity1.setManufacturer(ioOrderDetailCodeEntity.getManufacturer()); - ioOrderDetailCodeEntity1.setMeasname(ioOrderDetailCodeEntity.getMeasname()); - ioOrderDetailCodeEntity1.setPrice(ioOrderDetailCodeEntity.getPrice()); - ioOrderDetailCodeEntity1.setSpec(ioOrderDetailCodeEntity.getSpec()); - ioOrderDetailCodeEntity1.setCertCode(ioOrderDetailCodeEntity.getCertCode()); - ioOrderDetailCodeEntity1.setSupId(ioOrderDetailCodeEntity.getSupId()); - ioOrderDetailCodeEntity1.setBindSupStatus(ioOrderDetailCodeEntity.getBindSupStatus()); - ioOrderDetailCodeEntity1.setCount(ioOrderDetailCodeEntity.getCount()); - ioOrderDetailCodeEntity1.setReCount(ioOrderDetailCodeEntity.getReCount()); - ioOrderDetailCodeEntity1.setUpdateTime(new Date()); - ioOrderDetailCodeEntities.add(ioOrderDetailCodeEntity1); } + //业务单生成 List ioOrderDetailBizEntities = new ArrayList<>(); - if (ioOrderDetailBizEntityList != null && ioOrderDetailBizEntityList.size() > 0) { + if (CollectionUtil.isNotEmpty(ioOrderDetailBizEntityList)) { for (IoOrderDetailBizEntity ioOrderDetailBizEntity : ioOrderDetailBizEntityList) { IoOrderDetailBizEntity ioOrderDetailBizEntity1 = new IoOrderDetailBizEntity(); ioOrderDetailBizEntity1.setOrderIdFk(billNO); diff --git a/src/main/java/com/glxp/api/service/inout/impl/IoOrderInvoiceService.java b/src/main/java/com/glxp/api/service/inout/impl/IoOrderInvoiceService.java index 1f0cbcd5..d8e66fec 100644 --- a/src/main/java/com/glxp/api/service/inout/impl/IoOrderInvoiceService.java +++ b/src/main/java/com/glxp/api/service/inout/impl/IoOrderInvoiceService.java @@ -87,6 +87,9 @@ public class IoOrderInvoiceService extends ServiceImpl