|
|
|
@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
|
import com.logpm.basicdata.entity.BasicdataWarehouseEntity; |
|
|
|
|
import com.logpm.basicdata.feign.IBasicdataCodeClient; |
|
|
|
@ -69,6 +70,10 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
@Lazy |
|
|
|
|
@Autowired |
|
|
|
|
private IDistributionReservationService distributionReservationService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private IDistributionReservationStocklistService distributionReservationStocklistService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private IWarehouseTrayGoodsClient warehouseTrayGoodsClient; |
|
|
|
|
@Autowired |
|
|
|
@ -150,8 +155,8 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
page.setCurrent(stockupDTO.getCurrent()); |
|
|
|
|
page.setSize(stockupDTO.getSize()); |
|
|
|
|
stockupDTO.setUserId(AuthUtil.getUserId()); |
|
|
|
|
stockupDTO.setStockupDateStart(stockupDTO.getStockupDateStart()+" 00:00:00"); |
|
|
|
|
stockupDTO.setStockupDateEnd(stockupDTO.getStockupDateEnd()+" 23:59:59"); |
|
|
|
|
stockupDTO.setStockupDateStart(stockupDTO.getStockupDateStart() + " 00:00:00"); |
|
|
|
|
stockupDTO.setStockupDateEnd(stockupDTO.getStockupDateEnd() + " 23:59:59"); |
|
|
|
|
IPage<DistributionStockupListVO> distributionStockupEntityIPage = baseMapper.selectHomeStockupPage(page, stockupDTO); |
|
|
|
|
// IPage<DistributionStockupListVO> distributionStockupEntityIPage = baseMapper.selectStockupPage(page, stockupDTO);
|
|
|
|
|
List<DistributionStockupListVO> records = distributionStockupEntityIPage.getRecords(); |
|
|
|
@ -225,26 +230,26 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
// page.setSize(stockupDTO.getSize());
|
|
|
|
|
//查询备货信息
|
|
|
|
|
DistributionStockupListVO vo = baseMapper.selectStockupPageInfo(stockupDTO); |
|
|
|
|
if(ObjectUtils.isNotNull(vo)){ |
|
|
|
|
if (ObjectUtils.isNotNull(vo)) { |
|
|
|
|
intToStrDistributionStockupListVO(vo); |
|
|
|
|
map.put("stockupCode",vo.getStockupCode()); |
|
|
|
|
map.put("typeServiceStr",vo.getTypeServiceStr()); |
|
|
|
|
map.put("stockupArea",vo.getStockupArea()); |
|
|
|
|
map.put("stockupStatusStr",vo.getStockupStatusStr()); |
|
|
|
|
map.put("stockupCode", vo.getStockupCode()); |
|
|
|
|
map.put("typeServiceStr", vo.getTypeServiceStr()); |
|
|
|
|
map.put("stockupArea", vo.getStockupArea()); |
|
|
|
|
map.put("stockupStatusStr", vo.getStockupStatusStr()); |
|
|
|
|
String[] split = vo.getReservation().split(","); |
|
|
|
|
List<DistributionStockupListVO> list = new ArrayList<>(); |
|
|
|
|
for (int i = 0; i < split.length; i++) { |
|
|
|
|
stockupDTO.setReservationId(Long.parseLong(split[i])); |
|
|
|
|
//查询客户数据
|
|
|
|
|
DistributionStockupListVO distributionStockupListVO = baseMapper.selectStockupClientInfo(stockupDTO); |
|
|
|
|
if(ObjectUtils.isNotNull(distributionStockupListVO)){ |
|
|
|
|
if (ObjectUtils.isNotNull(distributionStockupListVO)) { |
|
|
|
|
intToStrDistributionStockupListVO(distributionStockupListVO); |
|
|
|
|
distributionStockupListVO.setReservationId(Long.parseLong(split[i])); |
|
|
|
|
list.add(distributionStockupListVO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
map.put("orderList",list); |
|
|
|
|
map.put("orderList", list); |
|
|
|
|
} |
|
|
|
|
return map; |
|
|
|
|
} |
|
|
|
@ -358,11 +363,11 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void intToStrDistributionStockupListVO(DistributionStockupListVO vo) { |
|
|
|
|
if(ObjectUtils.isNotNull(vo.getTypeService())){ |
|
|
|
|
if (ObjectUtils.isNotNull(vo.getTypeService())) { |
|
|
|
|
String typeServiceStr = DictBizCache.getValue(DictBizConstant.DISTRIBUTION_TYPE, vo.getTypeService()); |
|
|
|
|
vo.setTypeServiceStr(typeServiceStr); |
|
|
|
|
} |
|
|
|
|
if(ObjectUtils.isNotNull(vo.getStockupStatus())){ |
|
|
|
|
if (ObjectUtils.isNotNull(vo.getStockupStatus())) { |
|
|
|
|
String typeServiceStr = DictBizCache.getValue(DictBizConstant.STOCKUP_STATUS, vo.getStockupStatus()); |
|
|
|
|
vo.setStockupStatusStr(typeServiceStr); |
|
|
|
|
} |
|
|
|
@ -391,8 +396,8 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
public DistributionStockupOrderInfoVO selectOrderInfo(Long reservationId, Long stockArticleId, Long stockupId, Long trayId) { |
|
|
|
|
//查询客户信息
|
|
|
|
|
DistributionReservationEntity reservationEntity = distributionReservationService.getById(reservationId); //预约信息
|
|
|
|
|
//通过订单id和预约id,托盘信息查询对应的包件列表
|
|
|
|
|
List<PackageStockupVO> list = distributionParcelListService.selectOrderInfoList(reservationId, stockArticleId, stockupId,trayId); |
|
|
|
|
//通过订单id和预约id,托盘信息查询对应的包件列表
|
|
|
|
|
List<PackageStockupVO> list = distributionParcelListService.selectOrderInfoList(reservationId, stockArticleId, stockupId, trayId); |
|
|
|
|
int size = list.size(); //数量
|
|
|
|
|
Integer scanNum = 0; |
|
|
|
|
for (PackageStockupVO vo : list) { |
|
|
|
@ -435,7 +440,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
@Override |
|
|
|
|
public IPage<DistributionStockupVO> detailOrderOwn(IPage<Object> page, Long id) { |
|
|
|
|
IPage<DistributionStockupVO> distributionStockupVOIPage = baseMapper.detailOrderOwn(page, id); |
|
|
|
|
distributionStockupVOIPage.getRecords().forEach( o ->{ |
|
|
|
|
distributionStockupVOIPage.getRecords().forEach(o -> { |
|
|
|
|
Integer integer = distributionStockService.selectCount(Long.parseLong(o.getStockArticleId())); |
|
|
|
|
o.setNumber(integer); |
|
|
|
|
}); |
|
|
|
@ -539,15 +544,15 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
@Override |
|
|
|
|
public DistributionStockupVO detailOwnSelf(Long id) { |
|
|
|
|
DistributionStockupEntity distributionStockupEntity = baseMapper.selectById(id); |
|
|
|
|
DistributionStockupVO distributionStockupVO =DistributionStockupWrapper.build().entityVO(distributionStockupEntity); |
|
|
|
|
DistributionStockupVO distributionStockupVO = DistributionStockupWrapper.build().entityVO(distributionStockupEntity); |
|
|
|
|
return distributionStockupVO; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public IPage<DistributionStockupVO> detailOrderOwnSelf(IPage<Object> page, long parseLong) { |
|
|
|
|
IPage<DistributionStockupVO> distributionStockupVOIPage = baseMapper.detailOrderOwnSelf(page, parseLong); |
|
|
|
|
distributionStockupVOIPage.getRecords().forEach( o ->{ |
|
|
|
|
if(ObjectUtils.isNotNull(o.getStockArticleId())){ |
|
|
|
|
distributionStockupVOIPage.getRecords().forEach(o -> { |
|
|
|
|
if (ObjectUtils.isNotNull(o.getStockArticleId())) { |
|
|
|
|
Integer integer = distributionStockService.selectCount(Long.parseLong(o.getStockArticleId())); |
|
|
|
|
o.setNumber(integer); |
|
|
|
|
} |
|
|
|
@ -558,6 +563,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 整托备货 |
|
|
|
|
* |
|
|
|
|
* @param stockupDTO |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
@ -570,22 +576,22 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
//查询托盘上面的包件
|
|
|
|
|
List<WarehouseTrayGoodsEntity> trayIdList = warehouseTrayGoodsClient.getTrayIdList(stockupDTO.getTrayId()); |
|
|
|
|
List<DistributionStockPackageVO> voList = new ArrayList<>(); |
|
|
|
|
trayIdList.forEach( t ->{ |
|
|
|
|
trayIdList.forEach(t -> { |
|
|
|
|
Optional<DistributionStockPackageVO> first = list.stream().filter(l -> l.getParcelListId().equals(t.getAssociationId())).findFirst(); |
|
|
|
|
if (first.isPresent()) { |
|
|
|
|
DistributionStockPackageVO distributionStockPackageVO = first.get(); |
|
|
|
|
log.warn("找到了匹配的对象:" + distributionStockPackageVO); |
|
|
|
|
voList.add(distributionStockPackageVO); |
|
|
|
|
} else{ |
|
|
|
|
} else { |
|
|
|
|
log.warn("没有找到了匹配的对象;"); |
|
|
|
|
stock.set(true); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
if(stock.get()){ |
|
|
|
|
return R.fail(3001,"备货失败!"); |
|
|
|
|
}else{ |
|
|
|
|
if (stock.get()) { |
|
|
|
|
return R.fail(3001, "备货失败!"); |
|
|
|
|
} else { |
|
|
|
|
List<DistributionStockEntity> list1 = new ArrayList<>(); |
|
|
|
|
voList.forEach(i ->{ |
|
|
|
|
voList.forEach(i -> { |
|
|
|
|
DistributionStockEntity distributionStock = new DistributionStockEntity(); |
|
|
|
|
distributionStock.setStockupId(stockupDTO.getStockupId()); |
|
|
|
|
distributionStock.setStockArticle(i.getStockArticleId()); |
|
|
|
@ -604,13 +610,14 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
//TODO 其他操作
|
|
|
|
|
//添加扫描记录
|
|
|
|
|
distributionStockService.saveBatch(list1); |
|
|
|
|
return R.fail(200,"备货成功"); |
|
|
|
|
return R.fail(200, "备货成功"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 查询这个货位是否有整托 |
|
|
|
|
* |
|
|
|
|
* @param reservationId |
|
|
|
|
* @param allocationId |
|
|
|
|
* @return |
|
|
|
@ -621,16 +628,16 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
List<DistributionParcelTrayVO> list = distributionReservationPackageService.selectClientStockupPackTray(reservationId);//查询在那些托盘
|
|
|
|
|
List<WarehouseTaryAllocationEntity> allocationId1 = warehouseTaryAllocationClient.getAllocationId(allocationId);//查询托盘
|
|
|
|
|
AtomicReference<Boolean> trays = new AtomicReference<>(false); |
|
|
|
|
allocationId1.forEach( i ->{ |
|
|
|
|
allocationId1.forEach(i -> { |
|
|
|
|
boolean b = list.stream().anyMatch(a -> a.getTrayId().equals(i.getTrayId())); |
|
|
|
|
if(b){ |
|
|
|
|
if (b) { |
|
|
|
|
//有
|
|
|
|
|
Iterator<DistributionParcelTrayVO> iterator = list.iterator(); |
|
|
|
|
while (iterator.hasNext()){ |
|
|
|
|
if(i.getTrayId().equals(iterator.next().getTrayId())){ |
|
|
|
|
while (iterator.hasNext()) { |
|
|
|
|
if (i.getTrayId().equals(iterator.next().getTrayId())) { |
|
|
|
|
String trayPackNum = iterator.next().getTrayPackNum(); //在这个托盘的数量
|
|
|
|
|
List<WarehouseTrayGoodsEntity> trayIdList = warehouseTrayGoodsClient.getTrayIdList(i.getTrayId()); |
|
|
|
|
if(trayPackNum.equals(trayIdList.size())){ |
|
|
|
|
if (trayPackNum.equals(trayIdList.size())) { |
|
|
|
|
trays.set(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -641,5 +648,92 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
return trays.get(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 订单自编号,包件码,查询备货是否存在数据 1 订单 2库存品 |
|
|
|
|
* |
|
|
|
|
* @param |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public Integer selectPackage(StockupDTO stockupDTO) { |
|
|
|
|
Long reservationId = stockupDTO.getReservationId(); |
|
|
|
|
Long stockupId = stockupDTO.getStockupId(); |
|
|
|
|
|
|
|
|
|
switch (stockupDTO.getScanType()) { |
|
|
|
|
case 1: |
|
|
|
|
//订单
|
|
|
|
|
String orderCode = stockupDTO.getOrderCode(); |
|
|
|
|
String packetBarCode = stockupDTO.getPacketBarCode(); |
|
|
|
|
Integer integer = baseMapper.selectPackageExist(stockupDTO); |
|
|
|
|
if (ObjectUtils.isNotNull(integer) && integer > 0) { |
|
|
|
|
//存在
|
|
|
|
|
List<DistributionStockEntity> list = distributionStockService.list(Wrappers.<DistributionStockEntity>query().lambda() |
|
|
|
|
.eq(DistributionStockEntity::getCoding, packetBarCode) |
|
|
|
|
.eq(DistributionStockEntity::getOrderSelfNumbering, orderCode) |
|
|
|
|
.eq(DistributionStockEntity::getStockupId, stockupId) |
|
|
|
|
.eq(DistributionStockEntity::getReservationId, reservationId) |
|
|
|
|
); |
|
|
|
|
if (list.size() > 0) { |
|
|
|
|
//重复扫码
|
|
|
|
|
return 2; |
|
|
|
|
} else { |
|
|
|
|
return 1; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
//不存在
|
|
|
|
|
return 3; |
|
|
|
|
} |
|
|
|
|
case 2: |
|
|
|
|
//库存品
|
|
|
|
|
//输入的数量
|
|
|
|
|
Long stockListId = stockupDTO.getStockListId(); |
|
|
|
|
DistributionReservationStocklistEntity one = distributionReservationStocklistService.getOne(Wrappers.<DistributionReservationStocklistEntity>query().lambda() |
|
|
|
|
.eq(DistributionReservationStocklistEntity::getReservationId, reservationId) |
|
|
|
|
.eq(DistributionReservationStocklistEntity::getStocklistId, stockListId) |
|
|
|
|
.apply("stock_list_status in (1,3)") |
|
|
|
|
); |
|
|
|
|
if (ObjectUtils.isNotNull(one)) { |
|
|
|
|
int sum = one.getReservationNum(); |
|
|
|
|
int sum1 = one.getRealityNum(); |
|
|
|
|
if (sum == sum1) { |
|
|
|
|
log.warn("####备货:库存品数量已完成"); |
|
|
|
|
//已完成!
|
|
|
|
|
return 1; |
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
DistributionReservationStocklistEntity distributionReservationStocklistEntity = new DistributionReservationStocklistEntity(); |
|
|
|
|
distributionReservationStocklistEntity.setId(one.getId()); |
|
|
|
|
|
|
|
|
|
if (ObjectUtils.isNotNull(stockupDTO.getPacketBarCode())) { |
|
|
|
|
//扫描包件
|
|
|
|
|
distributionReservationStocklistEntity.setRealityNum(sum1 + 1); |
|
|
|
|
} else if (ObjectUtils.isNotNull(stockupDTO.getPackageNum())) { |
|
|
|
|
int n = stockupDTO.getPackageNum(); |
|
|
|
|
int a = sum - sum1;//待入库数
|
|
|
|
|
if (a == n) { |
|
|
|
|
// 相等
|
|
|
|
|
distributionReservationStocklistEntity.setRealityNum(one.getRealityNum() + n); |
|
|
|
|
} else { |
|
|
|
|
if (n < a) { |
|
|
|
|
distributionReservationStocklistEntity.setRealityNum(one.getRealityNum() + n); |
|
|
|
|
} else { |
|
|
|
|
//库存品失败
|
|
|
|
|
return 4; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//扫码成功
|
|
|
|
|
distributionReservationStocklistService.updateById(distributionReservationStocklistEntity); |
|
|
|
|
return 1; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
//扫码失败
|
|
|
|
|
return 4; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//扫码失败
|
|
|
|
|
return 4; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|