소스 검색

Merge branch 'dev_huangjunjie' of http://121.40.253.172:3000/pengyue/jsh_erp into test

廖泽勇 1 일 전
부모
커밋
4a1e5e2506
41개의 변경된 파일551개의 추가작업 그리고 245개의 파일을 삭제
  1. 25 0
      docs/new_sql.sql
  2. 5 0
      src/main/java/com/jsh/erp/constants/BusinessConstants.java
  3. 17 11
      src/main/java/com/jsh/erp/constants/ExceptionConstants.java
  4. 2 0
      src/main/java/com/jsh/erp/controller/DepotItemController.java
  5. 6 11
      src/main/java/com/jsh/erp/controller/MaterialCategoryController.java
  6. 12 12
      src/main/java/com/jsh/erp/controller/MaterialController.java
  7. 4 4
      src/main/java/com/jsh/erp/controller/SupplierController.java
  8. 4 8
      src/main/java/com/jsh/erp/controller/pda/PdaController.java
  9. 65 0
      src/main/java/com/jsh/erp/datasource/dto/MaterialQueryDTO.java
  10. 5 0
      src/main/java/com/jsh/erp/datasource/entities/Depot.java
  11. 3 0
      src/main/java/com/jsh/erp/datasource/entities/DepotHead.java
  12. 6 0
      src/main/java/com/jsh/erp/datasource/entities/DepotItemVo4WithInfoEx.java
  13. 12 0
      src/main/java/com/jsh/erp/datasource/entities/Material.java
  14. 3 0
      src/main/java/com/jsh/erp/datasource/entities/MaterialBatch.java
  15. 16 0
      src/main/java/com/jsh/erp/datasource/entities/MaterialCategory.java
  16. 0 3
      src/main/java/com/jsh/erp/datasource/entities/MaterialVo4Unit.java
  17. 9 0
      src/main/java/com/jsh/erp/datasource/entities/Supplier.java
  18. 2 1
      src/main/java/com/jsh/erp/datasource/mappers/MaterialMapperEx.java
  19. 4 1
      src/main/java/com/jsh/erp/datasource/mappers/SequenceMapperEx.java
  20. 6 0
      src/main/java/com/jsh/erp/datasource/vo/DepotHeadVo4List.java
  21. 11 3
      src/main/java/com/jsh/erp/service/MaterialCategoryService.java
  22. 4 2
      src/main/java/com/jsh/erp/service/MaterialService.java
  23. 8 81
      src/main/java/com/jsh/erp/service/SequenceService.java
  24. 8 2
      src/main/java/com/jsh/erp/service/SupplierService.java
  25. 1 1
      src/main/java/com/jsh/erp/service/impl/DepotHeadServiceImpl.java
  26. 5 3
      src/main/java/com/jsh/erp/service/impl/DepotItemServiceImpl.java
  27. 4 1
      src/main/java/com/jsh/erp/service/impl/MaterialBatchServiceImpl.java
  28. 6 4
      src/main/java/com/jsh/erp/service/impl/MaterialCategoryServiceImpl.java
  29. 129 79
      src/main/java/com/jsh/erp/service/impl/MaterialServiceImpl.java
  30. 76 0
      src/main/java/com/jsh/erp/service/impl/SequenceServiceImpl.java
  31. 7 4
      src/main/java/com/jsh/erp/service/impl/SupplierServiceImpl.java
  32. 8 2
      src/main/resources/mapper_xml/DepotHeadMapper.xml
  33. 1 1
      src/main/resources/mapper_xml/DepotItemMapper.xml
  34. 1 1
      src/main/resources/mapper_xml/DepotItemMapperEx.xml
  35. 7 1
      src/main/resources/mapper_xml/MaterialCategoryMapper.xml
  36. 2 1
      src/main/resources/mapper_xml/MaterialCategoryMapperEx.xml
  37. 1 1
      src/main/resources/mapper_xml/MaterialExtendMapper.xml
  38. 12 2
      src/main/resources/mapper_xml/MaterialMapper.xml
  39. 25 3
      src/main/resources/mapper_xml/MaterialMapperEx.xml
  40. 2 2
      src/main/resources/mapper_xml/SequenceMapperEx.xml
  41. 27 0
      src/main/resources/mapper_xml/SupplierMapper.xml

+ 25 - 0
docs/new_sql.sql

