本文整理匯總了PHP中OmAvailableModel::newData2ErpInterfOpen方法的典型用法代碼示例。如果您正苦於以下問題:PHP OmAvailableModel::newData2ErpInterfOpen方法的具體用法?PHP OmAvailableModel::newData2ErpInterfOpen怎麽用?PHP OmAvailableModel::newData2ErpInterfOpen使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OmAvailableModel
的用法示例。
在下文中一共展示了OmAvailableModel::newData2ErpInterfOpen方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: act_addSpu
function act_addSpu()
{
$data = array();
$data['spu'] = trim($_POST['spu']);
$data['sort'] = trim($_POST['sort']);
$data['prefix'] = trim($_POST['prefix']);
$data['isSingSpu'] = trim($_POST['isSingSpu']);
$data['createdTime'] = time();
$data['purchaseId'] = $_SESSION['userId'];
//驗證生成的SPU是否合法
if (!preg_match("/^[A-Z]{2}[0-9]{6}\$/", $data['spu'])) {
self::$errCode = 01;
self::$errMsg = "{$data['spu']} 不合法,請聯係IT人員查看";
return false;
}
if (intval($data['purchaseId']) <= 0) {
self::$errCode = 02;
self::$errMsg = "登陸超時,請重試";
return false;
}
//驗證spu是否已經存在
$res = OmAvailableModel::getTNameCount('pc_auto_create_spu', "where spu='{$data['spu']}'");
if (!empty($res)) {
self::$errCode = 03;
self::$errMsg = "{$data['spu']}已經存在,請重新生成";
return false;
} else {
if (SpuModel::insertSkuRow($data)) {
//這裏添加對應銷售人記錄邏輯
//addSalerInfoForAny($data['spu'], $data['isSingSpu'], $_SESSION['userId'], $_SESSION['userId']);//取消在申請SPU的時候添加銷售人信息,改為在添加真實SKU的時候添加
//
$dataAuto = array();
$dataAuto['sku'] = $data['spu'];
$dataAuto['cguser'] = getPersonNameById($data['purchaseId']);
$dataAuto['mainsku'] = $data['sort'];
$dataAuto['status'] = 2;
$dataAuto['addtime'] = time();
if ($data['prefix'] == 'TK') {
$type = 4;
}
if ($data['prefix'] == 'MT') {
$type = 3;
}
if ($data['prefix'] == 'OS') {
$type = 6;
}
if ($data['prefix'] == 'CB') {
$type = 7;
}
$dataAuto['type'] = $type;
OmAvailableModel::newData2ErpInterfOpen('pc.erp.addAutoCreatSpu', $dataAuto, 'gw88');
return true;
} else {
self::$errCode = SpuModel::$errCode;
self::$errMsg = '生成失敗,請重試';
return false;
}
}
}
示例2: act_setSkuWeightInWh
/**
*功能:提供給倉庫係統的接口,重量攔截重新得到重量
* */
public function act_setSkuWeightInWh()
{
$sku = isset($_GET['sku']) ? $_GET['sku'] : "";
$skuweight = isset($_GET['skuweight']) ? $_GET['skuweight'] / 1000 : "";
//傳遞過來的重量為g
$userId = isset($_GET['userId']) ? $_GET['userId'] : 0;
if (intval($userId) <= 0) {
self::$errCode = 111;
self::$errMsg = "登陸超時,請重新登陸!";
return false;
}
if (empty($sku) || empty($skuweight)) {
self::$errCode = 333;
self::$errMsg = "料號或重量不能為空!";
return false;
}
$skuList = getSkuBygoodsCode($sku);
//根據條碼獲取真實sku
if (empty($skuList)) {
self::$errCode = 404;
self::$errMsg = '料號不存在';
return false;
}
$oldWeight = !empty($skuList[0]['goodsWeight']) ? $skuList[0]['goodsWeight'] : 0;
//先找出該sku的重量
if ($oldWeight != $skuweight) {
//如果新舊重量不相等時,則更新
try {
BaseModel::begin();
$tName = 'pc_goods';
$set = "SET goodsWeight='{$skuweight}'";
$where = "WHERE sku='{$skuList[0]['sku']}'";
OmAvailableModel::updateTNameRow($tName, $set, $where);
//$info = UserCacheModel::getOpenSysApi('pc.updateTNameRow',array(array('tName'=>"pc_goods",'set'=>"goodsWeight='{$skuweight}'",'where'=>"WHERE sku='{$sku}' and is_delete = 0")));
//添加重量備份記錄
//$tName = 'pc_goods_weight_backups';
// $backupsArr = array ();
// $backupsArr['sku'] = $skuList[0]['sku'];
// $backupsArr['goodsWeight'] = $skuweight;
// $backupsArr['addUserId'] = $userId;
// $backupsArr['addTime'] = time();
// OmAvailableModel :: addTNameRow2arr($tName, $backupsArr);
addWeightBackupsModify($skuList[0]['sku'], $skuweight, $userId);
//
//$url = "add2ebay_goods_weight.php?goods_sn=".$skuList[0]['sku']."&goods_weight=".$skuweight;
// OmAvailableModel::newData2ErpInterf($url);
$paraArr['goods_sn'] = $skuList[0]['sku'];
$paraArr['goods_weight'] = $skuweight;
$res = OmAvailableModel::newData2ErpInterfOpen('pc.erp.addGoodsSnWeight', $paraArr, 'gw88');
//print_r($res);
// exit;
BaseModel::commit();
BaseModel::autoCommit();
$string = empty($oldWeight) ? "(Kg) 錄入成功!" : "(Kg) 更新成功,原來重量為 {$oldWeight}(Kg)";
self::$errCode = 200;
self::$errMsg = $skuList[0]['sku'] . " 重量 " . $skuweight . $string;
return true;
} catch (Exception $e) {
BaseModel::rollback();
BaseModel::autoCommit();
self::$errCode = 404;
self::$errMsg = $skuList[0]['sku'] . " 重量 " . $skuweight . "(Kg) 錄入失敗! " . $e->getMessage();
return false;
}
} else {
self::$errCode = 200;
self::$errMsg = $skuList[0]['sku'] . " 重量 無修改,為 {$skuweight}(Kg)";
return true;
}
}
示例3: view_createBill
public function view_createBill()
{
$id = $_POST['id'] ? post_check(trim($_POST['id'])) : '';
$whId = $_POST['wh'] ? post_check(trim($_POST['wh'])) : '';
$id = $_POST['id'] ? post_check(trim($_POST['id'])) : '';
$whId = $_POST['wh'] ? post_check(trim($_POST['wh'])) : '';
if (empty($id)) {
$status = '未選擇新品';
header("Location:index.php?mod=products&act=getNewGoodsList&status={$status}");
exit;
}
if (intval($whId) <= 0) {
$status = '倉庫有誤';
header("Location:index.php?mod=products&act=getNewGoodsList&status={$status}");
exit;
}
$iostoreDetailArr = array();
$tmpArr = array_filter(explode(',', $id));
$iostoreDetailArr = array();
$tmpArr = array_filter(explode(',', $id));
if (empty($tmpArr)) {
$status = '未選擇新品';
header("Location:index.php?mod=products&act=getNewGoodsList&status={$status}");
exit;
}
foreach ($tmpArr as $value) {
$sku = $value;
if (!empty($sku)) {
$iostoreDetailArr[] = $sku;
}
}
if (empty($iostoreDetailArr)) {
$status = '生成領料單異常';
header("Location:index.php?mod=products&act=getNewGoodsList&status={$status}");
exit;
}
//插入數據到單據表中
try {
BaseModel::begin();
//先插入表頭數據
$tName = 'pc_products_iostore';
$dataIostore = array();
$dataIostore['ordersn'] = "XPLQ" . date('Y') . date('m') . date('d') . date("H") . date('i') . date('s') . str_pad(rand(1, 9999), 4, '0', STR_PAD_LEFT);
//默認領料單單號為前綴“PRODUCTOR”+年月日時分秒生成
$where = "WHERE ordersn='{$dataIostore['ordersn']}'";
$countIoStore = OmAvailableModel::getTNameCount($tName, $where);
if ($countIoStore) {
$status = '異常,請重試';
header("Location:index.php?mod=products&act=tmpReturnPros&status={$status}");
exit;
}
$dataIostore['addUserId'] = $_SESSION['userId'];
//添加人
if (intval($dataIostore['addUserId']) <= 0) {
$status = '登陸超時,請重試';
header("Location:index.php?mod=products&act=getNewGoodsList&status={$status}");
exit;
}
$dataIostore['createdTime'] = time();
//生成時間
$dataIostore['whId'] = $whId;
$dataIostore['companyId'] = 1;
$dataIostoreTowh = $dataIostore;
$dataIostoreTowh['invoiceTypeId'] = 4;
//產品部借用
$dataIostoreTowh['ioType'] = 1;
//出庫
$dataIostoreTowh['paymentMethodsId'] = 3;
//無需付款
$whinsertid = OmAvailableModel::newData2ErpInterfOpen("wh.addWhIoStoreInWh", array("jsonArr" => json_encode($dataIostoreTowh)), '88', false);
$insertIostoreId = OmAvailableModel::addTNameRow2arr($tName, $dataIostore);
//下麵插入表體
$tName = 'pc_products_iostore_detail';
foreach ($iostoreDetailArr as $value) {
$dataIostoreDetail = array();
$dataIostoreDetailTowh = array();
$dataIostoreDetail['iostoreId'] = $insertIostoreId;
$dataIostoreDetailTowh['iostoreId'] = $whinsertid['data'];
$dataIostoreDetail['sku'] = $value;
$dataIostoreDetailTowh['sku'] = $value;
$dataIostoreDetail['addUserId'] = $dataIostore['addUserId'];
$dataIostoreDetail['addTime'] = time();
$dataIostoreDetail['whId'] = $whId;
$dataIostoreDetailTowh['whId'] = $whId;
$dataIostoreDetailTowh['amount'] = 1;
//默認數量為1
$dataIostoreDetailTowh['cost'] = GoodsModel::getCostBySku($value);
$dataIostoreDetailTowh['purchaseId'] = GoodsModel::getpurchaseIdBySku($value);
OmAvailableModel::addTNameRow2arr($tName, $dataIostoreDetail);
$msgiostore = OmAvailableModel::newData2ErpInterfOpen("wh.addWhIoStoreDetailInWh", array("jsonArr" => json_encode($dataIostoreDetailTowh)), '88', false);
}
BaseModel::commit();
BaseModel::autoCommit();
$status = "領料單 {$dataIostore['ordersn']} 生成成功";
header("Location:index.php?mod=products&act=getOutStoreList&status={$status}");
} catch (Exception $e) {
BaseModel::rollback();
BaseModel::autoCommit();
$status = "係統錯誤,生成失敗";
header("Location:index.php?mod=products&act=getOutStoreList&status={$status}");
//.........這裏部分代碼省略.........
示例4: view_changePurchaseBatchOn
public function view_changePurchaseBatchOn()
{
$useId = $_SESSION['userId'];
$personName = getPersonNameById($useId);
if (empty($personName)) {
$status = "<font color=red>係統找不到登錄人信息!</font><br/>";
echo $status;
exit;
}
if (isset($_POST['submit']) && $_POST['submit'] != '') {
$uploadfile = 'changePurchaseBatch' . date("Y") . date("m") . date("d") . date("H") . date('i') . date('s') . '_' . $personName . ".xls";
if (move_uploaded_file($_FILES['upfile']['tmp_name'], 'upload/' . $uploadfile)) {
echo "<font color=BLUE>文件上傳成功!</font><br>";
} else {
echo "<font color=red> 文件上傳失敗!</font>";
exit;
}
$fileName = 'upload/' . $uploadfile;
$filePath = $fileName;
$PHPExcel = new PHPExcel();
$PHPReader = new PHPExcel_Reader_Excel2007();
if (!$PHPReader->canRead($filePath)) {
$PHPReader = new PHPExcel_Reader_Excel5();
if (!$PHPReader->canRead($filePath)) {
echo 'no Excel';
return;
}
}
$PHPExcel = $PHPReader->load($filePath);
$currentSheet = $PHPExcel->getSheet(0);
$highestRow = $currentSheet->getHighestRow();
//表格中的最大行數
$tmpArr = array();
$status = '';
$flag = true;
//標識檢測結果
for ($i = 2; $i <= $highestRow; $i++) {
//先檢查導入表格的正確性
$sku = trim($currentSheet->getCell('A' . $i)->getValue());
//sku
$sku = preg_replace("/(\\s|\\ \\;| | )/", "", $sku);
$purchaseName = trim($currentSheet->getCell('B' . $i)->getValue());
//采購人名稱
$purchaseName = preg_replace("/(\\s|\\ \\;| | )/", "", $purchaseName);
$sku = strpos($sku, '_') === false ? str_pad($sku, 3, '0', STR_PAD_LEFT) : $sku;
if (empty($sku)) {
$status .= "<font color=red>第 {$i} 行,SKU為空!</font><br/>";
echo $status;
exit;
}
if (empty($purchaseName)) {
$status .= "<font color=red>第 {$i} 行,采購為空!</font><br/>";
echo $status;
exit;
}
if (!isSkuExist($sku)) {
$status .= "<font color=red>第 {$i} 行,找不到該SKU信息!</font><br/>";
$flag = false;
}
$purchaseId = getPersonIdByName($purchaseName);
if (empty($purchaseId)) {
$status .= "<font color=red>第 {$i} 行,找不到該采購員!</font><br/>";
$flag = false;
}
}
if (!$flag) {
$status .= '<font color=red>更新失敗!</font>';
echo $status;
exit;
}
$status = '';
for ($i = 2; $i <= $highestRow; $i++) {
//如果通過了檢測,則批量更新數據
$sku = trim($currentSheet->getCell('A' . $i)->getValue());
//sku
$sku = preg_replace("/(\\s|\\ \\;| | )/", "", $sku);
$purchaseName = trim($currentSheet->getCell('B' . $i)->getValue());
//采購人名稱
$purchaseName = preg_replace("/(\\s|\\ \\;| | )/", "", $purchaseName);
$sku = strpos($sku, '_') === false ? str_pad($sku, 3, '0', STR_PAD_LEFT) : $sku;
$purchaseId = getPersonIdByName($purchaseName);
$tName = 'pc_goods';
$dataPurchase = array();
$dataPurchase['purchaseId'] = $purchaseId;
$where = "WHERE sku='{$sku}'";
OmAvailableModel::updateTNameRow2arr($tName, $dataPurchase, $where);
OmAvailableModel::newData2ErpInterfOpen('pc.erp.updateCguser', array('goods_sn' => $sku, 'cguser' => $purchaseName, 'gw88'));
//同步到深圳ERP
$status .= "<font color=green>{$sku} 采購 {$purchaseName} 更新成功</font><br/>";
}
$status .= '<font color=green>更新成功!</font>';
echo $status;
exit;
}
}
示例5: view_addCombineOn
//.........這裏部分代碼省略.........
$combineNote = $_POST['combineNote' . $index] ? trim($_POST['combineNote' . $index]) : '';
$skuArr = $_POST['sku' . $index];
$countArr = $_POST['count' . $index];
$dataCom = array();
$dataCom['combineSpu'] = $combineSpu;
$dataCom['combineSku'] = $combineSku;
$dataCom['combineCost'] = $combineCost;
$dataCom['combineWeight'] = $combineWeight;
$dataCom['combineLength'] = $combineLength;
$dataCom['combineWidth'] = $combineWidth;
$dataCom['combineHeight'] = $combineHeight;
$dataCom['combineNote'] = $combineNote;
$dataCom['combineUserId'] = $_SESSION['userId'];
$dataCom['addTime'] = time();
$tName = 'pc_goods_combine';
$insertIdCom = OmAvailableModel::addTNameRow2arr($tName, $dataCom);
if (!$insertIdCom) {
throw new Exception('add combine error');
}
$dataRelation = array();
$dataRelationMem = array();
for ($i = 0; $i < count($skuArr); $i++) {
if (!empty($skuArr[$i]) && !empty($countArr[$i])) {
$dataRelation[] = array('combineSku' => $combineSku, 'sku' => $skuArr[$i], 'count' => $countArr[$i]);
$dataRelationMem[] = array('sku' => $skuArr[$i], 'count' => $countArr[$i]);
}
}
if (!empty($dataRelation)) {
$tName = 'pc_sku_combine_relation';
$where = "WHERE combineSku='{$combineSku}'";
$dataRelationCount = OmAvailableModel::getTNameCount($tName, $where);
if ($dataRelationCount) {
OmAvailableModel::deleteTNameRow($tName, $where);
}
foreach ($dataRelation as $value) {
if (!empty($value['combineSku']) && !empty($value['sku']) && !empty($value['count'])) {
$insertId = OmAvailableModel::addTNameRow2arr($tName, $value);
}
}
}
if ($autoSpuList[0]['status'] != 2) {
$tName = 'pc_auto_create_spu';
$set = "SET status=2";
$where = "WHERE spu='{$combineSpu}'";
$affectRow = OmAvailableModel::updateTNameRow($tName, $set, $where);
}
//將新添加的sku添加到mem中
$key = 'pc_goods_combine_' . $combineSku;
$dataCom['detail'] = $dataRelationMem;
$value = $dataCom;
setMemNewByKey($key, $value);
//這裏不保證能添加成功
//同步新數據到舊係統中
$ebayProductsCombine = array();
$ebayProductsCombine['id'] = $insertIdCom;
$ebayProductsCombine['goods_sn'] = $combineSku;
$goods_sncombine = array();
$truesku = array();
foreach ($dataRelationMem as $value) {
$str = '';
$strTrue = '';
$str = $value['sku'] . '*' . $value['count'];
$strTrue = '[' . $value['sku'] . ']';
$goods_sncombine[] = $str;
$truesku[] = $strTrue;
}
$ebayProductsCombine['goods_sncombine'] = implode(',', $goods_sncombine);
$ebayProductsCombine['notes'] = $combineNote;
$ebayProductsCombine['goods_price'] = $combineCost;
$ebayProductsCombine['goods_weight'] = $combineWeight;
$ebayProductsCombine['cguser'] = getPersonNameById($_SESSION['userId']);
$ebayProductsCombine['ebay_user'] = 'vipchen';
$ebayProductsCombine['createdtime'] = time();
$ebayProductsCombine['truesku'] = implode(',', $truesku);
$ebayGoodsArr[] = $ebayProductsCombine;
}
BaseModel::commit();
BaseModel::autoCommit();
addSalerInfoForAny($combineSpu, 2, $_SESSION['userId'], $_SESSION['userId']);
//add by zqt 20140519,添加銷售人邏輯
//同步數據到深圳ERP
foreach ($ebayGoodsArr as $value) {
$ret = OmAvailableModel::newData2ErpInterfOpen('pc.erp.addGoodsCombine', $value, 'gw88');
}
$status = "添加成功";
echo '<script language="javascript">
alert("' . $status . '");
window.parent.location.href = "index.php?mod=goods&act=getCombineList&searchComField=1&fieldValue=' . $combineSpu . '";
</script>';
exit;
} catch (Exception $e) {
BaseModel::rollback();
BaseModel::autoCommit();
echo $e->getMessage();
$status = "添加失敗,請聯係係統技術部,謝謝";
echo '<script language="javascript">
alert("' . $status . '");
</script>';
}
}
示例6: act_updateSpuArchivePid
function act_updateSpuArchivePid()
{
$spu = $_POST['spu'];
$pid = $_POST['pid'];
$userId = $_SESSION['userId'];
if (intval($userId) <= 0) {
self::$errCode = '100';
self::$errMsg = "登陸超時,請重試";
return false;
}
if (empty($spu) || empty($pid)) {
self::$errCode = '101';
self::$errMsg = "異常,錯誤!";
return false;
}
$tName = 'pc_spu_archive';
$select = 'categoryPath';
$where = "WHERE is_delete=0 AND spu='{$spu}'";
$spuList = OmAvailableModel::getTNameList($tName, $select, $where);
if (empty($spuList)) {
self::$errCode = '102';
self::$errMsg = "該SPU檔案不存在";
return false;
}
if ($spuList[0]['categoryPath'] == $pid) {
self::$errCode = '110';
self::$errMsg = "類別無修改";
return false;
}
$tName = 'pc_goods_category';
$where = "WHERE path='{$pid}' and is_delete=0";
$count = OmAvailableModel::getTNameCount($tName, $where);
if (!$count) {
self::$errCode = '103';
self::$errMsg = "所選類別不存在,請刷新重試!";
return false;
}
$where = "WHERE path like'{$pid}-%' and is_delete=0";
$count = OmAvailableModel::getTNameCount($tName, $where);
if ($count) {
self::$errCode = '104';
self::$errMsg = "產品檔案隻能建立在最小分類下,請選擇最小分類";
return false;
}
try {
BaseModel::begin();
$tName = 'pc_spu_archive';
$where = "WHERE spu='{$spu}'";
$dataTmpArr = array();
$dataTmpArr['categoryPath'] = $pid;
OmAvailableModel::updateTNameRow2arr($tName, $dataTmpArr, $where);
//更新SPU檔案的類別
$tName = 'pc_archive_spu_property_value_relation';
$where = "WHERE spu='{$spu}'";
OmAvailableModel::deleteTNameRow($tName, $where);
//物理刪除該SPU產品檔案選擇屬性記錄
$tName = 'pc_archive_spu_input_value_relation';
$where = "WHERE spu='{$spu}'";
OmAvailableModel::deleteTNameRow($tName, $where);
//物理刪除SPU產品檔案文本記錄
$tName = 'pc_goods';
$where = "WHERE is_delete=0 AND spu='{$spu}'";
$dataTmpArr = array();
$dataTmpArr['goodsCategory'] = $pid;
OmAvailableModel::updateTNameRow2arr($tName, $dataTmpArr, $where);
//更新該SPU下所有SKU的類別
BaseModel::commit();
BaseModel::autoCommit();
OmAvailableModel::newData2ErpInterfOpen('pc.erp.updateGoodsCategoryBySpu', array('spu' => $spu, 'pid' => $pid), 'gw88');
$personName = getPersonNameById($userId);
error_log(date('Y-m-d_H:i') . " {$personName} 將SPU:{$spu} 類別改為 {$pid} 原始類別為: {$spuList[0]['categoryPath']} \r\n", 3, WEB_PATH . "log/updateSpuCategoryLog.txt");
self::$errCode = 200;
self::$errMsg = "修改成功";
return true;
} catch (Exception $e) {
BaseModel::rollback();
BaseModel::autoCommit();
self::$errCode = 404;
self::$errMsg = '修改失敗,原因為:' . $e->getMessage();
return false;
}
}
示例7: view_addSkuSingOn
//.........這裏部分代碼省略.........
$ebayGoodsArr = array();
//同步數據數組
BaseModel::begin();
for ($i = 0; $i < count($skuArr); $i++) {
$sku = post_check($spu . trim($skuArr[$i]));
$goodsName = !empty($goodsNameArr[$i]) ? $goodsNameArr[$i] : '';
$goodsCost = !empty($goodsCostArr[$i]) ? $goodsCostArr[$i] : 0;
$goodsNote = !empty($goodsNoteArr[$i]) ? $goodsNoteArr[$i] : '';
$goodsColor = !empty($goodsColorArr[$i]) ? $goodsColorArr[$i] : 0;
$goodsSize = !empty($goodsSizeArr[$i]) ? $goodsSizeArr[$i] : 0;
if ($i >= 1 && $sku == $spu) {
continue;
}
$dataSku = array();
$dataSku['spu'] = $spu;
$dataSku['goodsCategory'] = $pid;
$dataSku['purchaseId'] = $userId;
$dataSku['goodsCreatedTime'] = time();
$dataSku['goodsSort'] = intval(substr($spu, 2));
$dataSku['sku'] = $sku;
$dataSku['goodsName'] = $goodsName;
$dataSku['goodsCost'] = $goodsCost;
$dataSku['goodsNote'] = $goodsNote;
$dataSku['goodsStatus'] = $goodsStatus;
$dataSku['isNew'] = $isNew;
$dataSku['goodsColor'] = $goodsColor;
$dataSku['goodsSize'] = $goodsSize;
$tName = 'pc_goods';
$insertId = OmAvailableModel::addTNameRow2arr($tName, $dataSku);
addWeightBackupsModify($sku, 0, $userId, false);
//添加默認的重量變化記錄
addVolumeBackupsModify($sku, 0, 0, 0, $userId, false);
//添加默認的體積變化記錄
addPmBackupsModify($sku, 0, 1, $userId, false);
//添加默認的包材變化記錄
addCostBackupsModify($sku, $goodsCost, $userId, false);
//添加默認的成本變化記錄
addStatusBackupsModify($sku, $goodsStatus, '', $userId, false);
//添加默認的狀態變化記錄
//將新添加的sku添加到mem中
$key = 'pc_goods_' . $sku;
$value = $dataSku;
setMemNewByKey($key, $value);
//這裏不保證能添加成功
//同步新數據到舊係統中
$ebayGoods = array();
$ebayGoods['goods_id'] = $insertId;
$ebayGoods['goods_name'] = preg_replace("/(\\s|\\ \\;| | )/", "", $goodsName);
$ebayGoods['goods_sn'] = $sku;
$ebayGoods['goods_price'] = $goodsCost;
$ebayGoods['goods_cost'] = $goodsCost;
//$ebayGoods['goods_weight'] = $goodsWeight;
$ebayGoods['goods_note'] = preg_replace("/(\\s|\\ \\;| | )/", "", $goodsNote);
$ebayGoods['goods_category'] = $pid;
//$ebayGoods['isPacking'] = $isPacking;
$ebayGoods['ebay_user'] = 'vipchen';
//$ebayGoods['factory'] = $partnerId;
$ebayGoods['cguser'] = empty($_SESSION['userId']) ? '' : getPersonNameById($_SESSION['userId']);
//$ebayGoods['capacity'] = $pmCapacity;
//$ebayGoods['ebay_packingmaterial'] = empty($pmId)?'':PackingMaterialsModel::getPmNameById($pmId);
$ebayGoods['add_time'] = time();
$ebayGoods['spu'] = $spu;
$ebayGoods['goods_code'] = $insertId + 1000000;
$ebayGoods['color'] = $goodsColor;
$ebayGoods['size'] = $goodsSize;
if ($goodsStatus == 1) {
//在線
$ebayGoods['isuse'] = 0;
} elseif ($goodsStatus == 51) {
//PK產品
$ebayGoods['isuse'] = 51;
} else {
//其餘的都做下線處理
$ebayGoods['isuse'] = 1;
}
$ebayGoodsArr[] = $ebayGoods;
}
BaseModel::commit();
BaseModel::autoCommit();
//同步數據到深圳ERP
foreach ($ebayGoodsArr as $value) {
$res = OmAvailableModel::newData2ErpInterfOpen('pc.erp.addGoods', $value, 'gw88');
}
$status = "添加成功";
echo '<script language="javascript">
alert("' . $status . '");
window.parent.location.href = "index.php?mod=goods&act=getGoodsList&searchs=1&status=' . $status . '&seachdata=' . $spu . '";
</script>';
exit;
} catch (Exception $e) {
BaseModel::rollback();
BaseModel::autoCommit();
$status = $e->getMessage();
echo '<script language="javascript">
alert("' . '添加失敗——' . $status . '");
window.parent.location.href = "index.php?mod=goods&act=getGoodsList&searchs=1&status=' . $status . '&seachdata=' . $spu . '";
</script>';
exit;
}
}
示例8: interFaceForCNDLToMH
function interFaceForCNDLToMH($sku, $type)
{
$tName = 'pc_goods';
$select = 'spu,goodsCost,goodsStatus,goodsWeight,goodsLength,goodsWidth,goodsHeight';
$where = "WHERE sku='{$sku}'";
$skuLst = OmAvailableModel::getTNameList($tName, $select, $where);
$spu = $skuLst[0]['spu'];
$goodsCost = $skuLst[0]['goodsCost'];
$goodsStatus = $skuLst[0]['goodsStatus'];
$goodsWeight = $skuLst[0]['goodsWeight'];
$goodsLength = $skuLst[0]['goodsLength'];
$goodsWidth = $skuLst[0]['goodsWidth'];
$goodsHeight = $skuLst[0]['goodsHeight'];
$dataArr = array();
$dataArr['spu'] = $spu;
$dataArr['status'] = $goodsStatus == 1 || $goodsStatus == 51 ? 1 : 0;
$dataArr['weight'] = $goodsWeight;
$dataArr['length'] = $goodsLength;
$dataArr['width'] = $goodsWidth;
$dataArr['height'] = $goodsHeight;
$dataArr['cost'] = $goodsCost;
$toArr = array();
$toArr['sku'] = $sku;
$toArr['type'] = $type;
$toArr['data'] = json_encode($dataArr);
$ret = OmAvailableModel::newData2ErpInterfOpen('erp.getPCgoodsInfo', $toArr, 'gw88');
error_log(date('Y-m-d_H:i') . " sku:{$sku} type:{$type} data:{$toArr['data']} \r\n", 3, WEB_PATH . "log/interFaceForCNDLToMHLog.txt");
//print_r($ret);
// exit;
}
示例9: act_alertSkuConversion
function act_alertSkuConversion()
{
$id = $_GET['id'] ? post_check(trim($_GET['id'])) : 0;
$id = intval($id);
if ($id <= 0) {
self::$errCode = '100';
self::$errMsg = "異常";
return;
}
$modifiedUserId = intval($_SESSION['userId']);
$modifiedTime = time();
$update_new_sku = $_REQUEST['update_new_sku'] ? post_check(trim($_REQUEST['update_new_sku'])) : "";
$update_old_sku = $_REQUEST['update_old_sku'] ? post_check(trim($_REQUEST['update_old_sku'])) : "";
$preoldsku = $_REQUEST['preoldsku'] ? post_check(trim($_REQUEST['preoldsku'])) : "";
$prenewsku = $_REQUEST['prenewsku'] ? post_check(trim($_REQUEST['prenewsku'])) : "";
if ($modifiedUserId <= 0) {
self::$errCode = '103';
self::$errMsg = "登陸超時,請重試";
return;
}
if (empty($update_old_sku)) {
self::$errCode = '101';
self::$errMsg = "舊料號不能為空";
return;
}
if (empty($update_new_sku)) {
self::$errCode = '101';
self::$errMsg = "新料號不能為空";
return;
}
/* if(!preg_match("/^[A-Z0-9]+(_[A-Z0-9]+)*$/",$update_new_sku)){
self::$errCode = '100';
self::$errMsg = "新料號 $update_new_sku 格式不合法";
return;
}
if(!preg_match("/^[A-Z0-9]+(_[A-Z0-9]+)*$/",$update_old_sku)){
self::$errCode = '100';
self::$errMsg = "舊料號 $update_old_sku 格式不合法";
return;
} */
$paArr = array('oldsku' => $update_old_sku, 'newsku' => $update_new_sku, 'preoldsku' => $preoldsku, 'prenewsku' => $prenewsku);
try {
BaseModel::begin();
$tName = ' pc_sku_conversion';
$set = " SET new_sku='{$update_new_sku}', old_sku='{$update_old_sku}', modifiedUserId='{$modifiedUserId}',modifiedTime='{$modifiedTime}'";
$where = " WHERE id={$id} and is_delete=0";
OmAvailableModel::updateTNameRow($tName, $set, $where);
//先將轉換記錄修改
self::$errCode = '200';
self::$errMsg = "修改轉換記錄成功,舊料號{$update_old_sku}轉新料號{$update_new_sku} 記錄修改成功";
$data = OmAvailableModel::newData2ErpInterfOpen("erp.updatePurchaseSkuConversion", $paArr, "88", false);
if ($data['resCode'] != 200) {
self::$errCode = '5004';
self::$errMsg = "同步數據出錯";
return;
}
BaseModel::commit();
BaseModel::autoCommit();
return;
} catch (Exception $e) {
BaseModel::rollback();
BaseModel::autoCommit();
self::$errCode = '4004';
self::$errMsg = $e->getMessage();
return;
}
}