|
|
|
@ -1577,7 +1577,7 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
|
|
|
|
|
List<UdiRlSupEntity> udiRlSupEntitys = udiRlSupService.findByUdiRlId(relId);
|
|
|
|
|
if (CollUtil.isNotEmpty(udiRlSupEntitys)) {
|
|
|
|
|
for (UdiRlSupEntity udiRlSupEntity : udiRlSupEntitys) {
|
|
|
|
|
Integer count1 = invProductService.selectExitCount(thrInvOrder.getInvCode(), Long.parseLong(udiRlSupEntity.getCustomerId()), Long.parseLong(udiRlSupEntity.getUdiRlIdFk()));
|
|
|
|
|
Integer count1 = invProductService.selectExitCount(thrInvOrderDetail.getInvCode(), Long.parseLong(udiRlSupEntity.getCustomerId()), Long.parseLong(udiRlSupEntity.getUdiRlIdFk()));
|
|
|
|
|
if (IntUtil.value(count1) > 0) {
|
|
|
|
|
thrInvOrderDetail.setSupId(udiRlSupEntity.getCustomerId());
|
|
|
|
|
if (udiRlSupEntity.getPrice() == null)
|
|
|
|
@ -1636,20 +1636,54 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
|
|
|
|
|
log.error(item.getCpmctymc() + "," + item.getThrCode() + "项目关联多个耗材对照,已被过滤!");
|
|
|
|
|
} else {
|
|
|
|
|
skProjectDetailEntityList.forEach(sk -> {
|
|
|
|
|
|
|
|
|
|
ThrInvOrderDetail thrInvOrderDetail = new ThrInvOrderDetail();
|
|
|
|
|
ThrInvOrderDetail thrInvOrderDetail2 = null;
|
|
|
|
|
BeanUtils.copyProperties(item, thrInvOrderDetail);
|
|
|
|
|
thrInvOrderDetail.setId(null);
|
|
|
|
|
thrInvOrderDetail.setOrderIdFk(billNo);
|
|
|
|
|
thrInvOrderDetail.setRelId(sk.getRelId());
|
|
|
|
|
Integer skCount = sk.getCount();
|
|
|
|
|
if (skCount != null && skCount > 0) {
|
|
|
|
|
thrInvOrderDetail.setReCount(String.valueOf(skCount * finalCount));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<UdiRlSupEntity> udiRlSupEntitys = udiRlSupService.findByUdiRlId(sk.getRelId());
|
|
|
|
|
if (CollUtil.isNotEmpty(udiRlSupEntitys)) {
|
|
|
|
|
for (UdiRlSupEntity udiRlSupEntity : udiRlSupEntitys) {
|
|
|
|
|
Integer count1 = invProductService.selectExitCount(thrInvOrder.getInvCode(), Long.parseLong(udiRlSupEntity.getCustomerId()), Long.parseLong(udiRlSupEntity.getUdiRlIdFk()));
|
|
|
|
|
int index = 0;
|
|
|
|
|
for (int i = 0; i < udiRlSupEntitys.size(); i++) {
|
|
|
|
|
UdiRlSupEntity udiRlSupEntity = udiRlSupEntitys.get(i);
|
|
|
|
|
Integer count1 = invProductService.selectExitCount(thrInvOrderDetail.getInvCode(), Long.parseLong(udiRlSupEntity.getCustomerId()), Long.parseLong(udiRlSupEntity.getUdiRlIdFk()));
|
|
|
|
|
if (IntUtil.value(count1) > 0) {
|
|
|
|
|
index = index + 1;
|
|
|
|
|
thrInvOrderDetail.setSupId(udiRlSupEntity.getCustomerId());
|
|
|
|
|
if (udiRlSupEntity.getPrice() == null)
|
|
|
|
|
thrInvOrderDetail.setPrice(BigDecimal.ZERO);
|
|
|
|
|
else
|
|
|
|
|
thrInvOrderDetail.setPrice(udiRlSupEntity.getPrice());
|
|
|
|
|
|
|
|
|
|
if (count1 <= IntUtil.value(thrInvOrderDetail.getReCount())) {
|
|
|
|
|
int relCount = IntUtil.value(thrInvOrderDetail.getReCount()) - count1;
|
|
|
|
|
for (int j = i + 1; j < udiRlSupEntitys.size(); j++) {
|
|
|
|
|
UdiRlSupEntity udiRlSupEntity2 = udiRlSupEntitys.get(j);
|
|
|
|
|
Integer count2 = invProductService.selectExitCount(thrInvOrderDetail.getInvCode(), Long.parseLong(udiRlSupEntity2.getCustomerId()), Long.parseLong(udiRlSupEntity2.getUdiRlIdFk()));
|
|
|
|
|
if (IntUtil.value(count2) > 0) {
|
|
|
|
|
thrInvOrderDetail2 = new ThrInvOrderDetail();
|
|
|
|
|
BeanUtils.copyProperties(thrInvOrderDetail, thrInvOrderDetail2);
|
|
|
|
|
if (udiRlSupEntity2.getPrice() == null)
|
|
|
|
|
thrInvOrderDetail2.setPrice(BigDecimal.ZERO);
|
|
|
|
|
else
|
|
|
|
|
thrInvOrderDetail2.setPrice(udiRlSupEntity2.getPrice());
|
|
|
|
|
thrInvOrderDetail2.setReCount(relCount + "");
|
|
|
|
|
thrInvOrderDetail2.setSupId(udiRlSupEntity2.getCustomerId());
|
|
|
|
|
thrInvOrderDetail.setReCount(count1 + "");
|
|
|
|
|
thrInvOrderDetails.add(thrInvOrderDetail2);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (thrInvOrderDetail.getSupId() == null) {
|
|
|
|
@ -1659,13 +1693,9 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
|
|
|
|
|
else
|
|
|
|
|
thrInvOrderDetail.setPrice(udiRlSupEntitys.get(0).getPrice());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else
|
|
|
|
|
exmsg.append(thrCode + "供应商未关联");
|
|
|
|
|
Integer skCount = sk.getCount();
|
|
|
|
|
if (skCount != null && skCount > 0) {
|
|
|
|
|
thrInvOrderDetail.setReCount(String.valueOf(skCount * finalCount));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//过滤是否高值
|
|
|
|
|
if (IntUtil.value(highFilter) > 0) {
|
|
|
|
|
UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(sk.getRelId());
|
|
|
|
|