diff --git a/src/main/java/com/glxp/api/controller/inout/IoCodeTempController.java b/src/main/java/com/glxp/api/controller/inout/IoCodeTempController.java index 6e77a5a1..6293112a 100644 --- a/src/main/java/com/glxp/api/controller/inout/IoCodeTempController.java +++ b/src/main/java/com/glxp/api/controller/inout/IoCodeTempController.java @@ -572,13 +572,26 @@ public class IoCodeTempController extends BaseController { } //产品是否可以以使用单元入库 udiRelevanceResponses = udiRelevanceService.selectGroupByNameCode(codeEnttity.getNameCode(), false); - if (udiRelevanceResponses.size() == 1) { + if (udiRelevanceResponses.size() >= 1) { UdiRelevanceResponse udiRelevanceResponse = udiRelevanceResponses.get(0); if (udiRelevanceResponse == null) { return ResultVOUtils.error(500, "该产品信息未维护!"); } else if (!udiRelevanceResponse.getUseDy() && udiRelevanceResponse.getDiType() == ConstantStatus.DITYPE_SYDY) { return ResultVOUtils.error(500, "该产品不允许以使用单元入库!"); } + + if (bussinessTypeEntity.isVailDispatch() && !udiRelevanceResponse.isDispatch()) { + return ResultVOUtils.error(500, "该产品不可配送,请联系院方!"); + } + + if (bussinessTypeEntity.getVailGroupBuy() == 1 && !udiRelevanceResponse.isGroupBuy()) { //只采集集采产品 + return ResultVOUtils.error(500, bussinessTypeEntity.getName() + "单只允许录入集采产品!"); + } + + if (bussinessTypeEntity.getVailGroupBuy() == 2 && udiRelevanceResponse.isGroupBuy()) { //只采集非集采产品 + return ResultVOUtils.error(500, bussinessTypeEntity.getName() + "单只允许录入非集采产品!"); + } + //计算实际数量 codeEnttity.setReCount(codeEnttity.getMyCount() * udiCalCountUtil.getActCount(udiRelevanceResponse)); } else if (udiRelevanceResponses.size() == 0) { diff --git a/src/main/java/com/glxp/api/controller/purchase/SupProductController.java b/src/main/java/com/glxp/api/controller/purchase/SupProductController.java index bc836da1..251d0be3 100644 --- a/src/main/java/com/glxp/api/controller/purchase/SupProductController.java +++ b/src/main/java/com/glxp/api/controller/purchase/SupProductController.java @@ -10,6 +10,7 @@ import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.constant.ConstantStatus; import com.glxp.api.entity.auth.AuthAdmin; +import com.glxp.api.entity.basic.UdiRelevanceEntity; import com.glxp.api.entity.purchase.SupCertEntity; import com.glxp.api.entity.purchase.SupCertSetEntity; import com.glxp.api.entity.purchase.SupManufacturerEntity; @@ -105,14 +106,14 @@ public class SupProductController { ListIterator iterable = supCertSetEntities.listIterator(); while (iterable.hasNext()) { SupCertSetEntity supCertSetEntity = iterable.next(); - if (supCertSetEntity.getImports()!=null && supCertSetEntity.getImports() == 1 || StrUtil.isNotEmpty(supCertSetEntity.getCplx()) && supCertSetEntity.getCplx().equals("全部") + if (supCertSetEntity.getImports() != null && supCertSetEntity.getImports() == 1 || StrUtil.isNotEmpty(supCertSetEntity.getCplx()) && supCertSetEntity.getCplx().equals("全部") || StrUtil.isNotEmpty(supCertSetEntity.getHchzsb()) && supCertSetEntity.getHchzsb().equals("全部") || (supCertSetEntity.getImports() != null && supCertSetEntity.getImports() == 2 && StrUtil.trimToEmpty(supProductEntity.getRecordCode()).contains("进")) || (supCertSetEntity.getImports() != null && supCertSetEntity.getImports() == 3 && !StrUtil.trimToEmpty(supProductEntity.getRecordCode()).contains("进")) || (StrUtil.trimToEmpty(supProductEntity.getProductType()).equals(supCertSetEntity.getCplx())) || (StrUtil.trimToEmpty(supProductEntity.getHchzsb()).equals(supCertSetEntity.getHchzsb())) - || StrUtil.isNotEmpty(supCertSetEntity.getFlbm()) &&(supCertSetEntity.getFlbm().contains(StrUtil.trimToEmpty(supProductEntity.getProductDirectoryCode()))) + || StrUtil.isNotEmpty(supCertSetEntity.getFlbm()) && (supCertSetEntity.getFlbm().contains(StrUtil.trimToEmpty(supProductEntity.getProductDirectoryCode()))) ) { for (SupCertEntity supCertEntity : supCertEntityList) { if (supCertEntity.getName().equals(supCertSetEntity.getName())) { @@ -188,59 +189,59 @@ public class SupProductController { } //判断是不是存在草稿 List supCertEntityList1 = supCertService.findAll(supProductEntity.getCustomerId(), supProductEntity.getManufacturerIdFk(), supProductEntity.getProductId()); - for(SupCertEntity obj:supCertEntityList1){ - if(obj.getAuditStatus()==0){ - return ResultVOUtils.error(999,"证书中存在草稿不允许提交!"); + for (SupCertEntity obj : supCertEntityList1) { + if (obj.getAuditStatus() == 0) { + return ResultVOUtils.error(999, "证书中存在草稿不允许提交!"); } } //提交审核 if (supProductEntity.getAuditStatus() == ConstantStatus.AUDIT_CHANGE || supProductEntity.getAuditStatus() == ConstantStatus.AUDIT_UN) { - //判断是否上级供应商是否审核通过 + //判断是否上级供应商是否审核通过 - SupManufacturerEntity supManufacturerEntity = supManufacturerService.findManufacturer(supProductEntity.getManufacturerIdFk()); - if (supManufacturerEntity.getAuditStatus() == ConstantStatus.AUDIT_UN - || supManufacturerEntity.getAuditStatus() == ConstantStatus.AUDIT_DRAFT) { - return ResultVOUtils.error(500, "所属生产企业资质未通过审核,暂时无法提交!"); - } - - //验证证书是否齐全 - FilterCertSetsRequest filterCertSetsRequest = new FilterCertSetsRequest(); - filterCertSetsRequest.setType(ConstantStatus.CERT_PRODUCT); - List supCertSetEntities = supCertSetService.filterCertSets(filterCertSetsRequest); - List supCertEntityList = supCertService.findAll(supProductEntity.getCustomerId(), supProductEntity.getManufacturerIdFk(), supProductEntity.getProductId()); - ListIterator iterable = supCertSetEntities.listIterator(); - while (iterable.hasNext()) { - SupCertSetEntity supCertSetEntity = iterable.next(); + SupManufacturerEntity supManufacturerEntity = supManufacturerService.findManufacturer(supProductEntity.getManufacturerIdFk()); + if (supManufacturerEntity.getAuditStatus() == ConstantStatus.AUDIT_UN + || supManufacturerEntity.getAuditStatus() == ConstantStatus.AUDIT_DRAFT) { + return ResultVOUtils.error(500, "所属生产企业资质未通过审核,暂时无法提交!"); + } - if (supCertSetEntity.getImports()!=null && supCertSetEntity.getImports() == 1 || StrUtil.isNotEmpty(supCertSetEntity.getCplx()) && supCertSetEntity.getCplx().equals("全部") - || StrUtil.isNotEmpty(supCertSetEntity.getHchzsb()) && supCertSetEntity.getHchzsb().equals("全部") - || (supCertSetEntity.getImports() != null && supCertSetEntity.getImports() == 2 - && StrUtil.trimToEmpty(supProductEntity.getRecordCode()).contains("进")) - || (supCertSetEntity.getImports() != null && supCertSetEntity.getImports() == 3 && !StrUtil.trimToEmpty(supProductEntity.getRecordCode()).contains("进")) - || (StrUtil.trimToEmpty(supProductEntity.getProductType()).equals(supCertSetEntity.getCplx())) - || (StrUtil.trimToEmpty(supProductEntity.getHchzsb()).equals(supCertSetEntity.getHchzsb())) - || StrUtil.isNotEmpty(supCertSetEntity.getFlbm()) &&(supCertSetEntity.getFlbm().contains(StrUtil.trimToEmpty(supProductEntity.getProductDirectoryCode()))) - ) { - for (SupCertEntity supCertEntity : supCertEntityList) { - if (supCertEntity.getName().equals(supCertSetEntity.getName())) { - if (StrUtil.isNotEmpty(supCertEntity.getFilePath())) { - iterable.remove(); - break; - } + //验证证书是否齐全 + FilterCertSetsRequest filterCertSetsRequest = new FilterCertSetsRequest(); + filterCertSetsRequest.setType(ConstantStatus.CERT_PRODUCT); + List supCertSetEntities = supCertSetService.filterCertSets(filterCertSetsRequest); + List supCertEntityList = supCertService.findAll(supProductEntity.getCustomerId(), supProductEntity.getManufacturerIdFk(), supProductEntity.getProductId()); + ListIterator iterable = supCertSetEntities.listIterator(); + while (iterable.hasNext()) { + SupCertSetEntity supCertSetEntity = iterable.next(); + + if (supCertSetEntity.getImports() != null && supCertSetEntity.getImports() == 1 || StrUtil.isNotEmpty(supCertSetEntity.getCplx()) && supCertSetEntity.getCplx().equals("全部") + || StrUtil.isNotEmpty(supCertSetEntity.getHchzsb()) && supCertSetEntity.getHchzsb().equals("全部") + || (supCertSetEntity.getImports() != null && supCertSetEntity.getImports() == 2 + && StrUtil.trimToEmpty(supProductEntity.getRecordCode()).contains("进")) + || (supCertSetEntity.getImports() != null && supCertSetEntity.getImports() == 3 && !StrUtil.trimToEmpty(supProductEntity.getRecordCode()).contains("进")) + || (StrUtil.trimToEmpty(supProductEntity.getProductType()).equals(supCertSetEntity.getCplx())) + || (StrUtil.trimToEmpty(supProductEntity.getHchzsb()).equals(supCertSetEntity.getHchzsb())) + || StrUtil.isNotEmpty(supCertSetEntity.getFlbm()) && (supCertSetEntity.getFlbm().contains(StrUtil.trimToEmpty(supProductEntity.getProductDirectoryCode()))) + ) { + for (SupCertEntity supCertEntity : supCertEntityList) { + if (supCertEntity.getName().equals(supCertSetEntity.getName())) { + if (StrUtil.isNotEmpty(supCertEntity.getFilePath())) { + iterable.remove(); + break; } } - } else { - iterable.remove(); } + } else { + iterable.remove(); } - String errMsg = ""; - if (supCertSetEntities.size() > 0) { - for (SupCertSetEntity supCertSetEntity : supCertSetEntities) { - errMsg = errMsg + "," + supCertSetEntity.getName(); - } - return ResultVOUtils.error(500, errMsg.substring(1) + "等证书未上传,无法提交审核!"); + } + String errMsg = ""; + if (supCertSetEntities.size() > 0) { + for (SupCertSetEntity supCertSetEntity : supCertSetEntities) { + errMsg = errMsg + "," + supCertSetEntity.getName(); } + return ResultVOUtils.error(500, errMsg.substring(1) + "等证书未上传,无法提交审核!"); + } } supProductEntity.setUpdateTime(new Date()); @@ -263,7 +264,7 @@ public class SupProductController { if (supProductEntity.getAuditStatus() == null) { return ResultVOUtils.error(500, "参数错误!"); } - if(supProductEntity.getAuditStatus()==1){ + if (supProductEntity.getAuditStatus() == 1) { //查询用户上传的证书 FilterSupCertRequest filterSupCertRequest = new FilterSupCertRequest(); filterSupCertRequest.setCustomerId(supProductEntity.getCustomerId()); @@ -281,14 +282,14 @@ public class SupProductController { while (iterable.hasNext()) { SupCertSetEntity supCertSetEntity = iterable.next(); - if (supCertSetEntity.getImports()!=null && supCertSetEntity.getImports() == 1 || StrUtil.isNotEmpty(supCertSetEntity.getCplx()) && supCertSetEntity.getCplx().equals("全部") + if (supCertSetEntity.getImports() != null && supCertSetEntity.getImports() == 1 || StrUtil.isNotEmpty(supCertSetEntity.getCplx()) && supCertSetEntity.getCplx().equals("全部") || StrUtil.isNotEmpty(supCertSetEntity.getHchzsb()) && supCertSetEntity.getHchzsb().equals("全部") || (supCertSetEntity.getImports() != null && supCertSetEntity.getImports() == 2 && StrUtil.trimToEmpty(supProductEntity.getRecordCode()).contains("进")) || (supCertSetEntity.getImports() != null && supCertSetEntity.getImports() == 3 && !StrUtil.trimToEmpty(supProductEntity.getRecordCode()).contains("进")) || (StrUtil.trimToEmpty(supProductEntity.getProductType()).equals(supCertSetEntity.getCplx())) || (StrUtil.trimToEmpty(supProductEntity.getHchzsb()).equals(supCertSetEntity.getHchzsb())) - || StrUtil.isNotEmpty(supCertSetEntity.getFlbm()) &&(supCertSetEntity.getFlbm().contains(StrUtil.trimToEmpty(supProductEntity.getProductDirectoryCode()))) + || StrUtil.isNotEmpty(supCertSetEntity.getFlbm()) && (supCertSetEntity.getFlbm().contains(StrUtil.trimToEmpty(supProductEntity.getProductDirectoryCode()))) ) { for (SupCertEntity supCertEntity : supCertEntityList) { if (supCertEntity.getName().equals(supCertSetEntity.getName())) { @@ -334,6 +335,14 @@ public class SupProductController { supProductEntity.setUpdateTime(new Date()); boolean b = supProductService.modifyRegistration(supProductEntity); + if (StrUtil.isNotEmpty(supProductEntity.getRelIdFk())) { + UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(Long.parseLong(supProductEntity.getRelIdFk())); + if (udiRelevanceEntity != null) { + udiRelevanceEntity.setDispatch(true); + udiRelevanceService.updateUdiRelevance(udiRelevanceEntity); + } + + } // if (supProductEntity.getAuditStatus() == ConstantStatus.AUDIT_PASS) { // SupProductResponse supProductResponse = supProductService.findJoinRegistration(supProductEntity.getId()); diff --git a/src/main/java/com/glxp/api/entity/basic/UdiRelevanceEntity.java b/src/main/java/com/glxp/api/entity/basic/UdiRelevanceEntity.java index 0f0d9dde..bdb0291f 100644 --- a/src/main/java/com/glxp/api/entity/basic/UdiRelevanceEntity.java +++ b/src/main/java/com/glxp/api/entity/basic/UdiRelevanceEntity.java @@ -157,5 +157,10 @@ public class UdiRelevanceEntity { @TableField(value = "remark") private String remark; - + @TableField(value = "useExpireTime") + private Integer useExpireTime; + @TableField(value = "dispatch") + private boolean dispatch; + @TableField(value = "groupBuy") //是否可配送 + private boolean groupBuy; //是否集采产品 }