gongchunyi
6 天以前 33d93225f790ff72f8ba5e86f8cf2c3e2db94d0d
src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
@@ -754,17 +754,8 @@
            for (SalesLedgerProduct product : updateList) {
                product.setType(type.getCode());
                salesLedgerProductMapper.updateById(product);
                //  实现删除绑定的全部加工
                salesLedgerProductProcessBindService.remove(new LambdaQueryWrapper<SalesLedgerProductProcessBind>().eq(SalesLedgerProductProcessBind::getSalesLedgerProductId, product.getId()));
                //  绑定产品额外加工
                List<SalesLedgerProductProcess> salesProductProcessList = product.getSalesProductProcessList();
                salesProductProcessList.forEach(s -> {
                    SalesLedgerProductProcessBind processBind = new SalesLedgerProductProcessBind();
                    processBind.setSalesLedgerProductId(Math.toIntExact(product.getId()));
                    processBind.setSalesLedgerProductProcessId(s.getId());
                    processBind.setQuantity(s.getQuantity());
                    salesLedgerProductProcessBindService.save(processBind);
                });
                //  清空销售产品绑定的加工
                salesLedgerProductProcessBindService.updateProductProcessBind(product.getSalesProductProcessList(), product.getId());
            }
        }
        // 执行插入操作
@@ -776,14 +767,8 @@
                salesLedgerProduct.setPendingInvoiceTotal(salesLedgerProduct.getTaxInclusiveTotalPrice());
                salesLedgerProductMapper.insert(salesLedgerProduct);
                //  绑定产品额外加工
                List<SalesLedgerProductProcess> salesProductProcessList = salesLedgerProduct.getSalesProductProcessList();
                salesProductProcessList.forEach(s -> {
                    SalesLedgerProductProcessBind processBind = new SalesLedgerProductProcessBind();
                    processBind.setSalesLedgerProductId(Math.toIntExact(salesLedgerProduct.getId()));
                    processBind.setSalesLedgerProductProcessId(s.getId());
                    processBind.setQuantity(s.getQuantity());
                    salesLedgerProductProcessBindService.save(processBind);
                });
                //  清空销售产品绑定的加工
                salesLedgerProductProcessBindService.updateProductProcessBind(salesLedgerProduct.getSalesProductProcessList(), salesLedgerProduct.getId());
                // 添加生产数据
                salesLedgerProductServiceImpl.addProductionData(salesLedgerProduct);
            }