public function act_changeOutOfStockToDispathBill() { $orderids = $_REQUEST['orderids']; if (empty($orderids)) { self::$errCode = "001"; self::$errMsg = "发货单号为空!"; return false; } if (!is_numeric($orderids)) { $tracknumber = $orderids; $info = orderWeighingModel::selectOrderId($tracknumber); if (!$info) { self::$errCode = 501; self::$errMsg = "此跟踪号不存在!"; return false; } $orderids = $info[0]['shipOrderId']; } $orderStatus = ShippingOrderModel::getShippingOrder("orderStatus", " where id='{$orderids}'"); $orderStatus = $orderStatus[0]['orderStatus']; if ($orderStatus == '402' || $orderStatus == '703') { $changeStatus = new printAct(); $changeStatus->act_markUnusual1(); if (empty($ret) || $changeStatus::$errCode != '200') { self::$errCode = $changeStatus::$errCode; self::$errMsg = $changeStatus::$errMsg; return false; //失败 } else { self::$errCode = $changeStatus::$errCode; self::$errMsg = $changeStatus::$errMsg; return true; } } self::$errCode = "002"; self::$errMsg = "非待配货!"; return false; }
public function act_packingTracknumber() { $orderid = isset($_POST['orderid']) ? $_POST['orderid'] : ""; $tracknumber = isset($_POST['tracknumber']) ? $_POST['tracknumber'] : ""; $userId = $_SESSION['userId']; //先核对订单 //兼容 EUB或者 包裹 扫描的是 trackno 而非ebayid $p_real_ebayid = '#^\\d+$#'; $p_trackno_eub = '#^(LK|RA|RB|RC|RR|RF|LN)\\d+(CN|HK|DE200)$#'; $is_eub_package_type = false; if (preg_match($p_real_ebayid, $orderid)) { } else { if (preg_match($p_trackno_eub, $orderid)) { $is_eub_package_type = true; } else { self::$errCode = "001"; self::$errMsg = "订单号[" . $orderid . "]格式有误"; return false; } } if ($is_eub_package_type === true) { $record = ShippingOrderModel::getShippingOrderInfo("b.*", "where a.tracknumber='{$orderid}' and a.is_delete=0"); } else { $record = ShippingOrderModel::getShippingOrder("*", "where id='{$orderid}'"); } //验证发货单号 以及所属状态 if (!$record) { self::$errCode = 404; self::$errMsg = "发货单号不存在!"; return false; } if ($record[0]['orderStatus'] != 404) { self::$errCode = 405; self::$errMsg = "此发货单不在待包装!"; if ($record[0]['orderStatus'] == 900) { self::$errMsg = "此发货单已废弃!"; } return false; } //挂号的单需要再输入挂号条码 $carrier = CommonModel::getShipingNameById($record[0]['transportId']); $partion = CommonModel::getChannelNameByIds($record[0]['transportId'], $record[0]['countryName']); $total_num = 0; $skuinfos = get_realskunum($record[0]['id']); foreach ($skuinfos as $or_sku => $or_nums) { $total_num += $or_nums; } if (carrier == '中国邮政挂号' && !preg_match("/^(RA|RB|RC|RR)\\d+(CN)\$/", $tracknumber)) { self::$errCode = 111; self::$errMsg = "录入失败,中国邮政挂号跟踪码不符合规范"; return false; } if ($carrier == '香港小包挂号' && !preg_match("/^(RA|RB|RC|RR)\\d+(HK)\$/", $tracknumber)) { self::$errCode = 111; self::$errMsg = "录入失败,香港小包挂号跟踪码不符合规范"; return false; } $p_str = "挂号条码:" . "<font color='#FF0000'>" . $tracknumber . "</font> <br>"; TransactionBaseModel::begin(); //更新订单状态 $msg = OmAvailableModel::updateTNameRow("wh_shipping_order", "set orderStatus=405", "where id={$record[0]['id']}"); if (!$msg) { self::$errCode = 409; self::$errMsg = "更新发货单状态记录失败!"; $arr['partion'] = $partion; $arr['carrier'] = $carrier; TransactionBaseModel::rollback(); return json_encode($arr); exit; } //更新操作记录 $msg = packingScanOrderModel::updateOrderRecord($record[0]['id'], $userId); if (!$msg) { self::$errCode = 406; self::$errMsg = "更新发货单操作记录失败!"; TransactionBaseModel::rollback(); return false; } //插入包装记录 $msg = packingScanOrderModel::insertPackingRecord($record[0]['id'], $userId); if (!$msg) { self::$errCode = 407; self::$errMsg = "插入包装记录失败!"; TransactionBaseModel::rollback(); return false; } $msg = packingScanOrderModel::deleteTrackRecord($record[0]['id']); if (!$msg) { self::$errCode = 409; self::$errMsg = "删除跟踪记录失败!"; TransactionBaseModel::rollback(); return false; } //录入挂号条码 $msg = packingScanOrderModel::insertTrackRecord($tracknumber, $record[0]['id']); if (!$msg) { self::$errCode = 408; self::$errMsg = "插入包装记录失败!"; TransactionBaseModel::rollback(); return false; } WhPushModel::pushOrderStatus($record[0]['id'], 'STATESHIPPED_BEWEIGHED', $userId, time(), '', $tracknumber); //状态推送 $arr['partion'] = "<font color='#FF0000'>该订单属于" . $partion . ";含SKU总数:" . $total_num . "个</font><br>"; $arr['carrier'] = $carrier; $arr['res'] = $arr['partion'] . "包装人员:" . "<font color='green'>" . $_SESSION['userCnName'] . "</font><br>" . "运输方式:" . "<font color='#FF0000'>" . $carrier . "</font> <br>" . $p_str . "扫描结果:<font color='#33CC33'>包装扫描成功!</font>"; TransactionBaseModel::commit(); return $arr; }
public function act_setShippingEnd() { $order_id = $_POST['ebay_id']; //先核对订单 $p_real_ebayid = '#^\\d+$#'; if (!preg_match($p_real_ebayid, $order_id)) { self::$errCode = "100"; self::$errMsg = "订单号[" . $order_id . "]格式有误"; return false; } $ordercheck = ShippingOrderModel::getShippingOrder("*", "where id='{$order_id}'"); if ($ordercheck) { $skuinfos = OrderReviewModel::getReviewList("*", "where shipOrderId='{$ordercheck[0]['id']}' and is_delete = 0"); if ($skuinfos) { self::$errCode = 200; self::$errMsg = '确定手动完结复核该订单吗'; return $skuinfos; } else { self::$errCode = "007"; self::$errMsg = '订单没有在复核记录表中,请确认复核'; return false; } } else { self::$errCode = "006"; self::$errMsg = '订单复核出现异常,请重新复核'; return false; } }
public function act_return() { $orderid = isset($_POST['orderid']) ? $_POST['orderid'] : ""; $userId = $_SESSION['userId']; //先核对订单 //兼容 EUB或者 包裹 扫描的是 trackno 而非ebayid $p_real_ebayid = '#^\\d+$#'; $p_trackno_eub = '#^(LK|RA|RB|RC|RR|RF|LN)\\d+(CN|HK|DE200)$#'; $is_eub_package_type = false; if (preg_match($p_real_ebayid, $orderid)) { } else { if (preg_match($p_trackno_eub, $orderid)) { $is_eub_package_type = true; } else { self::$errCode = 401; self::$errMsg = "订单号[" . $orderid . "]格式有误"; return false; } } if ($is_eub_package_type === true) { $record = ShippingOrderModel::getShippingOrderInfo("b.*", "where a.tracknumber='{$orderid}' and a.is_delete=0"); } else { $record = ShippingOrderModel::getShippingOrder("*", "where id='{$orderid}'"); } //验证发货单号 以及所属状态 if (!$record) { self::$errCode = 402; self::$errMsg = "发货单号不存在!"; return false; } if ($record[0]['orderStatus'] != 501) { self::$errCode = 403; self::$errMsg = "此发货单不是已发货!"; return false; } $order_detail = get_realskunum($record[0]['id']); $return_info = PostReturnModel::getReturnList("*", "where shipOrderId={$record[0]['id']}"); if (empty($return_info)) { $data = array(); $qc_arr = array(); $time = time(); OmAvailableModel::begin(); foreach ($order_detail as $sku => $num) { $data['shipOrderId'] = $record[0]['id']; $data['sku'] = $sku; $data['amount'] = $num; $data['returnTime'] = $time; $insert_info = PostReturnModel::insertRow($data); if (!$insert_info) { self::$errCode = 404; self::$errMsg = "订单录入失败"; OmAvailableModel::rollback(); return false; } $qc_arr[$record[0]['id']][$sku] = $num; } $qcinfo = CommonModel::qcOrderBackDetect(json_encode($qc_arr)); if (!$qcinfo) { self::$errCode = 405; self::$errMsg = "订单录入失败"; OmAvailableModel::rollback(); return false; } OmAvailableModel::commit(); self::$errMsg = "订单录入成功"; } else { self::$errCode = 406; self::$errMsg = "该订单已录入系统,请不要重复录入"; return false; } }
function act_searchWeighInfo($orderid) { $p_real_ebayid = '#^\\d+$#'; $p_trackno_eub = '#^(LK|RA|RB|RC|RR|RF|LN|LX)\\d+(CN|HK|DE200)$#'; $is_eub_package_type = false; if (preg_match($p_real_ebayid, $orderid)) { } else { if (preg_match($p_trackno_eub, $orderid)) { $is_eub_package_type = true; } else { return "订单号不存在,请确认!"; exit; } } if ($is_eub_package_type === true) { $ordercheck = ShippingOrderModel::getShippingOrderInfo("b.*", "where a.tracknumber='{$orderid}' and a.is_delete=0"); } else { $ordercheck = ShippingOrderModel::getShippingOrder("*", "where id='{$orderid}'"); } if (empty($ordercheck)) { return "订单号不存在,请确认!"; exit; } else { $orderid = $ordercheck[0]['id']; } $where = "where shipOrderId='{$orderid}' and is_delete=0 order by scanTime"; $list = OmAvailableModel::getTNameList("wh_order_weigh_records", "*", $where); if (empty($list)) { return "订单号{$orderid}没有称重扫描记录!"; } else { $scan_status = '已称重扫描。'; $usermodel = UserModel::getInstance(); $iqc_user = $usermodel->getGlobalUserLists('global_user_name', "where a.global_user_id={$list[0]['scanUserId']}", '', ''); $op_name = $iqc_user[0]['global_user_name']; return "订单{$orderid} {$scan_status} 称重扫描人 {$op_name} 称重扫描时间:" . ($list[0]['scanTime'] ? date('Y-m-d H:i:s', $list[0]['scanTime']) : ' 无 ') . "<br>"; } }
function act_searchSku() { $order_id = $_POST['ebay_id']; $sku = trim($_POST['sku']); $sku = get_goodsSn($sku); $now_pname = trim($_POST['now_pname']); $state_status = array(402); //准备状态 $final_status = array(403); //配货完成状态 $no_express_delivery = array('中国邮政平邮', '中国邮政挂号', '香港小包平邮', '香港小包挂号', '德国邮政', '新加坡邮政', 'EUB', 'Global Mail'); //先核对订单 //兼容 EUB或者 包裹 扫描的是 trackno 而非ebayid $p_real_ebayid = '#^\\d+$#'; $p_trackno_eub = '#^(LK|RA|RB|RC|RR|RF|LN)\\d+(CN|HK|DE200)$#'; $is_eub_package_type = false; if (preg_match($p_real_ebayid, $order_id)) { } else { if (preg_match($p_trackno_eub, $order_id)) { $is_eub_package_type = true; } else { self::$errCode = "001"; self::$errMsg = "订单号[" . $order_id . "]格式有误"; return false; } } if ($is_eub_package_type === true) { $ordercheck = ShippingOrderModel::getShippingOrderInfo("b.*", "where a.tracknumber='{$order_id}' and a.is_delete=0"); } else { $ordercheck = ShippingOrderModel::getShippingOrder("*", "where id='{$order_id}'"); } if (empty($ordercheck)) { self::$errCode = '001'; self::$errMsg = '未找到订单/跟踪号[' . $order_id . ']'; return false; } else { $ebay_carrier = CommonModel::getShipingNameById($ordercheck[0]['transportId']); //$ebay_carrier = '中国邮政平邮'; if (!in_array($ebay_carrier, $no_express_delivery)) { self::$errCode = '001'; self::$errMsg = '请选择非快递订单!'; return false; } } if ($ordercheck[0]['orderStatus'] == 900) { self::$errCode = '002'; self::$errMsg = "该发货单[{$order_id}][已经废弃]!"; return false; } else { if (in_array($ordercheck[0]['orderStatus'], $final_status)) { self::$errCode = '005'; self::$errMsg = "该发货单已经扫描完成!"; return false; } } if (!in_array($ordercheck[0]['orderStatus'], $state_status)) { self::$errCode = '002'; self::$errMsg = "该发货单[{$order_id}][不在待配货]!"; return false; } //配货单所有料号及数量 $skuinfos = array(); $skuinfo = GroupRouteModel::getOrderPositionID($ordercheck[0]['id']); foreach ($skuinfo as $info) { $s_key = $info['sku'] . "-" . $info['pName']; $skuinfos[$s_key] = $info['amount']; } $eosr_arr = OrderPickingRecordsModel::getPickingRecords("*", "where shipOrderId={$ordercheck[0]['id']} and sku='{$sku}' and is_delete=0"); if (!$eosr_arr) { self::$errCode = "012"; self::$errMsg = "请扫描正确料号!"; return false; } else { $sku_stock = GroupRouteModel::getSkuPosition("where a.sku='{$sku}' and c.pName='{$now_pname}' and b.is_delete=0"); $s_key = $sku . "-" . $now_pname; $goods_sn = array(); //$gsi = get_sku_info($sku); $goods_sn['sku'] = $sku; //$goods_sn['gc'] = $gsi['realnums']; $goods_sn['gc'] = isset($sku_stock[0]['nums']) ? $sku_stock[0]['nums'] : 0; //$goods_sn['day']= floor($gsi['realnums']/$gsi['everyday_sale']); //库存天数 $goods_sn['day'] = ""; //库存天数 $goods_sn['nums'] = $skuinfos[$s_key]; $goods_sn['is_scan'] = $eosr_arr[0]['isScan'] == 1 ? "已扫描" : "未扫描"; //$eg = GroupRouteModel::getSkuPosition("where a.sku='$sku'"); $goods_sn['gl'] = $now_pname; self::$errCode = "400"; self::$errMsg = '成功搜索该料号信息!' . $sku; return $goods_sn; } }