Пример #1
0
 public static function act_updateNewPostion()
 {
     $sku = isset($_GET['sku']) ? $_GET['sku'] : '';
     $location = isset($_GET['location']) ? $_GET['location'] : '';
     if (empty($sku)) {
         self::$errCode = 400;
         self::$errMsg = "sku参数有误!";
         return false;
     }
     if (empty($location)) {
         self::$errCode = 400;
         self::$errMsg = "sku参数有误!";
         return false;
     }
     $data = CommonModel::updateNewPostion($sku, $location);
     if ($data) {
         self::$errCode = 200;
         self::$errMsg = "更新成功!";
         return true;
     } else {
         self::$errCode = 400;
         self::$errMsg = "更新失败!";
         return false;
     }
 }
Пример #2
0
function updateSkuInfo($data)
{
    global $dbConn, $configArgument;
    $setContent = array2sql($data);
    $sql = "select count(*) as totalnum,purchasedays,safeStockDays,cycle_days from ow_stock where sku='{$data['sku']}'";
    $sql = $dbConn->execute($sql);
    $num = $dbConn->fetch_one($sql);
    $comObj = new CommonAct();
    $booknums = $comObj->getOrderSkuNum($data['sku']);
    //已订购库存
    if ($num['totalnum'] > 0) {
        $alertdays = $configArgument['onseadays'] + max($configArgument['stockreaddays'], $configArgument['shipredaydays']) + $configArgument['reshelfdays'] + $num['safeStockDays'] + $num['cycle_days'];
        //预警天数计算
        if ($data['everyday_sale'] != 0) {
            $days = ($data['virtual_stock'] + $data['onWayCount'] + $data['b_stock_cout'] + $booknums) / $data['everyday_sale'];
            $out_alert_days = $data['virtual_stock'] / $data['everyday_sale'];
            //可用天数
            if ($days < $alertdays) {
                $is_alert = 1;
            } else {
                $is_alert = 0;
            }
            if ($out_alert_days <= 5) {
                $out_alert = 1;
                //超卖控制
            } else {
                $out_alert = 0;
            }
        } else {
            $is_alert = 0;
            $out_alert = 0;
        }
        $sql = "update ow_stock set {$setContent}, is_alert='{$is_alert}',out_alert='{$out_alert}',booknums='{$booknums}' where sku='{$data['sku']}'";
    } else {
        $is_alert = 0;
        $out_alert = 0;
        $sql = "INSERT INTO `ow_stock`(`sku`,`everyday_sale`, `count`, `onWayCount`, `salensend`, `booknums`, `virtual_stock`, `b_stock_cout`,`is_alert`,out_alert) VALUES ('{$data['sku']}','{$data['everyday_sale']}','{$data['count']}','{$data['onWayCount']}','{$data['salensend']}','{$booknums}','{$data['virtual_stock']}','{$data['b_stock_cout']}','{$is_alert}','{$out_alert}')";
    }
    echo $sql . "\n";
    if ($dbConn->execute($sql)) {
        return 1;
    } else {
        echo $sql . "\n";
        return 0;
    }
}
Пример #3
0
 function act_getGoodsNum($where)
 {
     //调用model层获取数据
     $list = contentModel::getContentNum($where);
     if ($list) {
         return $list;
     } else {
         self::$errCode = contentModel::$errCode;
         self::$errMsg = contentModel::$errMsg;
         return false;
     }
 }
Пример #4
0
 /**
  * UserCompetenceAct::listAcc()
  * 查看所有采购帐号
  * @return array 
  */
 public function listAcc()
 {
     global $dbConn;
     $res = CommonAct::actGetPurchaseList(true);
     self::$errCode = CommonAct::$errCode;
     self::$errMsg = CommonAct::$errMsg;
     $type = $_POST["type"];
     $userIdArr = $_POST['userIdArr'];
     if ($type == "all" && count($userIdArr) > 1) {
         //批量添加
         $access_id = 0;
     } else {
         $sql = "SELECT power_ids from ph_purchases_access where user_id={$userIdArr[0]}";
         $sql = $dbConn->execute($sql);
         $powerInfo = $dbConn->fetch_one($sql);
         $access_id = $powerInfo['power_ids'];
     }
     $data = array("access_id" => $access_id, "data" => $res);
     return json_encode($data);
 }
 public function __construct()
 {
     parent::__construct();
     $this->smarty->template_dir = WEB_PATH . 'html/templates/ticket';
     //设置本功能所有页面的模板路径
 }
