$orderSn], null, '*'); if (!empty($itemList)) { foreach ($itemList as $it) { $itemId = $it['productId'] ?? 0; $ptItemId = $it['itemId'] ?? 0; $use[$itemId] = [ 'mainId' => $inMainId, 'itemId' => $itemId, 'ptItemId' => $ptItemId, ]; } } } $arr = array_keys($mainIdList); if (count($arr) > 1) { echo "不同门店的入库单\n"; return false; } if (empty($use)) { echo "没有花材需要盘点\n"; return false; } StockInDayClass::deleteByCondition(['mainId' => $inMainId]); foreach ($use as $info) { StockInDayClass::add($info); } $count = count($use); echo "OK {$count}个 \n"; } }