public Map<Integer, String> getForMoveItemByOrderId(
     Integer salesOrderId, Integer orderShipmentId) {
   String hql =
       "select os from OrderShipment os where os.salesOrder.salesOrderId=? and os.status<=? and os.orderShipmentId!=? order by os.shipmentNo";
   List<OrderShipment> rst =
       this.findByHql(
           hql, salesOrderId, OrderConstants.SHIPMENT_STATUS_INVENTORY_ASSIGNED, orderShipmentId);
   Map<Integer, String> moveTo = new HashMap<Integer, String>();
   if (rst != null)
     for (OrderShipment temp : rst) {
       if (temp.hasPhysicalSku()) moveTo.put(temp.getOrderShipmentId(), temp.getShipmentNo());
     }
   return moveTo;
 }
  /**
   * 获取待备货的发货项
   *
   * @return
   */
  public List<OrderShipment> getShipments4Picking() {
    String hql =
        "select os, so.customerFirstname, so.customerLastname from OrderShipment os, SalesOrder so where os.salesOrder.salesOrderId=so.salesOrderId and os.status=? and so.isOnHold!=?";
    List list =
        this.findByHql(hql, OrderConstants.SHIPMENT_STATUS_PICKING_AVAILABLE, Constants.FLAG_TRUE);
    List<OrderShipment> orderShipments = new ArrayList<OrderShipment>();
    if (list != null)
      for (int i = 0; i < list.size(); i++) {
        Object[] array = (Object[]) list.get(i);
        OrderShipment orderShipment = (OrderShipment) array[0];
        orderShipment.setCustomerFirstname((String) array[1]);
        orderShipment.setCustomerLastname((String) array[2]);
        orderShipments.add(orderShipment);
      }

    return orderShipments;
  }
  /**
   * 是否有类同的发货项,对比email与地址
   *
   * @param salesOrder
   * @param orderShipment
   * @param shippingAddress
   * @return
   */
  public boolean hasSimilarOrderShipment(
      SalesOrder salesOrder, OrderShipment orderShipment, OrderAddress shippingAddress) {
    if (shippingAddress == null) return false;
    String hql =
        "select os from SalesOrder so, OrderShipment os, OrderAddress oa where so.salesOrderId=os.salesOrder.salesOrderId and os.orderAddress.orderAddressId is not null and os.orderAddress.orderAddressId=oa.orderAddressId"
            + " and os.shipmentNo!=? and so.customerEmail=? and so.orderStatus=? and oa.country=? and oa.state=? and oa.city=? and oa.address1=? and oa.address2=?";
    Long countNum =
        this.countByHql(
            hql,
            orderShipment.getShipmentNo(),
            salesOrder.getCustomerEmail(),
            OrderConstants.ORDER_STATUS_COMPLETE,
            shippingAddress.getCountry(),
            shippingAddress.getState(),
            shippingAddress.getCity(),
            shippingAddress.getAddress1(),
            shippingAddress.getAddress2());

    if (countNum != null && countNum.longValue() > 0) return true;

    return false;
  }