Exemplo n.º 1
0
     break;
 } else {
     foreach ($msg_array as $order_infos) {
         $sku_info = array();
         $true_sku = get_realskuinfo($order_infos['sku']);
         foreach ($true_sku as $sku => $num) {
             if (isset($sku_info[$sku])) {
                 $sku_info[$sku] = $sku_info[$sku] + $num;
             } else {
                 $sku_info[$sku] = $num;
             }
         }
         $order_detail = array();
         $sku_blag = false;
         foreach ($sku_info as $sku => $nums) {
             $position_arr = getPositionBySku($sku, $nums);
             if (empty($position_arr)) {
                 Log::write('料号' . $sku . '找不到仓位', Log::ERR);
                 $sku_blag = true;
                 break;
             }
             foreach ($position_arr as $position) {
                 $order_detail[] = array('sku' => $sku, 'amount' => $position['amount'], 'positionId' => $position['positionId'], 'pName' => $position['position']);
             }
         }
         if ($sku_blag) {
             continue;
         }
         if (count($order_detail) == 1) {
             $orderAttributes = 1;
         } else {
Exemplo n.º 2
0
         }
         foreach ($position_arr as $position) {
             if ($position['storeId'] != 1) {
                 $storeId = $position['storeId'];
             }
             $order_detail[] = array('itemTitle' => $itemTitle, 'itemPrice' => $itemPrice, 'combineSku' => $key, 'combineNum' => $combine_amount, 'sku' => $sku, 'amount' => $position['amount'], 'positionId' => $position['positionId'], 'pName' => $position['position'], 'storeId' => $position['storeId']);
             $info = WhProductPositionRelationModel::updateSkuScanNums($position['pId'], $position['positionId'], $position['amount'], 3);
             if (!$info) {
                 Log::write('update wh_product_position_relation :FAIL', Log::ERR);
                 OmAvailableModel::rollback();
                 $sku_flag = false;
             }
         }
     }
 } else {
     $position_arr = getPositionBySku($key, $infos['amount']);
     if (empty($position_arr)) {
         Log::write('订单' . $msg_array['orderData']['id'] . ' 料号' . $key . '库存不足', Log::ERR);
         CommonModel::callbackOrderSys($msg_array['orderData']['id'], "料号{$key}库存不足");
         $sku_flag = false;
         //break;
     }
     foreach ($position_arr as $position) {
         if ($position['storeId'] != 1) {
             $storeId = $position['storeId'];
         }
         $order_detail[] = array('itemTitle' => $infos['itemTitle'], 'itemPrice' => $infos['itemPrice'], 'combineSku' => '', 'combineNum' => '', 'sku' => $key, 'amount' => $position['amount'], 'positionId' => $position['positionId'], 'pName' => $position['position'], 'storeId' => $position['storeId']);
         $info = WhProductPositionRelationModel::updateSkuScanNums($position['pId'], $position['positionId'], $position['amount'], 3);
         if (!$info) {
             Log::write('update wh_product_position_relation :FAIL', Log::ERR);
             OmAvailableModel::rollback();