/**
  *	通过分区ID和用户ID获取订单分区记录
  *  @param $partitionId
  *  @param $userId
  *  @return array()
  *  @author cmf
  */
 public function getPartionRecords($partitionId = 0, $userId = 0)
 {
     if (!$partitionId || !$userId) {
         return array();
     }
     $result = WhOrderPartionRecordsModel::find("partitionId='" . $partitionId . "' AND packageId=0 AND scanUserId='" . $userId . "' group by packageId", "count(shipOrderId) as totalnum,sum(weight) as totalweight");
     return $result;
 }
Esempio n. 2
0
 /**
  * OrderPrintAct::get_retAndProAdress()
  * 中国邮政获取退件单位和协议地址
  * @param int $ebay_id 发货单号
  * @author Gary
  * @return
  */
 public function get_retAndProAdress($ebay_id)
 {
     $ebay_id = intval($ebay_id);
     $partion = WhOrderPartionRecordsModel::get_OrderPartionRecords($ebay_id);
     $address = array();
     if (!empty($partion)) {
         $partion = $partion['partion'];
         if (strpos($partion, '深圳') !== FALSE) {
             //深圳
             $address['retUnit'] = '协议客户:赛维网络科技有限公司';
             $address['proCustomer'] = '退件单位:深圳邮局大宗邮件处理中心';
             $address['fromAddress'] = '<strong>from:Shenzhen China</strong>
                                             <span style="margin-left: 10px;display:inline-block;font-weight:bold;">
                                             	航站四路邮件处理中心
                                             </span>
                                             <span style="display:inline-block;font-weight:bold;">
                                             	国际业务部:赛维博
                                             </span>
                                             <span style="margin-left: 10px;display:inline-block;font-weight:bold;">
                                             	已验视
                                             </span>
                                             <span style="margin-left: 10px;display:inline-block;font-weight:bold;">
                                             	验视人:潘婷婷
                                             </span>
                                             <span style="display:inline-block;font-weight:bold;">
                                             	单位:国际业务部
                                             </span>
                                             	<strong>国际小包</strong>
                                             <span style="font-size:11px;font-weight:bold;display:inline-block;margin-left:4px;">
                                             	made in china
                                             </span>';
         } else {
             if (strpos($partion, '泉州') !== FALSE) {
                 //泉州
                 $address['retUnit'] = '协议客户:赛维网络科技有限公司';
                 $address['proCustomer'] = '退件单位:福建泉州邮件处理中心';
                 $address['fromAddress'] = '<strong>from: Mr. Chen</strong>
                                             <span style="display:inline-block;font-weight:bold;">
                                             	Quanzhou Riufeng Electronic Technology Co., Ltd., Quanzhou, Fujian
                                             </span>
                                             <span style="display:inline-block;font-weight:bold;">
                                             	362000,China
                                             </span>
                                             <span style="font-size:11px;font-weight:bold;display:inline-block;margin-left:4px;">
                                             	made in china
                                             </span>';
             } else {
                 if (strpos($partion, '福建') !== FALSE) {
                     //盘陀
                     $address['retUnit'] = '协议客户:陈文辉画室';
                     $address['proCustomer'] = '退件单位:福建盘陀邮件处理中心';
                     $address['fromAddress'] = '<strong>from:Chen Xiaoming</strong>
                                             <span style="display:inline-block;font-weight:bold;">
                                             	Zhangzhou,Fujian  Pantuo,Zhangpu
                                             </span>
                                             <span style="display:inline-block;font-weight:bold;">
                                             	363202,China
                                             </span>
                                             <span style="font-size:11px;font-weight:bold;display:inline-block;margin-left:4px;">
                                             	made in china
                                             </span>';
                 }
             }
         }
     }
     return $address;
 }
 /**
  * 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;
         }
     }
 }
Esempio n. 4
0
 /**
  * 分区操作
  * @author czq
  */
 public function act_checkPartion()
 {
     if (!$_SESSION['userId']) {
         $result = array('status' => 0, 'msg' => '请先登录系统');
         echo json_encode($result);
         exit;
     }
     $shipOrderId = trim($_REQUEST['shipOrderId']);
     $shipOrder = WhShippingOrderModel::find($shipOrderId);
     if (empty($shipOrder)) {
         $result = array('status' => 'A00', 'msg' => '发货单信息不存在');
         echo json_encode($result);
         exit;
     }
     if ($shipOrder['orderStatus'] != PKS_WDISTRICT) {
         $result = array('status' => 'A00', 'msg' => '发货单非待分区状态,不能分区');
         echo json_encode($result);
         exit;
     }
     if (empty($shipOrder['channelId'])) {
         $result = array('status' => 'A00', 'msg' => '发货单在申请运输方式中,请稍后分区');
         echo json_encode($result);
         exit;
     }
     $partition = WhTransportPartitionModel::getPartition($shipOrder['channelId'], $shipOrder['countryName']);
     if ($partition) {
         $vo = WhOrderPartionRecordsModel::find("shipOrderId='" . $shipOrderId . "'");
         if (!$vo) {
             $data = array('shipOrderId' => $shipOrderId, 'packageId' => 0, 'partitionId' => $partition['id'], 'weight' => $shipOrder['orderWeight'], 'partion' => $partition['title'], 'scanUserId' => $_SESSION['userId'], 'scanTime' => time(), 'modifyTime' => 0, 'note' => '', 'is_delete' => 0, 'storeId' => 0);
             WhOrderPartionRecordsModel::insert($data);
             $result = array('status' => $partition['code'], 'partition' => $partition['partition'], 'msg' => $partition['title']);
         } else {
             if ($vo['packageId']) {
                 $result = array('status' => 'A00', 'partition' => $partition['partition'], 'msg' => '已打包,不能再分区');
             } else {
                 $result = array('status' => $partition['code'], 'partition' => $partition['partition'], 'msg' => '包裹已分拣,分区为: ' . $partition['title']);
             }
         }
     } else {
         $result = array('status' => 'A00', 'partition' => '', 'msg' => '当前国家未分区,请联系销售人员');
     }
     echo json_encode($result);
     exit;
 }
 /**
  * pda_partitionCheckingAct::act_comparison()
  *    对发货单分区和发货单复核的数量进行对比
  * @author cxy
  * @return
  */
 public function act_comparison()
 {
     $userId = $_SESSION['userId'];
     $package_id = intval(trim($_POST['package_id']));
     if (empty($userId)) {
         self::$errCode = '0';
         self::$errMsg = '系统登录超时,请先关闭浏览器 然后登录扫描!!';
         return false;
     }
     if (empty($package_id)) {
         self::$errCode = '206';
         self::$errMsg = '请扫描分区的口袋编号!';
         return false;
     }
     //分区复核的总数
     $review_count = WhWaveOrderPartionScanReviewModel::get_countReview($package_id);
     $review_count = $review_count['mun'];
     // 发货单分区的总数
     $partion_count = WhOrderPartionRecordsModel::get_partionCount($package_id);
     $partion_count = $partion_count['mun'];
     if ($review_count != $partion_count) {
         if ($review_count < $partion_count) {
             $counts = $partion_count - $review_count;
             self::$errCode = '206';
             self::$errMsg = '该口袋编号的分区发货数量单比分区复核的数量多' . $counts;
             return false;
         } else {
             $counts = $review_count - $partion_count;
             self::$errCode = '206';
             self::$errMsg = '该口袋编号的分区发货数量单比分区复核的数量少' . $counts;
             return false;
         }
     } else {
         self::$errCode = '200';
         self::$errMsg = '该口袋编号的分区发货单与分区复核的数量符合!';
         $res['review_total'] = $partion_count;
         return $res;
     }
 }
