Browse Source

编号获取优化

guq 7 years ago
parent
commit
f1abc3c998
25 changed files with 226 additions and 75 deletions
  1. 1 1
      applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/exception/BizExceptionCode.java
  2. 1 1
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/controller/MaxnumberController.java
  3. 2 1
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/MaxnumberService.java
  4. 0 1
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/impl/ExcelServiceImpl.java
  5. 34 38
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/impl/MaxnumberServiceImpl.java
  6. 14 3
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/BankinformationServiceImpl.java
  7. 14 3
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/BomServiceImpl.java
  8. 8 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/CustomerServiceImpl.java
  9. 9 2
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/EmployeeServiceImpl.java
  10. 8 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProductServiceImpl.java
  11. 14 3
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/VendorServiceImpl.java
  12. 14 3
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/WarehouseServiceImpl.java
  13. 8 1
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/FundtransferServiceImpl.java
  14. 8 1
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/OthreceiptsServiceImpl.java
  15. 8 1
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/OthspendingsServiceImpl.java
  16. 8 1
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/PaybalanceServiceImpl.java
  17. 8 1
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/RecbalanceServiceImpl.java
  18. 14 3
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/VerificationServiceImpl.java
  19. 7 1
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/ProdInOutServiceImpl.java
  20. 7 1
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/PurchaseServiceImpl.java
  21. 9 3
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/ProdInOutServiceImpl.java
  22. 8 1
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/SaleServiceImpl.java
  23. 7 1
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/impl/MakeServiceImpl.java
  24. 7 1
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/impl/ProdInOutServiceImpl.java
  25. 8 1
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/impl/StocktakingServiceImpl.java

+ 1 - 1
applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/exception/BizExceptionCode.java

