本文整理汇总了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;
}
}