From 6dd0e0d4c527ce995f26a28396604804f335633d Mon Sep 17 00:00:00 2001 From: yewj Date: Mon, 26 Aug 2024 15:53:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=87=E6=8D=A2=E5=88=86=E6=94=AF=E5=A4=87?= =?UTF-8?q?=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/inout/IoAddInoutService.java | 5 ---- .../thrsys/impl/ThrInvOrderServiceImpl.java | 25 ++++++++++++++++--- src/main/resources/application-dev.yml | 4 +-- 3 files changed, 24 insertions(+), 10 deletions(-) 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 f9ce5fa6a..7f2533fcf 100644 --- a/src/main/java/com/glxp/api/service/inout/IoAddInoutService.java +++ b/src/main/java/com/glxp/api/service/inout/IoAddInoutService.java @@ -278,12 +278,7 @@ public class IoAddInoutService { } if (orderDetailBizEntity.getBindRlFk() == null) { - errMsg = errMsg + orderDetailBizEntity.getCoName() + "该产品未指定唯一耗材编码;"; - - } - if (StrUtil.isEmpty(orderDetailBizEntity.getSupId())) { - errMsg = errMsg + orderDetailBizEntity.getCoName() + "该产品未指定供应商;"; } if (IntUtil.value(orderDetailBizEntity.getCount()) == 0) { errMsg = errMsg + orderDetailBizEntity.getCoName() + "产品数量不能为0;"; diff --git a/src/main/java/com/glxp/api/service/thrsys/impl/ThrInvOrderServiceImpl.java b/src/main/java/com/glxp/api/service/thrsys/impl/ThrInvOrderServiceImpl.java index 7da7b7394..35782de84 100644 --- a/src/main/java/com/glxp/api/service/thrsys/impl/ThrInvOrderServiceImpl.java +++ b/src/main/java/com/glxp/api/service/thrsys/impl/ThrInvOrderServiceImpl.java @@ -23,6 +23,7 @@ import com.glxp.api.entity.basic.*; import com.glxp.api.entity.inout.IoCodeTempEntity; import com.glxp.api.entity.inout.IoOrderDetailBizEntity; import com.glxp.api.entity.inout.IoOrderEntity; +import com.glxp.api.entity.inv.InvProductEntity; import com.glxp.api.entity.thrsys.*; import com.glxp.api.exception.JsonException; import com.glxp.api.http.ErpInvClient; @@ -942,9 +943,27 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { item.setToBillNo(null); updateThrInvOrderDetails.add(item); //校验产品是否被供应商关联 - CompanyProductRelevanceEntity udiRlSupEntity = udiRlSupService.selOneByRlId(relId); - if (udiRlSupEntity != null) - item.setSupId(udiRlSupEntity.getCustomerId()); + List invProductEntities = invProductService.selectByRelId(relId, null, null, thrInvOrder.getInvCode()); + if (CollUtil.isNotEmpty(invProductEntities)) { + InvProductEntity invProductEntity1 = null; + for (InvProductEntity invProductEntity : invProductEntities) { + if (IntUtil.value(invProductEntity.getReCount()) > 0 && IntUtil.value(invProductEntity.getReCount()) > IntUtil.value(item.getReCount())) { + item.setSupId(invProductEntity.getSupId()); + break; + } else if (IntUtil.value(invProductEntity.getReCount()) > 0) { + //随机找一个有库存的供应商 + invProductEntity1 = invProductEntity; + } + } + if (StrUtil.isEmpty(item.getSupId()) && invProductEntity1 != null) { + item.setSupId(invProductEntity1.getSupId()); + } + } + if (StrUtil.isEmpty(item.getSupId())) { + CompanyProductRelevanceEntity udiRlSupEntity = udiRlSupService.selOneByRlId(relId); + if (udiRlSupEntity != null) + item.setSupId(udiRlSupEntity.getCustomerId()); + } } } }); diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index a2ecc2dc9..c3f8f2655 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -4,9 +4,9 @@ server: spring: datasource: driver-class-name: com.p6spy.engine.spy.P6SpyDriver - jdbc-url: jdbc:p6spy:mysql://127.0.0.1:3306/udi_wms_pt2?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true + jdbc-url: jdbc:p6spy:mysql://192.168.0.59:3306/udi_wms?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true username: root - password: 123456 + password: Glxp@6066 hikari: connection-timeout: 60000 maximum-pool-size: 20