Browse Source

1.仓库逻辑修改优化

training
zhenghaoyu 2 years ago
parent
commit
d56b353627
  1. 1
      blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/ReCheckTrayListVO.java
  2. 39
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseTrayTypeApiController.java
  3. 3
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayGoodsMapper.xml
  4. 2
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseUpdownGoodsMapper.xml
  5. 4
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseTrayTypeService.java
  6. 5
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayGoodsServiceImpl.java
  7. 133
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java
  8. 5
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownTypeServiceImpl.java

1
blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/ReCheckTrayListVO.java

@ -14,4 +14,5 @@ public class ReCheckTrayListVO implements Serializable {
private Long marketId;//商场id
private String marketName;//商场名称
private String name;
private String isFleeing;//串货
}

39
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseTrayTypeApiController.java

@ -794,7 +794,7 @@ public class WarehouseTrayTypeApiController {
public R scanSourceTrayCode(@RequestBody TrayTypeDTO trayTypeDTO) {
String method = "###########scanSourceTrayCode: ";
log.info(method + "扫码来源托盘 trayTypeDTO={}", trayTypeDTO);
String sourceTrayCode = trayTypeDTO.getSourceTrayCode();//来源托盘
String sourceTrayCode = trayTypeDTO.getTrayCode();//来源托盘
try{
if(!StringUtil.hasLength(sourceTrayCode)){
log.warn(method+"来源托盘码不能为空 sourceTrayCode={}",sourceTrayCode);
@ -810,17 +810,42 @@ public class WarehouseTrayTypeApiController {
}
}
@ResponseBody
@PostMapping("/scanTargetTrayCode")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "扫码目标托盘", notes = "传入trayTypeDTO")
public R scanTargetTrayCode(@RequestBody TrayTypeDTO trayTypeDTO) {
String method = "###########scanTargetTrayCode: ";
log.info(method + "扫码来源托盘 trayTypeDTO={}", trayTypeDTO);
log.info(method + "扫码目标托盘 trayTypeDTO={}", trayTypeDTO);
String targetTrayCode = trayTypeDTO.getTrayCode();//来源托盘
try{
if(!StringUtil.hasLength(targetTrayCode)){
log.warn(method+"目标托盘码不能为空 targetTrayCode={}",targetTrayCode);
return R.fail(403,"目标托盘码不能为空");
}
return warehouseTrayTypeService.scanTargetTrayCode(targetTrayCode);
}catch (CustomerException e){
log.warn(e.message);
return R.fail(e.code,e.message);
}catch (Exception e){
log.error(method+"系统异常,联系管理员",e);
return R.fail(500,"系统异常,联系管理员");
}
}
@ResponseBody
@PostMapping("/mergeTray")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "合托", notes = "传入trayTypeDTO")
public R mergeTray(@RequestBody TrayTypeDTO trayTypeDTO) {
String method = "###########mergeTray: ";
log.info(method + "合托 trayTypeDTO={}", trayTypeDTO);
String sourceTrayCode = trayTypeDTO.getSourceTrayCode();//来源托盘码
String targetTrayCode = trayTypeDTO.getTargetTrayCode();//目标托盘码
try{
if(!StringUtil.hasLength(sourceTrayCode)){
log.warn(method+"来源托盘码不能为空 sourceTrayCode={}",sourceTrayCode);
return R.fail(403,"来源托盘码不能为空");
@ -829,7 +854,13 @@ public class WarehouseTrayTypeApiController {
log.warn(method+"目标托盘码不能为空 targetTrayCode={}",targetTrayCode);
return R.fail(403,"目标托盘码不能为空");
}
return warehouseTrayTypeService.scanTargetTrayCode(sourceTrayCode,targetTrayCode);
if(targetTrayCode.equals(sourceTrayCode)){
log.warn(method+"目标托盘码和来源托盘不能为同一个 targetTrayCode={} sourceTrayCode={}",targetTrayCode,sourceTrayCode);
return R.fail(403,"目标托盘码和来源托盘不能为同一个");
}
return warehouseTrayTypeService.mergeTray(sourceTrayCode,targetTrayCode);
}catch (CustomerException e){
log.warn(e.message);
return R.fail(e.code,e.message);

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

@ -165,6 +165,7 @@
ldpl.order_package_code code,
1 goodsType,
lwtg.num num,
lwtg.is_fleeing isFleeing,
ldpl.material_name name
from logpm_warehouse_tray_goods lwtg
left join logpm_distribution_parcel_list ldpl on ldpl.id = lwtg.association_id and ldpl.is_deleted = 0
@ -176,6 +177,7 @@
select ldsa.order_code orderCode,
2 goodsType,
lwtg.num num,
lwtg.is_fleeing isFleeing,
ldsa.description_goods name
from logpm_warehouse_tray_goods lwtg
left join logpm_distribution_stock_article ldsa on ldsa.id = lwtg.association_id and ldsa.is_deleted = 0
@ -189,6 +191,7 @@
ldsl.description_goods name,
3 goodsType,
lwtg.num num,
lwtg.is_fleeing isFleeing,
ldsl.market_id marketId,
ldsl.market_name marketName
from logpm_warehouse_tray_goods lwtg

2
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseUpdownGoodsMapper.xml

@ -204,7 +204,7 @@
lwug.allocation_title allocationName,
lwt.pallet_code trayCode,
lwug.num num
from logpm_warehouse_updown_goods lwug on ldsa.id = lwug.association_id
from logpm_warehouse_updown_goods lwug
left join logpm_warehouse_tary_allocation lwta on lwta.allocation_id = lwug.allocation_id and lwta.is_deleted = 0
left join logpm_warehouse_tray lwt on lwt.id = lwta.tray_id
where lwug.association_id = #{orderId}

4
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseTrayTypeService.java

@ -64,7 +64,7 @@ public interface IWarehouseTrayTypeService extends BaseService<WarehouseTrayType
R scanSourceTrayCode(String sourceTrayCode);
R scanTargetTrayCode(String sourceTrayCode,String targetTrayCode);
R mergeTray(String sourceTrayCode,String targetTrayCode);
OrderDetailVO orderDetail(String orderCode,String trayCode);
@ -72,4 +72,6 @@ public interface IWarehouseTrayTypeService extends BaseService<WarehouseTrayType
R selectStockByMaterialCodeAndMarketId(Long marketId, String materialCode);
R scanTargetTrayCode(String targetTrayCode);
}

5
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayGoodsServiceImpl.java

@ -16,7 +16,6 @@ import lombok.extern.log4j.Log4j2;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@ -212,11 +211,9 @@ public class WarehouseTrayGoodsServiceImpl extends BaseServiceImpl<WarehouseTray
@Override
public void deleteByIdList(List<WarehouseTrayGoodsEntity> trayGoodsList) {
List<Long> ids = new ArrayList<>();
for (WarehouseTrayGoodsEntity trayGoodsEntity:trayGoodsList){
ids.add(trayGoodsEntity.getId());
baseMapper.deleteEntityByTrayGoodsId(trayGoodsEntity.getId());
}
baseMapper.deleteByIdList(ids);
}
@Override

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

@ -37,10 +37,7 @@ import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
@Log4j2
@Service
@ -1355,8 +1352,13 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
log.warn("################scanSourceTrayCode: 托盘没有打托方式 trayId={}",trayId);
return R.fail(403,"托盘未绑定数据");
}
Map<String,Object> map = new HashMap<>();
String type = trayTypeEntity.getType();
Long trayTypeId = trayTypeEntity.getId();
Integer totalNum = trayTypeEntity.getTotalNum();
Integer orderTotalNum = trayTypeEntity.getOrderTotalNum();
Integer stockNum = trayTypeEntity.getStockNum();
Integer stockTotalNum = trayTypeEntity.getStockTotalNum();
List<ReCheckTrayListVO> trayListVOS = null;
if(PalletProductTypeConstant.CUSTOMIZED.equals(type)){//订制品打托
@ -1370,26 +1372,32 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
}else {
log.warn("##################getEntityByTrayCode: 未知的打托类型");
}
return R.data(trayListVOS);
map.put("trayCode",trayCode);
map.put("totalNum",totalNum);
map.put("orderTotalNum",orderTotalNum);
map.put("stockNum",stockNum);
map.put("stockTotalNum",stockTotalNum);
map.put("list",trayListVOS);
return R.data(map);
}
@Override
public R scanTargetTrayCode(String sourceTrayCode,String targetTrayCode) {
log.info("#################scanTargetTrayCode: 合托扫码目标托盘 targetTrayCode={}",targetTrayCode);
public R mergeTray(String sourceTrayCode,String targetTrayCode) {
log.info("#################mergeTray: 合托扫码目标托盘 targetTrayCode={}",targetTrayCode);
BasicdataTrayEntity trayEntity = basicdataTrayClient.getTrayByTrayCode(targetTrayCode);
if(Objects.isNull(trayEntity)){
log.warn("################scanTargetTrayCode: 托盘信息不存在 targetTrayCode={}",targetTrayCode);
log.warn("################mergeTray: 托盘信息不存在 targetTrayCode={}",targetTrayCode);
return R.fail(403,"托盘信息不存在");
}
Integer disableType = trayEntity.getDisableType();
Long targetTrayId = trayEntity.getId();
if(disableType == 2){
log.warn("################scanTargetTrayCode: 托盘已禁用 targetTrayCode={}",targetTrayCode);
log.warn("################mergeTray: 托盘已禁用 targetTrayCode={}",targetTrayCode);
return R.fail(403,"托盘已禁用");
}
Long allocationId = warehouseTaryAllocationService.getAllocationIdByTrayId(targetTrayId);
if(!Objects.isNull(allocationId)){
log.warn("################scanTargetTrayCode: 托盘已上架 targetTrayId={}",targetTrayId);
log.warn("################mergeTray: 托盘已上架 targetTrayId={}",targetTrayId);
return R.fail(403,"托盘已上架,请先下架");
}
QueryWrapper<WarehouseTrayTypeEntity> sourceQueryWapper = new QueryWrapper<>();
@ -1397,36 +1405,40 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
.eq("is_deleted",0);
WarehouseTrayTypeEntity sourceTrayTypeEntity = baseMapper.selectOne(sourceQueryWapper);
if(Objects.isNull(sourceTrayTypeEntity)){
log.warn("################scanTargetTrayCode: 来源托盘信息有误 sourceTrayCode={}",sourceTrayCode);
log.warn("################mergeTray: 来源托盘信息有误 sourceTrayCode={}",sourceTrayCode);
return R.fail(403,"来源托盘信息有误");
}
QueryWrapper<WarehouseTrayTypeEntity> targetQueryWapper = new QueryWrapper<>();
targetQueryWapper.eq("tray_code",targetTrayCode)
.eq("is_deleted",0);
WarehouseTrayTypeEntity targetTrayTypeEntity = baseMapper.selectOne(targetQueryWapper);
if(Objects.isNull(targetTrayTypeEntity)){
log.warn("################scanTargetTrayCode: 目标托盘信息有误 targetTrayCode={}",targetTrayCode);
return R.fail(403,"目标托盘信息有误");
}
String sourceType = sourceTrayTypeEntity.getType();
String targetType = targetTrayTypeEntity.getType();
if(!sourceType.equals(targetType)){
log.warn("################scanTargetTrayCode: 托盘货物类型不同 sourceType={} targetType={}",sourceType,targetType);
return R.fail(403,"托盘货物类型不同");
}
BasicdataTrayEntity sourceTrayEntity = basicdataTrayClient.getTrayByTrayCode(sourceTrayCode);
if(Objects.isNull(sourceTrayEntity)){
log.warn("################scanTargetTrayCode: 托盘信息不存在 sourceTrayCode={}",sourceTrayCode);
return R.fail(403,"托盘信息不存在");
}
Long sourceTrayId = sourceTrayEntity.getId();
Long sourceTrayId = sourceTrayTypeEntity.getTrayId();
Long sourceTrayTypeId = sourceTrayTypeEntity.getId();
Long targetTrayTypeId = targetTrayTypeEntity.getId();
//先把来源托盘数据合到目标托盘
copyTrayGoodsToTargetTray(sourceTrayTypeId,targetTrayTypeEntity);
if(Objects.isNull(targetTrayTypeEntity)){
targetTrayTypeEntity = new WarehouseTrayTypeEntity();
BeanUtil.copy(sourceTrayTypeEntity,targetTrayTypeEntity);
targetTrayTypeEntity.setTrayId(targetTrayId);
targetTrayTypeEntity.setTrayCode(targetTrayCode);
targetTrayTypeEntity.setId(null);
save(targetTrayTypeEntity);//保存打托方式
//先把来源托盘数据合到目标托盘
copyTrayGoodsToTargetTray(sourceTrayTypeId,targetTrayTypeEntity);
//空置来源托盘
downTrayGoodsByTrayId(sourceTrayId,"合托:下托");
}else{
String targetType = targetTrayTypeEntity.getType();
if(!sourceType.equals(targetType)){
log.warn("################mergeTray: 托盘货物类型不同 sourceType={} targetType={}",sourceType,targetType);
return R.fail(403,"托盘货物类型不同");
}
//空置来源托盘
downTrayGoodsByTrayId(sourceTrayId,"合托:下托");
//先把来源托盘数据合到目标托盘
copyTrayGoodsToTargetTray(sourceTrayTypeId,targetTrayTypeEntity);
//空置来源托盘
downTrayGoodsByTrayId(sourceTrayId,"合托:下托");
}
return R.success("合托成功");
}
@ -1518,6 +1530,65 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
return R.data(ls);
}
@Override
public R scanTargetTrayCode(String trayCode) {
log.info("#################scanTargetTrayCode: 合托扫码来源托盘 trayCode={}",trayCode);
BasicdataTrayEntity trayEntity = basicdataTrayClient.getTrayByTrayCode(trayCode);
if(Objects.isNull(trayEntity)){
log.warn("################scanTargetTrayCode: 托盘信息不存在 trayCode={}",trayCode);
return R.fail(403,"托盘信息不存在");
}
Integer disableType = trayEntity.getDisableType();
Long trayId = trayEntity.getId();
if(disableType == 2){
log.warn("################scanTargetTrayCode: 托盘已禁用 trayCode={}",trayCode);
return R.fail(403,"托盘已禁用");
}
Long allocationId = warehouseTaryAllocationService.getAllocationIdByTrayId(trayId);
if(!Objects.isNull(allocationId)){
log.warn("################scanTargetTrayCode: 托盘已上架 trayId={}",trayId);
return R.fail(403,"托盘已上架,请先下架");
}
QueryWrapper<WarehouseTrayTypeEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("tray_id",trayId)
.eq("is_deleted",0);
WarehouseTrayTypeEntity trayTypeEntity = baseMapper.selectOne(queryWrapper);
if(Objects.isNull(trayTypeEntity)){
log.info("################scanTargetTrayCode: 托盘未绑定数据 trayId={}",trayId);
return R.success("托盘未绑定数据");
}else{
Map<String,Object> map = new HashMap<>();
String type = trayTypeEntity.getType();
Long trayTypeId = trayTypeEntity.getId();
Integer totalNum = trayTypeEntity.getTotalNum();
Integer orderTotalNum = trayTypeEntity.getOrderTotalNum();
Integer stockNum = trayTypeEntity.getStockNum();
Integer stockTotalNum = trayTypeEntity.getStockTotalNum();
List<ReCheckTrayListVO> trayListVOS = null;
if(PalletProductTypeConstant.CUSTOMIZED.equals(type)){//订制品打托
trayListVOS = warehouseTrayGoodsService.getReCheckPackageByTrayTypeId(trayTypeId);
}else if(PalletProductTypeConstant.ARTIFICIAL.equals(type)){
trayListVOS = warehouseTrayGoodsService.getReCheckZeroByTrayTypeId(trayTypeId);
}else if(PalletProductTypeConstant.STOCKDATA.equals(type)){
trayListVOS = warehouseTrayGoodsService.getReCheckStockByTrayTypeId(trayTypeId);
}else if(PalletProductTypeConstant.STOCKNODATA.equals(type)){
trayListVOS = warehouseTrayGoodsService.getReCheckStockByTrayTypeId(trayTypeId);
}else {
log.warn("##################scanTargetTrayCode: 未知的打托类型");
}
map.put("trayCode",trayCode);
map.put("totalNum",totalNum);
map.put("orderTotalNum",orderTotalNum);
map.put("stockNum",stockNum);
map.put("stockTotalNum",stockTotalNum);
map.put("list",trayListVOS);
return R.data(map);
}
}
private void copyTrayGoodsToTargetTray(Long sourceTrayTypeId, WarehouseTrayTypeEntity targetTrayTypeEntity) {
QueryWrapper<WarehouseTrayGoodsEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("tray_type_id",sourceTrayTypeId);

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

@ -749,7 +749,7 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
log.warn("##########downScanPackage: 包件信息不存在 orderPackageCode={}",orderPackageCode);
return R.fail(403,"包件信息不存在");
}
return R.data(parcelListEntity);
return R.data(updownGoodsEntity);
}
@Override
@ -1269,7 +1269,6 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
updownZeroOrderVO.setWaybillCode(stockArticleEntity.getWaybillNumber());
updownZeroOrderVO.setOrderCode(orderCode);
updownZeroOrderVO.setTotalNumber(totalNumber);
List<PositionVO> ls = new ArrayList<>();
List<PositionVO> updownGoodsEntities = warehouseUpdownGoodsService.getUpdownGoodsByZeroOrderId(orderId);
List<PositionVO> trayGoodsEntities = warehouseTrayGoodsService.getTrayGoodsByZeroOrderIdNoAllocationId(orderId);
updownGoodsEntities.addAll(trayGoodsEntities);
@ -1278,7 +1277,7 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
totalNumber = totalNumber -num;
}
updownZeroOrderVO.setResidueNumber(totalNumber);
updownZeroOrderVO.setList(ls);
updownZeroOrderVO.setList(updownGoodsEntities);
return updownZeroOrderVO;
}

Loading…
Cancel
Save