Browse Source

pda拣货入库模糊查询添加,订单出库时间添加,pc端订单商品数据显示,详情修改

huang 4 weeks ago
parent
commit
a80d90b281

+ 35 - 31
docs/new_sql.sql

@@ -123,50 +123,54 @@ ADD COLUMN create_time DATETIME DEFAULT NULL COMMENT '创建时间';
 
 
 -- 单据主表 修改文件,凭证,价格,数量图片类型
 -- 单据主表 修改文件,凭证,价格,数量图片类型
 ALTER TABLE jsh_depot_head
 ALTER TABLE jsh_depot_head
-  MODIFY file_name TEXT,
-  MODIFY voucher_picture TEXT,
-  MODIFY change_amount DECIMAL(24,2),
-  MODIFY back_amount DECIMAL(24,2),
-  MODIFY total_price DECIMAL(24,2),
-  MODIFY discount_money DECIMAL(24,2),
-  MODIFY discount_last_money DECIMAL(24,2),
-  MODIFY other_money DECIMAL(24,2),
-  MODIFY deposit DECIMAL(24,2);
+  MODIFY file_name TEXT DEFAULT NULL COMMENT '附件名称',
+  MODIFY voucher_picture TEXT DEFAULT NULL COMMENT '凭证图片',
+  MODIFY change_amount DECIMAL(24,2) DEFAULT NULL COMMENT '变动金额(收款/付款)',
+  MODIFY back_amount DECIMAL(24,2) DEFAULT NULL COMMENT '找零金额',
+  MODIFY total_price DECIMAL(24,2) DEFAULT NULL COMMENT '合计金额',
+  MODIFY discount_money DECIMAL(24,2) DEFAULT NULL COMMENT '优惠金额',
+  MODIFY discount_last_money DECIMAL(24,2) DEFAULT NULL COMMENT '优惠后金额',
+  MODIFY other_money DECIMAL(24,2) DEFAULT NULL COMMENT '销售或采购费用合计',
+  MODIFY deposit DECIMAL(24,2) DEFAULT NULL COMMENT '订金';
 
 
 -- 单据子表  修改数量、价格类型
 -- 单据子表  修改数量、价格类型
 ALTER TABLE jsh_depot_item
 ALTER TABLE jsh_depot_item
-  MODIFY oper_number DECIMAL(24,0),
-  MODIFY basic_number DECIMAL(24,0),
-  MODIFY unit_price DECIMAL(24,2),
-  MODIFY purchase_unit_price DECIMAL(24,2),
-  MODIFY tax_unit_price DECIMAL(24,2),
-  MODIFY all_price DECIMAL(24,2),
-  MODIFY tax_money DECIMAL(24,2),
-  MODIFY tax_last_money DECIMAL(24,2),
-  MODIFY actual_quantity_in_storage DECIMAL(10,0),
-  MODIFY warehousing_variance DECIMAL(10,0);
+  MODIFY oper_number DECIMAL(24,0) DEFAULT NULL COMMENT '数量',
+  MODIFY basic_number DECIMAL(24,0) DEFAULT NULL COMMENT '基础数量',
+  MODIFY unit_price DECIMAL(24,2) DEFAULT NULL COMMENT '单价',
+  MODIFY purchase_unit_price DECIMAL(24,2) DEFAULT NULL COMMENT '采购单价',
+  MODIFY tax_unit_price DECIMAL(24,2) DEFAULT NULL COMMENT '含税单价',
+  MODIFY all_price DECIMAL(24,2) DEFAULT NULL COMMENT '金额',
+  MODIFY tax_money DECIMAL(24,2) DEFAULT NULL COMMENT '税额',
+  MODIFY tax_last_money DECIMAL(24,2) DEFAULT NULL COMMENT '价税合计',
+  MODIFY actual_quantity_in_storage DECIMAL(10,0) DEFAULT NULL COMMENT '实际出入库数量',
+  MODIFY warehousing_variance DECIMAL(10,0) DEFAULT NULL COMMENT '出入库差异';
 
 
 -- 商品主表 修改商品图片、重量类型
 -- 商品主表 修改商品图片、重量类型
 ALTER TABLE jsh_material
 ALTER TABLE jsh_material
