| | |
| | | allStocked = false; |
| | | } |
| | | } |
| | | |
| | | long pendingInspectCount = qualityInspectMapper.selectCount(Wrappers.<QualityInspect>lambdaQuery() |
| | | .eq(QualityInspect::getSalesLedgerId, salesLedgerId) |
| | | .eq(QualityInspect::getInspectState, 0)); |
| | | boolean allInspectFinished = pendingInspectCount == 0; |
| | | |
| | | SalesLedger ledger = salesLedgerMapper.selectById(salesLedgerId); |
| | | if (ledger != null) { |
| | | ledger.setStockStatus(allStocked ? 2 : (hasStocked ? 1 : 0)); |
| | | int newStatus = ledger.getStockStatus() != null ? ledger.getStockStatus() : 0; |
| | | if (allInspectFinished) { |
| | | newStatus = allStocked ? 2 : 5; // 2: 已入库(质检完成), 5: 部分质检完成 |
| | | } else { |
| | | newStatus = 4; // 4: 质检中 |
| | | } |
| | | ledger.setStockStatus(newStatus); |
| | | salesLedgerMapper.updateById(ledger); |
| | | } |
| | | } |