@@ -36,7 +36,7 @@ public enum BizExceptionCode implements BaseExceptionCode {
     BIZ_RELUPDATE_AMOUNT(79312,"存在关联单据,不允许更新期初应收,期初预收,期初日期"),
     BIZ_RELUPDATE_AMOUNT(79312,"存在关联单据,不允许更新期初应收,期初预收,期初日期"),
     BIZ_BANNED(79313, "只能禁用已开启的单据"),
     BIZ_BANNED(79313, "只能禁用已开启的单据"),
     BIZ_ENABLE(79314, "只能开启已禁用的单据"),
     BIZ_ENABLE(79314, "只能开启已禁用的单据"),
-
+    BIZ_NULLCALLER(79315, "该单据的定义不存在"),
 
 
     NO_OPRATIONDATA(79400,"无可操作单据"),
     NO_OPRATIONDATA(79400,"无可操作单据"),
     NULL_DATA(23232,"无数据"),
     NULL_DATA(23232,"无数据"),

+ 1 - 1
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/controller/MaxnumberController.java

@@ -31,7 +31,7 @@ public class MaxnumberController {
     @PostMapping("/pushMaxnubmer")
     @PostMapping("/pushMaxnubmer")
     public Result<String> pushMaxnubmer(@RequestParam("count") Integer count, @RequestParam("code") String code,
     public Result<String> pushMaxnubmer(@RequestParam("count") Integer count, @RequestParam("code") String code,
                                 @RequestParam("caller") String caller) {
                                 @RequestParam("caller") String caller) {
-        return Result.success(maxnumberService.pushMaxnubmer(count, code, caller));
+        return maxnumberService.pushMaxnubmer(count, code, caller);
     }
     }
 
 
     @GetMapping("/list")
     @GetMapping("/list")

+ 2 - 1
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/MaxnumberService.java

@@ -1,6 +1,7 @@
 package com.usoftchina.saas.commons.service;
 package com.usoftchina.saas.commons.service;
 
 
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.base.Result;
 import com.usoftchina.saas.base.service.CommonBaseService;
 import com.usoftchina.saas.base.service.CommonBaseService;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.commons.dto.ListReqDTO;
 import com.usoftchina.saas.commons.dto.ListReqDTO;
@@ -15,7 +16,7 @@ import com.usoftchina.saas.page.PageRequest;
 public interface MaxnumberService extends CommonBaseService<MaxnumbersMapper, Maxnumbers> {
 public interface MaxnumberService extends CommonBaseService<MaxnumbersMapper, Maxnumbers> {
     String getMaxnumner(String caller, boolean update);
     String getMaxnumner(String caller, boolean update);
 
 
-    String pushMaxnubmer(Integer count, String code, String caller);
+    Result pushMaxnubmer(Integer count, String code, String caller);
 
 
     PageInfo<Maxnumbers> getListData(PageRequest page, ListReqDTO listReqDTO);
     PageInfo<Maxnumbers> getListData(PageRequest page, ListReqDTO listReqDTO);
 
 

+ 0 - 1
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/impl/ExcelServiceImpl.java

@@ -209,7 +209,6 @@ public class ExcelServiceImpl implements ExcelService{
                                        break;
                                        break;
                                    }
                                    }
                                }
                                }
-
                            }
                            }
                            //插入主表数据
                            //插入主表数据
                            if (null != mainData) {
                            if (null != mainData) {

+ 34 - 38
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/impl/MaxnumberServiceImpl.java

@@ -2,6 +2,7 @@ package com.usoftchina.saas.commons.service.impl;
 
 
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.base.Result;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.commons.dto.ListReqDTO;
 import com.usoftchina.saas.commons.dto.ListReqDTO;
@@ -52,7 +53,7 @@ public class MaxnumberServiceImpl extends CommonBaseServiceImpl<MaxnumbersMapper
     @Override
     @Override
     public String getMaxnumner(String caller, boolean update) {
     public String getMaxnumner(String caller, boolean update) {
         if (null == caller) {
         if (null == caller) {
-            return null;
+            throw new BizException(BizExceptionCode.BIZ_NULLCALLER);
         }
         }
         //单号
         //单号
         String maxcode = null;
         String maxcode = null;
@@ -67,35 +68,32 @@ public class MaxnumberServiceImpl extends CommonBaseServiceImpl<MaxnumbersMapper
         Long companyId = BaseContextHolder.getCompanyId();
         Long companyId = BaseContextHolder.getCompanyId();
         Long userId = BaseContextHolder.getUserId();
         Long userId = BaseContextHolder.getUserId();
         //查询编号规则
         //查询编号规则
-        Maxnumbers maxnumbers = getMaxnumbers(caller);
-        if (null != maxnumbers) {
-           rulecode = getRulecode(maxnumbers);
-           length = maxnumbers.getMn_number();
-            //查询从表是否存在该规则数据
-            Maxnumbersdetail detail = getMaxDetail(caller, rulecode);
-            if (null == detail) {
-                //不存在则插入
-                detail = new Maxnumbersdetail();
-                detail.setMd_caller(caller);
-                detail.setMd_leadcode(rulecode);
-                detail.setMd_maxno(maxno);
-                detail.setCompanyId(companyId);
-                detail.setCreateTime(new Date());
-                detail.setCreatorId(userId);
-                maxnumbersdetailMapper.insertSelective(detail);
-            } else {
-                //存在则取最大值
-                maxno = detail.getMd_maxno() + 1;
-            }
-            maxcode = rulecode + createSerialNum(length, maxno);
-            //如果以更新方式取编号
-            if (update) {
-                /*detail.setUpdateTime(new Date());
-                detail.setUpdaterId(userId);
-                detail.setMd_maxno(maxno);
-                maxnumbersdetailMapper.updateByPrimaryKeySelective(detail);*/
-                maxnumbersdetailMapper.updateMaxno(detail.getId(), maxno, BaseContextHolder.getCompanyId());
-            }
+        Maxnumbers maxnumbers = findMaxnumbers(caller);
+        if (maxnumbers == null) {
+            throw new BizException(BizExceptionCode.NULL_CODERULE);
+        }
+       rulecode = getRulecode(maxnumbers);
+       length = maxnumbers.getMn_number();
+        //查询从表是否存在该规则数据
+        Maxnumbersdetail detail = getMaxDetail(caller, rulecode);
+        if (null == detail) {
+            //不存在则插入
+            detail = new Maxnumbersdetail();
+            detail.setMd_caller(caller);
+            detail.setMd_leadcode(rulecode);
+            detail.setMd_maxno(maxno);
+            detail.setCompanyId(companyId);
+            detail.setCreateTime(new Date());
+            detail.setCreatorId(userId);
+            maxnumbersdetailMapper.insertSelective(detail);
+        } else {
+            //存在则取最大值
+            maxno = detail.getMd_maxno() + 1;
+        }
+        maxcode = rulecode + createSerialNum(length, maxno);
+        //如果以更新方式取编号
+        if (update) {
+            maxnumbersdetailMapper.updateMaxno(detail.getId(), maxno, BaseContextHolder.getCompanyId());
         }
         }
         return maxcode;
         return maxcode;
     }
     }
@@ -108,7 +106,7 @@ public class MaxnumberServiceImpl extends CommonBaseServiceImpl<MaxnumbersMapper
     * @Date: 2018/10/18
     * @Date: 2018/10/18
     */
     */
     @Override
     @Override
-    public String pushMaxnubmer(Integer count, String code, String caller) {
+    public Result<String> pushMaxnubmer(Integer count, String code, String caller) {
         //单号
         //单号
         String maxcode =  code;
         String maxcode =  code;
         //公司Id
         //公司Id
@@ -120,7 +118,7 @@ public class MaxnumberServiceImpl extends CommonBaseServiceImpl<MaxnumbersMapper
         //流水位数
         //流水位数
         Integer length = 0;
         Integer length = 0;
         //查询编号规则
         //查询编号规则
-        Maxnumbers maxnumbers = getMaxnumbers(caller);
+        Maxnumbers maxnumbers = findMaxnumbers(caller);
         if (null == maxnumbers) {
         if (null == maxnumbers) {
             throw new BizException(BizExceptionCode.NULL_CODERULE);
             throw new BizException(BizExceptionCode.NULL_CODERULE);
         }
         }
@@ -130,11 +128,11 @@ public class MaxnumberServiceImpl extends CommonBaseServiceImpl<MaxnumbersMapper
             if (count > 0) {
             if (count > 0) {
                 throw new BizException(BizExceptionCode.CODE_EXISTS);
                 throw new BizException(BizExceptionCode.CODE_EXISTS);
             }
             }
-            return maxcode;
+            return  Result.success(rulecode);
         }
         }
         //与规则匹配的编号
         //与规则匹配的编号
         if (count > 0) {
         if (count > 0) {
-            return getMaxnumner(caller, true);
+            return Result.success(getMaxnumner(caller, true));
         }
         }
 
 
         //查询从表是否存在该规则数据
         //查询从表是否存在该规则数据
@@ -152,7 +150,7 @@ public class MaxnumberServiceImpl extends CommonBaseServiceImpl<MaxnumbersMapper
             }
             }
 
 
         }
         }
