|
@@ -47,117 +47,206 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public List<WarehouseView> selectWarehouseViewinfo(String compId, String warehouseName) {
|
|
|
|
|
|
+ public List<WarehouseView> selectWarehouseViewinfo(String compId, String warehouseName,String warehouseType) {
|
|
List<WarehouseView> warehouseViews = new ArrayList<>();
|
|
List<WarehouseView> warehouseViews = new ArrayList<>();
|
|
Wrapper<WarehouseBaseInfo> warehouseBaseInfoWrapper = new EntityWrapper<>();
|
|
Wrapper<WarehouseBaseInfo> warehouseBaseInfoWrapper = new EntityWrapper<>();
|
|
- warehouseBaseInfoWrapper.eq("comp_id", compId).eq("delete_flag", "0").eq("show_flag", "1");
|
|
|
|
|
|
+ warehouseBaseInfoWrapper.eq("comp_id", compId).eq("delete_flag", "0").eq("show_flag", "1").eq("warehouse_type",warehouseType);;
|
|
if (!StringUtils.isEmpty(warehouseName)) {
|
|
if (!StringUtils.isEmpty(warehouseName)) {
|
|
warehouseBaseInfoWrapper.like("warehouse_name", "%" + warehouseName + "%");
|
|
warehouseBaseInfoWrapper.like("warehouse_name", "%" + warehouseName + "%");
|
|
}
|
|
}
|
|
// 查出所有仓库
|
|
// 查出所有仓库
|
|
List<WarehouseBaseInfo> warehouseBaseInfoList = this.selectList(warehouseBaseInfoWrapper);
|
|
List<WarehouseBaseInfo> warehouseBaseInfoList = this.selectList(warehouseBaseInfoWrapper);
|
|
- if (!CollectionUtils.isEmpty(warehouseBaseInfoList)) {
|
|
|
|
- for (WarehouseBaseInfo warehouseBaseInfo : warehouseBaseInfoList) {
|
|
|
|
- // 以库位为维度查询
|
|
|
|
- List<WarehousePositionInfo> warehousePositionInfos = warehousePositionInfoService.selectList(new EntityWrapper<WarehousePositionInfo>()
|
|
|
|
- .eq("base_id", warehouseBaseInfo.getId()));
|
|
|
|
- if (!CollectionUtils.isEmpty(warehousePositionInfos)) {
|
|
|
|
- for (WarehousePositionInfo warehousePositionInfo : warehousePositionInfos) {
|
|
|
|
- WarehouseView warehouseView = new WarehouseView();
|
|
|
|
- warehouseView.setWarehouseId(warehouseBaseInfo.getId());
|
|
|
|
- warehouseView.setWarehouseName(warehouseBaseInfo.getWarehouseName());
|
|
|
|
- warehouseView.setBinNumberId(warehousePositionInfo.getId());
|
|
|
|
- warehouseView.setBinNumber(warehousePositionInfo.getBinNumber());
|
|
|
|
- warehouseView.setCapacity(String.valueOf(warehousePositionInfo.getMaxStorage()));
|
|
|
|
- warehouseView.setRemark(warehousePositionInfo.getRemark());
|
|
|
|
- // 定义待完成数量
|
|
|
|
- int count = 0;
|
|
|
|
- // 定义应余量
|
|
|
|
- String storage = "";
|
|
|
|
- //定义入库
|
|
|
|
- String inNetWeight = "";
|
|
|
|
- // 子集合
|
|
|
|
- List<WarehouseNumView> warehouseNumViewList = new ArrayList<>();
|
|
|
|
- // 查询入库数量
|
|
|
|
- List<WarehouseInOutInfo> warehouseInOutInfoList = warehouseInOutInfoService.selectList(new EntityWrapper<WarehouseInOutInfo>()
|
|
|
|
- .eq("position_id", warehousePositionInfo.getId()).eq("status_flag", "3").eq("in_out_flag", "2").groupBy("goods_name_key").orderBy("goods_name_key"));
|
|
|
|
- if (!CollectionUtils.isEmpty(warehouseInOutInfoList)) {
|
|
|
|
- for (WarehouseInOutInfo warehouseInOutInfo : warehouseInOutInfoList) {
|
|
|
|
- WarehouseNumView warehouseNumView = new WarehouseNumView();
|
|
|
|
- // 查询入库数量
|
|
|
|
- List<WarehouseInOutInfo> warehouseInOutInfoAllList = warehouseInOutInfoService.selectList(new EntityWrapper<WarehouseInOutInfo>()
|
|
|
|
- .eq("position_id", warehousePositionInfo.getId()).eq("in_out_flag", "2")
|
|
|
|
- .eq("status_flag", "3").eq("goods_name_key", warehouseInOutInfo.getGoodsNameKey()));
|
|
|
|
-
|
|
|
|
- if (!CollectionUtils.isEmpty(warehouseInOutInfoAllList)) {
|
|
|
|
- Float netWeight = 0f;
|
|
|
|
- for (WarehouseInOutInfo warehouse : warehouseInOutInfoAllList) {
|
|
|
|
- netWeight = netWeight + warehouse.getNetWeight();
|
|
|
|
|
|
+ if (warehouseType.equals("1")) {
|
|
|
|
+ if (!CollectionUtils.isEmpty(warehouseBaseInfoList)) {
|
|
|
|
+ for (WarehouseBaseInfo warehouseBaseInfo : warehouseBaseInfoList) {
|
|
|
|
+ // 以库位为维度查询
|
|
|
|
+ List<WarehousePositionInfo> warehousePositionInfos = warehousePositionInfoService.selectList(new EntityWrapper<WarehousePositionInfo>()
|
|
|
|
+ .eq("base_id", warehouseBaseInfo.getId()));
|
|
|
|
+ if (!CollectionUtils.isEmpty(warehousePositionInfos)) {
|
|
|
|
+ for (WarehousePositionInfo warehousePositionInfo : warehousePositionInfos) {
|
|
|
|
+ WarehouseView warehouseView = new WarehouseView();
|
|
|
|
+ warehouseView.setWarehouseId(warehouseBaseInfo.getId());
|
|
|
|
+ warehouseView.setWarehouseName(warehouseBaseInfo.getWarehouseName());
|
|
|
|
+ warehouseView.setBinNumberId(warehousePositionInfo.getId());
|
|
|
|
+ warehouseView.setBinNumber(warehousePositionInfo.getBinNumber());
|
|
|
|
+ warehouseView.setCapacity(String.valueOf(warehousePositionInfo.getMaxStorage()));
|
|
|
|
+ warehouseView.setRemark(warehousePositionInfo.getRemark());
|
|
|
|
+ // 定义待完成数量
|
|
|
|
+ int count = 0;
|
|
|
|
+ // 定义应余量
|
|
|
|
+ String storage = "";
|
|
|
|
+ //定义入库
|
|
|
|
+ String inNetWeight = "";
|
|
|
|
+ // 子集合
|
|
|
|
+ List<WarehouseNumView> warehouseNumViewList = new ArrayList<>();
|
|
|
|
+ // 查询入库数量
|
|
|
|
+ List<WarehouseInOutInfo> warehouseInOutInfoList = warehouseInOutInfoService.selectList(new EntityWrapper<WarehouseInOutInfo>()
|
|
|
|
+ .eq("position_id", warehousePositionInfo.getId()).eq("status_flag","3").eq("in_out_flag", "2").groupBy("goods_name_key").orderBy("goods_name_key"));
|
|
|
|
+ if (!CollectionUtils.isEmpty(warehouseInOutInfoList)) {
|
|
|
|
+ for (WarehouseInOutInfo warehouseInOutInfo : warehouseInOutInfoList) {
|
|
|
|
+ WarehouseNumView warehouseNumView = new WarehouseNumView();
|
|
|
|
+ // 查询入库数量
|
|
|
|
+ List<WarehouseInOutInfo> warehouseInOutInfoAllList = warehouseInOutInfoService.selectList(new EntityWrapper<WarehouseInOutInfo>()
|
|
|
|
+ .eq("position_id", warehousePositionInfo.getId()).eq("in_out_flag", "2")
|
|
|
|
+ .eq("status_flag","3").eq("goods_name_key", warehouseInOutInfo.getGoodsNameKey()));
|
|
|
|
+
|
|
|
|
+ if (!CollectionUtils.isEmpty(warehouseInOutInfoAllList)) {
|
|
|
|
+ Float netWeight = 0f;
|
|
|
|
+ for (WarehouseInOutInfo warehouse : warehouseInOutInfoAllList) {
|
|
|
|
+ netWeight = netWeight + warehouse.getNetWeight();
|
|
|
|
+ }
|
|
|
|
+ warehouseNumView.setGoodsName(warehouseInOutInfoAllList.get(0).getGoodsName());
|
|
|
|
+ warehouseNumView.setInNetWeight(String.valueOf(netWeight));
|
|
|
|
+ if(StringUtils.isEmpty(inNetWeight)){
|
|
|
|
+ inNetWeight = "0";
|
|
|
|
+ }
|
|
|
|
+ inNetWeight = String.valueOf(Float.valueOf(inNetWeight) + netWeight);
|
|
}
|
|
}
|
|
- warehouseNumView.setGoodsName(warehouseInOutInfoAllList.get(0).getGoodsName());
|
|
|
|
- warehouseNumView.setInNetWeight(String.valueOf(netWeight));
|
|
|
|
- if (StringUtils.isEmpty(inNetWeight)) {
|
|
|
|
- inNetWeight = "0";
|
|
|
|
|
|
+ // 查询应余量
|
|
|
|
+ WarehousePositionStorageInfo warehousePositionStorageInfo = warehousePositionStorageInfoService.selectOne(new EntityWrapper<WarehousePositionStorageInfo>()
|
|
|
|
+ .eq("position_id", warehouseInOutInfo.getPositionId()).eq("goods_name_key", warehouseInOutInfo.getGoodsNameKey()));
|
|
|
|
+ if (warehousePositionStorageInfo!=null) {
|
|
|
|
+ storage = String.valueOf(warehousePositionStorageInfo.getStorage());
|
|
}
|
|
}
|
|
- inNetWeight = String.valueOf(Float.valueOf(inNetWeight) + netWeight);
|
|
|
|
|
|
+ else{
|
|
|
|
+ storage = "";
|
|
|
|
+ }
|
|
|
|
+ warehouseNumView.setStorage(storage);
|
|
|
|
+ warehouseNumViewList.add(warehouseNumView);
|
|
}
|
|
}
|
|
- // 查询应余量
|
|
|
|
- WarehousePositionStorageInfo warehousePositionStorageInfo = warehousePositionStorageInfoService.selectOne(new EntityWrapper<WarehousePositionStorageInfo>()
|
|
|
|
- .eq("position_id", warehouseInOutInfo.getPositionId()).eq("goods_name_key", warehouseInOutInfo.getGoodsNameKey()));
|
|
|
|
- if (warehousePositionStorageInfo != null) {
|
|
|
|
- storage = String.valueOf(warehousePositionStorageInfo.getStorage());
|
|
|
|
- } else {
|
|
|
|
- storage = "";
|
|
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //定义出库
|
|
|
|
+ String outNetWeight = "";
|
|
|
|
+ // 查询出库数量
|
|
|
|
+ List<WarehouseInOutInfo> warehouseInOutInfos = warehouseInOutInfoService.selectList(new EntityWrapper<WarehouseInOutInfo>()
|
|
|
|
+ .eq("position_id", warehousePositionInfo.getId()).eq("status_flag","3").eq("in_out_flag", "1").groupBy("goods_name_key").orderBy("goods_name_key"));
|
|
|
|
+ if (!CollectionUtils.isEmpty(warehouseInOutInfos)) {
|
|
|
|
+ for (WarehouseInOutInfo warehouseInOutInfo : warehouseInOutInfos) {
|
|
|
|
+ Float netWeight = 0f;
|
|
|
|
+ outNetWeight = "0";
|
|
|
|
+ List<WarehouseInOutInfo> warehouseInOutInfoAllList = warehouseInOutInfoService.selectList(new EntityWrapper<WarehouseInOutInfo>()
|
|
|
|
+ .eq("status_flag","3").eq("position_id", warehousePositionInfo.getId()).eq("in_out_flag", "1").eq("goods_name_key", warehouseInOutInfo.getGoodsNameKey()));
|
|
|
|
+ if (!CollectionUtils.isEmpty(warehouseInOutInfoAllList)) {
|
|
|
|
+ for (WarehouseInOutInfo warehouse : warehouseInOutInfoAllList) {
|
|
|
|
+ netWeight = netWeight + warehouse.getNetWeight();
|
|
|
|
+ }
|
|
|
|
+ if(StringUtils.isEmpty(outNetWeight)){
|
|
|
|
+ outNetWeight = "0";
|
|
|
|
+ }
|
|
|
|
+ outNetWeight = String.valueOf(Float.valueOf(outNetWeight) + netWeight);
|
|
|
|
+ }
|
|
|
|
+ for(WarehouseNumView warehouseNumView : warehouseNumViewList){
|
|
|
|
+ if(warehouseNumView.getGoodsName().equals(warehouseInOutInfo.getGoodsName())){
|
|
|
|
+ warehouseNumView.setOutNetWeight(outNetWeight);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- warehouseNumView.setStorage(storage);
|
|
|
|
- warehouseNumViewList.add(warehouseNumView);
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
+ // 查询入库数量
|
|
|
|
+ count = warehouseInOutInfoService.selectCount(new EntityWrapper<WarehouseInOutInfo>()
|
|
|
|
+ .eq("position_id", warehousePositionInfo.getId())
|
|
|
|
+ .eq("status_flag","1"));
|
|
|
|
+ warehouseView.setNumber(count);
|
|
|
|
+ warehouseView.setWarehouseNumViewList(warehouseNumViewList);
|
|
|
|
+ warehouseViews.add(warehouseView);
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ if (!CollectionUtils.isEmpty(warehouseBaseInfoList)) {
|
|
|
|
+ for (WarehouseBaseInfo warehouseBaseInfo : warehouseBaseInfoList) {
|
|
|
|
+ WarehouseView warehouseView = new WarehouseView();
|
|
|
|
+ warehouseView.setWarehouseId(warehouseBaseInfo.getId());
|
|
|
|
+ warehouseView.setWarehouseName(warehouseBaseInfo.getWarehouseName());
|
|
|
|
+ warehouseView.setAddress(warehouseBaseInfo.getWarehousePrivate()+warehouseBaseInfo.getWarehouseCity()+warehouseBaseInfo.getWarehouseArea()+warehouseBaseInfo.getDetailedAddress());
|
|
|
|
+ // 定义待完成数量
|
|
|
|
+ int count = 0;
|
|
|
|
+ // 定义应余量
|
|
|
|
+ String storage = "";
|
|
|
|
+ //定义入库
|
|
|
|
+ String inNetWeight = "";
|
|
|
|
+ // 子集合
|
|
|
|
+ List<WarehouseNumView> warehouseNumViewList = new ArrayList<>();
|
|
|
|
+ // 查询入库数量
|
|
|
|
+ List<WarehouseInOutInfo> warehouseInOutInfoList = warehouseInOutInfoService.selectList(new EntityWrapper<WarehouseInOutInfo>()
|
|
|
|
+ .eq("base_id", warehouseBaseInfo.getId()).eq("status_flag","3").eq("in_out_flag", "2").groupBy("goods_name_key").orderBy("goods_name_key"));
|
|
|
|
+ if (!CollectionUtils.isEmpty(warehouseInOutInfoList)) {
|
|
|
|
+ for (WarehouseInOutInfo warehouseInOutInfo : warehouseInOutInfoList) {
|
|
|
|
+ WarehouseNumView warehouseNumView = new WarehouseNumView();
|
|
|
|
+ // 查询入库数量
|
|
|
|
+ List<WarehouseInOutInfo> warehouseInOutInfoAllList = warehouseInOutInfoService.selectList(new EntityWrapper<WarehouseInOutInfo>()
|
|
|
|
+ .eq("base_id", warehouseBaseInfo.getId()).eq("in_out_flag", "2")
|
|
|
|
+ .eq("status_flag","3").eq("goods_name_key", warehouseInOutInfo.getGoodsNameKey()));
|
|
|
|
|
|
- //定义出库
|
|
|
|
- String outNetWeight = "";
|
|
|
|
- // 查询出库数量
|
|
|
|
- List<WarehouseInOutInfo> warehouseInOutInfos = warehouseInOutInfoService.selectList(new EntityWrapper<WarehouseInOutInfo>()
|
|
|
|
- .eq("position_id", warehousePositionInfo.getId()).eq("status_flag", "3").eq("in_out_flag", "1").groupBy("goods_name_key").orderBy("goods_name_key"));
|
|
|
|
- if (!CollectionUtils.isEmpty(warehouseInOutInfos)) {
|
|
|
|
- for (WarehouseInOutInfo warehouseInOutInfo : warehouseInOutInfos) {
|
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(warehouseInOutInfoAllList)) {
|
|
Float netWeight = 0f;
|
|
Float netWeight = 0f;
|
|
- outNetWeight = "0";
|
|
|
|
- List<WarehouseInOutInfo> warehouseInOutInfoAllList = warehouseInOutInfoService.selectList(new EntityWrapper<WarehouseInOutInfo>()
|
|
|
|
- .eq("status_flag", "3").eq("position_id", warehousePositionInfo.getId()).eq("in_out_flag", "1").eq("goods_name_key", warehouseInOutInfo.getGoodsNameKey()));
|
|
|
|
- if (!CollectionUtils.isEmpty(warehouseInOutInfoAllList)) {
|
|
|
|
- for (WarehouseInOutInfo warehouse : warehouseInOutInfoAllList) {
|
|
|
|
- netWeight = netWeight + warehouse.getNetWeight();
|
|
|
|
- }
|
|
|
|
- if (StringUtils.isEmpty(outNetWeight)) {
|
|
|
|
- outNetWeight = "0";
|
|
|
|
- }
|
|
|
|
- outNetWeight = String.valueOf(Float.valueOf(outNetWeight) + netWeight);
|
|
|
|
|
|
+ for (WarehouseInOutInfo warehouse : warehouseInOutInfoAllList) {
|
|
|
|
+ netWeight = netWeight + warehouse.getNetWeight();
|
|
}
|
|
}
|
|
- for (WarehouseNumView warehouseNumView : warehouseNumViewList) {
|
|
|
|
- if (warehouseNumView.getGoodsName().equals(warehouseInOutInfo.getGoodsName())) {
|
|
|
|
- warehouseNumView.setOutNetWeight(outNetWeight);
|
|
|
|
- }
|
|
|
|
|
|
+ warehouseNumView.setGoodsName(warehouseInOutInfoAllList.get(0).getGoodsName());
|
|
|
|
+ warehouseNumView.setInNetWeight(String.valueOf(netWeight));
|
|
|
|
+ if(StringUtils.isEmpty(inNetWeight)){
|
|
|
|
+ inNetWeight = "0";
|
|
|
|
+ }
|
|
|
|
+ inNetWeight = String.valueOf(Float.valueOf(inNetWeight) + netWeight);
|
|
|
|
+ }
|
|
|
|
+ warehouseNumViewList.add(warehouseNumView);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //定义出库
|
|
|
|
+ String outNetWeight = "";
|
|
|
|
+ // 查询出库数量
|
|
|
|
+ List<WarehouseInOutInfo> warehouseInOutInfos = warehouseInOutInfoService.selectList(new EntityWrapper<WarehouseInOutInfo>()
|
|
|
|
+ .eq("base_id", warehouseBaseInfo.getId()).eq("status_flag","3").eq("in_out_flag", "1").groupBy("goods_name_key").orderBy("goods_name_key"));
|
|
|
|
+ if (!CollectionUtils.isEmpty(warehouseInOutInfos)) {
|
|
|
|
+ for (WarehouseInOutInfo warehouseInOutInfo : warehouseInOutInfos) {
|
|
|
|
+ Float netWeight = 0f;
|
|
|
|
+ outNetWeight = "0";
|
|
|
|
+ List<WarehouseInOutInfo> warehouseInOutInfoAllList = warehouseInOutInfoService.selectList(new EntityWrapper<WarehouseInOutInfo>()
|
|
|
|
+ .eq("status_flag","3").eq("base_id", warehouseBaseInfo.getId()).eq("in_out_flag", "1").eq("goods_name_key", warehouseInOutInfo.getGoodsNameKey()));
|
|
|
|
+ if (!CollectionUtils.isEmpty(warehouseInOutInfoAllList)) {
|
|
|
|
+ for (WarehouseInOutInfo warehouse : warehouseInOutInfoAllList) {
|
|
|
|
+ netWeight = netWeight + warehouse.getNetWeight();
|
|
|
|
+ }
|
|
|
|
+ if(StringUtils.isEmpty(outNetWeight)){
|
|
|
|
+ outNetWeight = "0";
|
|
}
|
|
}
|
|
|
|
+ outNetWeight = String.valueOf(Float.valueOf(outNetWeight) + netWeight);
|
|
}
|
|
}
|
|
|
|
+ for(WarehouseNumView warehouseNumView : warehouseNumViewList){
|
|
|
|
+ if(warehouseNumView.getGoodsName().equals(warehouseInOutInfo.getGoodsName())){
|
|
|
|
+ warehouseNumView.setOutNetWeight(outNetWeight);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- // 查询入库数量
|
|
|
|
- count = warehouseInOutInfoService.selectCount(new EntityWrapper<WarehouseInOutInfo>()
|
|
|
|
- .eq("position_id", warehousePositionInfo.getId())
|
|
|
|
- .eq("status_flag", "1"));
|
|
|
|
- warehouseView.setNumber(count);
|
|
|
|
- warehouseView.setWarehouseNumViewList(warehouseNumViewList);
|
|
|
|
- warehouseViews.add(warehouseView);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+ // 查询入库数量
|
|
|
|
+ count = warehouseInOutInfoService.selectCount(new EntityWrapper<WarehouseInOutInfo>()
|
|
|
|
+ .eq("base_id", warehouseBaseInfo.getId())
|
|
|
|
+ .eq("status_flag","1"));
|
|
|
|
+ warehouseView.setNumber(count);
|
|
|
|
+ warehouseView.setWarehouseNumViewList(warehouseNumViewList);
|
|
|
|
+ warehouseViews.add(warehouseView);
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
return warehouseViews;
|
|
return warehouseViews;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -223,17 +312,20 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
|
|
@Override
|
|
@Override
|
|
public String editWarehouse(WarehouseBaseInfo warehouseBaseInfo) {
|
|
public String editWarehouse(WarehouseBaseInfo warehouseBaseInfo) {
|
|
this.updateById(warehouseBaseInfo);
|
|
this.updateById(warehouseBaseInfo);
|
|
- List<WarehousePositionInfo> warehousePositionInfoList = warehouseBaseInfo.getWarehousePositionInfoList();
|
|
|
|
- if (!CollectionUtils.isEmpty(warehousePositionInfoList)) {
|
|
|
|
- warehousePositionInfoList.forEach(warehousePositionInfo -> {
|
|
|
|
- if (StringUtils.isEmpty(warehousePositionInfo.getId())) {
|
|
|
|
- warehousePositionInfo.setId(IdGenerator.generateUUID());
|
|
|
|
- warehousePositionInfo.setBaseId(warehouseBaseInfo.getId());
|
|
|
|
- warehousePositionInfoService.insert(warehousePositionInfo);
|
|
|
|
- } else {
|
|
|
|
- warehousePositionInfoService.updateById(warehousePositionInfo);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+ if (warehouseBaseInfo.getWarehouseType().equals("1")){
|
|
|
|
+ List<WarehousePositionInfo> warehousePositionInfoList = warehouseBaseInfo.getWarehousePositionInfoList();
|
|
|
|
+ if (!CollectionUtils.isEmpty(warehousePositionInfoList)){
|
|
|
|
+ warehousePositionInfoList.forEach(warehousePositionInfo -> {
|
|
|
|
+ if(StringUtils.isEmpty(warehousePositionInfo.getId())){
|
|
|
|
+ warehousePositionInfo.setId(IdGenerator.generateUUID());
|
|
|
|
+ warehousePositionInfo.setBaseId(warehouseBaseInfo.getId());
|
|
|
|
+ warehousePositionInfoService.insert(warehousePositionInfo);
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ warehousePositionInfoService.updateById(warehousePositionInfo);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return warehouseBaseInfo.getId();
|
|
return warehouseBaseInfo.getId();
|
|
}
|
|
}
|
|
@@ -244,9 +336,9 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public List<WarehouseBaseInfo> selectWarehouse(String compId) {
|
|
|
|
|
|
+ public List<WarehouseBaseInfo> selectWarehouse(String compId,String warehouseType) {
|
|
List<WarehouseBaseInfo> warehouseBaseInfoList = this.selectList(new EntityWrapper<WarehouseBaseInfo>()
|
|
List<WarehouseBaseInfo> warehouseBaseInfoList = this.selectList(new EntityWrapper<WarehouseBaseInfo>()
|
|
- .eq("comp_id", compId).eq("delete_flag", "0"));
|
|
|
|
|
|
+ .eq("comp_id", compId).eq("warehouse_type", warehouseType).eq("delete_flag", "0"));
|
|
return warehouseBaseInfoList;
|
|
return warehouseBaseInfoList;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -342,26 +434,29 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
|
|
//查询仓库信息
|
|
//查询仓库信息
|
|
WarehouseBaseInfo warehouseBaseInfo = this.selectById(id);
|
|
WarehouseBaseInfo warehouseBaseInfo = this.selectById(id);
|
|
this.deleteById(warehouseBaseInfo.getId());
|
|
this.deleteById(warehouseBaseInfo.getId());
|
|
- //查询仓位信息
|
|
|
|
- List<WarehousePositionInfo> warehousePositionInfos = warehousePositionInfoService.selectList(new EntityWrapper<WarehousePositionInfo>()
|
|
|
|
- .eq("base_id", warehouseBaseInfo.getId()));
|
|
|
|
- if (!CollectionUtils.isEmpty(warehousePositionInfos)) {
|
|
|
|
- for (WarehousePositionInfo warehousePositionInfo : warehousePositionInfos) {
|
|
|
|
- warehousePositionInfoService.deleteById(warehousePositionInfo.getId());
|
|
|
|
- //查询仓位存储量
|
|
|
|
- List<WarehousePositionStorageInfo> warehousePositionStorageInfos = warehousePositionStorageInfoService.selectList(new EntityWrapper<WarehousePositionStorageInfo>()
|
|
|
|
- .eq("position_id", warehousePositionInfo.getId()));
|
|
|
|
- if (!CollectionUtils.isEmpty(warehousePositionStorageInfos)) {
|
|
|
|
- for (WarehousePositionStorageInfo warehousePositionStorageInfo : warehousePositionStorageInfos) {
|
|
|
|
- //判断是否有剩余库存
|
|
|
|
- if (warehousePositionStorageInfo.getStorage() > 0) {
|
|
|
|
- throw new YException(YExceptionEnum.WAREHOSE_SYSTEM_ERROR);
|
|
|
|
- } else {
|
|
|
|
- warehousePositionStorageInfoService.deleteById(warehousePositionStorageInfo.getId());
|
|
|
|
|
|
+ if(warehouseBaseInfo.getWarehouseType().equals("1")){
|
|
|
|
+ //查询仓位信息
|
|
|
|
+ List<WarehousePositionInfo> warehousePositionInfos = warehousePositionInfoService.selectList(new EntityWrapper<WarehousePositionInfo>()
|
|
|
|
+ .eq("base_id", warehouseBaseInfo.getId()));
|
|
|
|
+ if (!CollectionUtils.isEmpty(warehousePositionInfos)) {
|
|
|
|
+ for (WarehousePositionInfo warehousePositionInfo : warehousePositionInfos) {
|
|
|
|
+ warehousePositionInfoService.deleteById(warehousePositionInfo.getId());
|
|
|
|
+ //查询仓位存储量
|
|
|
|
+ List<WarehousePositionStorageInfo> warehousePositionStorageInfos = warehousePositionStorageInfoService.selectList(new EntityWrapper<WarehousePositionStorageInfo>()
|
|
|
|
+ .eq("position_id", warehousePositionInfo.getId()));
|
|
|
|
+ if (!CollectionUtils.isEmpty(warehousePositionStorageInfos)) {
|
|
|
|
+ for (WarehousePositionStorageInfo warehousePositionStorageInfo : warehousePositionStorageInfos) {
|
|
|
|
+ //判断是否有剩余库存
|
|
|
|
+ if (warehousePositionStorageInfo.getStorage() > 0) {
|
|
|
|
+ throw new YException(YExceptionEnum.WAREHOSE_SYSTEM_ERROR);
|
|
|
|
+ } else {
|
|
|
|
+ warehousePositionStorageInfoService.deleteById(warehousePositionStorageInfo.getId());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|