/**
  * pda_shippingGroupReviewAct::act_outReview()
  *  扫描口袋编号通过AJAX传递口袋编号来对该编号进行操作
  * @author cxy
  * @return boolean array
  */
 public function act_outReview()
 {
     $userId = $_SESSION['userId'];
     $packageId = intval(trim($_POST['packageid']));
     //得到发货单分区列表信息
     $get_orderPartion = WhOrderPartionPrintModel::get_OrderPartion($packageId);
     if (empty($get_orderPartion)) {
         self::$errCode = '202';
         self::$errMsg = '该口袋编号不存在分区列表中';
         return false;
     }
     if ($get_orderPartion['status'] == 0) {
         self::$errCode = '202';
         self::$errMsg = '该口袋编号还没有进行打包!';
         return false;
     }
     //得到该口袋编号下的发货单
     $all_order = WhOrderPartionRecordsModel::get_OrderPartionRecordsByPackageId($packageId);
     if ($all_order) {
         foreach ($all_order as $value) {
             $result_status = WhShippingOrderModel::get_order_info('orderStatus', array('id' => $value['shipOrderId']));
             if ($result_status[0]['orderStatus'] != PKS_WAITING_SHIPPING_CHECKING) {
                 self::$errCode = '202';
                 self::$errMsg = '该口袋编号下有发货单的状态不是在待发货组复核!';
                 return false;
             }
         }
     }
     //发货组复核信息
     $get_groupReview = WhWaveOrderPartionShippingReviewModel::get_pocket($packageId);
     if ($get_groupReview) {
         self::$errCode = '211';
         self::$errMsg = '该口袋编号已经在发货组复核中复核过了';
         return true;
     }
     //分区复核的信息
     $get_orderReview = WhWaveOrderPartionScanReviewModel::get_shippingNews($packageId);
     // print_r($get_orderReview);
     // echo $get_orderReview['review_weight'];exit;
     if ($get_orderPartion['totalWeight'] == $get_orderReview['review_weight'] && $get_orderPartion['totalNum'] == $get_orderReview['review_num']) {
         $is_error = 0;
         self::$errCode = '200';
         self::$errMsg = '请随机扫描一个订单!';
         $data = array('packageId' => $packageId, 'is_error' => $is_error, 'userId' => $userId, 'scantime' => time());
         $partion_arr = array();
         $review_arr = array();
         //分区扫描得到的发货单
         $get_orderPartion_detail = WhOrderPartionRecordsModel::get_OrderPartionRecordsByPackageId($packageId);
         //得到分区复核的发货单列表
         $get_review_detail = WhWaveOrderPartionScanReviewModel::get_shipping_review($packageId);
         foreach ($get_orderPartion_detail as $v) {
             $partion_arr[$v['shipOrderId']] = $v;
         }
         foreach ($get_review_detail as $v) {
             $review_arr[$v['shipOrderId']] = $v;
         }
         $diversity_a = array_diff_key($partion_arr, $review_arr);
         $diversity_b = array_diff_key($review_arr, $partion_arr);
         if (!empty($diversity_a) || !empty($diversity_b)) {
             self::$errCode = '500';
             self::$errMsg = '分区的发货单与分区复核的发货单不符合';
             $order_str = '';
             if ($diversity_a) {
                 foreach ($diversity_a as $k => $val) {
                     $order_str .= $k . ',';
                 }
             } elseif ($diversity_b) {
                 foreach ($diversity_b as $k => $val) {
                     $order_str .= $k . ',';
                 }
             }
             return trim($order_str, ',');
         }
         $res = array();
         WhBaseModel::begin();
         $result = WhWaveOrderPartionShippingReviewModel::insert($data);
         if ($result) {
             foreach ($get_review_detail as $ks => $val) {
                 //更新发货操作记录表
                 $update = WhWaveOrderPartionShippingReviewModel::updateOrderRecords($val['shipOrderId'], $userId);
                 if (!$update) {
                     self::$errCode = '206';
                     self::$errMsg = '更新操作记录失败,请联系负责人!';
                     WhBaseModel::rollback();
                     return false;
                 }
                 //更新发货表状态
                 $ostatus = WhWaveOrderPartionScanReviewModel::updateShippingOrderStatus($val['shipOrderId'], $status = PKS_WAITING_LOADING);
                 if (!$ostatus) {
                     self::$errCode = 608;
                     self::$errMsg = "更新发货单状态失败!";
                     WhBaseModel::rollback();
                     return false;
                 }
                 WhPushModel::pushOrderStatus($val['shipOrderId'], 'PKS_WAITING_LOADING', $_SESSION['userId'], time());
                 //状态推送,需要改为装车扫描(订单系统提供状态常量)
             }
             self::$errCode = '200';
             self::$errMsg = '该口袋编号正确,请复核下该口袋编号下的发货单!';
             $get_orderPartion['totalWeight'] = round($get_orderPartion['totalWeight'] / 1000, 3);
             $get_orderReview['review_weight'] = round($get_orderReview['review_weight'] / 1000, 3);
             $res['partion_data'] = $get_orderPartion;
             $res['review_data'] = $get_orderReview;
             $res['packageid'] = $packageId;
         } else {
             self::$errCode = '206';
             self::$errMsg = '该发货组复核口袋编号失败,请联系负责人!';
             WhBaseModel::rollback();
             return false;
         }
         WhBaseModel::commit();
         return $res;
     } else {
         self::$errCode = '201';
         self::$errMsg = '分区和分区复核的数据不一致!';
     }
     $res['partion_data'] = $get_orderPartion;
     $res['review_data'] = $get_orderReview;
     $res['packageid'] = $packageId;
     return $res;
 }