-        return maxcode;
+        return Result.success(maxcode);
     }
     }
 
 
     @Override
     @Override
@@ -247,7 +245,7 @@ public class MaxnumberServiceImpl extends CommonBaseServiceImpl<MaxnumbersMapper
     * @Author: guq
     * @Author: guq
     * @Date: 2018/10/19
     * @Date: 2018/10/19
     */
     */
-    private Maxnumbers getMaxnumbers(String caller) {
+    private Maxnumbers findMaxnumbers(String caller) {
        Long companyId = BaseContextHolder.getCompanyId();
        Long companyId = BaseContextHolder.getCompanyId();
         return maxnumbersMapper.selectByCaller(caller, companyId);
         return maxnumbersMapper.selectByCaller(caller, companyId);
     }
     }
@@ -292,8 +290,6 @@ public class MaxnumberServiceImpl extends CommonBaseServiceImpl<MaxnumbersMapper
         } else {
         } else {
             date = "";
             date = "";
         }
         }
-/*        String date = "YYYYMM".equals(mn_rule) ? DateUtils.format(new Date(), "yyyyMM") :
-                DateUtils.format(new Date(), "yyyyMMdd");*/
         return rulecode += date;
         return rulecode += date;
     }
     }
 
 

+ 14 - 3
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/BankinformationServiceImpl.java

@@ -2,6 +2,7 @@ package com.usoftchina.saas.document.service.impl;
 
 
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.base.Result;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.api.MessageLogService;
 import com.usoftchina.saas.commons.api.MessageLogService;
@@ -242,8 +243,18 @@ public class BankinformationServiceImpl extends CommonBaseServiceImpl<Bankinform
             throw new BizException(BizExceptionCode.NULL_CODE);
             throw new BizException(BizExceptionCode.NULL_CODE);
         }
         }
         Long companyId = BaseContextHolder.getCompanyId();
         Long companyId = BaseContextHolder.getCompanyId();
-        Integer count = "0".equals(String.valueOf(id)) ? getMapper().validateCodeWhenInsert(code, companyId) :
-                getMapper().validateCodeWhenUpdate(code, id, companyId);
-        return maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.BANKINFORMATION.getCaller()).getData();
+        String billCode = null;
+        synchronized (BankinformationServiceImpl.class) {
+            Integer count = "0".equals(String.valueOf(id)) ? getMapper().validateCodeWhenInsert(code, companyId) :
+                    getMapper().validateCodeWhenUpdate(code, id, companyId);
+            Result<String> res = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.BANKINFORMATION.getCaller());
+            if (res.isSuccess()) {
+                billCode = res.getData();
+            } else {
+                throw new BizException(123456, res.getMessage());
+            }
+           //  maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.BANKINFORMATION.getCaller()).getData();
+        }
+        return billCode;
     }
     }
 }
 }

+ 14 - 3
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/BomServiceImpl.java

@@ -2,6 +2,7 @@ package com.usoftchina.saas.document.service.impl;
 
 
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.base.Result;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.api.MessageLogService;
 import com.usoftchina.saas.commons.api.MessageLogService;
@@ -310,8 +311,18 @@ public class BomServiceImpl extends CommonBaseServiceImpl<BomMapper, Bom> implem
             throw new BizException(BizExceptionCode.NULL_CODE);
             throw new BizException(BizExceptionCode.NULL_CODE);
         }
         }
         Long companyId = BaseContextHolder.getCompanyId();
         Long companyId = BaseContextHolder.getCompanyId();