Пример #6
0
 /**
  * 构造函数
  */
 public function __construct()
 {
     parent::__construct();
 }
Пример #7
0
 public function act_ApplicationException($omOrderId, $content)
 {
     $tableName = "om_unshipped_order";
     $storeId = 1;
     if (!$omOrderId || !$content) {
         self::$errCode = '5806';
         self::$errMsg = 'param is error';
         return array();
     }
     $where = " WHERE id = " . $omOrderId . " AND orderStatus = " . C('STATESHIPPED');
     $returnStatus0 = array('orderStatus' => C('STATEINTERCEPTSHIP'), 'orderType' => C('STATEPENDING_APPEXC'));
     if (!OrderindexModel::updateOrder($tableName, $returnStatus0, $where)) {
         self::$errCode = '5807';
         self::$errMsg = 'update error';
         return false;
     }
     $insertOrderNoteDada = array('omOrderId' => $omOrderId, 'content' => $content, 'userId' => 0, 'createdTime' => time());
     if ($insertOrderNoteids = OrderAddModel::insertOrderNotesRow($insertOrderNoteDada)) {
         self::$errCode = '5808';
         self::$errMsg = 'insert Note error';
         return false;
     }
     self::$errCode = '200';
     self::$errMsg = 'sync success';
     return true;
 }
Пример #8
0
 public function view_checkSuperOrder_old()
 {
     //$purid          = $_SESSION[C('USER_AUTH_SYS_ID')];//采购员ID
     $purid = $_SESSION['sysUserId'];
     $pursename = $_SESSION['userCnName'];
     $orderListArr = CommonAct::getBigOrders_old($pursename);
     $orderListArr = json_decode($orderListArr, true);
     $orderList = $orderListArr["data"];
     //$data           = json_decode($orderList,true);
     /*
     		foreach($data as $k){
     			$skuInfo 	= $k['sku'];//sku详细信息
     			$sku     	= $skuInfo['sku'];
     			$warnInfo 	= PurchaseOrderAct::getWarnInfoBySku($sku);//获取每日均量、实际库存
     		}
     */
     //print_r($orderList);
     $this->smarty->assign("orderList", $orderList);
     $this->smarty->assign("skuInfo", $skuInfo);
     $this->smarty->assign("warnInfo", $warnInfo);
     $this->smarty->assign("purid", $purid);
     $this->smarty->assign("title", "超大订单审核");
     $this->smarty->display("checkSuperOrder_old.htm");
 }
Пример #9
0
 public static function act_getCategoryInfo($pid = '')
 {
     if (empty($pid) && $pid !== 0) {
         //支持前端js调用,优先直接传参
         $pid = $_GET['pid'];
     }
     $ret = CommonModel::getCategoryInfo($pid);
     if ($ret == false) {
         self::$errMsg = CommonModel::$errMsg;
         return false;
     }
     self::$errCode = 200;
     return $ret;
 }
