diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/OutsourceQuoteController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/OutsourceQuoteController.java index c6eaebaa..97cbaa26 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/OutsourceQuoteController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/OutsourceQuoteController.java @@ -161,4 +161,17 @@ public class OutsourceQuoteController extends BaseController { return toAjax(outsourceQuoteService.deleteOutsourceQuoteByOutsourceQuoteIds(ids)); } + + + /** + * 自动生成委外报价编号 + * + */ + @GetMapping("/generateOutsourceQuoteCode") + @ResponseBody + public String generateOutsourceQuoteCode(){ + + String result = outsourceQuoteService.generateOutsourceQuoteCode(); + return result; + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/IOutsourceQuoteService.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/IOutsourceQuoteService.java index 644043d4..6072159c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/IOutsourceQuoteService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/IOutsourceQuoteService.java @@ -68,4 +68,10 @@ public interface IOutsourceQuoteService * @param outsourceQuote 委外报价对象 */ public void insertOutsourceQuoteChild(OutsourceQuote outsourceQuote); + + /** + * 自动生成委外报价编号 + * */ + String generateOutsourceQuoteCode(); + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/OutsourceQuoteServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/OutsourceQuoteServiceImpl.java index 0271061e..ad1dbc4e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/OutsourceQuoteServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/OutsourceQuoteServiceImpl.java @@ -1,6 +1,8 @@ package com.ruoyi.system.service.impl; import java.util.List; + +import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.system.domain.OutsourceQuote; @@ -27,6 +29,9 @@ public class OutsourceQuoteServiceImpl implements IOutsourceQuoteService @Autowired private OutsourceQuoteMapper outsourceQuoteMapper; + @Autowired + private RedisCache redisCache; + /** * 查询委外报价 * @@ -149,4 +154,15 @@ public class OutsourceQuoteServiceImpl implements IOutsourceQuoteService } } } + + /** + * 自动生成委外报价编号 + * */ + @Override + public String generateOutsourceQuoteCode() { + + return redisCache.generateBillNo("WWBJ"); + } + + } diff --git a/ruoyi-admin/src/main/resources/templates/system/outsource_quote/add.html b/ruoyi-admin/src/main/resources/templates/system/outsource_quote/add.html index df6423d3..73901eaf 100644 --- a/ruoyi-admin/src/main/resources/templates/system/outsource_quote/add.html +++ b/ruoyi-admin/src/main/resources/templates/system/outsource_quote/add.html @@ -12,15 +12,12 @@

委外报价信息

-
- +
-
@@ -104,6 +101,19 @@ WWBJ002"> $.ajax(config) }; + + + //获取单号 + $.ajax({ + url: prefix + "/generateOutsourceQuoteCode", + type: "GET", + dateType: "json", + success: function (resp) { + console.log(resp) + if (resp != null) {$("input[name='outsourceQuoteCode']").val(resp);} else {$.modal.msgError("失败啦");} + } + }); + function submitHandler() { var url = prefix + "/add"; var outsourceQuote = {