-        Integer count = "0".equals(String.valueOf(id)) ? getMapper().validateCodeWhenInsert(code, companyId) :
-                getMapper().validateCodeWhenUpdate(code, id, companyId);
-        return maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.BOM.getCaller()).getData();
+        String billCode= null;
+        synchronized (BomServiceImpl.class) {
+            Integer count = "0".equals(String.valueOf(id)) ? getMapper().validateCodeWhenInsert(code, companyId) :
+                    getMapper().validateCodeWhenUpdate(code, id, companyId);
+            Result<String> res = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.BOM.getCaller());
+            if (res.isSuccess()) {
+                billCode = res.getData();
+            } else {
+                throw new BizException(123456, res.getMessage());
+            }
+            //maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.BOM.getCaller()).getData();
+        }
+        return billCode;
     }
     }
 }
 }

+ 8 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/CustomerServiceImpl.java

@@ -3,6 +3,7 @@ package com.usoftchina.saas.document.service.impl;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.base.Result;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.api.MessageLogService;
 import com.usoftchina.saas.commons.api.MessageLogService;
@@ -608,7 +609,13 @@ public class CustomerServiceImpl extends CommonBaseServiceImpl<CustomerMapper, C
         synchronized (CustomerServiceImpl.class){
         synchronized (CustomerServiceImpl.class){
             Integer count = "0".equals(String.valueOf(id)) ? getMapper().validateCodeWhenInsert(code, companyId) :
             Integer count = "0".equals(String.valueOf(id)) ? getMapper().validateCodeWhenInsert(code, companyId) :
                     getMapper().validateCodeWhenUpdate(code, id, companyId);
                     getMapper().validateCodeWhenUpdate(code, id, companyId);
-            cu_code =  maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.CUSTOMER.getCaller()).getData();
+            Result<String> res = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.CUSTOMER.getCaller());
+            if (res.isSuccess()) {
+                cu_code = res.getData();
+            } else {
+                throw new BizException(123456, res.getMessage());
+            }
+            //cu_code =  maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.CUSTOMER.getCaller()).getData();
         }
         }
         return cu_code;
         return cu_code;
     }
     }

+ 9 - 2
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/EmployeeServiceImpl.java

@@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.account.api.AccountApi;
 import com.usoftchina.saas.account.api.AccountApi;
 import com.usoftchina.saas.account.dto.AccountDTO;
 import com.usoftchina.saas.account.dto.AccountDTO;
+import com.usoftchina.saas.base.Result;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.api.MessageLogService;
 import com.usoftchina.saas.commons.api.MessageLogService;
@@ -211,10 +212,16 @@ public class EmployeeServiceImpl extends CommonBaseServiceImpl<EmployeeMapper, E
         synchronized (EmployeeServiceImpl.class){
         synchronized (EmployeeServiceImpl.class){
             Integer count = "0".equals(String.valueOf(id)) ? getMapper().validateCodeWhenInsert(code, companyId) :
             Integer count = "0".equals(String.valueOf(id)) ? getMapper().validateCodeWhenInsert(code, companyId) :
                     getMapper().validateCodeWhenUpdate(code, id, companyId);
                     getMapper().validateCodeWhenUpdate(code, id, companyId);
-            em_code =  maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.EMPLOYEE.getCaller()).getData();
+            Result<String> res = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.EMPLOYEE.getCaller());
+            if (res.isSuccess()) {
+                em_code = res.getData();
+            } else {
+                throw new BizException(123456, res.getMessage());
+            }
+            /*em_code =  maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.EMPLOYEE.getCaller()).getData();
             if (em_code==null){
             if (em_code==null){
                 em_code = code;
                 em_code = code;
-            }
+            }*/
         }
         }
         return em_code;
         return em_code;
     }
     }

+ 8 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProductServiceImpl.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.base.Result;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.api.MessageLogService;
 import com.usoftchina.saas.commons.api.MessageLogService;
@@ -688,7 +689,13 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
         synchronized (ProductServiceImpl.class) {
         synchronized (ProductServiceImpl.class) {
             Integer count = "0".equals(String.valueOf(id)) ? getMapper().validateCodeWhenInsert(code, companyId) :
             Integer count = "0".equals(String.valueOf(id)) ? getMapper().validateCodeWhenInsert(code, companyId) :
                     getMapper().validateCodeWhenUpdate(code, id, companyId);
                     getMapper().validateCodeWhenUpdate(code, id, companyId);
-            billCode = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.PRODUCT.getCaller()).getData();
+            Result<String> res = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.PRODUCT.getCaller());
+            if (res.isSuccess()) {
+                billCode = res.getData();
+            } else {
+                throw new BizException(123456, res.getMessage());
+            }
+            //billCode = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.PRODUCT.getCaller()).getData();
         }
         }
         return billCode;
         return billCode;
     }
     }

+ 14 - 3
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/VendorServiceImpl.java