Esempio n. 2
0
 /**
  * pda_TrackingAct::act_tracking_binding()
  * 快递绑定跟踪号
  * @author cxy
  * @return
  */
 public function act_tracking_binding()
 {
     $userId = $_SESSION['userId'];
     $ebay_id = trim($_POST['ebay_id']);
     $tracking = trim($_POST['tracking']);
     if (empty($userId)) {
         self::$errCode = '0';
         self::$errMsg = '系统登录超时,请先关闭浏览器 然后登录扫描!!';
         return false;
     }
     if (empty($ebay_id)) {
         self::$errCode = 0;
         self::$errMsg = '请填写单号!';
         return;
     }
     if (empty($tracking)) {
         self::$errCode = 0;
         self::$errMsg = '请输入正确的跟踪号!';
         return;
     }
     //查询扫描的跟踪号是否已经扫描过了的
     $result_select = WhOrderTracknumberModel::select_ByTracknumber($tracking);
     if ($result_select) {
         self::$errCode = 211;
         self::$errMsg = '该跟踪号已经绑定' . $result_select['shipOrderId'] . ',请检查!';
         return false;
     }
     $data = array('tracknumber' => $tracking, 'shipOrderId' => $ebay_id, 'createdTime' => time());
     $array = array('shipOrderId' => $ebay_id, 'is_delete' => 0);
     //根据发货单号获取快递需要的箱子和跟踪号数量
     $result_tracking_count = WhWaveTrackingBoxModel::select_by_shipOrderId($ebay_id);
     //说明该快递单只有一个箱子和一个跟踪号,所以不需要在wh_wave_tracking_box "快递单号的箱子与跟踪号数量表"添加记录
     if (empty($result_tracking_count)) {
         $count_binding = WhOrderTracknumberModel::count($array);
         //发货单已经绑定跟踪号的数量
         if ($count_binding > 0) {
             self::$errCode = 24;
             self::$errMsg = '该发货单号已经绑定好跟踪号了,不在需要绑定';
             return false;
         }
         WhBaseModel::begin();
         $result_insert = WhOrderTracknumberModel::insert($data);
         if (!$result_insert) {
             WhBaseModel::rollback();
             self::$errCode = 20;
             self::$errMsg = '跟踪号绑定失败,请联系负责人';
             return false;
         }
         //更新发货表状态
         $ostatus = WhWaveOrderPartionScanReviewModel::updateShippingOrderStatus($ebay_id, $status = PKS_WAITING_LOADING);
         if (!$ostatus) {
             WhBaseModel::rollback();
             self::$errCode = 20;
             self::$errMsg = '更新发货单状态失败,请联系负责人';
             return false;
         }
         WhPushModel::pushOrderStatus($ebay_id, 'PKS_WAITING_LOADING', $_SESSION['userId'], time());
         //状态推送,需要改为待装车扫描(订单系统提供状态常量)
         WhBaseModel::commit();
         self::$errCode = 200;
         self::$errMsg = '绑定成功,请扫描另外一个发货单!';
         return true;
     } else {
         $result_tracking_count = $result_tracking_count['trackingCount'];
         //发货单需要绑定跟踪号的数量
         $count_binding = WhOrderTracknumberModel::count($array);
         //发货单已经绑定跟踪号的数量
         if ($result_tracking_count > $count_binding) {
             WhBaseModel::begin();
             $result_insert = WhOrderTracknumberModel::insert($data);
             if (!$result_insert) {
                 WhBaseModel::rollback();
                 self::$errCode = 21;
                 self::$errMsg = '跟踪号绑定失败,请联系负责人';
                 return false;
             }
             $num = $result_tracking_count - $count_binding - 1;
             if ($num == 0) {
                 //更新发货表状态
                 $ostatus = WhWaveOrderPartionScanReviewModel::updateShippingOrderStatus($ebay_id, $status = PKS_WAITING_LOADING);
                 if (!$ostatus) {
                     WhBaseModel::rollback();
                     self::$errCode = 20;
                     self::$errMsg = '更新发货单状态失败,请联系负责人';
                     return false;
                 }
                 WhPushModel::pushOrderStatus($ebay_id, ' ', $_SESSION['userId'], time());
                 //状态推送,需要改为待装车扫描(订单系统提供状态常量)
                 WhBaseModel::commit();
                 self::$errMsg = '绑定成功,该发货单不需要绑定跟踪号了';
                 self::$errCode = 200;
                 return true;
             } else {
                 WhBaseModel::commit();
                 self::$errMsg = '绑定成功,该发货单还需要绑定' . $num . '个跟踪号';
                 self::$errCode = 400;
                 return true;
             }
         } else {
             self::$errCode = 22;
             self::$errMsg = '绑定失败,绑定的跟踪号已经够' . $result_tracking_count . '个,请扫描另外一个发货单!';
             return true;
         }
     }
 }
