|
|
|
@ -903,6 +903,29 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
|
|
|
|
|
thrInvOrderDetail.setHandleStatus(1);
|
|
|
|
|
thrInvOrderDetail.setToBillNo(null);
|
|
|
|
|
|
|
|
|
|
List<InvProductEntity> 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));
|
|
|
|
|