2
0

10 Коммиты 585781e077 ... 04c61fdd78

Автор SHA1 Сообщение Дата
  廖泽勇 04c61fdd78 Merge branch 'dev_ml' of http://121.40.253.172:3000/pengyue/jsh_erp 1 месяц назад
  yz 0eb9380888 Merge remote-tracking branch 'origin/master' 1 месяц назад
  yz 059c96432b Merge remote-tracking branch 'origin/dev_huangjunjie' 1 месяц назад
  huang 8fa463e7f3 订单导入,供应商导入修改 1 месяц назад
  廖泽勇 3374fedaa3 Merge branch 'dev_ml' of http://121.40.253.172:3000/pengyue/jsh_erp 1 месяц назад
  yz 8a3b3240cb Merge remote-tracking branch 'origin/master' 1 месяц назад
  yz 7f498d23ec Merge remote-tracking branch 'origin/dev_huangjunjie' 1 месяц назад
  huang 45ceb5ae86 入库的导入模板(采购入库、其他入库)增加生产日期字段 1 месяц назад
  huang 7961b519a6 入库的导入模板(采购入库、其他入库)增加生产日期字段 1 месяц назад
  huang 4426fe056d 添加用户修改 1 месяц назад

+ 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 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

+ 37 - 5
src/main/java/com/jsh/erp/controller/DepotItemController.java

