对接 PDA 问题件扫描确认上架

来源:互联网 发布:淘宝上正品金丝楠木店 编辑:程序博客网 时间:2024/04/30 09:31
/*     * 订单信息验证     * @param params=>array('header'=>用户/TOKEN/KEY,'data'=>订单数据验证,'methods') //json data     * @return array('status'=>1成功/0失败,'msg'=>系统信息,'systime'=>系统时间,'data'=>返回数据) //joson data     *     */ public function svcAction() {    //问题件扫描确认    if ( $params->methods == 'ProblemProductInfo' ) {         //接收 PDA 扫描数据         $problem_product = isset( $params->data->ProblemProduct ) ? $params->data->ProblemProduct : '';         //嵌套查询(订单号、跟踪号、物流单号)         if( !empty( $problem_product ) ) {              $condition = array( 'order_code' => $problem_product );              $Info = Order_Service_ProblemOrder::getByCondition( $condition );              if( !$Info ) {                   $condition = array( 'ref_tracking_number' => $problem_product );                   $Info = Order_Service_ProblemOrder::getByCondition( $condition );                    if( !$Info ) {                        $condition = array( 'tracking_number' => $problem_product );                        $Info = Order_Service_ProblemOrder::getByCondition( $condition );                   }                  }         }         //返回订单状态         if ( !empty( $Info ) ) {              foreach ( $Info as $value ) {                   if ( $value['po_status'] == 0 ) {                        $po_status = "删除";                   } else if ( $value['po_status'] == 1 ) {                        $po_status = "草稿";                   } else if ( $value['po_status'] == 2 ) {                        $po_status = "待客服处理";                   } else if ( $value['po_status'] == 3 ) {                        $po_status = "待操作处理";                   } else if ( $value['po_status'] == 4 ) {                        $po_status = "处理完成";                   }              }              $return['status'] = 1;              $return['msg'] = "成功";              $return['data'] = array( 'po_status' => $po_status );         } else {              $return['status'] = 0;              $return['msg'] = "问题件不存在";         }         die( json_encode( $return ) );    }    //问题件上架    if ( $params->methods == 'ProblemShelvesInfo' ) {         //接收 PDA 扫描数据         $problem_product = isset( $params->data->ProblemProduct ) ? $params->data->ProblemProduct : '';         $ws_code = isset( $params->data->ws_code ) ? $params->data->ws_code : '';         //确认货位号是否在该货架上         $condition = array( 'ws_code' => $ws_code );         $Info = Warehouse_Service_Shelf::getByCondition( $condition );         if ( !empty( $Info ) ) {              //确认该货架是否在不良区              foreach ( $Info as $value ) {                   $wa_type = Warehouse_Service_Area::getByWaCode( $value['wa_code'] );              }              if ( $wa_type['wa_type'] == 2 ) {                   //嵌套查询订单号是否存在货位号(订单号、跟踪号、物流单号)                   if( !empty( $problem_product ) ) {                        $data = array( 'order_code' => $problem_product );                        $problem_orderInfo = Order_Service_ProblemOrder::getByCondition( $data );                        if( empty( $problem_orderInfo ) ) {                             $data = array( 'ref_tracking_number' => $problem_product );                             $problem_orderInfo = Order_Service_ProblemOrder::getByCondition( $data );                              if( empty( $problem_orderInfo ) ) {                                  $data = array( 'tracking_number' => $problem_product );                                  $problem_orderInfo = Order_Service_ProblemOrder::getByCondition( $data );                             }                            }                   }                   if ( !empty( $problem_orderInfo ) ) {                        //订单号绑定货位号                        foreach ( $problem_orderInfo as $v ) {                             if ( $v['po_status'] == 4 ) {                                  $return['status'] = 0;                                  $return['msg'] = "处理完成订单不能再次上架";                             } else {                                  if ( empty( $v['ws_code'] ) ) {                                       $problem_orderList = Order_Service_ProblemOrder::update( $condition, $v['po_id'] );                                       $return['status'] = 1;                                       $return['msg'] = "上架成功";                                  } else {                                       $return['status'] = 0;                                       $return['msg'] = "该订单号已绑定货位号";                                  }                             }                        }                   } else {                        $return['status'] = 0;                        $return['msg'] = "问题件不存在";                   }              } else {                   $return['status'] = 0;                   $return['msg'] = "不良品区不存在该货位号";              }         } else {              $return['status'] = 0;              $return['msg'] = "货位号不存在";         }         die( json_encode( $return ) );    }}
原创粉丝点击