Commit 48386091 authored by honghy's avatar honghy

bug 206 PDA装柜扫描性能不达标

parent eb5e67a0
......@@ -189,6 +189,139 @@ public interface BoxPreloadGoodsMapper extends AbstractMapper<BoxPreloadGoodsDO>
List<BoxPreloadGoodsBackVO> orderPreloaded(@Param("query") PreloadedReq query);
/**
* PDA扫码专用查询
*/
@ResultType(BoxPreloadGoodsBackVO.class)
@Select({
"<script>",
"select ebpg.shipment_id, ",
"ebpg.id, ",
"ebpg.sec_id, ",
"ebpg.order_id, ",
"ebpg.order_item_id, ",
"ebpg.tidan_num, ",
"eo.order_id, ",
"eo.order_no, ",
"eo.transport_id, ",
"(select min(owi.`in_time`) from ecw_order_warehouse_in owi where owi.deleted = 0 and owi.order_id = eo.order_id ) as rucang_time,",
"eo.product_record, ",
"eo.customs_type, ",
"eo.adjust_to_dest_warehouse_id, ",
"eo.warehouse_type, ",
"eo.line_id, ",
"eo.is_external_warehouse, ",
"eo.cost ->> '$.totalWorth' as total_worth, ",
"eo.air_shipment, ",
"eo.status, ",
"eo.abnormal_state, ",
"eo.in_warehouse_state, ",
"eo.shipment_state, ",
"eo.pick_state, ",
"eo.audit_type, ",
"eo.audit_result, ",
"eo.guan_lian_order_status, ",
"eo.unload_time, ",
"eo.container_number, ",
"eo.exception_reason, ",
"eo.package_type as advance_type, ",
"eoi.prod_title_zh, ",
"eoi.prod_title_en, ",
"eoi.box_gauge, ",
"eoi.num, ",
"eoi.quantity, ",
"eoi.worth, ",
"eoi.brand_type, ",
"eoi.brand, ",
"eoi.sea_freight_currency, ",
"eoi.clearance_freight_currency, ",
"eoi.prod_attr_ids, ",
"eoi.warehouse_in_prod_attr_ids, ",
"eoi.fee_type, ",
"if(#{query.lang} = 0, ew_start.title_zh, ew_start.title_en) as start_warehouse_name, ",
"if(#{query.lang} = 0, ew_dest.title_zh, ew_dest.title_en) as dest_warehouse_name, ",
"eoi.unit, ",
"eoi.volume, ",
"eoi.warehouse_in_info, ",
"eoi.weight,",
"eoi.charge_weight, ",
"eoi.charge_volume, ",
"eoi.charge_quantity, ",
"eoi.material,",
"eoi.sea_freight_volume, ",
"eoi.clearance_freight_volume, ",
"IF(#{query.lang} = 0, pd.title_zh, pd.title_en) as brand_name, ",
"ewl.dest_warehouse_id, ",
"ewl.start_warehouse_id,",
"(select count(0) from ecw_order_guanlian t LEFT JOIN ecw_order t1 on t.order_id=t1.order_id LEFT JOIN ecw_order t2 on t.relate_order_id=t2.order_id where (t.order_id = eo.order_id or t.relate_order_id = eo.order_id) and t1.deleted=0 and t2.deleted=0 and t.deleted=0 ) as guanLianOrderCount, ",
"(select count(0) from ecw_order_warehouse_in owi where owi.order_item_id = eoi.order_item_id and owi.deleted = 0 and JSON_LENGTH(owi.order_warehouse_in_details) > 0) as mixCount",
"FROM ecw_box_preload_goods ebpg ",
"INNER JOIN ecw_box_preload_section ebps ON ebpg.sec_id = ebps.id ",
"INNER JOIN ecw_order eo ON eo.order_id = ebpg.order_id ",
"INNER JOIN ecw_order_item eoi ON ebpg.order_item_id = eoi.order_item_id ",
"INNER JOIN ecw_warehouse_line ewl ON eo.line_id = ewl.id ",
"INNER JOIN ecw_warehouse ew_start ON ewl.start_warehouse_id = ew_start.id ",
"INNER JOIN ecw_warehouse ew_dest ON ewl.dest_warehouse_id = ew_dest.id ",
"LEFT JOIN ecw_product_brank pd on eoi.brand = pd.id ",
"WHERE eo.deleted=0 ",
"and eoi.deleted=0 ",
"<when test = 'query.isDel == null'>",
"and ebpg.deleted=0 ",
"</when>",
"<when test = 'query.shipmentId != null'>",
"AND ebpg.shipment_id = #{query.shipmentId}",
"</when>",
"<when test = 'query.isCover != null'>",
"AND ebpg.`is_cover` = #{query.isCover}",
"</when>",
"<when test = 'query.isRemove != null'>",
"AND ebpg.`is_remove` = #{query.isRemove}",
"</when>",
"<when test = 'query.rucangTimeStart != null'>",
"AND eo.`rucang_time` &gt;= #{query.rucangTimeStart}",
"</when>",
"<when test = 'query.rucangTimeEnd != null'>",
"AND eo.`rucang_time` &lt;= #{query.rucangTimeEnd}",
"</when>",
"<when test = 'query.productRecord != null'>",
"AND eo.`product_record` = #{query.productRecord}",
"</when>",
"<when test = 'query.orderId != null'>",
"AND eo.`order_id` = #{query.orderId}",
"</when>",
"<when test = 'query.orderNo != null and query.orderNo != \"\" '>",
"AND eo.`order_no` like concat('%',concat(#{query.orderNo},'%'))",
"</when>",
"<when test = 'query.customsType != null '>",
"AND eo.`customs_type` = #{query.customsType}",
"</when>",
"<when test = 'query.weightRatioMin != null '>",
"AND eo.`weight_ratio` &gt;= #{query.weightRatioMin}",
"</when>",
"<when test = 'query.weightRatioMax != null '>",
"AND eo.`weight_ratio` &lt;= #{query.weightRatioMax} ",
"</when>",
"<when test = 'query.startWarehouseId != null'>",
"AND ewl.`start_warehouse_id` = #{query.startWarehouseId}",
"</when>",
"<when test = 'query.destWarehouseIdList != null and query.destWarehouseIdList.size() > 0'>",
"AND ewl.`dest_warehouse_id` in ",
"<foreach item='id' index='index' collection='query.destWarehouseIdList' open='(' separator=',' close=')'>#{id}</foreach>",
"</when>",
"<when test = 'query.itemName != null and query.itemName != \"\" '>",
"AND (eoi.`prod_title_zh` like concat('%',concat(#{query.itemName},'%')) or eoi.`prod_title_en` like concat('%',concat(#{query.itemName},'%')) )",
"</when>",
"<when test = 'query.shipmentIdList != null and query.shipmentIdList.size() > 0'>",
"AND ebpg.`shipment_id` in ",
"<foreach item='id' index='index' collection='query.shipmentIdList' open='(' separator=',' close=')'>#{id}</foreach>",
"</when>",
"order by ebpg.create_time",
"</script>"
})
List<BoxPreloadGoodsBackVO> orderPreloadedV2(@Param("query") PreloadedReq query);
// 从orderPreloaded copy过来的,主要是想要属性都保持一致。
@ResultType(BoxPreloadGoodsBackVO.class)
......
......@@ -284,6 +284,14 @@ public interface BoxService extends IService<BoxDO> {
*/
BoxCabinetLoadVO getBoxCabinetDetail(Long shipmentId);
/**
* 获取装柜详情(PDA扫描专用)
*
* @param shipmentId ID
* @return
*/
BoxCabinetLoadVO getBoxCabinetDetailV2(Long shipmentId);
/**
* 获取卸柜详情
*
......
......@@ -2830,6 +2830,84 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
return boxCabinetLoadVO;
}
/**
* 获取装柜详情(PDA扫描专用)
* @param shipmentId ID
* @return
*/
@Override
public BoxCabinetLoadVO getBoxCabinetDetailV2(Long shipmentId) {
List<BoxLoadSectionBackVO> boxLoadDetailBackVO = boxPreloadGoodsService.loadSecGoodsListV2(shipmentId);
/*查询所有库区库域信息 20250116 影响性能屏蔽
List<WarehouseAreaDO> areaList = warehouseAreaService.list(new LambdaQueryWrapper<>());
List<WarehouseAreaPositionDO> positionList = warehouseAreaPositionService.list(new LambdaQueryWrapper<>());
for (BoxLoadSectionBackVO sectionBackVO : boxLoadDetailBackVO) {
List<BoxLoadOrderVO> orderList = sectionBackVO.getSectionOrderList();
if (CollectionUtil.isEmpty(orderList)) continue;
for (BoxLoadOrderVO orderVO : orderList) {
Long orderId = orderVO.getOrderId();
List<OrderLocationDO> orderLocationLists = orderLocationService.getOrderLocationListByOrderId(orderId);
//按照订单纬度返回信息,分组
Map<String, List<OrderLocationDO>> positionMap = orderLocationLists.stream()
.collect(Collectors.groupingBy(
t -> t.getOrderId() + "_" +
// t.getOrderItemId() + "_" +
t.getWareId() + "_" + t.getAreaId() + "_" + t.getLocationId()));
List<OrderLocationDO> locationList = new ArrayList<>();
for (Map.Entry<String, List<OrderLocationDO>> entry : positionMap.entrySet()) {
List<OrderLocationDO> orderLocationDOList = entry.getValue();
locationList.add(orderLocationDOList.get(0));
}
String positionNo = matchLocation(areaList, positionList, locationList);
orderVO.setPositionNo(positionNo);
orderVO.setOrderLocationList(OrderLocationConvert.INSTANCE.convertList(locationList));
List<BoxPreloadGoodsBackVO> orderGoodsItemList = orderVO.getGoodsList();
for (BoxPreloadGoodsBackVO itemVO : orderGoodsItemList) {
matchItemLocation(areaList, positionList, locationList, itemVO);
}
}
}
*/
BoxCabinetLoadVO boxCabinetLoadVO = new BoxCabinetLoadVO();
boxCabinetLoadVO.setLoadDetail(boxLoadDetailBackVO);
BoxBaseBackVO boxBaseBackVO = getBaseBoxInfo(shipmentId);
boxCabinetLoadVO.setBoxInfo(boxBaseBackVO);
BoxCabinetDO boxCabinetDO = getBoxCabinetDO(shipmentId);
if (boxCabinetDO != null) {
BoxCabinetBackVO boxCabinetBackVO = BoxCabinetConvert.INSTANCE.convert(boxCabinetDO);
boxCabinetBackVO.setOperator(getUserName(boxCabinetDO.getCreator()));
boxCabinetLoadVO.setCabinetInfo(boxCabinetBackVO);
}
BoxApprovalDO cabinetSplitApproval = boxApprovalService.getOne(new LambdaQueryWrapperX<BoxApprovalDO>()
.eq(BoxApprovalDO::getShipmentId, shipmentId)
.eq(BoxApprovalDO::getApprovalType, BoxApprovalTypeEnum.SPLIT_ORDER.getType())
.orderByDesc(BoxApprovalDO::getId)
.last("limit 1")
);
if (cabinetSplitApproval != null) {
boxCabinetLoadVO.setCabinetSplitInfo(BoxApprovalConvert.INSTANCE.convert(cabinetSplitApproval));
}
if (TransportTypeEnum.AIR.getType().equals(boxBaseBackVO.getTransportType())) {
for (BoxLoadSectionBackVO backVO : boxLoadDetailBackVO) {
List<BoxLoadOrderVO> loadOrderList = backVO.getSectionOrderList();
if (CollectionUtil.isNotEmpty(loadOrderList)) {
loadOrderList.sort(Comparator.comparing(BoxLoadOrderVO::getPkgNum, Comparator.nullsLast(String::compareTo)));
}
}
}
return boxCabinetLoadVO;
}
@Override
public BoxCabinetLoadVO getBoxCabinetUnloadDetail(Long shipmentId) {
List<BoxLoadSectionBackVO> boxLoadDetailBackVO = boxPreloadGoodsService.boxGoodsDetail(shipmentId);
......
package cn.iocoder.yudao.module.shipment.service.boxPreloadGoods;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.framework.mybatis.core.service.IService;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.service.IService;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.order.dal.dataobject.order.OrderDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderItem.OrderItemDO;
import cn.iocoder.yudao.module.order.vo.order.OrderPreloadReq;
import cn.iocoder.yudao.module.order.vo.orderLocation.OrderLocationCreateReqVO;
import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxPreloadGoodsDO;
import cn.iocoder.yudao.module.shipment.vo.box.BoxGoodsStatistics;
import cn.iocoder.yudao.module.shipment.vo.box.PreloadResultVO;
import cn.iocoder.yudao.module.shipment.vo.boxPreloadGoods.*;
import cn.iocoder.yudao.module.shipment.vo.boxPreloadSection.BoxLoadDetailBackVO;
import cn.iocoder.yudao.module.shipment.vo.boxPreloadSection.BoxLoadSectionBackVO;
import cn.iocoder.yudao.module.shipment.vo.boxPreloadSection.BoxPreloadSectionBackVO;
import cn.iocoder.yudao.module.shipment.vo.boxPreloadSection.BoxPreloadSectionDetailVO;
import javax.validation.Valid;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* 预装货物 Service 接口
*
......@@ -101,6 +103,13 @@ public interface BoxPreloadGoodsService extends IService<BoxPreloadGoodsDO> {
*/
List<BoxLoadSectionBackVO> loadSecGoodsList(Long shipmentId);
/**
* 获得装柜部分列表(PDA扫描专用)
* @param shipmentId 出货单ID
* @return
*/
List<BoxLoadSectionBackVO> loadSecGoodsListV2(Long shipmentId);
/**
* 修改isRemove
* @param shipmentId
......
......@@ -90,6 +90,13 @@ public class MyBoxController {
return success(boxService.getBoxCabinetDetail(shipmentId));
}
@GetMapping("/cabinetDetailV2")
@ApiImplicitParam(name = "shipmentId", value = "ID", required = true, example = "1", dataTypeClass = Long.class)
@ApiOperation("获得装柜详情(PDA扫描)")
public CommonResult<BoxCabinetLoadVO> getBoxCabinetDetailV2(@RequestParam("shipmentId") Long shipmentId) {
return success(boxService.getBoxCabinetDetailV2(shipmentId));
}
@GetMapping("/cabinetUnloadDetail")
@ApiImplicitParam(name = "shipmentId", value = "ID", required = true, example = "1", dataTypeClass = Long.class)
@ApiOperation("获得卸柜详情")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment