|
@@ -25,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
|
|
|
@Service
|
|
@@ -52,6 +53,8 @@ public class RepairSupplyService {
|
|
|
IPartService partService;
|
|
|
@Autowired
|
|
|
IPriceListService priceListService;
|
|
|
+ @Autowired
|
|
|
+ IPartLogService partLogService;
|
|
|
|
|
|
/**
|
|
|
* 维修备件管理 供应链
|
|
@@ -72,20 +75,33 @@ public class RepairSupplyService {
|
|
|
wrapper.eq(PriceList::getRepairId,repairId);
|
|
|
wrapper.eq(PriceList::getStatus,1);
|
|
|
wrapper.eq(PriceList::getType,0);
|
|
|
+ List<PriceList> list = priceListService.list(wrapper);
|
|
|
+ List<PriceList> returnList = new ArrayList<>();
|
|
|
|
|
|
- if(type == 0){
|
|
|
- wrapper.eq(PriceList::getOutStatus,0);
|
|
|
+ LambdaQueryWrapper<PartLog> wrapper2 = new LambdaQueryWrapper<>();
|
|
|
+ wrapper2.eq(PartLog::getRepairId,repairId);
|
|
|
+ if(type == 0 || type == 2){ //出库
|
|
|
+ wrapper2.eq(PartLog::getStatus,1);
|
|
|
}
|
|
|
- if(type == 1){
|
|
|
- wrapper.eq(PriceList::getRecoveryStatus,0);
|
|
|
+ if(type == 1){ //回收
|
|
|
+ wrapper2.eq(PartLog::getStatus,2);
|
|
|
}
|
|
|
- if(type == 2){
|
|
|
- wrapper.eq(PriceList::getOutStatus,1);
|
|
|
+
|
|
|
+ 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 == 1 && map.get(priceList.getPriceListId()) == null){
|
|
|
+ returnList.add(priceList);
|
|
|
+ }
|
|
|
+ if(type == 2 && map.get(priceList.getPriceListId()) != null){
|
|
|
+ returnList.add(priceList);
|
|
|
+ }
|
|
|
}
|
|
|
- List<PriceList> list = priceListService.list(wrapper);
|
|
|
|
|
|
List<RepairRegisterPartVo> parts = new ArrayList<>();
|
|
|
- for (PriceList priceList : list) {
|
|
|
+ for (PriceList priceList : returnList) {
|
|
|
Part part = partService.getById(priceList.getPartId());
|
|
|
if(part == null){
|
|
|
continue;
|