|
@@ -72,27 +72,44 @@ public class RepairSupplyService {
|
|
|
|
|
|
public List<RepairRegisterPartVo> partInfo(String repairId,Integer type) {
|
|
|
if(type == 0){ //获取备件出库单
|
|
|
+ HashMap<Integer,PriceList> priceMap = new HashMap<>();
|
|
|
List<RepairRegisterPartVo> parts = new ArrayList<>();
|
|
|
List<PriceList> priceListList = priceListService.getByRepairId(repairId);
|
|
|
for (PriceList priceList : priceListList) {
|
|
|
if(priceList.getStatus() == 1){
|
|
|
- RepairRegisterPartVo vo = new RepairRegisterPartVo();
|
|
|
- vo.setPartId(priceList.getPartId());
|
|
|
- vo.setPartName(priceList.getName());
|
|
|
- vo.setPartCount(priceList.getCount());
|
|
|
- if(priceList.getPartId() != null){
|
|
|
- Part part = partService.getById(priceList.getPartId());
|
|
|
- if(part != null){
|
|
|
- vo.setPartNum(part.getPartNum());
|
|
|
+ if(priceList.getPartId() == null){
|
|
|
+ RepairRegisterPartVo vo = new RepairRegisterPartVo();
|
|
|
+ vo.setPartName(priceList.getName());
|
|
|
+ vo.setPartCount(priceList.getCount());
|
|
|
+ parts.add(vo);
|
|
|
+ }else {
|
|
|
+ if(priceMap.get(priceList.getPartId()) == null){
|
|
|
+ priceMap.put(priceList.getPartId(),priceList);
|
|
|
+ }else {
|
|
|
+ PriceList priceList1 = priceMap.get(priceList.getPartId());
|
|
|
+ priceList1.setCount(priceList1.getCount() + priceList.getCount());
|
|
|
}
|
|
|
}
|
|
|
- parts.add(vo);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (Integer partId : priceMap.keySet()) {
|
|
|
+ RepairRegisterPartVo vo = new RepairRegisterPartVo();
|
|
|
+ vo.setPartId(partId);
|
|
|
+ vo.setPartName(priceMap.get(partId).getName());
|
|
|
+ vo.setPartCount(priceMap.get(partId).getCount());
|
|
|
+ Part part = partService.getById(partId);
|
|
|
+ if(part != null){
|
|
|
+ vo.setPartNum(part.getPartNum());
|
|
|
}
|
|
|
+ parts.add(vo);
|
|
|
}
|
|
|
|
|
|
return parts;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
LambdaQueryWrapper<PartLog> wrapper2 = new LambdaQueryWrapper<>();
|
|
|
wrapper2.eq(PartLog::getRepairId,repairId);
|
|
|
wrapper2.eq(PartLog::getStatus,1);
|