Commit 185b1bc5 authored by liuzeheng's avatar liuzeheng

装箱

parent fb6614a1
...@@ -4,8 +4,11 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; ...@@ -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.mapper.AbstractMapper;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQuery; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQuery;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO; 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.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.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.BoxMergePkgPDAListVO;
import cn.iocoder.yudao.module.shipment.vo.boxMergePkg.BoxMergePkgQueryVO; import cn.iocoder.yudao.module.shipment.vo.boxMergePkg.BoxMergePkgQueryVO;
import cn.iocoder.yudao.module.shipment.vo.boxMergePkg.BoxMergePkgWebVO; import cn.iocoder.yudao.module.shipment.vo.boxMergePkg.BoxMergePkgWebVO;
...@@ -96,14 +99,46 @@ public interface BoxMergePkgMapper extends AbstractMapper<BoxMergePkgDO> { ...@@ -96,14 +99,46 @@ public interface BoxMergePkgMapper extends AbstractMapper<BoxMergePkgDO> {
"</script>") "</script>")
BoxMergePkgDO getMergePkgInfoById(@Param("id") Long id); 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("<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 " + "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 " + "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} " + "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" + "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>") "</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("<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, " + "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> { ...@@ -143,4 +178,106 @@ public interface BoxMergePkgMapper extends AbstractMapper<BoxMergePkgDO> {
"</when>"+ "</when>"+
"</script>") "</script>")
IPage<BoxMergePkgPDAListVO> getBoxMergePkgList4PDAPage(IPage<BoxMergePkgPDAListVO> mpPage, @Param("warehouseIdList") Set<Long> warehouseIds,@Param("selfNo") String selfNo); 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 ...@@ -47,4 +47,7 @@ public interface BoxOrderCheckInfoMapper extends AbstractMapper<BoxOrderCheckInf
return null; return null;
} }
List<BoxOrderCheckInfoDO> getBoxOrderCheckInfoByShipIdAndOrerId(Long shipmentId, Long orderId) ;
} }
...@@ -86,4 +86,6 @@ public interface BoxOrderCheckInfoService extends IService<BoxOrderCheckInfoDO> ...@@ -86,4 +86,6 @@ public interface BoxOrderCheckInfoService extends IService<BoxOrderCheckInfoDO>
void orderTally(Collection<Long> orderIdList, Long shipmentId); void orderTally(Collection<Long> orderIdList, Long shipmentId);
List<String> getOrderTagList(OrderDO orderDO) ; List<String> getOrderTagList(OrderDO orderDO) ;
List<BoxOrderCheckInfoDO> getOrderTagNumList(OrderDO order);
} }
...@@ -675,6 +675,42 @@ public class BoxOrderCheckInfoServiceImpl extends AbstractService<BoxOrderCheckI ...@@ -675,6 +675,42 @@ public class BoxOrderCheckInfoServiceImpl extends AbstractService<BoxOrderCheckI
return tagList; 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) { private OrderDO getOrderByNo(String orderNo) {
//根据订单编号找到订单 //根据订单编号找到订单
OrderQueryVO orderQueryVO = new OrderQueryVO(); OrderQueryVO orderQueryVO = new OrderQueryVO();
...@@ -695,6 +731,18 @@ public class BoxOrderCheckInfoServiceImpl extends AbstractService<BoxOrderCheckI ...@@ -695,6 +731,18 @@ public class BoxOrderCheckInfoServiceImpl extends AbstractService<BoxOrderCheckI
return getOrderTagList(orderDO, orderLabelList); 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) { private void checkShipmentStepStatus(Long shipmentId,Integer type) {
BoxDO box = boxService.getBox(shipmentId); BoxDO box = boxService.getBox(shipmentId);
if (type == 0) { if (type == 0) {
......
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