@@ -3,6 +3,7 @@ package com.usoftchina.saas.document.service.impl;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.base.Result;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.api.MessageLogService;
 import com.usoftchina.saas.commons.api.MessageLogService;
@@ -525,9 +526,19 @@ public class VendorServiceImpl extends CommonBaseServiceImpl<VendorMapper, Vendo
             throw new BizException(BizExceptionCode.NULL_CODE);
             throw new BizException(BizExceptionCode.NULL_CODE);
         }
         }
         Long companyId = BaseContextHolder.getCompanyId();
         Long companyId = BaseContextHolder.getCompanyId();
-        Integer count = "0".equals(String.valueOf(id)) ? getMapper().validateCodeWhenInsert(code, companyId) :
-                getMapper().validateCodeWhenUpdate(code, id, companyId);
-        return maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.VENDOR.getCaller()).getData();
+        String billcode = null;
+        synchronized (VendorServiceImpl.class) {
+            Integer count = "0".equals(String.valueOf(id)) ? getMapper().validateCodeWhenInsert(code, companyId) :
+                    getMapper().validateCodeWhenUpdate(code, id, companyId);
+            Result<String> res = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.VENDOR.getCaller());
+            if (res.isSuccess()) {
+                billcode = res.getData();
+            } else {
+                throw new BizException(123456, res.getMessage());
+            }
+           //billcode = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.VENDOR.getCaller()).getData();
+        }
+        return billcode;
     }
     }
 
 
     /**
     /**

+ 14 - 3
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/WarehouseServiceImpl.java

@@ -2,6 +2,7 @@ package com.usoftchina.saas.document.service.impl;
 
 
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.base.Result;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.api.MessageLogService;
 import com.usoftchina.saas.commons.api.MessageLogService;
@@ -297,9 +298,19 @@ public class WarehouseServiceImpl extends CommonBaseServiceImpl<WarehouseMapper,
             throw new BizException(BizExceptionCode.NULL_CODE);
             throw new BizException(BizExceptionCode.NULL_CODE);
         }
         }
         Long companyId = BaseContextHolder.getCompanyId();
         Long companyId = BaseContextHolder.getCompanyId();
-        Integer count = "0".equals(String.valueOf(id)) ? getMapper().validateCodeWhenInsert(code, companyId) :
-                getMapper().validateCodeWhenUpdate(code, id, companyId);
-        return maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.WAREHOUSE.getCaller()).getData();
+        String billCode = null;
+        synchronized (WarehouseServiceImpl.class) {
+            Integer count = "0".equals(String.valueOf(id)) ? getMapper().validateCodeWhenInsert(code, companyId) :
+                    getMapper().validateCodeWhenUpdate(code, id, companyId);
+            Result<String> res = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.WAREHOUSE.getCaller());
+            if (res.isSuccess()) {
+                billCode = res.getData();
+            } else {
+                throw new BizException(123456, res.getMessage());
+            }
+            // maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.WAREHOUSE.getCaller()).getData();
+        }
+       return billCode;
     }
     }
 
 
     /**
     /**

+ 8 - 1
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/FundtransferServiceImpl.java

@@ -2,6 +2,7 @@ package com.usoftchina.saas.money.service.impl;
 
 
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.base.Result;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.api.MessageLogService;
 import com.usoftchina.saas.commons.api.MessageLogService;
@@ -362,7 +363,13 @@ public class FundtransferServiceImpl extends CommonBaseServiceImpl<FundtransferM
         synchronized(FundtransferServiceImpl.class) {
         synchronized(FundtransferServiceImpl.class) {
             Integer count = "0".equals(String.valueOf(id)) ? fundtransferMapper.validateCodeWhenInsert(code, companyId) :
             Integer count = "0".equals(String.valueOf(id)) ? fundtransferMapper.validateCodeWhenInsert(code, companyId) :
                     fundtransferMapper.validateCodeWhenUpdate(code, id, companyId);
                     fundtransferMapper.validateCodeWhenUpdate(code, id, companyId);
-            codeString = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.FUNDTRANSFER.getCaller()).getData();
+            Result<String> res = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.FUNDTRANSFER.getCaller());
+            if (res.isSuccess()) {
+                codeString = res.getData();
+            } else {
+                throw new BizException(123456, res.getMessage());
+            }
+            //codeString = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.FUNDTRANSFER.getCaller()).getData();
         }
         }
         return codeString;
         return codeString;
     }
     }

+ 8 - 1
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/OthreceiptsServiceImpl.java

@@ -2,6 +2,7 @@ package com.usoftchina.saas.money.service.impl;
 
 
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.base.Result;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.commons.api.CommonService;
 import com.usoftchina.saas.commons.api.CommonService;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.api.MaxnumberService;
@@ -382,7 +383,13 @@ public class OthreceiptsServiceImpl extends CommonBaseServiceImpl<OthreceiptsMap
         synchronized(OthreceiptsServiceImpl.class) {
         synchronized(OthreceiptsServiceImpl.class) {
             Integer count = "0".equals(String.valueOf(id)) ? othreceiptsMapper.validateCodeWhenInsert(code, companyId) :
             Integer count = "0".equals(String.valueOf(id)) ? othreceiptsMapper.validateCodeWhenInsert(code, companyId) :
                     othreceiptsMapper.validateCodeWhenUpdate(code, id, companyId);
                     othreceiptsMapper.validateCodeWhenUpdate(code, id, companyId);
-            codeString = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.OTHRECEIPTS.getCaller()).getData();
+            Result<String> res = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.OTHRECEIPTS.getCaller());
+            if (res.isSuccess()) {
+                codeString = res.getData();
+            } else {
+                throw new BizException(123456, res.getMessage());
+            }
+            //codeString = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.OTHRECEIPTS.getCaller()).getData();
         }
         }
         return codeString;
         return codeString;
     }
     }

+ 8 - 1
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/OthspendingsServiceImpl.java

@@ -2,6 +2,7 @@ package com.usoftchina.saas.money.service.impl;
 
 
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.base.Result;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.api.MessageLogService;
 import com.usoftchina.saas.commons.api.MessageLogService;
@@ -377,7 +378,13 @@ public class OthspendingsServiceImpl extends CommonBaseServiceImpl<OthspendingsM
         synchronized(OthspendingsServiceImpl.class) {
         synchronized(OthspendingsServiceImpl.class) {
             Integer count = "0".equals(String.valueOf(id)) ? othspendingsMapper.validateCodeWhenInsert(code, companyId) :
             Integer count = "0".equals(String.valueOf(id)) ? othspendingsMapper.validateCodeWhenInsert(code, companyId) :
                     othspendingsMapper.validateCodeWhenUpdate(code, id, companyId);
                     othspendingsMapper.validateCodeWhenUpdate(code, id, companyId);
-            codeString = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.OTHSPENDINGS.getCaller()).getData();
+            Result<String> res = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.OTHSPENDINGS.getCaller());
+            if (res.isSuccess()) {
+                codeString = res.getData();
+            } else {
+                throw new BizException(123456, res.getMessage());
+            }
+            //codeString = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.OTHSPENDINGS.getCaller()).getData();
         }
         }
         return codeString;
         return codeString;
     }
     }

+ 8 - 1
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/PaybalanceServiceImpl.java

@@ -2,6 +2,7 @@ package com.usoftchina.saas.money.service.impl;
 
 
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.base.Result;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.commons.api.CommonService;
 import com.usoftchina.saas.commons.api.CommonService;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.api.MaxnumberService;
@@ -510,7 +511,13 @@ public class PaybalanceServiceImpl extends CommonBaseServiceImpl<PaybalanceMappe
         synchronized(PaybalanceServiceImpl.class) {
         synchronized(PaybalanceServiceImpl.class) {
             Integer count = "0".equals(String.valueOf(id)) ? paybalanceMapper.validateCodeWhenInsert(code, companyId) :
             Integer count = "0".equals(String.valueOf(id)) ? paybalanceMapper.validateCodeWhenInsert(code, companyId) :
                     paybalanceMapper.validateCodeWhenUpdate(code, id, companyId);
                     paybalanceMapper.validateCodeWhenUpdate(code, id, companyId);
-            codeString = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.PAYBALANCE.getCaller()).getData();
+            Result<String> res = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.PAYBALANCE.getCaller());
+            if (res.isSuccess()) {
+                codeString = res.getData();
+            } else {
+                throw new BizException(123456, res.getMessage());
+            }
+            //codeString = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.PAYBALANCE.getCaller()).getData();
         }
         }
         return codeString;
         return codeString;
     }
     }

+ 8 - 1
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/RecbalanceServiceImpl.java

@@ -2,6 +2,7 @@ package com.usoftchina.saas.money.service.impl;
 
 
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.base.Result;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.commons.api.CommonService;
 import com.usoftchina.saas.commons.api.CommonService;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.api.MaxnumberService;
@@ -521,7 +522,13 @@ public class RecbalanceServiceImpl extends CommonBaseServiceImpl<RecbalanceMappe
         synchronized(RecbalanceServiceImpl.class) {
         synchronized(RecbalanceServiceImpl.class) {
             Integer count = "0".equals(String.valueOf(id)) ? recbalanceMapper.validateCodeWhenInsert(code, companyId) :
             Integer count = "0".equals(String.valueOf(id)) ? recbalanceMapper.validateCodeWhenInsert(code, companyId) :
                     recbalanceMapper.validateCodeWhenUpdate(code, id, companyId);
                     recbalanceMapper.validateCodeWhenUpdate(code, id, companyId);
-            codeString = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.RECBALANCE.getCaller()).getData();
+            Result<String> res = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.RECBALANCE.getCaller());
+            if (res.isSuccess()) {
+                codeString = res.getData();
+            } else {
+                throw new BizException(123456, res.getMessage());
+            }
+            //codeString = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.RECBALANCE.getCaller()).getData();
         }
         }
         return codeString;
         return codeString;
     }
     }

+ 14 - 3
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/VerificationServiceImpl.java

@@ -2,6 +2,7 @@ package com.usoftchina.saas.money.service.impl;
 
 
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.base.Result;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.api.MessageLogService;
 import com.usoftchina.saas.commons.api.MessageLogService;
@@ -1081,8 +1082,18 @@ public class VerificationServiceImpl extends CommonBaseServiceImpl<VerificationM
         if (null == code) {
         if (null == code) {
             throw new BizException(BizExceptionCode.NULL_CODE);
             throw new BizException(BizExceptionCode.NULL_CODE);
         }
         }
-        Integer count = "0".equals(String.valueOf(id)) ? verificationMapper.validateCodeWhenInsert(code) :
-                verificationMapper.validateCodeWhenUpdate(code, id);
-        return maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.VERIFICATION.getCaller()).getData();
+        String billCode = null;
+        synchronized (VerificationServiceImpl.class) {
+            Integer count = "0".equals(String.valueOf(id)) ? verificationMapper.validateCodeWhenInsert(code) :
+                    verificationMapper.validateCodeWhenUpdate(code, id);
+            Result<String> res = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.VERIFICATION.getCaller());
+            if (res.isSuccess()) {
+                billCode = res.getData();
+            } else {
+                throw new BizException(123456, res.getMessage());
+            }
+        }
+        return billCode;
+       // return maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.VERIFICATION.getCaller()).getData();
     }
     }
 }
 }

+ 7 - 1
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/ProdInOutServiceImpl.java

@@ -646,7 +646,13 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
             }else if("采购验退单".equals(pi_class)) {
             }else if("采购验退单".equals(pi_class)) {
                 caller = BillCodeSeq.PURCHASEOUT.getCaller();
                 caller = BillCodeSeq.PURCHASEOUT.getCaller();
             }
             }
-            billCode = maxnumberService.pushMaxnubmer(count, pi_inoutno, caller).getData();
+            Result<String> res = maxnumberService.pushMaxnubmer(count, pi_inoutno, caller);
+            if (res.isSuccess()) {
+                billCode = res.getData();
+            } else {
+                throw new BizException(123456, res.getMessage());
+            }
+            //billCode = maxnumberService.pushMaxnubmer(count, pi_inoutno, caller).getData();
         }
         }
         return billCode;
         return billCode;
     }
     }

+ 7 - 1
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/PurchaseServiceImpl.java

@@ -607,7 +607,13 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
         synchronized (PurchaseServiceImpl.class) {
         synchronized (PurchaseServiceImpl.class) {
             Integer count = "0".equals(String.valueOf(id)) ? purchaseMapper.validateCodeWhenInsert(code, companyId) :
             Integer count = "0".equals(String.valueOf(id)) ? purchaseMapper.validateCodeWhenInsert(code, companyId) :
                     purchaseMapper.validateCodeWhenUpdate(code, id, companyId);
                     purchaseMapper.validateCodeWhenUpdate(code, id, companyId);
-            billCode = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.PURCHASE.getCaller()).getData();
+            Result<String> res = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.PURCHASE.getCaller());
+            if (res.isSuccess()) {
+                billCode = res.getData();
+            } else {
+                throw new BizException(123456, res.getMessage());
+            }
+           // billCode = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.PURCHASE.getCaller()).getData();
         }
         }
         return billCode;
         return billCode;
     }
     }

+ 9 - 3
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/ProdInOutServiceImpl.java

@@ -636,13 +636,19 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         synchronized (ProdInOutServiceImpl.class) {
         synchronized (ProdInOutServiceImpl.class) {
             Integer count = "0".equals(String.valueOf(id)) ? prodInOutMapper.validateCodeWhenInsert(code,pi_class) :
             Integer count = "0".equals(String.valueOf(id)) ? prodInOutMapper.validateCodeWhenInsert(code,pi_class) :
                     prodInOutMapper.validateCodeWhenUpdate(code, id);
                     prodInOutMapper.validateCodeWhenUpdate(code, id);
-            String caller ="";
-            if(pi_class.equals("出货单")){
+            String caller = "出货单".equals(pi_class) ? BillCodeSeq.SALEOUT.getCaller() : BillCodeSeq.SALEIN.getCaller();
+           /* if(pi_class.equals("出货单")){
                 caller = BillCodeSeq.SALEOUT.getCaller();
                 caller = BillCodeSeq.SALEOUT.getCaller();
             }else {//销售退货单
             }else {//销售退货单
                 caller = BillCodeSeq.SALEIN.getCaller();
                 caller = BillCodeSeq.SALEIN.getCaller();
+            }*/
+            Result<String> res = maxnumberService.pushMaxnubmer(count, code, caller);
+            if (res.isSuccess()) {
+                billCode = res.getData();
+            } else {
+                throw new BizException(123456, res.getMessage());
             }
             }