-  MODIFY img_name TEXT,
-  MODIFY weight DECIMAL(24,2);
+  MODIFY img_name TEXT DEFAULT NULL COMMENT '图片名称',
+  MODIFY weight DECIMAL(24,2) DEFAULT NULL COMMENT '基础重量(kg)';
 
 
 -- 商品子表 修改价格,库存类型
 -- 商品子表 修改价格,库存类型
 ALTER TABLE jsh_material_extend
 ALTER TABLE jsh_material_extend
-  MODIFY purchase_decimal DECIMAL(24,2),
-  MODIFY commodity_decimal DECIMAL(24,2),
-  MODIFY wholesale_decimal DECIMAL(24,2),
-  MODIFY low_decimal DECIMAL(24,2),
-  MODIFY inventory DECIMAL(10,0);
+  MODIFY purchase_decimal DECIMAL(24,2) DEFAULT NULL COMMENT '采购价格',
+  MODIFY commodity_decimal DECIMAL(24,2) DEFAULT NULL COMMENT '零售价格',
+  MODIFY wholesale_decimal DECIMAL(24,2) DEFAULT NULL COMMENT '销售价格',
+  MODIFY low_decimal DECIMAL(24,2) DEFAULT NULL COMMENT '最低售价',
+  MODIFY inventory DECIMAL(10,0) DEFAULT 0 COMMENT 'inventory';
 
 
 -- 初始库存表 修改库存类型
 -- 初始库存表 修改库存类型
 ALTER TABLE jsh_material_initial_stock
 ALTER TABLE jsh_material_initial_stock
-  MODIFY number DECIMAL(24,0),
-  MODIFY low_safe_stock DECIMAL(24,0),
-  MODIFY high_safe_stock DECIMAL(24,0);
+  MODIFY number DECIMAL(24,0) DEFAULT NULL COMMENT '初始库存数量',
+  MODIFY low_safe_stock DECIMAL(24,0) DEFAULT NULL COMMENT '最低库存数量',
+  MODIFY high_safe_stock DECIMAL(24,0) DEFAULT NULL COMMENT '最高库存数量';
 
 
 -- 当前库存表 修改价格、库存类型
 -- 当前库存表 修改价格、库存类型
 ALTER TABLE jsh_material_current_stock
 ALTER TABLE jsh_material_current_stock
-  MODIFY current_number DECIMAL(24,0),
-  MODIFY current_unit_price DECIMAL(24,2);
+  MODIFY current_number DECIMAL(24,0) DEFAULT NULL COMMENT '当前库存数量',
+  MODIFY current_unit_price DECIMAL(24,2) DEFAULT NULL COMMENT '当前价格';
+
+-- 单据主表 新增提交时间
+ALTER TABLE jsh_depot_head
+  ADD COLUMN submit_time datetime DEFAULT NULL COMMENT '提交时间';
 
 

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

