|
@@ -41,6 +41,7 @@ import java.math.RoundingMode;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
@@ -84,6 +85,21 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder
|
|
|
.like("wo", WorkOrder::getQuantity, dto.getKeyword()));
|
|
|
}
|
|
|
wrapper.eq("wo",WorkOrder::getSource,dto.getSource());
|
|
|
+
|
|
|
+
|
|
|
+ if(Objects.equals(dto.getIsRemaining(),1)) {
|
|
|
+ wrapper.gt( "wo.remainingQuantity", 0);
|
|
|
+
|
|
|
+ wrapper.and(q->q
|
|
|
+ .and(q1->q1
|
|
|
+ .eq("wo",WorkOrder::getIsCustomized,1)
|
|
|
+ .eq("wo",WorkOrder::getBomStatus,1)
|
|
|
+ .eq("wo",WorkOrder::getTechnologyStatus,1)
|
|
|
+ ).or()
|
|
|
+ .eq("wo",WorkOrder::getIsCustomized,0)
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
wrapper.orderByDesc("wo", WorkOrder::getId);
|
|
|
Page<WorkOrderVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
|
List<WorkOrderVo> records = page.getRecords();
|
|
@@ -95,27 +111,27 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder
|
|
|
item.setProductName(productInfo.getName());
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
- for (WorkOrderVo workOrder : records) {
|
|
|
- workOrder.setRemainingQuantity(workOrder.getQuantity());
|
|
|
- }
|
|
|
- List<Long> workOrderIds = records.stream().map(WorkOrder::getId).collect(Collectors.toList());
|
|
|
- if (ObjectUtil.isNotEmpty(workOrderIds)) {
|
|
|
- List<ProductionPlan> productionPlanList = productionPlanService.list(q -> q.in(ProductionPlan::getWorkOrderId, workOrderIds));
|
|
|
- if (ObjectUtil.isNotEmpty(productionPlanList)) {
|
|
|
-
|
|
|
- Map<Long, List<ProductionPlan>> productionPlanMap = productionPlanList.stream().collect(Collectors.groupingBy(ProductionPlan::getWorkOrderId));
|
|
|
- for (WorkOrderVo workOrder : records) {
|
|
|
- List<ProductionPlan> productionPlanList1 = productionPlanMap.get(workOrder.getId());
|
|
|
- BigDecimal count = BigDecimal.ZERO;
|
|
|
- if (ObjectUtil.isNotEmpty(productionPlanList1)) {
|
|
|
- count = productionPlanList1.stream().map(ProductionPlan::getQuantity)
|
|
|
- .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- }
|
|
|
- workOrder.setRemainingQuantity(workOrder.getQuantity().subtract(count));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
return page;
|
|
|
}
|
|
|
|