public static function orderLog($orderid, $ss, $note, $orderType = "") { !self::$dbConn ? self::initDB() : null; $where = "where id={$orderid}"; $orderinfo = OmAvailableModel::getTNameList("om_unshipped_order", "*", $where); $sql = array(); $sql['operatorId'] = $_SESSION['sysUserId']; $sql['omOrderId'] = $orderid; //$sql['note'] = "编辑订单"; $sql['note'] = $note; $sql['sql'] = mysql_real_escape_string($ss); $sql['createdTime'] = time(); if (!empty($orderType) && $orderinfo[0]['orderType'] != $orderType) { $sql['oldStatus'] = $orderinfo[0]['orderType']; $sql['newStatus'] = $orderType; $sql['note'] .= "修改订单状态"; } $strmctime = date('Y_m', time()); $sql = "INSERT INTO om_order_log_" . $strmctime . " set " . array2sql($sql); $sql = self::$dbConn->query($sql); if ($sql) { return true; } else { return false; //echo $sql; } }
public function act_accountList() { $select = " id ,account "; $where = " where is_delete = 0 and token <> '' order by account "; $accountList = OmAvailableModel::getTNameList("fb_account", $select, $where); return $accountList; }
function act_autoCreateSpu() { $data = array(); $prefix = trim($_POST['prefix']); if (!preg_match("/^[A-Z]{2}\$/", $prefix)) { self::$errCode = 11; self::$errMsg = 'error'; return false; } $prefixList = OmAvailableModel::getTNameList('pc_auto_create_spu_prefix', 'isSingSpu', "WHERE prefix='{$prefix}'"); $isSingSpu = $prefixList[0]['isSingSpu']; //该prefix下试单还是虚拟料号 $autoSpuList = OmAvailableModel::getTNameList('pc_auto_create_spu', 'sort', "WHERE spu REGEXP '^{$prefix}[0-9]{6}\$' order by sort desc limit 1"); $maxNumberAuto = $autoSpuList[0]['sort']; //auto表中最大的max $maxNumberTrue = OmAvailableModel::getMaxSpu($prefix, $isSingSpu); //对应goods表或combine表中最大的max $maxNumber = $maxNumberTrue > $maxNumberAuto ? $maxNumberTrue : $maxNumberAuto; //return $maxNumberTrue; //$maxNumber = OmAvailableModel::getMaxSpu($prefix, $isSingSpu); $spu = $prefix . str_pad($maxNumber + 1, 6, '0', STR_PAD_LEFT); $data = array('spu' => $spu, 'sort' => $maxNumber + 1, 'prefix' => $prefix, 'isSingSpu' => $isSingSpu); if (!empty($data)) { return $data; } else { self::$errCode = 1; self::$errMsg = 'error'; return false; } }
public function act_postsku() { $sku = isset($_POST['sku']) ? trim($_POST['sku']) : ""; $sku = get_goodsSn($sku); $position = isset($_POST['position']) ? trim($_POST['position']) : ""; $num = isset($_POST['num']) ? trim($_POST['num']) : ""; $num = intval($num); if (empty($position)) { self::$errCode = 502; self::$errMsg = "仓位不能为空"; return false; } if ($num < 1) { self::$errCode = 502; self::$errMsg = "{$sku}出库数量{$num}有误!"; return false; } $checkonhandle = wrapperSkuOutModel::selectstock($sku); if (empty($checkonhandle)) { self::$errCode = 502; self::$errMsg = "{$sku}材料未导入库存信息表!"; return false; } $skuinfo = whShelfModel::selectSku(" where sku = '{$sku}'"); if (empty($skuinfo)) { self::$errCode = 502; self::$errMsg = "{$sku}材料没信息!"; return false; } else { $skuId = $skuinfo['id']; $purchaseId = $skuinfo['purchaseId']; } $positon_info = OmAvailableModel::getTNameList("wh_position_distribution", "id", "where pName='{$position}' and storeId in(1,2)"); if (empty($positon_info)) { self::$errCode = 502; self::$errMsg = "无仓位号信息"; return false; } else { $positionId = $positon_info[0]['id']; } $relation_info = OmAvailableModel::getTNameList("wh_product_position_relation", "id", "where pId='{$skuId}' and positionId='{$positionId}' and storeId in(1,2)"); if (empty($relation_info)) { self::$errCode = 502; self::$errMsg = "包材和仓位不对应"; return false; } $paraArr = array('ordersn' => date('YmdHis', time()), 'sku' => $sku, 'amount' => $num, 'purchaseId' => $purchaseId, 'ioType' => 1, 'ioTypeId' => 26, 'userId' => $_SESSION['userId'], 'reason' => '包材出库', 'positionId' => $positionId); $WhIoRecordsAct = new WhIoRecordsAct(); $tt = $WhIoRecordsAct->act_addIoRecoresForWh($paraArr); //出库记录 self::$errCode = 200; self::$errMsg = "{$sku}出库{$num}个成功!"; return true; }
public function act_index() { $platformId = $_REQUEST['platformId']; $account = OmAvailableModel::getTNameList('om_account', 'id,platformId,account', 'WHERE is_delete=0 AND platformId = ' . $platformId); if ($account) { return $account; } else { self::$errCode = '300'; self::$errMsg = '无法获得对应平台用户名信息'; return false; } }
function act_getTNameList($tName, $set, $where) { //表名,SET,WHERE $list = OmAvailableModel::getTNameList($tName, $set, $where); if (is_array($list)) { return $list; } else { self::$errCode = OmAvailableModel::$errCode; self::$errMsg = OmAvailableModel::$errMsg; return false; } }
public function view_skuInfo() { $sku = isset($_GET['sku']) ? trim($_GET['sku']) : ""; //$spu = ExportsToXlsModel::getGoods($sku); $spu = GoodsModel::getSkuList($sku); $spu = $spu['spu']; $where = "where spu = '{$spu}'"; $skuinfo = OmAvailableModel::getTNameList("pc_goods", "*", $where); $skuStock = array(); foreach ($skuinfo as $key => $value) { $sku = $value['sku']; //获取库存 $skuStock = WarehouseAPIModel::getSkuStock($sku); //获取料号信息 //$skumsg = ExportsToXlsModel::getGoods($sku); $skumsg = GoodsModel::getSkuList($sku); //获取缓存表信息 $where = "where sku='{$sku}'"; $skuStatics = OmAvailableModel::getTNameList("om_sku_daily_status", "*", $where); $skuStockList = array(); $skuStockList['nums'] = $skuStock; $skuStockList['sku'] = $skumsg['sku']; $skuStockList['spu'] = $skumsg['spu']; $skuStockList['goodsName'] = $skumsg['goodsName']; $skuStockList['goodsCost'] = $skumsg['goodsCost']; $skuStockList['goodsWeight'] = $skumsg['goodsWeight']; $skuStockList['AverageDailyCount'] = $skuStatics['AverageDailyCount']; $skuStockList['waitingSendCount'] = $skuStatics['waitingSendCount']; $skuStockList['xuniCount'] = $skuStatics['waitingSendCount']; $skuStockList['goodsStatus'] = $skumsg['goodsStatus']; $path = $skumsg['goodsCategory']; $cateName = GoodsModel::getCategoryInfoByPath($path); $skuStockList['cateName'] = $cateName['name']; $skuStockList['isNew'] = $skumsg['isNew']; $skuStockList['pmId'] = $skumsg['pmId']; $pmName = GoodsModel::getMaterInfoById($skumsg['pmId']); $skuStockList['pmName'] = $pmName['pmName']; //print_r($pmName); $pName = $skumsg['purchaseId']; $skuStockList['pName'] = UserModel::getUsernameById($pName); $skuStockList['isPacking'] = $skumsg['isPacking']; $skuStockList['whName'] = "深圳A仓"; $skuStock_arr[] = $skuStockList; } $this->smarty->assign("skuStockList", $skuStock_arr); //print_r($skuStockList); $this->smarty->display("skuInfo.htm"); }
function act_getTNameList() { $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']; //表名 $select = $jsonArr['select']; //select,不用关键字SELECT $where = $jsonArr['where']; //where,要带上关键字WHERE if (empty($tName) || empty($select) || empty($where)) { self::$errCode = '300'; self::$errMsg = '必要参数不完整'; return false; } $list = OmAvailableModel::getTNameList($tName, $select, $where); if (is_array($list)) { self::$errCode = '200'; self::$errMsg = '成功'; return $list; } else { self::$errCode = '404'; self::$errMsg = '数据库操作错误'; return false; } }
/** * pda_ExpressWeighingAct::act_pda_ExpressId() * @author cxy * @return */ public function act_pda_ExpressId() { $userId = $_SESSION['userId']; $ebay_id = trim($_POST['ebay_id']); if (empty($userId)) { self::$errCode = '0'; self::$errMsg = '系统登录超时,请先关闭浏览器 然后登录扫描!!'; return false; } if (empty($ebay_id)) { self::$errCode = 0; self::$errMsg = '请填写单号!'; return; } $where = "where id={$ebay_id}"; $order = orderPartionModel::selectOrder($where); if (!$order) { self::$errCode = 0; self::$errMsg = $ebay_id . '发货单不存在!'; return false; } if ($order[0]['isExpressDelivery'] != 1) { self::$errCode = 0; self::$errMsg = $ebay_id . '此发货单不是快递发货单!'; return false; } if ($order[0]['orderStatus'] != PKS_WWEIGHING) { self::$errCode = 0; self::$errMsg = $ebay_id . '此发货单状态不是在待称重状态!'; return false; } $result = OmAvailableModel::getTNameList("wh_shipping_order_note_record ", "content", "where shipOrderId='{$ebay_id}' and is_delete =0 "); $note = $result[0]['content']; $res['content'] = $note; self::$errCode = 200; self::$errMsg = $ebay_id . "发货单号正确,请填写该发货单的重量,注意填写为的重量单位为KG!"; return $res; }
function act_getSkuId($sku) { $field = ' id '; $where = " where sku = '{$sku}' limit 0,1 "; $result = OmAvailableModel::getTNameList('ph_goods', $field, $where); return $result[0]['id']; }
/** *功能:我自己运行的接口,批量更新数据,根据需求批量更新销售是陈智兴的虚拟料号,将其销售人员改为对应真实SPU的销售人员 * */ public function act_updateBatchForSalers() { $tName = 'pc_spu_saler_combine'; $select = 'spu'; $where = "WHERE is_delete=0 and platformId=2 and isAgree=2 and salerId=60"; $combineSpuList = OmAvailableModel::getTNameList($tName, $select, $where); foreach ($combineSpuList as $value) { $combineSpu = $value['spu']; $tName = 'pc_goods_combine'; $select = 'combineSku'; $where = "WHERE is_delete=0 and combineSpu='{$combineSpu}'"; $combineSkuList = OmAvailableModel::getTNameList($tName, $select, $where); if (!empty($combineSkuList)) { $tName = 'pc_sku_combine_relation'; $select = 'sku'; $where = "WHERE combineSku='{$combineSkuList[0]['combineSku']}'"; $skuList = OmAvailableModel::getTNameList($tName, $select, $where); if (!empty($skuList)) { $tName = 'pc_goods'; $select = 'spu'; $where = "WHERE is_delete=0 and sku='{$skuList[0]['sku']}'"; $spuList = OmAvailableModel::getTNameList($tName, $select, $where); if (!empty($spuList)) { $tName = 'pc_spu_saler_single'; $select = 'salerId'; $where = "WHERE is_delete=0 and platformId=2 and isAgree=2 and spu='{$spuList[0]['spu']}'"; $singleSpuSalerIdList = OmAvailableModel::getTNameList($tName, $select, $where); if (!empty($singleSpuSalerIdList)) { $salerId = $singleSpuSalerIdList[0]['salerId']; $saler = getPersonNameById($salerId); $tName = 'pc_spu_saler_combine'; $where = "WHERE is_delete=0 and spu='{$combineSpu}'"; $dataArr = array(); $dataArr['salerId'] = $salerId; OmAvailableModel::updateTNameRow2arr($tName, $dataArr, $where); echo "{$combineSpu} 的原销售是 陈智兴,真实销售是 {$saler} <br />"; } else { echo "{$combineSpu} 的原销售是 陈智兴,真实销售为空 <br />"; } } } } } }
<?php require_once "/data/web/erpNew/pc.valsun.cn/framework.php"; Core::getInstance(); session_start(); header("Content-type:text/html;charset=utf-8"); date_default_timezone_set("Asia/Shanghai"); session_cache_expire(30); //session有效时间为30分钟 $tName = 'purchase_sku_conversion'; $select = '*'; $where = "WHERE 1=1"; $purchaseSkuConvertionList = OmAvailableModel::getTNameList($tName, $select, $where); if (!empty($purchaseSkuConvertionList)) { $tName = 'pc_sku_conversion'; $where = "WHERE 1=1"; OmAvailableModel::deleteTNameRow($tName, $where); } foreach ($purchaseSkuConvertionList as $value) { $id = $value['id']; $old_sku = $value['old_sku']; $new_sku = $value['new_sku']; $user = $value['user']; $createdtime = $value['createdtime']; $modifiedtime = $value['modifiedtime']; $dataConvertion = array(); $dataConvertion['id'] = $id; $dataConvertion['old_sku'] = $old_sku; $dataConvertion['new_sku'] = $new_sku; $dataConvertion['addUserId'] = getPersonIdByName($user); $dataConvertion['createdTime'] = strtotime($createdtime);
public static function calcNowOrderShippingFee($omOrderId) { require_once WEB_PATH . "api/include/functions.php"; $shippingFee = 0; //初始化要返回的订单运费变量 if (intval($omOrderId) == 0) { //订单号不合法 return false; } $tName = 'om_unshipped_order'; $select = '*'; $where = "WHERE is_delete=0 AND id='{$omOrderId}'"; $omOrderList = OmAvailableModel::getTNameList($tName, $select, $where); if (empty($omOrderList)) { //没有对应订单号 return false; } $isFixed = $omOrderList[0]['isFixed']; //是最优运输方式还是固定运输方式,默认为2 $calcWeight = $omOrderList[0]['calcWeight']; //订单估算重量 $transportId = $omOrderList[0]['transportId']; //运输方式id $tName = 'om_unshipped_order_userInfo'; $select = '*'; $where = "WHERE omOrderId='{$omOrderId}'"; $omOrderUserInfoList = OmAvailableModel::getTNameList($tName, $select, $where); if (empty($omOrderUserInfoList)) { //没有对应订单号的用户信息 return false; } $countryName = $omOrderUserInfoList[0]['countryName']; //国家名称 $shipaddr = 1; //发货地址id,用来获取最优运输方式 $zipCode = $omOrderUserInfoList[0]['zipCode']; //邮编 $method = ''; //访问开放系统接口名称,最优还是固定,调用开放系统必填参数 if ($isFixed == 2) { $method = 'trans.carrier.best.get'; } else { $method = 'trans.carrier.fix.get'; } $paramArr = array('method' => $method, 'format' => 'json', 'v' => '1.0', 'username' => C('OPEN_SYS_USER')); $paramArr['carrier'] = $transportId; $paramArr['country'] = $countryName; $paramArr['weight'] = $calcWeight; $paramArr['shaddr'] = $shipaddr; $paramArr['postcode'] = $zipCode; $result = callOpenSystem($paramArr); $data = json_decode($result, true); //var_dump($data); if (empty($data['data'])) { return false; } return $data['data']; /*$data = UserCacheModel :: getOpenSysApi($method, $paramArr); if ($isFixed == 2) { return $data['data']; } else { return $data['data']; }*/ }
public function view_printGroupOrder2() { $groupsn = isset($_GET['groupsn']) ? trim($_GET['groupsn']) : 0; if (empty($groupsn)) { echo "请指定配货清单!"; exit; } $group_list = OmAvailableModel::getTNameList("wh_shipping_order_group", "*", "where shipOrderGroup='{$groupsn}' order by id asc"); if (!$group_list) { echo "该配货清单不存在!"; exit; } $time = time(); $userName = $_SESSION['userName']; //更新今日清单打印表 OmAvailableModel::updateTNameRow("wh_shipping_order_group_print", "set status='1',orderPrintUser='******',orderPrintTime='{$time}'", "where shipOrderGroup='{$groupsn}'"); //获取订单对应的车号 $orderids = array(); foreach ($group_list as $group) { if (!isset($orderids[$group['shipOrderId']])) { $orderids[$group['shipOrderId']] = $group['carNumber']; } } $o_arr = array(); foreach ($orderids as $order => $car_number) { $o_arr[] = $order; } $oids = implode(',', $o_arr); $po_obj = new PackingOrderModel(); $ordersinfo = $po_obj->getaSetOfOrderInfo($oids); if (empty($ordersinfo)) { $data = array('data' => array('没有可打印内容!'), 'link' => 'index.php?mod=orderWaitforPrint&act=printList'); goErrMsgPage($data); exit; } $sod_obj = new ShipingOrderDetailModel(); $acc_id_arr = array(); foreach ($ordersinfo as &$orinfval) { $locationinfo = array(); $totalnum = 0; $package_type = ''; $iscard = ''; $skulisttemp = $sod_obj->getAllSkuListByOrderId($orinfval['id'], "order by pName,combineSku"); $totalnum = $skulisttemp['totalnum']; $locationinfo = $skulisttemp['skuinfo']; if (isset($locationinfo['notcombine']) && count($locationinfo['notcombine']['info']) == 1) { $package_type = $skulisttemp['packagetype']; } $iscard = printLabelModel::checkprintcard($orinfval['id']); $pmNameStr = CommonModel::getMaterInfoById($orinfval['pmId']); $orinfval['finalposition'] = $locationinfo; $totalStr = $totalnum . " " . $pmNameStr . " " . $orinfval['calcWeight'] . "KG"; if (!empty($package_type)) { $totalStr = $totalStr . " " . $package_type; } if (!empty($iscard)) { $totalStr = $totalStr . " " . $iscard; } $totalStr = $totalStr . " " . $orinfval['platformUsername']; $carrier = CommonModel::getShipingNameById($orinfval['transportId']); $orinfval['abbrshipname'] = CommonModel::getShipingAbbrNameById($orinfval['transportId']); $orinfval['totalStr'] = $totalStr; $orinfval['notes'] = $po_obj->getOrderNotesInfo($orinfval['id']); $orinfval['countryZh'] = CommonModel::getCountryNameCn($orinfval['countryName']); $orinfval['partionFromAddress'] = printLabelModel::getPartionFromAddress($orinfval['id'], $carrier, $orinfval['countryName']); if (!in_array($orinfval['accountId'], $acc_id_arr)) { array_push($acc_id_arr, $orinfval['accountId']); } } $salesaccountinfo = CommonModel::getAccountInfo($acc_id_arr); $this->smarty->assign('salesaccountinfo', $salesaccountinfo); $totalCount = count($ordersinfo); $this->smarty->assign('totalCount', $totalCount); $this->smarty->assign('orderids', $orderids); $this->smarty->assign('ordersinfo', $ordersinfo); $this->smarty->display('label50x100_22.htm'); }
public function act_manualSortingCheck() { $userId = $_SESSION['userId']; $waveId = isset($_POST['waveId']) ? $_POST['waveId'] : ""; $where = "number='{$waveId}'"; $waveInfo = WhWaveInfoModel::get_wave_info("*", $where); if (!$waveInfo) { self::$errCode = 502; self::$errMsg = "此配货单号不存在!"; return false; } if ($waveInfo[0]['waveStatus'] != WAVE_FINISH_GET_GOODS) { self::$errCode = 514; self::$errMsg = "此配货单不在【配货完成】状态,不能进行分拣操作!"; return false; } if ($waveInfo[0]['waveType'] == 3) { self::$errCode = 518; self::$errMsg = "此配货单属于多SKU生成的配货单,不能进行人工分拣!"; return false; } //一个发货单对应多个配货单的时候,发货单是唯一的, if ($waveInfo[0]['waveType'] == 1) { $waveId = $waveInfo[0]['id']; $result = WhWaveShippingRelationModel::select_not_scanning($waveId); $shipOrderId = $result[0]['shipOrderId']; if ($result[0]['pickUserId'] != 0) { self::$errCode = 520; self::$errMsg = "此配货单已经分拣过了!"; return false; } WhShippingOrderModel::begin(); $update = WhWaveShippingRelationModel::update(array('pickUserId' => $userId, 'pickTime' => time()), array('is_delete' => 0, 'waveId' => $waveId)); if (!$update) { self::$errCode = 519; self::$errMsg = "扫描该配货单失败,请联系负责人!"; WhShippingOrderModel::rollback(); return false; // $result = WhWaveShippingRelationModel::getShippingOrderIdsByWaveId($waveId); //$shipOrderId = $result[0]['shipOrderId']; //查询还没有扫描的配货单 } $select_not_scanning = WhWaveShippingRelationModel::select_not_scanning_by_id($shipOrderId); $not_scanning_waveId = ''; //还没有分拣的配货单 if ($select_not_scanning) { foreach ($select_not_scanning as $val) { $not_scanning_waveId .= $val['waveId'] . ','; } self::$errMsg = "扫描该配货单'{$waveId}'成功,对应发货单'{$shipOrderId}'的配货单'{$not_scanning_waveId}'还没有分拣!"; } else { self::$errMsg = "扫描该配货单'{$waveId}'成功,对应的发货单'{$shipOrderId}'已经分拣完成,请处理完成之后拿去复核!"; //获取一个发货单对应多个配货单的每个配货单号 $result = OmAvailableModel::getTNameList("wh_wave_shipping_relation", "waveId", "where shipOrderId='{$shipOrderId}' and is_delete=0 "); $wave_all = ''; foreach ($result as $values) { $wave_all .= $values['waveId'] . ','; } $wave_all = trim($wave_all, ','); //得到该发货单下所有配货单的信息 $scan_record = OmAvailableModel::getTNameList("wh_wave_scan_record", "waveId,sku,skuAmount,amount", "where waveId in ('{$wave_all}') and scanStatus = 1 and is_delete=0 "); $picklist_all = array(); foreach ($scan_record as $record) { $data = array('waveId' => $record['waveId'], 'shipOrderId' => $shipOrderId, 'sku' => $record['sku'], 'skuAmount' => $record['skuAmount'], 'amount' => $record['amount'], 'pickStatus' => 1, 'pickUserId' => intval($_SESSION['userId']), 'pickTime' => time(), 'deleteUserId' => '0', 'deleteTime' => '0', 'is_delete' => '0'); $picklist_all[] = $data; } if (!WhWavePickRecordModel::insert($picklist_all, true)) { WhShippingOrderModel::rollback(); self::$errCode = 517; self::$errMsg = "该配货单插入分拣记录失败!"; return false; } $where = "id = '{$shipOrderId}' AND orderStatus='" . PKS_WAITING_SORTING . "'"; if (!WhShippingOrderModel::update_shipping_order($where, "orderStatus='" . PKS_WIQC . "'")) { WhShippingOrderModel::rollback(); self::$errCode = 516; self::$errMsg = "此配货单所属发货单{$shipOrderId}更新状态失败!"; return false; } } WhPushModel::pushOrderStatus($shipOrderId, 'PKS_WIQC', $_SESSION['userId'], time()); //状态推送,需要改为待复核单(订单系统提供状态常量) WhShippingOrderModel::commit(); self::$errCode = 200; return true; } /* if(empty($waveInfo[0]['sku'])){ self::$errCode = 515; self::$errMsg = "此配货单不属于单SKU生成的配货单,不能进行人工分拣!"; return false; } */ $waveId = $waveInfo[0]['id']; //echo $waveId; $shippOrders = WhWaveShippingRelationModel::getShippingOrderIdsByWaveId($waveId); //var_dump($shippOrders); WhShippingOrderModel::begin(); foreach ($shippOrders as $shippOrder) { $shipOrderId = $shippOrder['shipOrderId']; $where = "id = '{$shipOrderId}' AND orderStatus='" . PKS_WAITING_SORTING . "'"; if (!WhShippingOrderModel::update_shipping_order($where, "orderStatus='" . PKS_WIQC . "'")) { WhShippingOrderModel::rollback(); self::$errCode = 516; self::$errMsg = "此配货单所属发货单{$shipOrderId}更新状态失败!"; return false; } } $pick = WhWavePickRecordModel::find("waveId='{$waveId}'"); if (!$pick) { $picklist = array(); $list = WhShippingOrderdetailModel::getShippingOrderSkuList($waveId); foreach ($list as $val) { $data = array('waveId' => $val['waveId'], 'shipOrderId' => $val['shipOrderId'], 'sku' => $val['sku'], 'skuAmount' => $val['amount'], 'amount' => 0, 'pickStatus' => 1, 'pickUserId' => intval($_SESSION['userId']), 'pickTime' => time(), 'deleteUserId' => '0', 'deleteTime' => '0', 'is_delete' => '0'); $picklist[] = $data; } if (!WhWavePickRecordModel::insert($picklist, true)) { WhShippingOrderModel::rollback(); self::$errCode = 517; self::$errMsg = "该配货单插入分拣记录失败!"; return false; } else { foreach ($picklist as $lists) { WhPushModel::pushOrderStatus($lists['shipOrderId'], 'PKS_WIQC', $_SESSION['userId'], time()); //状态推送,需要改为待复核单(订单系统提供状态常量) } } } WhShippingOrderModel::commit(); self::$errCode = 200; self::$errMsg = "该配货单分拣成功,请处理完成之后拿去复核!"; return true; }
public function view_addOrUpdateSpeicailSpuOn() { $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 = 'addOrUpdateSpeicailSpuExcelImport_' . 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(); //表格中的最大行数 echo "表格总行数为 {$highestRow} <br />"; if ($highestRow > 30000) { echo "表格不能超过30000行,请重新整理表格导入,谢谢!"; exit; } $status = ''; $flag = true; //标识检测结果 $tName = 'pc_special_property'; $select = 'id,propertyName'; $where = "WHERE isOn=1"; $pspList = OmAvailableModel::getTNameList($tName, $select, $where); $IPArr = array(); foreach ($pspList as $value) { $IPArr[$value['id']] = $value['propertyName']; } if (empty($IPArr)) { echo "启用的特殊属性记录为空,退出"; exit; } for ($i = 2; $i <= $highestRow; $i++) { //先检查导入表格的正确性 $spu = trim($currentSheet->getCell('A' . $i)->getValue()); //spu $spu = preg_replace("/(\\s|\\ \\;| | )/", "", $spu); $spu = strpos($spu, '_') === false ? str_pad($spu, 3, '0', STR_PAD_LEFT) : $spu; $specailPropertyName = trim($currentSheet->getCell('B' . $i)->getValue()); //$specailPropertyName = preg_replace("/(\s|\ \;| |\xc2\xa0)/","",$specailPropertyName); if (empty($spu)) { $status .= "第 {$i} 行,SPU为空 <br/>"; $flag = false; continue; } $tName = 'pc_auto_create_spu'; $where = "WHERE is_delete=0 AND isSingSpu=1 AND spu='{$spu}'"; if (!OmAvailableModel::getTNameCount($tName, $where)) { $status .= "第 {$i} 行,SPU不存在 <br/>"; $flag = false; continue; } $propertyId = intval(array_search($specailPropertyName, $IPArr)); if ($propertyId <= 0) { $status .= "第 {$i} 行,找不到 {$specailPropertyName} 这个特殊属性记录 <br/>"; $flag = false; continue; } } if (!$flag) { //验证不通过 echo "<font color=red>{$status}</font>"; exit; } else { $status = ''; for ($i = 2; $i <= $highestRow; $i++) { //先检查导入表格的正确性 $spu = trim($currentSheet->getCell('A' . $i)->getValue()); //spu $spu = preg_replace("/(\\s|\\ \\;| | )/", "", $spu); $spu = strpos($spu, '_') === false ? str_pad($spu, 3, '0', STR_PAD_LEFT) : $spu; $specailPropertyName = trim($currentSheet->getCell('B' . $i)->getValue()); //spu $propertyId = intval(array_search($specailPropertyName, $IPArr)); $tName = 'pc_special_property_spu'; $where = "WHERE spu='{$spu}' AND propertyId={$propertyId}"; if (OmAvailableModel::getTNameCount($tName, $where)) { $status .= "第 {$i} 行,{$spu} 已经存在 {$specailPropertyName} 这个特殊属性<br/>"; } else { $dataArr = array(); $dataArr['spu'] = $spu; $dataArr['propertyId'] = $propertyId; OmAvailableModel::addTNameRow2arr($tName, $dataArr); $status .= "第 {$i} 行,{$spu} 添加至 {$specailPropertyName} 成功 <br/>"; } } echo "<font color=green>{$status}</font>"; exit; } } }
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; }
public function recordDataToSystem($data) { $number = $data['num']; $sku = mysql_real_escape_string($data['sku']); $pName = mysql_real_escape_string($data['pName']); $orderid = $data['orderid']; $orderdetailid = $data['detailid']; $amount = $data['amount']; //配货数 $totalNums = $data['totalnum']; //料号总数 $scantime = time(); $scanuserid = $data['userid']; //扫描用户id $islast = $data['islast']; $type = $data['orderTypeId']; //是否为配货单 $shiptype = $data['shiptype']; //快递类型 分国内 国外 小包 $insert_records = "\n insert into wh_order_picking_records values (null, {$orderid}, {$orderdetailid}, '{$sku}', '{$pName}', {$amount},\n {$totalNums}, {$scantime}, '{$scanuserid}', null, null, 1, 0)\n "; //插入配货记录到数据库 $update_sql = "\n update wh_sku_location set actualStock=actualStock-{$amount} where sku = '{$sku}'\n "; //更新总库存 $position_info = OmAvailableModel::getTNameList("wh_position_distribution", "id", "where pName='{$pName}' and storeId=1"); if ($position_info) { $positionId = $position_info[0]['id']; } else { return false; } $sku_info = OmAvailableModel::getTNameList("pc_goods", "id", "where sku='{$sku}'"); if ($sku_info) { $pId = $sku_info[0]['id']; } else { return false; } $update_relation_sql = "\n update wh_product_position_relation set nums=nums-{$amount} where pId = '{$pId}' and positionId='{$positionId}' and is_delete=0 and storeId=1\n "; //更新具体仓位库存 $this->dbconn->begin(); // echo $insert_records;exit; $insert_result = $this->dbconn->query($insert_records); //插入配货记录 if (!$insert_result) { $this->dbconn->rollback(); //失败 回滚 $this->dbconn->query("SET AUTOCOMMIT=1"); return false; } $update_result = $this->dbconn->query($update_sql); //更新总库存 if (!$update_result) { $this->dbconn->rollback(); //失败 回滚 $this->dbconn->query("SET AUTOCOMMIT=1"); return false; } $update_res = $this->dbconn->query($update_relation_sql); //更新实际库存 if (!$update_res) { $this->dbconn->rollback(); //失败 回滚 $this->dbconn->query("SET AUTOCOMMIT=1"); return false; } $nextstatus = 0; if (1 == $shiptype) { //快递 $nextstatus = PKS_WIQC_EX; } elseif (2 == $shiptype) { //小包 $nextstatus = PKS_WIQC; } elseif (3 == $shiptype) { //国内快递 $nextstatus = PKS_INLANDWWEIGHING; } if ($islast) { //如果是最后一个配货料号 则还需更改发货单状态 $up_status_sql = ''; $up_status_sql = 'update wh_shipping_order set orderStatus=' . $nextstatus . ' where id=' . $orderid; /* if($type==1){ //当前为发货单 $up_status_sql = 'update wh_shipping_order set orderStatus='.$nextstatus.' where id='.$orderid; } else { //当前单为配货单 $up_status_sql = 'update wh_shipping_order set orderStatus='.PKS_PDONE.' where id='.$orderid; }*/ $upst_result = $this->dbconn->query($up_status_sql); if (!$update_result) { //修改状态失败 $this->dbconn->rollback(); $this->dbconn->query("SET AUTOCOMMIT=1"); return FALSE; } } $this->dbconn->commit(); $this->dbconn->query("SET AUTOCOMMIT=1"); return TRUE; }
session_cache_expire(30); //session有效时间为30分钟 $fileName = "/data/htdocs/zhuqingting.dev.com/pc.valsun.cn/html/excel/noCZCatetroy" . date("Y-m-d_H_i_s") . ".xls"; $propertyName = '材质'; $tName = 'pc_archive_property'; $select = 'categoryPath'; $where = "WHERE propertyName='{$propertyName}' group by categoryPath"; $ppList = OmAvailableModel::getTNameList($tName, $select, $where); $haveCZArr = array(); foreach ($ppList as $value) { $haveCZArr[] = $value['categoryPath']; } $tName = 'pc_goods_category'; $select = 'path'; $where = "WHERE is_delete=0"; $pathList = OmAvailableModel::getTNameList($tName, $select, $where); $excel = new ExportDataExcel('file'); $excel->filename = $fileName; $excel->initialize(); $excel->addRow(array('无材质属性类别')); foreach ($pathList as $value) { $tName = 'pc_goods_category'; $where = "WHERE path like'{$value['path']}-%' and is_delete=0"; $count = OmAvailableModel::getTNameCount($tName, $where); if (!in_array($value['path'], $haveCZArr) && !$count) { $categoryName = getAllCateNameByPath($value['path']); $excel->addRow(array($categoryName)); //echo $value['path']."\n"; } } $excel->finalize();
require_once "scripts.comm.php"; $accountArr = UserCacheModel::getOpenSysApi("getaccount", array('add' => 1)); $platformArr = array("aliexpress" => 2, "cndirect" => 8, "DHgate" => 4, "dresslink" => 10, "ebay平台" => 1, "Newegg" => 15, "亚马逊" => 11, "出口通" => 3, "国内销售部" => 16, "天猫哲果" => 13, "天猫芬哲" => 12, "海外仓" => 14, "海外销售平台" => 1, "线下结算客户" => 9); foreach ($accountArr as $account) { $insertarr = array(); foreach ($platformArr as $key => $value) { if ($key == $account['ebay_platform']) { $platformId = $value; break; } } $insertarr['id'] = $account['id']; $insertarr['account'] = $account['ebay_account']; $insertarr['addTime'] = 0; $insertarr['addUser'] = $account['ebay_user']; $insertarr['platformId'] = $platformId; $insertarr['appname'] = $account['appname']; $insertarr['email'] = $account['mail']; $insertarr['suffix'] = $account['account_suffix']; $insertarr['token'] = $account['ebay_token']; $count = OmAvailableModel::getTNameList("fb_account", "id", " where id={$account['id']}"); $sql = array2sql($insertarr); if (!count($count) > 0) { if (OmAvailableModel::insertRow("fb_account", " set {$sql}")) { echo "{$account['id']} \n"; } else { echo "失败"; } } unset($insertarr); }
function act_getTNameList($tName, $set, $where) { //表名,SET,WHERE $list = OmAvailableModel::getTNameList($tName, $set, $where); if (is_array($list)) { foreach ($list as $key => $v) { $list[$key]['addTime'] = Date('Y-m-d h:i', $v['addTime']); $list[$key]['updateTime'] = Date('Y-m-d h:i:s', $v['updateTime']); //$list[$key]['refundType'] = ($v['refundType'] == '1') ? '全部退款' : '部分退款'; } return $list; } else { self::$errCode = OmAvailableModel::$errCode; self::$errMsg = OmAvailableModel::$errMsg; return false; } }
function act_allSure() { $userId = $_SESSION['userId']; $id_arr = $_POST['id']; $f_count = count($id_arr); $id = implode(',', $id_arr); $where = "where id in(" . $id . ") and isConfirm=0"; $record_list = OmAvailableModel::getTNameList("wh_abnormal_purchase_orders", "*", $where); $s_count = count($record_list); if ($f_count != $s_count) { self::$errCode = "401"; self::$errMsg = "当前包含有不用审核的订单,请确认!"; return false; } $updata = OmAvailableModel::updateTNameRow("wh_abnormal_purchase_orders", "set isConfirm=1,confirmUserId='{$userId}'", $where); if ($updata) { return true; } else { self::$errCode = "402"; self::$errMsg = "确认失败!"; return false; } }
<?php require "/data/web/wh.valsun.cn/framework.php"; Core::getInstance(); $onhand = OmAvailableModel::getTNameList("wh_sku_location", "*", "where arrivalInventory>0"); foreach ($onhand as $on) { $total = 0; $onhand1 = OmAvailableModel::getTNameList("pc_goods", "*", "where sku='{$on['sku']}'"); $onhand2 = OmAvailableModel::getTNameList("wh_product_position_relation", "*", "where pId={$onhand1[0]['id']} and is_delete=0"); foreach ($onhand2 as $re) { $total += $re['nums']; } $update = OmAvailableModel::updateTNameRow("wh_sku_location", "set actualStock={$total}", "where sku='{$on['sku']}'"); echo $on['sku']; /* exit; print_r($total);exit; $fahuo2 = OmAvailableModel::getTNameList("wh_shipping_order as a inner join wh_shipping_order_relation as b on a.id=b.shipOrderId","a.id,b.originOrderId","where a.orderStatus=900 and b.originOrderId={$f['originOrderId']}"); if(!empty($fahuo2)){ print_r($fahuo2);echo"<br>"; foreach($fahuo2 as $ttt){ $fp = fopen('repeat.txt', 'a+'); $str = $ttt['id']; $str = "$str \n"; fwrite($fp, $str); } } */ } exit;
$where = "WHERE is_delete=0"; $countCombine = OmAvailableModel::getTNameCount($tName, $where); $per = 5000; $page = ceil($countCombine / $per); echo "totalcount = {$countCombine}"; echo "\n"; echo "totalpage = {$page}"; echo "\n"; for ($i = 0; $i < $page; $i++) { echo "currentPage = {$i}"; echo "\n"; $start = $per * $i; $tName = 'pc_goods_combine'; $select = 'combineSpu,combineUserId,addTime'; $where = "WHERE is_delete=0 limit {$start},{$per}"; $combineSpuList = OmAvailableModel::getTNameList($tName, $select, $where); foreach ($combineSpuList as $value) { $combineSpu = $value['combineSpu']; $combineUserId = $value['combineUserId']; $addTime = $value['addTime']; if (empty($combineSpu)) { continue; } $tName = 'pc_auto_create_spu'; $where = "WHERE spu='{$combineSpu}'"; $count1 = OmAvailableModel::getTNameCount($tName, $where); if (!$count1) { $dataAuto = array(); $dataAuto['spu'] = $combineSpu; $dataAuto['purchaseId'] = $combineUserId; $dataAuto['createdTime'] = $addTime;
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; } }
function act_getWhOrderId() { $recordNumber = isset($_GET['recordNumber']) ? trim($_GET['recordNumber']) : ''; $accountAccount = isset($_GET['accountAccount']) ? trim($_GET['accountAccount']) : ''; if (empty($recordNumber) || empty($accountAccount)) { //参数不完整 self::$errCode = 101; self::$errMsg = '参数信息不完整'; return false; } $accountId = 0; $salesaccountlist = CommonModel::getSalesaccountList(); //销售账号 foreach ($salesaccountlist as $list) { if ($list['account'] == $accountAccount) { $accountId = $list['id']; break; } } $data = array(); $orderInfo = OmAvailableModel::getTNameList("wh_shipping_order", "id", "where recordNumber='{$recordNumber}' and accountId='{$accountId}'"); if ($orderInfo) { if (!empty($orderInfo)) { $scanTime = OmAvailableModel::getTNameList("wh_order_review_records", "scanTime", "where shipOrderId={$orderInfo[0]['id']}"); $data['orderId'] = $orderInfo[0]['id']; if (!empty($scanTime)) { $data['scanTime'] = date('Y/m/d', $scanTime[0]['scanTime']); } else { $data['scanTime'] = ''; } return $data; } else { return ''; } } else { self::$errCode = OmAvailableModel::$errCode; self::$errMsg = OmAvailableModel::$errMsg; return false; } }
public function view_showForm() { global $memc_obj; $pagesize = 200; //页面大小 $whereSql = $this->buildWhereSql(); //echo $whereSql;exit; $packorder_obj = new PackingOrderModel(); $rownumber = $packorder_obj->getRowAllNumber($whereSql . ' group by po.id '); //获得所有的行数 $pager = new Page($rownumber, $pagesize); $billlist = $packorder_obj->getBillList($whereSql . ' group by po.id order by pd.pName ' . $pager->limit); //更具条件获得发货单 $packorder_obj->buildOrderinfo($billlist); /* //去除重复的 $currentid = NULL; $prekey = 0; foreach ($billlist as $key=>$valbill){ if ($currentid == $valbill['id']) { $billlist[$prekey]['originOrderId'] .= ', '.$valbill['originOrderId']; unset($billlist[$key]); }else { $prekey = $key; $currentid = $valbill['id']; } } */ $materInfo = CommonModel::getMaterInfoAll(); //获取包材信息 $materInfo = reverse_array($materInfo, 'pmName', 'id'); $shipingtyplist = CommonModel::getShipingTypeList(); //运输方式列表 $shipingtyplist = reverse_array($shipingtyplist, 'carrierNameCn', 'id'); $salesaccountlist = CommonModel::getSalesaccountList(); //获取销售帐号 $salesaccountlist = reverse_array($salesaccountlist, 'account', 'id'); //print_r($salesaccountlist);exit; $platformList = CommonModel::getPlatformInfo(); //获取平台帐号 $platformList = reverse_array($platformList, 'platform', 'id'); $this->smarty->assign('shipingtypelist', $shipingtyplist); $this->smarty->assign('salesaccountlist', $salesaccountlist); $this->smarty->assign('platformList', $platformList); foreach ($billlist as $key => $valbil) { $tracknumber = ''; $str_info = OmAvailableModel::getTNameList("wh_order_tracknumber", "tracknumber", "where shipOrderId='{$valbil['id']}' and is_delete=0"); if (!empty($str_info)) { $tracknumber = $str_info[0]['tracknumber']; } $billlist[$key]['tracknumber'] = $tracknumber; $originOrder_arr = array(); $originOrder_str = ''; $originOrder_info = OmAvailableModel::getTNameList("wh_shipping_order_relation", "originOrderId", "where shipOrderId='{$valbil['id']}'"); if (!empty($originOrder_info)) { foreach ($originOrder_info as $originOrder) { $originOrder_arr[] = $originOrder['originOrderId']; } $originOrder_str = implode(',', $originOrder_arr); } $billlist[$key]['originOrder'] = $originOrder_str; //运输方式 $billlist[$key]['shipingname'] = $shipingtyplist[$valbil['transportId']]; //包材 $billlist[$key]['materName'] = $materInfo[$valbil['pmId']]; //平台 $billlist[$key]['platformName'] = $platformList[$valbil['platformId']]; //销售账号 $billlist[$key]['salesaccountinfo'] = $salesaccountlist[$valbil['accountId']]; } if ($rownumber > $pagesize) { //分页 $pagestr = $pager->fpage(array(0, 2, 3, 4, 5, 6, 7, 8, 9)); } else { $pagestr = $pager->fpage(array(0, 2, 3)); } $this->smarty->assign('pagestr', $pagestr); $this->smarty->assign('billlist', $billlist); //发货单列表 $this->smarty->assign('secnev', 3); $libstu_obj = new LibraryStatusModel(); //出库状态类型 $libstatuslist = $libstu_obj->getAllLibStatusList(' and groupId in (4 ,5)'); $this->smarty->assign('outstatuslist', $libstatuslist); $toptitle = '订单查询'; //头部title $this->smarty->assign('toptitle', $toptitle); $storeId = isset($_GET['storeId']) ? intval($_GET['storeId']) : 0; if ($storeId == 1) { $navlist = array(array('url' => '', 'title' => '出库'), array('url' => '', 'title' => '发货单查询'), array('url' => '', 'title' => 'A仓发货单')); } elseif ($storeId == 2) { $navlist = array(array('url' => '', 'title' => '出库'), array('url' => '', 'title' => '发货单查询'), array('url' => '', 'title' => 'B仓发货单')); } else { $navlist = array(array('url' => '', 'title' => '出库'), array('url' => '', 'title' => '发货单查询')); } $this->smarty->assign('navlist', $navlist); $toplevel = 2; //一级菜单的序号 0 开始 $this->smarty->assign('toplevel', $toplevel); $secondlevel = isset($_GET['secondlevel']) ? trim($_GET['secondlevel']) : ''; if (empty($secondlevel)) { $secondlevel = '21'; //当前的二级菜单 } $this->smarty->assign('secondlevel', $secondlevel); $this->smarty->assign('platLists', $_SESSION['platformList']); $this->smarty->assign('accounts', $_SESSION['accountList']); $this->smarty->assign('shippingList', $_SESSION['shippingList']); $this->smarty->display('dispatchbillquery.htm'); }
public function view_invList() { $now_time = date("Y-m-d H:i:s", time()); $state = isset($_GET['state']) ? post_check($_GET['state']) : ''; $this->smarty->assign('state', $state); $reason = array(); $invPeople = isset($_GET['invPeople']) ? $_GET['invPeople'] : ''; $sku = isset($_GET['sku']) ? post_check($_GET['sku']) : ''; $invType = isset($_GET['invType']) ? $_GET['invType'] : ''; $auditStatus = isset($_GET['auditStatus']) ? $_GET['auditStatus'] : 3; $startdate = isset($_GET['startdate']) ? post_check($_GET['startdate']) : ''; $enddate = isset($_GET['enddate']) ? post_check($_GET['enddate']) : ''; $InventoryAct = new InventoryAct(); $where = 'where storeId=1 '; if ($invPeople) { $where .= "and invPeople ='{$invPeople}' "; $this->smarty->assign('invPeople', $invPeople); } if ($sku) { $where .= "and sku ='{$sku}' "; $this->smarty->assign('sku', $sku); } if ($invType) { $where .= "and invType ='{$invType}' "; $this->smarty->assign('invType', $invType); } if ($auditStatus != 3) { $where .= "and auditStatus ='{$auditStatus}' "; } $this->smarty->assign('auditStatus', $auditStatus); if ($startdate) { $starttime = strtotime($startdate); $where .= "and invTime >='{$starttime}' "; } else { $startdate = $now_time; } $this->smarty->assign('startdate', $startdate); if ($enddate) { $endtime = strtotime($enddate); $where .= "and invTime <='{$endtime}' "; } else { $enddate = $now_time; } $this->smarty->assign('enddate', $enddate); $total = $InventoryAct->act_getInvNum($where); $num = 80; //每页显示的个数 $page = new Page($total, $num, '', 'CN'); $where .= "order by sku, id " . $page->limit; $inventory_info = $InventoryAct->act_getInvRecordList('*', $where); if (!empty($_GET['page'])) { if (intval($_GET['page']) <= 1 || intval($_GET['page']) > ceil($total / $num)) { $n = 1; } else { $n = (intval($_GET['page']) - 1) * $num + 1; } } else { $n = 1; } if ($total > $num) { //输出分页显示 $show_page = $page->fpage(array(0, 2, 3, 4, 5, 6, 7, 8, 9)); } else { $show_page = $page->fpage(array(0, 2, 3)); } $this->smarty->assign('show_page', $show_page); //盘点原因 if (!empty($inventory_info)) { foreach ($inventory_info as $key => $info) { $reason_info = InvReasonModel::getInvReasonList("reasonName", "where id='{$info['reasonId']}'"); $reason[$info['id']] = $reason_info[0]['reasonName']; $sku_info = getSkuInfoBySku($info['sku']); $inventory_info[$key]['goodsCost'] = $sku_info['goodsCost']; $inventory_info[$key]['purchaseName'] = $sku_info['purchaseId'] ? getUserNameById($sku_info['purchaseId']) : '无'; $inventory_info[$key]['remark'] = $info['remark'] ? $info['remark'] : ''; //新增等待上架数量 add by Gary $tallyList = OmAvailableModel::getTNameList('wh_tallying_list', 'sum(ichibanNums) ichibanNums, sum(shelvesNums) shelvesNums', "where sku='{$info['sku']}' and tallyStatus=0 and is_delete = 0"); $ichibanNums = intval($tallyList[0]['ichibanNums']); $shelvesNums = intval($tallyList[0]['shelvesNums']); $inventory_info[$key]['wait_whself'] = $ichibanNums - $shelvesNums; } } $usermodel = UserModel::getInstance(); //盘点员 $iqc_user = $usermodel->getGlobalUserLists('global_user_id,global_user_name', "where a.global_user_job in(162,165)", '', ''); $this->smarty->assign('iqc_user', $iqc_user); $this->smarty->assign('inventory_info', $inventory_info ? $inventory_info : array()); $this->smarty->assign('reason', $reason); $navlist = array(array('url' => 'index.php?mod=skuStock&act=getSkuStockList', 'title' => '仓库'), array('url' => 'index.php?mod=inventory&act=inventory', 'title' => '盘点管理'), array('url' => 'index.php?mod=inventory&act=invList', 'title' => '盘点列表')); $toplevel = 0; //一级菜单的序号 0 开始 $this->smarty->assign('toplevel', $toplevel); $secondlevel = 04; //当前的二级菜单 $this->smarty->assign('secondlevel', $secondlevel); $this->smarty->assign('navlist', $navlist); $this->smarty->assign('toptitle', '盘点列表'); $this->smarty->assign('curusername', $_SESSION['userName']); $this->smarty->display('inventoryInfo.htm'); }
function act_syncOrder() { //手动同步旧系统订单至新系统 $orderDatas = isset($_GET['orderDatas']) ? $_GET['orderDatas'] : ""; if (!$orderDatas) { self::$errCede = '002'; self::$errMsg = '参数为空!'; return false; } $orderDatas = json_decode($orderDatas, true); foreach ($orderDatas as $key => $order) { $where = "id={$order['order']['id']}"; $msg1 = OmAvailableModel::getTNameList("om_unshipped_order", "*", $where); $msg2 = OmAvailableModel::getTNameList("om_shipped_order", "*", $where); if ($msg1 || $msg2) { self::$errMsg .= "订单{$order['order']['id']}已存在!"; unset($orderDatas[$key]); } } $log_data = ''; $tablekeys = array(); $tabledatas = array(); foreach ($orderDatas as $odk => $orderD) { if (!isset($orderD['order']['orderStatus'])) { //var_dump($orderD,$orderD['order'],$orderD['order']['orderStatus']);//exit; //echo "no status{$orderD['order']['id']}\n"; } //'orderStauts'=>900, //0 //'orderType'=>21, //2 $tou = $orderD['order']['orderStatus'] == 900 && $orderD['order']['orderType'] == 21 ? 'om_shipped_' : 'om_unshipped_'; foreach ($orderD as $dk => $dataL) { if ($dk == 'orderDetail') { foreach ($dataL as $ssdata) { foreach ($ssdata as $tkey => $tdata) { //var_dump($tkey, $tdata); $tablekeys[$tou . $tkey] = array_keys($tdata); $tabledatas[$tou . $tkey][] = '(' . implode(',', _array2strarray(array_values($tdata))) . ')'; //$log_data .= "INSERT INTO {$tkey} SET "._array2sql($tdata)."\n\n"; } } } else { $tou2 = in_array($dk, array('om_order_notes', 'om_order_tracknumber')) ? '' : $tou; $tablekeys[$tou2 . $dk] = array_keys($dataL); $tabledatas[$tou2 . $dk][] = '(' . implode(',', _array2strarray(array_values($dataL))) . ')'; } } } unset($orderDatas); //echo $log_data; $sql = ''; foreach ($tablekeys as $tablen => $tablekey) { //if (empty($tabledatas[$tablen])) var_dump($tabledatas[$tablen], $tabledatas); //INSERT INTO `valsun_ordermanage`.`om_unshipped_order` (`id`, `recordNumber`, `platformId`, `accountId`, `ordersTime`, `paymentTime`, `onlineTotal`, `actualTotal`, `transportId`, `marketTime`, `ShippedTime`, `orderStatus`, `orderType`, `orderAttribute`, `pmId`, `isFixed`, `channelId`, `calcWeight`, `calcShipping`, `orderAddTime`, `isSendEmail`, `isNote`, `isCopy`, `isSplit`, `combinePackage`, `combineOrder`, `isBuji`, `isLock`, `lockUser`, `lockTime`, `storeId`, `is_delete`) VALUES (NULL, 'fds', '', '', '', '', '0.00', '0.00', '', NULL, NULL, '', NULL, '1', NULL, '2', NULL, '0.000', '0.000', '', '0', '0', '0', '0', '0', '0', '0', '0', NULL, NULL, '1', '0'); //$sql = "INSERT INTO {$tablen}(".implode(',', $tablekey).") VALUES ".implode(',', $tabledatas[$tablen]).";\n"; $key = implode(',', $tablekey); $value = implode(',', $tabledatas[$tablen]); $info = OmAvailableModel::insertRowUseValue($tablen, $key, $value); if (!$info) { self::$errMsg .= "插入订单{$tabledatas[$tablen][0]}失败!"; } } if (self::$errMsg == "") { self::$errMsg = "所选订单已插入新系统!"; self::$errCode = '200'; return true; } else { self::$errCode = '002'; return false; } /*$info = orderAddModel::syncOrder($orderDatas); if($info){ self::$errCode = orderAddModel::$errCode; self::$errMsg = orderAddModel::$errMsg; return true; }else{ self::$errCode = orderAddModel::$errCode; self::$errMsg = orderAddModel::$errMsg; return false; }*/ }
public function view_getProductsCategoryAppointList() { $tName = 'pc_products_large_category_appoint'; $select = '*'; $where = "WHERE is_delete=0 "; $productsCategoryAppointList = OmAvailableModel::getTNameList($tName, $select, $where); foreach ($productsCategoryAppointList as $k1 => $v1) { $tName = 'pc_products_large_category'; $select = 'largeCategoryName,isOn'; $where = "WHERE is_delete=0 AND id={$v1['largeCategoryId']}"; $pplcLIst = OmAvailableModel::getTNameList($tName, $select, $where); $productsCategoryAppointList[$k1]['largeCategoryName'] = $pplcLIst[0]['largeCategoryName']; if (empty($pplcLIst) || $pplcLIst[0]['isOn'] == 2) { $productsCategoryAppointList[$k1]['off'] = 1; //表示无效 } } $this->smarty->assign('navlist', $navlist); $this->smarty->assign('onevar', 5); $this->smarty->assign('twovar', 518); $this->smarty->assign('title', '大类-工程师指派'); $this->smarty->assign('productsCategoryAppointList', empty($productsCategoryAppointList) ? array() : $productsCategoryAppointList); $this->smarty->display("productsLargeCategoryAppointList.htm"); }