-            billCode = maxnumberService.pushMaxnubmer(count, code, caller).getData();
+            //billCode = maxnumberService.pushMaxnubmer(count, code, caller).getData();
         }
         }
         return billCode;
         return billCode;
     }
     }

+ 8 - 1
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/SaleServiceImpl.java

@@ -2,6 +2,7 @@ package com.usoftchina.saas.sale.service.impl;
 
 
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.base.Result;
 import com.usoftchina.saas.commons.api.CommonService;
 import com.usoftchina.saas.commons.api.CommonService;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.api.MessageLogService;
 import com.usoftchina.saas.commons.api.MessageLogService;
@@ -669,7 +670,13 @@ public class SaleServiceImpl implements SaleService{
         synchronized(SaleServiceImpl.class) {
         synchronized(SaleServiceImpl.class) {
             Integer count = "0".equals(String.valueOf(id)) ? saleMapper.validateCodeWhenInsert(code, companyId) :
             Integer count = "0".equals(String.valueOf(id)) ? saleMapper.validateCodeWhenInsert(code, companyId) :
                     saleMapper.validateCodeWhenUpdate(code, id, companyId);
                     saleMapper.validateCodeWhenUpdate(code, id, companyId);
-            billCode = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.SALE.getCaller()).getData();
+            Result<String> res = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.SALE.getCaller());
+            if (res.isSuccess()) {
+                billCode = res.getData();
+            } else {
+                throw new BizException(123456, res.getMessage());
+            }
+            //billCode = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.SALE.getCaller()).getData();
         }
         }
         return billCode;
         return billCode;
     }
     }

