瀏覽代碼

Merge remote-tracking branch 'origin/dev_huangjunjie'

yz 1 天之前
父節點
當前提交
7f498d23ec

+ 4 - 0
src/main/java/com/jsh/erp/constants/ExceptionConstants.java

@@ -513,6 +513,10 @@ public class ExceptionConstants {
     public static final int DEPOT_ITEM_PRE_BILL_IS_CHANGE_CODE = 9000007;
     public static final int DEPOT_ITEM_PRE_BILL_IS_CHANGE_CODE = 9000007;
     public static final String DEPOT_ITEM_PRE_BILL_IS_CHANGE_MSG = "抱歉,原关联单据已被修改,请重新关联";
     public static final String DEPOT_ITEM_PRE_BILL_IS_CHANGE_MSG = "抱歉,原关联单据已被修改,请重新关联";
 
 
+    //单据明细-明细中生产日期格式错误
+    public static final int DEPOT_ITEM_PRODUCTION_DATE_TIME_CODE = 9000008;
+    public static final String DEPOT_ITEM_PRODUCTION_DATE_TIME_MSG = "抱歉,第%s行生产日期格式错误";
+
     /**
     /**
      *  财务信息
      *  财务信息
      * type = 95
      * type = 95

+ 33 - 2
src/main/java/com/jsh/erp/controller/DepotItemController.java

@@ -1028,7 +1028,7 @@ public class DepotItemController {
             } else {
             } else {
                 List<Map<String, String>> detailList = new ArrayList<>();
                 List<Map<String, String>> detailList = new ArrayList<>();
                 for (int i = 2; i < src.getRows(); i++) {
                 for (int i = 2; i < src.getRows(); i++) {
-                    String depotName = "", barCode = "", num = "", unitPrice = "", taxRate = "", remark = "";
+                    String depotName = "", barCode = "",productionDate = "", num = "", unitPrice = "", taxRate = "", remark = "";
                     if("QGD".equals(prefixNo)) {
                     if("QGD".equals(prefixNo)) {
                         barCode = ExcelUtils.getContent(src, i, 0);
                         barCode = ExcelUtils.getContent(src, i, 0);
                         num = ExcelUtils.getContent(src, i, 2);
                         num = ExcelUtils.getContent(src, i, 2);
@@ -1045,12 +1045,42 @@ public class DepotItemController {
                         //采购入库
                         //采购入库
                         depotName = ExcelUtils.getContent(src, i, 0);
                         depotName = ExcelUtils.getContent(src, i, 0);
                         barCode = ExcelUtils.getContent(src, i, 1);
                         barCode = ExcelUtils.getContent(src, i, 1);
+                        productionDate = ExcelUtils.getContent(src, i, 3);
+                        String format = "yyyy-MM-dd";
+                        //校验日期格式
+                        if (!DateUtils.isDateValid(productionDate,format)){
+                            throw new BusinessRunTimeException(ExceptionConstants.DEPOT_ITEM_PRODUCTION_DATE_TIME_CODE,
+                                    String.format(ExceptionConstants.DEPOT_ITEM_PRODUCTION_DATE_TIME_MSG, barCode));
+                        }
+                        num = ExcelUtils.getContent(src, i, 4);
+                        unitPrice = ExcelUtils.getContent(src, i, 5);
+                        taxRate = ExcelUtils.getContent(src, i, 6);
+                        remark = ExcelUtils.getContent(src, i, 7);
+                    }
+                    if("QTRK".equals(prefixNo)) {
+                        //其他入库
+                        depotName = ExcelUtils.getContent(src, i, 0);
+                        barCode = ExcelUtils.getContent(src, i, 1);
+                        productionDate = ExcelUtils.getContent(src, i, 3);
+                        String format = "yyyy-MM-dd";
+                        //校验日期格式
+                        if (!DateUtils.isDateValid(productionDate,format)){
+                            throw new BusinessRunTimeException(ExceptionConstants.DEPOT_ITEM_PRODUCTION_DATE_TIME_CODE,
+                                    String.format(ExceptionConstants.DEPOT_ITEM_PRODUCTION_DATE_TIME_MSG, barCode));
+                        }
+                        num = ExcelUtils.getContent(src, i, 4);
+                        unitPrice = ExcelUtils.getContent(src, i, 5);
+                        remark = ExcelUtils.getContent(src, i, 6);
+                    }
+                    if("XSCK".equals(prefixNo)) {
+                        depotName = ExcelUtils.getContent(src, i, 0);
+                        barCode = ExcelUtils.getContent(src, i, 1);
                         num = ExcelUtils.getContent(src, i, 3);
                         num = ExcelUtils.getContent(src, i, 3);
                         unitPrice = ExcelUtils.getContent(src, i, 4);
                         unitPrice = ExcelUtils.getContent(src, i, 4);
                         taxRate = ExcelUtils.getContent(src, i, 5);
                         taxRate = ExcelUtils.getContent(src, i, 5);
                         remark = ExcelUtils.getContent(src, i, 6);
                         remark = ExcelUtils.getContent(src, i, 6);
                     }
                     }
-                    if("QTRK".equals(prefixNo) || "QTCK".equals(prefixNo)) {
+                    if("QTCK".equals(prefixNo)) {
                         depotName = ExcelUtils.getContent(src, i, 0);
                         depotName = ExcelUtils.getContent(src, i, 0);
                         barCode = ExcelUtils.getContent(src, i, 1);
                         barCode = ExcelUtils.getContent(src, i, 1);
                         num = ExcelUtils.getContent(src, i, 3);
                         num = ExcelUtils.getContent(src, i, 3);
@@ -1064,6 +1094,7 @@ public class DepotItemController {
                     materialMap.put("unitPrice", unitPrice);
                     materialMap.put("unitPrice", unitPrice);
                     materialMap.put("taxRate", taxRate);
                     materialMap.put("taxRate", taxRate);
                     materialMap.put("remark", remark);
                     materialMap.put("remark", remark);
+                    materialMap.put("productionDate", productionDate);
                     detailList.add(materialMap);
                     detailList.add(materialMap);
                     barCodes += "'" + barCode + "',";
                     barCodes += "'" + barCode + "',";
                 }
                 }

+ 2 - 12
src/main/java/com/jsh/erp/controller/UserController.java

@@ -332,18 +332,8 @@ public class UserController extends BaseController {
     @ResponseBody
     @ResponseBody
     public Object addUser(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception{
     public Object addUser(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception{
         JSONObject result = ExceptionConstants.standardSuccess();
         JSONObject result = ExceptionConstants.standardSuccess();
-        User userInfo = userService.getCurrentUser();
-        Tenant tenant = tenantService.getTenantByTenantId(userInfo.getTenantId());
-        Long count = userService.countUser(null,null);
-        if(tenant!=null) {
-            if(count>= tenant.getUserNumLimit()) {
-                throw new BusinessParamCheckingException(ExceptionConstants.USER_OVER_LIMIT_FAILED_CODE,
-                        ExceptionConstants.USER_OVER_LIMIT_FAILED_MSG);
-            } else {
-                UserEx ue= JSONObject.parseObject(obj.toJSONString(), UserEx.class);
-                userService.addUserAndOrgUserRel(ue, request);
-            }
-        }
+        UserEx ue= JSONObject.parseObject(obj.toJSONString(), UserEx.class);
+        userService.addUserAndOrgUserRel(ue, request);
         return result;
         return result;
     }
     }
 
 

+ 1 - 1
src/main/java/com/jsh/erp/datasource/entities/DepotItem.java

@@ -109,7 +109,7 @@ public class DepotItem {
     private Date createTime;
     private Date createTime;
 
 
     @ApiModelProperty("生产日期")
     @ApiModelProperty("生产日期")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd")
     private Date productionDate;
     private Date productionDate;
 
 
     @ApiModelProperty("保质期天数")
     @ApiModelProperty("保质期天数")

+ 6 - 0
src/main/java/com/jsh/erp/service/impl/DepotItemServiceImpl.java

@@ -21,6 +21,7 @@ import com.jsh.erp.exception.BusinessRunTimeException;
 import com.jsh.erp.exception.JshException;
 import com.jsh.erp.exception.JshException;
 import com.jsh.erp.query.LambdaQueryWrapperX;
 import com.jsh.erp.query.LambdaQueryWrapperX;
 import com.jsh.erp.service.*;
 import com.jsh.erp.service.*;
+import com.jsh.erp.utils.DateUtils;
 import com.jsh.erp.utils.HttpClient;
 import com.jsh.erp.utils.HttpClient;
 import com.jsh.erp.utils.StringUtil;
 import com.jsh.erp.utils.StringUtil;
 import com.jsh.erp.utils.Tools;
 import com.jsh.erp.utils.Tools;
@@ -1626,6 +1627,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                     String remark = detailMap.get("remark");
                     String remark = detailMap.get("remark");
                     item.put("operNumber", operNumber);
                     item.put("operNumber", operNumber);
                     item.put("unitPrice", unitPrice);
                     item.put("unitPrice", unitPrice);
+                    item.put("productionDate",detailMap.get("productionDate"));
                     BigDecimal allPrice = BigDecimal.ZERO;
                     BigDecimal allPrice = BigDecimal.ZERO;
                     if(unitPrice!=null && unitPrice.compareTo(BigDecimal.ZERO)!=0) {
                     if(unitPrice!=null && unitPrice.compareTo(BigDecimal.ZERO)!=0) {
                         allPrice = unitPrice.multiply(operNumber);
                         allPrice = unitPrice.multiply(operNumber);
@@ -1640,6 +1642,10 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                     item.put("taxMoney", taxMoney);
                     item.put("taxMoney", taxMoney);
                     item.put("taxLastMoney", taxLastMoney);
                     item.put("taxLastMoney", taxLastMoney);
                     item.put("remark", remark);
                     item.put("remark", remark);
+                    item.put("expiryNum",m.getExpiryNum());
+                    item.put("wholesaleDecimal",m.getDefaultWholesaleDecimal());
+                    item.put("defaultPurchaseDecimal",m.getDefaultPurchaseDecimal());
+                    item.put("defaultWholesaleDecimal",m.getDefaultWholesaleDecimal());
                     arr.add(item);
                     arr.add(item);
                 } else {
                 } else {
                     throw new BusinessRunTimeException(ExceptionConstants.DEPOT_ITEM_BARCODE_IS_NOT_EXIST_CODE,
                     throw new BusinessRunTimeException(ExceptionConstants.DEPOT_ITEM_BARCODE_IS_NOT_EXIST_CODE,

+ 14 - 0
src/main/java/com/jsh/erp/utils/DateUtils.java

@@ -7,6 +7,7 @@ import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
 import java.time.*;
 import java.time.*;
 import java.time.format.DateTimeFormatter;
 import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeParseException;
 import java.util.*;
 import java.util.*;
 
 
 /**
 /**
@@ -319,4 +320,17 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         }
         }
         return dates;
         return dates;
     }
     }
+
+    /**
+     * 校验字符日期格式是否正确
+     */
+    public static boolean isDateValid(String inputDate, String format) {
+        try {
+            DateTimeFormatter formatter = DateTimeFormatter.ofPattern(format);
+            LocalDate.parse(inputDate, formatter);
+        } catch (DateTimeParseException e) {
+            return false;
+        }
+        return true;
+    }
 }
 }