Browse Source

1.库内作业逻辑优化

training
zhenghaoyu 1 year ago
parent
commit
c11b671344
  1. 4
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayGoodsMapper.xml
  2. 109
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java
  3. 8
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownGoodsServiceImpl.java
  4. 33
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownTypeServiceImpl.java

4
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayGoodsMapper.xml

@ -18,7 +18,7 @@
</select> </select>
<select id="getUpListByTrayTypeId" resultType="com.logpm.warehouse.vo.UpShelfDataVO"> <select id="getUpListByTrayTypeId" resultType="com.logpm.warehouse.vo.UpShelfDataVO">
select ldsa.order_code orderCode, select ldpl.order_code orderCode,
lwtg.tray_code trayCode, lwtg.tray_code trayCode,
1 goodsType, 1 goodsType,
sum(lwtg.num) shelfNum sum(lwtg.num) shelfNum
@ -27,7 +27,7 @@
where 1=1 where 1=1
and lwtg.is_deleted = 0 and lwtg.is_deleted = 0
and lwtg.tray_type_id = #{trayTypeId} and lwtg.tray_type_id = #{trayTypeId}
group by ldsa.order_code, group by ldpl.order_code,
lwtg.tray_code lwtg.tray_code
</select> </select>

109
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java

@ -19,14 +19,11 @@ import com.logpm.warehouse.dto.ZeroOrderVO;
import com.logpm.warehouse.entity.WarehouseTrayGoodsEntity; import com.logpm.warehouse.entity.WarehouseTrayGoodsEntity;
import com.logpm.warehouse.entity.WarehouseTrayGoodsLogEntity; import com.logpm.warehouse.entity.WarehouseTrayGoodsLogEntity;
import com.logpm.warehouse.entity.WarehouseTrayTypeEntity; import com.logpm.warehouse.entity.WarehouseTrayTypeEntity;
import com.logpm.warehouse.entity.WarehouseUpdownGoodsEntity;
import com.logpm.warehouse.mapper.WarehouseTrayTypeMapper; import com.logpm.warehouse.mapper.WarehouseTrayTypeMapper;
import com.logpm.warehouse.service.IWarehouseTaryAllocationService; import com.logpm.warehouse.service.*;
import com.logpm.warehouse.service.IWarehouseTrayGoodsLogService;
import com.logpm.warehouse.service.IWarehouseTrayGoodsService;
import com.logpm.warehouse.service.IWarehouseTrayTypeService;
import com.logpm.warehouse.vo.*; import com.logpm.warehouse.vo.*;
import com.logpm.warehouse.wrapper.WarehouseTrayTypeWrapper; import com.logpm.warehouse.wrapper.WarehouseTrayTypeWrapper;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.springblade.common.constant.DictBizConstant; import org.springblade.common.constant.DictBizConstant;
import org.springblade.common.constant.apiwarehouse.PalletProductTypeConstant; import org.springblade.common.constant.apiwarehouse.PalletProductTypeConstant;
@ -35,6 +32,8 @@ import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.system.cache.DictBizCache; import org.springblade.system.cache.DictBizCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -45,24 +44,27 @@ import java.util.Objects;
@Log4j2 @Log4j2
@Service @Service
@AllArgsConstructor
public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayTypeMapper, WarehouseTrayTypeEntity> implements IWarehouseTrayTypeService { public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayTypeMapper, WarehouseTrayTypeEntity> implements IWarehouseTrayTypeService {
private final IWarehouseTrayGoodsService warehouseTrayGoodsService; @Autowired
private IWarehouseTrayGoodsService warehouseTrayGoodsService;
private final IDistributionStockArticleClient distributionStockArticleClient; @Autowired
private IDistributionStockArticleClient distributionStockArticleClient;
private final IDistributionParcelListClient distributionParcelListClient; @Autowired
private IDistributionParcelListClient distributionParcelListClient;
private final IBasicMaterialClient basicMaterialClient; @Autowired
private IBasicMaterialClient basicMaterialClient;
private final IDistributionStockListClient distributionStockListClient; @Autowired
private IDistributionStockListClient distributionStockListClient;
private final IBasicdataTrayClient basicdataTrayClient; @Autowired
private IBasicdataTrayClient basicdataTrayClient;
private final IWarehouseTrayGoodsLogService warehouseTrayGoodsLogService; @Autowired
private IWarehouseTrayGoodsLogService warehouseTrayGoodsLogService;
private final IWarehouseTaryAllocationService warehouseTaryAllocationService; @Autowired
private IWarehouseTaryAllocationService warehouseTaryAllocationService;
@Autowired
@Lazy
private IWarehouseUpdownGoodsService warehouseUpdownGoodsService;
@Override @Override
public IPage<WarehouseTrayTypeVO> orderPageList(TrayTypeDTO trayTypeDTO) { public IPage<WarehouseTrayTypeVO> orderPageList(TrayTypeDTO trayTypeDTO) {
@ -107,6 +109,13 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
log.warn("###############getEntityByTrayCode: 该托盘已被禁用 trayCode={}",trayCode); log.warn("###############getEntityByTrayCode: 该托盘已被禁用 trayCode={}",trayCode);
throw new CustomerException(403,"该托盘已被禁用"); throw new CustomerException(403,"该托盘已被禁用");
} }
Long trayId = basicdataTrayEntity.getId();
Long allocationId = warehouseTaryAllocationService.getAllocationIdByTrayId(trayId);
if(!Objects.isNull(allocationId)){
log.warn("###############getEntityByTrayCode: 托盘已上架 allocationId={}",allocationId);
throw new CustomerException(403,"托盘已上架");
}
//根据托盘编码查询是否有托盘编码存在打托数据 //根据托盘编码查询是否有托盘编码存在打托数据
QueryWrapper<WarehouseTrayTypeEntity> queryTrayTypeWrapper = new QueryWrapper<>(); QueryWrapper<WarehouseTrayTypeEntity> queryTrayTypeWrapper = new QueryWrapper<>();
queryTrayTypeWrapper.eq("tray_code",trayCode) queryTrayTypeWrapper.eq("tray_code",trayCode)
@ -167,6 +176,14 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
qw.eq("association_value",orderPackageCode); qw.eq("association_value",orderPackageCode);
WarehouseTrayGoodsEntity trayGoodsEntity = warehouseTrayGoodsService.getOne(qw); WarehouseTrayGoodsEntity trayGoodsEntity = warehouseTrayGoodsService.getOne(qw);
QueryWrapper<WarehouseUpdownGoodsEntity> updownGoodsEntityQueryWrapper = new QueryWrapper<>();
updownGoodsEntityQueryWrapper.eq("association_value",orderPackageCode);
WarehouseUpdownGoodsEntity updownGoodsEntity = warehouseUpdownGoodsService.getOne(updownGoodsEntityQueryWrapper);
if(!Objects.isNull(updownGoodsEntity)){
log.warn("#########orderScanOrderPackageCode: 包件已上架 orderPackageCode={}",orderPackageCode);
return R.fail(403,"包件已上架");
}
BasicdataTrayEntity basicdataTrayEntity = basicdataTrayClient.getTrayByTrayCode(trayCode); BasicdataTrayEntity basicdataTrayEntity = basicdataTrayClient.getTrayByTrayCode(trayCode);
if(Objects.isNull(basicdataTrayEntity)){ if(Objects.isNull(basicdataTrayEntity)){
log.warn("#########orderScanOrderPackageCode: 未找到托盘信息 trayCode={}",trayCode); log.warn("#########orderScanOrderPackageCode: 未找到托盘信息 trayCode={}",trayCode);
@ -482,9 +499,46 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
@Override @Override
public List<TrayTypeDataListVO> getZeroOrderByWaybillCode(String waybillCode) { public List<TrayTypeDataListVO> getZeroOrderByWaybillCode(String waybillCode) {
// List<TrayTypeDataListVO> zeroOrderByWaybillCode = baseMapper.getZeroOrderByWaybillCode(waybillCode);
// for (TrayTypeDataListVO trayTypeDataListVO:zeroOrderByWaybillCode){
//
// String ordeCode = trayTypeDataListVO.getDataCode();
// Long orderId = trayTypeDataListVO.getDataId();
// //计算零担订单可用数量
// countZeroAvailableNum(orderId);
//
// }
return baseMapper.getZeroOrderByWaybillCode(waybillCode); return baseMapper.getZeroOrderByWaybillCode(waybillCode);
} }
/**
* 计算零担订单的可用数量
* @param orderId
* @return
*/
private Integer countZeroAvailableNum(Long orderId) {
//计算已打托数量
QueryWrapper<WarehouseTrayGoodsEntity> trayGoodsEntityQueryWrapper = new QueryWrapper<>();
trayGoodsEntityQueryWrapper.eq("association_id",orderId)
.eq("association_type",1);
List<WarehouseTrayGoodsEntity> trayGoodsList = warehouseTrayGoodsService.list(trayGoodsEntityQueryWrapper);
QueryWrapper<WarehouseUpdownGoodsEntity> updownGoodsEntityQueryWrapper = new QueryWrapper<>();
trayGoodsEntityQueryWrapper.eq("association_id",orderId)
.eq("association_type",1);
List<WarehouseUpdownGoodsEntity> updownGoodsList = warehouseUpdownGoodsService.list(updownGoodsEntityQueryWrapper);
for (WarehouseTrayGoodsEntity trayGoodsEntity:trayGoodsList){
for (WarehouseUpdownGoodsEntity updownGoodsEntity:updownGoodsList){
}
}
return 0;
}
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public R enterZeroOrderByTrayCode(String trayType,String trayCode, List<ZeroOrderVO> zeroList) { public R enterZeroOrderByTrayCode(String trayType,String trayCode, List<ZeroOrderVO> zeroList) {
@ -1225,12 +1279,13 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
//删除绑定关系 //删除绑定关系
warehouseTrayGoodsService.deleteByIdList(trayGoodsList); warehouseTrayGoodsService.deleteByIdList(trayGoodsList);
//删除打托方式 //删除打托方式
trayTypeEntity.setTotalNum(0); removeById(trayTypeEntity.getId());
trayTypeEntity.setOrderTotalNum(0); // trayTypeEntity.setTotalNum(0);
trayTypeEntity.setStockNum(0); // trayTypeEntity.setOrderTotalNum(0);
trayTypeEntity.setStockTotalNum(0); // trayTypeEntity.setStockNum(0);
trayTypeEntity.setIsDeleted(1); // trayTypeEntity.setStockTotalNum(0);
updateById(trayTypeEntity); // trayTypeEntity.setIsDeleted(1);
// updateById(trayTypeEntity);
//空置托盘 //空置托盘
basicdataTrayClient.updateTrayStatus(trayId,1); basicdataTrayClient.updateTrayStatus(trayId,1);
} }

8
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownGoodsServiceImpl.java

@ -104,14 +104,12 @@ public class WarehouseUpdownGoodsServiceImpl extends BaseServiceImpl<WarehouseUp
updownGoodsEntity.setAreaTitle(updownTypeEntity.getAreaTitle()); updownGoodsEntity.setAreaTitle(updownTypeEntity.getAreaTitle());
updownGoodsEntity.setShelfId(updownTypeEntity.getShelfId()); updownGoodsEntity.setShelfId(updownTypeEntity.getShelfId());
updownGoodsEntity.setShelfTitle(updownTypeEntity.getShelfTitle()); updownGoodsEntity.setShelfTitle(updownTypeEntity.getShelfTitle());
updownGoodsEntity.setAllocationId(updownGoodsEntity.getAllocationId()); updownGoodsEntity.setAllocationId(updownTypeEntity.getAllocationId());
updownGoodsEntity.setAllocationTitle(updownGoodsEntity.getAllocationTitle()); updownGoodsEntity.setAllocationTitle(updownTypeEntity.getAllocationTitle());
updownGoodsEntity.setPositionCode(updownGoodsEntity.getPositionCode()); updownGoodsEntity.setPositionCode(updownTypeEntity.getPositionCode());
updownGoodsEntity.setGoodsType(updownGoodsEntity.getGoodsType());
updownGoodsEntity.setAssociationId(parcelListEntity.getId()); updownGoodsEntity.setAssociationId(parcelListEntity.getId());
updownGoodsEntity.setAssociationValue(parcelListEntity.getOrderPackageCode()); updownGoodsEntity.setAssociationValue(parcelListEntity.getOrderPackageCode());
updownGoodsEntity.setAssociationType("3");//包件 updownGoodsEntity.setAssociationType("3");//包件
updownGoodsEntity.setGoodsName(updownGoodsEntity.getGoodsName());
updownGoodsEntity.setNum(parcelListEntity.getQuantity()); updownGoodsEntity.setNum(parcelListEntity.getQuantity());
save(updownGoodsEntity); save(updownGoodsEntity);
//存入包件货物上架记录 //存入包件货物上架记录

33
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownTypeServiceImpl.java

@ -799,8 +799,12 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
Long updownGoodsId = updownGoodsEntity.getId(); Long updownGoodsId = updownGoodsEntity.getId();
Long updownTypeId = updownGoodsEntity.getUpdownTypeId(); Long updownTypeId = updownGoodsEntity.getUpdownTypeId();
WarehouseUpdownTypeEntity updownTypeEntity = baseMapper.selectById(updownTypeId); WarehouseUpdownTypeEntity updownTypeEntity = baseMapper.selectById(updownTypeId);
BasicdataTrayEntity trayEntity = warehouseTaryAllocationService.getTrayByAllocationId(allocationId); QueryWrapper<WarehouseTaryAllocationEntity> taryAllocationEntityQueryWrapper = new QueryWrapper<>();
if(!Objects.isNull(trayEntity)){ taryAllocationEntityQueryWrapper.eq("allocation_id",allocationId)
.eq("is_deleted",0);
WarehouseTaryAllocationEntity taryAllocationEntity = warehouseTaryAllocationService.getOne(taryAllocationEntityQueryWrapper);
// BasicdataTrayEntity trayEntity = warehouseTaryAllocationService.getTrayByAllocationId(allocationId);
if(!Objects.isNull(taryAllocationEntity)){
//有托盘,托盘下托 //有托盘,托盘下托
warehouseTrayTypeService.downPackageByOrderPackageCode(orderPackageCode,"包件下架:同步下托"); warehouseTrayTypeService.downPackageByOrderPackageCode(orderPackageCode,"包件下架:同步下托");
} }
@ -810,6 +814,10 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
removeById(updownTypeId); removeById(updownTypeId);
//修改库位状态为空闲 //修改库位状态为空闲
basicdataGoodsAllocationClient.updateAllocationStatus(allocationId,"1"); basicdataGoodsAllocationClient.updateAllocationStatus(allocationId,"1");
//如果有托盘还要删除托盘与库位的绑定
if(!Objects.isNull(taryAllocationEntity)){
warehouseTaryAllocationService.deleteById(taryAllocationEntity);
}
} }
warehouseUpdownGoodsLogService.saveAllocationAndPackage(updownTypeEntity,parcelListEntity,"2",0,"包件下架:包件下架"); warehouseUpdownGoodsLogService.saveAllocationAndPackage(updownTypeEntity,parcelListEntity,"2",0,"包件下架:包件下架");
updateUpdownTypeNum(updownTypeEntity); updateUpdownTypeNum(updownTypeEntity);
@ -992,20 +1000,19 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
//删除绑定关系 //删除绑定关系
warehouseUpdownGoodsService.deleteEntityList(updownGoodsList); warehouseUpdownGoodsService.deleteEntityList(updownGoodsList);
//上架方式删除 //上架方式删除
updownTypeEntity.setTotalNum(0); removeById(updownTypeEntity.getId());
updownTypeEntity.setOrderTotalNum(0);
updownTypeEntity.setStockNum(0);
updownTypeEntity.setStockTotalNum(0);
updownTypeEntity.setIsDeleted(1);
updateById(updownTypeEntity);
//修改库位状态 //修改库位状态
basicdataGoodsAllocationClient.updateAllocationStatus(allocationId,"1"); basicdataGoodsAllocationClient.updateAllocationStatus(allocationId,"1");
//查询库位是否绑定了托盘 //查询库位是否绑定了托盘
BasicdataTrayEntity trayEntity = warehouseTaryAllocationService.getTrayByAllocationId(allocationId); QueryWrapper<WarehouseTaryAllocationEntity> taryAllocationEntityQueryWrapper = new QueryWrapper<>();
if(!Objects.isNull(trayEntity)){ taryAllocationEntityQueryWrapper.eq("allocation_id",allocationId)
.eq("is_deleted",0);
WarehouseTaryAllocationEntity taryAllocationEntity = warehouseTaryAllocationService.getOne(taryAllocationEntityQueryWrapper);
if(!Objects.isNull(taryAllocationEntity)){
//绑定了托盘 //绑定了托盘
warehouseTrayTypeService.downTrayGoodsByTrayId(trayEntity.getId(),"下架:按库位下架"); warehouseTaryAllocationService.deleteById(taryAllocationEntity);
// warehouseTrayTypeService.downTrayGoodsByTrayId(trayEntity.getId(),"下架:按库位下架");
} }
return R.success("下架成功"); return R.success("下架成功");
} }
@ -1020,7 +1027,7 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
} }
Long trayId = trayEntity.getId(); Long trayId = trayEntity.getId();
QueryWrapper<WarehouseTaryAllocationEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<WarehouseTaryAllocationEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("tary_id",trayId) queryWrapper.eq("tray_id",trayId)
.eq("is_deleted",0); .eq("is_deleted",0);
WarehouseTaryAllocationEntity taryAllocationEntity = warehouseTaryAllocationService.getOne(queryWrapper); WarehouseTaryAllocationEntity taryAllocationEntity = warehouseTaryAllocationService.getOne(queryWrapper);
if(Objects.isNull(taryAllocationEntity)){ if(Objects.isNull(taryAllocationEntity)){
@ -1029,7 +1036,7 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
} }
Long allocationId = taryAllocationEntity.getAllocationId();//库位id Long allocationId = taryAllocationEntity.getAllocationId();//库位id
//解绑托盘 //解绑托盘
warehouseTaryAllocationService.deleteById(taryAllocationEntity); // warehouseTaryAllocationService.deleteById(taryAllocationEntity);
R r = downAllocation(allocationId); R r = downAllocation(allocationId);
return r; return r;
} }

Loading…
Cancel
Save