|
@@ -75,18 +75,245 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public List<WarehouseView> selectWarehouseViewinfo(String compId, String warehouseName, String warehouseType) {
|
|
|
+ if(compId == null || compId.isEmpty()){
|
|
|
+ compId=AuthSecurityUtils.getStaffById(AuthSecurityUtils.getCurrentUserId()).getCompId();
|
|
|
+ }
|
|
|
+ String personCharge = AuthSecurityUtils.getStaffById(AuthSecurityUtils.getCurrentUserId()).getStaffMobilePhone();
|
|
|
+
|
|
|
List<WarehouseView> warehouseViews = new ArrayList<>();
|
|
|
Wrapper<WarehouseBaseInfo> warehouseBaseInfoWrapper = new EntityWrapper<>();
|
|
|
+ Wrapper<WarehouseBaseInfo> wrapper = new EntityWrapper<>();
|
|
|
warehouseBaseInfoWrapper.eq(WarehouseBaseInfo.QueryFiles.COMP_ID, compId)
|
|
|
.eq(WarehouseBaseInfo.QueryFiles.DELETE_FLAG, NumberConstant.CONSTANT0)
|
|
|
- .eq(WarehouseBaseInfo.QueryFiles.SHOW_FLAG, NumberConstant.CONSTANT1).eq(WarehouseBaseInfo.QueryFiles.WAREHOUSE_TYPE, warehouseType);
|
|
|
+ .eq(WarehouseBaseInfo.QueryFiles.SHOW_FLAG, NumberConstant.CONSTANT1);
|
|
|
+ wrapper.eq(WarehouseBaseInfo.QueryFiles.COMP_ID, compId)
|
|
|
+ .eq(WarehouseBaseInfo.QueryFiles.DELETE_FLAG, NumberConstant.CONSTANT0)
|
|
|
+ .eq(WarehouseBaseInfo.QueryFiles.SHOW_FLAG, NumberConstant.CONSTANT1);
|
|
|
if (!StringUtils.isEmpty(warehouseName)) {
|
|
|
warehouseBaseInfoWrapper.like(WarehouseBaseInfo.QueryFiles.WAREHOUSE_NAME, "%" + warehouseName + "%");
|
|
|
+ wrapper.like(WarehouseBaseInfo.QueryFiles.WAREHOUSE_NAME, "%" + warehouseName + "%");
|
|
|
}
|
|
|
- // 查出所有仓库
|
|
|
- List<WarehouseBaseInfo> warehouseBaseInfoList = this.selectList(warehouseBaseInfoWrapper);
|
|
|
- if (NumberConstant.CONSTANT1.equals(warehouseType)) {
|
|
|
+ if(!StringUtils.isEmpty(warehouseType)){
|
|
|
+ if(!personCharge.equals("13333333333")){
|
|
|
+ warehouseBaseInfoWrapper.andNew().eq("person_phone", personCharge).or()
|
|
|
+ .like("other_person_charge", personCharge);
|
|
|
+
|
|
|
+ }
|
|
|
+ warehouseBaseInfoWrapper.eq(WarehouseBaseInfo.QueryFiles.WAREHOUSE_TYPE, warehouseType);
|
|
|
+ // 查出所有仓库
|
|
|
+ List<WarehouseBaseInfo> warehouseBaseInfoList = this.selectList(warehouseBaseInfoWrapper);
|
|
|
+ if (NumberConstant.CONSTANT1.equals(warehouseType)) {
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ // 查询应余量
|
|
|
+ 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 = "";
|
|
|
+ }
|
|
|
+ warehouseNumView.setStorage(storage);
|
|
|
+ warehouseNumViewList.add(warehouseNumView);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //定义出库
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ // 查询入库数量
|
|
|
+ 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.setCreateType(warehouseBaseInfo.getCreateType());
|
|
|
+ warehouseView.setClearStatus(warehouseBaseInfo.getClearStatus());
|
|
|
+ warehouseView.setClearStatusFlag(warehouseBaseInfo.getClearStatusFlag());
|
|
|
+ warehouseView.setWarehouseName(warehouseBaseInfo.getWarehouseName());
|
|
|
+ warehouseView.setUpdateDate(warehouseBaseInfo.getUpdateDate());
|
|
|
+ warehouseView.setAddress(warehouseBaseInfo.getWarehousePrivate() + warehouseBaseInfo.getWarehouseCity() + warehouseBaseInfo.getWarehouseArea() + warehouseBaseInfo.getDetailedAddress());
|
|
|
+ // 定义待完成数量
|
|
|
+ int count = 0;
|
|
|
+ //定义入库
|
|
|
+ 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()));
|
|
|
+
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ 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("base_id", warehouseBaseInfo.getId())
|
|
|
+ .eq("status_flag", "1"));
|
|
|
+ warehouseView.setNumber(count);
|
|
|
+ // 定义待完成数量
|
|
|
+ int outCount = 0;
|
|
|
+ outCount = warehouseInOutInfoService.selectCount(new EntityWrapper<WarehouseInOutInfo>()
|
|
|
+ .eq("base_id", warehouseBaseInfo.getId())
|
|
|
+ .eq("in_out_flag", "1")
|
|
|
+ .eq("status_flag", "1"));
|
|
|
+ warehouseView.setOutNumber(outCount);
|
|
|
+ warehouseView.setWarehouseNumViewList(warehouseNumViewList);
|
|
|
+ warehouseViews.add(warehouseView);
|
|
|
+ // 排序
|
|
|
+ Comparator<WarehouseView> byClearStatusFlag = Comparator.comparing(WarehouseView::getClearStatusFlag);
|
|
|
+ Comparator<WarehouseView> byUpdateDate = Comparator.comparing(WarehouseView::getUpdateDate);
|
|
|
+ warehouseViews.sort(byClearStatusFlag.thenComparing(byUpdateDate));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ if(!personCharge.equals("13333333333")){
|
|
|
+ warehouseBaseInfoWrapper.andNew().eq("person_phone", personCharge).or()
|
|
|
+ .like("other_person_charge", personCharge);
|
|
|
+ wrapper.andNew().eq("person_phone", personCharge).or()
|
|
|
+ .like("other_person_charge", personCharge);
|
|
|
+ }
|
|
|
+ warehouseBaseInfoWrapper.eq(WarehouseBaseInfo.QueryFiles.WAREHOUSE_TYPE, "1");
|
|
|
+ // 查出常用仓库
|
|
|
+ List<WarehouseBaseInfo> warehouseBaseInfoList = this.selectList(warehouseBaseInfoWrapper);
|
|
|
if (!CollectionUtils.isEmpty(warehouseBaseInfoList)) {
|
|
|
for (WarehouseBaseInfo warehouseBaseInfo : warehouseBaseInfoList) {
|
|
|
// 以库位为维度查询
|
|
@@ -188,8 +415,9 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-
|
|
|
- } else {
|
|
|
+ // 查出临时仓库
|
|
|
+ wrapper.eq(WarehouseBaseInfo.QueryFiles.WAREHOUSE_TYPE, "2");
|
|
|
+ warehouseBaseInfoList = this.selectList(wrapper);
|
|
|
if (!CollectionUtils.isEmpty(warehouseBaseInfoList)) {
|
|
|
for (WarehouseBaseInfo warehouseBaseInfo : warehouseBaseInfoList) {
|
|
|
WarehouseView warehouseView = new WarehouseView();
|
|
@@ -278,15 +506,15 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
|
|
|
warehouseView.setWarehouseNumViewList(warehouseNumViewList);
|
|
|
warehouseViews.add(warehouseView);
|
|
|
// 排序
|
|
|
- Comparator<WarehouseView> byClearStatusFlag = Comparator.comparing(WarehouseView::getClearStatusFlag);
|
|
|
- Comparator<WarehouseView> byUpdateDate = Comparator.comparing(WarehouseView::getUpdateDate);
|
|
|
- warehouseViews.sort(byClearStatusFlag.thenComparing(byUpdateDate));
|
|
|
+// Comparator<WarehouseView> byClearStatusFlag = Comparator.comparing(WarehouseView::getClearStatusFlag);
|
|
|
+// Comparator<WarehouseView> byUpdateDate = Comparator.comparing(WarehouseView::getUpdateDate);
|
|
|
+// warehouseViews.sort(byUpdateDate);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
return warehouseViews;
|
|
|
}
|
|
|
|