|
|
|
@ -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 |
|
|
|
@ -942,20 +939,20 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
|
|
|
|
|
if(chuanFlag){ |
|
|
|
|
if(Objects.isNull(warehouseTrayGoodsEntity)){ |
|
|
|
|
//存入有数据库存品与托盘绑定关系表
|
|
|
|
|
warehouseTrayGoodsService.saveEntityStock(materialId, marketId,trayTypeEntity,incomingBatch,1, "1"); |
|
|
|
|
warehouseTrayGoodsService.saveEntityStock(materialId, marketId,trayTypeEntity,incomingBatch,materialCode,1, "1"); |
|
|
|
|
}else{ |
|
|
|
|
warehouseTrayGoodsService.updateEntityStock(warehouseTrayGoodsEntity,1); |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
if(Objects.isNull(warehouseTrayGoodsEntity)){ |
|
|
|
|
//存入有数据库存品与托盘绑定关系表
|
|
|
|
|
warehouseTrayGoodsService.saveEntityStock(materialId, marketId,trayTypeEntity,incomingBatch,1, "0"); |
|
|
|
|
warehouseTrayGoodsService.saveEntityStock(materialId, marketId,trayTypeEntity,incomingBatch,materialCode,1, "0"); |
|
|
|
|
}else{ |
|
|
|
|
warehouseTrayGoodsService.updateEntityStock(warehouseTrayGoodsEntity,-1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// //添加上拖日志表
|
|
|
|
|
warehouseTrayGoodsLogService.saveLogStock(materialId, marketId,trayTypeEntity,incomingBatch,1, "1", "分拣打托:有数据库存品 分拣", "1"); |
|
|
|
|
warehouseTrayGoodsLogService.saveLogStock(materialId, marketId,trayTypeEntity,incomingBatch,materialCode,1, "1", "分拣打托:有数据库存品 分拣", "1"); |
|
|
|
|
|
|
|
|
|
updateNumByTrayTypeId(trayTypeEntity); |
|
|
|
|
|
|
|
|
@ -978,6 +975,7 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
|
|
|
|
|
Long trayTypeId = trayGoodsEntity.getTrayTypeId(); |
|
|
|
|
Integer num = trayGoodsEntity.getNum(); |
|
|
|
|
Long materialId = trayGoodsEntity.getAssociationId(); |
|
|
|
|
String materialCode = trayGoodsEntity.getAssociationValue(); |
|
|
|
|
Long marketId = trayGoodsEntity.getMarketId(); |
|
|
|
|
Long trayId = trayGoodsEntity.getTrayId(); |
|
|
|
|
String incomingBatch = trayGoodsEntity.getIncomingBatch(); |
|
|
|
@ -1006,7 +1004,7 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//添加下托日志
|
|
|
|
|
warehouseTrayGoodsLogService.saveLogStock(materialId,marketId,trayTypeEntity,incomingBatch,num,"0","分拣打托:有数据库存品分拣","2"); |
|
|
|
|
warehouseTrayGoodsLogService.saveLogStock(materialId,marketId,trayTypeEntity,incomingBatch,materialCode,num,"0","分拣打托:有数据库存品分拣","2"); |
|
|
|
|
|
|
|
|
|
updateNumByTrayTypeId(trayTypeEntity); |
|
|
|
|
|
|
|
|
@ -1140,6 +1138,7 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
|
|
|
|
|
} |
|
|
|
|
String marketName = stockListEntity.getMarketName(); |
|
|
|
|
Long materialId = stockListEntity.getMaterialId(); |
|
|
|
|
String cargoNumber = stockListEntity.getCargoNumber(); |
|
|
|
|
BasicMaterialEntity materialEntity = basicMaterialClient.getMaterialOwnId(materialId); |
|
|
|
|
if(Objects.isNull(materialEntity)){ |
|
|
|
|
log.warn("#########saveTrayTypeByStock: 未找到物料信息 materialId={}",materialId); |
|
|
|
@ -1196,20 +1195,20 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
|
|
|
|
|
if(chuanFlag){ |
|
|
|
|
if(Objects.isNull(warehouseTrayGoodsEntity)){ |
|
|
|
|
//存入有数据库存品与托盘绑定关系表
|
|
|
|
|
warehouseTrayGoodsService.saveEntityStock(materialId, marketId,trayTypeEntity,incomingBatch,num, "1"); |
|
|
|
|
warehouseTrayGoodsService.saveEntityStock(materialId, marketId,trayTypeEntity,incomingBatch,cargoNumber,num, "1"); |
|
|
|
|
}else{ |
|
|
|
|
warehouseTrayGoodsService.updateEntityStock(warehouseTrayGoodsEntity,num); |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
if(Objects.isNull(warehouseTrayGoodsEntity)){ |
|
|
|
|
//存入有数据库存品与托盘绑定关系表
|
|
|
|
|
warehouseTrayGoodsService.saveEntityStock(materialId, marketId,trayTypeEntity,incomingBatch,num, "0"); |
|
|
|
|
warehouseTrayGoodsService.saveEntityStock(materialId, marketId,trayTypeEntity,incomingBatch,cargoNumber,num, "0"); |
|
|
|
|
}else{ |
|
|
|
|
warehouseTrayGoodsService.updateEntityStock(warehouseTrayGoodsEntity,-num); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// //添加上拖日志表
|
|
|
|
|
warehouseTrayGoodsLogService.saveLogStock(materialId, marketId,trayTypeEntity,incomingBatch,num, "1", "分拣打托:无数据库存品 分拣", "1"); |
|
|
|
|
warehouseTrayGoodsLogService.saveLogStock(materialId, marketId,trayTypeEntity,incomingBatch,cargoNumber,num, "1", "分拣打托:无数据库存品 分拣", "1"); |
|
|
|
|
|
|
|
|
|
updateNumByTrayTypeId(trayTypeEntity); |
|
|
|
|
|
|
|
|
@ -1254,6 +1253,7 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
|
|
|
|
|
WarehouseTrayGoodsEntity trayGoodsEntity = warehouseTrayGoodsService.getById(trayGoodsId); |
|
|
|
|
Long trayTypeId = trayGoodsEntity.getTrayTypeId(); |
|
|
|
|
Long materialId = trayGoodsEntity.getAssociationId(); |
|
|
|
|
String materialCode = trayGoodsEntity.getAssociationValue(); |
|
|
|
|
Long marketId = trayGoodsEntity.getMarketId(); |
|
|
|
|
String incomingBatch = trayGoodsEntity.getIncomingBatch(); |
|
|
|
|
WarehouseTrayTypeEntity trayTypeEntity = baseMapper.selectById(trayTypeId); |
|
|
|
@ -1261,7 +1261,7 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
|
|
|
|
|
warehouseTrayGoodsService.updateEntityStock(trayGoodsEntity,enterNum); |
|
|
|
|
|
|
|
|
|
//添加下托日志 Long materialId,Long marketId, WarehouseTrayTypeEntity trayTypeEntity,Integer num, String bindingType, String remark, String palletizingType
|
|
|
|
|
warehouseTrayGoodsLogService.saveLogStock(materialId,marketId,trayTypeEntity,incomingBatch,Math.abs(enterNum),"0","下架:库存品部分下架","2"); |
|
|
|
|
warehouseTrayGoodsLogService.saveLogStock(materialId,marketId,trayTypeEntity,incomingBatch,materialCode,Math.abs(enterNum),"0","下架:库存品部分下架","2"); |
|
|
|
|
|
|
|
|
|
updateNumByTrayTypeId(trayTypeEntity); |
|
|
|
|
} |
|
|
|
@ -1355,8 +1355,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 +1375,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 +1408,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 +1533,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); |
|
|
|
|