|
@@ -76,41 +76,42 @@ public class RepairSupplyService {
|
|
|
wrapper.eq(PriceList::getStatus,1);
|
|
|
wrapper.eq(PriceList::getType,0);
|
|
|
List<PriceList> list = priceListService.list(wrapper);
|
|
|
- List<PriceList> returnList = new ArrayList<>();
|
|
|
|
|
|
LambdaQueryWrapper<PartLog> wrapper2 = new LambdaQueryWrapper<>();
|
|
|
wrapper2.eq(PartLog::getRepairId,repairId);
|
|
|
- if(type == 0 || type == 2){ //出库
|
|
|
+ if(type == 0 ){ //出库
|
|
|
wrapper2.eq(PartLog::getStatus,1);
|
|
|
}
|
|
|
if(type == 1){ //回收
|
|
|
wrapper2.eq(PartLog::getStatus,2);
|
|
|
}
|
|
|
-
|
|
|
- List<PartLog> partLogs = partLogService.list(wrapper2);
|
|
|
HashMap<Integer,PartLog> map = new HashMap<>();
|
|
|
- partLogs.forEach(entity -> map.put(entity.getPriceListId(),entity));
|
|
|
-
|
|
|
- for (PriceList priceList : list) {
|
|
|
- if(type != 2 && map.get(priceList.getPriceListId()) == null){
|
|
|
- returnList.add(priceList);
|
|
|
- }
|
|
|
- if(type == 2 && map.get(priceList.getPriceListId()) != null){
|
|
|
- returnList.add(priceList);
|
|
|
- }
|
|
|
+ if(type != 2){
|
|
|
+ List<PartLog> partLogs = partLogService.list(wrapper2);
|
|
|
+ partLogs.forEach(entity -> map.put(entity.getPartId(),entity));
|
|
|
}
|
|
|
|
|
|
List<RepairRegisterPartVo> parts = new ArrayList<>();
|
|
|
- for (PriceList priceList : returnList) {
|
|
|
+ for (PriceList priceList : list) {
|
|
|
Part part = partService.getById(priceList.getPartId());
|
|
|
if(part == null){
|
|
|
continue;
|
|
|
}
|
|
|
RepairRegisterPartVo vo = new RepairRegisterPartVo();
|
|
|
vo.setPartName(priceList.getName());
|
|
|
- vo.setPartCount(priceList.getCount());
|
|
|
+ vo.setPartCount(priceList.getCount() );
|
|
|
BeanUtils.copyProperties(part,vo);
|
|
|
BeanUtils.copyProperties(priceList,vo);
|
|
|
+ if(type != 2){
|
|
|
+ PartLog partLog = map.get(part.getPartId());
|
|
|
+ if(partLog != null){
|
|
|
+ Integer count = partLog.getCount();
|
|
|
+ vo.setPartCount(priceList.getCount() - count);
|
|
|
+ }
|
|
|
+ if(vo.getPartCount() <=0){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
parts.add(vo);
|
|
|
}
|
|
|
return parts;
|
|
@@ -133,7 +134,7 @@ public class RepairSupplyService {
|
|
|
partService.outStockCheck(partVo.getPartId(),partVo.getPartCount(),userId,repair.getRepairId());
|
|
|
}
|
|
|
for (RepairRegisterPartVo partVo : partVoList) {
|
|
|
- partService.outStock(partVo.getPartId(),partVo.getPartCount(),userId,repair.getRepairId(),partVo.getPriceListId());
|
|
|
+ partService.outStock(partVo.getPartId(),partVo.getPartCount(),userId,repair.getRepairId());
|
|
|
}
|
|
|
priceListService.outStock(repair.getRepairId());
|
|
|
|
|
@@ -155,7 +156,7 @@ public class RepairSupplyService {
|
|
|
}
|
|
|
List<RepairRegisterPartVo> partVoList = this.partInfo(param.getRepairId(),1);
|
|
|
for (RepairRegisterPartVo partVo : partVoList) {
|
|
|
- partService.recovery(partVo.getPartId(),partVo.getPartCount(),userId,repair.getRepairId(),repair.getStatus(),partVo.getPriceListId());
|
|
|
+ partService.recovery(partVo.getPartId(),partVo.getPartCount(),userId,repair.getRepairId(),repair.getStatus());
|
|
|
}
|
|
|
priceListService.recoveryPart(repair.getRepairId());
|
|
|
|