Пример #10
0
 public function view_neutralExport()
 {
     $start = isset($_GET['start']) ? post_check($_GET['start']) : '';
     $end = isset($_GET['end']) ? post_check($_GET['end']) : '';
     $type = isset($_GET['type']) ? post_check($_GET['type']) : '';
     $start = strtotime($start);
     $end = strtotime($end);
     //$start	= 1356972800;
     //$end	= 1399972800;
     $where = " where is_delete = 0";
     if ($start != '') {
         $where .= " and feedbacktime >= '{$start}' ";
     }
     if ($end != '') {
         $where .= " and feedbacktime <= '{$end}' ";
     }
     if ($type == 'neutral') {
         $where .= " and (CommentType='Neutral' or status='21' or status='23')";
     } else {
         if ($type == 'negative') {
             $where .= " and (CommentType='Negative' or status='31' or status='32')";
         }
     }
     $condition = $where;
     $FBAct = new EbayFeedbackAct();
     $where .= " order by account,id ";
     $field = " distinct(sku) ";
     $fbkList = $FBAct->act_getOrderList($field, $where);
     $menuList = $FBAct->act_getEbayReasonCategoryInfo('*', 'order by id');
     $titlelist = array();
     $reasonlist = array();
     foreach ($menuList as $gtitle) {
         $titlelist[] = $gtitle['content'];
     }
     $reasonlist = $titlelist;
     $countReason = count($reasonlist);
     array_unshift($titlelist, '料号', '单价', '采购员');
     $fileName = ucfirst($type);
     $exporter = new ExportDataExcel("browser", $fileName . '_' . date('Y-m-d') . ".xls");
     $exporter->initialize();
     $exporter->addRow($titlelist);
     $comAct = new CommonAct();
     foreach ($fbkList as $v) {
         $sku = $v['sku'];
         if (!empty($sku)) {
             $countlist = array();
             for ($kk = 0; $kk < $countReason; $kk++) {
                 $reasonId = $reasonlist[$kk]['id'];
                 $condition .= " and reasonId = '{$reasonId}' and sku = '{$sku}'";
                 $count = $FBAct->act_getOrderList('count(*)', $condition);
                 $countlist[] = $count[0]['count(*)'];
             }
             $goodsInfo = $comAct->act_getGoodsInfo('goodsCost,purchaseId', " where sku = '{$sku}'");
             $price = $goodsInfo[0]['goodsCost'];
             $purchaseId = $goodsInfo[0]['purchaseId'];
             $purchaserInfo = $comAct->act_getPurchaserInfo('global_user_name', " where global_user_id = '{$purchaseId}'");
             $purchaser = $purchaserInfo[0]['global_user_name'];
             array_unshift($countlist, $sku, $price, $purchaser);
             $exporter->addRow($countlist);
         }
     }
     $exporter->finalize();
     exit;
 }
Пример #11
0
 public function addOrder()
 {
     global $dbConn;
     $dataArr = $_POST["dataArr"];
     $now = time();
     $status = 1;
     //未审核的订单
     $order_type = 4;
     //采购补单
     $warehouse_id = 1;
     $flag = array();
     $unOrderIdArr = array();
     $operater = $_SESSION['sysUserId'];
     $skuObj = new SkuAct();
     $skuComObj = new CommonAct();
     foreach ($dataArr as $item) {
         $price = PurchaseOrderModel::getPriceBySku($item['sku']);
         //SKU单价
         $partnerId = CommonAct::actgetPartnerIdBySku($item['sku']);
         //供应商ID
         $orderData = $this->getOrderSN($partnerId, $item['purchaseId'], 4);
         //判断同供应商、采购员跟踪号是否已存在
         $orderSN = $orderData['recordnumber'];
         if (isset($orderSN)) {
             //同一个供应商的订单已经存在
             $poid = $orderData['id'];
             $recordnumber = $orderSN;
         } else {
             $recordnumber = $this->autoCreateOrderSn($item['purchaseId'], 1);
             $sql = "INSERT INTO `ph_order`(`recordnumber`, `addtime`, `aduittime`,  `status`, `order_type`, `warehouse_id`, `purchaseuser_id`, `aduituser_id`, `partner_id`, `company_id`, `note`) VALUES ('{$recordnumber}',{$now},{$now},{$status},{$order_type},{$warehouse_id},{$item['purchaseId']},{$item['purchaseId']},{$partnerId},1,'异常到货采购补单')";
             if ($dbConn->execute($sql)) {
                 $poid = PurchaseOrderModel::getOrderIdByNum($recordnumber);
                 //根据跟踪号取采购主订单编号
             }
         }
         if (isset($poid)) {
             $sql = "select id totalNum from ph_order_detail where sku='{$item['sku']}' and po_id='{$poid}' ";
             $sql = $dbConn->execute($sql);
             $detailInfo = $dbConn->fetch_one($sql);
             if (isset($detailInfo['id'])) {
                 $sql = "update ph_order_detail set count=count+{$item['num']} WHERE id='{$poid}'";
             } else {
                 $sql = "insert into ph_order_detail (po_id,unOrderId,recordnumber,sku,count,price,stockqty) values ({$poid},'{$item['unOrderId']}','{$recordnumber}','{$item['sku']}',{$item['num']},{$price},'{$item['num']}')";
             }
             if ($dbConn->execute($sql)) {
                 $usql = "UPDATE `ph_sku_reach_record` SET `ordersn`='{$recordnumber}',operatime={$now}, operatorId={$operater},status = 1 WHERE id={$item['id']}";
                 //$skuObj->tallySkuRecord($item['sku'],$item['num'],1); // hold 住一部分数量
                 $dbConn->execute($usql);
                 $skuComObj->calcAlert($item['sku']);
                 $flag[] = 1;
                 $unOrderIdArr[] = $item["unOrderId"];
             } else {
                 $flag[] = 0;
             }
         }
     }
     //$pushObj = new CommonAct();
     //$pushObj->setTallyIsUse($unOrderIdArr);
     return json_encode($flag);
 }
