From 38e19070fb2e4dd2e284085be40d13b4a8c75002 Mon Sep 17 00:00:00 2001 From: yewj Date: Thu, 29 Aug 2024 14:59:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=B3=E8=B0=AD=E5=87=BA=E5=BA=93=E6=89=A3?= =?UTF-8?q?=E9=94=99=E5=BA=93=E5=AD=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../thrsys/impl/ThrInvOrderServiceImpl.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) 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 35782de84..895da4a31 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 @@ -903,6 +903,29 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { thrInvOrderDetail.setHandleStatus(1); thrInvOrderDetail.setToBillNo(null); + 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()); + } + + Integer skCount = sk.getCount(); if (skCount != null && skCount > 0) { thrInvOrderDetail.setReCount(String.valueOf(skCount * count));