Commit 2d7e0265 authored by liuzeheng's avatar liuzeheng

Merge branch 'master' into dev

# Conflicts:
#	yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/admin/user/vo/UserBackVO.java
#	yudao-module-shipment/yudao-module-shipment-core/src/main/java/cn/iocoder/yudao/module/shipment/service/box/BoxServiceImpl.java
parents d1deecee ffd169b3
......@@ -59,6 +59,7 @@ public class UserBackVO {
@ApiModelProperty(value = "最后登录时间")
private Date loginDate;
//lanbm 2024-06-16 update
@ExcelProperty("创建时间")
//lanbm 2024-05-15 修改显示BUG
//@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
......
package cn.iocoder.yudao.module.member.vo.member;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import java.util.*;
import io.swagger.annotations.*;
......@@ -50,7 +51,9 @@ public class MemberBackVO {
private String loginIp;
@ExcelProperty("最后登录时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
//lanbm 2024-05-15 修改显示BUG
//@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "最后登录时间")
private Date loginDate;
......@@ -59,7 +62,9 @@ public class MemberBackVO {
private String backLetterImg;
@ExcelProperty("创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
//lanbm 2024-05-15 修改显示BUG
//@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
......
......@@ -923,7 +923,8 @@
ecw_order_item eoi
left join ecw_order o on eoi.order_id = o.order_id
left join ecw_currency ec on eoi.sea_freight_currency = ec.id
and eoi.deleted = 0 and o.deleted = 0
where 1=1 and eoi.deleted = 0 and o.deleted = 0
<include refid="myOrderQuery">
</include>
</select>
......
......@@ -4,8 +4,11 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQuery;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.order.dal.dataobject.order.OrderDO;
import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxMergePkgDO;
import cn.iocoder.yudao.module.shipment.dal.dataobject.boxOrderCheckInfo.BoxOrderCheckInfoDO;
import cn.iocoder.yudao.module.shipment.dto.BoxMergePkgPageDto;
import cn.iocoder.yudao.module.shipment.vo.box.BoxOrderInstallVO;
import cn.iocoder.yudao.module.shipment.vo.boxMergePkg.BoxMergePkgPDAListVO;
import cn.iocoder.yudao.module.shipment.vo.boxMergePkg.BoxMergePkgQueryVO;
import cn.iocoder.yudao.module.shipment.vo.boxMergePkg.BoxMergePkgWebVO;
......@@ -96,14 +99,46 @@ public interface BoxMergePkgMapper extends AbstractMapper<BoxMergePkgDO> {
"</script>")
BoxMergePkgDO getMergePkgInfoById(@Param("id") Long id);
// @Select("<script>" +
// "select t.order_id,t.order_no,t.product_record,t.sum_num,t.sum_volume,t.sum_weight,t.sum_quantity,t1.tally_time ,t.customs_type " +
// "from ecw_box_preload_goods t2 left join ecw_order t on t2.order_id=t.order_id " +
// "LEFT JOIN ecw_box_tally t1 on t.order_id=t1.order_id and t1.deleted=0 and t1.shipment_id=#{shipmentId} " +
// "where 1=1 and not exists (select 1 from ecw_box_pkg_order a where a.order_id=t.order_id and a.deleted=0) " +
// "and t.deleted=0 and t2.deleted=0 and t.transport_id in (3,4) and t2.shipment_id=#{shipmentId} group by t2.order_id" +
// "</script>")
@Select("<script>" +
"select t.order_id,t.order_no,t.product_record,t.sum_num,t.sum_volume,t.sum_weight,t.sum_quantity,t1.tally_time ,t.customs_type " +
"from ecw_box_preload_goods t2 left join ecw_order t on t2.order_id=t.order_id " +
"LEFT JOIN ecw_box_tally t1 on t.order_id=t1.order_id and t1.deleted=0 and t1.shipment_id=#{shipmentId} " +
"where 1=1 " +
"<when test = 'unInstallOrderList != null'>"+
"AND t2.order_id in"+
"<foreach item='orderid' index='index' collection='unInstallOrderList' open='(' separator=',' close=')'>"+
"#{orderid}"+
"</foreach> "+
"</when>"+
"and t.deleted=0 and t2.deleted=0 and t.transport_id in (3,4) and t2.shipment_id=#{shipmentId} group by t2.order_id" +
"</script>")
IPage<BoxMergePkgWebVO> getUnPkgPage(IPage<BoxMergePkgWebVO> mpPage,@Param("shipmentId") Long shipmentId,@Param("unInstallOrderList") List<Long> unInstallOrderList);
@Select("<script>" +
"select t.order_id,t.order_no,t.product_record,t.sum_num,t.sum_volume,t.sum_weight,t.sum_quantity,t1.tally_time ,t.customs_type " +
"from ecw_box_preload_goods t2 left join ecw_order t on t2.order_id=t.order_id " +
"LEFT JOIN ecw_box_tally t1 on t.order_id=t1.order_id and t1.deleted=0 and t1.shipment_id=#{shipmentId} " +
"where 1=1 and not exists (select 1 from ecw_box_pkg_order a where a.order_id=t.order_id and a.deleted=0) " +
"where 1=1 " +
"<when test = 'installOrderList != null'>"+
"AND t2.order_id not in"+
"<foreach item='orderid' index='index' collection='installOrderList' open='(' separator=',' close=')'>"+
"#{orderid}"+
"</foreach> "+
"</when>"+
"and t.deleted=0 and t2.deleted=0 and t.transport_id in (3,4) and t2.shipment_id=#{shipmentId} group by t2.order_id" +
"</script>")
IPage<BoxMergePkgWebVO> getUnPkgPage(IPage<BoxMergePkgWebVO> mpPage,@Param("shipmentId") Long shipmentId);
IPage<BoxMergePkgWebVO> getUnPkgPage2(IPage<BoxMergePkgWebVO> mpPage,@Param("shipmentId") Long shipmentId,@Param("installOrderList") List<Long> installOrderList);
@Select("<script>" +
"select t.order_id,t.order_no,t.product_record,t.sum_num,t.sum_volume,t.sum_weight,t.sum_quantity,t1.tally_time, " +
......@@ -143,4 +178,106 @@ public interface BoxMergePkgMapper extends AbstractMapper<BoxMergePkgDO> {
"</when>"+
"</script>")
IPage<BoxMergePkgPDAListVO> getBoxMergePkgList4PDAPage(IPage<BoxMergePkgPDAListVO> mpPage, @Param("warehouseIdList") Set<Long> warehouseIds,@Param("selfNo") String selfNo);
@Select("<script>" +
"SELECT " +
" ci.order_id as orderId, " +
"ci.order_num_code as orderNumCode FROM " +
" ecw_box_order_check_info ci " +
"LEFT JOIN ecw_box_pkg_order pk ON pk.order_id = ci.order_id AND ci.deleted = 0 " +
"WHERE ci.shipment_id = #{shipmentId} AND ci.deleted = 0 AND ci.type = 1 " +
"<when test = 'orderId != null'>"+
"and ci.order_id = #{orderId} " +
"</when>"+
" GROUP BY ci.order_num_code " +
"</script>")
List<BoxOrderCheckInfoDO> getInstallBoxByShipmentId(@Param("shipmentId") Long shipmentId,@Param("orderId") Long orderId);
@Select("<script>" +
"SELECT\n" +
" t.order_id,\n" +
" t.order_no,\n" +
" t.product_record,\n" +
"\t t.sum_num,\n" +
"\t t.sum_volume,\n" +
"\t t.sum_weight,\n" +
"\t t.sum_quantity,\n" +
"\t t1.tally_time,\n" +
"\t t.customs_type \n" +
"FROM \n" +
"\t ecw_box_preload_goods t2\n" +
"\t LEFT JOIN ecw_order t ON t2.order_id = t.order_id\n" +
"\t LEFT JOIN ecw_box_tally t1 ON t.order_id = t1.order_id \n" +
"\t AND t1.deleted = 0 \n" +
"\t AND t1.shipment_id = #{shipmentId} \n" +
"\t\n" +
"WHERE\n" +
"\t 1 = 1 \n" +
" \t AND EXISTS ( SELECT 1 FROM ecw_box_pkg_order a WHERE a.order_id = t.order_id AND a.deleted = 0 ) \n" +
" AND t2.order_id NOT in ( " +
" SELECT\n" +
" ci.order_id \n" +
" FROM\n" +
" ecw_box_order_check_info ci\n" +
" LEFT JOIN ecw_box_pkg_order pk ON pk.order_id = ci.order_id AND ci.deleted = 0 \n" +
" WHERE ci.shipment_id = #{shipmentId} AND ci.deleted = 0 AND ci.type = 1 GROUP BY ci.order_num_code\n" +
" ) " +
"\t AND t.deleted = 0 \n" +
"\t AND t2.deleted = 0 \n" +
"\t AND t.transport_id IN ( 3, 4 ) \n" +
"\t AND t2.shipment_id = #{shipmentId} group by t2.order_id "+
"</script>")
List<BoxMergePkgWebVO> getNotInPkgOrderByShipmentId(@Param("shipmentId") Long shipmentId,@Param("orderIds") List<Long> orderIds);
@Select("<script>" +
"select t2.order_id,o.order_no, o.sum_num , case WHEN o.sum_num >1 THEN 1 ELSE 0 END as boxNumMoreOne from ecw_box_preload_goods t2 \n" +
" LEFT JOIN ecw_order o ON o.order_id = t2.order_id AND o.deleted=0 \n" +
" where 1=1 and t2.deleted=0 and t2.shipment_id=#{shipmentId} group by t2.order_id " +
"</script>")
List<BoxOrderInstallVO> getBoxOrderInstallVo(Long shipmentId);
@Select("<script>" +
"SELECT\n" +
"\t t.order_id,\n" +
"\t t.order_no,\n" +
"\t t.product_record,\n" +
"\t t.sum_num,\n" +
"\t t.sum_volume,\n" +
"\t t.sum_weight,\n" +
"\t t.sum_quantity,\n" +
"\t t.customs_type \n" +
"FROM \n" +
"\tecw_box_preload_goods t2\n" +
"LEFT JOIN ecw_order t ON t2.order_id = t.order_id\t\n" +
"LEFT JOIN ecw_box_pkg_order a ON a.order_id = t2.order_id AND a.deleted = 0\n" +
"WHERE 1=1 \n" +
"AND t.deleted = 0 \n" +
"\tAND t2.deleted = 0 \n" +
"\tAND t.transport_id IN ( 3, 4 ) " +
"\tAND t2.shipment_id = #{shipmentId} " +
"<when test = 'orderIds != null'>"+
"AND a.order_id in"+
"<foreach item='orderid' index='index' collection='orderIds' open='(' separator=',' close=')'>"+
"#{orderid}"+
"</foreach> "+
"</when>"+
" group by t2.order_id "+
"</script>")
List<BoxMergePkgWebVO> getAllBoxPgkOrder(@Param("shipmentId") Long shipmentId,@Param("orderIds") List<Long> orderIds);
@Select("<script>" +
"SELECT " +
" ci.order_id as orderId, " +
"ci.order_num_code as orderNumCode FROM " +
" ecw_box_order_check_info ci " +
"LEFT JOIN ecw_box_pkg_order pk ON pk.order_id = ci.order_id AND ci.deleted = 0 " +
"WHERE ci.shipment_id = #{shipmentId} AND ci.deleted = 0 AND ci.type = 1 " +
"<when test = 'orderIds != null'>"+
"AND ci.order_id in"+
"<foreach item='orderid' index='index' collection='orderIds' open='(' separator=',' close=')'>"+
" #{orderid} "+
"</foreach> "+
"</when>"+
" GROUP BY ci.order_num_code " +
"</script>")
List<BoxOrderCheckInfoDO> getAlllBoxOrderCheck(@Param("shipmentId") Long shipmentId,@Param("orderIds") List<Long> orderIds);
}
......@@ -47,4 +47,7 @@ public interface BoxOrderCheckInfoMapper extends AbstractMapper<BoxOrderCheckInf
return null;
}
List<BoxOrderCheckInfoDO> getBoxOrderCheckInfoByShipIdAndOrerId(Long shipmentId, Long orderId) ;
}
......@@ -975,6 +975,7 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
.orderByDesc(BoxArrivalAirDO::getId)
.last("limit 1")
);
abnormalCount = abnormalList.stream()
.filter(t -> t.getOpStep().equals(AbnormalStepAirEnum.ARRIVAL.getStep()))
.count();
......
......@@ -45,6 +45,7 @@ import cn.iocoder.yudao.module.shipment.service.boxOrderCheckInfo.BoxOrderCheckI
import cn.iocoder.yudao.module.shipment.service.boxPkgOrder.BoxPkgOrderService;
import cn.iocoder.yudao.module.shipment.service.boxPreloadGoods.BoxPreloadGoodsService;
import cn.iocoder.yudao.module.shipment.vo.box.BoxGoodsStatistics;
import cn.iocoder.yudao.module.shipment.vo.box.BoxOrderInstallVO;
import cn.iocoder.yudao.module.shipment.vo.boxMergePkg.*;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -221,12 +222,139 @@ public class BoxMergePkgServiceImpl extends AbstractService<BoxMergePkgMapper, B
return boxMergePkgMapper.selectList(query);
}
// @Override
// public PageResult<BoxMergePkgWebVO> getUnPkgPage(PageVO page,Long shipmentId) {
// PageResult<BoxMergePkgWebVO> pageResult = new PageResult<>();
// //全部要装的箱子
// List<BoxOrderCheckInfoDO> tagList = new ArrayList<>();
// List<OrderDO> orderList = boxMergePkgMapper.getBoxOrderCheckByShipmentId(shipmentId) ;
// List<BoxOrderCheckInfoDO> installBox = boxMergePkgMapper.getInstallBoxByShipmentId(shipmentId,null) ;
// List<BoxMergePkgWebVO> installPkgList = boxMergePkgMapper.getNotInPkgOrderByShipmentId(shipmentId) ;
// List<BoxOrderCheckInfoDO> installList = new ArrayList<>() ;
//
//// if(CollectionUtil.isNotEmpty(installBox)){
//// installList.addAll(installBox.stream().map(s-> s.getOrderId()).collect(Collectors.toList())) ;
//// }
//
// if(CollectionUtil.isNotEmpty(installPkgList)){
// installPkgList.forEach(o->{
// OrderDO order = new OrderDO() ;
// BeanUtils.copyProperties(o,order);
// List<BoxOrderCheckInfoDO> tags = boxOrderCheckInfoService.getOrderTagNumList(order);
// installList.addAll(tags) ;
// });
// }
// if(CollectionUtil.isNotEmpty(orderList)){
// orderList.forEach(o->{
// OrderDO order = new OrderDO() ;
// BeanUtils.copyProperties(o,order);
// List<BoxOrderCheckInfoDO> tags = boxOrderCheckInfoService.getOrderTagNumList(order);
// tagList.addAll(tags) ;
// });
// }
// //全部实装
// List<BoxOrderCheckInfoDO> allInstallList = new ArrayList<>() ;
// allInstallList.addAll(installList);
// allInstallList.addAll(installBox) ;
// //还未装的箱子 ,以订单号加 "-" 区分的数据
// List<BoxOrderCheckInfoDO> unInstall = new ArrayList<>() ;
// if(CollectionUtil.isNotEmpty(allInstallList)){
// List<BoxOrderCheckInfoDO> collect = tagList.stream().filter(item -> allInstallList.stream().anyMatch(ins -> item.getOrderNumCode().equals(ins.getOrderNumCode()))) .collect(Collectors.toList());
// unInstall.addAll(collect) ;
// }
//
// List<Long> unInstallOrderList = new ArrayList<>() ;
// if(CollectionUtil.isNotEmpty(unInstall)){
// unInstallOrderList = unInstall.stream().map(s-> s.getOrderId()).collect(Collectors.toList());
// }else{
// unInstallOrderList=null ;
// }
// IPage page1 = new PageDTO(page.getPage(),page.getRows());
// IPage<BoxMergePkgWebVO> boxMergePkgWebVOS = boxMergePkgMapper.getUnPkgPage(page1,shipmentId,unInstallOrderList);
//
// getUnOrderInfoPageResult(pageResult, boxMergePkgWebVOS,shipmentId);
// return pageResult;
// }
@Override
public PageResult<BoxMergePkgWebVO> getUnPkgPage(PageVO page,Long shipmentId) {
PageResult<BoxMergePkgWebVO> pageResult = new PageResult<>();
//全部要装的箱子
List<BoxOrderCheckInfoDO> tagList = new ArrayList<>();
//全部要装箱的订单
List<BoxOrderInstallVO> orderInstallVOList = boxMergePkgMapper.getBoxOrderInstallVo(shipmentId);
List<Long> allOrderIds = new ArrayList<>() ;
if(CollectionUtil.isNotEmpty(orderInstallVOList)){
orderInstallVOList.forEach(o->{
OrderDO order = new OrderDO() ;
BeanUtils.copyProperties(o,order);
List<BoxOrderCheckInfoDO> tags = boxOrderCheckInfoService.getOrderTagNumList(order);
tagList.addAll(tags) ;
allOrderIds.add(o.getOrderId()) ;
});
}
//一个箱子的只要判断在 ecw_box_pkg_order 表有数据就可以,多个实装箱子的,要在合包标签表ecw_box_order_check_info 判断还有哪个箱子没装
//已加入装箱列表的有哪些
List<BoxMergePkgWebVO> allBoxPgkOrder = boxMergePkgMapper.getAllBoxPgkOrder(shipmentId,allOrderIds) ;
//已加入合包标签表的有哪些
List<BoxOrderCheckInfoDO> allBoxOrderCheck= boxMergePkgMapper.getAlllBoxOrderCheck(shipmentId,allOrderIds) ;
//剔除数据,留下 带”-“ 还未装的
//加入已装箱列表但未加入合包标签表的
List<BoxMergePkgWebVO> noInBoxOrderCheck = new ArrayList<>() ;
List<Long> unInstallOrderList = new ArrayList<>() ;
//已加入装箱列表不为空,提取不在已装箱列表的数据
if(CollectionUtil.isNotEmpty(allBoxPgkOrder) && CollectionUtil.isNotEmpty(allBoxOrderCheck)){
List<BoxMergePkgWebVO> pkgWebVOS = allBoxPgkOrder.stream().filter(item -> !allBoxOrderCheck.stream().anyMatch(ins -> item.getOrderId().equals(ins.getOrderId()) || item.getOrderId()==ins.getOrderId())) .collect(Collectors.toList());
noInBoxOrderCheck.addAll(pkgWebVOS) ;
List<BoxOrderCheckInfoDO> collect = tagList.stream().filter(item -> !allBoxOrderCheck.stream().anyMatch(ins -> item.getOrderNumCode().equals(ins.getOrderNumCode()))) .collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(collect)){
List<BoxOrderCheckInfoDO> checkInfoDOS = collect.stream().filter(item -> !pkgWebVOS.stream().anyMatch(ins -> item.getOrderId().equals(ins.getOrderId()) || item.getOrderId()==ins.getOrderId())) .collect(Collectors.toList());
List<Long> orderIdList = checkInfoDOS.stream().map(s->s.getOrderId()).collect(Collectors.toList());
unInstallOrderList.addAll(orderIdList);
}
}else if(CollectionUtil.isNotEmpty(allBoxPgkOrder) && CollectionUtil.isEmpty(allBoxOrderCheck)) {
if(orderInstallVOList.size()==allBoxPgkOrder.size()){
// List<Long> orderIdList = allBoxPgkOrder.stream().map(s->s.getOrderId()).collect(Collectors.toList());
// unInstallOrderList.addAll(orderIdList);
}else{
List<BoxOrderInstallVO> info = orderInstallVOList.stream().filter(item -> !allBoxPgkOrder.stream().anyMatch(ins -> item.getOrderId().equals(ins.getOrderId()) || item.getOrderId()==ins.getOrderId())) .collect(Collectors.toList());
List<Long> orderIdList = info.stream().map(s->s.getOrderId()).collect(Collectors.toList());
unInstallOrderList.addAll(orderIdList);
}
}else if(CollectionUtil.isEmpty(allBoxPgkOrder) && CollectionUtil.isEmpty(allBoxOrderCheck)) {
List<BoxOrderInstallVO> info = orderInstallVOList.stream().filter(item -> !allBoxPgkOrder.stream().anyMatch(ins -> item.getOrderId().equals(ins.getOrderId()) || item.getOrderId()==ins.getOrderId())) .collect(Collectors.toList());
List<Long> orderIdList = info.stream().map(s->s.getOrderId()).collect(Collectors.toList());
unInstallOrderList.addAll(orderIdList);
}else if(CollectionUtil.isEmpty(allBoxPgkOrder) && CollectionUtil.isNotEmpty(allBoxOrderCheck)){
throw exception(ORDER_NOT_IN_BOX);
}
IPage page1 = new PageDTO(page.getPage(),page.getRows());
IPage<BoxMergePkgWebVO> boxMergePkgWebVOS = boxMergePkgMapper.getUnPkgPage(page1,shipmentId);
getOrderInfoPageResult(pageResult, boxMergePkgWebVOS);
if(CollectionUtil.isNotEmpty(unInstallOrderList)){//剩余未装箱订单
IPage<BoxMergePkgWebVO> boxMergePkgWebVOS = boxMergePkgMapper.getUnPkgPage(page1,shipmentId,unInstallOrderList);
getUnOrderInfoPageResult(pageResult, boxMergePkgWebVOS,shipmentId);
}else{//没有剩余未装箱数据
List<Long> orderIdList = orderInstallVOList.stream().map(s->s.getOrderId()).collect(Collectors.toList());
List<Long> installOrderList = new ArrayList<>();
installOrderList.addAll(orderIdList) ;
IPage<BoxMergePkgWebVO> boxMergePkgWebVOS = boxMergePkgMapper.getUnPkgPage2(page1,shipmentId,installOrderList);
getUnOrderInfoPageResult(pageResult, boxMergePkgWebVOS,shipmentId);
}
return pageResult;
}
......@@ -397,6 +525,33 @@ public class BoxMergePkgServiceImpl extends AbstractService<BoxMergePkgMapper, B
pageResult.setTotal(boxMergePkgWebVOIPage.getTotal());
}
private void getUnOrderInfoPageResult(PageResult<BoxMergePkgWebVO> pageResult, IPage<BoxMergePkgWebVO> boxMergePkgWebVOIPage,Long shipmentId) {
if (CollectionUtil.isNotEmpty(boxMergePkgWebVOIPage.getRecords())) {
List<Long> orderIdList = boxMergePkgWebVOIPage.getRecords().stream().map(o->o.getOrderId()).collect(Collectors.toList());
List<OrderItemDO> AllOrderItemDOS = orderItemService.selectList(new LambdaQueryWrapperX<OrderItemDO>()
.in(OrderItemDO::getOrderId,orderIdList)
.isNotNull(OrderItemDO::getWarehouseInInfo)
);
boxMergePkgWebVOIPage.getRecords().stream().forEach(item -> {
// List<OrderItemDO> orderItemDOS = orderItemService.selectList(new LambdaQueryWrapperX<OrderItemDO>()
// .eq(OrderItemDO::getOrderId, item.getOrderId())
// .isNotNull(OrderItemDO::getWarehouseInInfo)
// );
List<OrderItemDO> orderItemDOS = AllOrderItemDOS.stream().filter(all -> all.getOrderId()==item.getOrderId() || all.getOrderId().equals(item.getOrderId())) .collect(Collectors.toList());
List<BoxOrderCheckInfoDO> installBox = boxMergePkgMapper.getInstallBoxByShipmentId(shipmentId,item.getOrderId()) ;
item.setInstallNum(CollectionUtil.isNotEmpty(installBox) ? installBox.size() : 0);
item.setOrderItemDOS(orderItemDOS);
});
pageResult.setList(boxMergePkgWebVOIPage.getRecords());
}
pageResult.setPage(boxMergePkgWebVOIPage.getCurrent());
pageResult.setPages(boxMergePkgWebVOIPage.getPages());
pageResult.setRows(boxMergePkgWebVOIPage.getSize());
pageResult.setTotal(boxMergePkgWebVOIPage.getTotal());
}
private void checkBoxApproval(Long shipmentId){
BoxDO box = boxService.getBox(shipmentId);
if (box.getAirShipmentStatus() != AirShipmentStatusEnum.UNSHIPMENT.getStatus()) {
......
......@@ -86,4 +86,6 @@ public interface BoxOrderCheckInfoService extends IService<BoxOrderCheckInfoDO>
void orderTally(Collection<Long> orderIdList, Long shipmentId);
List<String> getOrderTagList(OrderDO orderDO) ;
List<BoxOrderCheckInfoDO> getOrderTagNumList(OrderDO order);
}
......@@ -675,6 +675,42 @@ public class BoxOrderCheckInfoServiceImpl extends AbstractService<BoxOrderCheckI
return tagList;
}
private List<BoxOrderCheckInfoDO> getOrderTagNumCaseList(OrderDO orderDO, List<OrderLabelDO> orderLabelList) {
//从OrderLabel里面查找订单的箱号
String orderNo = orderDO.getOrderNo();
List<BoxOrderCheckInfoDO> tagList = new ArrayList<>();
int start;
int end;
if(CollectionUtil.isEmpty(orderLabelList)) {
//没有存箱号,从订单的总箱数里面取
int totalNum = orderDO.getSumNum();//总箱数
start = 1;
end = totalNum;
for (int i = start; i <= end; i++) {
String tag = CodeUtils.createOrderTagNumber(orderNo, i);
BoxOrderCheckInfoDO checkInfoDO = new BoxOrderCheckInfoDO() ;
checkInfoDO.setOrderId(orderDO.getOrderId());
checkInfoDO.setOrderNumCode(tag) ;
tagList.add(checkInfoDO);
}
} else {
orderLabelList.sort(Comparator.comparing(OrderLabelDO::getId));
for (OrderLabelDO orderLabelDO : orderLabelList) {
start = orderLabelDO.getStart();
end = orderLabelDO.getEnd();
for (int i = start; i <= end; i++) {
String tag = CodeUtils.createOrderTagNumber(orderNo, i);
BoxOrderCheckInfoDO checkInfoDO = new BoxOrderCheckInfoDO() ;
checkInfoDO.setOrderId(orderDO.getOrderId());
checkInfoDO.setOrderNumCode(tag) ;
tagList.add(checkInfoDO);
}
}
}
return tagList;
}
private OrderDO getOrderByNo(String orderNo) {
//根据订单编号找到订单
OrderQueryVO orderQueryVO = new OrderQueryVO();
......@@ -695,6 +731,18 @@ public class BoxOrderCheckInfoServiceImpl extends AbstractService<BoxOrderCheckI
return getOrderTagList(orderDO, orderLabelList);
}
@Override
public List<BoxOrderCheckInfoDO> getOrderTagNumList(OrderDO orderDO) {
//从OrderLabel里面查找订单的箱号
Long orderId = orderDO.getOrderId();
OrderLabelQueryVO queryVO = new OrderLabelQueryVO();
queryVO.setOrderId(orderId);
List<OrderLabelDO> orderLabelList = orderLabelService.getLabelList(queryVO);
return getOrderTagNumCaseList(orderDO, orderLabelList);
}
private void checkShipmentStepStatus(Long shipmentId,Integer type) {
BoxDO box = boxService.getBox(shipmentId);
if (type == 0) {
......
......@@ -42,9 +42,11 @@ import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.ORDER_IS_PRE_INSTALLED;
import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.ORDER_NOT_EXISTS;
import static cn.iocoder.yudao.module.shipment.enums.ErrorCodeConstants.*;
/**
......@@ -91,6 +93,7 @@ public class BoxPkgOrderServiceImpl extends AbstractService<BoxPkgOrderMapper, B
return "success";
}
@Override
@Transactional(rollbackFor = Exception.class)
public String scanOrderNoCreate(BoxPkgOrderScanCodeVO createReqVO){
......@@ -98,81 +101,23 @@ public class BoxPkgOrderServiceImpl extends AbstractService<BoxPkgOrderMapper, B
String orderNumCode = createReqVO.getOrderNo();
int position = orderNumCode.lastIndexOf("-");
if(position >= 0) {
String orderNumber = orderNumCode.substring(0, position);
if(orderNumCode.contains("A") && orderNumCode.startsWith("A")){
return this.scanCodeByOrderNo(orderNumCode,vo,createReqVO);
}
BoxMergePkgDO boxMergePkgDO = boxMergePkgService.selectOne(new LambdaQueryWrapper<BoxMergePkgDO>()
.eq(BoxMergePkgDO::getShipmentId, createReqVO.getShipmentId())
.eq(BoxMergePkgDO::getPkgNum, orderNumber));
if(boxMergePkgDO!=null){
List<BoxPreloadGoodsDO> goodsDOS = boxPreloadGoodsMapper.selectList(new LambdaQueryWrapperX<BoxPreloadGoodsDO>().eq(BoxPreloadGoodsDO::getShipmentId,createReqVO.getShipmentId()).eq(BoxPreloadGoodsDO::getDeleted,0));
if (CollectionUtil.isNotEmpty(goodsDOS)) {
List<Long> orderIds = goodsDOS.stream().map(BoxPreloadGoodsDO::getOrderId).collect(Collectors.toList());
List<OrderDO> orderDOS = orderService.selectList(OrderDO::getOrderId, orderIds);
if(CollectionUtil.isNotEmpty(orderDOS)){
orderDOS.forEach(order->{
BoxPkgOrderCreateReqVO boxPkgOrderCreateReqVO = new BoxPkgOrderCreateReqVO();
boxPkgOrderCreateReqVO.setOrderId(order.getOrderId());
boxPkgOrderCreateReqVO.setPkgId(boxMergePkgDO.getId());
this.create(boxPkgOrderCreateReqVO);
Long orderId = order.getOrderId();
//删除以装柜的编号
// boxOrderCheckInfoMapper.delete(new LambdaQueryWrapper<BoxOrderCheckInfoDO>()
// .eq(BoxOrderCheckInfoDO::getOrderId, orderId)
// .eq(boxMergePkgDO.getId() != null && boxMergePkgDO.getId().longValue() > 0L,BoxOrderCheckInfoDO::getPkgId,boxMergePkgDO.getId())
// .eq(BoxOrderCheckInfoDO::getShipmentId, createReqVO.getShipmentId())
// .eq(BoxOrderCheckInfoDO::getType,1)
// );
//找到这个订单所有需要装柜的编号
List<String> tagList = boxOrderCheckInfoService.getOrderTagList(order);
List<BoxOrderCheckInfoDO> boxOrderCheckInfoDOS = new ArrayList<>();
for (int i = 0; i < tagList.size(); i++) {
String tag = tagList.get(i);
BoxOrderCheckInfoDO boxOrderCheckInfoDO = new BoxOrderCheckInfoDO();
boxOrderCheckInfoDO.setOrderId(orderId);
boxOrderCheckInfoDO.setPkgId(boxMergePkgDO.getId());
boxOrderCheckInfoDO.setOrderNumCode(tag);
boxOrderCheckInfoDO.setShipmentId(createReqVO.getShipmentId());
boxOrderCheckInfoDO.setType(1);
boxOrderCheckInfoDO.setDeleted(false);
boxOrderCheckInfoDOS.add(boxOrderCheckInfoDO);
return this.scanCodeByOrderNo(orderNumCode,vo,createReqVO);
}
boxOrderCheckInfoService.saveBatch(boxOrderCheckInfoDOS);
});
}
}
}else{
throw exception(ORDER_CASE_NUM_NOT_EXIST);
}
// Long orderId = orderService.getOrderIdByOrderNo(orderNumber);
// vo.setOrderId(orderId);
// BoxMergePkgDO boxMergePkgDO = boxMergePkgService.selectOne(new LambdaQueryWrapperX<BoxMergePkgDO>().eq(BoxMergePkgDO::getPkgNum,createReqVO.getPkgNum()));
// vo.setPkgId(boxMergePkgDO.getId()) ;
// BoxPkgOrderDO pkgOrderDO = boxPkgOrderMapper.selectOne(new LambdaQueryWrapperX<BoxPkgOrderDO>().eq(BoxPkgOrderDO::getOrderId,orderId).eq(BoxPkgOrderDO::getPkgId,boxMergePkgDO.getId()));
// if(pkgOrderDO!=null){
// throw exception(ORDER_IS_PRE_INSTALLED);
// }
// if(vo.getOrderId()!=null && vo.getPkgId()!=null){//订单和包裹id 不为空,调用装箱方法
// this.create(vo);
// }
}else if(!createReqVO.getOrderNo().contains("-")){
BoxMergePkgDO boxMergePkgDO = boxMergePkgService.selectOne(new LambdaQueryWrapper<BoxMergePkgDO>()
.eq(BoxMergePkgDO::getShipmentId, createReqVO.getShipmentId())
.eq(BoxMergePkgDO::getPkgNum, orderNumCode));
if(boxMergePkgDO!=null){
List<BoxPreloadGoodsDO> goodsDOS = boxPreloadGoodsMapper.selectList(new LambdaQueryWrapperX<BoxPreloadGoodsDO>().eq(BoxPreloadGoodsDO::getShipmentId,createReqVO.getShipmentId()).eq(BoxPreloadGoodsDO::getDeleted,0));
OrderDO orderDO = orderService.getOne(new LambdaQueryWrapperX<OrderDO>().eq(OrderDO::getOrderNo,createReqVO.getOrderNo())) ;
if(Objects.isNull(orderDO)){
throw exception(ORDER_NOT_IN_BOX);
}
List<BoxPreloadGoodsDO> goodsDOS = boxPreloadGoodsMapper.selectList(new LambdaQueryWrapperX<BoxPreloadGoodsDO>().eq(BoxPreloadGoodsDO::getOrderId,orderDO.getOrderId()).eq(BoxPreloadGoodsDO::getDeleted,0));
if (CollectionUtil.isNotEmpty(goodsDOS)) {
List<Long> orderIds = goodsDOS.stream().map(BoxPreloadGoodsDO::getOrderId).collect(Collectors.toList());
List<OrderDO> orderDOS = orderService.selectList(OrderDO::getOrderId, orderIds);
......@@ -184,13 +129,6 @@ public class BoxPkgOrderServiceImpl extends AbstractService<BoxPkgOrderMapper, B
this.create(boxPkgOrderCreateReqVO);
Long orderId = order.getOrderId();
//删除以装柜的编号
// boxOrderCheckInfoMapper.delete(new LambdaQueryWrapper<BoxOrderCheckInfoDO>()
// .eq(BoxOrderCheckInfoDO::getOrderId, orderId)
// .eq(boxMergePkgDO.getId() != null && boxMergePkgDO.getId().longValue() > 0L,BoxOrderCheckInfoDO::getPkgId,boxMergePkgDO.getId())
// .eq(BoxOrderCheckInfoDO::getShipmentId, createReqVO.getShipmentId())
// .eq(BoxOrderCheckInfoDO::getType,1)
// );
//找到这个订单所有需要装柜的编号
List<String> tagList = boxOrderCheckInfoService.getOrderTagList(order);
......@@ -210,11 +148,11 @@ public class BoxPkgOrderServiceImpl extends AbstractService<BoxPkgOrderMapper, B
});
}
}
}else {
}else{
throw exception(ORDER_CASE_NUM_NOT_EXIST);
}
}
// 返回
......@@ -230,26 +168,29 @@ public class BoxPkgOrderServiceImpl extends AbstractService<BoxPkgOrderMapper, B
}
OrderDO order = orderService.getById(orderId);
vo.setOrderId(orderId);
List<BoxOrderCheckInfoDO> tags = boxOrderCheckInfoService.getOrderTagNumList(order);
if(CollectionUtil.isNotEmpty(tags)){
List<BoxOrderCheckInfoDO> orderNum = tags.stream().filter(t-> t.getOrderNumCode().equals(orderNumCode) || t.getOrderNumCode()==orderNumCode).collect(Collectors.toList());
if(CollectionUtil.isEmpty(orderNum)){
throw exception(ORDER_NOT_EXISTS);
}
}
BoxMergePkgDO boxMergePkgDO = boxMergePkgService.selectOne(new LambdaQueryWrapperX<BoxMergePkgDO>().eq(BoxMergePkgDO::getPkgNum,createReqVO.getPkgNum()));
vo.setPkgId(boxMergePkgDO.getId()) ;
List<BoxPkgOrderDO> pkgOrderDO = boxPkgOrderMapper.selectList(new LambdaQueryWrapperX<BoxPkgOrderDO>().eq(BoxPkgOrderDO::getOrderId,orderId).eq(BoxPkgOrderDO::getPkgId,boxMergePkgDO.getId()));
if(CollectionUtil.isNotEmpty(pkgOrderDO)){
throw exception(ORDER_IS_PRE_INSTALLED);
}
if(vo.getOrderId()!=null && vo.getPkgId()!=null){//订单和包裹id 不为空,调用装箱方法
if(CollectionUtil.isEmpty(pkgOrderDO)){
this.create(vo);
}
//删除以装柜的编号
// boxOrderCheckInfoMapper.delete(new LambdaQueryWrapper<BoxOrderCheckInfoDO>()
// .eq(BoxOrderCheckInfoDO::getOrderId, orderId)
// .eq(boxMergePkgDO.getId() != null && boxMergePkgDO.getId().longValue() > 0L,BoxOrderCheckInfoDO::getPkgId,boxMergePkgDO.getId())
// .eq(BoxOrderCheckInfoDO::getShipmentId, createReqVO.getShipmentId())
// .eq(BoxOrderCheckInfoDO::getType,1)
// );
//找到这个订单所有需要装柜的编号
List<String> tagList = boxOrderCheckInfoService.getOrderTagList(order);
List<BoxOrderCheckInfoDO> boxOrderCheckInfoDOS = new ArrayList<>();
boolean ischeck = false;
if(tagList.contains(orderNumCode) ){
String tag = orderNumCode ;
BoxOrderCheckInfoDO boxOrderCheckInfoDO = new BoxOrderCheckInfoDO();
......@@ -260,20 +201,24 @@ public class BoxPkgOrderServiceImpl extends AbstractService<BoxPkgOrderMapper, B
boxOrderCheckInfoDO.setType(1);
boxOrderCheckInfoDO.setDeleted(false);
boxOrderCheckInfoDOS.add(boxOrderCheckInfoDO);
List<BoxOrderCheckInfoDO> checkInfoDO = boxOrderCheckInfoService.selectList(new LambdaQueryWrapper<BoxOrderCheckInfoDO>()
.eq(BoxOrderCheckInfoDO::getOrderNumCode,tag)
.eq(BoxOrderCheckInfoDO::getOrderId,orderId)
.eq(BoxOrderCheckInfoDO::getPkgId,boxMergePkgDO.getId())
.eq(BoxOrderCheckInfoDO::getShipmentId,createReqVO.getShipmentId()).eq(BoxOrderCheckInfoDO::getDeleted,0));
if(CollectionUtil.isNotEmpty(checkInfoDO)){
//已经存在这样的数据了
ischeck = true ;
}
}
// for (int i = 0; i < tagList.size(); i++) {
// String tag = tagList.get(i);
// BoxOrderCheckInfoDO boxOrderCheckInfoDO = new BoxOrderCheckInfoDO();
// boxOrderCheckInfoDO.setOrderId(orderId);
// boxOrderCheckInfoDO.setPkgId(boxMergePkgDO.getId());
// boxOrderCheckInfoDO.setOrderNumCode(tag);
// boxOrderCheckInfoDO.setShipmentId(createReqVO.getShipmentId());
// boxOrderCheckInfoDO.setType(1);
// boxOrderCheckInfoDO.setDeleted(false);
// boxOrderCheckInfoDOS.add(boxOrderCheckInfoDO);
// }
if(!ischeck){
boxOrderCheckInfoService.saveBatch(boxOrderCheckInfoDOS);
}else{
throw exception(ORDER_IS_PRE_INSTALLED);
}
}
return "success" ;
}
......@@ -286,7 +231,11 @@ public class BoxPkgOrderServiceImpl extends AbstractService<BoxPkgOrderMapper, B
// 插入
BoxPkgOrderDO boxPkgOrder = BoxPkgOrderConvert.INSTANCE.convert(createReqVO);
boxPkgOrder.setOrderItemId(item.getOrderItemId());
List<BoxPkgOrderDO> check = boxPkgOrderMapper.selectList(new LambdaQueryWrapper<BoxPkgOrderDO>().eq(BoxPkgOrderDO::getOrderId,item.getOrderId()).eq(BoxPkgOrderDO::getOrderItemId,item.getOrderItemId()).eq(BoxPkgOrderDO::getPkgId,createReqVO.getPkgId())) ;
if(CollectionUtil.isEmpty(check)){
boxPkgOrderMapper.insert(boxPkgOrder);
}
});
Long aLong = boxPkgOrderMapper.selectCount(BoxPkgOrderDO::getPkgId, createReqVO.getPkgId());
if (aLong.longValue() > 0L) {
......@@ -295,6 +244,8 @@ public class BoxPkgOrderServiceImpl extends AbstractService<BoxPkgOrderMapper, B
boxService.addOrderLog(Collections.singletonList(createReqVO.getOrderId()), OrderShipmentLog.MERGE_PKG_ADD, "");
}
@Override
public void updateBoxPkgOrder(BoxPkgOrderUpdateReqVO updateReqVO) {
// 校验存在
......
package cn.iocoder.yudao.module.shipment.vo.box;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class BoxOrderInstallVO {
/**
* 订单ID
*/
private Long orderId;
@ApiModelProperty("订单编号")
private String orderNo;
@ApiModelProperty("箱数是否大于1")
private Boolean boxNumMoreOne;
}
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