Esempio n. 3
0
 public function view_formDataImport()
 {
     // $tir_obj = new TrackInfoRecordModel();
     $ebay_id = $_POST['order'][1];
     $tracking = $_POST['express'][1];
     if (empty($ebay_id) && empty($tracking)) {
         $data = array("data" => array('发货单和跟踪号不能是空!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput');
         goErrMsgPage($data);
     }
     $where = "where id={$ebay_id}";
     $order = orderPartionModel::selectOrder($where);
     if (!$order) {
         $data = array("data" => array('发货单不存在!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput');
         goErrMsgPage($data);
         exit;
     }
     if ($order[0]['orderStatus'] != PKS_PRINT_SHIPPING_INVOICE) {
         $data = array("data" => array($ebay_id . '此发货单状态不是在待打印面单状态!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput');
         goErrMsgPage($data);
         exit;
     }
     $array = array('shipOrderId' => $ebay_id, 'is_delete' => 0);
     //根据发货单号获取快递需要的箱子和跟踪号数量
     $result_tracking_count = WhWaveTrackingBoxModel::select_by_shipOrderId($ebay_id);
     $count_binding = WhOrderTracknumberModel::count($array);
     //发货单已经绑定跟踪号的数量
     if (empty($result_tracking_count)) {
         if ($count_binding > 0) {
             $data = array("data" => array($ebay_id . "该发货单已经绑定好跟踪号了!"), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput');
             goErrMsgPage($data);
             exit;
         }
     } else {
         $result_tracking_count = $result_tracking_count['trackingCount'];
         //发货单需要绑定跟踪号的数量
         if ($result_tracking_count <= $count_binding) {
             $data = array("data" => array($ebay_id . "该发货单已经绑定好跟踪号了!"), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput');
             goErrMsgPage($data);
             exit;
         }
     }
     //查询扫描的跟踪号是否已经扫描过了的
     $result_select = WhOrderTracknumberModel::select_ByTracknumber($tracking);
     if ($result_select) {
         $data = array("data" => array('该跟踪号已经绑定' . $result_select['shipOrderId'] . ',请检查!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput');
         goErrMsgPage($data);
         exit;
     }
     $data_insert = array('tracknumber' => $tracking, 'shipOrderId' => $ebay_id, 'createdTime' => time());
     $array_count = array('shipOrderId' => $ebay_id, 'is_delete' => 0);
     //根据发货单号获取快递需要的箱子和跟踪号数量
     $result_tracking_count = WhWaveTrackingBoxModel::select_by_shipOrderId($ebay_id);
     //说明该快递单只有一个箱子和一个跟踪号,所以不需要在wh_wave_tracking_box "快递单号的箱子与跟踪号数量表"添加记录
     if (empty($result_tracking_count)) {
         $count_binding = WhOrderTracknumberModel::count($array_count);
         //发货单已经绑定跟踪号的数量
         if ($count_binding > 0) {
             $data = array("data" => array('该发货单号已经绑定好跟踪号了,不在需要和这个跟踪号绑定!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput');
             goErrMsgPage($data);
             exit;
         }
         WhBaseModel::begin();
         $result_insert = WhOrderTracknumberModel::insert($data_insert);
         if (!$result_insert) {
             WhBaseModel::rollback();
             $data = array("data" => array('跟踪号绑定失败,请联系负责人!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput');
             goErrMsgPage($data);
             exit;
         }
         //更新发货表状态
         $ostatus = WhWaveOrderPartionScanReviewModel::updateShippingOrderStatus($ebay_id, $status = PKS_WAITING_LOADING);
         if (!$ostatus) {
             WhBaseModel::rollback();
             $data = array("data" => array('更新发货单状态失败,请联系负责人!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput');
             goErrMsgPage($data);
             exit;
         }
         WhPushModel::pushOrderStatus($ebay_id, 'PKS_WAITING_LOADING', $_SESSION['userId'], time());
         //状态推送,需要改为待装车扫描(订单系统提供状态常量)
         WhBaseModel::commit();
         $data = array("data" => array('绑定成功,请扫描另外一个发货单!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput');
         goOkMsgPage($data);
     } else {
         $result_tracking_count = $result_tracking_count['trackingCount'];
         //发货单需要绑定跟踪号的数量
         $count_binding = WhOrderTracknumberModel::count($array_count);
         //发货单已经绑定跟踪号的数量
         if ($result_tracking_count > $count_binding) {
             WhBaseModel::begin();
             $result_insert = WhOrderTracknumberModel::insert($data_insert);
             if (!$result_insert) {
                 WhBaseModel::rollback();
                 $data = array("data" => array('跟踪号绑定失败,请联系负责人!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput');
                 goErrMsgPage($data);
                 exit;
             }
             $num = $result_tracking_count - $count_binding - 1;
             if ($num == 0) {
                 //更新发货表状态
                 $ostatus = WhWaveOrderPartionScanReviewModel::updateShippingOrderStatus($ebay_id, $status = PKS_WAITING_LOADING);
                 if (!$ostatus) {
                     WhBaseModel::rollback();
                     $data = array("data" => array('更新发货单状态失败,请联系负责人!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput');
                     goErrMsgPage($data);
                     exit;
                 }
                 WhPushModel::pushOrderStatus($ebay_id, ' ', $_SESSION['userId'], time());
                 //状态推送,需要改为待装车扫描(订单系统提供状态常量)
                 WhBaseModel::commit();
                 $data = array("data" => array('绑定成功,该发货单不需要绑定跟踪号了!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput');
                 goErrMsgPage($data);
             } else {
                 WhBaseModel::commit();
                 $data = array("data" => array('绑定成功,该发货单还需要绑定' . $num . '个跟踪号!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput');
                 goOkMsgPage($data);
             }
         } else {
             $data = array("data" => array('绑定失败,绑定的跟踪号已经够' . $result_tracking_count . '个,请扫描另外一个发货单!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput');
             goErrMsgPage($data);
             exit;
         }
     }
     $navlist = array(array('url' => '', 'title' => '出库'), array('url' => 'index.php?mod=expressRecheck&act=ExpressList', 'title' => '快递待复核'), array('url' => '', 'title' => '快递待复核数据导入 '));
     $this->smarty->assign('navlist', $navlist);
     $toptitle = '待复核';
     // 顶部链接
     $this->smarty->assign('toptitle', $toptitle);
     $toplevel = 2;
     // 顶层菜单
     $this->smarty->assign('toplevel', $toplevel);
     $secondlevel = '28';
     // 当前的二级菜单
     $this->smarty->assign('secondlevel', $secondlevel);
     $this->smarty->assign('secnev', 3);
     // 二级导航
     $this->smarty->assign('list', TrackInfoRecordModel::$data);
     $this->smarty->display('tracknumimport.htm');
 }
Esempio n. 4
0
 /**
  * Pda_orderLoadingAct::act_orderExpress()
  * 如果装车扫描的时候是扫描快递的,那么该模块接收的变量的值是追踪号$ebay_id,发货单号是$shipOrderId
  * @author cxy
  * @return
  */
 public function act_orderExpress()
 {
     $userId = $_SESSION['userId'];
     $shipOrderId = trim($_POST['shipOrderId']);
     //快递单号
     $ebay_id = trim($_POST['ebay_id']);
     //扫描的跟踪号
     if (empty($shipOrderId)) {
         self::$errCode = '201';
         self::$errMsg = '请输入发货单号!';
         return false;
     }
     if (empty($ebay_id)) {
         self::$errCode = '201';
         self::$errMsg = '请输入跟踪号!';
         return false;
     }
     // $arr_track[] = $ebay_id;
     //记录表里和发货单关联的跟踪号
     $tracknumber = WhOrderTracknumberModel::select_TracknumberByOrderId($shipOrderId);
     //print_r($tracknumber);exit();
     $tracking_arr = array();
     foreach ($tracknumber as $track) {
         $tracking_arr[] = $track['tracknumber'];
     }
     // print_r($arr_track);
     // print_r($tracking_arr);exit;
     if (!in_array($ebay_id, $tracking_arr)) {
         self::$errCode = '202';
         self::$errMsg = '输入的跟踪号没有和该发货单号绑定!';
         return false;
     }
     $data = array('packageId' => $shipOrderId, 'scantime' => time(), 'userId' => $userId, 'tracking' => $ebay_id, 'isExpress' => 1);
     $select_loading = WhWaveOrderLoadingModel::select_loading_express($shipOrderId, $ebay_id);
     if ($select_loading) {
         self::$errCode = '003';
         self::$errMsg = '该' . $shipOrderId . '下的跟踪号' . $ebay_id . '已经进行过装车扫描了!';
         return false;
     }
     $insert_loading = WhWaveOrderLoadingModel::insert($data);
     if (empty($insert_loading)) {
         self::$errCode = '003';
         self::$errMsg = '装车扫描失败,请联系负责人!';
         return false;
     }
     $count_load = WhWaveOrderLoadingModel::select_loading_count($shipOrderId);
     //已经装车扫描的记录
     //当需要扫描的跟踪号等于已经扫描的跟踪号的时候就改变发货单的状态
     if ($count_load['muns'] == count($tracknumber)) {
         $result = WhWaveOrderPartionScanReviewModel::updateShippingOrderStatus($shipOrderId, $status = PKS_DONE);
         if (!$result) {
             self::$errCode = '003';
             self::$errMsg = '更新' . $shipOrderId . '发货单号失败,请联系负责人!';
             return false;
         }
         WhPushModel::pushOrderStatus($shipOrderId, 'PKS_DONE', $_SESSION['userId'], time());
         //状态推送,需要改为已发货(订单系统提供状态常量)
         self::$errMsg = '扫描' . $shipOrderId . '快递单成功,请扫描下一个发货单号!';
     } else {
         self::$errMsg = '扫描' . $shipOrderId . '快递单的跟踪号成功,请扫描该快递单的下一个跟踪号!';
     }
     self::$errCode = '200';
     return true;
     // WhOrderTracknumberModel::select_ByTracknumber($ebay_id);
     // echo $ebay_id.'--'.$shipOrderId;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;
     }
 }