Beispiel #1
0
 public function view_tmpReturnPros()
 {
     $tmpReturnProsAct = new TmpReturnProsAct();
     $productsAct = new ProductsAct();
     //ProductsAct
     //添加sku
     $type = isset($_GET['type']) ? $_GET['type'] : '';
     $sku = isset($_GET['sku']) ? post_check(trim($_GET['sku'])) : '';
     if ($type == 'add') {
         if (!empty($sku)) {
             $skuList = getSkuBygoodsCode($sku);
             if (empty($skuList)) {
                 $status = "{$_GET['sku']} 找不到对应料号";
                 header('Location:index.php?mod=products&act=tmpReturnPros&status=' . $status);
                 exit;
             }
             $sku = $skuList[0]['sku'];
             $whereProducts = "where sku='{$sku}' and productsStatus=3";
             $isExsit = $productsAct->act_getProductsCount($whereProducts);
             //查看添加的sku是否是pc_products中状态为3的(归还)
             $status = '';
             if ($isExsit > 0) {
                 //如果存在
                 $where = "where sku='{$sku}'";
                 $now = time();
                 $skuExistCount = $tmpReturnProsAct->act_getTmpReturnProsCount($where);
                 //查看添加的sku是否在退料临时表中存在
                 $flag = 0;
                 //标识是添加成功还是由于数量导致添加失败
                 if ($skuExistCount > 0) {
                     //如果存在
                     $productsCountArr = $productsAct->act_getProducts('productsCount', $whereProducts);
                     $productsCount = $productsCountArr[0]['productsCount'];
                     //该sku在products表中的数量
                     $skuCountArr = $tmpReturnProsAct->act_getTmpReturnPros("count", $where);
                     //该sku在退料临时表中的数量
                     $skuCount = $skuCountArr[0]['count'] + 1;
                     if ($skuCount > $productsCount) {
                         $flag = 1;
                         //改变标识变量,输出提示
                         $status = "添加失败,{$sku} 已经扫描过且数量达到上限";
                     } else {
                         $set = "set count='{$skuCount}',createdTime='{$now}'";
                         $tmpReturnProsAct->act_updateTmpReturnPros($set, "where sku='{$sku}'");
                     }
                 } else {
                     $userId = intval($_SESSION['userId']);
                     if ($userId <= 0) {
                         $status = "登陆超时,请重试";
                         header('Location:index.php?mod=products&act=tmpReturnPros&status=' . $status);
                         exit;
                     }
                     $tmpReturnProsAct->act_addTmpReturnPros("set sku='{$sku}',addUserId={$userId},createdTime='{$now}'");
                 }
                 if ($flag == 0) {
                     $status = $sku . ' 添加成功';
                 }
             } else {
                 $status = "添加失败,制作完成列表中找不到 {$sku}";
             }
         }
         header('Location:index.php?mod=products&act=tmpReturnPros&status=' . $status);
     }
     //展示tmp表中的记录
     $select = "*";
     $where = "WHERE returnType=1 order by createdTime desc";
     $tmpReturnProsList = $tmpReturnProsAct->act_getTmpReturnPros($select, $where);
     $navlist = array(array('url' => 'index.php?mod=products&act=getProductsComfirmList', 'title' => '产品制作'), array('url' => 'index.php?mod=products&act=tmpReturnPros', 'title' => '新品归还'));
     $this->smarty->assign('navlist', $navlist);
     $this->smarty->assign('onevar', 5);
     $this->smarty->assign('twovar', 56);
     $this->smarty->assign('show_page', $show_page);
     $this->smarty->assign('title', '新品归还');
     $this->smarty->assign('status', $status);
     if (!empty($tmpReturnProsList)) {
         $whInfoList = getWhInfo();
         //根据接口取得对应仓库信息
         $whArr = array();
         foreach ($whInfoList as $value) {
             if (intval($value['id']) > 0) {
                 $whArr[$value['id']] = $value['whName'];
             }
         }
         $countProsList = count($tmpReturnProsList);
         for ($i = 0; $i < $countProsList; $i++) {
             $sku = $tmpReturnProsList[$i]['sku'];
             $tName = 'pc_goods';
             $select = 'goodsName';
             $where = "WHERE sku='{$sku}'";
             $skuInfoList = OmAvailableModel::getTNameList($tName, $select, $where);
             $tmpReturnProsList[$i]['goodsName'] = $skuInfoList[0]['goodsName'];
             $tName = 'pc_goods_whId_location_raletion';
             $select = 'location,whId';
             $where = "WHERE sku='{$sku}'";
             $skuLocWhInfoList = OmAvailableModel::getTNameList($tName, $select, $where);
             $tmpReturnProsList[$i]['location'] = $skuLocWhInfoList[0]['location'];
             $tmpReturnProsList[$i]['whName'] = $whArr[$skuLocWhInfoList[0]['whId']];
         }
     }
     $this->smarty->assign('tmpReturnProsList', empty($tmpReturnProsList) ? array() : $tmpReturnProsList);
     $this->smarty->display("tmpReturnPros.htm");
 }
Beispiel #2
0
 public function view_applyReturnBill()
 {
     if (!isset($_SESSION['userId'])) {
         header('Location:index.php?mod=login&act=index');
     }
     $tmpReturnProsAct = new TmpReturnProsAct();
     $select = "*";
     $where = "";
     $productsList = $tmpReturnProsAct->act_getTmpReturnPros($select, $where);
     if (!empty($productsList)) {
         $jsonArr = array();
         $type = "reTurn";
         $uid = $_SESSION['userId'];
         $usename = $_SESSION['usename'];
         $jsonArr['type'] = $type;
         $jsonArr['uid'] = $uid;
         $jsonArr['usename'] = $usename;
         $jsonArr['skuList'] = $productsList;
         var_dump(json_encode($jsonArr));
     } else {
         echo 'no data';
     }
 }