|
|
|
@ -35,10 +35,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Collections;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
|
@ -407,7 +404,7 @@ public class OrderServiceImpl implements OrderService {
|
|
|
|
|
productEntity.setInCount(count);
|
|
|
|
|
} else if (ConstantType.TYPE_OUT.equals(invProductDetailEntity.getMainAction())) {
|
|
|
|
|
//出库,在原有库存上增加库存
|
|
|
|
|
int count = productEntity.getOutCount() + invProductDetailEntity.getCount();
|
|
|
|
|
int count = productEntity.getOutCount() - invProductDetailEntity.getCount();
|
|
|
|
|
productEntity.setOutCount(count);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -416,12 +413,23 @@ public class OrderServiceImpl implements OrderService {
|
|
|
|
|
|
|
|
|
|
//删除单据相关数据,更新库存
|
|
|
|
|
try {
|
|
|
|
|
//删除库存详情
|
|
|
|
|
invProductDetailDao.deleteByOrderId(id);
|
|
|
|
|
//更新库存
|
|
|
|
|
for (InvProductEntity invProductEntity : invProductList) {
|
|
|
|
|
//查询库存码详情,如果库存码详情为空,则删除此库存
|
|
|
|
|
FilterInvProductDetailRequest detailParams = new FilterInvProductDetailRequest();
|
|
|
|
|
detailParams.setBatchNo(invProductEntity.getBatchNo());
|
|
|
|
|
detailParams.setInvCodes(Collections.singletonList(invProductEntity.getInvStorageCode()));
|
|
|
|
|
detailParams.setProductIdFk(invProductEntity.getRelIdFk());
|
|
|
|
|
int count = invProductDetailDao.statCount(detailParams);
|
|
|
|
|
if (count == 0) {
|
|
|
|
|
//如果库存码详情为空,则删除此库存
|
|
|
|
|
invProductDao.deleteById(String.valueOf(invProductEntity.getId()));
|
|
|
|
|
} else {
|
|
|
|
|
invProductDao.updateInvProduct(invProductEntity);
|
|
|
|
|
}
|
|
|
|
|
//删除库存详情
|
|
|
|
|
invProductDetailDao.deleteByOrderId(id);
|
|
|
|
|
}
|
|
|
|
|
//删除码详情
|
|
|
|
|
codesDao.deleteByOrderId(id);
|
|
|
|
|
//查询业务单据
|
|
|
|
|