本文整理匯總了PHP中OmAvailableModel::begin方法的典型用法代碼示例。如果您正苦於以下問題:PHP OmAvailableModel::begin方法的具體用法?PHP OmAvailableModel::begin怎麽用?PHP OmAvailableModel::begin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OmAvailableModel
的用法示例。
在下文中一共展示了OmAvailableModel::begin方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: updatePrintGroup
public static function updatePrintGroup($tallyIdArr)
{
self::initDB();
$log_file = 'print_label_record/' . date('Ymd') . '.txt';
//日誌文件
$date = date('Y-m-d H:i:s');
$userId = $_SESSION['userId'];
$time = time();
if (!is_array($tallyIdArr)) {
return false;
}
$ids = implode(',', $tallyIdArr);
OmAvailableModel::begin();
/** 更新點貨記錄**/
$update_tallying = "update wh_tallying_list set printerId={$userId},printTime={$time} where id in(" . $ids . ")";
$update_tallying = self::$dbConn->query($update_tallying);
if (!$update_tallying) {
$log_info = sprintf("tallyinglistId:%s, 時間:%s, 信息:%s,返回值:%s, 參數:%s \r\n", $ids, $date, '更新點貨信息打標時間失敗', $update_tallying, "update wh_tallying_list set printerId={$userId},printTime={$time} where id in(" . $ids . ")");
write_log($log_file, $log_info);
OmAvailableModel::rollback();
return false;
}
$log_info = sprintf("tallyinglistId:%s, 時間:%s, 信息:%s,返回值:%s, 參數:%s \r\n", $ids, $date, '更新點貨信息打標時間成功', $update_tallying, "update wh_tallying_list set printerId={$userId},printTime={$time} where id in(" . $ids . ")");
write_log($log_file, $log_info);
/** 更新點貨記錄 end**/
/** 更新打標記錄**/
// $select_sql = "select * from wh_print_group where tallyListId={$id} and is_delete=0 order by id desc limit 1";
// $select_info = self::$dbConn->fetch_first($select_sql);
// if(empty($select_info)){
// $log_info = sprintf("tallyinglistId:%s, 時間:%s,錯誤信息:%s,返回值:%s, 參數:%s \r\n", $id, $date, '打標信息不存在',
// is_array($select_info) ? json_encode($select_info) : $select_info , $select_sql);
// write_log($log_file, $log_info);
// OmAvailableModel::rollback();
// return false;
// }
$update_sql = "update wh_print_group set status=1 where tallyListId in ({$ids}) and is_delete=0";
$update_print = self::$dbConn->query($update_sql);
if (!$update_print) {
$log_info = sprintf("tallyinglistId:%s, 時間:%s,錯誤信息:%s,返回值:%s, 參數:%s \r\n", $id, $date, '更新打標記錄失敗', is_array($update_print) ? json_encode($update_print) : $update_print, $update_sql);
write_log($log_file, $log_info);
OmAvailableModel::rollback();
return false;
}
$log_info = sprintf("tallyinglistId:%s, 時間:%s,錯誤信息:%s,返回值:%s, 參數:%s \r\n", $id, $date, '更新打標記錄成功', is_array($update_print) ? json_encode($update_print) : $update_print, $update_sql);
write_log($log_file, $log_info);
/** 更新打標記錄 end**/
/** 推送QC**/
//foreach($tallyIdArr as $id){
$push = WhPushModel::pushTallyingList($ids);
$msg = $push ? '推送成功!' : '推送失敗!';
$log_info = sprintf("tallyinglistId:%s, 時間:%s,錯誤信息:%s,返回值:%s \r\n", $ids, $date, $msg, is_array($push) ? json_encode($push) : $push);
write_log($log_file, $log_info);
//}
OmAvailableModel::commit();
return true;
}
示例2: act_allPass
function act_allPass()
{
$userCnName = $_SESSION['userCnName'];
$id_arr = $_POST['id'];
$f_count = count($id_arr);
$id = implode(',', $id_arr);
$where = "where id in(" . $id . ") and auditStatus=0";
$record_list = InvRecordModel::getInvRecordList("*", $where);
$s_count = count($record_list);
if ($f_count != $s_count) {
self::$errCode = "401";
self::$errMsg = "當前包含有不用審核的訂單,請確認!";
return false;
}
OmAvailableModel::begin();
foreach ($record_list as $record) {
$data = array();
$id = $record['id'];
$data = array('auditStatus' => 1);
$Inv_info = InvRecordModel::getInvRecordList("*", "where id='{$id}'");
$position_info = OmAvailableModel::getTNameList("wh_position_distribution", "id", "where pName='{$Inv_info[0]['location']}'");
$skuinfo = whShelfModel::selectSku(" where sku='{$Inv_info[0]['sku']}'");
$updatedata = InvRecordModel::update($data, "and id='{$id}'");
if (!$updatedata) {
self::$errCode = "402";
self::$errMsg = "更新通過狀態失敗!";
return false;
}
$tName = 'wh_product_position_relation';
$set = "SET nums='{$Inv_info[0]['invNums']}'";
$where = "WHERE pId='{$skuinfo['id']}' AND positionId='{$position_info[0]['id']}' AND is_delete=0 AND storeId=1";
$affectRow = OmAvailableModel::updateTNameRow($tName, $set, $where);
//庫存變化
if ($affectRow === false) {
self::$errCode = "403";
self::$errMsg = "更新具體倉位庫存失敗!";
OmAvailableModel::rollback();
return false;
}
$adjustNums = $Inv_info[0]['adjustNums'];
if ($Inv_info[0]['invType'] == 2) {
$adjustNums = "-" . $adjustNums;
}
$tName = 'wh_sku_location';
$set = "SET actualStock=actualStock+'{$adjustNums}'";
$where = "WHERE sku='{$Inv_info[0]['sku']}' AND storeId=1";
$affectRow = WhIoRecordsModel::updateTNameRow($tName, $set, $where);
//庫存變化
if ($affectRow === false) {
self::$errCode = "404";
self::$errMsg = "更新總庫存失敗!";
OmAvailableModel::rollback();
return false;
}
/**** 插入出入庫記錄 *****/
if ($Inv_info[0]['invType'] == 2) {
$ioType = 1;
$ioTypeId = 11;
$reason = '盤點出庫';
} else {
$ioType = 2;
$ioTypeId = 10;
$reason = '盤點入庫';
}
if ($adjustNums != 0) {
$update_onhand = CommonModel::adjustInventory($Inv_info[0]['sku'], $adjustNums, $userCnName);
if ($update_onhand == 0) {
self::$errCode = 415;
self::$errMsg = "更新舊erp庫存失敗";
OmAvailableModel::rollback();
return false;
}
$skuinfo = whShelfModel::selectSku(" where sku = '{$Inv_info[0]['sku']}'");
$paraArr = array('sku' => $Inv_info[0]['sku'], 'amount' => abs($adjustNums), 'positionId' => $position_info[0]['id'], 'purchaseId' => $skuinfo['purchaseId'], 'ioType' => $ioType, 'ioTypeId' => $ioTypeId, 'userId' => $_SESSION['userId'], 'reason' => $reason);
$record = CommonModel::addIoRecores($paraArr);
//出庫記錄
if (!$record) {
OmAvailableModel::rollback();
return false;
}
}
//更新申請盤點表
$waitInf = WaitInventoryModel::updateInv($Inv_info[0]['sku'], $_SESSION['userId']);
if (!$waitInf) {
self::$errCode = 414;
self::$errMsg = "跟新申請盤點表失敗!";
TransactionBaseModel::rollback();
return false;
}
}
OmAvailableModel::commit();
return true;
}
示例3: deletRecord
public static function deletRecord($id_arr, $type = 0)
{
self::initDB();
if (!is_array($id_arr) || !is_numeric($type)) {
return false;
}
OmAvailableModel::begin();
foreach ($id_arr as $id) {
$info = self::selectList("where id={$id}");
$num = -$info[0]['num'];
$sku = $info[0]['sku'];
$update_tallying = "UPDATE wh_tallying_list SET is_delete=1 where id={$id}";
$update_query = self::$dbConn->query($update_tallying);
if (!$update_query) {
OmAvailableModel::rollback();
return false;
}
$update_store = self::updateStore($sku, $num);
if (!$update_store) {
OmAvailableModel::rollback();
return false;
}
if ($type == 1) {
$update_group = "UPDATE wh_print_group SET is_delete=1 where tallyListId={$id}";
$query_group = self::$dbConn->query($update_group);
if (!$query_group) {
OmAvailableModel::rollback();
return false;
}
}
CommonModel::checkOnWaySkuNum($sku, $info[0]['num'], 2);
//去掉采購係統hold住數量
}
OmAvailableModel::commit();
return true;
}
示例4: begin
function begin()
{
OmAvailableModel::begin();
}
示例5: foreach
$sku_blag = true;
break;
}
foreach ($position_arr as $position) {
$order_detail[] = array('sku' => $sku, 'amount' => $position['amount'], 'positionId' => $position['positionId'], 'pName' => $position['position']);
}
}
if ($sku_blag) {
continue;
}
if (count($order_detail) == 1) {
$orderAttributes = 1;
} else {
$orderAttributes = 2;
}
OmAvailableModel::begin();
$insert_arr[] = "username='{$order_infos['ebay_username']}'";
$insert_arr[] = "platformId='{$order_infos['platformId']}'";
$insert_arr[] = "platformUsername='{$order_infos['ebay_userid']}'";
$insert_arr[] = "email='{$order_infos['ebay_usermail']}'";
$insert_arr[] = "countryName='{$order_infos['ebay_countryname']}'";
$insert_arr[] = "countrySn='{$order_infos['ebay_couny']}'";
$insert_arr[] = "state='{$order_infos['ebay_state']}'";
$insert_arr[] = "city='{$order_infos['ebay_city']}'";
$insert_arr[] = "street='{$order_infos['ebay_street']}'";
$insert_arr[] = "address2='{$order_infos['ebay_street1']}'";
$insert_arr[] = "currency='{$order_infos['ebay_currency']}'";
$insert_arr[] = "landline='{$order_infos['ebay_phone']}'";
$insert_arr[] = "phone='{$order_infos['ebay_phone1']}'";
$insert_arr[] = "zipCode='{$order_infos['ebay_postcode']}'";
$insert_arr[] = "transportId='{$flip_carrier_arr[$order_infos['ebay_carrier']]}'";
示例6: act_return
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;
}
}
示例7: act_removeRollback
function act_removeRollback()
{
$userId = $_SESSION['userId'];
$time = time();
$shipOrderId = $_POST['order'];
$sku = $_POST['sku'];
$pName = $_POST['pname'];
$scan_record = OmAvailableModel::getTNameList("wh_order_picking_records", "*", "where shipOrderId='{$shipOrderId}' and sku='{$sku}' and pName='{$pName}' and is_delete=0 ");
if (empty($scan_record)) {
self::$errCode = "401";
self::$errMsg = "配貨單號 {$shipOrderId} 其中料號 {$sku} 在倉位 {$pName} 的配貨記錄不存在!";
return false;
} else {
OmAvailableModel::begin();
$amount = $scan_record[0]['amount'];
//配貨數量
$sql = "update ebay_order_scan_record set is_show = 1,canceltime='{$mctime}' where ebay_id = '{$ebay_id}' and sku = '{$ebay_sku}' and is_show = 0 ";
$update_record = OmAvailableModel::updateTNameRow("wh_order_picking_records", "set cancelUserId='{$userId}',cancelTime='{$time}',is_delete=1", "where shipOrderId='{$shipOrderId}' and sku='{$sku}' and pName='{$pName}' and is_delete=0");
if (!$update_record) {
self::$errCode = "402";
self::$errMsg = "配貨單刪除配貨記錄失敗";
return false;
}
$sku_info = OmAvailableModel::getTNameList("pc_goods", "id", "where sku='{$sku}' and is_delete=0");
$position_info = OmAvailableModel::getTNameList("wh_position_distribution", "id", "where pName='{$pName}' and storeId=1");
if (!$position_info || !$sku_info) {
self::$errCode = "403";
self::$errMsg = "配貨單刪除配貨記錄失敗,找不到對應倉位id或者skuid";
OmAvailableModel::rollback();
return false;
}
$update_product_position = OmAvailableModel::updateTNameRow("wh_product_position_relation", "set nums=nums+'{$amount}'", "where pId={$sku_info[0]['id']} and positionId={$position_info[0]['id']}");
if (!$update_product_position) {
self::$errCode = "404";
self::$errMsg = "配貨單刪除配貨記錄失敗,更新倉位數量出錯";
OmAvailableModel::rollback();
return false;
}
$update_sku_location = OmAvailableModel::updateTNameRow("wh_sku_location", "set actualStock=actualStock+'{$amount}'", "where sku='{$sku}' and storeId=1");
if (!$update_sku_location) {
self::$errCode = "405";
self::$errMsg = "配貨單刪除配貨記錄失敗,更新庫存數量出錯";
OmAvailableModel::rollback();
return false;
}
self::$errMsg = "配貨單刪除配貨記錄成功";
OmAvailableModel::commit();
return false;
}
}
示例8: act_pdaAdjust
public function act_pdaAdjust()
{
$userCnName = $_SESSION['userCnName'];
$userId = $_SESSION['userId'];
$groupid = trim($_POST['groupid']);
$num = intval(trim($_POST['num']));
if ($num == 0) {
self::$errCode = "401";
self::$errMsg = "請輸入正數";
return false;
}
$list = packageCheckModel::getSKUByGroupId($groupid);
if ($list) {
OmAvailableModel::begin();
$entryStatus = 0;
$nums = -$num;
$id = $list[0]['id'];
$batchNum = $list[0]['batchNum'];
$sku = $list[0]['sku'];
$beforeNum = $list[0]['num'];
$ichibanNums = $list[0]['ichibanNums'];
$shelvesNums = $list[0]['shelvesNums'];
$now_num = $beforeNum - $num;
$u_num = -$num;
/** 判斷點貨調整後數量是否為負數**/
if ($now_num <= 0) {
self::$errCode = 203;
self::$errMsg = "調整後數量必須大於0!";
return false;
}
/** 已上架情況下不許調整**/
if ($shelvesNums) {
self::$errCode = 203;
self::$errMsg = "料號已有上架數,不能調整!";
return false;
}
/** 判斷有良品的情況下調整數量隻能小於原先點貨數量**/
if ($ichibanNums && $now_num > $beforeNum) {
self::$errCode = 203;
self::$errMsg = "良品存在時,點貨調整後數量必須小於原點貨數量!";
return false;
}
CommonModel::adjustPrintNum($batchNum, $nums);
//去除qc數量
if ($shelvesNums == 0) {
//釋放采購hold住數量
$delCheckOnWaySku = CommonModel::checkOnWaySkuNum($sku, $beforeNum, 2);
//驗證sku在途數量是否足夠
$checkOnWaySku = CommonModel::checkOnWaySkuNum($sku, $now_num, 1);
if ($checkOnWaySku == 0) {
$u_num = -$num;
} else {
$entryStatus = 1;
$u_num = -$beforeNum;
}
}
$updateinfo = packageCheckModel::updateRecord($id, $nums, $entryStatus);
if (!$updateinfo) {
self::$errCode = 203;
self::$errMsg = "更新點貨記錄失敗!";
OmAvailableModel::rollback();
return false;
}
$insertinfo = packageCheckModel::insertAdjustRecord($id, $nums, $beforeNum, $userId);
if (!$insertinfo) {
self::$errCode = 204;
self::$errMsg = "插入點貨調整記錄失敗!";
OmAvailableModel::rollback();
return false;
}
$updatestore = packageCheckModel::updateStore($sku, $u_num);
if (!updatestore) {
self::$errCode = 205;
self::$errMsg = "更新總庫存失敗!";
OmAvailableModel::rollback();
return false;
}
if ($ichibanNums != 0 && $ichibanNums != NULL) {
$updateIchibanNums = packageCheckModel::updateIchibanNums($nums, $id);
if ($shelvesNums != 0) {
$updateshelvesNums = packageCheckModel::updateShelvesNums($nums, $sku, $id);
if (!$updateshelvesNums) {
self::$errCode = 206;
self::$errMsg = "更新上架庫存失敗!";
OmAvailableModel::rollback();
return false;
}
$update_onhand = CommonModel::adjustOut($sku, $nums, $userCnName);
if ($update_onhand == 0) {
self::$errCode = 206;
self::$errMsg = "更新舊erp庫存失敗";
OmAvailableModel::rollback();
return false;
}
}
}
self::$errMsg = "調整成功";
OmAvailableModel::commit();
return true;
} else {
//.........這裏部分代碼省略.........
示例9: act_markUnusual1
public function act_markUnusual1()
{
$userId = $_SESSION['userId'];
$orderids = isset($_POST['orderids']) ? $_POST['orderids'] : '';
if (empty($orderids)) {
self::$errCode = 0;
self::$errMsg = '請選擇發貨單號!';
return;
}
if (!is_numeric($orderids)) {
$tracknumber = $orderids;
$info = orderWeighingModel::selectOrderId($tracknumber);
if (!$info) {
self::$errCode = 501;
self::$errMsg = "此跟蹤號不存在!";
return false;
}
$orderids = $info[0]['shipOrderId'];
}
$order_arr = explode(',', $orderids);
OmAvailableModel::begin();
$po_obj = new PackingOrderModel();
$qresult = $po_obj->changeStatusToUnusual($orderids);
if ($qresult) {
foreach ($order_arr as $order) {
$order_info = orderWeighingModel::selectOrderDetail($order);
foreach ($order_info as $o_info) {
$data = array();
$sku_info = InvRecordModel::getSkuInfo($o_info['sku']);
$data = array('sku' => $o_info['sku'], 'applicantId' => $userId, 'applicantionTime' => time(), 'invReasonId' => 4, 'invStatus' => 0, 'systemNums' => $sku_info['actualStock']);
$insertid = WaitInventoryModel::insertRow($data);
if (!$insertid) {
self::$errCode = 0;
self::$errMsg = '標記異常發貨單失敗!';
OmAvailableModel::rollback();
return false;
}
}
}
self::$errCode = 200;
self::$errMsg = '標記異常發貨單成功!';
OmAvailableModel::commit();
return true;
} else {
self::$errCode = 0;
self::$errMsg = '標記異常發貨單失敗!';
return false;
}
}
示例10: act_shiftLibrary
public function act_shiftLibrary()
{
$sku = trim($_POST['sku']);
$sku = get_goodsSn($sku);
$oldposition = trim($_POST['oldposition']);
$newposition = trim($_POST['newposition']);
$nums = intval(trim($_POST['nums']));
if (empty($sku)) {
self::$errCode = 401;
self::$errMsg = "sku不能為空";
return false;
}
if (empty($oldposition)) {
self::$errCode = 402;
self::$errMsg = "舊倉位號不能為空";
return false;
}
if (empty($newposition)) {
self::$errCode = 403;
self::$errMsg = "新倉位號不能為空";
return false;
}
if ($oldposition == $newposition) {
self::$errCode = 404;
self::$errMsg = "新舊倉位號不能相同";
return false;
}
$where = " where sku = '{$sku}'";
$skuinfo = whShelfModel::selectSku($where);
if (empty($skuinfo)) {
self::$errCode = 404;
self::$errMsg = "無該料號信息";
return false;
} else {
$skuId = $skuinfo['id'];
}
$old_positon_info = OmAvailableModel::getTNameList("wh_position_distribution", "id", "where pName='{$oldposition}' and storeId in(1,2)");
if (empty($old_positon_info)) {
self::$errCode = 405;
self::$errMsg = "無舊倉位號信息";
return false;
} else {
$old_location = $old_positon_info[0]['id'];
}
$new_positon_info = OmAvailableModel::getTNameList("wh_position_distribution", "id,type", "where pName='{$newposition}' and storeId in(1,2)");
if (empty($new_positon_info)) {
self::$errCode = 406;
self::$errMsg = "無新倉位號信息";
return false;
} else {
$new_location = $new_positon_info[0]['id'];
}
$old_sku_pos_info = OmAvailableModel::getTNameList("wh_product_position_relation", "*", "where pId='{$skuId}' and positionId='{$old_location}' and storeId in(1,2) and is_delete=0");
if (empty($old_sku_pos_info)) {
self::$errCode = 407;
self::$errMsg = "無sku對應的舊倉位號信息";
return false;
}
$new_sku_pos_info = OmAvailableModel::getTNameList("wh_product_position_relation", "*", "where pId='{$skuId}' and positionId='{$new_location}' and storeId in(1,2) and is_delete=0");
if ($nums > $old_sku_pos_info[0]['nums'] || empty($nums)) {
$change_nums = $old_sku_pos_info[0]['nums'];
} else {
$change_nums = $nums;
}
OmAvailableModel::begin();
if (!empty($new_sku_pos_info)) {
if (empty($nums)) {
$tname_old = "wh_product_position_relation";
$set_old = "set nums=0,is_delete=1";
$where_old = "where id={$old_sku_pos_info[0]['id']}";
$update_old = OmAvailableModel::updateTNameRow($tname_old, $set_old, $where_old);
if (!$update_old) {
self::$errCode = 408;
self::$errMsg = "更新舊倉位庫存失敗!";
TransactionBaseModel::rollback();
return false;
}
} else {
$tname_old = "wh_product_position_relation";
$set_old = "set nums=nums-{$change_nums}";
$where_old = "where id={$old_sku_pos_info[0]['id']}";
$update_old = OmAvailableModel::updateTNameRow($tname_old, $set_old, $where_old);
if (!$update_old) {
self::$errCode = 409;
self::$errMsg = "更新舊倉位庫存失敗!";
TransactionBaseModel::rollback();
return false;
}
}
$tname_new = "wh_product_position_relation";
$set_new = "set nums=nums+{$change_nums}";
$where_new = "where id={$new_sku_pos_info[0]['id']}";
$update_new = OmAvailableModel::updateTNameRow($tname_new, $set_new, $where_new);
if (!$update_new) {
self::$errCode = 410;
self::$errMsg = "更新新倉位庫存失敗!";
TransactionBaseModel::rollback();
return false;
}
} else {
//.........這裏部分代碼省略.........
示例11: orderUnusual
/**
* 訂單係統通過接口更改倉庫係統異常訂單
*/
public static function orderUnusual($orderId, $calcWeight)
{
self::initDB();
//$sql = "select shipOrderId from wh_shipping_order_relation where originOrderId='{$orderId}'";
//$shipOrderInfo = self::$dbConn->fetch_first($sql);
if (is_numeric($orderId)) {
OmAvailableModel::begin();
$del_arr = array();
$id_str = '';
$detail_info = self::getorderUnusualInfo($orderId);
foreach ($detail_info['detail'] as $detail) {
if (!empty($detail['combineSku'])) {
if ($detail_info['picking'][$detail['combineSku']] == 0) {
$del_arr[] = $detail['id'];
}
} else {
if ($detail_info['picking'][$detail['sku']] == 0) {
$del_arr[] = $detail['id'];
}
}
}
if (empty($del_arr)) {
self::$errCode = "405";
self::$errMsg = "該訂單料號庫存足夠,不需拆分";
OmAvailableModel::rollback();
return false;
}
$id_str = implode(',', $del_arr);
$time = time();
$update_record_sql = "update wh_order_picking_records set is_delete=1,cancelTime={$time} where shipOrderdetailId in({$id_str})";
$udate_query = self::$dbConn->query($update_record_sql);
if ($udate_query) {
$del_detail_sql = "delete from wh_shipping_orderdetail where id in({$id_str}) ";
$del_query = self::$dbConn->query($del_detail_sql);
if ($del_query) {
$update_status_sql = "update wh_shipping_order set orderStatus=403,calcWeight='{$calcWeight}' where id={$orderId}";
$status_query = self::$dbConn->query($update_status_sql);
if ($status_query) {
OmAvailableModel::commit();
return true;
} else {
self::$errCode = "404";
self::$errMsg = "倉庫係統拆分失敗";
OmAvailableModel::rollback();
return false;
}
} else {
self::$errCode = "403";
self::$errMsg = "倉庫係統拆分失敗";
OmAvailableModel::rollback();
return false;
}
} else {
self::$errCode = "402";
self::$errMsg = "倉庫係統拆分失敗";
return false;
}
} else {
self::$errCode = "401";
self::$errMsg = "發貨單號有誤";
return false;
}
}