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 1076d985b..68aeac7d0 100644 --- a/src/main/java/com/glxp/api/controller/inout/IoCodeTempController.java +++ b/src/main/java/com/glxp/api/controller/inout/IoCodeTempController.java @@ -2,6 +2,7 @@ package com.glxp.api.controller.inout; import com.glxp.api.annotation.CusRedissonAnnotation; import com.glxp.api.constant.*; +import com.glxp.api.entity.basic.*; import com.glxp.api.entity.inv.InvProductDetailEntity; import com.glxp.api.service.inout.impl.IoCodeService; import com.glxp.api.service.inv.impl.InvProductDetailService; @@ -19,10 +20,6 @@ import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.controller.BaseController; import com.glxp.api.entity.auth.AuthAdmin; import com.glxp.api.entity.auth.InvWarehouseEntity; -import com.glxp.api.entity.basic.BasicBussinessTypeEntity; -import com.glxp.api.entity.basic.BasicCorpEntity; -import com.glxp.api.entity.basic.UdiEntity; -import com.glxp.api.entity.basic.UdiProductEntity; import com.glxp.api.entity.inout.*; import com.glxp.api.entity.inv.InvPreInProductDetailEntity; import com.glxp.api.req.basic.CompanyProductRelevanceRequest; @@ -747,21 +744,21 @@ public class IoCodeTempController extends BaseController { if (IntUtil.value(bussinessTypeEntity.getUseDyCount()) == 2) { - if (bussinessTypeEntity.isScanPreIn() && checkDiAttribute(bussinessTypeEntity, udiRelevanceResponse, 2)) { //校验预验收库存 + if (bussinessTypeEntity.isScanPreIn() && checkDiAttribute(bussinessTypeEntity, udiRelevanceResponse.getId(), 2)) { //校验预验收库存 BaseResponse invRes = checkPreInInv(bussinessTypeEntity, codeEnttity, false); if (invRes != null) { deleteEmptyBillNo(orderEntity); return invRes; } } - if (bussinessTypeEntity.isAdvancePreIn() && checkDiAttribute(bussinessTypeEntity, udiRelevanceResponse, 3)) { //校验寄售库存 + if (bussinessTypeEntity.isAdvancePreIn() && checkDiAttribute(bussinessTypeEntity, udiRelevanceResponse.getId(), 3)) { //校验寄售库存 BaseResponse invRes = checkPreInv(bussinessTypeEntity, codeEnttity, false); if (invRes != null) { deleteEmptyBillNo(orderEntity); return invRes; } } - if (bussinessTypeEntity.isVailInv() && checkDiAttribute(bussinessTypeEntity, udiRelevanceResponse, 1)) { + if (bussinessTypeEntity.isVailInv() && checkDiAttribute(bussinessTypeEntity, udiRelevanceResponse.getId(), 1)) { BaseResponse invRes = checkInv(bussinessTypeEntity, codeEnttity, false); if (invRes != null) { deleteEmptyBillNo(orderEntity); @@ -1358,11 +1355,11 @@ public class IoCodeTempController extends BaseController { codeTempService.updateById(codeTempEntity); BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction(tempEntity.getAction()); BaseResponse invRes = null; - if (bussinessTypeEntity.isScanPreIn()) { //校验预验收库存 + if (bussinessTypeEntity.isScanPreIn() && checkDiAttribute(bussinessTypeEntity, codeTempEntity.getRelId(), 2)) { //校验预验收库存 invRes = checkPreInInv(bussinessTypeEntity, codeTempEntity, true); - } else if (bussinessTypeEntity.isAdvancePreIn()) { //校验寄售库存 + } else if (bussinessTypeEntity.isAdvancePreIn() && checkDiAttribute(bussinessTypeEntity, codeTempEntity.getRelId(), 3)) { //校验寄售库存 invRes = checkPreInv(bussinessTypeEntity, codeTempEntity, true); - } else { + } else if (bussinessTypeEntity.isAdvancePreIn() && checkDiAttribute(bussinessTypeEntity, codeTempEntity.getRelId(), 1)) { invRes = checkInv(bussinessTypeEntity, codeTempEntity, true); } if (invRes != null) { @@ -1850,18 +1847,28 @@ public class IoCodeTempController extends BaseController { } /** - * @param udiRelevanceResponse - * @param purType 1:入账库;2:预验收库;3:寄售库 + * @param purType 1:入账库;2:预验收库;3:寄售库 */ - public boolean checkDiAttribute(BasicBussinessTypeEntity bussinessTypeEntity, UdiRelevanceResponse udiRelevanceResponse, Integer purType) { + public boolean checkDiAttribute(BasicBussinessTypeEntity bussinessTypeEntity, UdiRelevanceResponse udiRelevanceEntity, Integer purType) { if (bussinessTypeEntity.getUseDyCount() == 2) { - if (IntUtil.value(udiRelevanceResponse.getPurType()) == IntUtil.value(purType)) { + if (IntUtil.value(udiRelevanceEntity.getPurType()) == IntUtil.value(purType)) { return true; } else return false; } + return true; + } - + /** + * + */ + public boolean checkDiAttribute(BasicBussinessTypeEntity bussinessTypeEntity, Long relId, Integer purType) { + if (bussinessTypeEntity.getUseDyCount() == 2) { + if (udiRelevanceService.findPurType(relId) == IntUtil.value(purType)) { + return true; + } else + return false; + } return true; } } diff --git a/src/main/java/com/glxp/api/service/basic/impl/UdiRelevanceServiceImpl.java b/src/main/java/com/glxp/api/service/basic/impl/UdiRelevanceServiceImpl.java index e83614069..dfd6ab357 100644 --- a/src/main/java/com/glxp/api/service/basic/impl/UdiRelevanceServiceImpl.java +++ b/src/main/java/com/glxp/api/service/basic/impl/UdiRelevanceServiceImpl.java @@ -419,6 +419,8 @@ public class UdiRelevanceServiceImpl extends ServiceImpl().select("purType").eq("id", relId).last("limit 1")); + if (udiRelevanceEntity == null) + return 0; return IntUtil.value(udiRelevanceEntity.getPurType()); } diff --git a/src/main/java/com/glxp/api/service/inout/IoAddInoutService.java b/src/main/java/com/glxp/api/service/inout/IoAddInoutService.java index 843cfd89d..2253fd364 100644 --- a/src/main/java/com/glxp/api/service/inout/IoAddInoutService.java +++ b/src/main/java/com/glxp/api/service/inout/IoAddInoutService.java @@ -1003,8 +1003,6 @@ public class IoAddInoutService { } else return false; } - - return true; } diff --git a/src/main/java/com/glxp/api/service/inout/IoChangeInoutService.java b/src/main/java/com/glxp/api/service/inout/IoChangeInoutService.java index b9610dd95..a933ebadb 100644 --- a/src/main/java/com/glxp/api/service/inout/IoChangeInoutService.java +++ b/src/main/java/com/glxp/api/service/inout/IoChangeInoutService.java @@ -1,7 +1,9 @@ package com.glxp.api.service.inout; +import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.glxp.api.entity.basic.UdiRelevanceEntity; +import com.glxp.api.req.thrsys.UdiwmsOrderDetailRequest; import com.glxp.api.service.basic.UdiRelevanceService; import com.glxp.api.service.inout.impl.IoCodeService; import com.glxp.api.service.inv.impl.InvProductDetailService; @@ -29,6 +31,7 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.*; +import java.util.stream.Collectors; /** * 单据流转 @@ -214,7 +217,21 @@ public class IoChangeInoutService { } } if (CollUtil.isNotEmpty(groupBuyList)) { - buildGenOrder(targetBustypeEntity, bussinessChangeTypeEntity, groupBuyList, orderEntity, isGenInovice); + String value = systemParamConfigService.selectValueByParamKey("split_groupbuy"); + if (IntUtil.value(value) > 0) { + Map> splitMap = groupBuyList.stream() + .collect(Collectors.groupingBy(IoCodeEntity::getRelId)); + if (splitMap.size() > 1) { + for (List splitItems : splitMap.values()) { + buildGenOrder(targetBustypeEntity, bussinessChangeTypeEntity, splitItems, orderEntity, isGenInovice); + } + } + + } else { + buildGenOrder(targetBustypeEntity, bussinessChangeTypeEntity, groupBuyList, orderEntity, isGenInovice); + } + + } if (CollUtil.isNotEmpty(unGroupBuyList)) { buildGenOrder(targetBustypeEntity, bussinessChangeTypeEntity, unGroupBuyList, orderEntity, isGenInovice); diff --git a/src/main/resources/schemas/schema_v2.2.sql b/src/main/resources/schemas/schema_v2.2.sql index 1398eaff6..4af52bf95 100644 --- a/src/main/resources/schemas/schema_v2.2.sql +++ b/src/main/resources/schemas/schema_v2.2.sql @@ -285,3 +285,7 @@ CALL Pro_Temp_ColumnWork('inv_pre_product_detail', 'outFlag', 'tinyint', 1); CALL Pro_Temp_ColumnWork('inv_prein_product_detail', 'outFlag', 'tinyint', 1); CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'lyInvType', 'tinyint', 1); + +INSERT ignore INTO sys_param_config(`id`, `parentId`, `paramName`, `paramKey`, `paramValue`, `paramStatus`, `paramType`, + `paramExplain`, `updateTime`) +VALUES (20110, 0, '集采是否按产品拆单', 'split_groupbuy', '0', 1, 0, '当单据类型设置为按集采与非集采拆单是,此配置有效,0:否;1:是', '2024-02-29 09:47:08');