+ 7 - 1
applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/impl/MakeServiceImpl.java

@@ -807,7 +807,13 @@ public class MakeServiceImpl extends CommonBaseServiceImpl<MakeMapper, Make> imp
         synchronized (MakeServiceImpl.class){
         synchronized (MakeServiceImpl.class){
             Integer count = "0".equals(String.valueOf(id)) ? getMapper().validateCodeWhenInsert(code, companyId) :
             Integer count = "0".equals(String.valueOf(id)) ? getMapper().validateCodeWhenInsert(code, companyId) :
                     getMapper().validateCodeWhenUpdate(code, id, companyId);
                     getMapper().validateCodeWhenUpdate(code, id, companyId);
-            ma_code =  maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.MAKE.getCaller()).getData();
+            Result<String> res = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.MAKE.getCaller());
+            if (res.isSuccess()) {
+                ma_code = res.getData();
+            } else {
+                throw new BizException(123456, res.getMessage());
+            }
+           // ma_code =  maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.MAKE.getCaller()).getData();
         }
         }
         return ma_code;
         return ma_code;
     }
     }

+ 7 - 1
applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/impl/ProdInOutServiceImpl.java

@@ -460,7 +460,13 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
             }else if("调拨单".equals(pi_class)) {
             }else if("调拨单".equals(pi_class)) {
                 caller = BillCodeSeq.APPROPRIATIONINOUT.getCaller();
                 caller = BillCodeSeq.APPROPRIATIONINOUT.getCaller();
             }
             }
