public function act_orderPartion() { $orderid = isset($_POST['orderid']) ? trim($_POST['orderid']) : ""; if (!is_numeric($orderid)) { $tracknumber = $orderid; $info = orderWeighingModel::selectOrderId($tracknumber); if (!$info) { self::$errCode = 501; self::$errMsg = "此跟踪号不存在!"; return false; } $orderid = $info[0]['shipOrderId']; } $where = "where id={$orderid}"; $order = orderPartionModel::selectOrder($where); if (!$order) { self::$errCode = 601; self::$errMsg = "此发货单不存在!"; return false; } if (!is_numeric($orderid)) { $orderid = $order[0]['id']; } $msg = orderPartionModel::selectPartionRecord($orderid); if ($msg) { self::$errCode = 603; self::$errMsg = "此发货单已扫描!"; return false; } if ($order[0]['orderStatus'] != 406) { self::$errCode = 602; self::$errMsg = "此发货单不在待分区!"; return false; } $shipping = CommonModel::getShipingNameById($order[0]['transportId']); if (!in_array($shipping, array('中国邮政平邮', '中国邮政挂号', 'EUB', 'Global Mail', '香港小包平邮', '香港小包挂号', '德国邮政'))) { self::$errCode = 604; self::$errMsg = "此发货单不是小包!"; return false; } $partion = $shipping; $platformName = CommonModel::getPlatformInfo($order[0]['platformId']); if ($shipping == 'Global Mail') { if ($platformName == '亚马逊') { $partion = "非德国Global Mail"; } elseif ($platformName == '海外销售平台') { if ($order[0]['countryName'] == 'Deutschland') { $partion = "Global Mail"; } else { $partion = "非德国Global Mail"; } } } elseif ($shipping == '中国邮政平邮') { $partion = printLabelModel::showPartionScan($orderid, $order[0]['accountId'], $shipping, $order[0]['countryName']); } elseif ($shipping == '中国邮政挂号') { $partion = printLabelModel::showPartionScan($orderid, $order[0]['accountId'], $shipping, $order[0]['countryName']); } /* $lists = $memc_obj->get_extral('trans_system_carrierinfo'); //print_r($lists); foreach($lists as $list){ foreach($list as $value){ if($record[0]['channelId']==$value['channelId']){ $countries = $value['countries']; $country_arr = explode("','",$countries); $country_arr[0] = str_replace("'","",$country_arr[0]); $country_arr[count($country_arr)-1] = str_replace("'","",$country_arr[count($country_arr)-1]); if(in_array($record[0]['countryName'],$country_arr)){ $partionId = $value['id']; } } } }*/ TransactionBaseModel::begin(); $weight = orderPartionModel::selectWeight($orderid); if (!$weight) { self::$errCode = 605; self::$errMsg = "此发货单无重量!"; return false; } $userId = $_SESSION['userId']; $result = orderPartionModel::insertRecord($orderid, $partion, $weight, $userId); if (!result) { self::$errCode = 606; self::$errMsg = "插入分区记录失败!"; TransactionBaseModel::rollback(); return false; } $ret = orderPartionModel::updateOrderRecords($orderid, $userId); if (!ret) { self::$errCode = 607; self::$errMsg = "更新操作记录失败!"; TransactionBaseModel::rollback(); return false; } $ostatus = orderPartionModel::updateOrderStatus($orderid); if (!ostatus) { self::$errCode = 608; self::$errMsg = "更新发货单状态失败!"; TransactionBaseModel::rollback(); return false; } $arr['orderid'] = $orderid; $arr['partion'] = urlencode($partion); TransactionBaseModel::commit(); return $arr; }