|
|
|
@ -1653,12 +1653,13 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
|
|
|
|
|
thrInvOrderDetail.setReCount(String.valueOf(skCount * finalCount));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//1.找出产品的所有供应商
|
|
|
|
|
List<UdiRlSupEntity> udiRlSupEntitys = udiRlSupService.findByUdiRlId(sk.getRelId());
|
|
|
|
|
if (CollUtil.isNotEmpty(udiRlSupEntitys)) {
|
|
|
|
|
int index = 0;
|
|
|
|
|
for (int i = 0; i < udiRlSupEntitys.size(); i++) {
|
|
|
|
|
UdiRlSupEntity udiRlSupEntity = udiRlSupEntitys.get(i);
|
|
|
|
|
//2.查询当前供应商库存数量
|
|
|
|
|
Integer count1 = invProductService.selectExitCount(thrInvOrderDetail.getInvCode(), Long.parseLong(udiRlSupEntity.getCustomerId()), Long.parseLong(udiRlSupEntity.getUdiRlIdFk()));
|
|
|
|
|
if (IntUtil.value(count1) > 0) {
|
|
|
|
|
index = index + 1;
|
|
|
|
@ -1671,12 +1672,15 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
|
|
|
|
|
InvProductEntity invProductEntity = (InvProductEntity) invProductService.selectExitInv(thrInvOrderDetail.getInvCode(), Long.parseLong(udiRlSupEntity.getCustomerId()), Long.parseLong(udiRlSupEntity.getUdiRlIdFk()));
|
|
|
|
|
thrInvOrderDetail.setBatchNo(invProductEntity.getBatchNo());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//3.如果当前供应商数量不够扣
|
|
|
|
|
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)
|
|
|
|
|