|
@@ -416,14 +416,23 @@ public class BizReturnTurnoverController extends BaseController {
|
|
List<BizDaywork> updateDaywork = new ArrayList<>();
|
|
List<BizDaywork> updateDaywork = new ArrayList<>();
|
|
List<BizProductionResourceGroupSubPlan> subPlanList = new ArrayList<>();
|
|
List<BizProductionResourceGroupSubPlan> subPlanList = new ArrayList<>();
|
|
//操作dayworkCarrier表,如果该批次已经绑箱,把对应箱解绑,并重新绑定新箱子
|
|
//操作dayworkCarrier表,如果该批次已经绑箱,把对应箱解绑,并重新绑定新箱子
|
|
- List<BizDayworkCarrier> newDayworkCarrierList = new ArrayList<>();
|
|
|
|
- List<BizDayworkItem> bizDayworkItems = bizDayworkItemService.getListByDayworkIds(batches.stream().map(BizOutsourcedOrderDetail::getDayworkId).collect(Collectors.toList()));
|
|
|
|
|
|
+// List<BizDayworkCarrier> newDayworkCarrierList = new ArrayList<>();
|
|
List<BizDayworkCarrier> returnDayworkCarrierList = bizDayworkCarrierService.query().in("daywork_id", batches.isEmpty() ? Collections.singletonList(0L) : batches.stream().map(BizOutsourcedOrderDetail::getDayworkId).collect(Collectors.toList())).eq("process_inspection_id", 0L).eq("is_changed", 0).list();
|
|
List<BizDayworkCarrier> returnDayworkCarrierList = bizDayworkCarrierService.query().in("daywork_id", batches.isEmpty() ? Collections.singletonList(0L) : batches.stream().map(BizOutsourcedOrderDetail::getDayworkId).collect(Collectors.toList())).eq("process_inspection_id", 0L).eq("is_changed", 0).list();
|
|
- List<BizDaywork> bizDayworks = bizDayworkService.query().in("id", batches.isEmpty() ? Collections.singletonList(0L) : batches.stream().map(BizOutsourcedOrderDetail::getDayworkId).collect(Collectors.toList())).list();
|
|
|
|
|
|
+ List<BizDayworkCarrier> allDayworkCarriers = bizDayworkCarrierService.query().in("carrier_id", returnDayworkCarrierList.isEmpty() ? Collections.singletonList(0L): returnDayworkCarrierList.stream().map(BizDayworkCarrier::getCarrierId).collect(Collectors.toList())).eq("is_changed", 0).list();
|
|
|
|
|
|
- if (returnDayworkCarrierList.size() > 0) {
|
|
|
|
- returnDayworkCarrierList.stream().forEach(bizDayworkCarrier -> bizDayworkCarrier.setIsChanged(1));
|
|
|
|
- }
|
|
|
|
|
|
+ List<BizDaywork> bizDayworks = bizDayworkService.query().in("id", allDayworkCarriers.isEmpty() ? Collections.singletonList(0L) : allDayworkCarriers.stream().map(BizDayworkCarrier::getDayworkId).collect(Collectors.toList())).list();
|
|
|
|
+ List<BizReturnReceiptDetail> bizReturnReceiptDetails = bizReturnReceiptDetailService.query().in("daywork_id", bizDayworks.isEmpty() ? Collections.singletonList(0L) : bizDayworks.stream().map(BizDaywork::getId).collect(Collectors.toList())).list();
|
|
|
|
+ // 获取所有明细
|
|
|
|
+ List<BizOutsourcedOrderDetail> returnBatchs = bizOutsourcedOrderDetailService.query().in("id", bizReturnReceiptDetails.stream().map(BizReturnReceiptDetail::getOutsourceDetailId).collect(Collectors.toList())).list();
|
|
|
|
+ returnBatchs.forEach(l -> {
|
|
|
|
+ l.setReturnReceiptDetailList(bizReturnReceiptDetails.stream().filter(e -> e.getOutsourceDetailId().equals(l.getId())).collect(Collectors.toList()));
|
|
|
|
+ });
|
|
|
|
+ List<BizDayworkItem> bizDayworkItems = bizDayworkItemService.getListByDayworkIds(returnBatchs.stream().map(BizOutsourcedOrderDetail::getDayworkId).collect(Collectors.toList()));
|
|
|
|
+
|
|
|
|
+// 不用解绑载具,因为载具不换
|
|
|
|
+// if (returnDayworkCarrierList.size() > 0) {
|
|
|
|
+// returnDayworkCarrierList.stream().forEach(bizDayworkCarrier -> bizDayworkCarrier.setIsChanged(1));
|
|
|
|
+// }
|
|
//下序是否包装审核
|
|
//下序是否包装审核
|
|
if (outsourcedOrderDetail.getIsSortPackaging() != null && outsourcedOrderDetail.getIsSortPackaging() == 1) {
|
|
if (outsourcedOrderDetail.getIsSortPackaging() != null && outsourcedOrderDetail.getIsSortPackaging() == 1) {
|
|
List<BizDayworkItemExamine> dayworkItemExamineList = bizDayworkItemExamineService.query().in("daywork_id", batches.isEmpty() ? Collections.singletonList(0L) : batches.stream().map(BizOutsourcedOrderDetail::getDayworkId).collect(Collectors.toList())).list();
|
|
List<BizDayworkItemExamine> dayworkItemExamineList = bizDayworkItemExamineService.query().in("daywork_id", batches.isEmpty() ? Collections.singletonList(0L) : batches.stream().map(BizOutsourcedOrderDetail::getDayworkId).collect(Collectors.toList())).list();
|
|
@@ -458,18 +467,18 @@ public class BizReturnTurnoverController extends BaseController {
|
|
|
|
|
|
List<BizProductionResourceGroup> productionResourceGroupList = bizProductionResourceGroupService.list(new QueryWrapper<BizProductionResourceGroup>().eq("dept_id", outsourcedOrderDetail.getProductionDeptId()).eq("is_deactivate", 0));
|
|
List<BizProductionResourceGroup> productionResourceGroupList = bizProductionResourceGroupService.list(new QueryWrapper<BizProductionResourceGroup>().eq("dept_id", outsourcedOrderDetail.getProductionDeptId()).eq("is_deactivate", 0));
|
|
|
|
|
|
- batches.forEach(l -> {
|
|
|
|
- l.setProductionCarrier(l.getNewCarrierName());
|
|
|
|
|
|
+ returnBatchs.forEach(l -> {
|
|
|
|
+ l.setProductionCarrier(l.getReturnReceiptDetailList().isEmpty() ? l.getNewCarrierName() : l.getReturnReceiptDetailList().get(0).getNewCarrier());
|
|
l.setProductionDeptId(outsourcedOrderDetail.getProductionDeptId());
|
|
l.setProductionDeptId(outsourcedOrderDetail.getProductionDeptId());
|
|
l.setProductionDeptName(outsourcedOrderDetail.getProductionDeptName());
|
|
l.setProductionDeptName(outsourcedOrderDetail.getProductionDeptName());
|
|
- l.getCarriers().forEach(v -> {
|
|
|
|
- BizDayworkCarrier carrier = new BizDayworkCarrier();
|
|
|
|
- carrier.setCarrierId(v.getId());
|
|
|
|
- carrier.setCarrierCode(v.getCode());
|
|
|
|
- carrier.setDayworkId(l.getDayworkId());
|
|
|
|
- carrier.setLotId(l.getLotId());
|
|
|
|
- newDayworkCarrierList.add(carrier);
|
|
|
|
- });
|
|
|
|
|
|
+// l.getCarriers().forEach(v -> {
|
|
|
|
+// BizDayworkCarrier carrier = new BizDayworkCarrier();
|
|
|
|
+// carrier.setCarrierId(v.getId());
|
|
|
|
+// carrier.setCarrierCode(v.getCode());
|
|
|
|
+// carrier.setDayworkId(l.getDayworkId());
|
|
|
|
+// carrier.setLotId(l.getLotId());
|
|
|
|
+// newDayworkCarrierList.add(carrier);
|
|
|
|
+// });
|
|
BizDaywork daywork = bizDayworks.stream().filter(v -> v.getId().equals(l.getDayworkId())).findFirst().orElse(null);
|
|
BizDaywork daywork = bizDayworks.stream().filter(v -> v.getId().equals(l.getDayworkId())).findFirst().orElse(null);
|
|
BizDayworkItem lastDayworkItem = bizDayworkItems.stream().filter(v -> v.getDayworkId().equals(l.getDayworkId())).sorted(Comparator.comparing(BizDayworkItem::getProcessStepNumber).reversed()).collect(Collectors.toList()).get(0);
|
|
BizDayworkItem lastDayworkItem = bizDayworkItems.stream().filter(v -> v.getDayworkId().equals(l.getDayworkId())).sorted(Comparator.comparing(BizDayworkItem::getProcessStepNumber).reversed()).collect(Collectors.toList()).get(0);
|
|
if ("4".equals(lastDayworkItem.getStatus())) {
|
|
if ("4".equals(lastDayworkItem.getStatus())) {
|
|
@@ -536,8 +545,9 @@ public class BizReturnTurnoverController extends BaseController {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
bizOutsourcedOrderDetailService.updateBatchById(batches);
|
|
bizOutsourcedOrderDetailService.updateBatchById(batches);
|
|
- bizDayworkCarrierService.updateBatchById(returnDayworkCarrierList);
|
|
|
|
- bizDayworkCarrierService.saveBatch(newDayworkCarrierList);
|
|
|
|
|
|
+// bizDayworkCarrierService.updateBatchById(returnDayworkCarrierList);
|
|
|
|
+ // 批量周转补充绑箱
|
|
|
|
+// bizDayworkCarrierService.saveBatch(newDayworkCarrierList);
|
|
bizDayworkItemService.removeBatchByIds(removeItems);
|
|
bizDayworkItemService.removeBatchByIds(removeItems);
|
|
bizDayworkItemService.saveBatch(addItems);
|
|
bizDayworkItemService.saveBatch(addItems);
|
|
bizDayworkService.updateBatchById(updateDaywork);
|
|
bizDayworkService.updateBatchById(updateDaywork);
|