@@ -276,7 +276,7 @@ public class DepotItemController {
                     item.put("anotherDepotName", diEx.getAnotherDepotId() == null ? "" : diEx.getAnotherDepotName());
                     item.put("mType", diEx.getMaterialType());
                     item.put("op", 1);
-                    String productionDate = diEx.getProductionDate() == null ? null : DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",diEx.getProductionDate());
+                    String productionDate = diEx.getProductionDate() == null ? null : DateUtils.parseDateToStr("yyyy-MM-dd",diEx.getProductionDate());
                     item.put("productionDate",productionDate);
                     item.put("expiryNum",diEx.getExpiryNum());
                     item.put("supplierId",diEx.getSupplierId());
@@ -290,11 +290,12 @@ public class DepotItemController {
                     item.put("warehousingVariance",diEx.getWarehousingVariance());
                     item.put("reasonOfDifference",diEx.getReasonOfDifference());
                     item.put("warehousingUser",diEx.getWarehousingUser());
-                    item.put("warehousingTime",diEx.getWarehousingTime());
+                    item.put("warehousingTime",diEx.getWarehousingTime() == null ? null : DateUtils.parseDateToStr("yyyy-MM-dd",diEx.getWarehousingTime()));
                     item.put("warehousingUserName",diEx.getWarehousingUserName());
                     item.put("wholesaleDecimal",diEx.getWholesaleDecimal());
                     item.put("defaultPurchaseDecimal",diEx.getDefaultPurchaseDecimal());
                     item.put("defaultWholesaleDecimal",diEx.getDefaultWholesaleDecimal());
+                    item.put("ratio",diEx.getRatio());
                     dataArray.add(item);
                     //合计数据汇总
                     totalOperNumber = totalOperNumber.add(diEx.getOperNumber()==null?BigDecimal.ZERO:diEx.getOperNumber());
@@ -1028,7 +1029,7 @@ public class DepotItemController {
             } else {
                 List<Map<String, String>> detailList = new ArrayList<>();
                 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)) {
                         barCode = ExcelUtils.getContent(src, i, 0);
                         num = ExcelUtils.getContent(src, i, 2);
@@ -1041,16 +1042,46 @@ public class DepotItemController {
                         taxRate = ExcelUtils.getContent(src, i, 4);
                         remark = ExcelUtils.getContent(src, i, 5);
                     }
-                    if("CGRK".equals(prefixNo) || "XSCK".equals(prefixNo)) {
+                    if("CGRK".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);
+                        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);
                         unitPrice = ExcelUtils.getContent(src, i, 4);
                         taxRate = ExcelUtils.getContent(src, i, 5);
                         remark = ExcelUtils.getContent(src, i, 6);
                     }
-                    if("QTRK".equals(prefixNo) || "QTCK".equals(prefixNo)) {
+                    if("QTCK".equals(prefixNo)) {
                         depotName = ExcelUtils.getContent(src, i, 0);
                         barCode = ExcelUtils.getContent(src, i, 1);
                         num = ExcelUtils.getContent(src, i, 3);
@@ -1064,6 +1095,7 @@ public class DepotItemController {
                     materialMap.put("unitPrice", unitPrice);
                     materialMap.put("taxRate", taxRate);
                     materialMap.put("remark", remark);
+                    materialMap.put("productionDate", productionDate);
                     detailList.add(materialMap);
                     barCodes += "'" + barCode + "',";
                 }

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

@@ -332,18 +332,8 @@ public class UserController extends BaseController {
     @ResponseBody
     public Object addUser(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception{
         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;
     }
 

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

@@ -103,13 +103,14 @@ public class DepotItem {
     private Long warehousingUser;
 
     @ApiModelProperty("出入库时间")
-    private String warehousingTime;
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date warehousingTime;
 
     @ApiModelProperty("创建时间")
     private Date createTime;
 
     @ApiModelProperty("生产日期")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd")
     private Date productionDate;
 
     @ApiModelProperty("保质期天数")

+ 2 - 0
src/main/java/com/jsh/erp/datasource/entities/DepotItemVo4WithInfoEx.java

@@ -1,5 +1,6 @@
 package com.jsh.erp.datasource.entities;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
@@ -60,6 +61,7 @@ public class DepotItemVo4WithInfoEx extends DepotItem{
     private String brand;
 
     @ApiModelProperty("生产日期")
+    @JsonFormat(pattern = "yyyy-MM-dd")
     private Date productionDate;
 
     @ApiModelProperty("保质期天数")

+ 7 - 2
src/main/java/com/jsh/erp/service/impl/DepotHeadServiceImpl.java

@@ -1331,6 +1331,7 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
         /**入库和出库处理单据子表信息*/
         depotItemService.saveDetials(rows,depotHead.getId(), "update",request);
         //修改订单总额
+        updateTotalPriceById(depotHead);
 //        if (depotHead.getSubType().equals("采购") || depotHead.getSubType().equals("销售")){
 //            updateTotalPriceById(depotHead);
 //        }
@@ -2002,6 +2003,7 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
         depotHead.setRemark(pdaDepotHeadDTO.getRemark());
         depotHead.setCreateTime(new Timestamp(System.currentTimeMillis()));
         depotHead.setStatus("2");
+        depotHead.setOtherMoney(BigDecimal.ZERO);
         //添加主表
         depotHeadMapper.insertSelective(depotHead);
         //根据单据编号查询单据id
@@ -2118,8 +2120,11 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
             if (depotHead.getTotalPrice().compareTo(BigDecimal.ZERO) < 0){
                 totalPrice = totalPrice.negate();
             }
-            this.update(new UpdateWrapper<DepotHead>().set("total_price",totalPrice).set("discount_last_money",sum).eq("id",depotHead.getId()));
-
+            if ("采购".equals(depotHead.getSubType()) || "销售".equals(depotHead.getSubType()) && depotHead.getChangeAmount().compareTo(BigDecimal.ZERO) == 0){
+                this.update(new UpdateWrapper<DepotHead>().set("change_amount",totalPrice).set("total_price",totalPrice).set("discount_last_money",sum).eq("id",depotHead.getId()));
+            }else {
+                this.update(new UpdateWrapper<DepotHead>().set("total_price",totalPrice).set("discount_last_money",sum).eq("id",depotHead.getId()));
+            }
     }
 
 }

+ 17 - 8
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.query.LambdaQueryWrapperX;
 import com.jsh.erp.service.*;
+import com.jsh.erp.utils.DateUtils;
 import com.jsh.erp.utils.HttpClient;
 import com.jsh.erp.utils.StringUtil;
 import com.jsh.erp.utils.Tools;
@@ -550,7 +551,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                 //出入库用户
                 depotItem.setWarehousingUser(rowObj.getLong("warehousingUser"));
                 //warehousingTime
-                depotItem.setWarehousingTime(rowObj.getString("warehousingTime"));
+                depotItem.setWarehousingTime(rowObj.getDate("warehousingTime"));
                 //生产日期
                 depotItem.setProductionDate(rowObj.getDate("productionDate"));
                 //保质期天数
@@ -1613,22 +1614,24 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                     }
                     if(StringUtil.isNotEmpty(detailMap.get("unitPrice"))) {
                         unitPrice = new BigDecimal(detailMap.get("unitPrice"));
-                    } else {
-                        if("CGDD".equals(prefixNo)) {
-                            unitPrice = m.getPurchaseDecimal();
-                        } else if("XSDD".equals(prefixNo)) {
-                            unitPrice = m.getWholesaleDecimal();
-                        }
                     }
+//                    else {
+//                        if("CGDD".equals(prefixNo)) {
+//                            unitPrice = m.getPurchaseDecimal();
+//                        } else if("XSDD".equals(prefixNo)) {
+//                            unitPrice = m.getWholesaleDecimal();
+//                        }
+//                    }
                     if(StringUtil.isNotEmpty(detailMap.get("taxRate"))) {
                         taxRate = new BigDecimal(detailMap.get("taxRate"));
                     }
                     String remark = detailMap.get("remark");
                     item.put("operNumber", operNumber);
                     item.put("unitPrice", unitPrice);
+                    item.put("productionDate",detailMap.get("productionDate"));
                     BigDecimal allPrice = BigDecimal.ZERO;
                     if(unitPrice!=null && unitPrice.compareTo(BigDecimal.ZERO)!=0) {
-                        allPrice = unitPrice.multiply(operNumber);
+                        allPrice = unitPrice.multiply(operNumber).multiply(m.getRatio());
                     }
                     BigDecimal taxMoney = BigDecimal.ZERO;
                     if(taxRate.compareTo(BigDecimal.ZERO) != 0) {
@@ -1640,6 +1643,12 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                     item.put("taxMoney", taxMoney);
                     item.put("taxLastMoney", taxLastMoney);
                     item.put("remark", remark);
+                    item.put("expiryNum",m.getExpiryNum());
+                    item.put("wholesaleDecimal",m.getDefaultWholesaleDecimal());
+                    item.put("defaultPurchaseDecimal",m.getDefaultPurchaseDecimal());
+                    item.put("defaultWholesaleDecimal",m.getDefaultWholesaleDecimal());
+                    item.put("ratio",m.getRatio());
+                    item.put("unitName",m.getUnitName());
                     arr.add(item);
                 } else {
                     throw new BusinessRunTimeException(ExceptionConstants.DEPOT_ITEM_BARCODE_IS_NOT_EXIST_CODE,

+ 1 - 1
src/main/java/com/jsh/erp/service/impl/SupplierServiceImpl.java

@@ -685,7 +685,7 @@ public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier> i
                 // 结算方式
                 objs[12] = mapSettlementMethod(s.getSettlementMethod());
                 // 账单周期
-                objs[13] = s.getBillingCycleDays() == null? "" : s.getBillingCycleDays().toString();
+                objs[13] = s.getBillingCycleDays() == null ? "" : s.getBillingCycleDays() == 1 ? "先款后货" : "先货后款";
                 // 采购对接人
                 objs[14] = s.getProcurementContact();
                 // 到货天数

+ 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.time.*;
 import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeParseException;
 import java.util.*;
 
 /**
@@ -319,4 +320,17 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         }
         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;
+    }
 }

+ 3 - 3
src/main/resources/mapper_xml/DepotItemMapper.xml

@@ -240,7 +240,7 @@
       <if test="warehousingUser != null">
         warehousing_user,
       </if>
-      <if test="warehousingTime != null and warehousingTime != ''">
+      <if test="warehousingTime != null">
         warehousing_time,
       </if>
       <if test="createTime != null">
@@ -347,8 +347,8 @@
       <if test="warehousingUser != null">
         #{warehousingUser,jdbcType=BIGINT},
       </if>
-      <if test="warehousingTime != null and warehousingTime != ''">
-        #{warehousingTime,jdbcType=DATE},
+      <if test="warehousingTime != null">
+        #{warehousingTime},
       </if>
       <if test="createTime != null">
         #{createTime,jdbcType=DATE},

+ 2 - 2
src/main/resources/mapper_xml/DepotItemMapperEx.xml

@@ -322,7 +322,7 @@
         m.other_field1 MOtherField1,m.other_field2 MOtherField2,m.other_field3 MOtherField3,m.enable_serial_number, m.enable_batch_number,
         m.brand, dp1.name DepotName,dp2.name AnotherDepotName, me.purchase_decimal,
         me.production_date, me.expiry_num, me.supplier_id, me.bar_code, me.batch_number, me.position,s.supplier supplierName,u.name unit_name,me.inventory,
-        us.username warehousingUserName,m.default_purchase_decimal,m.default_wholesale_decimal
+        us.username warehousingUserName,m.default_purchase_decimal,m.default_wholesale_decimal,me.ratio
         from jsh_depot_item di
         left join jsh_material m on di.material_id=m.id  and ifnull(m.delete_flag,'0') !='1'
         left join jsh_material_extend me on me.id=di.material_extend_id  and ifnull(me.delete_Flag,'0') !='1'
@@ -1106,7 +1106,7 @@
     <select id="getBillItemByParam" resultType="com.jsh.erp.datasource.entities.MaterialVo4Unit">
         select m.*,u.name unit_name, me.id meId, me.commodity_unit, me.purchase_decimal, me.commodity_decimal,
         me.wholesale_decimal, me.low_decimal, me.sku,
-        me.production_date, me.expiry_num, me.supplier_id, me.bar_code, me.batch_number, me.depot_id, me.position,d.`name` depotName,s.supplier supplierName
+        me.production_date, me.expiry_num, me.supplier_id, me.bar_code, me.batch_number, me.depot_id, me.position,d.`name` depotName,s.supplier supplierName,me.ratio
         from jsh_material m
         left join jsh_material_extend me on m.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
         left join jsh_unit u on m.unit_id=u.id and ifnull(u.delete_Flag,'0') !='1'