liujie
3 天以前 ce531d3bb32f5221b35f9e24d027ef83450ebbc6
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpProcurementServiceImpl.java
@@ -467,8 +467,8 @@
                String datePart = "C" + DateUtils.dateTimeNow();
                // 直接获取后五位数字并+1,不考虑是否同一天
                String numberPart = lastProcurementCode.substring(Math.max(0, lastProcurementCode.length() - 5));
                try {
                    String numberPart = lastProcurementCode.substring(Math.max(0, lastProcurementCode.length() - 5));
                    int number = Integer.parseInt(numberPart);
                    if (number < 99999) {
                        number++;
@@ -606,8 +606,34 @@
                        tErpSupplierOutbound.setOutboundType(7);
                        //TODO 确定这个是采购价还是销售价格
                        tErpSupplierOutbound.setTotalMoney(tErpProcurementGoods.getPurchasePrice().multiply(new BigDecimal(purchaseCount)));
                        tErpSupplierOutbound.setOutboundNumber("G" + DateUtils.dateTimeNow());
                        TErpSupplierOutbound last = erpSupplierOutboundMapper.selectOne(new LambdaQueryWrapper<TErpSupplierOutbound>().orderByDesc(BaseModel::getCreateTime).last("limit 1"));
                        if(last==null){
                            tErpSupplierOutbound.setOutboundNumber("G" + DateUtils.dateTimeNow()+"00001");
                        }else {
                            String lastProcurementCode = last.getOutboundNumber();
                            String datePart = "G" + DateUtils.dateTimeNow();
                            // 直接获取后五位数字并+1,不考虑是否同一天
                            try {
                                String numberPart = lastProcurementCode.substring(Math.max(0, lastProcurementCode.length() - 5));
                                int number = Integer.parseInt(numberPart);
                                if (number < 99999) {
                                    number++;
                                } else {
                                    number = 2; // 达到99999后重置为00002
                                }
                                tErpSupplierOutbound.setOutboundNumber(datePart + String.format("%05d", number));
                            } catch (NumberFormatException e) {
                                // 如果解析失败,默认从00001开始
                                tErpSupplierOutbound.setOutboundNumber(datePart + "00001");
                            }
                        }
                        try {
                        erpSupplierOutboundMapper.insert(tErpSupplierOutbound);
                        }catch (Exception e){
                            throw new RuntimeException("网络繁忙,请重试");
                        }
                        TErpSupplierOutboundGoods tErpSupplierOutboundGoods = new TErpSupplierOutboundGoods();
                        tErpSupplierOutboundGoods.setOutboundId(tErpSupplierOutbound.getId());
@@ -629,8 +655,35 @@
                        tErpSupplierOutbound.setOutboundType(7);
                        //TODO 确定这个是采购价还是销售价格
                        tErpSupplierOutbound.setTotalMoney(tErpProcurementGoods.getPurchasePrice().multiply(new BigDecimal(purchaseCount)));
                        tErpSupplierOutbound.setOutboundNumber("G" + DateUtils.dateTimeNow());
                        TErpSupplierOutbound last = erpSupplierOutboundMapper.selectOne(new LambdaQueryWrapper<TErpSupplierOutbound>().orderByDesc(BaseModel::getCreateTime).last("limit 1"));
                        if(last==null){
                            tErpSupplierOutbound.setOutboundNumber("G" + DateUtils.dateTimeNow()+"00001");
                        }else {
                            String lastProcurementCode = last.getOutboundNumber();
                            String datePart = "G" + DateUtils.dateTimeNow();
                            // 直接获取后五位数字并+1,不考虑是否同一天
                            try {
                                String numberPart = lastProcurementCode.substring(Math.max(0, lastProcurementCode.length() - 5));
                                int number = Integer.parseInt(numberPart);
                                if (number < 99999) {
                                    number++;
                                } else {
                                    number = 2; // 达到99999后重置为00002
                                }
                                tErpSupplierOutbound.setOutboundNumber(datePart + String.format("%05d", number));
                            } catch (NumberFormatException e) {
                                // 如果解析失败,默认从00001开始
                                tErpSupplierOutbound.setOutboundNumber(datePart + "00001");
                            }
                        }
                        try {
                        erpSupplierOutboundMapper.insert(tErpSupplierOutbound);
                        }catch (Exception e){
                            throw new RuntimeException("网络繁忙,请重试");
                        }
                        TErpSupplierOutboundGoods tErpSupplierOutboundGoods = new TErpSupplierOutboundGoods();
                        tErpSupplierOutboundGoods.setOutboundId(tErpSupplierOutbound.getId());