-            code = maxnumberService.pushMaxnubmer(count, pi_inoutno, caller).getData();
+            Result<String> res = maxnumberService.pushMaxnubmer(count, pi_inoutno, caller);
+            if (res.isSuccess()) {
+                code = res.getData();
+            } else {
+                throw new BizException(123456, res.getMessage());
+            }
+            //code = maxnumberService.pushMaxnubmer(count, pi_inoutno, caller).getData();
         }
         }
         return code;
         return code;
     }
     }

+ 8 - 1
applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/impl/StocktakingServiceImpl.java

@@ -2,6 +2,7 @@ package com.usoftchina.saas.storage.service.impl;
 
 
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.base.Result;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
@@ -216,7 +217,13 @@ public class StocktakingServiceImpl extends CommonBaseServiceImpl<StockTakingMap
             }else if("其它出库单".equals(pi_class)) {
             }else if("其它出库单".equals(pi_class)) {
                 caller = BillCodeSeq.OTHEROUT.getCaller();
                 caller = BillCodeSeq.OTHEROUT.getCaller();
             }
             }
-            billCode = maxnumberService.pushMaxnubmer(count, pi_inoutno, caller).getData();
+            Result<String> res = maxnumberService.pushMaxnubmer(count, pi_inoutno, caller);
+            if (res.isSuccess()) {
+                billCode = res.getData();
+            } else {
+                throw new BizException(123456, res.getMessage());
+            }
+            //billCode = maxnumberService.pushMaxnubmer(count, pi_inoutno, caller).getData();
         }
         }
         return billCode;
         return billCode;
     }
     }