Browse Source

修改库存盘点功能

lwx_dev
erdanergou 3 years ago
parent
commit
c715399792
  1. 4
      src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java
  2. 4
      src/main/java/com/dreamchaser/depository_manage/entity/Inventory.java
  3. 10
      src/main/java/com/dreamchaser/depository_manage/mapper/PlaceMapper.java
  4. 2
      src/main/java/com/dreamchaser/depository_manage/mapper/PlaceMapper.xml
  5. 3
      src/main/java/com/dreamchaser/depository_manage/pojo/MaterialAndPlaceForViewP.java
  6. 6
      src/main/java/com/dreamchaser/depository_manage/service/MaterialService.java
  7. 10
      src/main/java/com/dreamchaser/depository_manage/service/PlaceService.java
  8. 4
      src/main/java/com/dreamchaser/depository_manage/service/impl/GroupServiceImpl.java
  9. 29
      src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java
  10. 10
      src/main/java/com/dreamchaser/depository_manage/service/impl/PlaceServiceImpl.java
  11. 625
      src/main/java/com/dreamchaser/depository_manage/service/impl/StockTakingServiceImpl.java
  12. 2
      target/classes/com/dreamchaser/depository_manage/mapper/PlaceMapper.xml

4
src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java

@ -82,7 +82,7 @@ public class MaterialController {
return new RestResponse(null); return new RestResponse(null);
} else { } else {
map.put("userTokenId", userToken.getId()); map.put("userTokenId", userToken.getId());
List<MaterialAndPlaceForView> inventoryForStockTaking = materialService.findInventoryForStockTaking(map); List<MaterialAndPlaceForViewP> inventoryForStockTaking = materialService.findInventoryForStockTaking(map);
return new RestResponse(inventoryForStockTaking, placeService.findPlaceAndMaterialCountByCondition(map), 200); return new RestResponse(inventoryForStockTaking, placeService.findPlaceAndMaterialCountByCondition(map), 200);
} }
} }
@ -1991,7 +1991,7 @@ public class MaterialController {
} }
} }
map.put("userTokenId",userToken.getId()); map.put("userTokenId",userToken.getId());
List<MaterialAndPlaceForView> materialAndPlaceForViews = materialService.findInventoryByMidAndDepository(map, depositoryIdList); List<MaterialAndPlaceForViewP> materialAndPlaceForViews = materialService.findInventoryByMidAndDepository(map, depositoryIdList);
Integer count = placeService.findPlaceAndMaterialCountByDidsAndMid(depositoryIdList, map); Integer count = placeService.findPlaceAndMaterialCountByDidsAndMid(depositoryIdList, map);
return new RestResponse(materialAndPlaceForViews,count,200); return new RestResponse(materialAndPlaceForViews,count,200);
}else{ }else{

4
src/main/java/com/dreamchaser/depository_manage/entity/Inventory.java

@ -1,6 +1,6 @@
package com.dreamchaser.depository_manage.entity; package com.dreamchaser.depository_manage.entity;
import com.dreamchaser.depository_manage.pojo.MaterialAndPlaceForView; import com.dreamchaser.depository_manage.pojo.MaterialAndPlaceForViewP;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
@ -161,7 +161,7 @@ public class Inventory {
public Inventory() { public Inventory() {
} }
public Inventory(MaterialAndPlaceForView mpv) { public Inventory(MaterialAndPlaceForViewP mpv) {
this.id = mpv.getIid(); this.id = mpv.getIid();
this.mid = mpv.getMid(); this.mid = mpv.getMid();
this.mname = mpv.getMname(); this.mname = mpv.getMname();

10
src/main/java/com/dreamchaser/depository_manage/mapper/PlaceMapper.java

@ -2,7 +2,7 @@ package com.dreamchaser.depository_manage.mapper;
import com.dreamchaser.depository_manage.entity.MaterialAndPlace; import com.dreamchaser.depository_manage.entity.MaterialAndPlace;
import com.dreamchaser.depository_manage.entity.Place; import com.dreamchaser.depository_manage.entity.Place;
import com.dreamchaser.depository_manage.pojo.MaterialAndPlaceForView; import com.dreamchaser.depository_manage.pojo.MaterialAndPlaceForViewP;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@ -141,21 +141,21 @@ public interface PlaceMapper {
* @param map 待查询条件 * @param map 待查询条件
* @return * @return
*/ */
List<MaterialAndPlaceForView> findPlaceAndMaterialByDidAndMid(Map<String,Object> map); List<MaterialAndPlaceForViewP> findPlaceAndMaterialByDidAndMid(Map<String,Object> map);
/** /**
* 根据仓库id及物料id获取对应库位存储的物料 * 根据仓库id及物料id获取对应库位存储的物料
* @param map 待查询条件 * @param map 待查询条件
* @return * @return
*/ */
List<MaterialAndPlaceForView> findPlaceAndMaterialByDidsAndMid(Map<String,Object> map); List<MaterialAndPlaceForViewP> findPlaceAndMaterialByDidsAndMid(Map<String,Object> map);
/** /**
* 根据主键获取物料与库位的对应关系的具体数据 * 根据主键获取物料与库位的对应关系的具体数据
* @param id 待查询id * @param id 待查询id
* @return * @return
*/ */
MaterialAndPlaceForView findPlaceAndMaterialForViewById(Integer id); MaterialAndPlaceForViewP findPlaceAndMaterialForViewById(Integer id);
/** /**
@ -170,7 +170,7 @@ public interface PlaceMapper {
* @param map 待查询条件 * @param map 待查询条件
* @return * @return
*/ */
List<MaterialAndPlaceForView> findPlaceAndMaterialByCondition(Map<String,Object> map); List<MaterialAndPlaceForViewP> findPlaceAndMaterialByCondition(Map<String,Object> map);
/** /**
* 根据条件获取对应库位存储的物料数量 * 根据条件获取对应库位存储的物料数量

2
src/main/java/com/dreamchaser/depository_manage/mapper/PlaceMapper.xml

@ -33,7 +33,7 @@
<result column="kingdeecode" property="kingdeecode" jdbcType="VARCHAR"/> <result column="kingdeecode" property="kingdeecode" jdbcType="VARCHAR"/>
</resultMap> </resultMap>
<resultMap id="MaterialAndPlaceForViewMap" type="com.dreamchaser.depository_manage.pojo.MaterialAndPlaceForView"> <resultMap id="MaterialAndPlaceForViewMap" type="com.dreamchaser.depository_manage.pojo.MaterialAndPlaceForViewP">
<id column="id" property="id" jdbcType="INTEGER"/> <id column="id" property="id" jdbcType="INTEGER"/>
<result column="mid" property="mid" jdbcType="INTEGER"/> <result column="mid" property="mid" jdbcType="INTEGER"/>
<result column="pid" property="pid" jdbcType="INTEGER"/> <result column="pid" property="pid" jdbcType="INTEGER"/>

3
src/main/java/com/dreamchaser/depository_manage/pojo/MaterialAndPlaceForView.java → src/main/java/com/dreamchaser/depository_manage/pojo/MaterialAndPlaceForViewP.java

@ -7,7 +7,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
@Data @Data
public class MaterialAndPlaceForView { public class MaterialAndPlaceForViewP {
/** /**
* 物料与库位映射关系id * 物料与库位映射关系id
*/ */
@ -126,5 +126,4 @@ public class MaterialAndPlaceForView {
*/ */
private Map<String,Double> splitInventory; private Map<String,Double> splitInventory;
} }

6
src/main/java/com/dreamchaser/depository_manage/service/MaterialService.java

@ -2,7 +2,7 @@ package com.dreamchaser.depository_manage.service;
import com.dreamchaser.depository_manage.entity.*; import com.dreamchaser.depository_manage.entity.*;
import com.dreamchaser.depository_manage.pojo.InventoryP; import com.dreamchaser.depository_manage.pojo.InventoryP;
import com.dreamchaser.depository_manage.pojo.MaterialAndPlaceForView; import com.dreamchaser.depository_manage.pojo.MaterialAndPlaceForViewP;
import com.dreamchaser.depository_manage.pojo.MaterialP; import com.dreamchaser.depository_manage.pojo.MaterialP;
import java.util.List; import java.util.List;
@ -156,7 +156,7 @@ public interface MaterialService {
* @param depositoryList 待查询的仓库 * @param depositoryList 待查询的仓库
* @return * @return
*/ */
List<MaterialAndPlaceForView> findInventoryByMidAndDepository(Map<String,Object> map, List<Integer> depositoryList); List<MaterialAndPlaceForViewP> findInventoryByMidAndDepository(Map<String,Object> map, List<Integer> depositoryList);
@ -429,5 +429,5 @@ public interface MaterialService {
* @param map 具体条件 * @param map 具体条件
* @return * @return
*/ */
List<MaterialAndPlaceForView> findInventoryForStockTaking(Map<String,Object> map); List<MaterialAndPlaceForViewP> findInventoryForStockTaking(Map<String,Object> map);
} }

10
src/main/java/com/dreamchaser/depository_manage/service/PlaceService.java

@ -3,7 +3,7 @@ package com.dreamchaser.depository_manage.service;
import com.dreamchaser.depository_manage.entity.MaterialAndPlace; import com.dreamchaser.depository_manage.entity.MaterialAndPlace;
import com.dreamchaser.depository_manage.entity.PidOrDidAndCode; import com.dreamchaser.depository_manage.entity.PidOrDidAndCode;
import com.dreamchaser.depository_manage.entity.Place; import com.dreamchaser.depository_manage.entity.Place;
import com.dreamchaser.depository_manage.pojo.MaterialAndPlaceForView; import com.dreamchaser.depository_manage.pojo.MaterialAndPlaceForViewP;
import com.dreamchaser.depository_manage.pojo.PlaceP; import com.dreamchaser.depository_manage.pojo.PlaceP;
import java.util.List; import java.util.List;
@ -122,7 +122,7 @@ public interface PlaceService {
* @param mid 物料id * @param mid 物料id
* @return * @return
*/ */
List<MaterialAndPlaceForView> findPlaceAndMaterialByDidAndMid(Integer did, Integer mid); List<MaterialAndPlaceForViewP> findPlaceAndMaterialByDidAndMid(Integer did, Integer mid);
/** /**
* 根据仓库id及物料id获取对应库位存储的物料 * 根据仓库id及物料id获取对应库位存储的物料
@ -130,7 +130,7 @@ public interface PlaceService {
* @param map 待查询的其他数据 * @param map 待查询的其他数据
* @return * @return
*/ */
List<MaterialAndPlaceForView> findPlaceAndMaterialByDidsAndMid(List<Integer> dids, Map<String,Object> map); List<MaterialAndPlaceForViewP> findPlaceAndMaterialByDidsAndMid(List<Integer> dids, Map<String,Object> map);
/** /**
* 根据仓库id及物料id获取对应库位存储的物料数量 * 根据仓库id及物料id获取对应库位存储的物料数量
@ -145,7 +145,7 @@ public interface PlaceService {
* @param map 待查询条件 * @param map 待查询条件
* @return * @return
*/ */
List<MaterialAndPlaceForView> findPlaceAndMaterialByCondition(Map<String,Object> map); List<MaterialAndPlaceForViewP> findPlaceAndMaterialByCondition(Map<String,Object> map);
/** /**
* 根据条件获取对应库位存储的物料数量 * 根据条件获取对应库位存储的物料数量
* @param map 待查询条件 * @param map 待查询条件
@ -171,7 +171,7 @@ public interface PlaceService {
* @param id 待查询id * @param id 待查询id
* @return * @return
*/ */
MaterialAndPlaceForView findPlaceAndMaterialForViewById(Integer id); MaterialAndPlaceForViewP findPlaceAndMaterialForViewById(Integer id);
/** /**

4
src/main/java/com/dreamchaser/depository_manage/service/impl/GroupServiceImpl.java

@ -1032,11 +1032,11 @@ public class GroupServiceImpl implements GroupService {
for (Integer depositoryId : depositoryIdList) { for (Integer depositoryId : depositoryIdList) {
paramForPlace.put("depositoryId", depositoryId); paramForPlace.put("depositoryId", depositoryId);
// 获取当前仓库中该物料与库位的对应关系 // 获取当前仓库中该物料与库位的对应关系
List<MaterialAndPlaceForView> materialAndPlaceForViews = placeMapper.findPlaceAndMaterialByDidAndMid(paramForPlace); List<MaterialAndPlaceForViewP> materialAndPlaceForViews = placeMapper.findPlaceAndMaterialByDidAndMid(paramForPlace);
// 定义标志位用于判断是否跳出循环 // 定义标志位用于判断是否跳出循环
boolean flag = false; boolean flag = false;
for (MaterialAndPlaceForView materialAndPlaceForView : for (MaterialAndPlaceForViewP materialAndPlaceForView :
materialAndPlaceForViews) { materialAndPlaceForViews) {
// 定义物料与库位的对应关系 // 定义物料与库位的对应关系
MaterialAndPlace mp = new MaterialAndPlace(); MaterialAndPlace mp = new MaterialAndPlace();

29
src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java

@ -6,15 +6,13 @@ import com.alibaba.fastjson.JSONObject;
import com.dreamchaser.depository_manage.entity.*; import com.dreamchaser.depository_manage.entity.*;
import com.dreamchaser.depository_manage.mapper.*; import com.dreamchaser.depository_manage.mapper.*;
import com.dreamchaser.depository_manage.pojo.InventoryP; import com.dreamchaser.depository_manage.pojo.InventoryP;
import com.dreamchaser.depository_manage.pojo.MaterialAndPlaceForView; import com.dreamchaser.depository_manage.pojo.MaterialAndPlaceForViewP;
import com.dreamchaser.depository_manage.pojo.MaterialP; import com.dreamchaser.depository_manage.pojo.MaterialP;
import com.dreamchaser.depository_manage.pojo.PlaceP; import com.dreamchaser.depository_manage.pojo.PlaceP;
import com.dreamchaser.depository_manage.service.*; import com.dreamchaser.depository_manage.service.*;
import com.dreamchaser.depository_manage.utils.DateUtil; import com.dreamchaser.depository_manage.utils.DateUtil;
import com.dreamchaser.depository_manage.utils.ObjectFormatUtil; import com.dreamchaser.depository_manage.utils.ObjectFormatUtil;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisOperations;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -537,8 +535,8 @@ public class MaterialServiceImpl implements MaterialService {
double quantity = 0; double quantity = 0;
// 获取该物料在该仓库下的映射关系 // 获取该物料在该仓库下的映射关系
List<MaterialAndPlaceForView> placeAndMaterialByDidAndMid = placeService.findPlaceAndMaterialByDidAndMid(depositoryId, groupInfo.getMid()); List<MaterialAndPlaceForViewP> placeAndMaterialByDidAndMid = placeService.findPlaceAndMaterialByDidAndMid(depositoryId, groupInfo.getMid());
for (MaterialAndPlaceForView materialAndPlaceForView : placeAndMaterialByDidAndMid) { for (MaterialAndPlaceForViewP materialAndPlaceForView : placeAndMaterialByDidAndMid) {
paramForSplitInventory.put("iid", materialAndPlaceForView.getId()); paramForSplitInventory.put("iid", materialAndPlaceForView.getId());
MaterialAndPlace materialAndPlace = new MaterialAndPlace(); MaterialAndPlace materialAndPlace = new MaterialAndPlace();
materialAndPlace.setQuantity((int)(materialAndPlaceForView.getInventory() / 100)); materialAndPlace.setQuantity((int)(materialAndPlaceForView.getInventory() / 100));
@ -563,15 +561,18 @@ public class MaterialServiceImpl implements MaterialService {
* @return * @return
*/ */
@Override @Override
public List<MaterialAndPlaceForView> findInventoryByMidAndDepository(Map<String, Object> map, List<Integer> depositoryList) { public List<MaterialAndPlaceForViewP> findInventoryByMidAndDepository(Map<String, Object> map, List<Integer> depositoryList) {
Integer mid = ObjectFormatUtil.toInteger(map.get("mid")); Integer mid = ObjectFormatUtil.toInteger(map.get("mid"));
// 获取当前物料的所有拆单记录 // 获取当前物料的所有拆单记录
List<SplitInfo> splitInfoList = splitUnitMapper.findSplitInfoByMid(mid); List<SplitInfo> splitInfoList = splitUnitMapper.findSplitInfoByMid(mid);
// 定义参数用于获取当前物料在仓库下的各库位记录 // 定义参数用于获取当前物料在仓库下的各库位记录
List<MaterialAndPlaceForView> placeAndMaterialByDidsAndMid = placeService.findPlaceAndMaterialByDidsAndMid(depositoryList, map); List<MaterialAndPlaceForViewP> placeAndMaterialByDidsAndMid = placeService.findPlaceAndMaterialByDidsAndMid(depositoryList, map);
if (placeAndMaterialByDidsAndMid.size() > 0) { if (placeAndMaterialByDidsAndMid.size() > 0) {
// 如果存在库存记录 // 如果存在库存记录
for (MaterialAndPlaceForViewP materialByDidsAndMid:placeAndMaterialByDidsAndMid
) {
materialByDidsAndMid.setInventory(materialByDidsAndMid.getInventory() / 100);
}
return packMpvList(placeAndMaterialByDidsAndMid, map); return packMpvList(placeAndMaterialByDidsAndMid, map);
} }
@ -2606,7 +2607,7 @@ public class MaterialServiceImpl implements MaterialService {
* @return * @return
*/ */
@Override @Override
public List<MaterialAndPlaceForView> findInventoryForStockTaking(Map<String, Object> map) { public List<MaterialAndPlaceForViewP> findInventoryForStockTaking(Map<String, Object> map) {
Integer size = 10, page = 1; Integer size = 10, page = 1;
if (map.containsKey("size")) { if (map.containsKey("size")) {
size = ObjectFormatUtil.toInteger(map.get("size")); size = ObjectFormatUtil.toInteger(map.get("size"));
@ -2620,13 +2621,17 @@ public class MaterialServiceImpl implements MaterialService {
if (Integer.compare(placeId, 0) == 0) { if (Integer.compare(placeId, 0) == 0) {
map.remove("placeId"); map.remove("placeId");
} }
List<MaterialAndPlaceForView> placeAndMaterialByCondition = placeService.findPlaceAndMaterialByCondition(map); List<MaterialAndPlaceForViewP> placeAndMaterialByCondition = placeService.findPlaceAndMaterialByCondition(map);
for (MaterialAndPlaceForViewP placeAndPlaceForViewP:placeAndMaterialByCondition
) {
placeAndPlaceForViewP.setInventory(placeAndPlaceForViewP.getInventory() / 100);
}
return packMpvList(placeAndMaterialByCondition, map); return packMpvList(placeAndMaterialByCondition, map);
} }
List<MaterialAndPlaceForView> packMpvList(List<MaterialAndPlaceForView> materialAndPlaceForViewList, Map<String, Object> map) { List<MaterialAndPlaceForViewP> packMpvList(List<MaterialAndPlaceForViewP> materialAndPlaceForViewList, Map<String, Object> map) {
for (MaterialAndPlaceForView mpv : materialAndPlaceForViewList for (MaterialAndPlaceForViewP mpv : materialAndPlaceForViewList
) { ) {
// 获取其对应的拆单记录 // 获取其对应的拆单记录
List<SplitInfo> list = splitUnitMapper.findSplitInfoByMid(mpv.getMid()); List<SplitInfo> list = splitUnitMapper.findSplitInfoByMid(mpv.getMid());

10
src/main/java/com/dreamchaser/depository_manage/service/impl/PlaceServiceImpl.java

@ -5,7 +5,7 @@ import com.dreamchaser.depository_manage.entity.*;
import com.dreamchaser.depository_manage.mapper.MaterialMapper; import com.dreamchaser.depository_manage.mapper.MaterialMapper;
import com.dreamchaser.depository_manage.mapper.PlaceMapper; import com.dreamchaser.depository_manage.mapper.PlaceMapper;
import com.dreamchaser.depository_manage.mapper.QrCodeMapper; import com.dreamchaser.depository_manage.mapper.QrCodeMapper;
import com.dreamchaser.depository_manage.pojo.MaterialAndPlaceForView; import com.dreamchaser.depository_manage.pojo.MaterialAndPlaceForViewP;
import com.dreamchaser.depository_manage.pojo.PlaceP; import com.dreamchaser.depository_manage.pojo.PlaceP;
import com.dreamchaser.depository_manage.service.DepositoryService; import com.dreamchaser.depository_manage.service.DepositoryService;
import com.dreamchaser.depository_manage.service.PlaceService; import com.dreamchaser.depository_manage.service.PlaceService;
@ -278,7 +278,7 @@ public class PlaceServiceImpl implements PlaceService {
* @return * @return
*/ */
@Override @Override
public List<MaterialAndPlaceForView> findPlaceAndMaterialByDidAndMid(Integer did, Integer mid) { public List<MaterialAndPlaceForViewP> findPlaceAndMaterialByDidAndMid(Integer did, Integer mid) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("depositoryId", did); map.put("depositoryId", did);
map.put("mid", mid); map.put("mid", mid);
@ -294,7 +294,7 @@ public class PlaceServiceImpl implements PlaceService {
* @return * @return
*/ */
@Override @Override
public List<MaterialAndPlaceForView> findPlaceAndMaterialByDidsAndMid(List<Integer> dids, Map<String, Object> map) { public List<MaterialAndPlaceForViewP> findPlaceAndMaterialByDidsAndMid(List<Integer> dids, Map<String, Object> map) {
Integer size = 10, page = 1; Integer size = 10, page = 1;
if (map.containsKey("size")) { if (map.containsKey("size")) {
size = ObjectFormatUtil.toInteger(map.get("size")); size = ObjectFormatUtil.toInteger(map.get("size"));
@ -322,7 +322,7 @@ public class PlaceServiceImpl implements PlaceService {
* @return * @return
*/ */
@Override @Override
public List<MaterialAndPlaceForView> findPlaceAndMaterialByCondition(Map<String, Object> map) { public List<MaterialAndPlaceForViewP> findPlaceAndMaterialByCondition(Map<String, Object> map) {
return placeMapper.findPlaceAndMaterialByCondition(map); return placeMapper.findPlaceAndMaterialByCondition(map);
} }
@ -358,7 +358,7 @@ public class PlaceServiceImpl implements PlaceService {
} }
@Override @Override
public MaterialAndPlaceForView findPlaceAndMaterialForViewById(Integer id) { public MaterialAndPlaceForViewP findPlaceAndMaterialForViewById(Integer id) {
return placeMapper.findPlaceAndMaterialForViewById(id); return placeMapper.findPlaceAndMaterialForViewById(id);
} }

625
src/main/java/com/dreamchaser/depository_manage/service/impl/StockTakingServiceImpl.java

File diff suppressed because it is too large

2
target/classes/com/dreamchaser/depository_manage/mapper/PlaceMapper.xml

@ -33,7 +33,7 @@
<result column="kingdeecode" property="kingdeecode" jdbcType="VARCHAR"/> <result column="kingdeecode" property="kingdeecode" jdbcType="VARCHAR"/>
</resultMap> </resultMap>
<resultMap id="MaterialAndPlaceForViewMap" type="com.dreamchaser.depository_manage.pojo.MaterialAndPlaceForView"> <resultMap id="MaterialAndPlaceForViewMap" type="com.dreamchaser.depository_manage.pojo.MaterialAndPlaceForViewP">
<id column="id" property="id" jdbcType="INTEGER"/> <id column="id" property="id" jdbcType="INTEGER"/>
<result column="mid" property="mid" jdbcType="INTEGER"/> <result column="mid" property="mid" jdbcType="INTEGER"/>
<result column="pid" property="pid" jdbcType="INTEGER"/> <result column="pid" property="pid" jdbcType="INTEGER"/>

Loading…
Cancel
Save