@@ -219,6 +219,31 @@ CREATE TABLE `material_batch` (
   PRIMARY KEY (`id`)
   PRIMARY KEY (`id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='商品批次信息表';
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='商品批次信息表';
 
 
+-- 产品类型表 新增有效期阈值
+ALTER TABLE jsh_material_category
+  ADD COLUMN expiry_threshold INT DEFAULT NULL COMMENT '有效期阈值';
+
+-- 产品信息表  新增保质期天数,默认采购价,默认销售价
+ALTER TABLE jsh_material
+  ADD COLUMN expiry_num INT DEFAULT NULL COMMENT '保质期天数',
+  ADD COLUMN default_purchase_decimal DECIMAL(24,2) DEFAULT NULL COMMENT '默认采购价格',
+  ADD COLUMN default_wholesale_decimal DECIMAL(24,2) DEFAULT NULL COMMENT '默认销售价格';
+
+-- 供应商信息表  新增供应商编码,是否支持售后,售后规则
+ALTER TABLE jsh_supplier
+  ADD COLUMN serial_no VARCHAR(50) DEFAULT NULL COMMENT '供应商编码',
+  ADD COLUMN is_after_sales VARCHAR(1) DEFAULT NULL COMMENT '是否支持售后 (1是0否)',
+  ADD COLUMN after_sales_rules VARCHAR(1000) DEFAULT NULL COMMENT '售后规则';
+
+-- 单据主表 新增复核
+ALTER TABLE jsh_depot_head
+  ADD COLUMN auditor BIGINT DEFAULT NULL COMMENT '复核人员';
+
+
+
+
+
+
 
 
 
 
 
 

+ 5 - 0
src/main/java/com/jsh/erp/constants/BusinessConstants.java

@@ -122,6 +122,11 @@ public class BusinessConstants {
     public static final String SEQ_TO_STRING_LESS_INSERT = "0";
     public static final String SEQ_TO_STRING_LESS_INSERT = "0";
     //单据编号
     //单据编号
     public static final String DEPOT_NUMBER_SEQ = "depot_number_seq";
     public static final String DEPOT_NUMBER_SEQ = "depot_number_seq";
+    //供应商返回字符串的最小长度
+    public static final Long SUPPLIER_SEQ_TO_STRING_MIN_LENGTH = 1000L;
+    //供应商编号
+    public static final String SUPPLIER_NUMBER_SEQ = "supplier_number_seq";
+
     /**
     /**
      * 商品类别根目录id
      * 商品类别根目录id
      * */
      * */

+ 17 - 11
src/main/java/com/jsh/erp/constants/ExceptionConstants.java

@@ -356,30 +356,36 @@ public class ExceptionConstants {
     //EXCEL中有副条码在系统中已存在(除自身商品之外)
     //EXCEL中有副条码在系统中已存在(除自身商品之外)
     public static final int MATERIAL_EXCEL_IMPORT_MANY_BARCODE_EXIST_CODE = 80000028;
     public static final int MATERIAL_EXCEL_IMPORT_MANY_BARCODE_EXIST_CODE = 80000028;
     public static final String MATERIAL_EXCEL_IMPORT_MANY_BARCODE_EXIST_MSG = "抱歉,EXCEL中有副条码在系统中已存在,具体副条码为:%s";
     public static final String MATERIAL_EXCEL_IMPORT_MANY_BARCODE_EXIST_MSG = "抱歉,EXCEL中有副条码在系统中已存在,具体副条码为:%s";
-    //基本单位为空
+    //类别为空
     public static final int MATERIAL_Category_Name_EMPTY_CODE = 8000029;
     public static final int MATERIAL_Category_Name_EMPTY_CODE = 8000029;
     public static final String MATERIAL_Category_Name_EMPTY_MSG = "第%s行类别为空";
     public static final String MATERIAL_Category_Name_EMPTY_MSG = "第%s行类别为空";
-
-    //类型不存在错误
+    //类别不存在
     public static final int MATERIAL_TYPE_NOT_DECIMAL_CODE = 8000030;
     public static final int MATERIAL_TYPE_NOT_DECIMAL_CODE = 8000030;
     public static final String MATERIAL_TYPE_NOT_DECIMAL_MSG = "第%s行类别不存在";
     public static final String MATERIAL_TYPE_NOT_DECIMAL_MSG = "第%s行类别不存在";
-
-    //供应商不存在错误
+    //供应商不存在
     public static final int MATERIAL_SUPPLIER_NOT_DECIMAL_CODE = 8000031;
     public static final int MATERIAL_SUPPLIER_NOT_DECIMAL_CODE = 8000031;
     public static final String MATERIAL_SUPPLIER_NOT_DECIMAL_MSG = "第%s行供应商不存在";
     public static final String MATERIAL_SUPPLIER_NOT_DECIMAL_MSG = "第%s行供应商不存在";
-
-    //仓库不存在错误
+    //仓库不存在
     public static final int MATERIAL_DEPOT_NOT_DECIMAL_CODE = 8000031;
     public static final int MATERIAL_DEPOT_NOT_DECIMAL_CODE = 8000031;
     public static final String MATERIAL_DEPOT_NOT_DECIMAL_MSG = "第%s行仓库不存在";
     public static final String MATERIAL_DEPOT_NOT_DECIMAL_MSG = "第%s行仓库不存在";
-
     //erp_sku 不存在
     //erp_sku 不存在
     public static final int MATERIAL_ERP_SKU_NOT_DECIMAL_CODE = 8000032;
     public static final int MATERIAL_ERP_SKU_NOT_DECIMAL_CODE = 8000032;
     public static final String MATERIAL_ERP_SKU_NOT_DECIMAL_MSG = "商品erp_sku[%s]不存在";
     public static final String MATERIAL_ERP_SKU_NOT_DECIMAL_MSG = "商品erp_sku[%s]不存在";
-
-    //EXCEL中有条码在系统中已存在(除自身商品之外)
+    //EXCEL中有条码在系统中已存在
     public static final int MATERIAL_EXCEL_IMPORT_BARCODE_SYSTEM_EXIST_CODE = 80000033;
     public static final int MATERIAL_EXCEL_IMPORT_BARCODE_SYSTEM_EXIST_CODE = 80000033;
     public static final String MATERIAL_EXCEL_IMPORT_BARCODE_SYSTEM_EXIST_MSG = "抱歉,EXCEL中有条码在系统中已存在,具体条码为:%s";
     public static final String MATERIAL_EXCEL_IMPORT_BARCODE_SYSTEM_EXIST_MSG = "抱歉,EXCEL中有条码在系统中已存在,具体条码为:%s";
-    //基本单位为空
+    //默认采购价为空
+    public static final int MATERIAL_DEFAULT_PURCHASE_DECIMAL_EMPTY_CODE = 80000034;
+    public static final String MATERIAL_DEFAULT_PURCHASE_DECIMAL_EMPTY_MSG = "第%s行默认采购价不存在";
+    //默认采购价格式错误
+    public static final int MATERIAL_DEFAULT_PURCHASE_DECIMAL_NOT_DECIMAL_CODE = 8000035;
+    public static final String MATERIAL_DEFAULT_PURCHASE_DECIMAL_NOT_DECIMAL_MSG = "第%s行默认采购价格式错误";
+    //默认销售价为空
+    public static final int MATERIAL_DEFAULT_WHOLESALE_DECIMAL_EMPTY_CODE = 80000036;
+    public static final String MATERIAL_DEFAULT_WHOLESALE_DECIMAL_EMPTY_MSG = "第%s行默认销售价不存在";
+    //默认销售价格式错误
+    public static final int MATERIAL_DEFAULT_WHOLESALE_DECIMAL_NOT_DECIMAL_CODE = 8000037;
+    public static final String MATERIAL_DEFAULT_WHOLESALE_DECIMAL_NOT_DECIMAL_MSG = "第%s行默认销售价格式错误";
 
 
     /**
     /**
      *  单据信息
      *  单据信息

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

@@ -293,6 +293,8 @@ public class DepotItemController {
                     item.put("warehousingTime",diEx.getWarehousingTime());
                     item.put("warehousingTime",diEx.getWarehousingTime());
                     item.put("warehousingUserName",diEx.getWarehousingUserName());
                     item.put("warehousingUserName",diEx.getWarehousingUserName());
                     item.put("wholesaleDecimal",diEx.getWholesaleDecimal());
                     item.put("wholesaleDecimal",diEx.getWholesaleDecimal());
+                    item.put("defaultPurchaseDecimal",diEx.getDefaultPurchaseDecimal());
+                    item.put("defaultWholesaleDecimal",diEx.getDefaultWholesaleDecimal());
                     dataArray.add(item);
                     dataArray.add(item);
                     //合计数据汇总
                     //合计数据汇总
                     totalOperNumber = totalOperNumber.add(diEx.getOperNumber()==null?BigDecimal.ZERO:diEx.getOperNumber());
                     totalOperNumber = totalOperNumber.add(diEx.getOperNumber()==null?BigDecimal.ZERO:diEx.getOperNumber());

+ 6 - 11
src/main/java/com/jsh/erp/controller/MaterialCategoryController.java

@@ -66,17 +66,17 @@ public class MaterialCategoryController extends BaseController {
 
 
     @PostMapping(value = "/add")
     @PostMapping(value = "/add")
     @ApiOperation(value = "新增")
     @ApiOperation(value = "新增")
-    public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
+    public String addResource(@RequestBody MaterialCategory materialCategory, HttpServletRequest request)throws Exception {
         Map<String, Object> objectMap = new HashMap<>();
         Map<String, Object> objectMap = new HashMap<>();
-        int insert = materialCategoryService.insertMaterialCategory(obj, request);
+        int insert = materialCategoryService.insertMaterialCategory(materialCategory, request);
         return returnStr(objectMap, insert);
         return returnStr(objectMap, insert);
     }
     }
 
 
     @PutMapping(value = "/update")
     @PutMapping(value = "/update")
     @ApiOperation(value = "修改")
     @ApiOperation(value = "修改")
-    public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
+    public String updateResource(@RequestBody MaterialCategory materialCategory, HttpServletRequest request)throws Exception {
         Map<String, Object> objectMap = new HashMap<>();
         Map<String, Object> objectMap = new HashMap<>();
-        int update = materialCategoryService.updateMaterialCategory(obj, request);
+        int update = materialCategoryService.updateMaterialCategory(materialCategory, request);
         return returnStr(objectMap, update);
         return returnStr(objectMap, update);
     }
     }
 
 
@@ -133,14 +133,8 @@ public class MaterialCategoryController extends BaseController {
         return res;
         return res;
     }
     }
 
 
-    /**
-     * 根据id来查询商品名称
-     * @param id
-     * @param request
-     * @return
-     */
     @GetMapping(value = "/findById")
     @GetMapping(value = "/findById")
-    @ApiOperation(value = "根据id来查询商品名称")
+    @ApiOperation(value = "根据类别id来查询类别信息")
     public BaseResponseInfo findById(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
     public BaseResponseInfo findById(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
         BaseResponseInfo res = new BaseResponseInfo();
         BaseResponseInfo res = new BaseResponseInfo();
         try {
         try {
@@ -158,6 +152,7 @@ public class MaterialCategoryController extends BaseController {
                     outer.put("sort", mc.getSort());
                     outer.put("sort", mc.getSort());
                     outer.put("serialNo", mc.getSerialNo());
                     outer.put("serialNo", mc.getSerialNo());
                     outer.put("remark", mc.getRemark());
                     outer.put("remark", mc.getRemark());
+                    outer.put("expiryThreshold",mc.getExpiryThreshold());
                 }
                 }
             }
             }
             res.code = 200;
             res.code = 200;

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

@@ -52,9 +52,6 @@ public class MaterialController extends BaseController {
     private DepotService depotService;
     private DepotService depotService;
 
 
     @Resource
     @Resource
-    private RoleService roleService;
-
-    @Resource
     private UserService userService;
     private UserService userService;
 
 
     @Resource
     @Resource
@@ -79,8 +76,7 @@ public class MaterialController extends BaseController {
 
 
     @GetMapping(value = "/list")
     @GetMapping(value = "/list")
     @ApiOperation(value = "获取信息列表")
     @ApiOperation(value = "获取信息列表")
-    public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
-                                 HttpServletRequest request)throws Exception {
+    public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search)throws Exception {
         String categoryId = StringUtil.getInfo(search, "categoryId");
         String categoryId = StringUtil.getInfo(search, "categoryId");
         String materialParam = StringUtil.getInfo(search, "materialParam");
         String materialParam = StringUtil.getInfo(search, "materialParam");
         String standard = StringUtil.getInfo(search, "standard");
         String standard = StringUtil.getInfo(search, "standard");
@@ -97,8 +93,9 @@ public class MaterialController extends BaseController {
         String enabled = StringUtil.getInfo(search, "enabled");
         String enabled = StringUtil.getInfo(search, "enabled");
         String remark = StringUtil.getInfo(search, "remark");
         String remark = StringUtil.getInfo(search, "remark");
         String mpList = StringUtil.getInfo(search, "mpList");
         String mpList = StringUtil.getInfo(search, "mpList");
+        String reminder = StringUtil.getInfo(search, "reminder");
         List<MaterialVo4Unit> list = materialService.select(materialParam, standard, model, color, brand, mfrs, materialOther, weight, expiryNum,
         List<MaterialVo4Unit> list = materialService.select(materialParam, standard, model, color, brand, mfrs, materialOther, weight, expiryNum,
-                enableSerialNumber, enableBatchNumber, position, enabled, remark, categoryId, mpList);
+                enableSerialNumber, enableBatchNumber, position, enabled, remark, categoryId, mpList, reminder);
         return getDataTable(list);
         return getDataTable(list);
     }
     }
 
 
@@ -609,23 +606,26 @@ public class MaterialController extends BaseController {
                         mvo.setBillPrice(mvo.getCommodityDecimal());
                         mvo.setBillPrice(mvo.getCommodityDecimal());
                     } else if ("CGDD".equals(prefixNo) || "CGRK".equals(prefixNo) || "CGTH".equals(prefixNo)) {
                     } else if ("CGDD".equals(prefixNo) || "CGRK".equals(prefixNo) || "CGTH".equals(prefixNo)) {
                         //采购价
                         //采购价
-                        mvo.setBillPrice(mvo.getPurchaseDecimal());
+                        mvo.setBillPrice(mvo.getDefaultPurchaseDecimal());
                     } else if("QTRK".equals(prefixNo) || "DBCK".equals(prefixNo) || "ZZD".equals(prefixNo) || "CXD".equals(prefixNo)
                     } else if("QTRK".equals(prefixNo) || "DBCK".equals(prefixNo) || "ZZD".equals(prefixNo) || "CXD".equals(prefixNo)
                             || "PDLR".equals(prefixNo) || "PDFP".equals(prefixNo)) {
                             || "PDLR".equals(prefixNo) || "PDFP".equals(prefixNo)) {
                         //采购价-给录入界面按权限屏蔽
                         //采购价-给录入界面按权限屏蔽
-                        mvo.setBillPrice(roleService.parseBillPriceByLimit(mvo.getPurchaseDecimal(), "buy", priceLimit, request));
-                    } if ("XSDD".equals(prefixNo) || "XSCK".equals(prefixNo) || "XSTH".equals(prefixNo) || "QTCK".equals(prefixNo)) {
+                       // mvo.setBillPrice(roleService.parseBillPriceByLimit(mvo.getPurchaseDecimal(), "buy", priceLimit, request));
+                        mvo.setBillPrice(mvo.getDefaultPurchaseDecimal());
+                    }
+                    if ("XSDD".equals(prefixNo) || "XSCK".equals(prefixNo) || "XSTH".equals(prefixNo) || "QTCK".equals(prefixNo)) {
                         //销售价
                         //销售价
                         if(organId == null) {
                         if(organId == null) {
-                            mvo.setBillPrice(mvo.getWholesaleDecimal());
+                            mvo.setBillPrice(mvo.getDefaultWholesaleDecimal());
                         } else {
                         } else {
                             //查询最后一单的销售价,实现不同的客户不同的销售价
                             //查询最后一单的销售价,实现不同的客户不同的销售价
                             BigDecimal lastUnitPrice = depotItemService.getLastUnitPriceByParam(organId, mvo.getMeId(), prefixNo);
                             BigDecimal lastUnitPrice = depotItemService.getLastUnitPriceByParam(organId, mvo.getMeId(), prefixNo);
-                            mvo.setBillPrice(lastUnitPrice!=null? lastUnitPrice : mvo.getWholesaleDecimal());
+                            mvo.setBillPrice(lastUnitPrice != null ? lastUnitPrice : mvo.getDefaultWholesaleDecimal());
                         }
                         }
                         //销售价-给录入界面按权限屏蔽价格
                         //销售价-给录入界面按权限屏蔽价格
                         if("QTCK".equals(prefixNo)) {
                         if("QTCK".equals(prefixNo)) {
-                            mvo.setBillPrice(roleService.parseBillPriceByLimit(mvo.getWholesaleDecimal(), "sale", priceLimit, request));
+                            //mvo.setBillPrice(roleService.parseBillPriceByLimit(mvo.getWholesaleDecimal(), "sale", priceLimit, request));
+                            mvo.setBillPrice(mvo.getDefaultWholesaleDecimal());
                         }
                         }
                     }
                     }
                     //仓库id
                     //仓库id

+ 4 - 4
src/main/java/com/jsh/erp/controller/SupplierController.java

@@ -77,17 +77,17 @@ public class SupplierController extends BaseController {
 
 
     @PostMapping(value = "/add")
     @PostMapping(value = "/add")
     @ApiOperation(value = "新增")
     @ApiOperation(value = "新增")
-    public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
+    public String addResource(@RequestBody Supplier supplier, HttpServletRequest request)throws Exception {
         Map<String, Object> objectMap = new HashMap<>();
         Map<String, Object> objectMap = new HashMap<>();
-        int insert = supplierService.insertSupplier(obj, request);
+        int insert = supplierService.insertSupplier(supplier, request);
         return returnStr(objectMap, insert);
         return returnStr(objectMap, insert);
     }
     }
 
 
     @PutMapping(value = "/update")
     @PutMapping(value = "/update")
     @ApiOperation(value = "修改")
     @ApiOperation(value = "修改")
-    public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
+    public String updateResource(@RequestBody Supplier supplier, HttpServletRequest request)throws Exception {
         Map<String, Object> objectMap = new HashMap<>();
         Map<String, Object> objectMap = new HashMap<>();
-        int update = supplierService.updateSupplier(obj, request);
+        int update = supplierService.updateSupplier(supplier, request);
         return returnStr(objectMap, update);
         return returnStr(objectMap, update);
     }
     }
 
 

+ 4 - 8
src/main/java/com/jsh/erp/controller/pda/PdaController.java

@@ -82,10 +82,6 @@ public class PdaController extends BaseController {
     @Resource
     @Resource
     private MaterialBatchService materialBatchService;
     private MaterialBatchService materialBatchService;
 
 
-    /**
-     * 采购入库
-     * @return
-     */
     @PostMapping ("/purchaseInventory")
     @PostMapping ("/purchaseInventory")
     @ApiOperation(value = "采购入库")
     @ApiOperation(value = "采购入库")
     public TableDataInfo purchaseInventory(@RequestBody PDADepotHeadDTO pdaDepotHeadDTO) {
     public TableDataInfo purchaseInventory(@RequestBody PDADepotHeadDTO pdaDepotHeadDTO) {
@@ -136,14 +132,14 @@ public class PdaController extends BaseController {
     }
     }
 
 
     @ApiOperation("商品详情")
     @ApiOperation("商品详情")
-    @GetMapping("/materialDetail/{id}")
-    public AjaxResult materialDetail(@PathVariable("id") Long id) throws Exception {
+    @GetMapping("/materialDetail/{id}/{depotId}")
+    public AjaxResult materialDetail(@PathVariable("id") Long id, @PathVariable("depotId") Long depotId) throws Exception {
         return AjaxResult.success(depotItemService.pdaDetail(id));
         return AjaxResult.success(depotItemService.pdaDetail(id));
     }
     }
 
 
     @ApiOperation("商品库存详情")
     @ApiOperation("商品库存详情")
-    @GetMapping("/materialDepotDetail/{type}/{materialId}")
-    public TableDataInfo materialDepotDetail(@PathVariable("type") String type, @PathVariable("materialId") Long materialId) {
+    @GetMapping("/materialDepotDetail/{type}/{materialId}/{depotId}")
+    public TableDataInfo materialDepotDetail(@PathVariable("type") String type, @PathVariable("materialId") Long materialId,@PathVariable("depotId") Long depotId) {
         startPage();
         startPage();
         if ("in".equals(type)) {
         if ("in".equals(type)) {
             type = "入库";
             type = "入库";

+ 65 - 0
src/main/java/com/jsh/erp/datasource/dto/MaterialQueryDTO.java

@@ -0,0 +1,65 @@
+package com.jsh.erp.datasource.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class MaterialQueryDTO {
+
+    @ApiModelProperty("商品类别ID")
+    private String categoryId;
+
+    @ApiModelProperty("关键字")
+    private String materialParam;
+
+    @ApiModelProperty("规格")
+    private String standard;
+
+    @ApiModelProperty("型号")
+    private String model;
+
+    @ApiModelProperty("颜色")
+    private String color;
+
+    @ApiModelProperty("品牌")
+    private String brand;
+
+    @ApiModelProperty("启用状态 0-禁用  1-启用")
+    private String enabled;
+
+    @ApiModelProperty("是否开启序列号,0否,1是")
+    private String enableSerialNumber;
+
+    @ApiModelProperty("拓展信息")
+    private String materialOther;
+
+    @ApiModelProperty("基础重量")
+    private String weight;
+
+    @ApiModelProperty("商品提醒")
+    private String reminder;
+
+    @ApiModelProperty("备注")
+    private String remark;
+
+    @ApiModelProperty("商品类型ID集合")
+    private List<Long> idList;
+
+    @ApiModelProperty("保质期")
+    private String expiryNum;
+
+    @ApiModelProperty("是否开启批号,0否,1是")
+    private String enableBatchNumber;
+
+    @ApiModelProperty("库位")
+    private String position;
+
+    private String mpList;
+
+
+
+
+
+}

+ 5 - 0
src/main/java/com/jsh/erp/datasource/entities/Depot.java

@@ -1,7 +1,12 @@
 package com.jsh.erp.datasource.entities;
 package com.jsh.erp.datasource.entities;
 
 
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 
 
+@TableName("jsh_depot")
+@Data
 public class Depot {
 public class Depot {
     private Long id;
     private Long id;
 
 

+ 3 - 0
src/main/java/com/jsh/erp/datasource/entities/DepotHead.java

@@ -157,6 +157,9 @@ public class DepotHead {
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date submitTime;
     private Date submitTime;
 
 
+    @ApiModelProperty("复核人员")
+    private Long auditor;
+
 
 
     public Long getId() {
     public Long getId() {
         return id;
         return id;

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

@@ -86,6 +86,12 @@ public class DepotItemVo4WithInfoEx extends DepotItem{
     @ApiModelProperty("入库人名称")
     @ApiModelProperty("入库人名称")
     private String warehousingUserName;
     private String warehousingUserName;
 
 
+    @ApiModelProperty("默认销售价格")
+    private BigDecimal defaultPurchaseDecimal;
+
+    @ApiModelProperty("默认采购价格")
+    private BigDecimal defaultWholesaleDecimal;
+
     public Long getMId() {
     public Long getMId() {
         return MId;
         return MId;
     }
     }

+ 12 - 0
src/main/java/com/jsh/erp/datasource/entities/Material.java

@@ -87,6 +87,18 @@ public class Material {
     @ApiModelProperty("无动销提醒周期")
     @ApiModelProperty("无动销提醒周期")
     private String movingPinReminderCycle;
     private String movingPinReminderCycle;
 
 
+    @ApiModelProperty("保质期天数")
+    private int expiryNum;
+
+    @ApiModelProperty("默认采购价格")
+    private BigDecimal defaultPurchaseDecimal;
+
+    @ApiModelProperty("默认销售价格")
+    private BigDecimal defaultWholesaleDecimal;
+
+    @ApiModelProperty("商品提醒")
+    private String reminder;
+
     @TableField(exist = false)
     @TableField(exist = false)
     private List<MaterialExtend> list;
     private List<MaterialExtend> list;
 
 

+ 3 - 0
src/main/java/com/jsh/erp/datasource/entities/MaterialBatch.java

@@ -1,5 +1,7 @@
 package com.jsh.erp.datasource.entities;
 package com.jsh.erp.datasource.entities;
 
 
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.Data;
@@ -14,6 +16,7 @@ import java.util.Date;
 public class MaterialBatch {
 public class MaterialBatch {
 
 
     @ApiModelProperty("主键id")
     @ApiModelProperty("主键id")
+    @TableId(type = IdType.AUTO)
     private Long id;
     private Long id;
 
 
     @ApiModelProperty("商品id")
     @ApiModelProperty("商品id")

+ 16 - 0
src/main/java/com/jsh/erp/datasource/entities/MaterialCategory.java

@@ -1,6 +1,7 @@
 package com.jsh.erp.datasource.entities;
 package com.jsh.erp.datasource.entities;
 
 
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.Data;
 import lombok.experimental.Accessors;
 import lombok.experimental.Accessors;
 
 
@@ -14,28 +15,43 @@ import java.util.Date;
 @TableName("jsh_material_category")
 @TableName("jsh_material_category")
 public class MaterialCategory {
 public class MaterialCategory {
 
 
+
+    @ApiModelProperty("主键id")
     private Long id;
     private Long id;
 
 
+    @ApiModelProperty("名称")
     private String name;
     private String name;
 
 
+    @ApiModelProperty("等级")
     private Short categoryLevel;
     private Short categoryLevel;
 
 
+    @ApiModelProperty("上级id")
     private Long parentId;
     private Long parentId;
 
 
+    @ApiModelProperty("显示顺序")
     private String sort;
     private String sort;
 
 
+    @ApiModelProperty("编号")
     private Long serialNo;
     private Long serialNo;
 
 
+    @ApiModelProperty("备注")
     private String remark;
     private String remark;
 
 
+    @ApiModelProperty("创建时间")
     private Date createTime;
     private Date createTime;
 
 
+    @ApiModelProperty("更新时间")
     private Date updateTime;
     private Date updateTime;
 
 
+    @ApiModelProperty("租户id")
     private Long tenantId;
     private Long tenantId;
 
 
+    @ApiModelProperty("删除标记,0未删除,1删除")
     private String deleteFlag;
     private String deleteFlag;
 
 
+    @ApiModelProperty("有效期阈值")
+    private int expiryThreshold;
+
     public Long getId() {
     public Long getId() {
         return id;
         return id;
     }
     }

+ 0 - 3
src/main/java/com/jsh/erp/datasource/entities/MaterialVo4Unit.java

@@ -74,9 +74,6 @@ public class MaterialVo4Unit extends Material{
     @ApiModelProperty("生产日期")
     @ApiModelProperty("生产日期")
     private String productionDate;
     private String productionDate;
 
 
-    @ApiModelProperty("保质期天数")
-    private Integer expiryNum;
-
     @ApiModelProperty("供应商id")
     @ApiModelProperty("供应商id")
     private Long supplierId;
     private Long supplierId;
 
 

+ 9 - 0
src/main/java/com/jsh/erp/datasource/entities/Supplier.java

@@ -1,6 +1,7 @@
 package com.jsh.erp.datasource.entities;
 package com.jsh.erp.datasource.entities;
 
 
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.Data;
 
 
 import java.math.BigDecimal;
 import java.math.BigDecimal;
@@ -109,6 +110,14 @@ public class Supplier {
     /** 合同附件存储路径 */
     /** 合同附件存储路径 */
     private String contractUpload;
     private String contractUpload;
 
 
+    @ApiModelProperty("供应商编码")
+    private String serialNo;
+
+    @ApiModelProperty("是否支持售后")
+    private String isAfterSales;
+
+    @ApiModelProperty("售后规则")
+    private String afterSalesRules;
 
 
     public Long getId() {
     public Long getId() {
         return id;
         return id;

+ 2 - 1
src/main/java/com/jsh/erp/datasource/mappers/MaterialMapperEx.java

@@ -37,7 +37,8 @@ public interface MaterialMapperEx {
             @Param("enabled") String enabled,
             @Param("enabled") String enabled,
             @Param("remark") String remark,
             @Param("remark") String remark,
             @Param("idList") List<Long> idList,
             @Param("idList") List<Long> idList,
-            @Param("mpList") String mpList);
+            @Param("mpList") String mpList,
+            @Param("reminder") String reminder);
 
 
     Long insertSelectiveEx(Material record);
     Long insertSelectiveEx(Material record);
 
 

+ 4 - 1
src/main/java/com/jsh/erp/datasource/mappers/SequenceMapperEx.java

@@ -4,7 +4,10 @@ import org.apache.ibatis.annotations.Param;
 
 
 public interface SequenceMapperEx {
 public interface SequenceMapperEx {
 
 
-    void updateBuildOnlyNumber();
+    /**
+     * 修改数加一
+     */
+    void updateBuildOnlyNumber(@Param("seq_name") String seq_name);
 
 
     /**
     /**
      * 获得一个全局唯一的数作为订单号的追加
      * 获得一个全局唯一的数作为订单号的追加

+ 6 - 0
src/main/java/com/jsh/erp/datasource/vo/DepotHeadVo4List.java

@@ -1,10 +1,13 @@
 package com.jsh.erp.datasource.vo;
 package com.jsh.erp.datasource.vo;
 
 
 import com.jsh.erp.datasource.entities.DepotHead;
 import com.jsh.erp.datasource.entities.DepotHead;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
 
 
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 import java.util.Date;
 import java.util.Date;
 
 
+@Data
 public class DepotHeadVo4List extends DepotHead{
 public class DepotHeadVo4List extends DepotHead{
 
 
     private String projectName;
     private String projectName;
@@ -57,6 +60,9 @@ public class DepotHeadVo4List extends DepotHead{
      */
      */
     private BigDecimal realNeedDebt;
     private BigDecimal realNeedDebt;
 
 
+    @ApiModelProperty("复核人名称")
+    private String auditorName;
+
     public String getProjectName() {
     public String getProjectName() {
         return projectName;
         return projectName;
     }
     }

+ 11 - 3
src/main/java/com/jsh/erp/service/MaterialCategoryService.java

@@ -26,17 +26,17 @@ public interface MaterialCategoryService extends IService<MaterialCategory> {
 
 
     /**
     /**
      * 新增商品类别
      * 新增商品类别
-     * @param obj 商品类别数据
+     * @param materialCategory 商品类别数据
      */
      */
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    int insertMaterialCategory(JSONObject obj, HttpServletRequest request)throws Exception;
+    int insertMaterialCategory(MaterialCategory materialCategory, HttpServletRequest request)throws Exception;
 
 
     /**
     /**
      * 修改商品类别
      * 修改商品类别
      * @param obj 商品类别数据
      * @param obj 商品类别数据
      */
      */
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    int updateMaterialCategory(JSONObject obj, HttpServletRequest request) throws Exception;
+    int updateMaterialCategory(MaterialCategory obj, HttpServletRequest request) throws Exception;
 
 
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     int deleteMaterialCategory(Long id, HttpServletRequest request)throws Exception;
     int deleteMaterialCategory(Long id, HttpServletRequest request)throws Exception;
@@ -47,8 +47,16 @@ public interface MaterialCategoryService extends IService<MaterialCategory> {
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     int batchDeleteMaterialCategoryByIds(String ids) throws Exception;
     int batchDeleteMaterialCategoryByIds(String ids) throws Exception;
 
 
+    /**
+     * 检查类别名称是否存在
+     */
     int checkIsNameExist(Long id, String name)throws Exception;
     int checkIsNameExist(Long id, String name)throws Exception;
 
 
+
+    /**
+     * 根据类别id来查询类别信息
+     * @param id 类别id
+     */
     List<MaterialCategory> findById(Long id)throws Exception;
     List<MaterialCategory> findById(Long id)throws Exception;
 
 
     List<TreeNode> getMaterialCategoryTree(Long id) throws Exception;
     List<TreeNode> getMaterialCategoryTree(Long id) throws Exception;

+ 4 - 2
src/main/java/com/jsh/erp/service/MaterialService.java

@@ -35,8 +35,7 @@ public interface MaterialService extends IService<Material> {
     List<MaterialVo4Unit> select(String materialParam, String standard, String model, String color, String brand, String mfrs,
     List<MaterialVo4Unit> select(String materialParam, String standard, String model, String color, String brand, String mfrs,
                                  String materialOther, String weight, String expiryNum, String enableSerialNumber,
                                  String materialOther, String weight, String expiryNum, String enableSerialNumber,
                                  String enableBatchNumber, String position, String enabled, String remark, String categoryId,
                                  String enableBatchNumber, String position, String enabled, String remark, String categoryId,
-                                 String mpList)
-            throws Exception;
+                                 String mpList, String reminder);
 
 
     /**
     /**
      * 新增商品
      * 新增商品
@@ -180,6 +179,9 @@ public interface MaterialService extends IService<Material> {
 
 
     MaterialExtend getMaterialExtendBySerialNumber(String serialNumber);
     MaterialExtend getMaterialExtendBySerialNumber(String serialNumber);
 
 
+    /**
+     * 根据商品id查询主表及子表信息
+     */
     Material getMaterialById(Long id);
     Material getMaterialById(Long id);
 
 
     List<MaterialVo4Unit> getMaterialBySystemSku(List<String> systemSkuList);
     List<MaterialVo4Unit> getMaterialBySystemSku(List<String> systemSkuList);

+ 8 - 81
src/main/java/com/jsh/erp/service/SequenceService.java

@@ -1,91 +1,18 @@
 package com.jsh.erp.service;
 package com.jsh.erp.service;
 
 
-import com.alibaba.fastjson.JSONObject;
-import com.jsh.erp.constants.BusinessConstants;
-import com.jsh.erp.datasource.entities.*;
-import com.jsh.erp.datasource.mappers.*;
-import com.jsh.erp.exception.JshException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 
 
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-
-/**
- * Description
- *
- * @Author: longyong
- * @Date: 2021/3/16 16:33
- */
-@Service
-public class SequenceService {
-    private Logger logger = LoggerFactory.getLogger(SequenceService.class);
-
-    @Resource
-    private SequenceMapperEx sequenceMapperEx;
-
-    public SerialNumber getSequence(long id)throws Exception {
-        return null;
-    }
-
-    public List<SerialNumberEx> select(String name, Integer offset, Integer rows)throws Exception {
-        return null;
-    }
-
-    public Long countSequence(String name)throws Exception {
-        return null;
-    }
-
-    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public int insertSequence(JSONObject obj, HttpServletRequest request)throws Exception {
-        return 0;
-    }
-
-    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public int updateSequence(JSONObject obj, HttpServletRequest request) throws Exception{
-        return 0;
-    }
-
-    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public int deleteSequence(Long id, HttpServletRequest request)throws Exception {
-        return 0;
-    }
+public interface SequenceService {
 
 
+    /**
+     * 获取单据编号
+     */
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public int batchDeleteSequence(String ids, HttpServletRequest request)throws Exception {
-        return 0;
-    }
-
-    public int checkIsNameExist(Long id, String serialNumber)throws Exception {
-        return 0;
-    }
+    String buildOnlyNumber()throws Exception;
 
 
     /**
     /**
-     * 创建一个唯一的序列
-     * */
+     * 构建供应商编号
+     */
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public String buildOnlyNumber()throws Exception{
-        Long buildOnlyNumber=null;
-        synchronized (this){
-            try{
-                sequenceMapperEx.updateBuildOnlyNumber(); //编号+1
-                buildOnlyNumber= sequenceMapperEx.getBuildOnlyNumber(BusinessConstants.DEPOT_NUMBER_SEQ);
-            }catch(Exception e){
-                JshException.writeFail(logger, e);
-            }
-        }
-        if(buildOnlyNumber<BusinessConstants.SEQ_TO_STRING_MIN_LENGTH){
-            StringBuffer sb=new StringBuffer(buildOnlyNumber.toString());
-            int len=BusinessConstants.SEQ_TO_STRING_MIN_LENGTH.toString().length()-sb.length();
-            for(int i=0;i<len;i++){
-                sb.insert(0,BusinessConstants.SEQ_TO_STRING_LESS_INSERT);
-            }
-            return sb.toString();
-        }else{
-            return buildOnlyNumber.toString();
-        }
-    }
+    String buildSupplierNumber();
 }
 }

+ 8 - 2
src/main/java/com/jsh/erp/service/SupplierService.java

@@ -22,11 +22,17 @@ public interface SupplierService extends IService<Supplier> {
 
 
     List<Supplier> select(String supplier, String type, String phonenum, String telephone) throws Exception;
     List<Supplier> select(String supplier, String type, String phonenum, String telephone) throws Exception;
 
 
+    /**
+     * 新增供应商
+     */
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    int insertSupplier(JSONObject obj, HttpServletRequest request)throws Exception;
+    int insertSupplier(Supplier supplier, HttpServletRequest request)throws Exception;
 
 
+    /**
+     * 修改供应商
+     */
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    int updateSupplier(JSONObject obj, HttpServletRequest request)throws Exception;
+    int updateSupplier(Supplier supplier, HttpServletRequest request)throws Exception;
 
 
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     int deleteSupplier(Long id, HttpServletRequest request)throws Exception;
     int deleteSupplier(Long id, HttpServletRequest request)throws Exception;

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

@@ -2096,7 +2096,7 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
             if (depotHead.getTotalPrice().compareTo(BigDecimal.ZERO) < 0){
             if (depotHead.getTotalPrice().compareTo(BigDecimal.ZERO) < 0){
                 totalPrice = totalPrice.negate();
                 totalPrice = totalPrice.negate();
             }
             }
-            this.update(new UpdateWrapper<DepotHead>().set("total_price",totalPrice).set("change_amount",totalPrice).set("discount_last_money",sum).eq("id",depotHead.getId()));
+            this.update(new UpdateWrapper<DepotHead>().set("total_price",totalPrice).set("discount_last_money",sum).eq("id",depotHead.getId()));
 
 
     }
     }
 
 

+ 5 - 3
src/main/java/com/jsh/erp/service/impl/DepotItemServiceImpl.java

@@ -781,7 +781,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                 if (StringUtil.isExist(rowObj.get("taxRate"))) {
                 if (StringUtil.isExist(rowObj.get("taxRate"))) {
                     depotItem.setTaxRate(rowObj.getBigDecimal("taxRate"));
                     depotItem.setTaxRate(rowObj.getBigDecimal("taxRate"));
                     //金额*税率
                     //金额*税率
-                    depotItem.setTaxLastMoney(depotItem.getAllPrice().multiply(depotItem.getTaxRate()).divide(new BigDecimal("100"),2,BigDecimal.ROUND_HALF_UP));
+                    depotItem.setTaxMoney(depotItem.getAllPrice().multiply(depotItem.getTaxRate()).divide(new BigDecimal("100"),2,BigDecimal.ROUND_HALF_UP));
                 }
                 }
                 //税额
                 //税额
                 if (StringUtil.isExist(rowObj.get("taxMoney"))) {
                 if (StringUtil.isExist(rowObj.get("taxMoney"))) {
@@ -792,7 +792,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                 if (StringUtil.isExist(rowObj.get("taxLastMoney"))) {
                 if (StringUtil.isExist(rowObj.get("taxLastMoney"))) {
                     //单价总额 + 税额
                     //单价总额 + 税额
                     //depotItem.setTaxLastMoney(rowObj.getBigDecimal("taxLastMoney"));
                     //depotItem.setTaxLastMoney(rowObj.getBigDecimal("taxLastMoney"));
-                    depotItem.setTaxLastMoney(depotItem.getAllPrice().add(depotItem.getTaxLastMoney() == null ? BigDecimal.ZERO : depotItem.getTaxLastMoney()));
+                    depotItem.setTaxLastMoney(depotItem.getAllPrice().add(depotItem.getTaxMoney() == null ? BigDecimal.ZERO : depotItem.getTaxMoney()));
                 }
                 }
                 if (StringUtil.isExist(rowObj.get("mType"))) {
                 if (StringUtil.isExist(rowObj.get("mType"))) {
                     depotItem.setMaterialType(rowObj.getString("mType"));
                     depotItem.setMaterialType(rowObj.getString("mType"));
@@ -856,7 +856,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                 //更新当前库存
                 //更新当前库存
                 updateCurrentStock(depotItem);
                 updateCurrentStock(depotItem);
                 //更新当前成本价
                 //更新当前成本价
-                updateCurrentUnitPrice(depotItem);
+                //updateCurrentUnitPrice(depotItem);
                 //更新商品的价格
                 //更新商品的价格
                 updateMaterialExtendPrice(materialExtend.getId(), depotHead.getSubType(), depotHead.getBillType(), rowObj);
                 updateMaterialExtendPrice(materialExtend.getId(), depotHead.getSubType(), depotHead.getBillType(), rowObj);
             }
             }
@@ -1387,9 +1387,11 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
         if(mId!=null && dId!=null) {
         if(mId!=null && dId!=null) {
             //-先清除再插入,防止商品仓库变更,数据对不上
             //-先清除再插入,防止商品仓库变更,数据对不上
             materialCurrentStockMapper.delete(new LambdaQueryWrapperX<MaterialCurrentStock>().eq(MaterialCurrentStock::getMaterialId,mId).eqIfPresent(MaterialCurrentStock::getDepotId,dId));
             materialCurrentStockMapper.delete(new LambdaQueryWrapperX<MaterialCurrentStock>().eq(MaterialCurrentStock::getMaterialId,mId).eqIfPresent(MaterialCurrentStock::getDepotId,dId));
+            Material material = materialService.getOne(new LambdaQueryWrapperX<Material>().eq(Material::getId,mId));
             MaterialCurrentStock materialCurrentStock = new MaterialCurrentStock();
             MaterialCurrentStock materialCurrentStock = new MaterialCurrentStock();
             materialCurrentStock.setMaterialId(mId);
             materialCurrentStock.setMaterialId(mId);
             materialCurrentStock.setDepotId(dId);
             materialCurrentStock.setDepotId(dId);
+            materialCurrentStock.setCurrentUnitPrice(material.getDefaultPurchaseDecimal());
             //设置当前库存数量
             //设置当前库存数量
             materialCurrentStock.setCurrentNumber(getStockByParam(dId,mId,null,null));
             materialCurrentStock.setCurrentNumber(getStockByParam(dId,mId,null,null));
             //添加当前库存
             //添加当前库存

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

@@ -48,7 +48,6 @@ public class MaterialBatchServiceImpl extends ServiceImpl<MaterialBatchMapper,Ma
 
 
     @Override
     @Override
     public void generateMaterialBatchByDepotItemId(DepotItem depotItem, Long supplierId) throws Exception {
     public void generateMaterialBatchByDepotItemId(DepotItem depotItem, Long supplierId) throws Exception {
-        //获取单据子表信息
         //获取条码信息
         //获取条码信息
         MaterialExtend materialExtend = materialExtendService.getMaterialExtend(depotItem.getMaterialExtendId());
         MaterialExtend materialExtend = materialExtendService.getMaterialExtend(depotItem.getMaterialExtendId());
         //创建批次信息
         //创建批次信息
@@ -61,6 +60,10 @@ public class MaterialBatchServiceImpl extends ServiceImpl<MaterialBatchMapper,Ma
         materialBatch.setSupplierId(supplierId);
         materialBatch.setSupplierId(supplierId);
         //设置商品单位
         //设置商品单位
         materialBatch.setCommodityUnit(depotItem.getMaterialUnit());
         materialBatch.setCommodityUnit(depotItem.getMaterialUnit());
+        //设置采购价
+        materialBatch.setPurchaseDecimal(depotItem.getUnitPrice());
+        //设置销售价
+        materialBatch.setWholesaleDecimal(depotItem.getWholesaleDecimal());
         User user = userService.getCurrentUser();
         User user = userService.getCurrentUser();
         //创建人编码
         //创建人编码
         materialBatch.setCreateSerial(user.getLoginName());
         materialBatch.setCreateSerial(user.getLoginName());

+ 6 - 4
src/main/java/com/jsh/erp/service/impl/MaterialCategoryServiceImpl.java

@@ -126,11 +126,13 @@ public class MaterialCategoryServiceImpl extends ServiceImpl<MaterialCategoryMap
 
 
     @Override
     @Override
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public int insertMaterialCategory(JSONObject obj, HttpServletRequest request)throws Exception {
-        MaterialCategory materialCategory = JSONObject.parseObject(obj.toJSONString(), MaterialCategory.class);
+    public int insertMaterialCategory(MaterialCategory materialCategory, HttpServletRequest request)throws Exception {
+        //创建时间
         materialCategory.setCreateTime(new Date());
         materialCategory.setCreateTime(new Date());
+        //修改时间
         materialCategory.setUpdateTime(new Date());
         materialCategory.setUpdateTime(new Date());
         User user = userService.getCurrentUser();
         User user = userService.getCurrentUser();
+        //租户id
         materialCategory.setTenantId(user.getId());
         materialCategory.setTenantId(user.getId());
         int result = 0;
         int result = 0;
         try{
         try{
@@ -145,8 +147,8 @@ public class MaterialCategoryServiceImpl extends ServiceImpl<MaterialCategoryMap
 
 
     @Override
     @Override
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public int updateMaterialCategory(JSONObject obj, HttpServletRequest request) throws Exception{
-        MaterialCategory materialCategory = JSONObject.parseObject(obj.toJSONString(), MaterialCategory.class);
+    public int updateMaterialCategory(MaterialCategory materialCategory, HttpServletRequest request) throws Exception{
+        //修改时间
         materialCategory.setUpdateTime(new Date());
         materialCategory.setUpdateTime(new Date());
         int result=0;
         int result=0;
         try{
         try{

+ 129 - 79
src/main/java/com/jsh/erp/service/impl/MaterialServiceImpl.java

@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.jsh.erp.constants.BusinessConstants;
 import com.jsh.erp.constants.BusinessConstants;
 import com.jsh.erp.constants.ExceptionConstants;
 import com.jsh.erp.constants.ExceptionConstants;
@@ -41,6 +42,7 @@ import java.io.File;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.*;
+import java.util.stream.Collectors;
 
 
 @Service
 @Service
 public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> implements MaterialService {
 public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> implements MaterialService {
@@ -134,12 +136,14 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
 
 
 
 
 
 
+    /**
+     * 查询商品管理-商品信息列表查询
+     */
     @Override
     @Override
     public List<MaterialVo4Unit> select(String materialParam, String standard, String model, String color, String brand, String mfrs,
     public List<MaterialVo4Unit> select(String materialParam, String standard, String model, String color, String brand, String mfrs,
                                         String materialOther, String weight, String expiryNum, String enableSerialNumber,
                                         String materialOther, String weight, String expiryNum, String enableSerialNumber,
                                         String enableBatchNumber, String position, String enabled, String remark, String categoryId,
                                         String enableBatchNumber, String position, String enabled, String remark, String categoryId,
-                                        String mpList)
-            throws Exception{
+                                        String mpList,String reminder) {
         String[] mpArr = new String[]{};
         String[] mpArr = new String[]{};
         if(StringUtil.isNotEmpty(mpList)){
         if(StringUtil.isNotEmpty(mpList)){
             mpArr= mpList.split(",");
             mpArr= mpList.split(",");
@@ -147,12 +151,14 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
         List<MaterialVo4Unit> list = new ArrayList<>();
         List<MaterialVo4Unit> list = new ArrayList<>();
         try{
         try{
             List<Long> idList = new ArrayList<>();
             List<Long> idList = new ArrayList<>();
+            //类型不为空,获取类型id集合
             if(StringUtil.isNotEmpty(categoryId)){
             if(StringUtil.isNotEmpty(categoryId)){
                 idList = getListByParentId(Long.parseLong(categoryId));
                 idList = getListByParentId(Long.parseLong(categoryId));
+
             }
             }
             PageUtils.startPage();
             PageUtils.startPage();
             list= materialMapperEx.selectByConditionMaterial(materialParam, standard, model, color, brand, mfrs, materialOther, weight, expiryNum,
             list= materialMapperEx.selectByConditionMaterial(materialParam, standard, model, color, brand, mfrs, materialOther, weight, expiryNum,
-                    enableSerialNumber, enableBatchNumber, position, enabled, remark, idList, mpList);
+                    enableSerialNumber, enableBatchNumber, position, enabled, remark, idList, mpList,reminder);
             if (null != list && list.size()>0) {
             if (null != list && list.size()>0) {
                 Map<Long,BigDecimal> initialStockMap = getInitialStockMapByMaterialList(list);
                 Map<Long,BigDecimal> initialStockMap = getInitialStockMapByMaterialList(list);
                 Map<Long,BigDecimal> currentStockMap = getCurrentStockMapByMaterialList(list);
                 Map<Long,BigDecimal> currentStockMap = getCurrentStockMapByMaterialList(list);
@@ -179,9 +185,9 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
      */
      */
     @Override
     @Override
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public int insertMaterial(MaterialDto obj, HttpServletRequest request)throws Exception {
+    public int insertMaterial(MaterialDto material, HttpServletRequest request)throws Exception {
         //商品主表信息
         //商品主表信息
-        Material m = obj;
+        Material m = material;
         //设置状态
         //设置状态
         m.setEnabled(true);
         m.setEnabled(true);
         //获取类型编码
         //获取类型编码
@@ -189,17 +195,15 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
         String sku = serial_no + DateUtils.dateTimeNow()  + RandomHelper.getRandomStr(6);
         String sku = serial_no + DateUtils.dateTimeNow()  + RandomHelper.getRandomStr(6);
         //设置系统sku
         //设置系统sku
         m.setSystemSku(sku);
         m.setSystemSku(sku);
-        User user = userService.getCurrentUser();
         try{
         try{
             //添加商品
             //添加商品
             materialMapperEx.insertSelectiveEx(m);
             materialMapperEx.insertSelectiveEx(m);
             Long mId = m.getId();
             Long mId = m.getId();
             //添加商品条码信息
             //添加商品条码信息
-            materialExtendService.saveDetails(obj.getMbList(),obj.getSortList().toJSONString(),mId,"insert");
-            //materialExtendService.saveDetials(null, obj.getSortList(), mId, "insert");
+            materialExtendService.saveDetails(material.getMbList(),material.getSortList().toJSONString(),mId,"insert");
             //设置初始库存
             //设置初始库存
-            if(obj.getStock()!=null) {
-                List<MaterialInitialStock> stockArr = obj.getStock();
+            if(material.getStock()!=null) {
+                List<MaterialInitialStock> stockArr = material.getStock();
                 for (int i = 0; i < stockArr.size(); i++) {
                 for (int i = 0; i < stockArr.size(); i++) {
                     MaterialInitialStock jsonObj = stockArr.get(i);
                     MaterialInitialStock jsonObj = stockArr.get(i);
                     //此时id为仓库id,仓库di、最低安全库存数量不为空
                     //此时id为仓库id,仓库di、最低安全库存数量不为空
@@ -309,7 +313,7 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
     @Override
     @Override
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     public int batchDeleteMaterialByIds(String ids) throws Exception{
     public int batchDeleteMaterialByIds(String ids) throws Exception{
-        String [] idArray=ids.split(",");
+        String [] idArray = ids.split(",");
         //校验单据子表	jsh_depot_item
         //校验单据子表	jsh_depot_item
         List<DepotItem> depotItemList =null;
         List<DepotItem> depotItemList =null;
         try{
         try{
@@ -436,7 +440,7 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
      */
      */
     @Override
     @Override
     public List<Long> getListByParentId(Long parentId) {
     public List<Long> getListByParentId(Long parentId) {
-        List<Long> idList = new ArrayList<Long>();
+        List<Long> idList = new ArrayList<>();
         List<MaterialCategory> list = materialCategoryMapperEx.getListByParentId(parentId);
         List<MaterialCategory> list = materialCategoryMapperEx.getListByParentId(parentId);
         idList.add(parentId);
         idList.add(parentId);
         if(list!=null && list.size()>0) {
         if(list!=null && list.size()>0) {
@@ -1023,7 +1027,7 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
     private Map<Long, String> getExcelDepot(Sheet src, int depotCount, Map<String, Long> depotMap, int i) throws Exception {
     private Map<Long, String> getExcelDepot(Sheet src, int depotCount, Map<String, Long> depotMap, int i) throws Exception {
         Map<Long, String> stockMap = new HashMap<>();
         Map<Long, String> stockMap = new HashMap<>();
         for(int j = 1; j<= depotCount; j++) {
         for(int j = 1; j<= depotCount; j++) {
-            int col = 16 + j;
+            int col = 18 + j;
             if(col < src.getColumns()){
             if(col < src.getColumns()){
                 String depotName = ExcelUtils.getContent(src, 1, col); //获取仓库名称
                 String depotName = ExcelUtils.getContent(src, 1, col); //获取仓库名称
                 if(StringUtil.isNotEmpty(depotName)) {
                 if(StringUtil.isNotEmpty(depotName)) {
@@ -1614,14 +1618,12 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
 
 
     /**
     /**
      * 根据商品id查询主表及子表信息
      * 根据商品id查询主表及子表信息
-     * @param id 商品id
-     * @return
      */
      */
     @Override
     @Override
     public Material getMaterialById(Long id){
     public Material getMaterialById(Long id){
         Material material = materialMapper.selectByPrimaryKey(id);
         Material material = materialMapper.selectByPrimaryKey(id);
-        List<MaterialExtend> list = materialExtendMapper.selectByMId(id);
-        material.setList(list);
+//        List<MaterialExtend> list = materialExtendMapper.selectByMId(id);
+//        material.setList(list);
         return material;
         return material;
     }
     }
 
 
@@ -1653,11 +1655,32 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
         List<String> expirationReminders = new ArrayList<>();
         List<String> expirationReminders = new ArrayList<>();
         List<String> inventoryReminders = new ArrayList<>();
         List<String> inventoryReminders = new ArrayList<>();
         //获取商品信息
         //获取商品信息
-        MaterialExample materialExample = new MaterialExample();
-        materialExample.createCriteria().andDeleteFlagEqualTo("0");
-        List<Material> materials = materialMapper.selectByExample(materialExample);
+        List<Material> materials = list(new LambdaQueryWrapperX<Material>().isNotNull(Material::getMovingPinReminderCycle).eq(Material::getDeleteFlag,"0"));
+        //所有商品提醒信息赋值为空
+        this.update(new UpdateWrapper<Material>().set("reminder","").eq("delete_flag","0"));
         //获取商品批次信息
         //获取商品批次信息
-        List<MaterialBatch> extendList = materialBatchService.list(new LambdaQueryWrapperX<MaterialBatch>().eq(MaterialBatch::getDeleteFlag,"0"));
+        List<MaterialBatch> extendList = materialBatchService.list(new LambdaQueryWrapperX<MaterialBatch>().gt(MaterialBatch::getInventory,"0").eq(MaterialBatch::getDeleteFlag,"0"));
+        Map<Long,Material> materialMap = new HashMap<>();
+        //过期提醒
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        extendList.stream().filter(v -> v.getInventory() != null && v.getInventory().doubleValue() > 0 && v.getProductionDate() != null && v.getExpiryNum() != null)
+                .forEach(v ->{
+                    if (DateUtils.differentDaysByMillisecond(v.getProductionDate(),new Date()) >  (v.getExpiryNum() -30)){
+                        String name = materialMapper.selectByPrimaryKey(v.getMaterialId()).getName();
+                        String str = "商品名称:" + name
+                                + ", 批次号:" + v.getBatchNumber()
+                                + ", 条码:" + v.getBarCode()
+                                + ", 生产日期:" + sdf.format(v.getProductionDate())
+                                + ", 保质期:" + v.getExpiryNum() + "天"
+                                + ", 库存:" + v.getInventory()
+                                + ",即将要过期,请及时处理";
+                        expirationReminders.add(str);
+                        if (materialMap.get(v.getMaterialId()) == null){
+                            materialMap.put(v.getMaterialId(),new Material().setId(v.getMaterialId()).setReminder("临期"));
+                        }
+                    }
+                });
+        vo.setExpirationReminder(expirationReminders);
         //无动销提醒
         //无动销提醒
         materials.stream().filter( v -> v.getMovingPinReminderCycle() != null && !"".equals(v.getMovingPinReminderCycle()))
         materials.stream().filter( v -> v.getMovingPinReminderCycle() != null && !"".equals(v.getMovingPinReminderCycle()))
                         .forEach(v -> {
                         .forEach(v -> {
@@ -1668,6 +1691,11 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
                                     //当前时间对比订单时间是否大于动销提醒周期
                                     //当前时间对比订单时间是否大于动销提醒周期
                                     String str = "商品名称:" + v.getName() + ",在[无动销提醒周期]内,无动销,请及时处理";
                                     String str = "商品名称:" + v.getName() + ",在[无动销提醒周期]内,无动销,请及时处理";
                                     noMovingPinReminders.add(str);
                                     noMovingPinReminders.add(str);
+                                    if (materialMap.get(v.getId()) == null){
+                                        materialMap.put(v.getId(),new Material().setId(v.getId()).setReminder("无动销"));
+                                    }else {
+                                        materialMap.put(v.getId(),new Material().setId(v.getId()).setReminder(materialMap.get(v.getId()).getReminder() + ",无动销"));
+                                    }
                                 }
                                 }
                             }else{
                             }else{
                                 //获取商品批次信息
                                 //获取商品批次信息
@@ -1675,33 +1703,22 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
                                 if (DateUtils.differentDaysByMillisecond(m.getCreateTime(),new Date()) > Integer.valueOf(v.getMovingPinReminderCycle())){
                                 if (DateUtils.differentDaysByMillisecond(m.getCreateTime(),new Date()) > Integer.valueOf(v.getMovingPinReminderCycle())){
                                     String str = "商品名称:" + v.getName() + ",在[无动销提醒周期]内,无动销,请及时处理";
                                     String str = "商品名称:" + v.getName() + ",在[无动销提醒周期]内,无动销,请及时处理";
                                     noMovingPinReminders.add(str);
                                     noMovingPinReminders.add(str);
+                                    if (materialMap.get(v.getId()) == null){
+                                        materialMap.put(v.getId(),new Material().setId(v.getId()).setReminder("无动销"));
+                                    }else {
+                                        materialMap.get(v.getId()).setRemark(materialMap.get(v.getId()).getReminder() + ",无动销");
+                                    }
                                 }
                                 }
                             }
                             }
 
 
                         });
                         });
         vo.setNoMovingPinReminder(noMovingPinReminders);
         vo.setNoMovingPinReminder(noMovingPinReminders);
-        //过期提醒
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
-        extendList.stream().filter(v -> v.getInventory() != null && v.getInventory().doubleValue() > 0 && v.getProductionDate() != null && v.getExpiryNum() != null)
-                .forEach(v ->{
-                    if (DateUtils.differentDaysByMillisecond(v.getProductionDate(),new Date()) >  (v.getExpiryNum() -30)){
-                        String name = materialMapper.selectByPrimaryKey(v.getMaterialId()).getName();
-                        String str = "商品名称:" + name
-                                + ", 批次号:" + v.getBatchNumber()
-                                + ", 条码:" + v.getBarCode()
-                                + ", 生产日期:" + sdf.format(v.getProductionDate())
-                                + ", 保质期:" + v.getExpiryNum() + "天"
-                                + ", 库存:" + v.getInventory()
-                                + ",即将要过期,请及时处理";
-                        expirationReminders.add(str);
-                    }
-                });
-        vo.setExpirationReminder(expirationReminders);
         //库存提醒
         //库存提醒
         MaterialInitialStockExample initialStockExample = new MaterialInitialStockExample();
         MaterialInitialStockExample initialStockExample = new MaterialInitialStockExample();
         initialStockExample.createCriteria().andDeleteFlagEqualTo("0");
         initialStockExample.createCriteria().andDeleteFlagEqualTo("0");
-
         List<MaterialInitialStock> initialStocks = materialInitialStockMapper.selectByExample(initialStockExample);
         List<MaterialInitialStock> initialStocks = materialInitialStockMapper.selectByExample(initialStockExample);
+        List<Depot> depotList = depotService.list();
+        Map<Long,String> depotMap = depotList.stream().collect(Collectors.toMap(Depot::getId,Depot::getName));
         initialStocks.stream().filter(v -> v.getLowSafeStock() != null && v.getLowSafeStock().doubleValue() > 0)
         initialStocks.stream().filter(v -> v.getLowSafeStock() != null && v.getLowSafeStock().doubleValue() > 0)
                 .forEach(v -> {
                 .forEach(v -> {
                     //根据商品id和仓库id查询当前库存
                     //根据商品id和仓库id查询当前库存
@@ -1709,11 +1726,18 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
                     if (currentNumber.doubleValue() <= v.getLowSafeStock().doubleValue()){
                     if (currentNumber.doubleValue() <= v.getLowSafeStock().doubleValue()){
                         Material material = materialMapper.selectByPrimaryKey(v.getMaterialId());
                         Material material = materialMapper.selectByPrimaryKey(v.getMaterialId());
                         String str = "商品名称:" + material.getName()
                         String str = "商品名称:" + material.getName()
-                                + ",库存告警,请及时处理";
+                                +depotMap.get(v.getDepotId()) + ",库存告警,请及时处理";
                         inventoryReminders.add(str);
                         inventoryReminders.add(str);
+                        if (materialMap.get(v.getMaterialId()) == null){
+                            materialMap.put(v.getMaterialId(),new Material().setId(v.getMaterialId()).setReminder("库存危险"));
+                        }else if (!materialMap.get(v.getMaterialId()).getReminder().contains("库存危险")){
+                            materialMap.get(v.getMaterialId()).setReminder(materialMap.get(v.getMaterialId()).getReminder() + ",库存危险");
+                        }
                     }
                     }
                 });
                 });
         vo.setInventoryReminder(inventoryReminders);
         vo.setInventoryReminder(inventoryReminders);
+        List<Material> materialList = new ArrayList<>(materialMap.values());
+        this.updateBatchById(materialList);
         return vo;
         return vo;
     }
     }
 
 
@@ -1760,10 +1784,12 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
                 String enabled = ExcelUtils.getContent(src, i, 10); //状态
                 String enabled = ExcelUtils.getContent(src, i, 10); //状态
                 String enableSerialNumber = ExcelUtils.getContent(src, i, 11); //序列号
                 String enableSerialNumber = ExcelUtils.getContent(src, i, 11); //序列号
                 String barCode = ExcelUtils.getContent(src, i, 12); //商品条码
                 String barCode = ExcelUtils.getContent(src, i, 12); //商品条码
-                String otherField1 = ExcelUtils.getContent(src, i, 13); //自定义1
-                String otherField2 = ExcelUtils.getContent(src, i, 14); //自定义2
-                String otherField3 = ExcelUtils.getContent(src, i, 15); //自定义3
-                String remark = ExcelUtils.getContent(src, i, 16); //备注
+                String defaultPurchaseDecimal = ExcelUtils.getContent(src, i, 13); //默认销售价
+                String defaultWholesaleDecimal = ExcelUtils.getContent(src, i, 14); //默认采购价
+                String otherField1 = ExcelUtils.getContent(src, i, 15); //自定义1
+                String otherField2 = ExcelUtils.getContent(src, i, 16); //自定义2
+                String otherField3 = ExcelUtils.getContent(src, i, 17); //自定义3
+                String remark = ExcelUtils.getContent(src, i, 18); //备注
                 //校验字段
                 //校验字段
                 //名称为空
                 //名称为空
                 if(StringUtil.isEmpty(name)) {
                 if(StringUtil.isEmpty(name)) {
@@ -1824,6 +1850,26 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
                     throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_BARCODE_LENGTH_ERROR_CODE,
                     throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_BARCODE_LENGTH_ERROR_CODE,
                             String.format(ExceptionConstants.MATERIAL_BARCODE_LENGTH_ERROR_MSG, barCode));
                             String.format(ExceptionConstants.MATERIAL_BARCODE_LENGTH_ERROR_MSG, barCode));
                 }
                 }
+                //默认采购价为空
+                if(StringUtil.isEmpty(defaultPurchaseDecimal)) {
+                    throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_DEFAULT_PURCHASE_DECIMAL_EMPTY_CODE,
+                            String.format(ExceptionConstants.MATERIAL_DEFAULT_PURCHASE_DECIMAL_EMPTY_MSG, i+1));
+                }
+                //校验默认采购价是否是数字(含小数)
+                if(!StringUtil.isPositiveBigDecimal(defaultPurchaseDecimal)) {
+                    throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_DEFAULT_PURCHASE_DECIMAL_NOT_DECIMAL_CODE,
+                            String.format(ExceptionConstants.MATERIAL_DEFAULT_PURCHASE_DECIMAL_NOT_DECIMAL_MSG, i+1));
+                }
+                //默认销售价为空
+                if(StringUtil.isEmpty(defaultWholesaleDecimal)) {
+                    throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_DEFAULT_WHOLESALE_DECIMAL_EMPTY_CODE,
+                            String.format(ExceptionConstants.MATERIAL_DEFAULT_WHOLESALE_DECIMAL_EMPTY_MSG, i+1));
+                }
+                //校验默认销售价是否是数字(含小数)
+                if(!StringUtil.isPositiveBigDecimal(defaultWholesaleDecimal)) {
+                    throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_DEFAULT_WHOLESALE_DECIMAL_NOT_DECIMAL_CODE,
+                            String.format(ExceptionConstants.MATERIAL_DEFAULT_WHOLESALE_DECIMAL_NOT_DECIMAL_MSG, i+1));
+                }
                 //批量校验excel中有无重复条码(1-文档自身校验,2-和数据库里面的商品校验)
                 //批量校验excel中有无重复条码(1-文档自身校验,2-和数据库里面的商品校验)
                 batchCheckExistBarCodeByParam(mList, barCode, null);
                 batchCheckExistBarCodeByParam(mList, barCode, null);
 //                Long depotId = null;
 //                Long depotId = null;
@@ -1862,6 +1908,10 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
                 Long serial_no = categoryId == null ? null : materialCategoryService.getMaterialCategory(m.getCategoryId()).getSerialNo();
                 Long serial_no = categoryId == null ? null : materialCategoryService.getMaterialCategory(m.getCategoryId()).getSerialNo();
                 //设置系统sku
                 //设置系统sku
                 m.setSystemSku(serial_no + DateUtils.dateTimeNow() + RandomHelper.getRandomStr(6));
                 m.setSystemSku(serial_no + DateUtils.dateTimeNow() + RandomHelper.getRandomStr(6));
+                //设置默认采购价
+                m.setDefaultPurchaseDecimal(StringUtil.isNotEmpty(defaultPurchaseDecimal) ? new BigDecimal(defaultPurchaseDecimal) : null);
+                //设置默认销售价
+                m.setDefaultWholesaleDecimal(StringUtil.isNotEmpty(defaultWholesaleDecimal) ? new BigDecimal(defaultWholesaleDecimal) : null);
                 m.setOtherField1(StringUtil.isNotEmpty(otherField1)?otherField1:null);
                 m.setOtherField1(StringUtil.isNotEmpty(otherField1)?otherField1:null);
                 m.setOtherField2(StringUtil.isNotEmpty(otherField2)?otherField2:null);
                 m.setOtherField2(StringUtil.isNotEmpty(otherField2)?otherField2:null);
                 m.setOtherField3(StringUtil.isNotEmpty(otherField3)?otherField3:null);
                 m.setOtherField3(StringUtil.isNotEmpty(otherField3)?otherField3:null);
@@ -2064,41 +2114,41 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
                     + "-" + m.getUnit();
                     + "-" + m.getUnit();
             if (materialMap.get(str) == null) {
             if (materialMap.get(str) == null) {
                 //商品主表不存在,创建商品主表
                 //商品主表不存在,创建商品主表
-                Material material = new Material();
-                //名称
-                material.setName(m.getName());
-                //型号
-                material.setModel(m.getModel());
-                //规格
-                material.setStandard(m.getStandard());
-                //品牌
-                material.setBrand(m.getBrand());
-                //助记码
-                material.setMnemonic(m.getMnemonic());
-                //颜色
-                material.setColor(m.getColor());
-                //商品类别
-                material.setCategoryId(m.getCategoryId());
-                //单位-单个
-                material.setUnit(m.getUnit());
-                //计量单位Id
-                material.setUnitId(m.getUnitId());
-                //备注
-                material.setRemark(m.getRemark());
-                //基础重量
-                material.setWeight(m.getWeight());
-                //启用 0-禁用  1-启用
-                material.setEnabled(m.getEnabled());
-                //自定义1
-                material.setOtherField1(m.getOtherField1());
-                //自定义2
-                material.setOtherField2(m.getOtherField2());
-                //自定义3
-                material.setOtherField3(m.getOtherField3());
-                //是否开启序列号
-                material.setEnableSerialNumber(m.getEnableSerialNumber());
-                //系统sku
-                material.setSystemSku(m.getSystemSku());
+                Material material = m;
+//                //名称
+//                material.setName(m.getName());
+//                //型号
+//                material.setModel(m.getModel());
+//                //规格
+//                material.setStandard(m.getStandard());
+//                //品牌
+//                material.setBrand(m.getBrand());
+//                //助记码
+//                material.setMnemonic(m.getMnemonic());
+//                //颜色
+//                material.setColor(m.getColor());
+//                //商品类别
+//                material.setCategoryId(m.getCategoryId());
+//                //单位-单个
+//                material.setUnit(m.getUnit());
+//                //计量单位Id
+//                material.setUnitId(m.getUnitId());
+//                //备注
+//                material.setRemark(m.getRemark());
+//                //基础重量
+//                material.setWeight(m.getWeight());
+//                //启用 0-禁用  1-启用
+//                material.setEnabled(m.getEnabled());
+//                //自定义1
+//                material.setOtherField1(m.getOtherField1());
+//                //自定义2
+//                material.setOtherField2(m.getOtherField2());
+//                //自定义3
+//                material.setOtherField3(m.getOtherField3());
+//                //是否开启序列号
+//                material.setEnableSerialNumber(m.getEnableSerialNumber());
+//                //系统sku
+//                material.setSystemSku(m.getSystemSku());
                 List<MaterialExtend> list = new ArrayList<>();
                 List<MaterialExtend> list = new ArrayList<>();
                 material.setList(list);
                 material.setList(list);
                 material.setDepotMap(m.getDepotMap());
                 material.setDepotMap(m.getDepotMap());

+ 76 - 0
src/main/java/com/jsh/erp/service/impl/SequenceServiceImpl.java

@@ -0,0 +1,76 @@
+package com.jsh.erp.service.impl;
+
+import com.jsh.erp.constants.BusinessConstants;
+import com.jsh.erp.datasource.mappers.*;
+import com.jsh.erp.exception.JshException;
+import com.jsh.erp.service.SequenceService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+
+/**
+ * Description
+ *
+ * @Author: longyong
+ * @Date: 2021/3/16 16:33
+ */
+@Service
+public class SequenceServiceImpl implements SequenceService {
+    private Logger logger = LoggerFactory.getLogger(SequenceServiceImpl.class);
+
+    @Resource
+    private SequenceMapperEx sequenceMapperEx;
+
+    /**
+     * 创建一个唯一的序列号
+     * */
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    @Override
+    public String buildOnlyNumber()throws Exception{
+        Long buildOnlyNumber=null;
+        synchronized (this){
+            try{
+                sequenceMapperEx.updateBuildOnlyNumber(BusinessConstants.DEPOT_NUMBER_SEQ); //编号+1
+                buildOnlyNumber= sequenceMapperEx.getBuildOnlyNumber(BusinessConstants.DEPOT_NUMBER_SEQ);
+            }catch(Exception e){
+                JshException.writeFail(logger, e);
+            }
+        }
+        if(buildOnlyNumber<BusinessConstants.SEQ_TO_STRING_MIN_LENGTH){
+            StringBuffer sb=new StringBuffer(buildOnlyNumber.toString());
+            int len=BusinessConstants.SEQ_TO_STRING_MIN_LENGTH.toString().length()-sb.length();
+            for(int i=0;i<len;i++){
+                sb.insert(0,BusinessConstants.SEQ_TO_STRING_LESS_INSERT);
+            }
+            return sb.toString();
+        }else{
+            return buildOnlyNumber.toString();
+        }
+    }
+
+    /**
+     * 构建供应商编号
+     */
+    @Override
+    public String buildSupplierNumber() {
+        Long buildOnlyNumber = null;
+        synchronized (this){
+            sequenceMapperEx.updateBuildOnlyNumber(BusinessConstants.SUPPLIER_NUMBER_SEQ); //编号+1
+            buildOnlyNumber = sequenceMapperEx.getBuildOnlyNumber(BusinessConstants.SUPPLIER_NUMBER_SEQ);
+        }
+        if(buildOnlyNumber < BusinessConstants.SUPPLIER_SEQ_TO_STRING_MIN_LENGTH){
+            StringBuffer sb = new StringBuffer(buildOnlyNumber.toString());
+            int len = BusinessConstants.SUPPLIER_SEQ_TO_STRING_MIN_LENGTH.toString().length() - sb.length();
+            for(int i=0; i<len; i++){
+                sb.insert(0,BusinessConstants.SEQ_TO_STRING_LESS_INSERT);
+            }
+            return sb.toString();
+        }else{
+            return buildOnlyNumber.toString();
+        }
+    }
+
+}

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

@@ -56,6 +56,9 @@ public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier> i
     @Resource
     @Resource
     private UserBusinessMapper userBusinessMapper;
     private UserBusinessMapper userBusinessMapper;
 
 
+    @Resource
+    private SequenceService sequenceService;
+
     @Override
     @Override
     public Supplier getSupplier(long id)throws Exception {
     public Supplier getSupplier(long id)throws Exception {
         Supplier result=null;
         Supplier result=null;
@@ -153,11 +156,12 @@ public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier> i
 
 
     @Override
     @Override
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public int insertSupplier(JSONObject obj, HttpServletRequest request)throws Exception {
-        Supplier supplier = JSONObject.parseObject(obj.toJSONString(), Supplier.class);
+    public int insertSupplier(Supplier supplier, HttpServletRequest request)throws Exception {
         int result=0;
         int result=0;
         try{
         try{
             supplier.setEnabled(true);
             supplier.setEnabled(true);
+            //设置供应商编号
+            supplier.setSerialNo("S" + sequenceService.buildSupplierNumber());
             User userInfo=userService.getCurrentUser();
             User userInfo=userService.getCurrentUser();
             supplier.setCreator(userInfo==null?null:userInfo.getId());
             supplier.setCreator(userInfo==null?null:userInfo.getId());
             result=supplierMapper.insertSelective(supplier);
             result=supplierMapper.insertSelective(supplier);
@@ -173,8 +177,7 @@ public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier> i
 
 
     @Override
     @Override
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public int updateSupplier(JSONObject obj, HttpServletRequest request)throws Exception {
-        Supplier supplier = JSONObject.parseObject(obj.toJSONString(), Supplier.class);
+    public int updateSupplier(Supplier supplier, HttpServletRequest request)throws Exception {
         if(supplier.getBeginNeedPay() == null) {
         if(supplier.getBeginNeedPay() == null) {
             supplier.setBeginNeedPay(BigDecimal.ZERO);
             supplier.setBeginNeedPay(BigDecimal.ZERO);
         }
         }

+ 8 - 2
src/main/resources/mapper_xml/DepotHeadMapper.xml

@@ -279,8 +279,11 @@
       <if test="receiverAddress != null">
       <if test="receiverAddress != null">
         receiver_address,
         receiver_address,
       </if>
       </if>
+      <if test="depotId != null">
+        depot_id,
+      </if>
       <if test="operId != null">
       <if test="operId != null">
-        oper_id
+        oper_id,
       </if>
       </if>
     </trim>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
     <trim prefix="values (" suffix=")" suffixOverrides=",">
@@ -401,8 +404,11 @@
       <if test="receiverAddress != null">
       <if test="receiverAddress != null">
         #{receiverAddress,jdbcType=VARCHAR},
         #{receiverAddress,jdbcType=VARCHAR},
       </if>
       </if>
+      <if test="depotId != null">
+        #{depotId},
+      </if>
       <if test="operId != null">
       <if test="operId != null">
-        #{operId,jdbcType=INTEGER}
+        #{operId,jdbcType=INTEGER},
       </if>
       </if>
     </trim>
     </trim>
   </insert>
   </insert>

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

@@ -97,7 +97,7 @@
     id, header_id, material_id, material_extend_id, material_unit, sku, oper_number, 
     id, header_id, material_id, material_extend_id, material_unit, sku, oper_number, 
     basic_number, unit_price, purchase_unit_price, tax_unit_price, all_price, remark, 
     basic_number, unit_price, purchase_unit_price, tax_unit_price, all_price, remark, 
     depot_id, another_depot_id, tax_rate, tax_money, tax_last_money, material_type, sn_list, 
     depot_id, another_depot_id, tax_rate, tax_money, tax_last_money, material_type, sn_list, 
-    batch_number, expiration_date, link_id, tenant_id, delete_flag
+    batch_number, expiration_date, link_id, tenant_id, delete_flag,production_date,expiry_num,position,wholesale_decimal
   </sql>
   </sql>
   <select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="BaseResultMap">
   <select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="BaseResultMap">
     select
     select

+ 1 - 1
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.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,
         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,
         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
+        us.username warehousingUserName,m.default_purchase_decimal,m.default_wholesale_decimal
         from jsh_depot_item di
         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 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'
         left join jsh_material_extend me on me.id=di.material_extend_id  and ifnull(me.delete_Flag,'0') !='1'

+ 7 - 1
src/main/resources/mapper_xml/MaterialCategoryMapper.xml

@@ -74,7 +74,7 @@
   </sql>
   </sql>
   <sql id="Base_Column_List">
   <sql id="Base_Column_List">
     id, name, category_level, parent_id, sort, serial_no, remark, create_time, update_time, 
     id, name, category_level, parent_id, sort, serial_no, remark, create_time, update_time, 
-    tenant_id, delete_flag
+    tenant_id, delete_flag, expiry_threshold
   </sql>
   </sql>
   <select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.MaterialCategoryExample" resultMap="BaseResultMap">
   <select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.MaterialCategoryExample" resultMap="BaseResultMap">
     select
     select
@@ -151,6 +151,9 @@
       <if test="deleteFlag != null">
       <if test="deleteFlag != null">
         delete_flag,
         delete_flag,
       </if>
       </if>
+      <if test="expiryThreshold != null">
+        expiry_threshold,
+      </if>
     </trim>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       (select ifnull(MAX(id),0) + 10001 from jsh_material_category AS mc),
       (select ifnull(MAX(id),0) + 10001 from jsh_material_category AS mc),
@@ -185,6 +188,9 @@
       <if test="deleteFlag != null">
       <if test="deleteFlag != null">
         #{deleteFlag,jdbcType=VARCHAR},
         #{deleteFlag,jdbcType=VARCHAR},
       </if>
       </if>
+      <if test="expiryThreshold != null">
+        #{expiryThreshold},
+      </if>
     </trim>
     </trim>
   </insert>
   </insert>
 
 

+ 2 - 1
src/main/resources/mapper_xml/MaterialCategoryMapperEx.xml

@@ -107,7 +107,8 @@
        update jsh_material_category
        update jsh_material_category
        set update_time=#{updateTime},
        set update_time=#{updateTime},
         parent_id=#{parentId},sort=#{sort},
         parent_id=#{parentId},sort=#{sort},
-        name=#{name},remark=#{remark}
+        name=#{name},remark=#{remark},
+        expiry_threshold = #{expiryThreshold}
        where id =#{id}
        where id =#{id}
     </update>
     </update>
 
 

+ 1 - 1
src/main/resources/mapper_xml/MaterialExtendMapper.xml

@@ -439,7 +439,7 @@
         position = #{position,jdbcType=VARCHAR},
         position = #{position,jdbcType=VARCHAR},
       </if>
       </if>
       <if test="ratio != null">
       <if test="ratio != null">
-        position = #{ratio,jdbcType=INTEGER},
+        ratio = #{ratio,jdbcType=INTEGER},
       </if>
       </if>
     </set>
     </set>
     where id = #{id,jdbcType=BIGINT}
     where id = #{id,jdbcType=BIGINT}

+ 12 - 2
src/main/resources/mapper_xml/MaterialMapper.xml

@@ -91,7 +91,8 @@
   <sql id="Base_Column_List">
   <sql id="Base_Column_List">
     id, category_id, name, model, standard, brand, mnemonic, color, unit, remark,
     id, category_id, name, model, standard, brand, mnemonic, color, unit, remark,
     img_name, unit_id, weight, enabled, other_field1, other_field2, other_field3,
     img_name, unit_id, weight, enabled, other_field1, other_field2, other_field3,
-    enable_serial_number, enable_batch_number, tenant_id, delete_flag, system_sku, moving_pin_reminder_cycle
+    enable_serial_number, enable_batch_number, tenant_id, delete_flag, system_sku,
+    moving_pin_reminder_cycle,expiry_num,default_purchase_decimal,default_wholesale_decimal
   </sql>
   </sql>
 
 
   <select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="BaseResultMap">
   <select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="BaseResultMap">
@@ -459,6 +460,15 @@
       <if test="movingPinReminderCycle != null">
       <if test="movingPinReminderCycle != null">
         moving_pin_reminder_cycle = #{movingPinReminderCycle,jdbcType=VARCHAR},
         moving_pin_reminder_cycle = #{movingPinReminderCycle,jdbcType=VARCHAR},
       </if>
       </if>
+      <if test="expiryNum != null">
+        expiry_num = #{expiryNum},
+      </if>
+      <if test="defaultPurchaseDecimal != null">
+        default_purchase_decimal = #{defaultPurchaseDecimal},
+      </if>
+      <if test="defaultWholesaleDecimal != null">
+        default_wholesale_decimal = #{defaultWholesaleDecimal},
+      </if>
     </set>
     </set>
     where id = #{id,jdbcType=BIGINT}
     where id = #{id,jdbcType=BIGINT}
   </update>
   </update>
@@ -502,7 +512,7 @@
     FROM jsh_material m
     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_material_extend me on m.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
     left join jsh_material_initial_stock mis ON m.id= mis.material_id AND mis.depot_id = #{depotId}
     left join jsh_material_initial_stock mis ON m.id= mis.material_id AND mis.depot_id = #{depotId}
-    left JOIN (SELECT material_id,SUM(current_number) AS 'inventory' FROM jsh_material_current_stock GROUP BY material_id) mi ON m.id = mi.material_id
+    left JOIN (SELECT material_id,SUM(current_number) AS 'inventory' FROM jsh_material_current_stock WHERE depot_id = #{depotId} GROUP BY material_id) mi ON m.id = mi.material_id
     <where>
     <where>
       m.enabled = 1 and me.id is not null
       m.enabled = 1 and me.id is not null
       <if test="keyword != null and keyword !=''">
       <if test="keyword != null and keyword !=''">

+ 25 - 3
src/main/resources/mapper_xml/MaterialMapperEx.xml

@@ -48,7 +48,7 @@
         <result column="number" jdbcType="DECIMAL" property="number" />
         <result column="number" jdbcType="DECIMAL" property="number" />
     </resultMap>
     </resultMap>
 
 
-    <select id="selectByConditionMaterial" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="ResultMapList">
+    <select id="selectByConditionMaterial" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultType="com.jsh.erp.datasource.entities.MaterialVo4Unit">
         select jm.*, u.name unitName, mc.name categoryName, jme.bar_code,
         select jm.*, u.name unitName, mc.name categoryName, jme.bar_code,
         jme.purchase_decimal, jme.commodity_decimal, jme.wholesale_decimal, jme.low_decimal, jme.sku
         jme.purchase_decimal, jme.commodity_decimal, jme.wholesale_decimal, jme.low_decimal, jme.sku
         from (select m.id, min(me.id) meId
         from (select m.id, min(me.id) meId
@@ -103,6 +103,10 @@
             <bind name="bindRemark" value="'%'+remark+'%'"/>
             <bind name="bindRemark" value="'%'+remark+'%'"/>
             and m.remark like #{bindRemark}
             and m.remark like #{bindRemark}
         </if>
         </if>
+        <if test="reminder != null and reminder !=''">
+            <bind name="bindReminder" value="'%'+reminder+'%'"/>
+            and m.reminder like #{bindReminder}
+        </if>
         <if test="idList.size()>0">
         <if test="idList.size()>0">
             and m.category_id in
             and m.category_id in
             <foreach collection="idList" item="item" index="index" separator="," open="(" close=")">
             <foreach collection="idList" item="item" index="index" separator="," open="(" close=")">
@@ -191,6 +195,15 @@
             <if test="movingPinReminderCycle != null">
             <if test="movingPinReminderCycle != null">
                 moving_pin_reminder_cycle,
                 moving_pin_reminder_cycle,
             </if>
             </if>
+            <if test="expiryNum != null">
+                expiry_num,
+            </if>
+            <if test="defaultPurchaseDecimal != null">
+                default_purchase_decimal,
+            </if>
+            <if test="defaultWholesaleDecimal != null">
+                default_wholesale_decimal,
+            </if>
         </trim>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="id != null">
             <if test="id != null">
@@ -262,6 +275,15 @@
             <if test="movingPinReminderCycle != null">
             <if test="movingPinReminderCycle != null">
                 #{movingPinReminderCycle,jdbcType=VARCHAR},
                 #{movingPinReminderCycle,jdbcType=VARCHAR},
             </if>
             </if>
+            <if test="expiryNum != null">
+                #{expiryNum},
+            </if>
+            <if test="defaultPurchaseDecimal != null">
+                #{defaultPurchaseDecimal},
+            </if>
+            <if test="defaultWholesaleDecimal != null">
+                #{defaultWholesaleDecimal},
+            </if>
         </trim>
         </trim>
     </insert>
     </insert>
 
 
@@ -552,8 +574,8 @@
     </select>
     </select>
 
 
     <select id="getMaterialByBarCode" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="ResultAndUnitMap">
     <select id="getMaterialByBarCode" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="ResultAndUnitMap">
-        select m.*,u.name unit_name, me.id meId,me.bar_code m_bar_code, 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
+        select m.*,u.name unit_name, me.id meId,me.bar_code m_bar_code, me.commodity_unit,
+        me.sku, me.production_date, me.expiry_num, me.supplier_id, me.bar_code, me.batch_number, me.depot_id,me.ratio
         from jsh_material m
         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_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'
         left join jsh_unit u on m.unit_id=u.id and ifnull(u.delete_Flag,'0') !='1'

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

@@ -3,11 +3,11 @@
 <mapper namespace="com.jsh.erp.datasource.mappers.SequenceMapperEx">
 <mapper namespace="com.jsh.erp.datasource.mappers.SequenceMapperEx">
 
 
     <update id="updateBuildOnlyNumber">
     <update id="updateBuildOnlyNumber">
-        update jsh_sequence set current_val = current_val + 1 where seq_name = 'depot_number_seq'
+        update jsh_sequence set current_val = current_val + 1 where seq_name = #{seq_name}
     </update>
     </update>
 
 
     <select id="getBuildOnlyNumber" resultType="java.lang.Long">
     <select id="getBuildOnlyNumber" resultType="java.lang.Long">
-      select current_val from jsh_sequence where seq_name = 'depot_number_seq'
+      select current_val from jsh_sequence where seq_name = #{seq_name}
     </select>
     </select>
 
 
 </mapper>
 </mapper>

+ 27 - 0
src/main/resources/mapper_xml/SupplierMapper.xml

@@ -248,6 +248,15 @@
       <if test="contractUpload != null">
       <if test="contractUpload != null">
         contract_upload,
         contract_upload,
       </if>
       </if>
+      <if test="serialNo != null">
+        serial_no,
+      </if>
+      <if test="isAfterSales != null">
+        is_after_sales,
+      </if>
+      <if test="afterSalesRules != null">
+        after_sales_rules,
+      </if>
     </trim>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="id != null">
       <if test="id != null">
@@ -346,6 +355,15 @@
       <if test="contractUpload != null">
       <if test="contractUpload != null">
         #{contractUpload,jdbcType=VARCHAR},
         #{contractUpload,jdbcType=VARCHAR},
       </if>
       </if>
+      <if test="serialNo != null">
+        #{serialNo},
+      </if>
+      <if test="isAfterSales != null">
+        #{isAfterSales},
+      </if>
+      <if test="afterSalesRules != null">
+        #{afterSalesRules},
+      </if>
     </trim>
     </trim>
   </insert>
   </insert>
   <select id="countByExample" parameterType="com.jsh.erp.datasource.entities.SupplierExample" resultType="java.lang.Long">
   <select id="countByExample" parameterType="com.jsh.erp.datasource.entities.SupplierExample" resultType="java.lang.Long">
@@ -592,6 +610,15 @@
       <if test="contractUpload != null">
       <if test="contractUpload != null">
         contract_upload = #{contractUpload,jdbcType=VARCHAR},
         contract_upload = #{contractUpload,jdbcType=VARCHAR},
       </if>
       </if>
+      <if test="serialNo != null">
+        serial_no = #{serialNo},
+      </if>
+      <if test="isAfterSales != null">
+        is_after_sales = #{isAfterSales},
+      </if>
+      <if test="afterSalesRules != null">
+        after_sales_rules = #{afterSalesRules},
+      </if>
     </set>
     </set>
     where id = #{id,jdbcType=BIGINT}
     where id = #{id,jdbcType=BIGINT}
   </update>
   </update>