Пример #12
0
function updateSkuInfo($data)
{
    global $dbConn;
    $comm = new CommonAct();
    $bookNum = $comm->getOrderSkuNum($data['sku']);
    $item = $data;
    if (isset($item['everyday_sale'])) {
        $alertNum = $item['stock_qty'] + $item['ow_stock'] + $bookNum - $item['salensend'] - $item['interceptnums'] - $item['autointerceptnums'] - $item['auditingnums'];
        $outalertNum = $item['stock_qty'] + $item['ow_stock'] - $item['salensend'] - $item['autointerceptnums'];
        if ($item['everyday_sale'] != 0) {
            $canUseDay = $alertNum / $item['everyday_sale'];
            if ($canUseDay < $item['alertDays']) {
                $isAlert = 1;
            } else {
                $isAlert = 0;
            }
            $outuseDay = $outalertNum / $item['everyday_sale'];
            if (isset($item['stockoutDays']) && $item['stockoutDays'] != 0) {
                $stockoutDays = $item['stockoutDays'];
            } else {
                $stockoutDays = 10;
            }
            if ($outuseDay < $stockoutDays) {
                $outAlert = 1;
            } else {
                $outAlert = 0;
            }
        } else {
            $outAlert = 0;
            $isAlert = 0;
        }
        $data['is_alert'] = $isAlert;
        $data['out_alert'] = $outAlert;
        $data['newBookNum'] = $bookNum;
    } else {
        $sql = "select * from ph_sku_statistics where sku='{$data['sku']}'";
        $sql = $dbConn->execute($sql);
        $skuitem = $dbConn->fetch_one($sql);
        $alertNum = $item['stock_qty'] + $item['ow_stock'] + $bookNum - $skuitem['salensend'] - $skuitem['interceptnums'] - $skuitem['autointerceptnums'] - $skuitem['auditingnums'];
        $outalertNum = $item['stock_qty'] + $item['ow_stock'] - $item['salensend'] - $item['autointerceptnums'];
        if ($skuitem['everyday_sale'] != 0) {
            $canUseDay = $alertNum / $skuitem['everyday_sale'];
            if ($canUseDay < $skuitem['alertDays']) {
                $isAlert = 1;
            } else {
                $isAlert = 0;
            }
            $outuseDay = $outalertNum / $skuitem['everyday_sale'];
            if (isset($skuitem['stockoutDays']) && $skuitem['stockoutDays'] != 0) {
                $stockoutDays = $item['stockoutDays'];
            } else {
                $stockoutDays = 10;
            }
            echo "可用天数" . $outuseDay . "超卖预警控制天数" . $stockoutDays . "\n";
            if ($outuseDay < $stockoutDays) {
                $outAlert = 1;
            } else {
                $outAlert = 0;
            }
        } else {
            $isAlert = 0;
            $outAlert = 0;
        }
        $data['is_alert'] = $isAlert;
        $data['out_alert'] = $outAlert;
        $data['newBookNum'] = $bookNum;
    }
    $setContent = array2sql($data);
    $sql = "select count(*) as totalnum from ph_sku_statistics where sku='{$data['sku']}'";
    $sql = $dbConn->execute($sql);
    $num = $dbConn->fetch_one($sql);
    if ($num['totalnum'] > 0) {
        $sql = "update ph_sku_statistics set {$setContent} where sku='{$data['sku']}'";
    } else {
        $sql = "insert into  ph_sku_statistics set {$setContent} ";
    }
    echo $sql . "\n";
    if ($dbConn->execute($sql)) {
        //$comm->calcAlert($data['sku'],"auto"); //自动更新判断预警
        return 1;
    } else {
        return 0;
    }
    //echo $sql;
}
Пример #13
0
 /**
  *功能:根据SKU返回生成订单需要的数据,如单价等等
  *@param $skulist 支持单个或数组
  *@return 存在返回:信息;不存在返回:false;
  *日期:2013/08/06
  *作者:王民伟
  */
 public static function getPurSkuInfo($skulist, $purid)
 {
     self::initDB();
     for ($i = 0; $i < count($skulist); $i++) {
         $sku .= "'" . $skulist[$i] . "',";
     }
     $res = CommonAct::actGetPurchaseAccess();
     //获取所属下的采购id
     $purid = $res['power_ids'];
     $sku = substr($sku, 0, strlen($sku) - 1);
     $sql = "SELECT g.sku, g.goodsCost, gp.partnerId as partnerid FROM pc_goods  g ";
     $sql .= " LEFT JOIN " . C('DB_PREFIX') . "goods_partner_relation gp ON g.sku = gp.sku ";
     $sql .= " WHERE g.sku IN ({$sku}) AND g.is_delete = 0  ";
     if (!empty($purid)) {
         $sql .= " AND g.purchaseId IN ({$purid}) ";
     }
     $query = self::$dbConn->query($sql);
     if ($query) {
         $rtn_data = self::$dbConn->fetch_array_all($query);
         if (!empty($rtn_data)) {
             return $rtn_data;
         } else {
             self::$errCode = "8004";
             self::$errMsg = "返回数据为空";
             return false;
         }
     } else {
         self::$errCode = "8001";
         self::$errMsg = "查询语句错误";
         return false;
     }
 }
