public function view_internalBuySubmit()
 {
     //单据明细组装
     $newArrays = array();
     if (is_array($_POST)) {
         foreach ($_POST['sku'] as $pkey => $pvalue) {
             $shippingArr = array();
             $newArray['sku'] = $pvalue;
             $newArray['amount'] = $_POST['num'][$pkey];
             $newArray['cost'] = $_POST['price'][$pkey];
             //$shippingArr	        = explode("-",$_POST['shipping'][$pkey]);
             $newArray['positionId'] = $_POST['shippingId'][$pkey];
             //仓位ID
             $newArray['purchaseId'] = $_POST['purchaseId'][$pkey];
             $newArrays[] = $newArray;
         }
     }
     //单据表头数据组装
     $storeInfoArr = array();
     $invoiceTypeId = $_POST['ioTypeinvoiceChoose'];
     //出入库单据类型列表ID
     $this->where = " where id = {$invoiceTypeId}";
     $InternalIoSellManagement = new InternalIoSellManagementAct();
     $invoiceTypeArr = $InternalIoSellManagement->act_invoiceTypeList($this->where);
     $ioType = $invoiceTypeArr[0]['ioType'];
     if ($ioType == 0) {
         $ioType = 1;
         //出库类型
     } else {
         if ($ioType == 1) {
             $ioType = 2;
             //入库类型
         }
     }
     $userId = $_SESSION['userId'];
     //申请人ID (未转换)$_POST['userId']
     $ordersn = $_POST['ordersn'];
     //单据号(单据编码)
     $note = trim($_POST['noteInput']);
     //备注
     $paymentMethodsId = isset($_POST['paymentMethods']) ? $_POST['paymentMethods'] : 3;
     //付款方式
     $companyId = 1;
     //公司ID
     $storeId = 1;
     //出库ID
     $storeInfoArr['invoiceTypeId'] = $invoiceTypeId;
     $storeInfoArr['ioType'] = $ioType;
     $storeInfoArr['userId'] = $userId;
     $storeInfoArr['ordersn'] = $ordersn;
     $storeInfoArr['note'] = $note;
     $storeInfoArr['paymentMethodsId'] = $paymentMethodsId;
     $storeInfoArr['companyId'] = $companyId;
     $storeInfoArr['storeId'] = $storeId;
     //插入表头
     $whIoStoreAct = new WhIoStoreAct();
     $internalBuyList = $whIoStoreAct->act_addWhIoStoreForWh($storeInfoArr);
     //返回0 插入错误  返回刚刚插入的ID 成功  插入明细表
     if ($internalBuyList != 0) {
         //插入明细
         foreach ($newArrays as $insertVal) {
             $insertVal['iostoreId'] = $internalBuyList;
             //出入库单据编号(id)
             //一条一条插入
             $storeDetailList = $whIoStoreAct->act_addWhIoStoreDetailForWh($insertVal);
             //if($storeDetailList){
             //echo $insertVal['sku']."提交成功!"."<br>";
             //}
         }
         header("location:index.php?mod=internalIoSell&act=internalUseIostoreList");
     } else {
         header("location:index.php?mod=internalIoSell&act=internalBuyList");
     }
 }