Exemplo n.º 1
0
 /**
  * Pda_orderLoadingAct::act_orderLoading()
  * 	装车扫描的时候对口袋编号进行改变状态,如果是快递的就扫描发货单号
  * @author cxy
  * @return
  */
 public function act_orderLoading()
 {
     $userId = $_SESSION['userId'];
     $packageId = trim($_POST['order_group']);
     //需要验证是否是口袋编号
     //if(strlen($packageId)<7){
     //  $a =  WhWaveAreaInfoModel::get_area_info(1,1,1);
     //  echo $a ;exit;
     $group_sql = WhWaveOrderPartionShippingReviewModel::get_pocket($packageId);
     //  print_r($group_sql);exit;
     if (empty($group_sql)) {
         self::$errCode = '003';
         self::$errMsg = '该编号不在发货复核中,请重新输入!';
         return false;
     }
     $ebay_id_all = WhWaveOrderPartionScanReviewModel::get_shipping_review($packageId);
     if (empty($ebay_id_all)) {
         self::$errCode = '003';
         self::$errMsg = '该编号不在分区复核中,请重新输入!';
         return false;
     }
     $data = array('packageId' => $packageId, 'scantime' => time(), 'userId' => $userId, 'isExpress' => 2);
     $select_loading = WhWaveOrderLoadingModel::select_loading($packageId);
     if ($select_loading) {
         self::$errCode = '003';
         self::$errMsg = '该' . $packageId . '编号已经进行过装车扫描了!';
         return false;
     }
     WhBaseModel::begin();
     $insert_loading = WhWaveOrderLoadingModel::insert($data);
     if (empty($insert_loading)) {
         self::$errCode = '003';
         self::$errMsg = '装车扫描失败,请联系负责人!';
         WhBaseModel::rollback();
         return false;
     }
     foreach ($ebay_id_all as $values) {
         $shipOrderId = $values['shipOrderId'];
         $result = WhWaveOrderPartionScanReviewModel::updateShippingOrderStatus($shipOrderId, $status = PKS_DONE);
         if (!$result) {
             self::$errCode = '003';
             self::$errMsg = '更新' . $shipOrderId . '发货单号失败!';
             WhBaseModel::rollback();
             return false;
         }
         WhPushModel::pushOrderStatus($shipOrderId, 'PKS_DONE', $_SESSION['userId'], time());
         //状态推送,需要改为已发货(订单系统提供状态常量)
     }
     self::$errCode = '200';
     self::$errMsg = '扫描' . $packageId . '口袋编号成功!';
     WhBaseModel::commit();
     return true;
     //  }else{
     // }
 }
 /**
  * pda_shippingGroupReviewAct::Act_orderReview()
  * 对随机扫描的发货单号进行判断
  * @author cxy
  * @return
  */
 public function Act_orderReview()
 {
     $userId = $_SESSION['userId'];
     $packageId = intval(trim($_POST['packageid']));
     $shipOrderId = trim($_POST['ebay_id']);
     //先核对订单
     //兼容 EUB或者 包裹 扫描的是 trackno 而非ebayid
     $p_real_ebayid = '#^\\d+$#';
     $p_trackno_eub = '#^(LK|RA|RI|RL|RB|RC|RD|RM|RR|RF|LN|LM|AG)\\d+(CN|HK|DE200)$#';
     $p_trackno_ups = '#^(1ZR)\\d+$#';
     $p_trackno_bpost = '#^(BLVS)\\d+$#';
     $is_eub_package_type = false;
     if (preg_match($p_real_ebayid, $shipOrderId)) {
     } else {
         if (preg_match($p_trackno_eub, $shipOrderId)) {
             $is_eub_package_type = true;
         } else {
             if (preg_match($p_trackno_ups, $shipOrderId)) {
                 $is_eub_package_type = true;
             } else {
                 if (preg_match($p_trackno_bpost, $shipOrderId)) {
                     $is_eub_package_type = true;
                 } else {
                     if (strlen($shipOrderId) > 11) {
                         $is_eub_package_type = true;
                     } else {
                         self::$errCode = '001';
                         self::$errMsg = '订单号[' . $shipOrderId . ']格式有误';
                         return false;
                     }
                 }
             }
         }
     }
     if ($is_eub_package_type == true) {
         //$is_eub_package_type是真的时候$ebay_id是跟踪号
         $info = orderWeighingModel::selectOrderId($shipOrderId);
         if (!$info) {
             self::$errCode = 501;
             self::$errMsg = "此跟踪号不存在!";
             return false;
         }
         //得到发货单号
         $shipOrderId = $info[0]['shipOrderId'];
     }
     //得到发货单明细
     $order_records = WhOrderPartionRecordsModel::get_OrderPartionRecords($shipOrderId);
     if (empty($order_records)) {
         self::$errCode = 0;
         self::$errMsg = "此跟踪号/发货单号还没有进行分区!";
         return false;
     }
     if ($order_records['packageId'] != $packageId) {
         self::$errCode = 0;
         self::$errMsg = "此跟踪号/发货单号应该在{$order_records['packageId']}口袋编号中!";
         return false;
     }
     $where = "where id={$shipOrderId}";
     $order = orderPartionModel::selectOrder($where);
     if (!$order) {
         self::$errCode = 0;
         self::$errMsg = "此发货单不存在!";
         return false;
     }
     if ($order[0]['orderStatus'] != PKS_WAITING_LOADING) {
         self::$errCode = 0;
         self::$errMsg = "此发货单没有在待装车扫描状态下!";
         return false;
     }
     $order_str = $shipOrderId;
     $result_group_review = WhWaveOrderPartionShippingReviewModel::get_pocket($packageId);
     if (empty($result_group_review)) {
         self::$errCode = 0;
         self::$errMsg = "此口袋编号没有进行过分区复核!";
         return false;
     } else {
         if ($result_group_review['orders'] != 0) {
             $order_str .= ',' . $result_group_review['orders'];
             $order_str = trim($order_str, ',');
             $order_str = explode(',', $order_str);
             $order_str = array_unique($order_str);
             $order_str = implode(',', $order_str);
         }
         $update_group_shipping = WhWaveOrderPartionShippingReviewModel::update_shipping_review($packageId, $order_str);
         if ($update_group_shipping) {
             self::$errCode = '200';
             self::$errMsg = "请复核下一个发货单或者下一个口袋编号";
             return true;
         } else {
             self::$errCode = '20';
             self::$errMsg = "扫描发货单号失败,请联系负责人";
             return false;
         }
     }
 }