Пример #14
0
				FROM 			' . $tableName . ' AS a 
				LEFT JOIN       ' . $tableName . '_detail AS b 
				ON 			    b.omOrderId = a.id
				WHERE			a.orderStatus = ' . C('STATESHIPPED') . '
				AND				a.orderType = ' . C('STATESHIPPED_APPLYPRINT') . ' 
				AND 			a.is_delete = 0
				AND 			a.storeId= ' . $storeId;
$order_sql = $dbConn->query($ordersql);
$orders_count = $dbConn->fetch_array($order_sql);
//var_dump($orders_count); echo "\n";
$page = 1;
$perpage = 2000;
$totalpage = ceil($orders_count['total_num'] / $perpage);
$time_start = time();
echo "\n=====[" . date('Y-m-d H:i:s', $time_start) . "]系统【推送打印数据给仓库系统】共有(" . $orders_count['total_num'] . ")个订单需要处理\n";
$CommonAct = new CommonAct();
while ($page <= $totalpage) {
    echo "总共{$totalpage}页---现在是第{$page}页\n";
    //$start_num  = ($page-1)*$perpage;
    $start_num = 0;
    $limit = " GROUP BY a.id ORDER BY a.id LIMIT {$start_num}, {$perpage}";
    $ordersql = 'SELECT         a.id
					FROM 			' . $tableName . ' AS a 
					LEFT JOIN       ' . $tableName . '_detail AS b 
					ON 			    b.omOrderId = a.id
					WHERE			a.orderStatus = ' . C('STATESHIPPED') . '
					AND				a.orderType = ' . C('STATESHIPPED_APPLYPRINT') . ' 
					AND 			a.is_delete = 0
					AND 			a.storeId= ' . $storeId . $limit;
    //echo $ordersql; echo "<br>";
    //exit;
Пример #15
0
 /**
  * 管理黑名单
  * @return   void
  */
 public function view_blackList()
 {
     $this->smarty->assign("title", "黑名单管理");
     $where = "  AND pp.status = '0' ";
     //黑名单
     //获取当前登录着可以看到的采购料号 add by guanyongjun 2013-11-18
     $res = CommonAct::actGetPurchaseAccess();
     if (empty($res['power_ids'])) {
         $uids = isset($_SESSION[C('USER_AUTH_SYS_ID')]) ? $_SESSION[C('USER_AUTH_SYS_ID')] : 0;
     } else {
         $uids = $res['power_ids'];
     }
     $where .= " AND pp.purchaseuser_id IN({$uids})";
     $keyword = post_check($_GET['keyword']);
     $type = post_check($_GET['type']);
     if ($keyword != '') {
         if ($type == "all") {
             $where .= " and (pp.`company_name` like '{$keyword}%' or pp.`username` like '{$keyword}%' or pp.`tel` like '{$keyword}%' or pp.`phone` like '{$keyword}%' or pp.`fax` like '{$keyword}%' or pp.`e_mail` like '{$keyword}%' or pp.`QQ` like '{$keyword}%' or pp.`AliIM` like '{$keyword}%' or pp.`address` like '{$keyword}%' or pp.`note` like '{$keyword}%' or pu.`global_user_name` like '{$keyword}%' )";
         } else {
             if ($type == 'purchaseuser') {
                 $where .= " and pu.`global_user_name` like '{$keyword}%' ";
             } else {
                 $where .= " and pp.`" . $type . "` like '{$keyword}%' ";
             }
         }
     }
     $this->smarty->assign("keyword", $keyword);
     $this->smarty->assign("type", $type);
     $this->smarty->assign("option_values", array("all", "company_name", "username", "tel", "phone", "e_mail", "QQ", "AliIM", "purchaseuser"));
     $this->smarty->assign("option_output", array("全部类型", "公司名称", "姓名", "电话", "移动电话", "电子邮件", "QQ", "阿里旺旺", "采购员"));
     $this->smarty->assign("option_selected", $type);
     $perNum = 20;
     $field = " pp.id,pp.company_name,ppt.category_name,pp.username,pp.`status`,pp.tel,pp.phone,pp.fax,pp.QQ,pp.AliIM,pp.e_mail,pp.shoplink,pp.address,pp.city,pp.email_status,pp.sms_status,pu.global_user_name as purchaser,pp.note,pc.company ";
     $list = PartnerAct::act_getPage($where, $field, $perNum, "", 'CN');
     $partnerList = $list[0];
     foreach ($partnerList as $key => $partner) {
         $partnerList[$key]['status'] = $partner['status'] == 0 ? '黑名单' : ($partner['status'] == 1 ? '正常' : '优质供应商');
         $partnerList[$key]['email_status'] = $partner['email_status'] == 1 ? '是' : '否';
         $partnerList[$key]['sms_status'] = $partner['sms_status'] == 1 ? '是' : '否';
     }
     $this->smarty->assign("pageIndex", $list[1]);
     $this->smarty->assign("searchResults", $list[2]);
     $this->smarty->assign("userLists", $partnerList);
     $this->smarty->assign("button_moveout", "移出黑名单");
     $this->smarty->display('manageBlackList.htm');
 }
Пример #16
0
 function act_getUnusualList()
 {
     $starttime = isset($_GET['instock_startTime']) ? $_GET['instock_startTime'] : '';
     // date("Y-m-d");//,'1354294861');
     $endtime = isset($_GET['instock_endTime']) ? $_GET['instock_endTime'] : '';
     // date("Y-m-d");//,'1375290061');
     $sku = isset($_GET['sku']) ? $_GET['sku'] : '';
     // 	$purid = isset ( $_GET['purid']) ? $_GET['purid']: '';
     $isconfirm = isset($_GET['isconfirm']) ? $_GET['isconfirm'] : '';
     // 待点货确认,已确认待处理
     $status = isset($_GET['status']) ? $_GET['status'] : '';
     // 处理结果: 采购已补单,取消订单,调整为零,二次录入
     $parnterid = isset($_GET['parnterid']) ? $_GET['parnterid'] : '';
     $page = isset($_GET['page']) ? $_GET['page'] : '1';
     $res = CommonAct::actGetPurchaseAccess();
     //获取所属下的采购id
     if (empty($res['power_ids'])) {
         $uids = isset($_SESSION[C('USER_AUTH_SYS_ID')]) ? $_SESSION[C('USER_AUTH_SYS_ID')] : 0;
     } else {
         $uids = $res['power_ids'];
     }
     $purid = $uids;
     $paramArr['method'] = 'wh.getUnusualOrderList';
     // API名称
     $paramArr['username'] = C('OPEN_SYS_USER');
     // 开放系统用户名
     $paramArr['format'] = 'json';
     // 数据格式
     $paramArr['v'] = '1.0';
     // 版本号
     $paramArr['abStatus'] = $status;
     $paramArr['isConfirm'] = $isconfirm;
     $paramArr['startTime'] = !empty($starttime) ? strtotime($starttime . " 00:00:00") : '';
     $paramArr['endTime'] = !empty($endtime) ? strtotime($endtime . " 23:59:59") : '';
     $paramArr['page'] = $page;
     $paramArr['sku'] = $sku;
     $paramArr['tracktime'] = "on";
     $paramArr['purid'] = base64_encode($purid);
     $start = time();
     //$unusualOrder = callOpenSystem($paramArr, "local");
     $unusualOrder = callOpenSystem($paramArr);
     print_r($unusualOrder);
     $end = time();
     $consumetime = $end - $start;
     echo "consumetime:" . $consumetime;
     return $unusualOrder;
 }
Пример #17
0
 public function addNewOrder()
 {
     global $dbConn;
     $skulist = $_POST['skulist'];
     //$purchaseId = $_SESSION[C('USER_AUTH_SYS_ID')];//采购员ID
     $purchaseId = $skulist[0]["cguserId"];
     //采购员ID
     $comid = $_SESSION[C('USER_COM_ID')];
     //公司ID
     $skuComObj = new CommonAct();
     //重新计算这个sku 的已订购数量
     $purchaseOrder = new PurchaseOrderAct();
     $rollback = false;
     foreach ($skulist as $sku) {
         $price = $sku['price'];
         //SKU单价
         $partnerId = $purchaseOrder->getPartnerId($sku['sku']);
         //供应商ID
         $partnerId = $partnerId['partnerId'];
         $storeid = 1;
         //仓库ID
         $orderData = $purchaseOrder->getOrderSN($partnerId, $purchaseId);
         //判断同供应商、采购员跟踪号是否已存在
         $orderSN = $orderData['recordnumber'];
         $main = array();
         $detail = array();
         if (!empty($orderSN)) {
             //存在符合条件的跟踪号,直接插入采购订单明细
             $detail['sku'] = $sku['sku'];
             $detail['price'] = $price;
             //单价
             $detail['count'] = $sku['rec'];
             //采购数量
             $detail['goods_recommend_count'] = $sku['rec'];
             //采购数量
             $dataSet = array2sql($detail);
             $sql = "insert into ph_order_detail set {$dataSet}  ";
             $dbConn->execute($sql);
         } else {
             //不存在符合条件的跟踪号重新生成
             $recordnumber = PurchaseOrderModel::autoCreateOrderSn($purchaseId, $comid);
             //生成对应公司的采购订单跟踪号
             if (!empty($recordnumber)) {
                 //生成采购订单号成功
                 $main['recordnumber'] = $recordnumber;
                 //跟踪号
                 $main['purchaseuser_id'] = $purchaseId;
                 //采购员ID
                 $main['warehouse_id'] = $storeid;
                 //仓库ID
                 $main['partner_id'] = $partnerId;
                 //供应商ID
                 $main['company_id'] = $comid;
                 //公司编号
                 $dataSet = array2sql($main);
                 $sql = "insert into ph_order set {$dataSet}  ";
                 $dbConn->execute($sql);
                 if ($rtnmain) {
                     //主订单添加成功
                     $detail['sku'] = $sku['sku'];
                     $detail['price'] = $price;
                     //单价
                     $detail['count'] = $sku['rec'];
                     //采购数量
                     $detail['goods_recommend_count'] = $sku['rec'];
                     //采购数量
                     $detail['recordnumber'] = $recordnumber;
                     $dataSet = array2sql($detail);
                     $sql = "insert into ph_order_detail set {$dataSet}  ";
                     $dbConn->execute($sql);
                     $skuComObj->calcAlert($detail['sku']);
                     //重新计算已订购数量
                 }
             }
         }
     }
 }
Пример #18
0
 public function view_index()
 {
     $searchWhere = "1";
     $flag1 = false;
     $flag2 = false;
     $searchGet = array_map("trim", $_GET);
     if (isset($searchGet["type"]) && !empty($searchGet["type"])) {
         $this->smarty->assign("type", $searchGet["type"]);
         $flag1 = true;
     }
     if (isset($searchGet["keyWord"]) && !empty($searchGet["keyWord"])) {
         $this->smarty->assign("keyWord", $searchGet["keyWord"]);
         $flag2 = true;
     }
     if ($flag1 && $flag2) {
         if ($searchGet["type"] == "sku") {
             $searchWhere .= ' AND pd.' . $searchGet["type"] . '="' . $searchGet["keyWord"] . '"';
         } else {
             $searchWhere .= ' AND (po.' . $searchGet["type"] . ' like "' . $searchGet["keyWord"] . '%"';
             $searchWhere .= ' OR po.' . $searchGet["type"] . ' like "%' . $searchGet["keyWord"] . '")';
         }
     }
     $flag1 = false;
     $flag2 = false;
     $flag3 = false;
     if (isset($searchGet["status"]) && !empty($searchGet["status"])) {
         $this->smarty->assign("status", $searchGet["status"]);
         $flag1 = true;
     }
     if (isset($searchGet["starTime"]) && !empty($searchGet["starTime"])) {
         $this->smarty->assign("starTime", $searchGet["starTime"]);
         $flag2 = true;
         $startTime = strtotime($searchGet["starTime"] . " 00:00:00 ");
     }
     if (isset($searchGet["endTime"]) && !empty($searchGet["endTime"])) {
         $this->smarty->assign("endTime", $searchGet["endTime"]);
         $flag3 = true;
         $endTime = strtotime($searchGet["endTime"] . " 23:59:59 ");
     }
     if ($flag1 && $flag2 && $flag3) {
         $searchWhere .= ' AND po.' . $searchGet["status"] . '  BETWEEN "' . $startTime . '" AND "' . $endTime . '"';
     }
     if (isset($searchGet["search-pur"]) && !empty($searchGet["search-pur"])) {
         $this->smarty->assign("search_pur", $searchGet["search-pur"]);
         $searchWhere .= ' AND po.purchaseuser_id = "' . $searchGet["search-pur"] . '"';
     }
     if (isset($searchGet["paystatus"]) && !empty($searchGet["paystatus"])) {
         $this->smarty->assign("paystatus", $searchGet["paystatus"]);
         $searchWhere .= ' AND po.paystatus = "' . $searchGet["paystatus"] . '"';
     }
     $powerlist = commonAct::actGetPurchaseAccess();
     //获取采购订单显示权限
     $con = '';
     if ($powerlist != '') {
         $powerinfo = $powerlist['power_ids'];
         $searchWhere .= " AND po.purchaseuser_id in (" . $powerinfo . ")";
         $con .= $powerinfo;
     }
     $PO = new PaymentOrderAct();
     $waitpay = $PO->countByStatus(2, $con);
     //等待付款
     $haspay = $PO->countByStatus(3, $con);
     //已付款
     $orderListPage = $PO->getOrderList($searchWhere);
     $purchaseList = CommonAct::actGetPurchaseList();
     $this->smarty->assign('purchaseList', $purchaseList);
     //采购列表
     $this->smarty->assign("waitpay", $waitpay);
     $this->smarty->assign("haspay", $haspay);
     $this->smarty->assign("orderList", $orderListPage[0]);
     $this->smarty->assign("fpage", $orderListPage[1]);
     $this->smarty->display("paymentOrder.htm");
 }