Esempio n. 6
0
 public function view_savepacket()
 {
     $packageid = intval($_POST['packageid']);
     $packet = WhOrderPartionPrintModel::find($packageid, 'status,partion,partitionId');
     if (!$packet) {
         $result = array('status' => 0, 'msg' => '口袋编号不存在');
         echo json_encode($result);
         exit;
     }
     $status = $packet['status'];
     $partion = $packet['partion'];
     $partionId = $packet['partitionId'];
     unset($packet);
     if ($status != 0) {
         $result = array('status' => 0, 'msg' => '该包裹已使用,请更换包裹编号!');
         echo json_encode($result);
         exit;
     }
     if (!$_SESSION['userId']) {
         $result = array('status' => 0, 'msg' => '请先登录系统');
         echo json_encode($result);
         exit;
     }
     $record = WhOrderPartionRecordsModel::getPartionRecords($partionId, $_SESSION['userId']);
     $totalnum = $record['totalnum'];
     $totalweight = $record['totalweight'];
     if (!$totalnum && !$totalweight) {
         $result = array('status' => 0, 'msg' => '该包裹分区下没有订单');
         echo json_encode($result);
         exit;
     }
     //更新口袋分区
     $data = array('packageId' => $packageid, 'modifyTime' => time());
     WhOrderPartionRecordsModel::update($data, "partitionId='" . $partionId . "' AND packageId=0 AND scanUserId='" . $_SESSION['userId'] . "'");
     //更新口袋打包
     $packet_data = array('totalWeight' => $totalweight, 'totalNum' => $totalnum, 'status' => 1, 'modifyTime' => time());
     WhOrderPartionPrintModel::update($packet_data, $packageid);
     $result = array('status' => 1, 'totalWeight' => round($totalweight / 1000, 3), 'totalNum' => $totalnum, 'msg' => '口袋打包成功');
     //更新订单状态
     $orders = WhOrderPartionRecordsModel::select("partitionId='" . $partionId . "' AND packageId='" . $packageid . "' AND scanUserId='" . $_SESSION['userId'] . "'");
     foreach ($orders as $val) {
         $orderIds[] = $val['shipOrderId'];
         WhPushModel::pushOrderStatus($val['shipOrderId'], 'PKS_DISTRICT_CHECKING', $_SESSION['userId'], time());
         //状态推送,需要改为待分区复核(订单系统提供状态常量)
     }
     $data = array('orderStatus' => PKS_DISTRICT_CHECKING);
     WhShippingOrderModel::update($data, array('id in' => $orderIds));
     echo json_encode($result);
 }