@@ -287,6 +287,7 @@ public class DepotItemController {
                     item.put("reasonOfDifference",diEx.getReasonOfDifference());
                     item.put("reasonOfDifference",diEx.getReasonOfDifference());
                     item.put("warehousingUser",diEx.getWarehousingUser());
                     item.put("warehousingUser",diEx.getWarehousingUser());
                     item.put("warehousingTime",diEx.getWarehousingTime());
                     item.put("warehousingTime",diEx.getWarehousingTime());
+                    item.put("warehousingUserName",diEx.getWarehousingUserName());
                     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 - 2
src/main/java/com/jsh/erp/datasource/entities/DepotHead.java

@@ -35,8 +35,8 @@ public class DepotHead {
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date createTime;
     private Date createTime;
 
 
-    @ApiModelProperty("出入库时间")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty("单据时间")
+    @JsonFormat(pattern = "yyyy-MM-dd")
     private Date operTime;
     private Date operTime;
 
 
     @ApiModelProperty("供应商id")
     @ApiModelProperty("供应商id")
@@ -153,6 +153,10 @@ public class DepotHead {
     @ApiModelProperty("操作人")
     @ApiModelProperty("操作人")
     private Long operId;
     private Long operId;
 
 
+    @ApiModelProperty("提交时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date submitTime;
+
 
 
     public Long getId() {
     public Long getId() {
         return id;
         return id;

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

@@ -82,6 +82,9 @@ public class DepotItemVo4WithInfoEx extends DepotItem{
     @ApiModelProperty("供应商名称")
     @ApiModelProperty("供应商名称")
     private String supplierName;
     private String supplierName;
 
 
+    @ApiModelProperty("入库人名称")
+    private String warehousingUserName;
+
     public Long getMId() {
     public Long getMId() {
         return MId;
         return MId;
     }
     }

+ 9 - 0
src/main/java/com/jsh/erp/datasource/entities/MaterialCurrentStock.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;
 
 
@@ -13,18 +14,26 @@ import java.math.BigDecimal;
 @Accessors(chain = true)
 @Accessors(chain = true)
 @TableName("jsh_material_current_stock")
 @TableName("jsh_material_current_stock")
 public class MaterialCurrentStock {
 public class MaterialCurrentStock {
+
+    @ApiModelProperty("主键id")
     private Long id;
     private Long id;
 
 
+    @ApiModelProperty("产品id")
     private Long materialId;
     private Long materialId;
 
 
+    @ApiModelProperty("仓库id")
     private Long depotId;
     private Long depotId;
 
 
+    @ApiModelProperty("当前库存数量")
     private BigDecimal currentNumber;
     private BigDecimal currentNumber;
 
 
+    @ApiModelProperty("当前价格")
     private BigDecimal currentUnitPrice;
     private BigDecimal currentUnitPrice;
 
 
+    @ApiModelProperty("租户id")
     private Long tenantId;
     private Long tenantId;
 
 
+    @ApiModelProperty("删除标记,0未删除,1删除")
     private String deleteFlag;
     private String deleteFlag;
 
 
     public Long getId() {
     public Long getId() {

+ 3 - 0
src/main/java/com/jsh/erp/datasource/pda/vo/PDADepotHeadVO.java

@@ -36,4 +36,7 @@ public class PDADepotHeadVO {
     @ApiModelProperty("订单状态")
     @ApiModelProperty("订单状态")
     private String status;
     private String status;
 
 
+    @ApiModelProperty("出入库时间")
+    private Date warehousingTime;
+
 }
 }

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

@@ -1,11 +1,17 @@
 package com.jsh.erp.datasource.vo;
 package com.jsh.erp.datasource.vo;
 
 
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 
 
+@Data
 public class MaterialCountVo {
 public class MaterialCountVo {
 
 
+    @ApiModelProperty("单据主表ID")
     private Long headerId;
     private Long headerId;
 
 
+    @ApiModelProperty("商品数量")
     private BigDecimal materialCount;
     private BigDecimal materialCount;
 
 
     public Long getHeaderId() {
     public Long getHeaderId() {

+ 4 - 0
src/main/java/com/jsh/erp/service/DepotItemService.java

@@ -67,6 +67,10 @@ public interface DepotItemService extends IService<DepotItem> {
     Long findDetailByDepotIdsAndMaterialIdCount(String depotIds, Boolean forceFlag, Boolean inOutManageFlag, String sku, String batchNumber,
     Long findDetailByDepotIdsAndMaterialIdCount(String depotIds, Boolean forceFlag, Boolean inOutManageFlag, String sku, String batchNumber,
                                                 String number, String beginTime, String endTime, Long mId)throws Exception;
                                                 String number, String beginTime, String endTime, Long mId)throws Exception;
 
 
+    /**
+     * 插入单据子表
+     * @param depotItem 单据子表
+     */
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     int insertDepotItemWithObj(DepotItem depotItem)throws Exception;
     int insertDepotItemWithObj(DepotItem depotItem)throws Exception;
 
 

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

@@ -732,6 +732,10 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
         return materialsListMap;
         return materialsListMap;
     }
     }
 
 
+    /**
+     * 根据单据主表id获取商品数量
+     * @param idList 单据主表id集合
+     */
     @Override
     @Override
     public Map<Long,BigDecimal> getMaterialCountListMapByHeaderIdList(List<Long> idList)throws Exception {
     public Map<Long,BigDecimal> getMaterialCountListMapByHeaderIdList(List<Long> idList)throws Exception {
         Map<Long,BigDecimal> materialCountListMap = new HashMap<>();
         Map<Long,BigDecimal> materialCountListMap = new HashMap<>();
@@ -1123,12 +1127,17 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
         }
         }
         //判断用户是否已经登录过,登录过不再处理
         //判断用户是否已经登录过,登录过不再处理
         User userInfo=userService.getCurrentUser();
         User userInfo=userService.getCurrentUser();
+        //创建人
         depotHead.setCreator(userInfo==null?null:userInfo.getId());
         depotHead.setCreator(userInfo==null?null:userInfo.getId());
+        //创建时间
         depotHead.setCreateTime(new Timestamp(System.currentTimeMillis()));
         depotHead.setCreateTime(new Timestamp(System.currentTimeMillis()));
+        //订单状态
         if(StringUtil.isEmpty(depotHead.getStatus())) {
         if(StringUtil.isEmpty(depotHead.getStatus())) {
             depotHead.setStatus(BusinessConstants.BILLS_STATUS_UN_AUDIT);
             depotHead.setStatus(BusinessConstants.BILLS_STATUS_UN_AUDIT);
         }
         }
+        //采购状态
         depotHead.setPurchaseStatus(BusinessConstants.BILLS_STATUS_UN_AUDIT);
         depotHead.setPurchaseStatus(BusinessConstants.BILLS_STATUS_UN_AUDIT);
+        //付款类型
         depotHead.setPayType(depotHead.getPayType()==null?"现付":depotHead.getPayType());
         depotHead.setPayType(depotHead.getPayType()==null?"现付":depotHead.getPayType());
         if(StringUtil.isNotEmpty(depotHead.getAccountIdList())){
         if(StringUtil.isNotEmpty(depotHead.getAccountIdList())){
             depotHead.setAccountIdList(depotHead.getAccountIdList().replace("[", "").replace("]", "").replaceAll("\"", ""));
             depotHead.setAccountIdList(depotHead.getAccountIdList().replace("[", "").replace("]", "").replaceAll("\"", ""));
@@ -1198,6 +1207,7 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
             Long headId = list.get(0).getId();
             Long headId = list.get(0).getId();
             /**入库和出库处理单据子表信息*/
             /**入库和出库处理单据子表信息*/
             depotItemService.saveDetials(rows,headId, "add",request);
             depotItemService.saveDetials(rows,headId, "add",request);
+            //处理实际入库数量价格总额
             if (list.get(0).getSubType().equals("采购") || !list.get(0).getSubType().equals("销售")){
             if (list.get(0).getSubType().equals("采购") || !list.get(0).getSubType().equals("销售")){
                 updateTotalPriceById(list.get(0));
                 updateTotalPriceById(list.get(0));
             }
             }
@@ -1318,7 +1328,10 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
         }
         }
         /**入库和出库处理单据子表信息*/
         /**入库和出库处理单据子表信息*/
         depotItemService.saveDetials(rows,depotHead.getId(), "update",request);
         depotItemService.saveDetials(rows,depotHead.getId(), "update",request);
-        updateTotalPriceById(depotHead);
+        //处理实际入库数量价格总额
+        if (depotHead.getSubType().equals("采购") || depotHead.getSubType().equals("销售")){
+            updateTotalPriceById(depotHead);
+        }
         logService.insertLog("单据",
         logService.insertLog("单据",
                 new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(depotHead.getNumber()).toString(),
                 new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(depotHead.getNumber()).toString(),
                 ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
                 ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
@@ -1934,9 +1947,13 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
         }
         }
         //判断用户是否已经登录过,登录过不再处理
         //判断用户是否已经登录过,登录过不再处理
         User userInfo = userService.getCurrentUser();
         User userInfo = userService.getCurrentUser();
+        //创建人
         depotHead.setCreator(userInfo==null?null:userInfo.getId());
         depotHead.setCreator(userInfo==null?null:userInfo.getId());
+        //创建时间
         depotHead.setCreateTime(new Timestamp(System.currentTimeMillis()));
         depotHead.setCreateTime(new Timestamp(System.currentTimeMillis()));
+        //操作人
         depotHead.setOperId(userInfo==null?null:userInfo.getId());
         depotHead.setOperId(userInfo==null?null:userInfo.getId());
+        //单据时间
         depotHead.setOperTime(new Timestamp(System.currentTimeMillis()));
         depotHead.setOperTime(new Timestamp(System.currentTimeMillis()));
         if(StringUtil.isEmpty(depotHead.getStatus())) {
         if(StringUtil.isEmpty(depotHead.getStatus())) {
             depotHead.setStatus(BusinessConstants.BILLS_STATUS_UN_AUDIT);
             depotHead.setStatus(BusinessConstants.BILLS_STATUS_UN_AUDIT);
@@ -1979,8 +1996,6 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
         //设置凭证图片、备注
         //设置凭证图片、备注
         depotHead.setVoucherPicture(pdaDepotHeadDTO.getVoucherPicture());
         depotHead.setVoucherPicture(pdaDepotHeadDTO.getVoucherPicture());
         depotHead.setRemark(pdaDepotHeadDTO.getRemark());
         depotHead.setRemark(pdaDepotHeadDTO.getRemark());
-        User user = userService.getCurrentUser();
-        depotHead.setTenantId(user.getId());
         depotHead.setCreateTime(new Timestamp(System.currentTimeMillis()));
         depotHead.setCreateTime(new Timestamp(System.currentTimeMillis()));
         depotHead.setStatus("2");
         depotHead.setStatus("2");
         //添加主表
         //添加主表
@@ -2024,6 +2039,7 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
                     depotItem.setBasicNumber(oNumber); //其他情况
                     depotItem.setBasicNumber(oNumber); //其他情况
                 }
                 }
             }
             }
+            User user = userService.getCurrentUser();
             depotItem.setWarehousingUser(user.getId());
             depotItem.setWarehousingUser(user.getId());
             //基本单位数量*单价
             //基本单位数量*单价
             depotItem.setAllPrice(depotItem.getBasicNumber().multiply(depotItem.getUnitPrice()));
             depotItem.setAllPrice(depotItem.getBasicNumber().multiply(depotItem.getUnitPrice()));
@@ -2049,8 +2065,9 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
             //修改订单总额
             //修改订单总额
             updateTotalPriceById(depotHead);
             updateTotalPriceById(depotHead);
         }
         }
-        //修改采购订单状态完成
-        this.update(new UpdateWrapper<DepotHead>().set("status", "2").eq("id", pdaDepotHeadDTO.getId()));
+        //修改采购订单状态、操作人、操作时间
+        this.update(new UpdateWrapper<DepotHead>().set("status", "2").set("oper_id",userInfo.getId()).set("submit_time",new Date()).eq("id", pdaDepotHeadDTO.getId()));
+
         return true;
         return true;
     }
     }
 
 

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

@@ -257,16 +257,12 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
         return result;
         return result;
     }
     }
 
 
-    /**
-     * 插入单据子表
-     * @param depotItem 单据子表
-     */
     @Override
     @Override
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     public int insertDepotItemWithObj(DepotItem depotItem)throws Exception {
     public int insertDepotItemWithObj(DepotItem depotItem)throws Exception {
         User user = userService.getCurrentUser();
         User user = userService.getCurrentUser();
+        //创建时间
         depotItem.setCreateTime(new Date());
         depotItem.setCreateTime(new Date());
-        depotItem.setTenantId(user.getId());
         int result =0;
         int result =0;
         try{
         try{
             result = depotItemMapper.insertSelective(depotItem);
             result = depotItemMapper.insertSelective(depotItem);
@@ -493,6 +489,9 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                 JSONObject rowObj = JSONObject.parseObject(rowArr.getString(i));
                 JSONObject rowObj = JSONObject.parseObject(rowArr.getString(i));
                 depotItem.setHeaderId(headerId);
                 depotItem.setHeaderId(headerId);
                 String batchNumber = rowObj.getString("batchNumber");
                 String batchNumber = rowObj.getString("batchNumber");
+                if (batchNumber.isEmpty()){
+                    batchNumber = rowObj.getString("barCode");
+                }
                 MaterialExtend materialExtend = materialExtendService.getInfoByBatchNumber(batchNumber);
                 MaterialExtend materialExtend = materialExtendService.getInfoByBatchNumber(batchNumber);
                 if(materialExtend == null) {
                 if(materialExtend == null) {
                     throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_BARCODE_IS_NOT_EXIST_CODE,
                     throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_BARCODE_IS_NOT_EXIST_CODE,
@@ -794,7 +793,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                     materialExtend.setInventory(materialExtend.getInventory().add(depotItem.getBasicNumber()));
                     materialExtend.setInventory(materialExtend.getInventory().add(depotItem.getBasicNumber()));
                     materialExtendService.updateInventory("单据",depotItem.getId(),materialExtend);
                     materialExtendService.updateInventory("单据",depotItem.getId(),materialExtend);
                 }else if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
                 }else if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
-                    //表单库,修改商品库存
+                    //表单库,修改商品库存
                     materialExtend.setInventory(materialExtend.getInventory().subtract(depotItem.getBasicNumber()));
                     materialExtend.setInventory(materialExtend.getInventory().subtract(depotItem.getBasicNumber()));
                     materialExtendService.updateInventory("单据",depotItem.getId(),materialExtend);
                     materialExtendService.updateInventory("单据",depotItem.getId(),materialExtend);
                 }
                 }

+ 18 - 13
src/main/java/com/jsh/erp/service/impl/MaterialExtendServiceImpl.java

@@ -503,19 +503,24 @@ public class MaterialExtendServiceImpl extends ServiceImpl<MaterialExtendMapper,
     @Override
     @Override
     public synchronized void updateInventory(String type, Long id, MaterialExtend materialExtend) throws Exception {
     public synchronized void updateInventory(String type, Long id, MaterialExtend materialExtend) throws Exception {
         if (materialExtend.getInventory() != null){
         if (materialExtend.getInventory() != null){
-            User user = userService.getCurrentUser();
-            InventoryLog log = new InventoryLog();
-            log.setUpdateUser(user.getId());
-            log.setUpdateTime(new Date());
-            log.setMaterialId(materialExtend.getMaterialId());
-            log.setMaterialExtendId(materialExtend.getId());
-            log.setOriginalStock(materialExtendMapper.selectByPrimaryKey(materialExtend.getId()).getInventory().intValue());
-            Integer i = materialExtend.getInventory().intValue();
-            log.setCurrentStock(i);
-            log.setItemId(id);
-            log.setType(type);
-            inventoryLogService.save(log);
-            update(new UpdateWrapper<MaterialExtend>().set("inventory",materialExtend.getInventory()).set("position",materialExtend.getPosition()).eq("id",materialExtend.getId()));
+            //获取修改前库存
+            int originalStock = materialExtendMapper.selectByPrimaryKey(materialExtend.getId()).getInventory().intValue();
+            if (originalStock != materialExtend.getInventory().intValue()){
+                //库存不相同,修改库存
+                User user = userService.getCurrentUser();
+                InventoryLog log = new InventoryLog();
+                log.setUpdateUser(user.getId());
+                log.setUpdateTime(new Date());
+                log.setMaterialId(materialExtend.getMaterialId());
+                log.setMaterialExtendId(materialExtend.getId());
+                log.setOriginalStock(originalStock);
+                Integer i = materialExtend.getInventory().intValue();
+                log.setCurrentStock(i);
+                log.setItemId(id);
+                log.setType(type);
+                inventoryLogService.save(log);
+                update(new UpdateWrapper<MaterialExtend>().set("inventory",materialExtend.getInventory()).set("position",materialExtend.getPosition()).eq("id",materialExtend.getId()));
+            }
         }
         }
     }
     }
     /**
     /**

+ 5 - 8
src/main/java/com/jsh/erp/service/impl/MaterialServiceImpl.java

@@ -200,20 +200,17 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
                 JSONArray stockArr = obj.getJSONArray("stock");
                 JSONArray stockArr = obj.getJSONArray("stock");
                 for (int i = 0; i < stockArr.size(); i++) {
                 for (int i = 0; i < stockArr.size(); i++) {
                     JSONObject jsonObj = stockArr.getJSONObject(i);
                     JSONObject jsonObj = stockArr.getJSONObject(i);
-                    if(jsonObj.get("id")!=null && jsonObj.get("initStock")!=null) {
-                        String number = jsonObj.getString("initStock");
-                        BigDecimal lowSafeStock = null;
+                    //最低安全库存数量不为空
+                    if(jsonObj.get("id")!=null && jsonObj.get("lowSafeStock")!=null) {
+                        BigDecimal lowSafeStock = jsonObj.getBigDecimal("lowSafeStock");
                         BigDecimal highSafeStock = null;
                         BigDecimal highSafeStock = null;
-                        if(jsonObj.get("lowSafeStock")!=null) {
-                            lowSafeStock = jsonObj.getBigDecimal("lowSafeStock");
-                        }
                         if(jsonObj.get("highSafeStock")!=null) {
                         if(jsonObj.get("highSafeStock")!=null) {
                             highSafeStock = jsonObj.getBigDecimal("highSafeStock");
                             highSafeStock = jsonObj.getBigDecimal("highSafeStock");
                         }
                         }
                         Long depotId = jsonObj.getLong("id");
                         Long depotId = jsonObj.getLong("id");
-                        if(StringUtil.isNotEmpty(number) && Double.parseDouble(number)>0 || lowSafeStock!=null || highSafeStock!=null) {
+                        if(lowSafeStock!=null || highSafeStock!=null) {
                             //设置初始库
                             //设置初始库
-                            insertInitialStockByMaterialAndDepot(depotId, mId, parseBigDecimalEx(number), lowSafeStock, highSafeStock);
+                            insertInitialStockByMaterialAndDepot(depotId, mId, parseBigDecimalEx("0"), lowSafeStock, highSafeStock);
                             //设置当前库
                             //设置当前库
                             //insertCurrentStockByMaterialAndDepot(depotId, mId, parseBigDecimalEx(number));
                             //insertCurrentStockByMaterialAndDepot(depotId, mId, parseBigDecimalEx(number));
                             //更新当前库存
                             //更新当前库存

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

@@ -769,7 +769,7 @@
       AND dh.delete_flag = '0'
       AND dh.delete_flag = '0'
       AND ifnull(dh.status,'0') != '0'
       AND ifnull(dh.status,'0') != '0'
       <if test="number != null and number != ''">
       <if test="number != null and number != ''">
-        AND dh.number = #{number}
+        AND dh.number like CONCAT('%',#{number},'%')
       </if>
       </if>
       <if test="status != null and status != ''">
       <if test="status != null and status != ''">
         AND dh.status = #{status}
         AND dh.status = #{status}

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

@@ -184,7 +184,7 @@
     </select>
     </select>
 
 
     <select id="getMaterialCountListByHeaderIdList" resultType="com.jsh.erp.datasource.vo.MaterialCountVo">
     <select id="getMaterialCountListByHeaderIdList" resultType="com.jsh.erp.datasource.vo.MaterialCountVo">
-        select header_id, sum(oper_number) materialCount from jsh_depot_item
+        select header_id, IF(ifnull(actual_quantity_in_storage,0) > 0,sum(actual_quantity_in_storage),sum(oper_number)) materialCount from jsh_depot_item
         where 1=1
         where 1=1
         <if test="idList.size()>0">
         <if test="idList.size()>0">
             and header_id in
             and header_id in

+ 3 - 1
src/main/resources/mapper_xml/DepotItemMapperEx.xml

@@ -322,7 +322,8 @@
         select di.*,m.name MName,m.model MModel,m.color MColor,m.unit_id,m.standard MStandard,m.weight, m.img_name,
         select di.*,m.name MName,m.model MModel,m.color MColor,m.unit_id,m.standard MStandard,m.weight, m.img_name,
         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
         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'
@@ -330,6 +331,7 @@
         left join jsh_depot dp2 on di.another_depot_id=dp2.id and ifnull(dp2.delete_Flag,'0') !='1'
         left join jsh_depot dp2 on di.another_depot_id=dp2.id and ifnull(dp2.delete_Flag,'0') !='1'
         left JOIN jsh_supplier s on me.supplier_id = s.id and ifnull(s.delete_Flag,'0') !='1'
         left JOIN jsh_supplier s on me.supplier_id = s.id and ifnull(s.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'
+        left join jsh_user us on di.warehousing_user=us.id and ifnull(us.delete_Flag,'0') !='1'
         where di.header_id = #{headerId}
         where di.header_id = #{headerId}
         and ifnull(di.delete_flag,'0') !='1'
         and ifnull(di.delete_flag,'0') !='1'
         order by di.id asc
         order by di.id asc

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

@@ -862,7 +862,7 @@
         and me.id is not null
         and me.id is not null
         <if test="keyword != null and keyword !=''">
         <if test="keyword != null and keyword !=''">
             <bind name="bindKey" value="'%'+keyword+'%'"/>
             <bind name="bindKey" value="'%'+keyword+'%'"/>
-            and (me.batch_number like #{bindKey} or m.name like #{bindKey})
+            and (me.batch_number like #{bindKey} or m.name like #{bindKey} or me.bar_code like #{bindKey})
         </if>
         </if>
         <if test="position != null and position !=''">
         <if test="position != null and position !=''">
             <bind name="bindPosition" value="'%'+position+'%'"/>
             <bind name="bindPosition" value="'%'+position+'%'"/>