Browse Source

自提订单列表查询优化

master
汤建军 10 months ago
parent
commit
177752b3e0
  1. 7
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistrilbutionBillStockController.java
  2. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillStockMapper.java
  3. 10
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillStockMapper.xml
  4. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillStockServiceImpl.java

7
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistrilbutionBillStockController.java

@ -85,7 +85,12 @@ public class DistrilbutionBillStockController extends BladeController {
@GetMapping("/billOrderDetail")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入distrilbutionBillLading")
public R<IPage<DistributionBillOrderVO>> getBillOrderDetail(@ApiIgnore @RequestParam Map<String, Object> distrilbutionBillStock, Query query) {
public R getBillOrderDetail(@ApiIgnore @RequestParam Map<String, Object> distrilbutionBillStock, Query query) {
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if (Func.isEmpty(myCurrentWarehouse)){
return R.fail(403,"未授权!!!");
}
distrilbutionBillStock.put("warehouseId",myCurrentWarehouse.getId());
IPage<DistributionBillOrderVO> detail = distrilbutionBillStockService.getBillOrderDetail(distrilbutionBillStock,Condition.getPage(query));
return R.data(detail);
}

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

@ -57,7 +57,7 @@ public interface DistrilbutionBillStockMapper extends BaseMapper<DistrilbutionBi
*/
List<DistrilbutionBillStockExcel> exportDistrilbutionBillStock(@Param("ew") Wrapper<DistrilbutionBillStockEntity> queryWrapper);
IPage<DistributionBillOrderVO> getBillOrderDetail(IPage page,@Param("param") DistrilbutionBillStockEntity distrilbutionBillStock);
IPage<DistributionBillOrderVO> getBillOrderDetail(IPage page,@Param("param") DistrilbutionBillStockDTO distrilbutionBillStock);
IPage<DistributionBillOrderPackVO> getBillOrderPack(IPage<Object> page,@Param("param") DistrilbutionBillStockDTO billStock);

10
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillStockMapper.xml

@ -132,9 +132,9 @@
(select IFNULL(sum(quantity) ,0) from logpm_distribution_bill_lading_scan
where stock_article_id = ldsa.id AND bill_lading_id = #{param.billLadingId} AND is_deleted = 0 ) pick_up_quantity,
CASE
WHEN (SELECT COUNT(id) FROM logpm_distribution_bill_lading_scan WHERE stock_article_id = ldsa.id AND is_deleted = 0) - (SELECT COUNT(id) FROM logpm_distrilbution_bill_package WHERE stock_article_id = ldsa.id AND packet_bar_status IN (1,3) AND is_deleted = 0) = 0 THEN '20'
WHEN (SELECT COUNT(id) FROM logpm_distribution_bill_lading_scan WHERE stock_article_id = ldsa.id AND is_deleted = 0) - (SELECT COUNT(id) FROM logpm_distrilbution_bill_package WHERE stock_article_id = ldsa.id AND packet_bar_status IN (1,3) AND is_deleted = 0) > 0 THEN '10'
WHEN (SELECT COUNT(id) FROM logpm_distribution_bill_lading_scan WHERE stock_article_id = ldsa.id AND is_deleted = 0) - (SELECT COUNT(id) FROM logpm_distrilbution_bill_package WHERE stock_article_id = ldsa.id AND packet_bar_status IN (1,3) AND is_deleted = 0) &lt; 0 THEN '30'
WHEN (SELECT COUNT(id) FROM logpm_distribution_bill_lading_scan WHERE stock_article_id = ldsa.id AND is_deleted = 0) - (SELECT COUNT(id) FROM logpm_distrilbution_bill_package WHERE stock_article_id = ldsa.id AND packet_bar_status IN (1,3) AND is_deleted = 0) = 0 THEN '30'
WHEN (SELECT COUNT(id) FROM logpm_distribution_bill_lading_scan WHERE stock_article_id = ldsa.id AND is_deleted = 0) = 0 THEN '10'
WHEN (SELECT COUNT(id) FROM logpm_distribution_bill_lading_scan WHERE stock_article_id = ldsa.id AND is_deleted = 0) - (SELECT COUNT(id) FROM logpm_distrilbution_bill_package WHERE stock_article_id = ldsa.id AND packet_bar_status IN (1,3) AND is_deleted = 0) &lt; 0 THEN '20'
END AS conditions,
(select GROUP_CONCAT(DISTINCT ldpl.material_name )
from logpm_distribution_parcel_list ldpl
@ -156,9 +156,9 @@
logpm_distrilbution_bill_lading AS ldbl
LEFT JOIN logpm_distrilbution_bill_stock ldbs ON ldbs.bill_lading_id = ldbl.id
LEFT JOIN logpm_distribution_stock_article ldsa on ldbs.stock_article_id = ldsa.id
LEFT JOIN logpm_distribution_bill_lading_scan AS ldbls ON ldbl.id = ldbls.bill_lading_id AND ldbs.stock_article_id = ldbls.stock_article_id
LEFT JOIN logpm_distribution_bill_lading_scan AS ldbls ON ldbl.id = ldbls.bill_lading_id AND ldbs.stock_article_id = ldbls.stock_article_id AND ldbls.warehouse_id = ldbl.warehouse_id
<where>
ldbs.is_deleted = 0 and ldbs.bill_lading_id = #{param.billLadingId} and ldbs.order_status in (1,3)
ldbs.is_deleted = 0 and ldbs.bill_lading_id = #{param.billLadingId} and ldbs.order_status in (1,3) AND ldbl.warehouse_id = #{param.warehouseId}
</where>
GROUP BY ldbl.id,ldbs.stock_article_id
</select>

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillStockServiceImpl.java

@ -87,7 +87,7 @@ public class DistrilbutionBillStockServiceImpl extends BaseServiceImpl<Distrilbu
*/
@Override
public IPage<DistributionBillOrderVO> getBillOrderDetail(Map<String, Object> distrilbutionBillStock, IPage page) {
DistrilbutionBillStockEntity billStock = JSON.parseObject(JSON.toJSONString(distrilbutionBillStock), DistrilbutionBillStockEntity.class);
DistrilbutionBillStockDTO billStock = JSON.parseObject(JSON.toJSONString(distrilbutionBillStock), DistrilbutionBillStockDTO.class);
IPage<DistributionBillOrderVO> billOrderDetail = baseMapper.getBillOrderDetail(page, billStock);
billOrderDetail.getRecords().forEach( i ->{
if(StringUtils.isNotBlank(i.getStockupStatus())){

Loading…
Cancel
Save