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 id="getUpListByTrayTypeId" resultType="com.logpm.warehouse.vo.UpShelfDataVO">
select ldsa.order_code orderCode,
select ldpl.order_code orderCode,
lwtg.tray_code trayCode,
1 goodsType,
sum(lwtg.num) shelfNum
@ -27,7 +27,7 @@
where 1=1
and lwtg.is_deleted = 0
and lwtg.tray_type_id = #{trayTypeId}
group by ldsa.order_code,
group by ldpl.order_code,
lwtg.tray_code
</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.WarehouseTrayGoodsLogEntity;
import com.logpm.warehouse.entity.WarehouseTrayTypeEntity;
import com.logpm.warehouse.entity.WarehouseUpdownGoodsEntity;
import com.logpm.warehouse.mapper.WarehouseTrayTypeMapper;
import com.logpm.warehouse.service.IWarehouseTaryAllocationService;
import com.logpm.warehouse.service.IWarehouseTrayGoodsLogService;
import com.logpm.warehouse.service.IWarehouseTrayGoodsService;
import com.logpm.warehouse.service.IWarehouseTrayTypeService;
import com.logpm.warehouse.service.*;
import com.logpm.warehouse.vo.*;
import com.logpm.warehouse.wrapper.WarehouseTrayTypeWrapper;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springblade.common.constant.DictBizConstant;
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.utils.BeanUtil;
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.transaction.annotation.Transactional;
@ -45,24 +44,27 @@ import java.util.Objects;
@Log4j2
@Service
@AllArgsConstructor
public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayTypeMapper, WarehouseTrayTypeEntity> implements IWarehouseTrayTypeService {
private final IWarehouseTrayGoodsService warehouseTrayGoodsService;
private final IDistributionStockArticleClient distributionStockArticleClient;
private final IDistributionParcelListClient distributionParcelListClient;
private final IBasicMaterialClient basicMaterialClient;
private final IDistributionStockListClient distributionStockListClient;
private final IBasicdataTrayClient basicdataTrayClient;
private final IWarehouseTrayGoodsLogService warehouseTrayGoodsLogService;
private final IWarehouseTaryAllocationService warehouseTaryAllocationService;
@Autowired
private IWarehouseTrayGoodsService warehouseTrayGoodsService;
@Autowired
private IDistributionStockArticleClient distributionStockArticleClient;
@Autowired
private IDistributionParcelListClient distributionParcelListClient;
@Autowired
private IBasicMaterialClient basicMaterialClient;
@Autowired
private IDistributionStockListClient distributionStockListClient;
@Autowired
private IBasicdataTrayClient basicdataTrayClient;
@Autowired
private IWarehouseTrayGoodsLogService warehouseTrayGoodsLogService;
@Autowired
private IWarehouseTaryAllocationService warehouseTaryAllocationService;
@Autowired
@Lazy
private IWarehouseUpdownGoodsService warehouseUpdownGoodsService;
@Override
public IPage<WarehouseTrayTypeVO> orderPageList(TrayTypeDTO trayTypeDTO) {
@ -107,6 +109,13 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
log.warn("###############getEntityByTrayCode: 该托盘已被禁用 trayCode={}",trayCode);
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<>();
queryTrayTypeWrapper.eq("tray_code",trayCode)
@ -167,6 +176,14 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
qw.eq("association_value",orderPackageCode);
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);
if(Objects.isNull(basicdataTrayEntity)){
log.warn("#########orderScanOrderPackageCode: 未找到托盘信息 trayCode={}",trayCode);
@ -482,9 +499,46 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
@Override
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);
}
/**
* 计算零担订单的可用数量
* @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)
@Override
public R enterZeroOrderByTrayCode(String trayType,String trayCode, List<ZeroOrderVO> zeroList) {
@ -1225,12 +1279,13 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
//删除绑定关系
warehouseTrayGoodsService.deleteByIdList(trayGoodsList);
//删除打托方式
trayTypeEntity.setTotalNum(0);
trayTypeEntity.setOrderTotalNum(0);
trayTypeEntity.setStockNum(0);
trayTypeEntity.setStockTotalNum(0);
trayTypeEntity.setIsDeleted(1);
updateById(trayTypeEntity);
removeById(trayTypeEntity.getId());
// trayTypeEntity.setTotalNum(0);
// trayTypeEntity.setOrderTotalNum(0);
// trayTypeEntity.setStockNum(0);
// trayTypeEntity.setStockTotalNum(0);
// trayTypeEntity.setIsDeleted(1);
// updateById(trayTypeEntity);
//空置托盘
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.setShelfId(updownTypeEntity.getShelfId());
updownGoodsEntity.setShelfTitle(updownTypeEntity.getShelfTitle());
updownGoodsEntity.setAllocationId(updownGoodsEntity.getAllocationId());
updownGoodsEntity.setAllocationTitle(updownGoodsEntity.getAllocationTitle());
updownGoodsEntity.setPositionCode(updownGoodsEntity.getPositionCode());
updownGoodsEntity.setGoodsType(updownGoodsEntity.getGoodsType());
updownGoodsEntity.setAllocationId(updownTypeEntity.getAllocationId());
updownGoodsEntity.setAllocationTitle(updownTypeEntity.getAllocationTitle());
updownGoodsEntity.setPositionCode(updownTypeEntity.getPositionCode());
updownGoodsEntity.setAssociationId(parcelListEntity.getId());
updownGoodsEntity.setAssociationValue(parcelListEntity.getOrderPackageCode());
updownGoodsEntity.setAssociationType("3");//包件
updownGoodsEntity.setGoodsName(updownGoodsEntity.getGoodsName());
updownGoodsEntity.setNum(parcelListEntity.getQuantity());
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 updownTypeId = updownGoodsEntity.getUpdownTypeId();
WarehouseUpdownTypeEntity updownTypeEntity = baseMapper.selectById(updownTypeId);
BasicdataTrayEntity trayEntity = warehouseTaryAllocationService.getTrayByAllocationId(allocationId);
if(!Objects.isNull(trayEntity)){
QueryWrapper<WarehouseTaryAllocationEntity> taryAllocationEntityQueryWrapper = new QueryWrapper<>();
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,"包件下架:同步下托");
}
@ -810,6 +814,10 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
removeById(updownTypeId);
//修改库位状态为空闲
basicdataGoodsAllocationClient.updateAllocationStatus(allocationId,"1");
//如果有托盘还要删除托盘与库位的绑定
if(!Objects.isNull(taryAllocationEntity)){
warehouseTaryAllocationService.deleteById(taryAllocationEntity);
}
}
warehouseUpdownGoodsLogService.saveAllocationAndPackage(updownTypeEntity,parcelListEntity,"2",0,"包件下架:包件下架");
updateUpdownTypeNum(updownTypeEntity);
@ -992,20 +1000,19 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
//删除绑定关系
warehouseUpdownGoodsService.deleteEntityList(updownGoodsList);
//上架方式删除
updownTypeEntity.setTotalNum(0);
updownTypeEntity.setOrderTotalNum(0);
updownTypeEntity.setStockNum(0);
updownTypeEntity.setStockTotalNum(0);
updownTypeEntity.setIsDeleted(1);
updateById(updownTypeEntity);
removeById(updownTypeEntity.getId());
//修改库位状态
basicdataGoodsAllocationClient.updateAllocationStatus(allocationId,"1");
//查询库位是否绑定了托盘
BasicdataTrayEntity trayEntity = warehouseTaryAllocationService.getTrayByAllocationId(allocationId);
if(!Objects.isNull(trayEntity)){
QueryWrapper<WarehouseTaryAllocationEntity> taryAllocationEntityQueryWrapper = new QueryWrapper<>();
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("下架成功");
}
@ -1020,7 +1027,7 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
}
Long trayId = trayEntity.getId();
QueryWrapper<WarehouseTaryAllocationEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("tary_id",trayId)
queryWrapper.eq("tray_id",trayId)
.eq("is_deleted",0);
WarehouseTaryAllocationEntity taryAllocationEntity = warehouseTaryAllocationService.getOne(queryWrapper);
if(Objects.isNull(taryAllocationEntity)){
@ -1029,7 +1036,7 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
}
Long allocationId = taryAllocationEntity.getAllocationId();//库位id
//解绑托盘
warehouseTaryAllocationService.deleteById(taryAllocationEntity);
// warehouseTaryAllocationService.deleteById(taryAllocationEntity);
R r = downAllocation(allocationId);
return r;
}

Loading…
Cancel
Save