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