Browse Source

修改配送单查询

training
caoyizhong 1 year ago
parent
commit
1518d434ab
  1. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.java
  2. 8
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml
  3. 84
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.java

@ -234,4 +234,6 @@ public interface DistributionReservationMapper extends BaseMapper<DistributionRe
* @return
*/
List<DistributionParcelNumberVO> selectReservationZeroOrderDetail(@Param("stockArticleId") Long id,@Param("reservationId") Long reservationId);
List<String> getStockListAllocation(@Param("stockListId")Long stockListId, @Param("reservationId")Long reservationId);
}

8
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml

@ -933,6 +933,14 @@
and ldrp.stock_article_id = #{stockArticleId}
and lwug.id is not null
</select>
<select id="getStockListAllocation" resultType="string">
select CONCAT(lwug.area_title,'-',lwug.shelf_title,'-',lwug.allocation_title)
from logpm_distribution_reservation_stocklist ldrs
LEFT JOIN logpm_distribution_stock_list ldsi on ldsi.id = ldrs.stocklist_id
left join logpm_warehouse_updown_goods lwug on lwug.association_id = ldsi.material_id and lwug.association_type = '4'
and lwug.incoming_batch = ldsi.incoming_batch and ldsi.market_id = lwug.market_id
where ldrs.reservation_id = #{reservationId} and ldsi.id = #{stockListId}
</select>
<select id="getStockupAreaByStockArticleIdAndReservationId" resultType="java.lang.String">
select ldss.stockup_area

84
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java

@ -4102,6 +4102,12 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
map.put("定制品集合", spaclOrderList);
map.put("定制品合计", spaclOrderList.stream().mapToInt(map1 -> Integer.parseInt(map1.get("数量").toString())).sum());
// 通过预约单查询预约下面的订单 --1 或者 库存品 --2
List<Map<String, Object>> spaclStockList = buildSpaclOrders(distributionReservationEntity, 2);
map.put("库存品集合", spaclStockList);
map.put("库存品合计", spaclStockList.stream().mapToInt(map1 -> Integer.parseInt(map1.get("数量").toString())).sum());
map.put("备注", distributionReservationEntity.getRemarks());
@ -4162,6 +4168,11 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
map.put("定制品集合", spaclOrderList);
map.put("定制品合计", spaclOrderList.stream().mapToInt(map1 -> Integer.parseInt(map1.get("数量").toString())).sum());
// 通过预约单查询预约下面的订单 --1 或者 库存品 --2
List<Map<String, Object>> spaclStockList = buildSpaclOrders(distributionReservationEntity, 2);
map.put("库存品集合", spaclStockList);
map.put("库存品合计", spaclStockList.stream().mapToInt(map1 -> Integer.parseInt(map1.get("数量").toString())).sum());
map.put("备注", distributionReservationEntity.getRemarks());
}
@ -4209,12 +4220,19 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
temp.put("合同号", distributionStockArticleEntity.getOrderCode());
temp.put("产品名称", distributionStockArticleEntity.getDescriptionGoods());
//todo 单位是否需要查询物料表
temp.put("单位", "件");
temp.put("单位", getUnit(distributionStockArticleEntity.getId()));
temp.put("数量", distributionReservationStockarticleEntity.getReservationNum());
temp.put("备货区", null);
//todo 这里还没完成
temp.put("货位", null);
temp.put("备货区", getStockupArea(distributionReservationEntity.getId()));
//todo 这里还没完成
//通过订单id和预约id查询对应包件的库位信息
List<String> allocationStrList = distributionReservationMapper.getAllocationByStockArticleIdAndReservationId(distributionStockArticleEntity.getId(), distributionReservationEntity.getId());
if(!allocationStrList.isEmpty()){
String allocationStr = StringUtils.join(allocationStrList, ",");
temp.put("货位", allocationStr);
}else{
temp.put("货位", null);
}
result.add(temp);
}
@ -4222,14 +4240,70 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
break;
case 2:
distributionReservationStocklistEntities = distributionReservationStocklistService.lambdaQuery().eq(DistributionReservationStocklistEntity::getReservationId, distributionReservationEntity.getId()).list();
if(distributionReservationStocklistEntities.isEmpty()){
return null;
}
// 取值
for (DistributionReservationStocklistEntity reservationStocklistEntity : distributionReservationStocklistEntities) {
Map<String, Object> temp = new HashMap<>();
//查询库存品信息
DistributionStockListEntity distributionStockListEntity = distributionStockListMapper.selectById(reservationStocklistEntity.getStocklistId());
if(ObjectUtils.isNull(distributionStockListEntity)){
continue;
}
temp.put("合同号", distributionStockListEntity.getOrderCode());
temp.put("产品名称", distributionStockListEntity.getDescriptionGoods());
//todo 单位是否需要查询物料表
temp.put("单位",Optional.ofNullable(distributionStockListEntity.getCargoUnit()).orElse(null) );
temp.put("数量", reservationStocklistEntity.getReservationNum());
temp.put("备货区", getStockupArea(distributionReservationEntity.getId()));
//todo 这里还没完成
List<String> allocationList = distributionReservationMapper.getStockListAllocation(distributionStockListEntity.getId(),distributionReservationEntity.getId());
if(!allocationList.isEmpty()){
String allocationStr = StringUtils.join(allocationList, ",");
temp.put("货位", allocationStr);
}else{
temp.put("货位", null);
}
result.add(temp);
}
break;
default:
}
return result;
}
/**
* 查询备货区
* @param reservationId
* @return
*/
private String getStockupArea(Long reservationId){
List<DistributionStockupInfoEntity> list = distributionStockupInfoService.list(Wrappers.<DistributionStockupInfoEntity>query().lambda().eq(DistributionStockupInfoEntity::getReservationId, reservationId));
if(!list.isEmpty()){
DistributionStockupEntity distributionStockupEntity = distributionStockupMapper.selectById(list.get(0).getStockupId());
return ObjectUtils.isNotNull(distributionStockupEntity) ? distributionStockupEntity.getStockupArea() : "无";
}else {
return "无";
}
}
/**
* 查询物料单位
* @param stockArticleId
* @return
*/
private String getUnit(Long stockArticleId){
List<DistributionParcelListEntity> list = distributionParcelListService.list(Wrappers.<DistributionParcelListEntity>query().lambda().eq(DistributionParcelListEntity::getStockArticleId, stockArticleId));
if(!list.isEmpty()){
return list.stream().map(ii -> ii.getMaterialUnit()).collect(Collectors.joining(","));
}else {
return "无";
}
}
}

Loading…
Cancel
Save