Exemplo n.º 1
0
 public function act_checkSku()
 {
     $skus = $_POST['skus'];
     $skuarray = array();
     $skulists = explode(',', $skus);
     foreach ($skulists as $skulist) {
         list($sku, $num) = array_map('trim', explode('*', $skulist));
         $skuarray[] = "'{$sku}'";
         $skukeyarray[$sku] = array('sku' => $sku);
     }
     $skuarray = array_unique($skuarray);
     $skustr = "(" . implode(',', $skuarray) . ")";
     $goodslists = OmAvailableModel::getTNameList("pc_goods", "sku,goodsName", "where sku in {$skustr} and is_delete=0");
     if (empty($goodslists)) {
         self::$errCode = 201;
         self::$errMsg = "未找到对应的料号信息!";
         return false;
     } else {
         $res = array();
         $skukeyresult = array();
         $resultskus = array();
         foreach ($goodslists as $key => $goodslist) {
             $resultskus[$goodslist['sku']] = array('');
             $pname_info = GroupRouteModel::getSkuPosition("where a.sku='{$goodslist['sku']}' and b.is_delete=0");
             if (!empty($pname_info)) {
                 $pname = $pname_info[0]['pName'];
             } else {
                 $pname = null;
             }
             $goodslists[$key]['pName'] = $pname;
         }
         foreach ($goodslists as $goodslist) {
             $skukeyarray[$goodslist['sku']] = $goodslist;
         }
         foreach ($skukeyarray as $skukey) {
             $skukeyresult[] = $skukey;
         }
         $errorskus = array_diff_key($skukeyarray, $resultskus);
         $res['res_data'] = $skukeyresult;
         $res['res_errorsku'] = count($errorskus) > 0 ? true : false;
         self::$errMsg = "料号验证成功";
         return $res;
     }
 }
Exemplo n.º 2
0
 public function view_export()
 {
     $exportXlsAct = new PasteLabelAct();
     $exportXlsAct->act_export();
 }