| | |
| | | import com.ruoyi.approve.service.IApproveNodeService; |
| | | import com.ruoyi.common.enums.FileNameType; |
| | | import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.device.mapper.DeviceRepairMapper; |
| | | import com.ruoyi.device.pojo.DeviceRepair; |
| | |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Arrays; |
| | | import java.util.Comparator; |
| | |
| | | purchaseLedger.setApprovalStatus(3); |
| | | List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectList(new QueryWrapper<SalesLedgerProduct>() |
| | | .lambda().eq(SalesLedgerProduct::getSalesLedgerId, purchaseLedger.getId()).eq(SalesLedgerProduct::getType, 2)); |
| | | boolean hasCheckedProduct = false; |
| | | for (SalesLedgerProduct salesLedgerProduct : salesLedgerProducts) { |
| | | // 质检 |
| | | if (salesLedgerProduct.getIsChecked()) { |
| | | hasCheckedProduct = true; |
| | | purchaseLedgerServiceImpl.addQualityInspect(purchaseLedger, salesLedgerProduct); |
| | | }else { |
| | | //直接入库 |
| | | stockUtils.addStock(null, salesLedgerProduct.getId(), salesLedgerProduct.getProductModelId(), |
| | | salesLedgerProduct.getQuantity(), StockInQualifiedRecordTypeEnum.PURCHASE_STOCK_IN.getCode(), salesLedgerProduct.getId()); |
| | | BigDecimal oldStocked = salesLedgerProduct.getStockedQuantity() == null ? BigDecimal.ZERO : salesLedgerProduct.getStockedQuantity(); |
| | | BigDecimal orderQty = salesLedgerProduct.getQuantity() == null ? BigDecimal.ZERO : salesLedgerProduct.getQuantity(); |
| | | BigDecimal newStocked = oldStocked.add(orderQty); |
| | | salesLedgerProduct.setStockedQuantity(newStocked); |
| | | salesLedgerProduct.setProductStockStatus(2); |
| | | salesLedgerProduct.fillRemainingQuantity(); |
| | | salesLedgerProductMapper.updateById(salesLedgerProduct); |
| | | } |
| | | } |
| | | purchaseLedger.setStockStatus(hasCheckedProduct ? 0 : 2); |
| | | } else if (status.equals(3)) { |
| | | // 拒绝 |
| | | purchaseLedger.setApprovalStatus(4); |