<?php

require_once('../config.php');
$flagFile = APPLICATION_PATH . '/../data/log/jiedantiaozheng.lock';
if (@file_exists($flagFile)) {
    echo 'The running.'."\r\n";
    echo $flagFile."\r\n";
    //exit();
}

$full_path = "G:/baiducloud/百度云同步盘/工作电脑2016/F/工作文档/进口系统/2018年/沙田/处理/2022年/11月/16/SEC03650000032批次数据2.xlsx";



$titile = array(
    '单号' => 'order_code',
    '数量' => 'quantity',
    '条码' => 'product_barcode',
    '批次id' => 'ib_id',
    '货架'=>'huojia',
);
$resultArray = Common_Upload::readXlsFromTitle($full_path, $titile);

print_r($resultArray);

foreach ($resultArray as $k=>$row){
    $batch = Service_InventoryBatch::getByField($row['ib_id'],'ib_id');
    $new_quantity = $batch['ib_quantity']+$row['quantity'];
    $reason = $row['order_code']."截单返回库存:".$row['quantity'];
    echo $reason."\r\n";
    $inventoryProcess = new Service_InventoryProcess();
    $result = $inventoryProcess->adjustInventory($row['ib_id'], $new_quantity, $reason);
    var_dump($result);
    //exit;
}








/*$inventoryProcess = new Service_InventoryProcess();
$result = $inventoryProcess->adjustInventory($ib_id, $new_quantity, $reason);*/