本文整理汇总了PHP中OmAvailableModel::addTNameRow方法的典型用法代码示例。如果您正苦于以下问题:PHP OmAvailableModel::addTNameRow方法的具体用法?PHP OmAvailableModel::addTNameRow怎么用?PHP OmAvailableModel::addTNameRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OmAvailableModel
的用法示例。
在下文中一共展示了OmAvailableModel::addTNameRow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: act_addTNameRow
/**
*添加指定表记录,返回 insertId
*/
function act_addTNameRow($tName, $set)
{
$ret = OmAvailableModel::addTNameRow($tName, $set);
if ($ret !== FALSE) {
return $ret;
} else {
self::$errCode = OmAvailableModel::$errCode;
self::$errMsg = OmAvailableModel::$errMsg;
return false;
}
}
示例2: act_insertBlackList
function act_insertBlackList($data, $table)
{
//表名,SET,WHERE
$key = array();
$value = array();
foreach ($data as $k => $v) {
$key[] = $k;
$value[] = $v;
}
$set = " (" . implode(',', $key) . ") VALUE ('" . implode("','", $value) . "')";
$ret = OmAvailableModel::addTNameRow($table, $set);
if ($ret) {
return true;
} else {
self::$errCode = OmAvailableModel::$errCode;
self::$errMsg = OmAvailableModel::$errMsg;
return false;
}
}
示例3: act_addTNameRow
function act_addTNameRow()
{
$jsonArr = isset($_GET['jsonArr']) ? $_GET['jsonArr'] : '';
//传过来的base64编码的json字符串
if (empty($jsonArr)) {
self::$errCode = 101;
self::$errMsg = '参数数组为空';
return false;
}
$jsonArr = json_decode(base64_decode($jsonArr), true);
//对base64及json解码
if (!is_array($jsonArr)) {
self::$errCode = 103;
self::$errMsg = '参数数组不是数组格式';
return false;
}
$tName = $jsonArr['tName'];
//表名
$set = $jsonArr['set'];
//set,用关键字SET
if (empty($tName) || empty($set)) {
self::$errCode = '300';
self::$errMsg = '必要参数不完整';
return false;
}
$insertId = OmAvailableModel::addTNameRow($tName, $set);
if ($insertId !== FALSE) {
self::$errCode = '200';
self::$errMsg = '成功';
return $insertId;
} else {
self::$errCode = '404';
self::$errMsg = '数据库操作错误';
return false;
}
}
示例4: act_updateCostAndAddHistory
function act_updateCostAndAddHistory()
{
$sku = $_GET['sku'] ? post_check(trim($_GET['sku'])) : '';
//sku
$purchaseCost = $_GET['purchaseCost'] ? post_check(trim($_GET['purchaseCost'])) : 0;
//成本
$addUserId = $_GET['addUserId'] ? post_check(trim($_GET['addUserId'])) : 0;
//添加人
$addTime = time();
if (empty($sku)) {
self::$errCode = '101';
self::$errMsg = 'sku为空';
return false;
}
if (!is_numeric($purchaseCost) || $purchaseCost <= 0) {
self::$errCode = '102';
self::$errMsg = '成本必须大于0';
return false;
}
if (intval($addUserId) <= 0) {
self::$errCode = '103';
self::$errMsg = '添加人id不合法';
return false;
}
$tName = 'pc_goods';
$select = '*';
$where = "WHERE sku='{$sku}' and is_delete=0";
$skuList = OmAvailableModel::getTNameList($tName, $select, $where);
if (empty($skuList)) {
self::$errCode = '104';
self::$errMsg = "找不到 {$sku} 料号";
return false;
}
try {
BaseModel::begin();
//先更新goods表中对应sku的goodsCost
$set = "SET goodsCost='{$purchaseCost}'";
OmAvailableModel::updateTNameRow($tName, $set, $where);
//然后再历史记录表中添加一条记录
$tName = 'pc_goods_cost_history_record';
$set = "SET sku='{$sku}',purchaseCost='{$purchaseCost}',addUserId='{$addUserId}',addTime='{$addTime}'";
OmAvailableModel::addTNameRow($tName, $set);
//更新mem中的sku
$key = 'pc_goods_' . $sku;
$value = $skuList[0];
$value['goodsCost'] = $purchaseCost;
setMemNewByKey($key, $value);
//这里不保证能添加成功
BaseModel::commit();
BaseModel::autoCommit();
self::$errCode = '200';
self::$errMsg = "更新成功";
return true;
} catch (Exception $e) {
BaseModel::rollback();
BaseModel::autoCommit();
self::$errCode = '404';
self::$errMsg = $e->getMessage();
return false;
}
}
示例5: foreach
Log::write("INSERT INTO " . $tracknumber_tname . $tracknumber_set, Log::ERR);
OmAvailableModel::rollback();
continue;
}
}
$detail_blag = false;
foreach ($order_detail as $detail) {
$insert_detail_arr = array();
$insert_detail_arr[] = "shipOrderId = '{$shipOrderId}'";
$insert_detail_arr[] = "sku = '{$detail['sku']}'";
$insert_detail_arr[] = "amount = '{$detail['amount']}'";
$insert_detail_arr[] = "positionId = '{$detail['positionId']}'";
$insert_detail_arr[] = "pName = '{$detail['pName']}'";
$detail_tname = "wh_shipping_orderdetail";
$detail_set = "set " . implode(",", $insert_tracknumber_arr);
$detailId = OmAvailableModel::addTNameRow($detail_tname, $detail_set);
if (!$detailId) {
Log::write("INSERT INTO " . $detail_tname . $detail_set, Log::ERR);
OmAvailableModel::rollback();
$detail_blag = true;
break;
}
}
if ($detail_blag) {
continue;
}
OmAvailableModel::commit();
$channel->basic_ack($msg->delivery_info['delivery_tag']);
}
}
}
示例6: act_checkOrder
function act_checkOrder()
{
$userId = $_SESSION['userId'];
$order_id = trim($_POST['ebay_id']);
$state_status = array(PKS_WIQC);
//先核对订单
$p_real_ebayid = '#^\\d+$#';
if (!preg_match($p_real_ebayid, $order_id)) {
self::$errCode = "001";
self::$errMsg = "发货单号[" . $order_id . "]格式有误";
return false;
}
$ordercheck = ShippingOrderModel::getShippingOrder("*", "where id='{$order_id}'");
if (empty($ordercheck)) {
self::$errCode = '001';
self::$errMsg = '未找到发货单[' . $order_id . ']';
return false;
}
if ($ordercheck[0]['isExpressDelivery'] == 1) {
self::$errCode = '001';
self::$errMsg = '此发货单是快递运输方式,请转到快递复核界面操作!';
return false;
}
$orderinfos = array();
$skuinfos = array();
$orderinfos = get_realskunum($ordercheck[0]['id']);
//配货单所有料号及数量
foreach ($orderinfos as $or_sku => $or_nums) {
$sku_info = OrderReviewModel::getSkuInfo("goodsName", "where sku='{$or_sku}'");
$skuinfos[] = array('sku' => $or_sku, 'goodsName' => $sku_info['goodsName'], 'num' => $or_nums);
}
$string = "";
$time = strtotime(date('Y-m-d H:i:s'));
foreach ($skuinfos as $info) {
$string .= "('" . $ordercheck[0]['id'] . "','" . $info['sku'] . "','" . $info['goodsName'] . "','0','" . $info['num'] . "','" . $userId . "','" . $time . "','0'),";
}
$string = trim($string, ",");
OrderReviewModel::update(array('is_delete' => 1), "and shipOrderId='{$ordercheck[0]['id']}'");
$insert_info = OrderReviewModel::insert($string);
if ($insert_info) {
if (!in_array($ordercheck[0]['orderStatus'], $state_status)) {
if ($ordercheck[0]['orderStatus'] == PKS_PROCESS_GET_GOODS) {
$where = "where shipOrderId='{$ordercheck[0]['id']}' and is_delete=0";
$list = OmAvailableModel::getTNameList("wh_order_picking_records", "*", $where);
$eosr_arrlist = array();
foreach ($list as $row) {
$eosr_arrlist[] = $row['shipOrderdetailId'];
}
//$skuinfos = get_realskunum($orderid);
$skuinfos = OmAvailableModel::getTNameList("wh_shipping_orderdetail", "*", "where shipOrderId='{$ordercheck[0]['id']}' and is_delete = 0");
foreach ($skuinfos as $info) {
$order_detail = array();
if (!in_array($info['id'], $eosr_arrlist)) {
$order_detail['shipOrderId'] = $info['shipOrderId'];
$order_detail['shipOrderdetailId'] = $info['id'];
$order_detail['sku'] = $info['sku'];
$order_detail['pName'] = $info['pName'];
$order_detail['totalNums'] = $info['amount'];
$order_detail['isScan'] = 0;
$order_detail['is_delete'] = 0;
$field = ' SET ' . array2sql($order_detail);
OmAvailableModel::addTNameRow("wh_order_picking_records", $field);
}
}
$where = "where shipOrderId='{$ordercheck[0]['id']}' and is_delete=0 and isScan=0";
$p_list = OmAvailableModel::getTNameList("wh_order_picking_records", "*", $where);
$str = '';
if (!empty($p_list)) {
foreach ($p_list as $eo) {
$op_amount = empty($eo['amount']) ? 0 : $eo['amount'];
$str .= "料号 {$eo['sku']} 未配货,";
$str .= " 已配货 {$op_amount} 还需配货 " . ($eo['totalNums'] - $op_amount);
$str .= " PDA扫描时间:" . ($eo['scanTime'] ? date('Y-m-d H:i:s', $eo['scanTime']) : ' 无 ');
$str .= "<br>";
}
}
self::$errCode = '004';
self::$errMsg = "该订单[{$order_id}]在等待配货状态,请确认!<br/>" . $str;
return false;
}
self::$errCode = '001';
self::$errMsg = "该订单[{$order_id}]在" . LibraryStatusModel::getStatusNameByStatusCode($ordercheck[0]['orderStatus']) . "状态,请确认!";
return false;
}
$fist_skuinfos = OrderReviewModel::getReviewList("*", "where shipOrderId='{$ordercheck[0]['id']}' and is_delete=0 and storeId=1");
$note_info = OmAvailableModel::getTNameList("wh_shipping_order_note_record", "*", "where shipOrderId='{$ordercheck[0]['id']}'");
if (!empty($note_info)) {
self::$errMsg = "订单有效,请复核该订单下的料号及数量!<br/>备注:" . $note_info[0]['content'];
} else {
self::$errMsg = "订单有效,请复核该订单下的料号及数量!";
}
return $fist_skuinfos;
} else {
self::$errCode = '003';
self::$errMsg = "订单料号初始化出错,请重试";
return false;
}
}
示例7: view_tmpModReturnPros
public function view_tmpModReturnPros()
{
//添加sku
$type = isset($_GET['type']) ? $_GET['type'] : '';
$sku = isset($_GET['sku']) ? post_check(trim($_GET['sku'])) : '';
$addUserId = intval($_SESSION['userId']);
if ($addUserId <= 0) {
$status = '登陆超时,请重试';
header('Location:index.php?mod=products&act=tmpModReturnPros&status=' . $status);
exit;
}
$now = time();
if ($type == 'add') {
if (!empty($sku)) {
$skuList = getSkuBygoodsCode($sku);
$sku = $skuList[0]['sku'];
if (empty($sku)) {
$status = "{$_GET['sku']} 找不到对应料号";
header('Location:index.php?mod=products&act=tmpModReturnPros&status=' . $status);
exit;
}
$tName = 'pc_products_iostore_detail';
$where = "WHERE is_delete=0 AND sku='{$sku}' AND iostoreTypeId=1 AND useTypeId=2 AND isAudit<3";
//找出领料单中修改领取的该产品记录数
$countDetailLL = OmAvailableModel::getTNameCount($tName, $where);
if (empty($countDetailLL)) {
$status = "找不到 {$_GET['sku']} 的 修改领料 记录";
header('Location:index.php?mod=products&act=tmpModReturnPros&status=' . $status);
exit;
}
$tName = 'pc_products_iostore_detail';
$where = "WHERE is_delete=0 AND sku='{$sku}' AND iostoreTypeId=2 AND useTypeId=2 AND isAudit<3";
//找出退料单中修改归还的该产品记录数
$countDetailTL = OmAvailableModel::getTNameCount($tName, $where);
$allowAddCount = $countDetailLL - $countDetailTL;
//该料号允许添加的数量
$tName = 'pc_tmp_products_return';
$where = "WHERE returnType=3 AND sku='{$sku}'";
$countSku = OmAvailableModel::getTNameCount($tName, $where);
$countSku++;
//当前该sku的数量
if ($allowAddCount < $countSku) {
//如果允许添加的该sku数量小于该sku已经添加的数量,则报错
$status = "{$_GET['sku']} 已经全部归还,不能再添加";
header('Location:index.php?mod=products&act=tmpModReturnPros&status=' . $status);
exit;
}
$set = "SET returnType=3,sku='{$sku}',addUserId='{$addUserId}',createdTime='{$now}'";
//type=3 ,修改归还
OmAvailableModel::addTNameRow($tName, $set);
$status = $sku . ' 添加成功';
header('Location:index.php?mod=products&act=tmpModReturnPros&status=' . $status);
}
}
//展示tmp表中的记录
$tName = 'pc_tmp_products_return';
$select = "*";
$where = "WHERE returnType=3 order by createdTime desc";
//修改领料
$tmpModReturnProsList = OmAvailableModel::getTNameList($tName, $select, $where);
$navlist = array(array('url' => 'index.php?mod=products&act=getProductsComfirmList', 'title' => '产品制作'), array('url' => 'index.php?mod=products&act=tmpModReturnPros', 'title' => '修改产品归还'));
$this->smarty->assign('navlist', $navlist);
$this->smarty->assign('onevar', 5);
$this->smarty->assign('twovar', 510);
$this->smarty->assign('show_page', $show_page);
$this->smarty->assign('title', '修改产品归还');
if (!empty($tmpModReturnProsList)) {
$whInfoList = getWhInfo();
//根据接口取得对应仓库信息
$whArr = array();
foreach ($whInfoList as $value) {
if (intval($value['id']) > 0) {
$whArr[$value['id']] = $value['whName'];
}
}
$countProsList = count($tmpModReturnProsList);
for ($i = 0; $i < $countProsList; $i++) {
$sku = $tmpModReturnProsList[$i]['sku'];
$tName = 'pc_goods';
$select = 'goodsName';
$where = "WHERE sku='{$sku}'";
$skuInfoList = OmAvailableModel::getTNameList($tName, $select, $where);
$tmpModReturnProsList[$i]['goodsName'] = $skuInfoList[0]['goodsName'];
$tName = 'pc_goods_whId_location_raletion';
$select = 'location,whId';
$where = "WHERE sku='{$sku}'";
$skuLocWhInfoList = OmAvailableModel::getTNameList($tName, $select, $where);
$tmpModReturnProsList[$i]['location'] = $skuLocWhInfoList[0]['location'];
$tmpModReturnProsList[$i]['whName'] = $whArr[$skuLocWhInfoList[0]['whId']];
}
}
$this->smarty->assign('tmpModReturnProsList', empty($tmpModReturnProsList) ? array() : $tmpModReturnProsList);
$this->smarty->display("tmpModReturnPros.htm");
}
示例8: intval
//添加自动生成SPU记录
$tName = 'pc_auto_create_spu';
$where = "WHERE spu='{$spu}'";
$countAutoCreSpu = OmAvailableModel::getTNameCount($tName, $where);
if ($countAutoCreSpu) {
echo "{$spu} autoCreateSpu has exist!\n";
//continue;
}
if (preg_match("/^[A-Z]{2}[0-9]{6}\$/", $spu)) {
$sort = intval(substr($spu, 2));
} else {
$sort = 0;
}
$set = "SET spu='{$spu}',purchaseId='{$purchaseId}',createdTime='{$now}',sort='{$sort}',status=2";
if (!$countAutoCreSpu) {
OmAvailableModel::addTNameRow($tName, $set);
echo "{$spu} autoCreateSpu insert success\n";
}
//添加SPU档案
$tName = 'pc_spu_archive';
$where = "WHERE spu='{$spu}'";
$countSpuArchive = OmAvailableModel::getTNameCount($tName, $where);
if ($countSpuArchive) {
echo "{$spu} spuArchive has exist!\n";
$set = "SET categoryPath='{$value['goods_category']}',purchaseId='{$pcGoodsArr['purchaseId']}'";
OmAvailableModel::updateTNameRow($tName, $set, $where);
echo "{$spu} spuArchive update category and purchaseId success! {$value['goods_category']} {$pcGoodsArr['purchaseId']} \n";
//continue;
}
$dataSpuArchive = array();
$dataSpuArchive['spu'] = $spu;
示例9: act_addInput
function act_addInput()
{
//$pidNew = $_POST['pidNew']?post_check($_POST['pidNew']):'';//类别
$finalIdArr = $_POST['finalIdStr'];
//新建属性-类别4
$inputName = $_POST['inputName'] ? post_check($_POST['inputName']) : '';
//类别
$textStatus = $_POST['textStatus'] ? post_check($_POST['textStatus']) : '';
//文本方式
if (empty($finalIdArr) || empty($inputName)) {
self::$errCode = 101;
self::$errMsg = '类别或属性名不能为空';
return false;
}
if (intval($textStatus) <= 0) {
self::$errCode = 102;
self::$errMsg = '文本方式有误';
return false;
}
$tmpArr = array();
if (!is_array($finalIdArr)) {
$tmpArr[] = $finalIdArr;
$finalIdArr = $tmpArr;
}
$finalPathArr = array();
foreach ($finalIdArr as $cid) {
$catePath = CategoryModel::getCategoryPathById($cid);
if (empty($catePath)) {
self::$errCode = 109;
self::$errMsg = '类别有误';
return false;
}
$finalPathArr[] = $catePath;
}
$tName = 'pc_goods_category';
foreach ($finalPathArr as $value) {
$where = "WHERE path like'%{$value}-%' and is_delete=0";
$count = OmAvailableModel::getTNameCount($tName, $where);
if ($count) {
self::$errCode = 105;
self::$errMsg = '只能在最小分类进行复制';
return false;
}
}
try {
$pidNewStr = '';
BaseModel::begin();
$tName = 'pc_archive_input';
foreach ($finalPathArr as $value) {
$where = "WHERE inputName='{$inputName}' AND categoryPath='{$value}'";
$countIN = OmAvailableModel::getTNameCount($tName, $where);
if (!$countIN) {
$pidNewStr .= CategoryModel::getCategoryNameByPath($value) . ' ';
$set = "SET inputName='{$inputName}',categoryPath='{$value}',textStatus='{$textStatus}'";
OmAvailableModel::addTNameRow($tName, $set);
}
}
BaseModel::commit();
BaseModel::autoCommit();
self::$errCode = 200;
self::$errMsg = "{$inputName} 添加到 {$pidNewStr} 成功";
return true;
} catch (Exception $e) {
BaseModel::rollback();
BaseModel::autoCommit();
self::$errCode = 201;
self::$errMsg = $e->getMessage();
return false;
}
}
示例10: act_searchPickingInfo
function act_searchPickingInfo($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 "订单号{$orderid}没有配货记录!订单号不存在,请确认!";
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 "订单号{$orderid}没有配货记录!订单号不存在,请确认!";
exit;
} else {
$orderid = $ordercheck[0]['id'];
}
$where = "where shipOrderId='{$orderid}' and is_delete=0";
$list = OmAvailableModel::getTNameList("wh_order_picking_records", "*", $where);
$eosr_arrlist = array();
foreach ($list as $row) {
$eosr_arrlist[] = $row['shipOrderdetailId'];
}
//$skuinfos = get_realskunum($orderid);
$skuinfos = OmAvailableModel::getTNameList("wh_shipping_orderdetail", "*", "where shipOrderId='{$orderid}'");
foreach ($skuinfos as $info) {
$order_detail = array();
if (!in_array($info['id'], $eosr_arrlist)) {
$order_detail['shipOrderId'] = $info['shipOrderId'];
$order_detail['shipOrderdetailId'] = $info['id'];
$order_detail['sku'] = $info['sku'];
$order_detail['pName'] = $info['pName'];
$order_detail['totalNums'] = $info['amount'];
$order_detail['isScan'] = 0;
$order_detail['is_delete'] = 0;
$field = ' SET ' . array2sql($order_detail);
OmAvailableModel::addTNameRow("wh_order_picking_records", $field);
}
}
$where = "where shipOrderId='{$orderid}'";
$p_list = OmAvailableModel::getTNameList("wh_order_picking_records", "*", $where);
$show = '';
foreach ($p_list as $value) {
$scan_status = $value['isScan'] == 0 ? '未配货' : '已配货';
if (empty($value['scanUserId'])) {
$op_name = '无';
} else {
//配货人
$usermodel = UserModel::getInstance();
$iqc_user = $usermodel->getGlobalUserLists('global_user_name', "where a.global_user_id={$value['scanUserId']}", '', '');
$op_name = $iqc_user[0]['global_user_name'];
}
$op_amount = empty($value['amount']) ? 0 : $value['amount'];
if ($value['is_delete'] == 1) {
$show .= "<font style='color:red;'>配货记录已删除:订单{$orderid} 的料号 {$value['sku']} 仓位{$value['pName']} {$scan_status} 配货人 {$op_name}, ";
$show .= " 已配货 {$op_amount} 还需配货 " . ($value['totalNums'] - $op_amount);
$show .= " PDA扫描时间:" . ($value['scanTime'] ? date('Y-m-d H:i:s', $value['scanTime']) : ' 无 ') . "</font>";
} else {
$show .= "订单{$orderid} 的料号 {$value['sku']} 仓位{$value['pName']} {$scan_status} 配货人 {$op_name}, ";
$show .= " 已配货 {$op_amount} 还需配货 " . ($value['totalNums'] - $op_amount);
$show .= " PDA扫描时间:" . ($value['scanTime'] ? date('Y-m-d H:i:s', $value['scanTime']) : ' 无 ');
}
/*
if($value['isScan']==1 && $value['is_delete']==0){
$show .= "<input class='del' type='button' name='deletebutton' orderid='{$orderid}' sku='{$value['sku']}' pname='{$value['pName']}' value='删除订单的配货记录,回滚库存' />";
}*/
$show .= "<br>";
}
return $show;
}
示例11: act_modify
public function act_modify()
{
$skuNumber = 0;
$skuAmount = 0;
$skuSql = '';
$detailArr = array();
$num = $_REQUEST['num'];
$orderId = $_REQUEST['orderId'];
$detailId = $_REQUEST['detailId'];
$transport = $_REQUEST['transport'];
$materials = $_REQUEST['materials'];
$skuString = $_REQUEST['skuString'];
$numberString = $_REQUEST['numberString'];
$countryName = $_REQUEST['countryName'];
$state = $_REQUEST['state'];
$city = $_REQUEST['city'];
$street = $_REQUEST['street'];
$address2 = $_REQUEST['address2'];
$address3 = $_REQUEST['address3'];
$landline = $_REQUEST['landline'];
$phone = $_REQUEST['phone'];
$zipCode = $_REQUEST['zipCode'];
$currency = $_REQUEST['currency'];
$notes = $_REQUEST['notes'];
$detailIdArr = explode(',', $detailId);
$skuArr = explode(',', $skuString);
$numberArr = explode(',', $numberString);
for ($i = 0; $i < $num; $i++) {
$detailArr[$i]['id'] = $detailIdArr[$i];
$detailArr[$i]['sku'] = $skuArr[$i];
$detailArr[$i]['amount'] = $numberArr[$i];
}
$orderData = OmAvailableModel::getTNameList(' om_unshipped_order ', ' * ', ' WHERE id = ' . $orderId);
$set = ' SET transportId = "' . $transport . '" , pmId = "' . $materials . '" ';
$where = ' WHERE id = ' . $orderId;
$ret1 = OmAvailableModel::updateTNameRow('om_unshipped_order', $set, $where);
if ($ret1 === false) {
self::$errCode = OmAvailableModel::$errCode;
self::$errMsg = OmAvailableModel::$errMsg;
return false;
}
foreach ($detailArr as $k => $v) {
$skuData = OmAvailableModel::getTNameList(' om_unshipped_order_detail ', ' * ', ' WHERE id = ' . $v['id']);
$set = ' SET sku = "' . $v['sku'] . '" , amount = "' . $v['amount'] . '" ';
$where = ' WHERE id = ' . $v['id'];
$ret2 = OmAvailableModel::updateTNameRow('om_unshipped_order_detail', $set, $where);
if ($ret2 === false) {
self::$errCode = OmAvailableModel::$errCode;
self::$errMsg = OmAvailableModel::$errMsg;
return false;
}
if ($ret2 !== 0) {
$skuSql .= ' UPDATE om_unshipped_order_detail SET sku = \\"' . $v['sku'] . '\\" , amount = \\"' . $v['amount'] . '\\" WHERE id = ' . $v['id'];
if ($skuData[0]['sku'] != $v['sku']) {
$skuNumber = 1;
}
if ($skuData[0]['amount'] != $v['amount']) {
$skuAmount = 1;
}
}
}
$set = ' SET countryName = "' . $countryName . '" , state = "' . $state . '" , city = "' . $city . '" , street = "' . $street . '" , address2 = "' . $address2 . '" , address3 = "' . $address3 . '" , landline = "' . $landline . '" , phone = "' . $phone . '" , zipCode = "' . $zipCode . '" , currency = "' . $currency . '" ';
$where = ' WHERE omOrderId = ' . $orderId;
$ret3 = OmAvailableModel::updateTNameRow('om_unshipped_order_userInfo', $set, $where);
if ($ret3 === false) {
self::$errCode = OmAvailableModel::$errCode;
self::$errMsg = OmAvailableModel::$errMsg;
return false;
}
if ($ret3 !== 0) {
$userInfoSql .= ' UPDATE om_unshipped_order_userInfo SET countryName = \\"' . $countryName . '\\" , state = \\"' . $state . '\\" , city = \\"' . $city . '\\" , street = \\"' . $street . '\\" , address2 = \\"' . $address2 . '\\" , address3 = \\"' . $address3 . '\\" , landline = \\"' . $landline . '\\" , phone = \\"' . $phone . '\\" , zipCode = \\"' . $zipCode . '\\" , currency = \\"' . $currency . '\\" WHERE omOrderId = ' . $orderId;
}
$currencyData = OmAvailableModel::getTNameList(' om_order_notes ', ' * ', ' WHERE omOrderId = ' . $orderId);
if (!empty($currencyData)) {
$set = ' SET content = "' . $notes . '" , userId = "' . $_SESSION['sysUserId'] . '" ,createdTime = "' . time() . '" ';
$ret4 = OmAvailableModel::updateTNameRow('om_order_notes', $set, $where);
if ($ret4 === false) {
self::$errCode = OmAvailableModel::$errCode;
self::$errMsg = OmAvailableModel::$errMsg;
return false;
}
if ($ret4 !== 0) {
$notesSql .= ' UPDATE om_unshipped_order_userInfo SET notes = \\"' . $notes . '\\" , userId = \\"' . $_SESSION['sysUserId'] . '\\" ,createdTime = \\"' . time() . '\\" WHERE omOrderId = ' . $orderId;
}
} else {
$addNotes = ' (omOrderId,content,userId,createdTime) VALUES ("' . $orderId . '","' . $notes . '","' . $_SESSION['sysUserId'] . '","' . time() . '")';
$ret4 = OmAvailableModel::addTNameRow('om_order_notes', $addNotes);
if ($ret4 === false) {
self::$errCode = OmAvailableModel::$errCode;
self::$errMsg = OmAvailableModel::$errMsg;
return false;
}
if ($ret4 !== 0) {
$notesSql .= ' INSERT INTO om_order_notes (omOrderId,content,userId,createdTime) VALUES (\\"' . $orderId . '\\",\\"' . $notes . '\\",\\"' . $_SESSION['sysUserId'] . '\\",\\"' . time() . '\\")';
}
}
if ($ret1 !== 0 || $ret2 !== 0 || $ret3 !== 0 || $ret4 !== 0) {
$value = ' (`operatorId`,`omOrderId`,`oldStatus`,`newStatus`,`sql`,`note`,`createdTime`) VALUES (';
$value .= '"' . $_SESSION['sysUserId'] . '",';
$value .= '"' . $orderId . '",';
//.........这里部分代码省略.........
示例12: explode
$affectRowCom = 1;
if ($affectRowCom !== false) {
//echo "{$pcGoodsArr['combineSku']} insert success\n";
$goods_sncombine = $value['goods_sncombine'];
$tmpArr1 = explode(',', $goods_sncombine);
//按逗号截取字符串,生成对应真实料号及对应数量的数组数量
//$tName = 'pc_sku_combine_relation';
// $where = "WHERE combineSku='{$pcGoodsArr['combineSku']}'";
// OmAvailableModel::deleteTNameRow($tName, $where);//删除旧的关系
// echo "{$pcGoodsArr['combineSku']} old relation delete success\n";
foreach ($tmpArr1 as $value1) {
$tmpArr2 = explode('*', $value1);
//按*截取,获取真实料号及数量
$trueSku = trim($tmpArr2[0]);
$amount = trim($tmpArr2[1]);
if (!empty($trueSku) && !empty($amount)) {
$tName = 'pc_sku_combine_relation';
$set = "SET combineSku='{$pcGoodsArr['combineSku']}',sku='{$trueSku}',count='{$amount}'";
$affectRow = OmAvailableModel::addTNameRow($tName, $set);
if ($affectRow !== false) {
echo "{$pcGoodsArr['combineSku']} {$trueSku} {$amount} insert success in relation\n";
} else {
echo "{$pcGoodsArr['combineSku']} {$trueSku} {$amount} insert fail in relation\n";
}
}
}
} else {
echo "{$pcGoodsArr['combineSku']} insert fail\n";
}
}
}
示例13: view_addInputOn
public function view_addInputOn()
{
$inputName = $_GET['inputName'] ? post_check(trim($_GET['inputName'])) : '';
$pid = $_GET['pid'] ? post_check(trim($_GET['pid'])) : '';
if (empty($inputName)) {
$status = "属性名不能为空";
header("Location:index.php?mod=property&act=addInput&status={$status}");
exit;
}
if (empty($pid)) {
$status = "类别不能为空";
header("Location:index.php?mod=property&act=addInput&status={$status}");
exit;
}
$categoryName = getAllCateNameByPath($pid);
$pathImplodeStr = getAllPathBypid($pid);
$tName = 'pc_archive_input';
$where = "WHERE inputName='{$inputName}' and categoryPath IN ({$pathImplodeStr})";
$count = OmAvailableModel::getTNameCount($tName, $where);
if ($count) {
$status = "{$categoryName} 或其父类下已经存在 {$inputName} 属性";
header("Location:index.php?mod=property&act=addInput&status={$status}");
exit;
}
$set = "SET inputName='{$inputName}',categoryPath='{$pid}'";
$insertId = OmAvailableModel::addTNameRow($tName, $set);
if (!$insertId) {
$status = "系统插入数据错误";
header("Location:index.php?mod=property&act=addInput&status={$status}");
exit;
}
$status = "{$categoryName} 中添加 {$inputName} 文本属性成功";
header("Location:index.php?mod=property&act=addInput&status={$status}");
}
示例14: act_addSkuConversion
function act_addSkuConversion()
{
$old_sku = $_POST['old_sku'] ? post_check(trim($_POST['old_sku'])) : '';
//old_sku
$new_sku = $_POST['new_sku'] ? post_check(trim($_POST['new_sku'])) : '';
//new_sku
$addUserId = intval($_SESSION['userId']);
$createdTime = time();
if (empty($old_sku) || empty($new_sku)) {
self::$errCode = '101';
self::$errMsg = "新/旧料号不能为空";
return;
}
if ($old_sku == $new_sku) {
self::$errCode = '109';
self::$errMsg = "新/旧料号相同,不能转换";
return;
}
if (!preg_match("/^[A-Z0-9]+(_[A-Z0-9]+)*\$/", $new_sku)) {
self::$errCode = '100';
self::$errMsg = "新料号 {$new_sku} 格式不合法";
return;
}
if ($addUserId <= 0) {
self::$errCode = '103';
self::$errMsg = "登陆超时,请重试";
return;
}
$tName = 'pc_sku_conversion';
$where = "WHERE is_delete=0 AND old_sku='{$old_sku}'";
$countOldSkuCon = OmAvailableModel::getTNameCount($tName, $where);
//在料号转换表里查找是否已经存在该旧料号的信息
if ($countOldSkuCon) {
self::$errCode = '104';
self::$errMsg = "旧料号 {$old_sku} 已经存在料号转换列表中";
return;
}
$tName = 'pc_goods';
$select = '*';
$where = "WHERE is_delete=0 AND sku='{$old_sku}' order by id desc limit 1";
$oldSkuList = OmAvailableModel::getTNameList($tName, $select, $where);
//在产品表里找是否存在旧料号
$oldSku = $oldSkuList[0];
//旧料号的信息
if (empty($oldSku)) {
self::$errCode = '105';
self::$errMsg = "旧料号 {$old_sku} 在产品列表中不存在";
return;
}
try {
BaseModel::begin();
$tName = 'pc_sku_conversion';
$set = "SET old_sku='{$old_sku}',new_sku='{$new_sku}',addUserId='{$addUserId}',createdTime='{$createdTime}'";
$flag = OmAvailableModel::addTNameRow($tName, $set);
//添加转换记录
if ($flag) {
self::$errCode = '200';
self::$errMsg = "旧料号 {$old_sku}转{$new_sku}添加成功";
}
BaseModel::commit();
BaseModel::autoCommit();
return;
} catch (Exception $e) {
BaseModel::rollback();
BaseModel::autoCommit();
self::$errCode = '404';
self::$errMsg = $e->getMessage();
return;
}
}
示例15: view_addSpuPrefixOn
public function view_addSpuPrefixOn()
{
$prefix = $_GET['prefix'] ? post_check(trim($_GET['prefix'])) : '';
$isSingSpu = $_GET['isSingSpu'] ? post_check(trim($_GET['isSingSpu'])) : '';
$companyId = $_GET['companyId'] ? post_check(trim($_GET['companyId'])) : '';
$isUse = $_GET['isUse'] ? post_check(trim($_GET['isUse'])) : '';
if (!preg_match("/^[A-Z]{2}\$/", $prefix)) {
$status = "前缀必须是两个大写字母的组合";
header("Location:index.php?mod=spu&act=getSpuPrefixList&status={$status}");
exit;
}
if (intval($isSingSpu) != 1 && intval($isSingSpu) != 2) {
$status = "单/组合料号有误";
header("Location:index.php?mod=spu&act=getSpuPrefixList&status={$status}");
exit;
}
$companyInfo = getCompanyNameById($companyId);
if (empty($companyInfo)) {
$status = "公司信息有误";
header("Location:index.php?mod=spu&act=getSpuPrefixList&status={$status}");
exit;
}
if (intval($isUse) == 0) {
$status = "启动/禁用不能为空";
header("Location:index.php?mod=spu&act=getSpuPrefixList&status={$status}");
exit;
}
$tName = 'pc_auto_create_spu_prefix';
$where = "WHERE prefix='{$prefix}' AND companyId='{$companyId}'";
$count = OmAvailableModel::getTNameCount($tName, $where);
if ($count) {
$status = "该公司下已经存在 {$prefix} 前缀";
header("Location:index.php?mod=spu&act=getSpuPrefixList&status={$status}");
exit;
}
$set = "SET prefix='{$prefix}',isSingSpu='{$isSingSpu}',companyId='{$companyId}',isUse='{$isUse}'";
$insertId = OmAvailableModel::addTNameRow($tName, $set);
if (!$insertId) {
$status = "系统插入数据错误";
header("Location:index.php?mod=spu&act=getSpuPrefixList&status={$status}");
exit;
}
$status = "添加 {$prefix} 前缀成功";
header("Location:index.php?mod=spu&act=getSpuPrefixList&status={$status}");
}